Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Let's take for eg. the address 010h and register DS.

How can i access their values?

I have a function that prints numbers as a binary code ( because that's what i want ). I want to print the content as a binary and decimal code. Leave alone the decimal code, i will figure that out later.

How can i access the value at the address 010h? What about the value of the register DS?
I've searched the whole internet but... still i can't figure it out.

What I have tried:

This function only prints a number in binary. Insead of 010h it should be the content of the address 010h...
mov bl, 010h
mov cx, 8
print: mov ah, 2   ; print function.
       mov dl, '0'
       test bl, 10000000b  ; test first bit.
       jz zero
       mov dl, '1'
zero:  int 21h
       shl bl, 1
loop print
; print binary suffix:
mov dl, 'b'
int 21h
Posted
Comments
Richard MacCutchan 12-Oct-19 15:15pm    
But that is what you are printing. If you want the contents of address 010h then you need to put the address in an offset register, load the contents of the address and then print that. But printing as hex is much more useful than binary.

And ...
"I've searched the whole internet"
That is patently untrue, as it would take forever.
g0dafk 12-Oct-19 16:58pm    
Haha, you got me. By "the whole internet" i meant the first page of Google, cause no one ever dared to click on page 2.
Could you please provide me a website where i can read more about offset registers and load instructions? I don't fully understand that. What are some good instructions to look at and read about?
Richard MacCutchan 13-Oct-19 2:51am    
Just Google for whichever assembler version you are trying to work with. No idea what your previous search was for, but look at intel assembler - Google Search[^].

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