1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 18:08:06 +11:00

ti84: offset binary by 0x100 to free space for TI-specific stuff

Not yet tried on real hardware, but we should be getting pretty
close...
This commit is contained in:
Virgil Dupras 2020-05-10 14:06:01 -04:00
parent 62ae1012df
commit 2791dd992e
2 changed files with 74 additions and 4 deletions

View File

@ -8,11 +8,24 @@ screen. With a tiny font, the best we can get is a 24x10 console.
There is, however, a built-in USB controller that might prove very handy. There is, however, a built-in USB controller that might prove very handy.
[Further reading](../../doc/ti8x.md) I haven't opened one up yet, but apparently, they have limited scavenging value
because its z80 CPU is packaged in a TI-specific chip. Due to its sturdy design,
and its ample RAM and flash, we could imagine it becoming a valuable piece of
equipment if found intact.
The best pre-collapse ressource about it is
[WikiTI](http://wikiti.brandonw.net/index.php).
As it is now, with its tiny screen and cumbersome keyboard, Collapse OS is
not really usable on the TI-84+. One could imagine a scenario where one has a
terminal and uses the TI-84+ through the link for its large amount of flash and
RAM. But using it standalone? Nah, not even post-collapse.
Therefore, this recipe is more of a "look, I run!" demo.
## Recipe ## Recipe
This recipe gets the Collapse OS BASIC shell to run on the TI-84+, using its LCD This recipe gets the Collapse OS interpreter to run on the TI-84+, using its LCD
screen as output and its builtin keyboard as input. screen as output and its builtin keyboard as input.
## Gathering parts ## Gathering parts
@ -25,7 +38,7 @@ screen as output and its builtin keyboard as input.
## Build the ROM ## Build the ROM
Running `make` will result in `os.rom` being created. Running `make` will result in `stage1.rom` being created.
## Emulate ## Emulate
@ -38,6 +51,30 @@ Collapse OS prompt will appear. See `emul/hw/ti/README.md` for details.
## Upload to the calculator ## Upload to the calculator
### Background notes
Getting software to run on it is a bit tricky because it needs to be signed
with TI-issued private keys. Those keys have long been found and are included
in `keys/`. With the help of the
[mktiupgrade](https://github.com/KnightOS/mktiupgrade), an upgrade file can be
prepared and then sent through the USB port with the help of
[tilp](http://lpg.ticalc.org/prj_tilp/).
That, however, requires a modern computing environment. As of now, there is no
way of installing Collapse OS on a TI-8X+ calculator from another Collapse OS
system.
Because it is not on the roadmap to implement complex cryptography in Collapse
OS, the plan is to build a series of pre-signed bootloader images. The
bootloader would then receive data through either the Link jack or the USB port
and write that to flash (I haven't verified that yet, but I hope that data
written to flash this way isn't verified cryptographically by the calculator).
As modern computing fades away, those pre-signed binaries would become opaque,
but at least, would allow bootstrapping from post-modern computers.
### Instructions
**WARNING: the instructions below will wipe all the contents of your calculator, **WARNING: the instructions below will wipe all the contents of your calculator,
including TI-OS.** including TI-OS.**

View File

@ -4,6 +4,7 @@ RAMSTART 0x70 + CONSTANT LCD_MEM
RAMSTART 0x72 + CONSTANT KBD_MEM RAMSTART 0x72 + CONSTANT KBD_MEM
0x01 CONSTANT KBD_PORT 0x01 CONSTANT KBD_PORT
212 LOAD ( z80 assembler ) 212 LOAD ( z80 assembler )
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
262 LOAD ( xcomp ) 262 LOAD ( xcomp )
522 LOAD ( font compiler ) 522 LOAD ( font compiler )
: CODE XCODE ; : CODE XCODE ;
@ -12,8 +13,40 @@ RAMSTART 0x72 + CONSTANT KBD_MEM
: CREATE XCREATE ; ( for KBD tbls ) : CREATE XCREATE ; ( for KBD tbls )
: : [ ' X: , ] ; : : [ ' X: , ] ;
( TI-84+ requires specific code at specific offsets which
come in conflict with Collapse OS' stable ABI. We thus
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 )
( handleInterrupt )
DI,
AF PUSHqq,
( did we push the ON button? )
0x04 ( PORT_INT_TRIG ) INAn,
0 ( INT_TRIG_ON ) A BITbr,
IFNZ,
( yes? acknowledge and boot )
0x03 ( PORT_INT_MASK ) INAn,
0x00 ( INT_MASK_ON ) A RESbr, ( ack interrupt )
0x03 ( PORT_INT_MASK ) OUTnA,
AF POPqq,
EI,
0x100 JPnn,
THEN,
AF POPqq,
EI,
RETI,
0x03 ZFILL, ( 0x53 )
0x100 JPnn, ( 0x56 ) 0xff A, 0xa5 A, 0xff A,
0xa7 ZFILL, ( 0x100 )
( All set, carry on! )
CURRENT @ XCURRENT ! CURRENT @ XCURRENT !
0x100 BIN( !
282 LOAD ( boot.z80 ) 282 LOAD ( boot.z80 )
393 LOAD ( icore low ) 393 LOAD ( icore low )
555 557 LOADR ( LCD low ) 555 557 LOADR ( LCD low )
@ -27,5 +60,5 @@ PC ORG @ 8 + !
558 560 XPACKR ( LCD high ) 558 560 XPACKR ( LCD high )
438 451 XPACKR ( print fmt readln ) 438 451 XPACKR ( print fmt readln )
," : _ LCD$ KBD$ (ok) RDLN$ ; _ " ," : _ LCD$ KBD$ (ok) RDLN$ ; _ "
ORG @ 256 /MOD 2 PC! 2 PC! ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!