2019-11-08 03:52:29 +11:00
|
|
|
.equ RAMSTART 0x8000
|
|
|
|
.equ RAMEND 0xbfff
|
|
|
|
.equ PORT_INT_MASK 0x03
|
|
|
|
.equ INT_MASK_ON 0x00
|
|
|
|
.equ PORT_INT_TRIG 0x04
|
|
|
|
.equ INT_TRIG_ON 0x00
|
|
|
|
.equ PORT_BANKB 0x07
|
|
|
|
|
|
|
|
jp boot
|
|
|
|
|
|
|
|
.fill 0x18-$
|
|
|
|
jp boot ; reboot
|
|
|
|
|
|
|
|
.fill 0x38-$
|
|
|
|
jp handleInterrupt
|
|
|
|
|
|
|
|
.fill 0x53-$
|
|
|
|
jp boot
|
|
|
|
; 0x0056
|
|
|
|
.db 0xFF, 0xA5, 0xFF
|
|
|
|
|
|
|
|
.fill 0x64-$
|
|
|
|
|
|
|
|
.inc "err.h"
|
2019-11-14 12:38:06 +11:00
|
|
|
.inc "ascii.h"
|
2019-11-08 03:52:29 +11:00
|
|
|
.inc "core.asm"
|
2019-11-15 01:55:31 +11:00
|
|
|
.inc "str.asm"
|
2019-11-12 05:24:50 +11:00
|
|
|
.equ FNT_WIDTH 3
|
|
|
|
.equ FNT_HEIGHT 5
|
2019-11-08 03:52:29 +11:00
|
|
|
.inc "fnt/mgm.asm"
|
2019-11-08 12:52:09 +11:00
|
|
|
.equ LCD_RAMSTART RAMSTART
|
2019-11-08 03:52:29 +11:00
|
|
|
.inc "ti/lcd.asm"
|
2019-11-09 12:27:43 +11:00
|
|
|
.equ KBD_RAMSTART LCD_RAMEND
|
2019-11-08 03:52:29 +11:00
|
|
|
.inc "ti/kbd.asm"
|
2019-11-09 12:27:43 +11:00
|
|
|
.equ STDIO_RAMSTART KBD_RAMEND
|
2019-11-09 06:04:56 +11:00
|
|
|
.equ STDIO_GETC kbdGetC
|
2019-11-08 03:52:29 +11:00
|
|
|
.equ STDIO_PUTC lcdPutC
|
|
|
|
.inc "stdio.asm"
|
|
|
|
|
2019-12-02 12:11:13 +11:00
|
|
|
; *** BASIC ***
|
|
|
|
|
|
|
|
; RAM space used in different routines for short term processing.
|
2019-12-13 04:04:56 +11:00
|
|
|
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
|
2019-12-02 12:11:13 +11:00
|
|
|
.equ SCRATCHPAD STDIO_RAMEND
|
2019-11-16 07:37:49 +11:00
|
|
|
.inc "lib/util.asm"
|
2019-12-02 12:11:13 +11:00
|
|
|
.inc "lib/ari.asm"
|
2019-11-16 07:37:49 +11:00
|
|
|
.inc "lib/parse.asm"
|
2019-12-02 12:11:13 +11:00
|
|
|
.inc "lib/fmt.asm"
|
|
|
|
.equ EXPR_PARSE parseLiteralOrVar
|
|
|
|
.inc "lib/expr.asm"
|
|
|
|
.inc "basic/util.asm"
|
|
|
|
.inc "basic/parse.asm"
|
|
|
|
.inc "basic/tok.asm"
|
|
|
|
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
|
|
|
|
.inc "basic/var.asm"
|
|
|
|
.equ BUF_RAMSTART VAR_RAMEND
|
|
|
|
.inc "basic/buf.asm"
|
|
|
|
.equ BAS_RAMSTART BUF_RAMEND
|
|
|
|
.inc "basic/main.asm"
|
|
|
|
|
|
|
|
.out BAS_RAMEND
|
2019-11-08 03:52:29 +11:00
|
|
|
boot:
|
|
|
|
di
|
2019-12-02 12:11:13 +11:00
|
|
|
ld sp, RAMEND
|
2019-11-12 05:24:50 +11:00
|
|
|
im 1
|
2019-11-08 03:52:29 +11:00
|
|
|
|
|
|
|
; enable ON key interrupt
|
|
|
|
in a, (PORT_INT_MASK)
|
|
|
|
set INT_MASK_ON, a
|
|
|
|
out (PORT_INT_MASK), a
|
|
|
|
ld a, 0x80
|
|
|
|
out (PORT_BANKB), a
|
|
|
|
|
|
|
|
ei
|
|
|
|
|
|
|
|
call lcdOff
|
|
|
|
|
|
|
|
; sleep until we press ON
|
|
|
|
halt
|
|
|
|
|
|
|
|
main:
|
2019-12-02 12:11:13 +11:00
|
|
|
; Fun fact: if I place this line just above basStart like I would
|
|
|
|
; normally do, my TI-84+ refuses to validate the binary. But placed
|
|
|
|
; here, validation works fine.
|
|
|
|
call basInit
|
2019-11-09 12:27:43 +11:00
|
|
|
call kbdInit
|
2019-11-08 03:52:29 +11:00
|
|
|
call lcdInit
|
|
|
|
xor a
|
|
|
|
call lcdSetCol
|
2019-12-02 12:11:13 +11:00
|
|
|
jp basStart
|
2019-11-08 03:52:29 +11:00
|
|
|
|
|
|
|
handleInterrupt:
|
|
|
|
di
|
|
|
|
push af
|
|
|
|
|
|
|
|
; did we push the ON button?
|
|
|
|
in a, (PORT_INT_TRIG)
|
|
|
|
bit INT_TRIG_ON, a
|
|
|
|
jp z, .done ; no? we're done
|
|
|
|
|
|
|
|
; yes? acknowledge and boot
|
|
|
|
in a, (PORT_INT_MASK)
|
|
|
|
res INT_MASK_ON, a ; acknowledge interrupt
|
|
|
|
out (PORT_INT_MASK), a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ei
|
|
|
|
jp main
|
2019-11-12 05:24:50 +11:00
|
|
|
|
2019-11-08 03:52:29 +11:00
|
|
|
.done:
|
|
|
|
pop af
|
|
|
|
ei
|
|
|
|
reti
|
|
|
|
|
|
|
|
FNT_DATA:
|
2019-11-12 05:24:50 +11:00
|
|
|
.bin "fnt/3x5.bin"
|