Question

I am learning assembly programming using the debug, in particular, through DOSBox to emulate 8086 processors. I am trying to make a loop. When I write something similar to:

looplabel: instruction
..
..
loop looplabel

As this screenshot shows, I get an error:

enter image description here

Can you help me make a loop using debug tool (DOSBox) ??

Was it helpful?

Solution

debugis a rather old debugger. As such it doesn't allow you labes, and when you write code in it, it is directly written into the memory (reminds me of my beginning days :)).

So when you want to write something which is related to addresses, you have to specify the adresses directly.

In your case, you would have to remember the address 073f:0106 and when you want to jump or branch there, you use it, just as you would use a label.

-a
15E7:0100 mov si,0
15E7:0103 mov cx, 3
15E7:0106 mov al, [si]
15E7:0108 dec cx
15E7:0109 jne 15e7:0106
15E7:010B ret
15E7:010C
-

This is a very cumbersome way to write programs, because if you insert instrutions later, you might have problems moving the rest of the code and adjust the adresses.

If you want to learn assembly, then it would be better to use some assembler instead, for testing small code samples it is nice and easy way though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top