home *** CD-ROM | disk | FTP | other *** search
- ;
- ;BinLink v1.0 for the TI82 (ASH)
- ; by
- ; Sami Khawam (sKhawam@bigfoot.com).
- ;
- ;
- ;This is a small program I wrote when I was developping the IR Link
- ;in order to debug and test it. This program shows the data coming
- ;from the link port in binary mode, and it also let you send bytes
- ;also in binary mode.
- ;
- ;There are only 3 keys used: 1, 0 and Exit.
- ;
- ;In order to distinguish between what is received and what is
- ;sent, the program show the the received data in white-on-black.
- ;
- ;--
- ; Sami Khawam (sKhawam@bigfoot.com)
- ;
- ; http://unet.univie.ac.at/~a9501901
-
-
- #INCLUDE "TI82.H"
- #INCLUDE "KEYS.INC"
-
- PORT = 000H
-
- .ORG START_ADDR
- .db "BinLink by Sami Khawam",0
-
-
- ROM_CALL(CLEARLCD)
- ld de, $0000
- ld (CURSOR_ROW), de
- Start:
- ld b, 8
-
- ProgLoop:
-
- in a, (PORT)
- and 3
- cp 3
- jr z, CheckKey
-
- push bc
- call GetByte
- ld c, a
- call DispCBin
- pop bc
-
-
- CheckKey
- call GET_KEY
- cp G_MODE
- ret z
- cp G_1
- jr z, Bit1
- cp G_0
- jr z, Bit0
- jr ProgLoop
-
- Bit1
- scf
- rl c
- ld a, '1'
- jr CheckSnd
-
- Bit0
- sla c
- ld a, '0'
- jr CheckSnd
-
- CheckSnd:
- ROM_CALL(TX_CHARPUT)
- djnz ProgLoop
- ld a, c
- call PutByte
- ld a, $FF
- ROM_CALL(TX_CHARPUT)
- jr Start
-
-
-
-
- DispCBin:
- set 3,(IY+05)
- ld b, 8
- DC_NextBit
- rl c
- jr nc, DC_Zero
- ld a, '1'
- jr DC_Disp
- DC_Zero
- ld a, '0'
- DC_Disp
- ROM_CALL(TX_CHARPUT)
- djnz DC_NextBit
- res 3,(IY+05)
- ld a, $FF
- ROM_CALL(TX_CHARPUT)
- ret
-
-
-
- ; Thanks for Randy Gluvna (gluvna@home.com) for this recieve routine.
-
-
-
- GetByte:
- push bc
- LD B,008H
- R0:
- LD DE,0FFFFH
- JR R2
- R1:
- IN A,(PORT)
- AND 003H
- jr z, GB_End
- CP 003H
- JR NZ,R3
- IN A,(PORT)
- AND 003H
- jr z, GB_End
- CP 003H
- JR NZ,R3
- R2:
- DEC DE
- LD A,D
- OR E
- JR NZ,R1
- jr GB_End
- R3:
- SUB 002H
- JR NC,R8
- LD A,0D4H
- OUT (PORT),A
- RR C
- LD DE,0FFFFH
- R4:
- IN A,(PORT)
- AND 003H
- CP 002H
- JR Z,R5
- DEC DE
- LD A,D
- OR E
- JR NZ,R4
- jr GB_End
- R5:
- LD A,0C0H
- OUT (PORT),A
- LD D,004H
- R6:
- DEC D
- JR Z,R7
- IN A,(PORT)
- AND 003H
- CP 003H
- JR NZ,R6
- R7:
- DJNZ R0
- LD A,C
- jr GB_End
- R8:
- LD A,0E8H
- OUT (PORT),A
- RR C
- LD DE,0FFFFH
- R9:
- IN A,(PORT)
- AND 003H
- CP 001H
- JR Z,R5
- DEC DE
- LD A,D
- OR E
- JR NZ,R9
- GB_End
- pop bc
- ret
-
-
-
- PutByte:
- push bc
- LD C,A
- LD B,8 ; 8 Bits
-
- PB_Next_Bit:
-
- LD A, $C0 ; Set W1 and R1
- OUT (PORT),A
-
- Cont:
- RR C
- JR NC, PB_SendZero
- PB_SendOne:
- LD A, $E8
- JR PB_Output_val
- PB_SendZero:
- LD A, $D4
- PB_Output_val:
- OUT (PORT),A
-
- LD DE, $FFFF ; For time-out
- PB_Wait_for_W0_and_R0:
- IN A,(PORT)
- AND 3
- JR Z, PB_Continue
- IN A,(PORT)
- AND 3
- JR Z, PB_Continue
- DEC DE
- LD A,D
- OR E
- JR NZ, PB_Wait_for_W0_and_R0
- JR PB_End ; If error return.
-
- PB_Continue:
- LD A, $C0 ; Set W1 and R1
- OUT (PORT),A
-
- LD DE, $FFFF ; Reload time-out
- PB_Wait_for_W1_and_R1:
- DEC DE
- LD A,D
- OR E
- JR Z, PB_End
- IN A,(PORT)
- AND 3
- CP 3
- JR NZ, PB_Wait_for_W1_and_R1
-
- DJNZ PB_Next_Bit
- PB_End:
- LD A, $C0 ; Set W1 and R1
- OUT (PORT),A
- POP BC
- RET
-
-
- .end
-