color.asm

来自「介绍用Java解析网络数据的三种特殊方法」· 汇编 代码 · 共 70 行

ASM
70
字号
; This sample prints 16x16 color map,
; it uses all possible colors.

#make_COM#

ORG     100h   

; set video mode:
; Text mode 40x25, 16 colors, 8 pages
MOV     AH, 0
MOV     AL, 0
INT     10h

; disable blinking:
MOV     AX, 1003h
MOV     BX, 0
INT     10h
               
               
MOV     DL, 0   ; current column.
MOV     DH, 0   ; current row.

MOV     BL, 0   ; current attributes.

JMP     next_char

next_row:
INC     DH
CMP     DH, 16
JE      stop_print
MOV     DL, 0

next_char:

; set cursor position at (DL,DH):
MOV     AH, 02h
INT     10h

MOV     AL, 'A'
MOV     BH, 0
MOV     CX, 1
MOV     AH, 09h
INT     10h

INC     BL      ; next attributes.

INC     DL
CMP     DL, 16
JE      next_row
JMP     next_char

stop_print:

; set cursor position at (DL,DH):
MOV     DL, 10  ; column.
MOV     DH, 5   ; row.
MOV     AH, 02h
INT     10h

; test of teletype output,
; it uses color attributes
; at current cursor position:
MOV     AL, 'X'
MOV     AH, 0Eh
INT     10h

RET

END

⌨️ 快捷键说明

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