Re: A86: Port 7
[Prev][Next][Index][Thread]
Re: A86: Port 7
Stein Sem-Jacobsen wrote:
>
> I've got a problem. I've hooked up a 7404 (acting as a buffer to some LED's)
> to the port, and I'm trying to alter the port pins. But when I'm writing to
> the port, the appropriate pins just "blink" to ground. At the same time
> (loger duration then the blink) the calculator freezes for a short period
> that means that it will not accept the Exit key or any other key. Exept when
> I use the Left key, so the port stays at its startingposition, -both pins
> active. Please look through my code and see if I've made any mistakes. (It
> has nothing to say that the circuit is attached or not)
>
> Thanks in advance
[code snipped]
The immediate code looks okay to me, though I don't know how similar the
86 is to the 85. You should change the 'jp's that you have used to
'jr's as 'jr' is considerably more efficient, especially since you use
several!
You might want to look at the attatched program that I wrote for the
85. It does pretty much the same thing, but is a little more visually
appealing. ;) If you wanted to use it on the 86, it would, needless to
say, need to be slightly modified; you have my permission to go ahead
and to this if you like! :)
Cheers,
--
~Keith
tsk3000@Prodigy.Net
http://pages.prodigy.net/tsk3000/
; port7--The Link Port Driver v1.0
; Copyright (C) 1997 by Keith Burzinski <tsk3000@Prodigy.Net>
; -----
#include "TI-85.H"
.org 0
.db "Link Port Driver v1.0",0
Init:
ROM_CALL(CLEARLCD)
ld hl,$0000
ld ($800C),hl
ld hl,OutStr
ld de,(PROGRAM_ADDR)
add hl,de
ROM_CALL(D_ZT_STR)
ld hl,$0001
ld ($800C),hl
ld hl,InStr
ld de,(PROGRAM_ADDR)
add hl,de
ROM_CALL(D_ZT_STR)
ld hl,$3A01
ld (CURSOR_X),hl
ld hl,AuthorStr
ld de,(PROGRAM_ADDR)
add hl,de
ROM_CALL(D_ZM_STR)
KeyLoop:
CALL_(UpdateInput)
call get_key
cp K_0
jr z,SetBoth
cp K_1
jr z,SetWonly
cp K_2
jr z,SetRonly
cp K_3
jr z,ClearBoth
cp K_EXIT
jr z,Exit
jr KeyLoop
SetBoth:
ld a,$C0 ; R+ W+
out (7),a
ld hl,$0900
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
jr Put1W
SetWonly:
ld a, $D4 ; R- W+
out (7),a
ld hl,$0900
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
Put1W:
ld hl,$0F00
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
jr KeyLoop
SetRonly:
ld a,$E8 ; R+ W-
out (7),a
ld hl,$0900
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
jr Put0W
ClearBoth:
ld a, $FC ; R- W-
out (7),a
ld hl,$0900
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
Put0W:
ld hl,$0F00
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
jr KeyLoop
Exit:
ld a,$C0 ; R+ W+
out (7),a
ret
UpdateInput:
in a,(7)
and 3
cp 0
jr z,BothClear
cp 1
jr z,RedClear
cp 2
jr z,WhiteClear
BothSet:
ld hl,$0901
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
ld hl,$0F01
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
ret
BothClear:
ld hl,$0901
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
ld hl,$0F01
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
ret
WhiteClear:
ld hl,$0901
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
ld hl,$0F01
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
ret
RedClear:
ld hl,$0901
ld ($800C),hl
ld a,'1'
ROM_CALL(TX_CHARPUT)
ld hl,$0F01
ld ($800C),hl
ld a,'0'
ROM_CALL(TX_CHARPUT)
ret
OutStr:
.db "Outpt: R=1 W=1",0
InStr:
.db "Input: R=1 W=1",0
AuthorStr:
.db "By K. Burzinski "
.db "TSK3000@Prodigy.Net",0
.end
References:
- A86: Port 7
- From: "Stein Sem-Jacobsen" <ssemjaco@online.no>