flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 18 Feb 2010, 07:19
You need this:
Code: FLAGS equ MODULEALIGN or MEMINFO |
|||
![]() |
|
LocoDelAssembly 18 Feb 2010, 07:22
Code: format elf public loader ; making entry point visible to linker extrn kmain ; kmain is defined elsewhere ; setting up the Multiboot header - see GRUB docs for details MODULEALIGN equ (1 shl 0) ; align loaded modules on page boundaries MEMINFO equ (1 shl 1) ; provide memory map FLAGS equ (MODULEALIGN or MEMINFO) ; this is the Multiboot 'flag' field MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header CHECKSUM equ (0 - MAGIC - FLAGS) ; checksum required section '.text' align 4 MultiBootHeader: dd MAGIC dd FLAGS dd CHECKSUM ; reserve initial kernel stack space STACKSIZE equ 0x4000 ; that's 16k. loader: mov esp, _stack+STACKSIZE ; set up the stack push eax ; pass Multiboot magic number push ebx ; pass Multiboot info structure call kmain ; call kernel proper cli hang: hlt ; halt machine should kernel return jmp hang section '.bss' align 4 _stack: ;stack is a reserved word so I prefixed it with "_" rb STACKSIZE ; reserve 16k stack on a doubleword boundary If you define constants with EQU make sure to always surround calculations with parentheses because otherwise you risk to have undesired results. Also note that in fasm you could use just "=" instead of EQU. The "=" is interpreted at assembler stage and has the ability to be forward referenced and parentheses are not needed since the value is calculated and stored like a variable rather than being just a chunk of text that is expanded anywhere it is referred. |
|||
![]() |
|
VelcroMan 18 Feb 2010, 07:49
LocoDelAssembly wrote:
Thank you. As i'm facing several problems with syntax i'll read through the FASM tutorials and the syntax parts in the manual. Just another question.. NASM's syntax isn't really "standard" compared to other intel-syntax assemblers, right? ![]() |
|||
![]() |
|
DOS386 22 Feb 2010, 08:38
VelcroMan wrote: another question.. NASM's syntax isn't really "standard" compared to other intel-syntax assemblers, right? There is none, see http://board.flatassembler.net/topic.php?t=9343 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.