【问题标题】:Enter string, display entered string and convert string upper case to lower case?输入字符串,显示输入的字符串并将字符串大写转换为小写?
【发布时间】:2012-12-07 20:33:14
【问题描述】:

我卡在输入字符串上,显示输入的字符串并将字符串大写转换为小写。

我必须使用emu8086.inc,但我不知道如何将下面的代码转换为接受字符串而不是数字/整数。有没有人愿意就此事进一步指导?

8086 asm 代码:​​

include 'emu8086.inc'

ORG    100h 

LEA    SI, msg1      
CALL   print_string   
CALL   scan_num       

MOV    AX, CX       

; print the following string:
CALL   pthis
DB  13, 10, 'You have entered: ', 0

CALL   print_num      

RET          

msg1   DB  'Enter the number: ', 0

DEFINE_SCAN_NUM
DEFINE_PRINT_STRING
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS 
DEFINE_PTHIS
END              

提前谢谢你。

【问题讨论】:

    标签: assembly x86 x86-16 assembly-resolution


    【解决方案1】:

    我不确定 emu8086.inc 包含哪些功能。

    在 Linux 系统上,您也许可以使用系统调用,但我不确定是否从未使用过 Linux。在 Windows 上,最好通过与 MSVCRT.dll 链接来包含像 scanf 这样的 C 函数,或者与 Kernell32.dll 链接的 Windows 提供的控制台函数(请参阅Console functions)。我会查看您的汇编程序文档,了解如何链接到 dll 并调用各个函数。 C 运行时 MSVCRT.dll 还包括将字符串转换为大写的函数“toupper”。 Windows 可能有类似的功能,但我不确定。

    【讨论】:

    • RTFM: itipacinotti.it/pagine/sistemi2008/documentation_emulator/… 看起来你需要get_string。 Linux 和/或 Windows 功能很好……但在 8086 上不行!
    • emu8086.inc 是一个库通用函数。要使用 emu8086.inc 中的任何函数,我们应该在源文件的开头包含以下行:include 'emu8086.inc'
    猜你喜欢
    • 1970-01-01
    • 2012-05-06
    • 1970-01-01
    • 1970-01-01
    • 2014-02-25
    • 1970-01-01
    • 1970-01-01
    • 2021-06-11
    • 2018-01-13
    相关资源
    最近更新 更多