Compare commits
2 commits
master
...
1cbd918b56
Author | SHA1 | Date | |
---|---|---|---|
|
1cbd918b56 | ||
|
fea43699d7 |
3 changed files with 35 additions and 9 deletions
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ DOSBOX=dosbox -conf dosbox-build.conf -exit
|
||||||
|
|
||||||
ordos.img: BOOT.BIN IO.SYS ORDOS.SYS COMMAND.COM debug.com edlin.com exe2bin.exe link.exe masm.exe
|
ordos.img: BOOT.BIN IO.SYS ORDOS.SYS COMMAND.COM debug.com edlin.com exe2bin.exe link.exe masm.exe
|
||||||
rm -f ordos.img
|
rm -f ordos.img
|
||||||
mkfs.fat -C $@ -M 0xff 320
|
mkfs.fat -C $@ 720
|
||||||
rw -I 0x7c00 -i BOOT.BIN -o $@ -c 512
|
rw -I 0x7c00 -i BOOT.BIN -o $@ -c 512
|
||||||
mcopy -i $@ IO.SYS ::
|
mcopy -i $@ IO.SYS ::
|
||||||
mcopy -i $@ ORDOS.SYS ::
|
mcopy -i $@ ORDOS.SYS ::
|
||||||
|
|
12
boot.asm
12
boot.asm
|
@ -17,12 +17,12 @@ jmp code
|
||||||
dw 512 ; Bytes per sector
|
dw 512 ; Bytes per sector
|
||||||
db 2 ; Sectors per cluster
|
db 2 ; Sectors per cluster
|
||||||
dw 1 ; Reserved sectors
|
dw 1 ; Reserved sectors
|
||||||
db 2 ; FATs
|
fats db 2 ; FATs
|
||||||
dw 112 ; Root directory entries
|
dw 112 ; Root directory entries
|
||||||
dw 2*320 ; Total sectors
|
dw 2*720 ; Total sectors
|
||||||
db 0ffh ; Media descriptor
|
db 0f9h ; Media descriptor
|
||||||
dw 1 ; Sectors per fat
|
sectorsperfat dw 3 ; Sectors per fat
|
||||||
sectorspertrack dw 8
|
sectorspertrack dw 9
|
||||||
heads dw 2
|
heads dw 2
|
||||||
dd 0 ; Hidden sectors
|
dd 0 ; Hidden sectors
|
||||||
dd 0 ; Total sectors (large)
|
dd 0 ; Total sectors (large)
|
||||||
|
@ -40,7 +40,7 @@ code:
|
||||||
mov drivenumber, dl
|
mov drivenumber, dl
|
||||||
|
|
||||||
; TODO: Check we actually have the OS
|
; TODO: Check we actually have the OS
|
||||||
mov ax, 10
|
mov ax, 14
|
||||||
mov bx, 600h
|
mov bx, 600h
|
||||||
mov cx, 17 ; This is what PC-DOS 1.10's full size ends up at
|
mov cx, 17 ; This is what PC-DOS 1.10's full size ends up at
|
||||||
call loadsectors
|
call loadsectors
|
||||||
|
|
30
io.asm
30
io.asm
|
@ -1,6 +1,8 @@
|
||||||
; SPDX-License-Identifier: MIT
|
; SPDX-License-Identifier: MIT
|
||||||
; Copyright (c) 2021 Juhani 'nortti' Krekelä.
|
; Copyright (c) 2021 Juhani 'nortti' Krekelä.
|
||||||
|
|
||||||
|
debug equ 1
|
||||||
|
|
||||||
iosegment equ 60h
|
iosegment equ 60h
|
||||||
dossegment equ iosegment + 1*1024/16 ; DOS starts 1KiB after IO system
|
dossegment equ iosegment + 1*1024/16 ; DOS starts 1KiB after IO system
|
||||||
|
|
||||||
|
@ -64,8 +66,10 @@ init:
|
||||||
shl ax, cl
|
shl ax, cl
|
||||||
; Memory size is passed in dx
|
; Memory size is passed in dx
|
||||||
mov dx, ax
|
mov dx, ax
|
||||||
|
if debug
|
||||||
call hexprint16
|
call hexprint16
|
||||||
call newline
|
call newline
|
||||||
|
endif
|
||||||
|
|
||||||
; Disk table is passed in si
|
; Disk table is passed in si
|
||||||
mov si, offset iogroup:disks_table
|
mov si, offset iogroup:disks_table
|
||||||
|
@ -94,9 +98,11 @@ init:
|
||||||
test al, al
|
test al, al
|
||||||
jnz open_error
|
jnz open_error
|
||||||
|
|
||||||
|
if debug
|
||||||
mov al, '+'
|
mov al, '+'
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
int 10h
|
int 10h
|
||||||
|
endif
|
||||||
|
|
||||||
; Set random record field 0
|
; Set random record field 0
|
||||||
mov word ptr iogroup:command_fcb+33, 0
|
mov word ptr iogroup:command_fcb+33, 0
|
||||||
|
@ -114,12 +120,14 @@ init:
|
||||||
cmp al, 1
|
cmp al, 1
|
||||||
jne read_error
|
jne read_error
|
||||||
|
|
||||||
|
if debug
|
||||||
mov ax, cx
|
mov ax, cx
|
||||||
call hexprint16
|
call hexprint16
|
||||||
|
|
||||||
mov al, '.'
|
mov al, '.'
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
int 10h
|
int 10h
|
||||||
|
endif
|
||||||
|
|
||||||
; Set up segments for command.com
|
; Set up segments for command.com
|
||||||
mov ds, bx
|
mov ds, bx
|
||||||
|
@ -205,6 +213,7 @@ putch endp
|
||||||
; OUT:
|
; OUT:
|
||||||
; TODO: Document
|
; TODO: Document
|
||||||
diskread proc far
|
diskread proc far
|
||||||
|
if debug
|
||||||
push ax
|
push ax
|
||||||
mov ax, 0e00h + 'r'
|
mov ax, 0e00h + 'r'
|
||||||
int 10h
|
int 10h
|
||||||
|
@ -226,6 +235,7 @@ diskread proc far
|
||||||
call hexprint16
|
call hexprint16
|
||||||
call newline
|
call newline
|
||||||
pop ax
|
pop ax
|
||||||
|
endif
|
||||||
|
|
||||||
; TODO: Everything except sregs can be trashed
|
; TODO: Everything except sregs can be trashed
|
||||||
push es
|
push es
|
||||||
|
@ -272,7 +282,9 @@ diskread proc far
|
||||||
|
|
||||||
sector_read_fail:
|
sector_read_fail:
|
||||||
mov al, ah
|
mov al, ah
|
||||||
|
if debug
|
||||||
call hexprint8;debg
|
call hexprint8;debg
|
||||||
|
endif
|
||||||
mov al, '?'
|
mov al, '?'
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
int 10h
|
int 10h
|
||||||
|
@ -532,7 +544,9 @@ error:
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
mov al, '!'
|
mov al, '!'
|
||||||
int 10h
|
int 10h
|
||||||
|
if debug
|
||||||
call far_caller
|
call far_caller
|
||||||
|
endif
|
||||||
|
|
||||||
hang:
|
hang:
|
||||||
hlt
|
hlt
|
||||||
|
@ -544,14 +558,15 @@ code ends
|
||||||
|
|
||||||
constants segment
|
constants segment
|
||||||
|
|
||||||
sectorspertrack dw 8 ; TODO: Don't hardcode
|
sectorspertrack dw 9 ; TODO: Don't hardcode
|
||||||
heads dw 2 ; TODO: Don't hardcode
|
heads dw 2 ; TODO: Don't hardcode
|
||||||
|
|
||||||
disks_table:
|
disks_table:
|
||||||
db 1 ; 1 drive, TODO: Don't hardcode
|
db 1 ; 1 drive, TODO: Don't hardcode
|
||||||
|
|
||||||
db 0 ; Physical drive 0
|
db 0 ; Physical drive 0
|
||||||
dw offset iogroup:parameters_320k
|
;dw offset iogroup:parameters_320k
|
||||||
|
dw offset iogroup:parameters_720k
|
||||||
|
|
||||||
parameters_320k:
|
parameters_320k:
|
||||||
dw 512 ; Sector size in bytes
|
dw 512 ; Sector size in bytes
|
||||||
|
@ -561,6 +576,14 @@ parameters_320k:
|
||||||
dw 112 ; Number of directory entries
|
dw 112 ; Number of directory entries
|
||||||
dw 320*2 ; Number of sectors
|
dw 320*2 ; Number of sectors
|
||||||
|
|
||||||
|
parameters_720k:
|
||||||
|
dw 512 ; Sector size in bytes
|
||||||
|
db 2 ; Sectors per cluster
|
||||||
|
dw 1 ; Number of reserved sectors
|
||||||
|
db 2 ; Number of FATs
|
||||||
|
dw 112 ; Number of directory entries
|
||||||
|
dw 720*2 ; Number of sectors
|
||||||
|
|
||||||
doubleticks_per_hour dw 32772 ; 1800B0h / 2 / 24
|
doubleticks_per_hour dw 32772 ; 1800B0h / 2 / 24
|
||||||
ticks_per_minute dw 1092 ; 1800B0h / 24 / 60
|
ticks_per_minute dw 1092 ; 1800B0h / 24 / 60
|
||||||
ticks_per_second dw 18 ; 1800B0h / 24 / 60 / 60
|
ticks_per_second dw 18 ; 1800B0h / 24 / 60 / 60
|
||||||
|
@ -583,6 +606,8 @@ days_since_epoch: dw 0
|
||||||
data ends
|
data ends
|
||||||
|
|
||||||
code segment
|
code segment
|
||||||
|
if debug
|
||||||
|
|
||||||
hexprint16 proc
|
hexprint16 proc
|
||||||
xchg al, ah
|
xchg al, ah
|
||||||
call hexprint8
|
call hexprint8
|
||||||
|
@ -672,6 +697,7 @@ logaddr proc
|
||||||
ret
|
ret
|
||||||
logaddr endp
|
logaddr endp
|
||||||
|
|
||||||
|
endif
|
||||||
code ends
|
code ends
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue