console1.asm

来自「想学习汇编语言的」· 汇编 代码 · 共 40 行

ASM
40
字号
TITLE Win32 Console Example #1                    (Console1.asm)

; This program calls the following Win32 Console functions:
; GetStdHandle, ExitProcess, WriteConsole
; Last update: 1/20/02

INCLUDE Irvine32.inc

.data
endl EQU <0dh,0ah>		; end of line sequence
message  \
BYTE "-------------------- Console1.asm -----------------------"
BYTE endl,endl
BYTE "This program is a simple demonstration of console ",endl
BYTE "mode output, using the GetStdHandle and WriteConsole ",endl
BYTE "functions.",endl
BYTE "---------------------------------------------------------"
BYTE endl,endl,endl
messageSize = ($-message)

consoleHandle DWORD 0     ; handle to standard output device
bytesWritten  DWORD ?     ; number of bytes written

.code
main PROC
  ; Get the console output handle:
	INVOKE GetStdHandle, STD_OUTPUT_HANDLE
	mov consoleHandle,eax

  ; Write a string to the console:
	INVOKE WriteConsole,
	  consoleHandle,		; console output handle
	  ADDR message,       		; string pointer
	  messageSize,		; string length
	  ADDR bytesWritten,		; returns num bytes written
	  0		; not used

	INVOKE ExitProcess,0
main ENDP
END main

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?