如何使用 8086 汇编在图形模式下的特定位置打印一个字符?
How to print a char on a specific location in graphics mode using 8086 assembly?
我在 Windows.
上的 DOSBox 上使用 8086 程序集
我想在图形模式下打印一个字符,我知道它是这样的:
mov ah, 0eh ;0eh = 14
mov al, 'x'
xor bx, bx ;Page number zero
mov bl, 0ch ;Color is red
int 10h
上面的代码在屏幕顶部的左侧打印字母 'x'。
我不知道如何在屏幕的特定位置打印 'x' 字符。我应该怎么做才能在特定位置打印 'x'?
What should I do in order to print 'x' in specific location?
首先要知道,在图形屏幕上,BIOS 无法在您想要的任何 (X,Y) 位置打印您的角色。您只能在可以定位光标的每个 (Col,Row) 点上获取字符。
因此要在 320x200 256 色图形屏幕(模式 19)的中心显示 "x" 字符,您可以编写代码:
mov dl, 20 ;Column
mov dh, 12 ;Row
mov bh, 0 ;Display page
mov ah, 02h ;SetCursorPosition
int 10h
mov al, 'x'
mov bl, 0Ch ;Color is red
mov bh, 0 ;Display page
mov ah, 0Eh ;Teletype
int 10h
我在 Windows.
上的 DOSBox 上使用 8086 程序集
我想在图形模式下打印一个字符,我知道它是这样的:
mov ah, 0eh ;0eh = 14
mov al, 'x'
xor bx, bx ;Page number zero
mov bl, 0ch ;Color is red
int 10h
上面的代码在屏幕顶部的左侧打印字母 'x'。
我不知道如何在屏幕的特定位置打印 'x' 字符。我应该怎么做才能在特定位置打印 'x'?
What should I do in order to print 'x' in specific location?
首先要知道,在图形屏幕上,BIOS 无法在您想要的任何 (X,Y) 位置打印您的角色。您只能在可以定位光标的每个 (Col,Row) 点上获取字符。
因此要在 320x200 256 色图形屏幕(模式 19)的中心显示 "x" 字符,您可以编写代码:
mov dl, 20 ;Column
mov dh, 12 ;Row
mov bh, 0 ;Display page
mov ah, 02h ;SetCursorPosition
int 10h
mov al, 'x'
mov bl, 0Ch ;Color is red
mov bh, 0 ;Display page
mov ah, 0Eh ;Teletype
int 10h