Is my use of segmentation off? shouldn't 0050:0000 and 0000:0500 be interchangeable?
Am I not reading from the correct part of the disk? I can open the image in a hex editor, and at offset 0x4200 (0x4200 / 512 (decimal) is 33 (decimal) is the exact same code found in the IO.ASM file that I wrote.
Also, as a sidenote: Using the bochs (GUI) debugger, when ever a 'mov cx, ...' or instruction happens, CX never changes its value in the debugger. (at least for me). is something wrong with my build of bochs, or is this correct behavior? same with the SP register. Only increments (INC, DEC, ADD, SUB, etc), change its value (on my end), never anything else. I don't know why lol
And please, forgive me if I am making one heck of a mistake and overlooking something important...
Code: Select all
NULL EQU 0
BOOTSEG EQU 07C0H
LOADSEG EQU 0AE0H ; ignore; not used
JMP SHORT RSTREG
NOP
DB "PEDOS1.0"
BPBV00: DW 512 ; Bytes per Disk-sector
BPBV01: DB 1 ; Disk-sector per disk-cluster
BPBV02: DW 1 ; Reserved disk-sectors
BPBV03: DB 2 ; how many FATS are on the disk
BPBV04: DW 224
DW 2880
DB 0F0H
BPBV05: DW 9
BPBV06: DW 18
BPBV07: DW 2
DD 0
DD 0
DB 0
DB 41
DB 0
DB " "
DB "FAT12 "
ORG 7C00H
RSTREG:
XOR AX, AX
MOV DS, AX
MOV AX, WORD BOOTSEG
CLI
MOV SS, AX
MOV SP, 1024
STI
; XOR DX, DX
; INT 13H
;
PUSH 0050H
POP ES
MOV AX, 201 ; AH=02, AL=01; correct?
MOV CX, 33 ; CH=00, CL=33; correct?
; read the bochs sidenote: not sure if its related to actual hardware ; or just a bug in the ;debugger softare.
XOR DX, DX
XOR BX, BX
INT 13H
JC SHORT DSKERR
PUSH 0000H
PUSH 0500H
RETF
;
; If any errors have occurred during boot up,
; then alert the user, and halt the system, and
; retstart the system if requested.
;
DSKERR:
LEA SI, [ERRMSG]
PRNSTR:
LODSB
OR AL, 0
JZ DSKHLT
MOV AH, 14
MOV BX, 7
INT 16
JMP PRNSTR
DSKHLT:
XOR AX, AX
INT 22
INT 25
ERRMSG: DB "Non-System disk or disk error...replace and try again when ready."
DB NULL
DOSFLE: DB "SHELL SYS"
IOSFLE: DB "IO SYS"
TIMES 510 - ($ - $$) DB 0
;
; End of the boot-sector.
;
DW 0AA55H