【问题标题】:DOSBOX-X Bug: newline is offset to the right [duplicate]DOSBOX-X Bug:换行向右偏移[重复]
【发布时间】:2021-08-12 07:31:20
【问题描述】:

我有一个很短的组装TASM程序:

IDEAL
MODEL small
STACK 100h
DATASEG

;creating all the messages
opening_message db 10, 'This is an encryption program.', 10, 'This program allows you to encrypt a message into giberish,', 10, 'send it to a friend, who can then decrypt it back into text$'


CODESEG
start:
    mov ax, @data
    mov ds, ax
; --------------------------
; Your code here
; --------------------------
    ;We clear the screen of dosbox
    mov ax, 13h
    int 10h
    mov ax, 2
    int 10h

    ;print opening message
    lea dx, [opening_message]
    mov ah, 9
    int 21h
exit:
    mov ax, 4c00h
    int 21h
END start

当我尝试在 DOSBOX-X 中运行程序时,最新版本,64 位,字符串中的换行符 (10) 以巨大的偏移量打印。看图

任何人都可以帮忙吗? 谢谢 附言 该程序在 vanilla dosbox 中运行良好

【问题讨论】:

    标签: assembly tasm dosbox


    【解决方案1】:

    DOSBox 遵循 DOS 规则,即要求回车 (13) 和换行 (10) 才能输出换行符。

    您的代码仅使用换行符,因此文本仅删除一行。

    opening_message db 13, 10, 'This is an encryption program.'
      db 13, 10, 'This program allows you to encrypt a message into giberish,'
      db 13, 10, 'send it to a friend, who can then decrypt it back into text', 13, 10, '$'
    

    ;We clear the screen of dosbox
    mov ax, 13h
    int 10h
    mov ax, 2
    int 10h
    

    为什么先设置图形屏幕 13h (320x200) 再设置文本屏幕 02h (80x25) ? 请注意,通常使用模式号 03h 设置 80x25 文本屏幕。

    【讨论】:

    • 谢谢,我是组装新手,这对我有帮助!
    • 我将屏幕设置为图形,然后返回文本以清除屏幕。有没有更好的办法?
    • @ItaiElidan 要清除屏幕,我们只需设置一次视频模式。由于 DOSBox 默认在屏幕模式 03h(文本 80x25)下运行,因此您只需要 mov ax, 0003h int 10h。 (先设置图形画面没有什么用,是多余的操作)
    猜你喜欢
    • 1970-01-01
    • 2020-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-12
    • 2020-03-31
    • 1970-01-01
    相关资源
    最近更新 更多