A83: Linkport stuff...


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

A83: Linkport stuff...




Here it is...for you people who want it!
----------------------------------------------------------------------------
-------------

POST THIS ANYWHERE, JUST GIVE ME CREDIT


First of all, the Linkport is naturally high and gets _pulled_ low. OK,
now that that's out of the way heres how to do stuff:

#1: Go into your ti83asm.inc file and find the linkport equates. Change
them to look like this: 
;      LINK PORT WRITE EQUATES
;
D0LD1L      .equ              0D3h
D0LD1H      .equ              0D1h
D0HD1L      .equ              0D2h
D0HD1H      .equ              0D0h
BPORT       .equ              0

Now, to pull data line 0 (D0) low and keep D1 high, do this:
ld a,D0LD1H
out (0),a

To pull both low:
ld a,D0LD1L
out (0),a

I think you get the idea.

Remember that you CANNOT make any ROM calls and keep the lines pulled
low. If you make a call such as _getkey, or _puts the lines will go high.

Next, to input stuff:

To put the state of the lines into a, do this:
in a,(0)

Heres the equates:
ID0HD1H	.equ	31	;D0 & D1 high
IDOLD1H	.equ	26	;D0 low, D1 high
IDOHD1L	.equ	21	;D0 high, D1 low
IDOLD1L	.equ	16	;D0 & D1 pulled low

So, in order to wait until both lines are pulled low, do this:

loop:
	in a,(0)
	cp ID0LD1L
	jp z,bothlow	;if they're both low, goto bothlow
	jp loop		;No? continue looping

One note: Although you cannot use _getkey while holding lines low, you
CAN use direct input. Heres an example that pulls both lines low, then
releases them (high) until you hit clear:

.NOLIST
#define equ .equ
#define EQU .equ
#define end .end

#include "ti83asm.inc"
#include "tokens.inc"

.LIST
#define state	826Ah
#define		address		8265h
#define		address2	8266h

.org 9327h



	call _clrLCDFull		;this is all pointless text
	call _homeup
	set textInverse,(iy+textflags)
	ld hl,title
	call _puts
	res textInverse,(iy+textflags)
	call _newline
	ld hl,pressclear
	call _puts
	ld a,0			;sets the initial state of the
lines
	ld (state),a
	
loop:
	ld a,0FFh	;reset keyport
	out (1),a
	ld a,0FDh	;pick column the keys are in according to group
	out (1),a	;Required Syntax
	in a,(1) 	;Required Syntax
	cp 191		;check if clear is pressed
	jp z,quit	;if so goto quit

	call wait	;wait to slow down the speed

	call changestate	;change the state of the lines

	ld a,(state)		
	cp 0		;if the state if 0
	jp z,low	;goto low
	jp high		;else goto high
	
	
low:
	ld a,D0LD1L	;loads into a D0 & D1 are low
	out (0),a	;sends it to port 0 (linkport)
	jp loop		;return to loop

high:	
	ld a,D0HD1H	;loads into a D0 & D1 are low
	out (0),a	;sends it to port 0
	jp loop		;goto loop

	


changestate:
	ld a,(state)	;this is pretty simple
	cp 0
	jp z,sethigh
	ld a,0
	ld (state),a
	ret

sethigh:
	ld a,1
	ld (state),a	
	ret
	

quit:
	call _clrLCDFull
	call _homeup
	ret



wait:			;this is the wait routine
	ld hl,0000
	ld (address),hl
	jp loop2

inch:
	ld hl,(address)
	inc h
	ld (address),hl
	ld hl,(address)
	ld a,h
	cp 100	;this number is how long it waits, the higher the
longer
	jp z,doneW
	jp loop2

loop2:
	ld hl,(address)
	inc l
	ld a,l
	ld (address),a
	ld a,l
	cp 255
	jp z,inch
	ld hl,(address)
	ld a,(hl)
	jp loop2

doneW:
	ret



title:
.db "FIRST Strobe",0

pressclear:
.db "press clear",0

.end
END


If you have any questions or if something in here is wrong, email me.
Also, to get on a list of people to be email when my memxpander is done
you can email me.

Chris Brainerd


Follow-Ups: