DOSBOX-X 错误:换行符向右偏移

问题描述

我有一个很短的汇编 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,','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) 以巨大的偏移量打印。看图

problem

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

解决方法

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

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

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

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

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...