如何在打印字母后删除垃圾?

时间:2013-10-06 10:15:09

标签: assembly nasm

我希望这段代码只打印'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;

1 个答案:

答案 0 :(得分:1)

mov dl, 'B';
mov ah, 2h;
int 21h;

int21 function 2h在控制台上将dl中的字节显示为char。