Assembly program
I want to make a program in Assembly that will read a string from keyboard then convert every letter throughout another table and then store it in a table at [201]. At [200] I have a char counter of my string. Here is what I have done:
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 开发者_JAVA百科data buffer ES:DI+1
For some reason DI takes value 0900 at the end of my programm. Any idea why it doesn't work, or any idea that I can make it by any other way? thanx a lot.
mov al,[di]
Shouldn't you add an offset to your input buffer here?
It's soo broken.. take a look at this as exemple (it considers that fn 1 of int81 reads a char. no idea of the actual interface) :
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:
精彩评论