flat assembler
Message board for the users of flat assembler.

Index > OS Construction > how to load kernel on my os

Author
Thread Post new topic Reply to topic
xpfan3169



Joined: 13 Nov 2024
Posts: 6
xpfan3169 13 Nov 2024, 18:29
Hello, i am new at Assembly development and i'm trying to develop an 16 bit assembly OS called MayMayOS which uses FAT16 file system. But when i run my OS, nothing happens. Where am i wrong? I will be happy if you help me.

boot.asm:
Code:
bits 16
org 100h

OEM                                     db "XPFAN3169"
bytes_sector            dw 0x0200
sectors_cluster         db 0x04
reserved                        dw 0x0001
fats                            db 0x02
root_entries            dw 0x0200
sectors                         dw 0x0000
media_type                      db 0xf8
sectors_fat                     dw 0x0040
sectors_track           dw 0x0020
heads                           dw 0x0040
sectors_hidden          dd 0x00000000
sectors_large           dd 0x00010000
drive_num                       dw 0x8000
extended_sig            db 0x29
serial                          dd 0x688b221b
label                           db "MAYMAYOS    "
filesystem                      db "FAT16       "

mov ax,0x07c0
mov ds,ax
add ax,0x0020
mov ss,ax
mov sp,0x1000

mov byte [boot_drive_num],dl

mov ah,08h
int 13h

mov dl,dh
mov dh,0
inc dl
mov word [heads],dx

mov ch,0
and ch,0x3f
mov word [sectors_track],cx

load_fat:
        mov si,msg_load
        call print_teletype
        
        mov ax,0x3000
        mov es,ax
        mov bx,0x0000
        
        mov ax,word [reserved]
        call calc_chs_ls
        mov ax,word [sectors_fat]
        mov ah,0x02
        int 13h
        jnc load_root                           ;Load root if carry flag is not set
        
        jmp reboot                                      ;Otherwise reboot
        
load_root:
        mov si,msg_load
        call print_teletype
        
        mov ax,0x3800
        mov es,ax
        
        call calc_root_start
        call calc_chs_ls
        mov ah,0x02
        mov al,0x20
        int 13h
        jc reboot                                       ;Reboot if carry flag is set
        
search_init:
        mov si,msg_search_root
        call print_teletype
        
        mov ax,0x07c0
        mov ds,ax
        
        mov ax,0x3800
        mov es,ax
        mov di,0x0000
        
        mov cx,word [root_entries]
        
check_entry:
        push cx
        
        mov cx,0x000b
        mov si,kern_filename
        push di
        
        repe cmpsb
        
        pop di
        pop cx
        
        je found_entry
        
        add di,0x0020
        loop check_entry
        
        jmp reboot_fatal
        
found_entry:
        mov ax,word [es:di+1ah]
        mov word [cluster],ax
        
load_cluster:
        mov si,msg_load_cluster
        call print_teletype
        
        mov ax,word [cluster]
        sub ax,0x0002
        mul byte [sectors_cluster]
        mov dx,ax
        
        call calc_root_start
        add ax,0x20
        add ax,dx
        
        call calc_chs_ls
        
        mov ax,0x2000
        mov es,ax
        mov bx,word [buffer_pointer]
        mov ah,0x02
        mov al,byte [sectors_cluster]
        int 13h
        jnc next_cluster
        
        call reset_disk
        
        mov ah,0x02
        mov al,byte [sectors_cluster]
        int 13h
        jc reboot
        
next_cluster:
        mov ax,0x3000
        mov ds,ax
        
        mov si,word [cluster]
        shl si,1
        
        mov ax,word [ds:si]
        mov word [cluster],ax
        
        cmp ax,0xfff8
        
        mov ax,0x0200
        mul word [sectors_cluster]
        add word [buffer_pointer],ax
        
        jb load_cluster
        
jump:
        mov si,msg_ready
        call print_teletype
        
        mov ah,0x00
        int 16h
        
        mov dl,byte [boot_drive_num]
        
        jmp 0x2000:0x0000
        
calc_root_start:
        push dx
        
        mov ax,word [sectors_fat]
        mov dh,0x00
        mov dl,byte [fats]
        mul dx
        add ax,word [reserved]
        
        pop dx
        ret
        
calc_chs_ls:
        mov dx,0x0000
        div word [sectors_track]
        mov cl,dl
        inc cl
        
        mov dx,0x0000
        div word [heads]
        mov dh,dl
        mov ch,al
        
        mov dl,byte [boot_drive_num]
        ret
        
print_teletype:
        lodsb
        cmp al,"$"
        je done_teletype
        mov ah,0eh
        int 10h
        jmp print_teletype
        
done_teletype:
        ret
        
reset_disk:
        push ax
        
        mov si,msg_retrying
        call print_teletype
        
        mov ah,0x00
        mov dl,byte [boot_drive_num]
        int 13h
        jc reboot_fatal
        
        pop ax
        ret
        
reboot_fatal:
        mov si,msg_fatal
        call print_teletype
        
reboot:
        mov si,msg_fatal
        call print_teletype
        
        mov si,msg_ready
        call print_teletype
        
        mov ah,0x00
        int 16h
        
        jmp 0xffff:0x0000
        
cluster                         dw 0x0000
buffer_pointer          dw 0x0000
boot_drive_num          db 0x00

msg_retrying            db "Retry$"
msg_fatal                       db "FATAL$"
msg_reboot                      db "Reboot$"
msg_search_root         db "Searching$"
msg_load_cluster        db "Load cluster$"
msg_ready                       db "READY$"
msg_load                        db "Press any key$"

kern_filename           db "KERNEL      BIN"
        
times 510-($-$$) db 0
dw 0xaa55
    





kernel.asm:
Code:
bits 16
org 0x0000

welcome_text    db "Welcome to MayMayOS$"
old_int_off     dw 0
old_int_seg     dw 0

mov ax,0x07e0
mov ds,ax
mov es,ax

mov si,welcome_text
call print_teletype
jmp set_ints

print_teletype:
        lodsb
        cmp al,"$"
        je done_teletype
        mov ah,0eh
        int 10h
        jmp print_teletype
        
done_teletype:
        ret
        
set_ints:
        mov bx,[es:77h*4]
        mov [old_int_off],bx
        mov bx,[es:77h*4+2]
        mov [old_int_seg],bx
        
        mov dx,int_77_prog
        mov [es:77h*4],dx
        mov ax,cs
        mov [es:77h*4+2],ax
        
jmp $
        
int_77_prog:
        pusha
        
        popa
        iret
    


make.bat (i use dd for windows btw):
Code:
@echo off
del *.bin
nasm -f bin boot.asm -o boot.bin
nasm -f bin kernel.asm -o kernel.bin
dd if=NUL of=maymayos.img size=1440
dd if=boot.bin of=maymayos.img
dd if=kernel.bin of=maymayos.img seek=1
pause
    
Post 13 Nov 2024, 18:29
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 13 Nov 2024, 18:51
Already at the very beginning. You don't have jmp to your code, but immediately there is a field that should be 3 bytes further (just the place for jmp)
Code:
jmp short startup
nop
OEM                                     db "XPFAN316";, "9" ; 8 bytes
bytes_sector            dw 0x0200
sectors_cluster         db 0x04
reserved                        dw 0x0001
fats                            db 0x02
root_entries            dw 0x0200
sectors                         dw 0x0000
media_type                      db 0xf8
sectors_fat                     dw 0x0040
sectors_track           dw 0x0020
heads                           dw 0x0040
sectors_hidden          dd 0x00000000
sectors_large           dd 0x00010000
drive_num               db 0x00; dw 0x8000  ; byte
current_head            db 0x00; not used
extended_sig            db 0x29
serial                          dd 0x688b221b
label                           db "MAYMAYOS  ";, " " ; 11 bytes
filesystem                      db "FAT16   "; , "    "; 8 bytes

startup:    


Here you jump to the kernel load address, but!
Code:
        jmp 0x2000:0x0000    

your kernel does not start with code, but with data (i.e. data will be executed)!
Code:
bits 16
org 0x0000

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
welcome_text    db "Welcome to MayMayOS$"
old_int_off     dw 0
old_int_seg     dw 0
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mov ax,0x07e0
mov ds,ax
mov es,ax    


Last edited by macomics on 13 Nov 2024, 19:11; edited 1 time in total
Post 13 Nov 2024, 18:51
View user's profile Send private message Reply with quote
xpfan3169



Joined: 13 Nov 2024
Posts: 6
xpfan3169 13 Nov 2024, 19:11
for some reason i got binary data of my floppy image

here is the corrected code incase

boot.asm:
Code:
bits 16
org 100h

jmp short startup
nop

OEM                                     db "XPFAN316"
bytes_sector            dw 0x0200
sectors_cluster         db 0x04
reserved                        dw 0x0001
fats                            db 0x02
root_entries            dw 0x0200
sectors                         dw 0x0000
media_type                      db 0xf8
sectors_fat                     dw 0x0040
sectors_track           dw 0x0020
heads                           dw 0x0040
sectors_hidden          dd 0x00000000
sectors_large           dd 0x00010000
drive_num                       dw 0x8000
extended_sig            db 0x29
serial                          dd 0x688b221b
label                           db "MAYMAYOS   "
filesystem                      db "FAT16   "


startup:
mov ax,0x07c0
mov ds,ax
add ax,0x0020
mov ss,ax
mov sp,0x1000

mov byte [boot_drive_num],dl

mov ah,08h
int 13h

mov dl,dh
mov dh,0
inc dl
mov word [heads],dx

mov ch,0
and ch,0x3f
mov word [sectors_track],cx

load_fat:
        mov si,msg_load
        call print_teletype
        
        mov ax,0x3000
        mov es,ax
        mov bx,0x0000
        
        mov ax,word [reserved]
        call calc_chs_ls
        mov ax,word [sectors_fat]
        mov ah,0x02
        int 13h
        jnc load_root                           ;Load root if carry flag is not set
        
        jmp reboot                                      ;Otherwise reboot
        
load_root:
        mov si,msg_load
        call print_teletype
        
        mov ax,0x3800
        mov es,ax
        
        call calc_root_start
        call calc_chs_ls
        mov ah,0x02
        mov al,0x20
        int 13h
        jnc search_init
        
        call reset_disk
        
        mov ah,0x02
        mov al,0x20
        int 13h
        jc reboot
        
search_init:
        mov si,msg_search_root
        call print_teletype
        
        mov ax,0x07c0
        mov ds,ax
        
        mov ax,0x3800
        mov es,ax
        mov di,0x0000
        
        mov cx,word [root_entries]
        
check_entry:
        push cx
        
        mov cx,0x000b
        mov si,kern_filename
        push di
        
        repe cmpsb
        
        pop di
        pop cx
        
        je found_entry
        
        add di,0x0020
        loop check_entry
        
        jmp reboot_fatal
        
found_entry:
        mov ax,word [es:di+1ah]
        mov word [cluster],ax
        
load_cluster:
        mov si,msg_load_cluster
        call print_teletype
        
        mov ax,word [cluster]
        sub ax,0x0002
        mul byte [sectors_cluster]
        mov dx,ax
        
        call calc_root_start
        add ax,0x20
        add ax,dx
        
        call calc_chs_ls
        
        mov ax,0x2000
        mov es,ax
        mov bx,word [buffer_pointer]
        mov ah,0x02
        mov al,byte [sectors_cluster]
        int 13h
        jnc next_cluster
        
        call reset_disk
        
        mov ah,0x02
        mov al,byte [sectors_cluster]
        int 13h
        jc reboot
        
next_cluster:
        mov ax,0x3000
        mov ds,ax
        
        mov si,word [cluster]
        shl si,1
        
        mov ax,word [ds:si]
        mov word [cluster],ax
        
        cmp ax,0xfff8
        
        mov ax,0x0200
        mul word [sectors_cluster]
        add word [buffer_pointer],ax
        
        jb load_cluster
        
jump:
        mov si,msg_ready
        call print_teletype
        
        mov ah,0x00
        int 16h
        
        mov dl,byte [boot_drive_num]
        
        jmp 0x2000:0x0000
        
calc_root_start:
        push dx
        
        mov ax,word [sectors_fat]
        mov dh,0x00
        mov dl,byte [fats]
        mul dx
        add ax,word [reserved]
        
        pop dx
        ret
        
calc_chs_ls:
        mov dx,0x0000
        div word [sectors_track]
        mov cl,dl
        inc cl
        
        mov dx,0x0000
        div word [heads]
        mov dh,dl
        mov ch,al
        
        mov dl,byte [boot_drive_num]
        ret
        
print_teletype:
        lodsb
        cmp al,"$"
        je done_teletype
        mov ah,0eh
        int 10h
        jmp print_teletype
        
done_teletype:
        ret
        
reset_disk:
        push ax
        
        mov si,msg_retrying
        call print_teletype
        
        mov ah,0x00
        mov dl,byte [boot_drive_num]
        int 13h
        jc reboot_fatal
        
        pop ax
        ret
        
reboot_fatal:
        mov si,msg_fatal
        call print_teletype
        
reboot:
        mov si,msg_reboot
        call print_teletype
        
        mov si,msg_ready
        call print_teletype
        
        mov ah,0x00
        int 16h
        
        jmp 0xffff:0x0000
        
cluster                         dw 0x0000
buffer_pointer          dw 0x0000
boot_drive_num          db 0x00

msg_retrying            db "Retry$"
msg_fatal                       db "FATAL$"
msg_reboot                      db "Reboot$"
msg_search_root         db "Search$"
msg_load_cluster        db "Load clstr$"
msg_ready                       db "READY$"
msg_load                        db "Press a key$"

kern_filename           db "KERNEL      BIN"
        
times 510-($-$$) db 0
dw 0xaa55
    



kernel.asm:
Code:
bits 16
org 0x2000

welcome_text    db "Welcome to MayMayOS$"
old_int_off     dw 0
old_int_seg     dw 0

mov si,welcome_text
call print_teletype
jmp set_ints

print_teletype:
        lodsb
        cmp al,"$"
        je done_teletype
        mov ah,0eh
        int 10h
        jmp print_teletype
        
done_teletype:
        ret
        
set_ints:
        mov bx,[es:77h*4]
        mov [old_int_off],bx
        mov bx,[es:77h*4+2]
        mov [old_int_seg],bx
        
        mov dx,int_77_prog
        mov [es:77h*4],dx
        mov ax,cs
        mov [es:77h*4+2],ax
        
jmp $
        
int_77_prog:
        pusha
        
        popa
        iret
    


Description: output
Filesize: 11.89 KB
Viewed: 724 Time(s)

Capture.PNG


Post 13 Nov 2024, 19:11
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 13 Nov 2024, 19:28
Try this (with fasm-1.73.32 and qemu)


Description: just make (cmake)
Download
Filename: fdd.zip
Filesize: 22.67 KB
Downloaded: 39 Time(s)

Post 13 Nov 2024, 19:28
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 13 Nov 2024, 20:05
Screenshots


Description: Text video segment
Filesize: 50.79 KB
Viewed: 699 Time(s)

Снимок экрана_20241114_000154.png


Description: BIOS vars segment
Filesize: 41.76 KB
Viewed: 699 Time(s)

Снимок экрана_20241114_000236.png


Description: IFPT - Interrupt Far Pointers Table
Filesize: 47.91 KB
Viewed: 699 Time(s)

Снимок экрана_20241114_000219.png


Post 13 Nov 2024, 20:05
View user's profile Send private message Reply with quote
xpfan3169



Joined: 13 Nov 2024
Posts: 6
xpfan3169 14 Nov 2024, 09:20
k tkz i will try when i arrive home, btw should i use fat in mbr or kernel?
Post 14 Nov 2024, 09:20
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 14 Nov 2024, 09:35
The concept of MBR/SBR/BS is closely related to the file system. It should work with the file system and load the first program from disk into memory, and then transfer control to it. You have declared the work with the file system yourself in your task list. Therefore, the kernel should also work with it.
Post 14 Nov 2024, 09:35
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 11
Location: Socket in motherboard
Core i7 14 Nov 2024, 14:36
One note...
The int-10h interrupt handler has over 500 lines of code,
so for printing text it is better to use direct output to the video buffer "rep stosw":
Code:
msg1  db  'Hello World!'
len1  $ - msg1
;.....
    mov   ax,3      ; vmode = 80x25x16
    int   10h

    mov   cx,len1
    mov   si,msg1
    mov   ah,5      ; text color
    mov   di,40     ; position in vBuff  
    call  printf
;.....

printf:
    push  es 0xb800
    pop   es
@@: lodsb 
    stosw   
    loop  @b 
    pop   es 
ret
    
Post 14 Nov 2024, 14:36
View user's profile Send private message Reply with quote
xpfan3169



Joined: 13 Nov 2024
Posts: 6
xpfan3169 14 Nov 2024, 15:19
i found this code from online and this code loads kernel into memory (i wanna use fat16 at the next sector after kernel)

boot.asm:
Code:
bits 16
org 0x7c00

cld

xor ax,ax
mov ss,ax
mov sp,0x7c00

mov es,ax
mov bx,0x7e00

mov ah,2
mov al,1
mov ch,0
mov cl,2
int 13h

jmp 0x0000:0x7e00

times 510-($-$$) db 0
dw 0xaa55
    


kernel.asm:
Code:
bits 16
org 0x0000

mov ax,0x07e0
mov ds,ax
mov es,ax
    
Post 14 Nov 2024, 15:19
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 14 Nov 2024, 15:27
@Core i7
Code:
printf: push es ; you forgot    

xpfan3169 wrote:
i found this code
Don't do that. This code does not suggest the presence of any file system on the disk. Just look at my archive. FAT16 is almost the same as FAT12.
Post 14 Nov 2024, 15:27
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 11
Location: Socket in motherboard
Core i7 14 Nov 2024, 16:35
@macomics no, there are 2 pushes in one line: push es 0xb800 --> pop es ... pop es
Post 14 Nov 2024, 16:35
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 14 Nov 2024, 21:12
Core i7 wrote:
@macomics no, there are 2 pushes in one line: push es 0xb800 --> pop es ... pop es
Right. I'm blind
Post 14 Nov 2024, 21:12
View user's profile Send private message Reply with quote
Core i7



Joined: 14 Nov 2024
Posts: 11
Location: Socket in motherboard
Core i7 15 Nov 2024, 07:25
xpfan3169 wrote:
which uses FAT16 file system.

If your kernel does not have a file system manager, then you do not need to format the drive in FAT-16/32 - just read/write at the disk sector level. There are no interrupts among BIOS services that work with FS - only DOS int-25/26h.

You should have other priorities - switching to protected mode with access to 4GB of memory, creating IDT/GDT tables, etc. To work with physical devices, you need access to PCI-Config-Space, and these are the highest memory addresses. If you want to leave BIOS interrupts, you can switch to "UnrealMode" to address all memory up to 4Gb. And there is nothing interesting in RMode with 1Mb of memory.
Post 15 Nov 2024, 07:25
View user's profile Send private message Reply with quote
xpfan3169



Joined: 13 Nov 2024
Posts: 6
xpfan3169 16 Nov 2024, 19:11
i found this code and i think i will use FAT12

Code:
bits 16
org 0x7c00

jmp start
nop

OEM                                             db "DISKNAME"
BytesPerSect                    dw 512
SectPerCluster                  db 1
ReservedSects                   dw 1
NumberFATs                              db 2
TotalSects                              dw 2880
Media                                   db 0x00                 ;0x00 = number for floppy drive
SectsPerFAT                             dw 9
SectsPerTrack                   dw 18
HeadsPerCylinder                dw 2
dq 0                                                                    ;Hidden sectors
DriveNumber                             db 0
Unused                                  db 0
Bootsig                                 db 0x29
Serial                                  dd 0x1a2a3a
VolumeLabel                             db "MAYMAYOS   "
FileSystem                              db "FAT12   "

start:
        cli                                     ;Clear interrupt flag (IF)
        mov ax,0x07c0
        mov es,ax
        mov ds,ax
        mov gs,ax
        mov fs,ax
        
        xor ax,ax
        mov ss,ax
        mov sp,0xffff
        sti
        mov ax,19d
        mov cx,14d
        mov bx,200h
        call read_sects
        
        mov di,200h
        mov cx,224d
        
find_file:
        push cx
        
        mov cx,11d
        mov si,filen
        
        push di
        repe cmpsb
        pop di
        je file_found
        pop cx
        
        add di,32
        loop find_file
        int 18h
        
file_found:
        pop cx
        mov dx,word [di+1ah]
        mov word [cluster],dx
        mov ax,1
        mov cx,9
        mov bx,200h
        call read_sects
        mov ax,60h
        mov es,ax
        
        xor bx,bx
        push bx
        
cluster_loop:
        mov ax,word [cluster]
        sub ax,2
        add ax,33d
        mov cx,1
        pop bx
        call read_sects
        push bx
        mov ax,word [cluster]
        mov dx,ax
        mov cx,ax
        shr dx,1
        add cx,dx
        mov bx,200h
        add bx,cx
        mov dx,word [bx]
        test ax,1
        jnz odd_cluster
        and dx,0xffff
        jmp done
        
odd_cluster:
        shr dx,4
        
done:
        mov word [cluster],dx
        cmp dx,0xff0
        jb cluster_loop
        mov ax,es
        sub ax,10h
        mov es,ax
        mov ds,ax
        mov ss,ax
        xor sp,sp
        push es
        push 100h
        retf

read_sects:
        mov di,5
        
sect_loop:
        push ax
        push bx
        push cx
        push dx
        
        call lbachs
        mov ah,02h
        mov al,1
        mov dl,0
        mov dh,[head]
        mov cl,[sector]
        mov ch,[track]
        int 13h
        jnc success
        xor ax,ax
        int 13h
        pop dx
        pop cx
        pop bx
        pop ax
        inc ax
        add bx,512d
        loop read_sects
        ret
        
lbachs:
        pusha
        
        xor dx,dx
        mov cx,18d
        div cx
        inc dl
        mov byte [sector],dl
        mov cx,2
        xor dx,dx
        div cx
        mov byte [head],dl
        mov byte [track],al
        popa
        ret
        
cluster                 dw 0
sector                  db 0
head                    db 0
track                   db 0
filen                   db "KERNEL  BIN"

times 512-($-$$) db 0
dw 0xaa55
    
Post 16 Nov 2024, 19:11
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1013
Location: Russia
macomics 16 Nov 2024, 21:07
Do not stupidly take someone else's code (besides, I have already sent you 2 versions of the same in the archive). Then you will have to sort out the occupied memory blocks, and because of someone else's code, you will simply get confused in them.
Code:
 00000 -  003FF = 00400: IFPT (Interrupt Far Pointers Table)
 00400 -  005FF = 00200: BIOS vars
 00600 -  9FFFF = 9FAFF: "Empty" (dirty)
 9F000 -  9FFFF = 01000: (optional) BIOS reserved memory
 A0000 -  AFFFF = 10000: Video memory (graphic)
 B0000 -  B7FFF = 08000: Text video segment (old, hercules)
 B8000 -  B8FFF = 01000: Text video segment (current, page 0)
 B9000 -  B9FFF = 01000: Text video segment (page 1)
 BA000 -  BAFFF = 01000: Text video segment (page 2)
 BB000 -  BBFFF = 01000: Text video segment (page 3)
 BC000 -  BCFFF = 01000: Text video segment (page 4)
 BD000 -  BDFFF = 01000: Text video segment (page 5)
 BE000 -  BEFFF = 01000: Text video segment (page 6)
 BF000 -  BFFFF = 01000: Text video segment (page 7)
 C0000 -  CFFFF = 10000: ROM BIOS (extended, devices)
 D0000 -  EFFFF = 20000: "Empty" (reserved)
 F0000 -  FFFFF = 10000: ROM BIOS (main)
100000 - 10FFEF = 0FFF0: HMA (A20 gate)    
First, imagine where you put your KERNEL.BIN in this memory card. And where your BOOT sector will be. And you also need an area for the stack.

ADD: For example, this is a memory card for an example from the archive (qemu).
Code:
 00000 -  003FF = 00400: IFPT (Interrupt Far Pointers Table)
 00400 -  005FF = 00200: BIOS vars
 00600 -  009FF = 00400: "Empty" (available, free)
 00A00 -  969FF = 96000: BOOT.BIN (600 kb)
 96A00 -  9BFFF = 055FF: "Empty" (available, free)
 9C000 -  9FBFF = 03C00: Stack segment
 9FC00 -  9FFFF = 00400: BIOS reserved memory
 A0000 -  AFFFF = 10000: Video memory (graphic)
 B0000 -  B7FFF = 08000: Text video segment (old, hercules)
 B8000 -  B8FFF = 01000: Text video segment (current, page 0)
 B9000 -  B9FFF = 01000: Text video segment (page 1)
 BA000 -  BAFFF = 01000: Text video segment (page 2)
 BB000 -  BBFFF = 01000: Text video segment (page 3)
 BC000 -  BCFFF = 01000: Text video segment (page 4)
 BD000 -  BDFFF = 01000: Text video segment (page 5)
 BE000 -  BEFFF = 01000: Text video segment (page 6)
 BF000 -  BFFFF = 01000: Text video segment (page 7)
 C0000 -  CFFFF = 10000: ROM BIOS (extended, devices)
 D0000 -  EFFFF = 20000: "Empty" (reserved)
 F0000 -  FFFFF = 10000: ROM BIOS (main)
100000 - 10FFEF = 0FFF0: HMA (A20 gate)    
Post 16 Nov 2024, 21:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.