1818;;==============================================================================
1919
2020
21+ %include "./asm/include/mbr.inc"
22+
23+
2124BITS 16
2225
2326entry:
@@ -30,48 +33,27 @@ entry:
3033 mov sp , 0x7c00
3134 sti
3235
33- mov [ driveNumber ], dl ;; Bios passes drive number in dl.
36+ mov [ drvNum ], dl ;; Bios passes drive number in dl.
3437
3538 call pushTest
3639 call extensionTest
3740
3841 mov si , msg_load
3942 call print
4043
41- mov ax , 512 ;; Cant sectors. Load 512 = 262144 bytes = 256 KiB.
42- mov bx , 6117 ;; Offset = 8192.
43- mov cx , 0x8000 ;; Copy here.
44- call diskcpy ;; Copia payload completo.
44+ mov ax , 512 ;; Cant sectors. Load 512 = 262144 bytes = 256 KiB.
45+ mov bx , 6117 ;; Offset = 8192.
46+ mov cx , 0x8000 ;; Copy here.
47+ call diskcpy ;; Copia payload completo.
4548
4649 mov si , msg_ok
4750 call print
4851
4952;; TO-DO reponer
50- ;;mov eax, [0x8000 + 6 ]
51- ;;cmp eax, "BOOT" ; Match against the tsl_start.sys binary
53+ ;;mov eax, [0x8000 + SIGNATURE_OFFSET ]
54+ ;;cmp eax, "BOOT" ;; Simple payload verification ( tsl_start.sys binary).
5255 ;;jne magic_fail
5356
54- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; esta copia a 60000 no la quiero.
55-
56- ;;mov ax, 0x0800 ; Segment where the bootloader and payload are loaded
57- ;;mov cx, 0x6000 ; Segment where the bootloader and payload will be copied
58-
59- ;;copy_payload_to_free_mem: ; Move bootloader and payload to 0x60000
60- ;; mov fs, ax ; From segment
61- ;; mov es, cx ; To segment
62- ;; mov bx, 0x0 ; Offset
63-
64- ;;copy_single_segment:
65- ;; mov dl, [fs:bx]
66- ;; mov [es:bx], dl
67- ;; inc bx
68- ;; jnz copy_single_segment
69-
70- ;; add ax, 0x1000
71- ;; add cx, 0x1000
72- ;; cmp cx, 0xA000 ; Last address (bootloader + payload = 256KiB total)
73- ;; jnz copy_payload_to_free_mem
74-
7557 mov eax , 0
7658 mov ebx , 0
7759 mov ecx , 0
@@ -149,7 +131,7 @@ readSec:
149131 push byte 16 ;; dap00 dap.pkSiz
150132
151133 mov si , sp
152- mov dl , [ driveNumber ]
134+ mov dl , [ drvNum ]
153135 mov ah , 42h ; EXTENDED READ
154136 int 0x13 ; http://hdebruijn.soo.dto.tudelft.nl/newpage/interupt/out-0700.htm#0651
155137
@@ -218,7 +200,7 @@ extensionTest:
218200
219201 mov ah , 0x41 ;; Check extensions present.
220202 mov bx , 55AAh ;; Required signature.
221- mov dl , [ driveNumber ]
203+ mov dl , [ drvNum ]
222204 int 0x13
223205 jc notify_ext_not_supported
224206 cmp bx , 0xAA55
@@ -266,7 +248,7 @@ msg_load: db "Reading disk..", 0
266248msg_ok: db " ok" , 13 , 10 , 0
267249msg_halt: db "Sys halted" , 0
268250
269- driveNumber: db 0x00
251+ drvNum: db 0x00
270252
271253;; Zero fill.
272254times 446 - $ + $$ db 0
0 commit comments