DOS-like OS for Intel 8086 / NEC V30
Go to file
Nero 3a721063f4 debug.rom: show CS during boot 2019-11-04 20:35:01 +00:00
bdos find root directory for fcb opening 2019-11-04 13:10:50 +00:00
bios Separate out headers for structures 2019-10-30 13:10:23 +00:00
boot Improve memory position handling 2019-10-28 10:49:42 +00:00
com Rename programs/ to com/ 2019-10-18 14:43:28 +00:00
hdr Separate out headers for structures 2019-10-30 13:10:23 +00:00
lib Refine opcode 8080 table 2019-10-25 13:14:15 +00:00
rom debug.rom: show CS during boot 2019-11-04 20:35:01 +00:00
utils Cosmetic fixes for emulator 2019-10-08 19:54:13 +00:00
.gitignore Ignore emul binary in the future 2019-10-03 17:01:42 +00:00
Makefile Separate out headers for structures 2019-10-30 13:10:23 +00:00
README.md Add BIOS entrypoints to README 2019-10-28 09:45:15 +00:00

README.md

Components

The BIOS is in the uppermost 2K of the memory area - it provides basic character and disk I/O functions. It it expected to stay static and not be unloaded by the user program. The BIOS may hook into interrupts if necessary to provide its functionality. Depending on your hardware, a different BIOS binary may be used.

The BDOS is in the 2K below the BIOS, it provides a filesystem driver to work atop of the BIOS. It is agnostic to the underlaying hardware configuration, but different depending on the instruction set. A user program might overwrite memory up to the end of the BDOS. Upon program exit, the BIOS will reload the BDOS from disk.

Memory Layout

On a 8080, there are no segments, the addresses are as displayed.

On on the 8086, a single segment with a value of 0x0100 is assumed. This implies that the first 4k of memory are not used.

The BIOS and BDOS may be recompiled for starting at a lower address, in this case, the minimum memory requirement may be less than 64k.

Start Size Function
0xF800 2k BIOS / hw drivers
0xF000 2k BDOS
... ... BDOS data area, disk deblocking buffers
SP var Stack, growing down
... ... Free memory
... var Heap, growing up
0x0100 var Transient Program Area
0x0080 128 bytes Command line and disk buffer
0x006C 20 bytes Pre-filled FCB 2
0x005C 16 bytes Pre-filled FCB 1
0x0008 84 bytes BIOS data area, specific to BIOS implementation
0x0005 3 bytes Jump code for BDOS
0x0004 1 byte default drive for BDOS
0x0003 1 byte may be used as iobyte by BIOS
0x0000 3 bytes Jump to BIOS warm boot entry point / program exit

BIOS Interface

The entry points for the BIOS start at its base address. Each entry point is offset a multiple of 3 from the beginning of the BIOS.

BIOS+0 Boot

The bootloader jumps here after loading the BIOS.

BIOS+3 Warm boot

Reload the BDOS from disk, and call its entry point. The jump opcodes at the start of memory are re-initialized.

BIOS+6 Console status

Checks if keyboard input is available. Returns FFh in AL (A) is character is available, 00 if not.

BIOS+9 Console read

Read a character from keyboard from AL (A). This call does not return until a character is available.

BIOS+12 Console write

Write character in DL (E) to the display.

BIOS+24 Seek disk to zero

Seek current disk (selected with the following call) to its beginning. This is a commonly a no-op.

BIOS+27 Select disk

Select disk by the number given in CL (C).

This is equivalent to the DL number for the PC BIOS Int 13h.

BIOS+30 Set track

Select track number for next disk i/o via register CX (BC).

For CHS-adressed disks, the track number is the current cylinder multiplied by the number of heads plus the current head number.

For disks with one side, the cylinder number is equal to the track number.

BIOS+33 Set disk sector

Select sector on the current track in register CX (BC). This parameter is 1-based, this means the first sector is sector 1. The value 0 is invalid.

For CHS-adressed floppies, the number of sectors per track might vary depending on the inserted floppy disk, even for the same drive.

BIOS+36 Set disk transfer address

Set buffer for disk operations via register CX (BC).

This is somewhat incompatible with CP/M versions since on modern systems, the sector size is 512 instead of 128 bytes. Setting it to the default value of 0x80 (which is the standard disk buffer for CP/M) will overwrite the first 0x180 bytes of the transient program area.

The BDOS is expected to do deblocking to provide the application program with 128-byte disk i/o.

BIOS+39 Read sector

Read sector previously specified. AL (A) is non-zero error code on failure. The error codes are implementation-specific.

BIOS+42 Write sector

Write sector previously specified. AL (A) is non-zero error code on failure. The error codes are implementation-specific

Application program interface

It is using the call 5 convention with CP/M compatible syscall numbers.

File I/O is done via FCB blocks.