color.asm

来自「字符背景颜色变幻」· 汇编 代码 · 共 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 + -
显示快捷键?