News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

bootloader

Started by mabdelouahab, February 21, 2017, 07:47:20 PM

Previous topic - Next topic

mabdelouahab

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)

johnsa

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.