Calculator Community > KnightOS

TI-84+ Incompatability Problems

(1/8) > >>

SirCmpwn:
Hello,
I'm having some issues with KnightOS.  As of right now, it runs fine on the TI-83+ (SE).  However, on the TI-84+ (SE), it crashes.  I believe this to be caused by improper USB interrupt handling.  KnightOS runs without incident if interrupts are turned on, but as soon as interrupts (and multitasking) are turned on, it will crash.  Here is my USB interrupt code:

--- Code: ---HandleUSBEvents:
ld a, (ModelID)
cp 2 ; Models 2 and up have USB.
jp c, ResumeInterrupt ; Leave if we don't have the hardware (also tested with NC)
in a, (55h) ; Read USB status
bit 0, a
jr z, UnknownUSBEvent
bit 2, a
jr z, USBLineInterrupt
bit 4, a
jp z, USBProtocolInterrupt
jp ResumeInterrupt

UnknownUSBEvent:
xor a
out (5Bh), a ; Unknown event, WikiTI claims you should zero port 5B to acknowledge
jp ResumeInterrupt

USBLineInterrupt:
in a, (56h)
ld c, a
cpl ; xor 0FFh
ld b, a
in a, (57h)
ld d, a
and b
out (57h), a
ld a, d
out (57h), a ; Ack the interrupt without doing anything special
jp ResumeInterrupt

USBProtocolInterrupt:
in a, (86h)
ld c, a
in a, (84h)
ld b, a
in a, (85h)
in a, (83h)
in a, (82h) ; Just ack and leave, and hope that it doesn't get angry

jp ResumeInterrupt
--- End code ---

However, if you don't notice anything wrong with this, it may not be the problem.  Also suspect is the code that sets up the memory mappings on boot:

--- Code: ---    ld a, 1    ; Set flash page 1 in bank 1.
    out (6), a
    in a, (2)    ;get calc version
    rlca ;Roll bit 7 into carry.
    ld a, 41h ; Set ram page 1 in bank 2.
    jr nc, LowerModel ; C vs NC?
HigherModel:
    out (5),a
    ld a,81h
    out (7),a
    jr Return
LowerModel:
    out (6), a
    out (7),a
Return:
    ret
--- End code ---
I'd put my money on USB interrupts, but that's just me.  You are now looking at the only model-dependent code in the whole OS, so this is pretty much where the problem has to lie.  Is there any hardware I may not have initialized properly, or something I may have left out that is required on the TI-84+ (SE)?

calc84maniac:
Could it be that you are putting RAM page 1 into both $8000-$BFFF and $C000-$FFFF? You'd probably want to put RAM page 0 in $C000-$FFFF to have the same mapping as TI-83+

SirCmpwn:
Ah, that could present an issue.  I want an executable page in both, though, is that possible?  Compatibility with calculators missing RAM is vital.

calcdude84se:
Paging the single extra RAM page in as page 3 rather than page 2 would allow you to execute stuff on it. :)

calc84maniac:
Yeah, you can put an odd-numbered page in (usually people use 3, but that's due to Omnicalc using pages 4-7, which you don't have to worry about for KOS)

Navigation

[0] Message Index

[#] Next page

Go to full version