Answer the question
In order to leave comments, you need to log in
Can you explain parts of the code in assembler?
.model tiny
.code
.486
org 100h
.startup
a:xor ax,ax
int 16h
and ax,255
imul dx,ax,5
add dx,offset roman-'1'*5
mov ah,9
int 21h
jmp a
roman db 'I$$$$II$$$III$$IV$$$V$$$$VI$$$VII$$VIII$IX$'
end
Answer the question
In order to leave comments, you need to log in
Called int 16h with function code 0 (xor ax,ax is ax:=0). This is reading a character from the keyboard. Further, only the low byte is left in ax (aka AL, AH is cleared =0) (and ax, 0000000011111111b (=255)). In AL there will be a character code. It is multiplied by 5 and added to the offset at the beginning of the line, minus the offset for pressing 1 (i.e. if 1 is pressed, the initial offset of this line will be obtained, if 2 is supposed to be the initial offset plus 5, etc.). Taking into account that the line is connected 5 lines of 5 characters each, and the '$' symbol signals the end of the output (for function 09 of the DOS service), the address of the line with the Roman designation of the entered digit will be obtained (by idea). Further it is deduced by function 9 of interruption int 21h.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question