5150 stuff
Layout of a bootable polOS floppy disk
The floppy disk is FAT12 formatted. It must contain at least the following items:
- fat12boot.bin: the boot sector. It loads polio.com from a FAT12-formatted drive 0 to address 0x0600 and jumps to it.
- polio.com: the basic OS functions. It serves all interrupt 0x80 functions (see below) and loads polmon.com to address 0x1200, then jumps to it.
- polmon.com: a barebones memory utility. See below for all it can do.
polOS int 0x80
- function in AH
- optional argument in AL
- other arguments on the stack
- return value in AX
| AH | AL | stack arguments | return | description | |-------------|--------------|-----------------|-------------| | 0x01 | | addr, c, h, s | error code in AH | readsector: reads 1 floppy sector at c/h/s into 0000:addr | | 0x02 | | addr, c, h, s | error code in AH | writesector: writes 1 floppy sector at c/h/s from 0000:addr | | 0x03 | | c, h | error code in AH | formattrack: formats 1 track at c/h | | 0x04 | | fname, addr | non-zero if error | readfile: reads file with name at ds:fname into ds:addr | | 0x05 | | addr, size | bytes received, < 0 if error | recvpara: receive at most size bytes from parallel port into ds:addr | | 0x06 | | addr, size | bytes sent, < 0 if error | sendpara: send at most size bytes to parallel port from ds:addr | | 0x07 | until-idle | | 0 if idle | runpara: run a round of parallel comms if AL=0, keep going until idle if AL!=0 | | 0x08 | | fname, addr, size | error code in AH | writefile: writes size bytes from ds:addr into file with name at ds:fname |
polmon commands
Commands are a single letter followed by an optional space and arguments, with optional spaces between them. A command can be prefixed with up to 4 hex digits, which will then change the current address.
- (no command): dumps 16 bytes at the current address. If no address is given, also increments the current address by 16.
w bytes:[u8]*
: writes bytes in hex to the current address.k src:u16 size:u16
: copy size bytes of memory from cur-seg:src to cur-seg:cur-addrs seg:u16
: changes the current segmentj
: calls a function at the current address. ABI calling conventions below.l file:str
: loads a program with given name into the current segment, address 0x0100.r args:[u16]*
: runs the program in the current segment with arguments.i ax:u16 args:[u16]*
: call an int 0x80 function with given AX and stack args. See section above.
The r, j and i commands display the value of the AX register after returning to polmon.
ABI convention for (j)umping to functions
- AX, BX, CX, DX are caller-saved, all others are callee-saved
- first 3 arguments passed in AX, DX and CX, others are pushed in reverse order (former argument in lower memory)
- return value in AX
ABI for programs
See example in hello.com