我希望这段代码只打印'B',但是在'B'之后打印一些垃圾,如何删除垃圾?我正在使用NASM。
SECTION .data
num: db "" , '$' ; reserves 1 byte in memory
SECTION .text
org 0 x100 ; assembler directive
mov ax , 33 ; this is recommended number representation
mov cx , 33 ; works smooth , but not recommended
add ax , cx
mov [num] , al ; saves result to memory
mov dx , num
mov ah , 0x9 ; system interrupt
int 0x21 ; system interrupt for printing
mov ah , 0x4c ; last two lines are
int 0x21 ; synonymous to return 0;
答案 0 :(得分:1)
mov dl, 'B';
mov ah, 2h;
int 21h;
int21 function 2h在控制台上将dl中的字节显示为char。