flat assembler
Message board for the users of flat assembler.
Index
> Main > pmode code |
Author |
|
othername 09 Apr 2005, 22:09
forgot to write,
boot loader loads this code to memory, then jumps on. _________________ Sorry for my bad English |
|||
09 Apr 2005, 22:09 |
|
Giedrius 10 Apr 2005, 10:38
I don't know if that will help, but try to use or al,1 instead of or eax,1.
_________________ Better to rule in hell, than to be a slave in heaven... |
|||
10 Apr 2005, 10:38 |
|
othername 10 Apr 2005, 10:56
did'nt help.
I dont know much about how to read from disk, maby problem in bootloader? Code: KERNEL_START equ 1; Disk block where kernel starts KERNEL_SIZE equ 1; Kernel size in disk blocks KERNEL_SEGMENT equ 10000h; Segment where kernel will be loaded mov ax, 200h + KERNEL_SIZE push word KERNEL_SEGMENT pop es xor bx, bx mov cx, KERNEL_START + 1 mov dx, 0 int 13h jnc ok jmp $ ok: jmp KERNEL_SEGMENT:0 times 510 - ($ - $$) db 0 db 55h db 0aah _________________ Sorry for my bad English |
|||
10 Apr 2005, 10:56 |
|
MazeGen 10 Apr 2005, 12:50
Giedrius wrote: I don't know if that will help, but try to use or al,1 instead of or eax,1. Those two instructions are semanticaly identical - you always set the least significant bit. |
|||
10 Apr 2005, 12:50 |
|
othername 10 Apr 2005, 14:52
GOT it!!
i put org 0x07c00 on top of code. But iam stil a bit confused witch this "org" directive, can anybody tell me more about it _________________ Sorry for my bad English |
|||
10 Apr 2005, 14:52 |
|
Tomasz Grysztar 10 Apr 2005, 15:04
BTW, you can do it without manual opcodes:
Code: jmp pword 00001000b:0 label PM dword at $-6 |
|||
10 Apr 2005, 15:04 |
|
othername 10 Apr 2005, 19:09
X-0
What is this all about? _________________ Sorry for my bad English |
|||
10 Apr 2005, 19:09 |
|
bogdanontanu 10 Apr 2005, 21:45
ORG directive tells the assembler where to consider that the code will be loaded and executed aka at what addres will the code normaly run?
ORG 0x7C00 simply means that the code is expected to be loaded and run at address 7C00 hexa. For a boot code the BIOS will get it there and run it But that is another story: how does it get there? and who starts it's execution? It makes sense mainly for binary output. You do have to tell the assembler because otherwise how will it know the value of your data labels? Privalov decided that FASM will not move the location inside the output file acordingly. So as a consequence the ORG directive only affects the $ assembler location counter but not the position inside the output code. Luckyly this behaviour is exactly what is expected/needed for OS boot code. So your output code will still have only 512bytes and will not be filled by 07C00 x zeroes at start FYI TASM on MASM move the file pointer. |
|||
10 Apr 2005, 21:45 |
|
othername 11 Apr 2005, 16:25
now it's clear. thanks for help
_________________ Sorry for my bad English |
|||
11 Apr 2005, 16:25 |
|
PopeInnocent 13 Apr 2005, 00:46
Quote: mov sp,0xffff I might be drifting off-topic here, but since this is the general assembly-stuff forum, we should point out that it's a very bad idea to store the value 0xffff in SP. In 16-bit code, SP should be a multiple of 2; in 32-bit code, ESP should be a multiple of 4. An odd value in ESP means that the processor will have to split memory reads and write when a push or pop crosses a cache line boundary: a major performance hit. The following line would work well: mov sp,0xfffc |
|||
13 Apr 2005, 00:46 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.