首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DOSBOX: newline向右偏移

DOSBOX: newline向右偏移
EN

Stack Overflow用户
提问于 2021-05-23 21:27:46
回答 1查看 112关注 0票数 0

我有一个非常短的汇编TASM程序:

代码语言:javascript
复制
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(最新版本,64位)中运行程序时,字符串中的换行符(10)是以一个巨大的偏移量打印出来的。见图

有人能帮忙吗?谢谢P.S.这个程序在香草dosbox上运行得很好

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-23 21:34:33

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

您的代码只使用linefeed,因此文本只删除一行。

代码语言:javascript
复制
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, '$'

;我们清除dosbox,13h int 10hmovax,2int10h的屏幕。

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

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67664524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档