Browse Source

Start work on io.sys

master
Juhani Krekelä 1 year ago
parent
commit
b3ca33653f
  1. 9
      Makefile
  2. 1
      README
  3. 4
      build.bat
  4. 4
      clean.bat
  5. 157
      io.asm

9
Makefile

@ -1,13 +1,18 @@
ordos.img: BOOT.BIN
ordos.img: BOOT.BIN IO.SYS ORDOS.SYS COMMAND.COM
rm -f ordos.img
mkdosfs -C $@ -M 0xff 320
rw -I 0x7c00 -i BOOT.BIN -o $@ -c 512
mcopy -i $@ IO.SYS ::
mcopy -i $@ ORDOS.SYS ::
mcopy -i $@ COMMAND.COM ::
BOOT.BIN ORDOS.SYS COMMAND.COM:
BOOT.BIN IO.SYS ORDOS.SYS COMMAND.COM:
dosbox -exit build.bat
BOOT.BIN: boot.asm
IO.SYS: io.asm
ORDOS.SYS: msdos.asm stddos.asm
COMMAND.COM: command.asm

1
README

@ -15,6 +15,7 @@ command.asm ms-dos v1.25/source/COMMAND.ASM
debug.com ms-dos v1.25/bin/DEBUG.COM
edlin.com ms-dos v1.25/bin/EDLIN.COM
exe2bin.exe ms-dos v1.25/bin/EXE2BIN.EXE
io.asm ordos
link.exe ms-dos v1.25/bin/LINK.EXE
masm.exe ms-dos v2.0/bin/MASM.EXE
msdos.asm ms-dos v1.25/source/MSDOS.ASM

4
build.bat

@ -9,3 +9,7 @@ exe2bin stddos.exe ordos.sys
masm boot;
link boot;
exe2bin boot.exe boot.bin
masm io;
link io;
exe2bin io.exe io.sys

4
clean.bat

@ -9,3 +9,7 @@ del ordos.sys
del boot.obj
del boot.exe
del boot.bin
del io.obj
del io.exe
del io.sys

157
io.asm

@ -0,0 +1,157 @@
; SPDX-License-Identifier: MIT
; Copyright (c) 2021 Juhani 'nortti' Krekelä.
iosegment equ 60h
dossegment equ iosegment + 1*1024/16 ; DOS starts 1KiB after IO system
dos segment at dossegment
org 0
dosinit proc far
dosinit endp
dos ends
code segment
code ends
constants segment
constants ends
data segment
data ends
iogroup group code, constants, data
code segment
assume cs:iogroup, ds:iogroup, es:iogroup
org 0
; Jump table
jmp init
jmp status
jmp getch
jmp putch
jmp unimplemented ; Output to printer
jmp unimplemented ; Serial read
jmp unimplemented ; Serial write
jmp diskread
jmp diskwrite
jmp diskchange
jmp setdate
jmp settime
jmp gettime
jmp flush
jmp mapdev
init:
cld
cli
mov ax, cs
mov ds, ax
mov es, ax
; Put setup stack just below 32K
xor ax, ax
mov ss, ax
mov sp, 8000h
sti
; Figure out memory size
int 12h
; AX = memory size in kilobytes
; We want it in paragraphs
; There are 64 paragraphs in a kilobyte
mov cx, 64
shl al, cl
; Memory size is passed in dx
mov dx, ax
; Disk table is passed in si
mov si, offset iogroup:disks_table
call dosinit
mov al, 'c'
jmp error
; OUT:
; al = character if any
; zf = there were no characters
status proc far
; TODO: Implement
xor ax, ax
test ax, ax
ret
status endp
getch:
mov al, 'g'
jmp error
; IN:
; ax = character
putch proc far
push ax
mov ah, 0eh
int 10h
pop ax
ret
putch endp
diskread:
mov al, 'r'
jmp error
diskwrite:
mov al, 'w'
jmp error
diskchange:
mov al, 'c'
jmp error
setdate:
mov al, 'd'
jmp error
settime:
mov al, 't'
jmp error
gettime:
mov al, 'T'
jmp error
flush:
mov al, 'f'
jmp error
mapdev:
mov al, 'm'
jmp error
unimplemented:
mov al, '@'
error:
mov ah, 0eh
int 10h
hang:
hlt
jmp hang
code ends
constants segment
disks_table:
db 1 ; 1 drive
db 0 ; Physical drive 0
dw offset iogroup:parameters_320k
parameters_320k:
dw 512 ; Sector size in bytes
db 2 ; Sectors per cluster
dw 1 ; Number of reserved sectors
dw 2 ; Number of FATs
dw 112 ; Number of directory entries
dw 320*2 ; Number of sectors
constants ends
end
Loading…
Cancel
Save