Browse Source

version 0.3.0: Fixed wrong read in mem, plus better realocation

master
Jørn Guldberg 5 years ago
parent
commit
eb9b2d01c9
3 changed files with 25 additions and 64 deletions
  1. +0
    -40
      notes.txt
  2. BIN
      slrboot.bin
  3. +25
    -24
      slrboot.nasm

+ 0
- 40
notes.txt View File

@ -1,40 +0,0 @@
0x0000: cli
0x0001: mov ax, 0x1000
0x0004: mov ss, ax
0x0006: mov sp, 0xb000
0x0009: mov ax, 0
0x000c: mov ds, ax
0x000e: mov es, ax
0x0010: sti
0x0011: mov si, 0x7c00
0x0014: mov di, 0x600
0x0017: mov cx, 0x200
0x001a: rep movsb byte ptr es:[di], byte ptr [si]
0x001c: ljmp 0:0x621
0x0021: mov si, 0x7be
0x0024: cmp byte ptr [si], al
0x0026: jne 0x33
0x0028: add si, 0x10
0x002b: cmp si, 0x7fe
0x002f: jne 0x24
0x0031: jmp 0x49
0x0033: mov ah, 2
0x0035: mov al, 1
0x0037: mov bx, 0x7c00
0x003a: mov dl, 0x80
0x003c: mov dh, byte ptr [si + 1]
0x003f: mov cx, word ptr [si + 2]
0x0042: int 0x13
0x0044: ljmp 0:0x7c00
0x0049: jmp 0x49
// This is test for workshop.

BIN
slrboot.bin View File


+ 25
- 24
slrboot.nasm View File

@ -1,34 +1,33 @@
ORG 0x7C00
ORG 0x600
BITS 16 BITS 16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SLRboot ; SLRboot
; Bootloader for SingOS ; Bootloader for SingOS
; version 0.2.1.0-exp
; version 0.3.0.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cli cli
jmp long 0x0000:start
start:
;jmp long 0x0000:start
mov ax, 0x1000 mov ax, 0x1000
mov ss, ax mov ss, ax
mov sp, 0xb000 mov sp, 0xb000
mov ax, 0
mov ds, ax
mov es, ax
mov [disk_identifier], dl
push dx
mov ax, 0x0
mov ds, ax ; ds is used by si
mov es, ax ; es is used by di
sti sti
mov si, 0x7c00 mov si, 0x7c00
mov di, 0x600 mov di, 0x600
mov cx, 0x100 mov cx, 0x100
rep movsw rep movsw
mov bx, relocated
sub bx, 0x7600 ; Calculate the offset.
push bx
ret ; Return far
;jmp long 0:bx
jmp 0x0000:relocated
relocated: relocated:
mov ax, 0x0
mov ds, ax
mov es, ax
pop dx
mov [disk_identifier], dl
mov si, message ; Put address of the null-terminated string to output into 'si' mov si, message ; Put address of the null-terminated string to output into 'si'
call print ; Call our string-printing routine call print ; Call our string-printing routine
@ -91,30 +90,32 @@ mov ax, partition_1
jmp .loop jmp .loop
break: break:
add ax, 8 ; This is the offset to fetch the LBA start adress of the partition record add ax, 8 ; This is the offset to fetch the LBA start adress of the partition record
mov bx, ax mov bx, ax
xor ax, ax xor ax, ax
mov ax, [bx] ; first part of LBA mov ax, [bx] ; first part of LBA
mov WORD [DAPACK.lba_addr_dw_low], ax mov WORD [DAPACK.lba_addr_dw_low], ax
call dumpax
;call dumpax
add bx, 2 ; next part add bx, 2 ; next part
mov ax, [bx] mov ax, [bx]
mov WORD [DAPACK.lba_addr_dw_low + 1], ax
call dumpax
mov WORD [DAPACK.lba_addr_dw_low + 2], ax
;call dumpax
;mov WORD [DAPACK.lba_addr_dw_low], 2048
mov WORD [DAPACK.blkcnt], 0x01 mov WORD [DAPACK.blkcnt], 0x01
mov WORD [DAPACK.db_addr_segment], 0x0000
mov WORD [DAPACK.db_addr_offset], 0x7c00 mov WORD [DAPACK.db_addr_offset], 0x7c00
mov WORD [DAPACK.db_addr_segment], 0x0000
mov si, DAPACK ; address of "disk address packet" mov si, DAPACK ; address of "disk address packet"
xor ax, ax xor ax, ax
mov ah, 0x42 ; READ mov ah, 0x42 ; READ
mov dl, [disk_identifier] mov dl, [disk_identifier]
int 0x13 int 0x13
;call dumpax
jc endcarrycheck ; An error ocurred when reading from disk. jc endcarrycheck ; An error ocurred when reading from disk.
; If no error then jump to volume boot record ; If no error then jump to volume boot record
notcarry:
notcarry:
mov dl, [disk_identifier]
jmp long 0x0:0x7c00 jmp long 0x0:0x7c00
cli cli
@ -177,7 +178,7 @@ jmp .printchar ; Repeat for the next character
ret ret
data: data:
message db 'SLRboot for SingOS! v0.2.1.0-exp',13,10,0
message db 'SLRboot for SingOS! v0.3.0.0',13,10,0
enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0 enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0
welcome_debug db 'Debug mode v.0.0.1:',13,10,0 welcome_debug db 'Debug mode v.0.0.1:',13,10,0
error_str db 'Error', 0 error_str db 'Error', 0
@ -233,4 +234,4 @@ times 510-($-$$) db 0
dw 0xAA55 ; => 0x55 0xAA (little endian byte order) dw 0xAA55 ; => 0x55 0xAA (little endian byte order)
; bootloder debug_mode goes here ; bootloder debug_mode goes here
times 8192-($-$$) db 0
times 8192-($-$$) db 0

Loading…
Cancel
Save