flat assembler
Message board for the users of flat assembler.
Index
> Main > Write to memory adress |
Author |
|
VelcroMan 14 Feb 2010, 08:55
Hi there, i'm looking at some documents regarding the video memory.
I'm experimenting with a small bootloader/bootsector. The document author uses nasm, and fasm's syntax is different in that case i think. In nasm you would write a character like this: Code: mov 0B8000, 'N' mov 0B8001, 1Bh I tried to rewrite it for fasm and ended up with this: Code: mov byte [0B8000h], 'N' mov byte [0B8001h], 1Bh Am i wrong with my rewrite here? The reason i'm asking is that i don't see the character, and i need to know if it's my character output that doesn't work, or if the bootloader stops earlier If that code is correct, i have a problem elsewhere. Here is the full code if anyone would like to help: http://pastebin.com/m662156c2 It builds without problems |
|||
14 Feb 2010, 08:55 |
|
VelcroMan 14 Feb 2010, 09:04
revolution wrote: I don't think you SS and DS are correct: Changing the value to 10h or similiar does not fix the problem. As the syntax is correct there must be a problem elsewhere. I don't really know where though.. This is document/tutorial i'm reading: http://www.osdever.net/tutorials/view/the-world-of-protected-mode |
|||
14 Feb 2010, 09:04 |
|
revolution 14 Feb 2010, 09:07
VelcroMan: There is lots of PM setup/entry code in this forum. Have you tried searching here? Lots of people have posted working code similar to yours.
|
|||
14 Feb 2010, 09:07 |
|
VelcroMan 14 Feb 2010, 09:30
I fixed the error(s) in the code so it works fine now.
I downloaded the sourcecode for the article and looked through it, and there were a few changes not shown in the article, so i hade a few errors. If anyone are interested, a working fasm version of http://www.osdever.net/tutorials/view/the-world-of-protected-mode is avliable here: http://pastebin.com/f2c5ee886 And thank you revolution for your help |
|||
14 Feb 2010, 09:30 |
|
asmmsa 14 Feb 2010, 10:11
bootloaders run in real mode, to u have to use segment registers to pass > 65k address.
try: mov ax,0xb800 mov ds,ax mov [0],0x1B70 |
|||
14 Feb 2010, 10:11 |
|
DOS386 14 Feb 2010, 12:02
asmmsa wrote: bootloaders run in real mode, to u have to use segment registers to pass > 65k address. Don't you see the code enabling PM ???? Code: mov byte [ds:0B8000h], 'N' mov byte [ds:0B8001h], 1Bh This is good, just the "ds:" prefix is unnecessary as it is the default anyway Code: mov esp, 90000h ;500h to 9FFFFh are free memory. This is good but unnecessary as long as you don't use the stack. Quote:
A few bits have different meaning Quote:
WRONG. http://www.sudleyplace.com/dpmione/expanddown.html Quote:
The MA$M syntax is horrible, again |
|||
14 Feb 2010, 12:02 |
|
asmmsa 14 Feb 2010, 13:39
Quote: This is good, just the "ds:" prefix is unnecessary as it is the default anyway Wink actually, fasm should add DS override prefix to instruction when writing ds: ok i didnt even saw this code, my mistake. db gdt_end - gdt should be - 1, its not size but sizie -1, for unknown reasons. # cli ;Disable interrups you dont disable int 2, it can appear as any other one. i belive you should do something witn port IO wich APIC to disable routing interrupts to current cpu, interrupt flag is useless, i think so. you should also check if cpu support protected mode, but only when you write something serious, here you dont have to. # mov ax, 08h ;Store the code segment adress in ax # mov ss, ax ;Fill the stack segment register with the adress # mov ds, ax ;Fill the data segment register with the adress you store 0x08 segment in ss and ds, it goes only to cs. # mov esp, 90000h ;500h to 9FFFFh are free memory. Our bootloader originates at 7C00h, so if we put our stack at 90000h we have enough memory (FFFFh) and out code have a lot of room why you assume this address holds ram, not memory mapped something? # hang: ;Hang the cpu # jmp hang try jmp $, shorter. or cli + hlt, shouldnt be interrupted, if nmi fires just use jmp $. |
|||
14 Feb 2010, 13:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.