The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: mabdelouahab on February 21, 2017, 07:47:20 PM

Title: bootloader
Post by: mabdelouahab on February 21, 2017, 07:47:20 PM
In the past, I mention that I have made bootloader by Nasm,my Very small os, but it works
Are there samples in HJWasm (32/64)
Title: Re: bootloader
Post by: johnsa on March 13, 2017, 12:43:25 AM
Hey,

With the changes I implemented a few versions back yes.. I used it for exactly that purpose. I have a bios and pxe boot loader written in hjwasm which starts something like :



option flat:1
.code

use16

include bootconfig.asm

;--------------------------------------------------------------------------------
; Ensure the assembler generates 0 relative offsets for our later CS correction.
; -> Some PXE BIOSes will load the boot sector code to 0000:7c00 while others
; -> will load it to 07c0:0000. We move it to this in either event for
; -> simplicity and to ensure we can re-locate the code to a different segment
; -> without affecting the offsets.
;--------------------------------------------------------------------------------
org 0h

start:

db 0eah
dw offset cs_correction, 07c0h ; Hard-coded long jump to force cs:ofs correction.

;--------------------------------------------------------------------------------
; Configure Stack and Segment Registers.
;--------------------------------------------------------------------------------
cs_correction:
cld ; Ensure the direction flag is clear.
cli ; Switch off interrupts while we setup the stack.
mov ax,CONFIG_SPACE
mov fs,ax



You can make use of
option:flat

and use16, use32, use64 in the file to switch codegen types, things which were lacking in hjwasm imho when compared to something like fasm.