Just making a simple OS as a beginner for my assembly project. I have this very simple bootloader which prints a character B and reads the second sector (kernel) from drive and loads it at 10000h memory address
.model tiny
ORG 7C00h
.code
start:
cli
mov ax, 07B0h
mov ss, ax
mov sp, 00FFh
sti
mov ax, cs
mov ds, ax
mov ah, 0Eh
mov al, 'B'
int 10h
; Reading kernel
mov ah, 02h
mov al, 1
mov ch, 0 ; cylinder
mov cl, 2
mov dh, 0 ; head
mov dl, 0
mov bx, 0
mov ax, 1000h
mov es, ax
int 13h
jc disk_error
mov ah, 0Eh
mov al, 'J'
int 10h
jmp es:[bx]
disk_error:
mov ah, 0Eh
mov al, 'E'
int 10h
db 510-($-start) dup(0)
dw 0AA55h
end start
I'm using qemu to test, it is printing B and J but not K or anything I try to print or do in kernel:
.model tiny
org 0
.code
start:
cli
mov ax, 07B0h
mov ss, ax
mov sp, 00FFh
sti
mov ax, cs
mov ds, ax
mov ah, 0Eh
mov al, 'K'
mov bh, 0
mov bl, 7
int 10h
jmp $
db 512 - ($ - start) dup(0)
end start
I can't find any resource which uses MASM to develop an OS all resources are on NASM which is not part of our course. Bootloader seems to work fine but can't seem to figure out if jmp is not working or if something's wrong in kernel file.
ahandal, which you set up forint 13h, are both part ofaxwhich you overwrite to initialisees. Change the order of writes soaxhas 0201h atint 13htime. (jmp es:[bx]is wrong too.)retf,iret, andjmpall can work, albeit using the correct forms for MASM may be more complicated than on NASM.jmp 1000h:0would be the correct direct/immediate far jump for NASM to setcsto 1000h andipto 0.