Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建一个接受文件作为参数的 .com 程序。.com 程序将从命令行解释器执行。我打算用汇编语言编写程序。这是它应该如何工作的。假设程序DecToHex.com在用户输入的命令行(在 MSDOS 中)
DecToHex.com
DecToHex.com afile.dec
然后程序转换afile.dec为十六进制并创建另一个名为afile.hex
afile.dec
afile.hex
PS:这个要在MSDOS汇编语言中完成
IIRC,MSDOS 存储从 CS:0080h 开始的命令行参数。
您应该能够使用debug.exe dectohex.com infile outfile Then disassemble / dump memory from cs:0 来验证这一点并搜索字符串。
debug.exe dectohex.com infile outfile
正如弗兰克所提醒的那样,MSDOS 不知道 asciiz,它显然使用了 pascal 类型的字符串格式。必须逐字节解析字符串字节——我想命令行参数将按原样存在。例如。连续的空格不会被截断。