mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 21:38:05 +11:00
Compare commits
No commits in common. "4e1fe916be053e45a04947348787e6d9e0e7ffd0" and "06a4674317d51d4e79cdcc7ad3c71e8a32913624" have entirely different histories.
4e1fe916be
...
06a4674317
2
blk/569
2
blk/569
@ -4,7 +4,7 @@
|
||||
DROP
|
||||
1+ DUP 7 = IF DROP 0 THEN ( inc gid )
|
||||
1 OVER LSHIFT 0xff -^ ( group dmask ) _get
|
||||
DUP 0xff = NOT UNTIL _wait
|
||||
DUP 0xff = NOT UNTIL
|
||||
( gid dmask )
|
||||
0xff XOR ( dpos ) 0 ( dindex )
|
||||
BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1-
|
||||
|
4
blk/570
4
blk/570
@ -8,7 +8,5 @@
|
||||
SWAP 0x81 = _2nd!
|
||||
_gti + C@
|
||||
DUP 0 0x80 >< UNTIL ( loop if not in range )
|
||||
( lowercase? )
|
||||
_2nd@ IF DUP 'A' 'Z' =><= IF 0x20 OR THEN THEN
|
||||
;
|
||||
_wait ;
|
||||
: KBD$ 0 [ KBD_MEM LITN ] C! ;
|
||||
|
@ -8,24 +8,11 @@ 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.
|
||||
|
||||
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.
|
||||
[Further reading](../../doc/ti8x.md)
|
||||
|
||||
## Recipe
|
||||
|
||||
This recipe gets the Collapse OS interpreter to run on the TI-84+, using its LCD
|
||||
This recipe gets the Collapse OS BASIC shell to run on the TI-84+, using its LCD
|
||||
screen as output and its builtin keyboard as input.
|
||||
|
||||
## Gathering parts
|
||||
@ -38,7 +25,7 @@ screen as output and its builtin keyboard as input.
|
||||
|
||||
## Build the ROM
|
||||
|
||||
Running `make` will result in `stage1.rom` being created.
|
||||
Running `make` will result in `os.rom` being created.
|
||||
|
||||
## Emulate
|
||||
|
||||
@ -51,30 +38,6 @@ Collapse OS prompt will appear. See `emul/hw/ti/README.md` for details.
|
||||
|
||||
## 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,
|
||||
including TI-OS.**
|
||||
|
||||
|
116
recipes/ti84/glue.asm
Normal file
116
recipes/ti84/glue.asm
Normal file
@ -0,0 +1,116 @@
|
||||
.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"
|
2
recipes/ti84/user.h
Normal file
2
recipes/ti84/user.h
Normal file
@ -0,0 +1,2 @@
|
||||
; RAMSTART + kernel usage + safety buffer
|
||||
.equ USER_RAMSTART 0x8040
|
@ -4,7 +4,6 @@ RAMSTART 0x70 + CONSTANT LCD_MEM
|
||||
RAMSTART 0x72 + CONSTANT KBD_MEM
|
||||
0x01 CONSTANT KBD_PORT
|
||||
212 LOAD ( z80 assembler )
|
||||
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
|
||||
262 LOAD ( xcomp )
|
||||
522 LOAD ( font compiler )
|
||||
: CODE XCODE ;
|
||||
@ -13,55 +12,8 @@ RAMSTART 0x72 + CONSTANT KBD_MEM
|
||||
: CREATE XCREATE ; ( for KBD tbls )
|
||||
: : [ ' 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. )
|
||||
|
||||
0x5a JPnn, 0x15 ZFILL, ( 0x18 )
|
||||
0x5a 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 )
|
||||
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 !
|
||||
|
||||
0x100 BIN( !
|
||||
282 LOAD ( boot.z80 )
|
||||
393 LOAD ( icore low )
|
||||
555 557 LOADR ( LCD low )
|
||||
@ -75,5 +27,5 @@ PC ORG @ 8 + !
|
||||
558 560 XPACKR ( LCD high )
|
||||
438 451 XPACKR ( print fmt readln )
|
||||
," : _ LCD$ KBD$ (ok) RDLN$ ; _ "
|
||||
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
|
||||
ORG @ 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
||||
|
Loading…
Reference in New Issue
Block a user