Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
suthers
Member
Posts: 672 Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:
Post
by suthers » Fri Feb 08, 2008 4:19 pm
When i use the following code to write to the screen:
Code: Select all
mov bx, 0B8140h
mov byte [ds:bx], 'T'
add bx, 1
mov byte [ds:bx], 1Bh
It assembles with the warning: word value exceeds bounds.
What would be a suitable alternative that would allow it to work.
Thanks in advance,
Jules
jerryleecooper
Member
Posts: 233 Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada
Post
by jerryleecooper » Fri Feb 08, 2008 4:50 pm
YOu are putting more data in bx than it can contain. It's no time for the omega point yet.
put 0xb814 into ds and 0 into bx.
segment addresses are << 4 to the other addresses.
Sorry for my poor english, English, I mean.
pcmattman
Member
Posts: 2566 Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:
Post
by pcmattman » Fri Feb 08, 2008 4:52 pm
Assuming real mode and therefore real mode segment interpretation:
Code: Select all
push ds
mov ds,0b800h
mov bx, 0140h
mov byte [ds:bx], 'T'
add bx, 1
mov byte [ds:bx], 1Bh
pop ds
Linear = seg << 4 + offset.
In Pmode, you can just use eax
.
Edit: Added pop ds to the code snippet.
suthers
Member
Posts: 672 Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:
Post
by suthers » Fri Feb 08, 2008 6:20 pm
Yah, I should of said that i was in protected mode.
Thanks i just used eax to store the address
Jules
jal
Member
Posts: 1385 Joined: Wed Oct 31, 2007 9:09 am
Post
by jal » Mon Feb 11, 2008 6:32 am
[quote="pcmattman"]
This should of course be
as mov ds does not take an immediate values as operand.
JAL
Dex
Member
Posts: 1444 Joined: Fri Jan 27, 2006 12:00 am
Contact:
Post
by Dex » Mon Feb 11, 2008 7:10 am
You could also use
Code: Select all
mov byte [ds:0xB8140], "T"
mov byte [ds:0xB8141], 1Bh
pcmattman
Member
Posts: 2566 Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:
Post
by pcmattman » Mon Feb 11, 2008 3:09 pm
jal: True, but I didn't want to just give away the answer as easily as that
.