mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 21:38:05 +11:00
Compare commits
4 Commits
06a4674317
...
4e1fe916be
Author | SHA1 | Date | |
---|---|---|---|
|
4e1fe916be | ||
|
2791dd992e | ||
|
62ae1012df | ||
|
a6aba40327 |
2
blk/569
2
blk/569
@ -4,7 +4,7 @@
|
|||||||
DROP
|
DROP
|
||||||
1+ DUP 7 = IF DROP 0 THEN ( inc gid )
|
1+ DUP 7 = IF DROP 0 THEN ( inc gid )
|
||||||
1 OVER LSHIFT 0xff -^ ( group dmask ) _get
|
1 OVER LSHIFT 0xff -^ ( group dmask ) _get
|
||||||
DUP 0xff = NOT UNTIL
|
DUP 0xff = NOT UNTIL _wait
|
||||||
( gid dmask )
|
( gid dmask )
|
||||||
0xff XOR ( dpos ) 0 ( dindex )
|
0xff XOR ( dpos ) 0 ( dindex )
|
||||||
BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1-
|
BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1-
|
||||||
|
4
blk/570
4
blk/570
@ -8,5 +8,7 @@
|
|||||||
SWAP 0x81 = _2nd!
|
SWAP 0x81 = _2nd!
|
||||||
_gti + C@
|
_gti + C@
|
||||||
DUP 0 0x80 >< UNTIL ( loop if not in range )
|
DUP 0 0x80 >< UNTIL ( loop if not in range )
|
||||||
_wait ;
|
( lowercase? )
|
||||||
|
_2nd@ IF DUP 'A' 'Z' =><= IF 0x20 OR THEN THEN
|
||||||
|
;
|
||||||
: KBD$ 0 [ KBD_MEM LITN ] C! ;
|
: KBD$ 0 [ KBD_MEM LITN ] C! ;
|
||||||
|
@ -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.**
|
||||||
|
|
||||||
|
@ -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"
|
|
@ -1,2 +0,0 @@
|
|||||||
; RAMSTART + kernel usage + safety buffer
|
|
||||||
.equ USER_RAMSTART 0x8040
|
|
@ -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,55 @@ 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. )
|
||||||
|
|
||||||
|
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 !
|
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 +75,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!
|
||||||
|
Loading…
Reference in New Issue
Block a user