pato-z80-home-computer/assembly/bios/main.asm

102 lines
1.8 KiB
NASM
Raw Normal View History

2020-11-01 13:06:01 +01:00
jp Sysinit ; Startup vector: DO NOT MOVE! Must be the first instruction
2020-10-27 20:08:07 +01:00
; Pat80 BIOS v0.01
; @author: Daniele Verducci
;
; MEMORY MAP
; ROM is at 0x0000
; RAM is at 0x8000
; SYSTEM VAR SPACE: 0x8000 - 0x8FFF (4kb)
; DRIVERS VAR SPACE: 0x9000 - 0x9FFF (4kb)
; APPLICATION VAR SPACE: 0xA000 - 0xFFFF (24kb)
; I/O MAP
2020-12-06 15:51:26 +01:00
; I/O 0 (0x00 - 0x1F) Parallel terminal (uses addr 0x00 only)
; I/O 1 (0x20 - 0x3F) Sound card (uses addr 0x20 only)
; I/O 2 (0x40 - 0x5F)
; I/O 3 (0x60 - 0x7F)
; I/O 4 (0x80 - 0x9F)
; I/O 5 (0xA0 - 0xBF)
; I/O 6 (0xC0 - 0xDF)
; I/O 7 (0xE0 - 0xFF)
2020-11-01 13:06:01 +01:00
; MEMORY CONFIGURATION
SYS_VAR_SPACE: EQU 0x8000
DRV_VAR_SPACE: EQU 0x9000
APP_SPACE: EQU 0xA000
2020-10-27 20:08:07 +01:00
; SYSTEM CONFIGURATION
IO_0: EQU 0x00
IO_1: EQU 0x20
IO_2: EQU 0x40
IO_3: EQU 0x60
IO_4: EQU 0x80
IO_5: EQU 0xA0
IO_6: EQU 0xC0
IO_7: EQU 0xE0
2020-10-27 20:08:07 +01:00
;include 'drivers/hd44780.asm'
;include 'drivers/keyboard.asm'
2020-12-06 15:51:26 +01:00
include 'drivers/arduino_terminal.asm'
include 'drivers/sn76489.asm'
2020-12-06 15:51:26 +01:00
include 'monitor.asm'
include 'libs/time.asm'
2020-12-06 15:51:26 +01:00
;include 'tests/sndtest.asm'
2020-10-27 20:08:07 +01:00
2020-12-06 15:51:26 +01:00
; **** SYSTEM CALLS ****
2020-11-23 08:47:23 +01:00
2020-12-06 15:51:26 +01:00
; Prints string
; @param BC Pointer to a null-terminated string first character
Print:
call Term_print
ret
2020-12-06 15:51:26 +01:00
; Writes a single character
; @param A Value of character to print
Printc:
call Term_printc
ret
2020-12-06 15:51:26 +01:00
; Reads a single character
; @return A The read character
Readc:
call Term_readc
ret
2020-12-06 15:51:26 +01:00
; Reads a line
; @return BC The pointer to a null-terminated read string
Readline:
call Term_readline
ret
2020-11-23 08:47:23 +01:00
2020-12-06 15:51:26 +01:00
; Emits system beep
Beep:
call Snd_beep
ret
2020-12-06 15:51:26 +01:00
; **** SYSTEM INITIALIZATION ****
Sysinit:
; Init snd driver
call Snd_init
2020-12-06 15:51:26 +01:00
; Init video
; TODO
; Wait for audio amp to unmute
ld bc, TIME_DUR_SECOND
call Time_delay55
2020-12-06 15:51:26 +01:00
; Play startup sound
call Beep
; Run memory monitor
call Monitor_main
halt