簡體   English   中英

組裝程序

[英]Assembly program

我想在Assembly中制作一個程序,該程序將從鍵盤讀取一個字符串,然后將每個字母轉換成另一個表,然后將其存儲在[201]的表中。 在[200],我有一個字符串的字符計數器。 這是我所做的:

mov [0300h],88h        ;thats the table that I want to convert to.(only 3 digits)

mov [0301h],83h

mov [0302h],0CEh


mov ah,01h                     ;insert string 
int 81h                   


mov di,01h                 

start: 
mov al,[di]  
cmp al,00h          ;not
    sure about that. last char of string
    should be /0.

je end                  
mov [0200h],di    ;char counter.    
inc di

mov bx,0300h      
sub al,041h
    ;convert char 
xlat 
mov [di+01ffh],al
    ;store converted char to 201...

loop start 

end:

**int 81h**
;reads chars until <cr> from keyboard.Starting  address of input data buffer             ES:DI+1

由於某種原因,DI在我的程序結束時取值為0900。 知道為什么它不起作用,或者我可以通過其他任何方式實現它嗎? 非常感謝。

mov al,[di]

您不應該在此處向輸入緩沖區添加偏移量嗎?

它太糟了..以示例為例(它認為int81的fn 1讀一個字符。不知道實際的接口):

some_table: db 88h, 83h, CEh
result:     db ??(128) // can't recall the syntax

push ds
pop  es
lea bx, some_table
lea di, result // for stosb to work

start: 
mov ah,01h                     ;//insert string 
int 81h                   
cmp al, 0Ah  // enter in linux (or it's 0Dh?)
je end                  
sub al, 'A' // what do you mean by "convert to char"? it's already a char. and what happens if it's larger than 'C'?
xlat 
stosb 
jmp start 
end:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM