8086 汇编中文本用户界面的字符大小错误
Wrong character size for Text User Interface in 8086 assembly
我尝试用 DOS 的字符集制作一个简单的 TUI,但是当我写字符时,它们非常分离:
我尝试了几种文本模式都没有成功。 (我使用此页面作为参考:http://www.ctyme.com/intr/rb-0069.htm)
我使用 DOSBOX 和 NASM。
pd: 如果我的问题不清楚
我有这个:
我想要这个:
这是我的代码:
[bits 16]
org 0x100
segment .text
global main
main:
; Ajustamos el modo de video
mov ah,00h
mov al,04h ; I tried with 01h,03h
int 10h
; Dibujamos el campo de juego
call draw_ui
; Terminamos la apliacion
mov ah,00h
int 21h
draw_ui:
mov ah,02h ; Posicionamos el cursor
mov dh,6 ; en la esquina superior
mov dl,17 ; izquierda del campo de
mov bh,0x0
int 10h ; juego.
mov ah,02h ; Imprimimos el caracter
mov dl,0xc9 ; correspondiente a la
int 21h ; esquina del campo
mov bl,6
call draw_top_ui
mov ah,03
int 10h
mov ah,02h
inc dl
mov bh,0x0
int 10h
mov ah,02h
mov dl,0xbb
int 21h
ret
draw_top_ui:
mov ah,03 ; Obtenemos la posicon
int 10h ; del cursor
mov ah,02h ; Movemos el cursor una
inc dl ; columna a la derecha
mov bh,0x0
int 10h
mov ah,02h ; Imprimimos el caracter
mov dl,0xcd ; de la parte superiro
int 21h ; del campo de juego
dec bl ; hacemos esto 6 veces
jnz draw_top_ui
ret
mov ah,00h
mov al,04h
int 10h
模式04h不是文字画面!
尝试使用 01h,40x25 文本屏幕。
mov ah,03
int 10h
mov ah,02h
inc dl
int 10h
读写光标位置时,必须在BH
寄存器中指定显示页!使用 BH=0.
主要问题当然是你用DOS输出字符
DOS 已经将光标向右移动了! 然后你第二次递增它。这会在字符之间产生额外的 space 。
如果你执意要自己管理光标位置,那就用BIOS的字符输出函数0Ah吧。这个不会自动更新光标。
我尝试用 DOS 的字符集制作一个简单的 TUI,但是当我写字符时,它们非常分离:
我尝试了几种文本模式都没有成功。 (我使用此页面作为参考:http://www.ctyme.com/intr/rb-0069.htm)
我使用 DOSBOX 和 NASM。
pd: 如果我的问题不清楚
我有这个:
我想要这个:
这是我的代码:
[bits 16]
org 0x100
segment .text
global main
main:
; Ajustamos el modo de video
mov ah,00h
mov al,04h ; I tried with 01h,03h
int 10h
; Dibujamos el campo de juego
call draw_ui
; Terminamos la apliacion
mov ah,00h
int 21h
draw_ui:
mov ah,02h ; Posicionamos el cursor
mov dh,6 ; en la esquina superior
mov dl,17 ; izquierda del campo de
mov bh,0x0
int 10h ; juego.
mov ah,02h ; Imprimimos el caracter
mov dl,0xc9 ; correspondiente a la
int 21h ; esquina del campo
mov bl,6
call draw_top_ui
mov ah,03
int 10h
mov ah,02h
inc dl
mov bh,0x0
int 10h
mov ah,02h
mov dl,0xbb
int 21h
ret
draw_top_ui:
mov ah,03 ; Obtenemos la posicon
int 10h ; del cursor
mov ah,02h ; Movemos el cursor una
inc dl ; columna a la derecha
mov bh,0x0
int 10h
mov ah,02h ; Imprimimos el caracter
mov dl,0xcd ; de la parte superiro
int 21h ; del campo de juego
dec bl ; hacemos esto 6 veces
jnz draw_top_ui
ret
mov ah,00h mov al,04h int 10h
模式04h不是文字画面!
尝试使用 01h,40x25 文本屏幕。
mov ah,03
int 10h
mov ah,02h
inc dl
int 10h
读写光标位置时,必须在BH
寄存器中指定显示页!使用 BH=0.
主要问题当然是你用DOS输出字符
DOS 已经将光标向右移动了! 然后你第二次递增它。这会在字符之间产生额外的 space 。
如果你执意要自己管理光标位置,那就用BIOS的字符输出函数0Ah吧。这个不会自动更新光标。