Click here to Skip to main content
15,895,792 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
ASM
mov ah, 02
mov cl, 19
mov bh, 01
mov dl, 41
int 21
mov dh, dl
mov dl, 0a
int 21
mov dl, 0d
int 21
mov bl, cl
inc bh
inc dh
mov cl, bh
mov dl, dh
int 21
loop 011e
mov cl, bl
loop 010a
int 20


it has an output of
A
BB
CCC
DDDD
...
and so on up to 'Z'
i just need some explanation on cl,bh,and dh
thanks in advance and ill appreciate it if someone could explain it thoroughly
Posted

No!
I for one am not going to: it's just too much work!

Instead, sit down with a piece of paper and a pencil, and create a bunch of boxes - one for each register being used. Then go through the code and fill in the boxes as the instructions execute and change the values.
Slowly, it should be obvious what your two loops do, and how each instruction contributes to that.

The thing is that if you understand the assembly instructions and what they do, it's pretty obvious. If you don't, then you need to - and the only way you will do that is to execute them yourself and see what happens. And "hand-cranking" the code is probably the best way of doing that.

To add to that, we don;t even know exactly where anything is: your loops are to absolute addresses rather than labels, so we would have to guess what is where - and guessing is not a good solution to any computing problem.

If you didn't understand it, why did you write it? And more to the point, how?
 
Share this answer
 
Comments
Member 10548351 31-Jan-14 4:06am    
this is my first time taking this class so knowledge about this is close to zero
and i got this code from my friend who got it from his friend, i asked him if he could explain but he cant also
is there any tutorial website you could atleast recommend, i tried looking for it on my own but didnt find anything
OriginalGriff 31-Jan-14 4:19am    
Try it! Go through it as if you were the processor: it will mean you should understand atthe end.
Member 10548351 31-Jan-14 4:37am    
i will, after i do a little research on it
thanks for the advice too
I already provided an explanation, and pseudo code to solve the problem, at How Do I Get To Display This?[^].
 
Share this answer
 
Comments
Member 10548351 31-Jan-14 4:18am    
believe me i tried it all night, trying to figure it out and putting it on assembler but no luck.
if you can give me a site or a tutorial video where i can learn about this cl,bh,and dh
ill be happy to learn it on my own
Richard MacCutchan 31-Jan-14 4:32am    
There are plenty of sites that cover assembler programming, all you need to do is search for them.
Member 10548351 31-Jan-14 4:38am    
okay thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900