ti84: working!

This commit is contained in:
Virgil Dupras 2020-05-10 14:33:35 -04:00
parent 2791dd992e
commit 4e1fe916be
3 changed files with 19 additions and 122 deletions

View File

@ -1,116 +0,0 @@
.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"
.inc "ascii.h"
.inc "core.asm"
.inc "str.asm"
.equ FNT_WIDTH 3
.equ FNT_HEIGHT 5
.inc "fnt/mgm.asm"
.equ LCD_RAMSTART RAMSTART
.inc "ti/lcd.asm"
.equ KBD_RAMSTART LCD_RAMEND
.inc "ti/kbd.asm"
.equ STDIO_RAMSTART KBD_RAMEND
.equ STDIO_GETC kbdGetC
.equ STDIO_PUTC lcdPutC
.inc "stdio.asm"
; *** BASIC ***
; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"
.inc "lib/parse.asm"
.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
boot:
di
ld sp, RAMEND
im 1
; 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:
; 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
call kbdInit
call lcdInit
xor a
call lcdSetCol
jp basStart
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
.done:
pop af
ei
reti
FNT_DATA:
.bin "fnt/3x5.bin"

View File

@ -1,2 +0,0 @@
; RAMSTART + kernel usage + safety buffer
.equ USER_RAMSTART 0x8040

View File

@ -18,8 +18,8 @@ RAMSTART 0x72 + CONSTANT KBD_MEM
offset the binary by 0x100, which is our minimum possible
increment and fill the TI stuff with the code below. )
0x100 JPnn, 0x15 ZFILL, ( 0x18 )
0x100 JPnn, ( reboot ) 0x1d ZFILL, ( 0x38 )
0x5a JPnn, 0x15 ZFILL, ( 0x18 )
0x5a JPnn, ( reboot ) 0x1d ZFILL, ( 0x38 )
( handleInterrupt )
DI,
AF PUSHqq,
@ -40,8 +40,23 @@ EI,
RETI,
0x03 ZFILL, ( 0x53 )
0x100 JPnn, ( 0x56 ) 0xff A, 0xa5 A, 0xff A,
0xa7 ZFILL, ( 0x100 )
0x5a JPnn, ( 0x56 ) 0xff A, 0xa5 A, 0xff A, ( 0x5a )
( boot )
DI,
(im1)
( enable the ON key interrupt )
0x03 ( PORT_INT_MASK ) INAn,
0x00 ( INT_MASK_ON ) A SETbr,
0x03 ( PORT_INT_MASK ) OUTnA,
A 0x80 LDrn,
0x07 ( PORT_BANKB ) OUTnA,
EI,
( LCD off )
A 0x02 ( LCD_CMD_DISABLE ) LDrn,
0x10 ( LCD_PORT_CMD ) OUTnA,
HALT,
0x95 ZFILL, ( 0x100 )
( All set, carry on! )
CURRENT @ XCURRENT !