Is it possible to write to address 0x0b800 (text/video memory) on real mode ? or do I need to switch to protected mode ?
Thanks in advance
Video memory and Real Mode ?
yes
use
where B800h is the segment and offset is 0
because in real mode addresses are segment shifted left 4 bits + offset
shifting left 4 bits is the same thing as multiplying by 10h (16 in decimal)
800h shifted left by 4 becomes B8000h + offset 0
(B800h*10h)+0h=B8000h
^same thing as above
use
Code: Select all
mov byte [B800h:0], 'a'
because in real mode addresses are segment shifted left 4 bits + offset
shifting left 4 bits is the same thing as multiplying by 10h (16 in decimal)
800h shifted left by 4 becomes B8000h + offset 0
(B800h*10h)+0h=B8000h
Code: Select all
mov ds, B800h
mov byte [0], 'a'
Ah, thanks I knew It was simple but the kernels I have previously coded were already in pmode + I used C. Im attempting to make a real mode OS (Don't care much about the memory limits). So far I managed to make bootsector load the kernel and save itself to HDD.Gizmo wrote:yes
usewhere B800h is the segment and offset is 0Code: Select all
mov byte [B800h:0], 'a'
because in real mode addresses are segment shifted left 4 bits + offset
shifting left 4 bits is the same thing as multiplying by 10h (16 in decimal)
800h shifted left by 4 becomes B8000h + offset 0
(B800h*10h)+0h=B8000h^same thing as aboveCode: Select all
mov ds, B800h mov byte [0], 'a'
Edit: after trying that code it says:
error: invalid segment override
the same error I got when I was trying
mov B800h, 'c'
Try
Code: Select all
mov ax,0xB800
mov es,ax
mov byte [es:0],'a'
ye thats what I tried in the first place and it did compile but I don't see the character even after adding the attribute byteDex wrote:TryCode: Select all
mov ax,0xB800 mov es,ax mov byte [es:0],'a'
Code: Select all
mov ax,0xB800
mov es,ax
mov byte [es:0],'a'
mov ax,0xB800
mov es,ax
mov byte [es:1],07h
btw Dex terrific job you've done with DexOS
edit: hehe.. im such an idiot my original code or the one Dex posted was working but I missed it on the screen.. I need to get myself some glasses eh ?
Thanks guys.
I have done that myself and thanks for comment on DexOS.
As a side note, i written a small realmode OS, as a OS tut, it's open source and fully commented, it a basic Dos clone, that can run some old Dos games.
The idea is everyone that leans from it, can add another int 21h function, or it may help you with your OS.
Its called MiniDos you can get it here: http://board.flatassembler.net/topic.php?t=5275&start=0
As a side note, i written a small realmode OS, as a OS tut, it's open source and fully commented, it a basic Dos clone, that can run some old Dos games.
The idea is everyone that leans from it, can add another int 21h function, or it may help you with your OS.
Its called MiniDos you can get it here: http://board.flatassembler.net/topic.php?t=5275&start=0
Ye that will definitely come in useful... A DOS clone is exactly what Im attempting to write but I failed to find any source code (not that I looked for more than 10 minutes, I'll admit to that) that might tell me how the internal workings tick on DOS.Dex wrote:I have done that myself and thanks for comment on DexOS.
As a side note, i written a small realmode OS, as a OS tut, it's open source and fully commented, it a basic Dos clone, that can run some old Dos games.
The idea is everyone that leans from it, can add another int 21h function, or it may help you with your OS.
Its called MiniDos you can get it here: http://board.flatassembler.net/topic.php?t=5275&start=0
Thanks again.