[A83] Ambivalent Ion programs


[Prev][Next][Index][Thread]

[A83] Ambivalent Ion programs




would it be possible to let an Ion program do one thing if ran from Ion
and another thing when ran from TIOS??

something like:

...blah blah...
#ifdef TI83P
        .org progstart-2
        .db $BB,$6D
#else
        .org progstart
#endif
        jr noion     -     to go to tios routine
        jr start        -    to go to ion routine
        .db "Nice program name",0
start:
    ...code...
noion:
    ...code...

I know this example would never work, because where i put "jr noion" it
takes 2 bytes, instead of the one byte (ret or xor a) in the ion header

another (maybe working) way would be:
    ...Ion header with xor a....

start:
    ld hl, some place where ion routines reside
    ld a,(hl)
    cp (key-byte which would only be there when ion is ran)
    jp nz, TIOS-Part


Any thoughts?

--peter martijn

P.S.
Don't come with "what uses would it have", it would be fun to use this
to impress friends or to make an ordinary ION program put a text like "I
hate the tios, run me from ion" when started from tios (or maybe crash
the calc, but that wouldn't be nice)