Added tinybasic
This commit is contained in:
@@ -2,6 +2,10 @@ STACK_TOP = 0xFFFF
|
||||
DELAY_LOOPS_PER_MS = 40
|
||||
MONITOR_BASE = 0xC000
|
||||
MONITOR_ROM_SOURCE = 0x0080
|
||||
TINYBASIC_BASE = 0xD000
|
||||
TINYBASIC_ROM_SOURCE = 0x1000
|
||||
|
||||
.include "tinybasic.inc"
|
||||
|
||||
.globl _main
|
||||
.globl _delay_ms
|
||||
@@ -10,6 +14,8 @@ MONITOR_ROM_SOURCE = 0x0080
|
||||
.globl _enable_interrupts
|
||||
.globl _disable_interrupts
|
||||
.globl _jump_to
|
||||
.globl _monitor_uart_putc
|
||||
.globl _monitor_uart_getc
|
||||
.globl monitor_image_end
|
||||
.globl s__DATA
|
||||
.globl l__DATA
|
||||
@@ -29,6 +35,11 @@ boot_copy:
|
||||
ld de, #MONITOR_BASE
|
||||
ld bc, #(monitor_image_end - MONITOR_BASE)
|
||||
ldir
|
||||
|
||||
ld hl, #TINYBASIC_ROM_SOURCE
|
||||
ld de, #TINYBASIC_BASE
|
||||
ld bc, #TINYBASIC_SIZE
|
||||
ldir
|
||||
jp init
|
||||
|
||||
.area _ITABLE (ABS)
|
||||
@@ -58,6 +69,13 @@ boot_copy:
|
||||
.dw ctc_isr ; CTC channel 2: vector 0x44
|
||||
.dw uart_isr ; CTC channel 3: vector 0x46
|
||||
|
||||
; Stable entry points for programs living alongside the monitor.
|
||||
; C050: write the character in A. C053: return a character in A, or 0.
|
||||
.org MONITOR_BASE + 0x50
|
||||
jp monitor_service_putc
|
||||
.org MONITOR_BASE + 0x53
|
||||
jp monitor_service_getc
|
||||
|
||||
.area _HOME
|
||||
init:
|
||||
di
|
||||
@@ -110,6 +128,38 @@ monitor_image_end:
|
||||
|
||||
.area _CODE
|
||||
|
||||
; Monitor ABI services preserve all working registers. PUTC also preserves AF;
|
||||
; GETC returns the received byte (or zero) in A.
|
||||
monitor_service_putc:
|
||||
push af
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
push ix
|
||||
push iy
|
||||
call _monitor_uart_putc
|
||||
pop iy
|
||||
pop ix
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
pop af
|
||||
ret
|
||||
|
||||
monitor_service_getc:
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
push ix
|
||||
push iy
|
||||
call _monitor_uart_getc
|
||||
pop iy
|
||||
pop ix
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
ret
|
||||
|
||||
.macro MAKE_ISR entry, handler
|
||||
.globl handler
|
||||
entry:
|
||||
|
||||
Reference in New Issue
Block a user