version 0.3.0: Fixed wrong read in mem, plus better realocation
This commit is contained in:
1 parent
987dbcf24d
commit
eb9b2d01c9
3 files changed
+25
-64
No files matched your search
@@ -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
Binary file not shown.
+25
-24
@@ -1,34 +1,33 @@
|
||||
ORG 0x7C00
|
||||
ORG 0x600
|
||||
BITS 16
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; SLRboot
|
||||
; Bootloader for SingOS
|
||||
; version 0.2.1.0-exp
|
||||
; version 0.3.0.0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
cli
|
||||
jmp long 0x0000:start
|
||||
|
||||
start:
|
||||
;jmp long 0x0000:start
|
||||
mov ax, 0x1000
|
||||
mov ss, ax
|
||||
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
|
||||
mov si, 0x7c00
|
||||
mov di, 0x600
|
||||
mov cx, 0x100
|
||||
rep movsw
|
||||
mov bx, relocated
|
||||
sub bx, 0x7600 ; Calculate the offset.
|
||||
push bx
|
||||
ret ; Return far
|
||||
;jmp long 0:bx
|
||||
jmp 0x0000: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'
|
||||
call print ; Call our string-printing routine
|
||||
|
||||
@@ -91,30 +90,32 @@ mov ax, partition_1
|
||||
jmp .loop
|
||||
break:
|
||||
|
||||
|
||||
add ax, 8 ; This is the offset to fetch the LBA start adress of the partition record
|
||||
mov bx, ax
|
||||
xor ax, ax
|
||||
mov ax, [bx] ; first part of LBA
|
||||
mov WORD [DAPACK.lba_addr_dw_low], ax
|
||||
call dumpax
|
||||
;call dumpax
|
||||
add bx, 2 ; next part
|
||||
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.db_addr_segment], 0x0000
|
||||
mov WORD [DAPACK.db_addr_offset], 0x7c00
|
||||
mov WORD [DAPACK.db_addr_segment], 0x0000
|
||||
mov si, DAPACK ; address of "disk address packet"
|
||||
xor ax, ax
|
||||
mov ah, 0x42 ; READ
|
||||
mov dl, [disk_identifier]
|
||||
int 0x13
|
||||
;call dumpax
|
||||
jc endcarrycheck ; An error ocurred when reading from disk.
|
||||
|
||||
; If no error then jump to volume boot record
|
||||
notcarry:
|
||||
notcarry:
|
||||
mov dl, [disk_identifier]
|
||||
jmp long 0x0:0x7c00
|
||||
|
||||
cli
|
||||
@@ -177,7 +178,7 @@ jmp .printchar ; Repeat for the next character
|
||||
ret
|
||||
|
||||
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
|
||||
welcome_debug db 'Debug mode v.0.0.1:',13,10,0
|
||||
error_str db 'Error', 0
|
||||
@@ -233,4 +234,4 @@ times 510-($-$$) db 0
|
||||
dw 0xAA55 ; => 0x55 0xAA (little endian byte order)
|
||||
; bootloder debug_mode goes here
|
||||
|
||||
times 8192-($-$$) db 0
|
||||
times 8192-($-$$) db 0
|
||||
Reference in new issue
Block a user