⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writecolors.asm

📁 在MASM6.15上
💻 ASM
字号:
TITLE Writing Text Colors              (WriteColors.asm)

; Demonstration of WriteConsoleOutputCharacter,
; and WriteConsoleOutputAttribute functions.
; Last update: 9/28/01

INCLUDE Irvine32.inc
.data
outHandle    DWORD ?
cellsWritten DWORD ?
xyPos COORD <10,2>

; Array of character codes:
buffer BYTE 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
	   BYTE 16,17,18,19.20
BufSize = ($ - buffer)
; Array of attributes:
attributes WORD 0Fh,0Eh,0Dh,0Ch,0Bh,0Ah,9,8,7,6
           WORD 5,4,3,2,1,0F0h,0E0h,0D0h,0C0h,0B0h

.code
main PROC

; Get the Console standard output handle:
	INVOKE GetStdHandle,STD_OUTPUT_HANDLE
	mov outHandle,eax

; Set the colors from (10,2) to (30,2):
INVOKE WriteConsoleOutputAttribute,
	  outHandle, ADDR attributes,
	  BufSize, xyPos,
	  ADDR cellsWritten

; Write character codes 1 to 20:
	INVOKE WriteConsoleOutputCharacter,
	  outHandle, ADDR buffer, BufSize,
	  xyPos, ADDR cellsWritten

	call ReadChar
	exit
main ENDP
END main

⌨️ 快捷键说明

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