I am having a few problems. Basically when I run it and send a message the recieving calc won't return to type mode after it has recieved a message. And it won't display the past message until I send another one. Then it never returns to type mode. Here is an excerpt of some code; I would appreciate any help I can get:
Code:
KeyLoop:
call flashcursor ;flashes a cursor that I have made
push bc ;input routine
push hl
ld b,50
recieveagain:
push bc
ei
halt
di
in a,(0) ;read link port status
and 3
cp 3 ;if this sets NZ then there is a byte trying to be sent,
call nz,recieving ;so call the receive routine
keyloopa:
bcall(_GetCSC)
pop bc
OR A ; If no character recieved, restart
JR nz, keypressed
dec b
jr nz,recieveagain
pop hl
pop bc
jr keyloop
;this continues by displaying text to a place on the bottom of the screen
;
recieving:
ld b,66
xor a
ld (pointer),a
recieveloop:
call receive
ld c,a
ld a,(pointer)
cp BUFSIZE
call z,quitloop
ld h,0
ld l,a
ld de,reciever ;data location for the data to be stored
add hl,de
ld a,c
ld (hl),a
ld hl,pointer
inc (hl)
jr recieveloop
quitloop:
call storerecieved ;just stores the data to a data location that
call background ;functions like textscreen
call echoit ;background clears the background
ret ;echoit displays textscreen to the background
;Send routine
Send:
di
ld e,a ;Byte to send
ld a,1
out (0),a ;clock line low
TachyonLink_Send_Wait:
in a,(0)
and 2
jr nz,TachyonLink_Send_Wait
;Both lines have gone low
xor a
out (0),a ;set both high
TachyonLink_Send_Wait2:
in a,(0)
and 2
jr z,TachyonLink_Send_Wait2
;Start the sending loop
call TachyonLink_Pause
ld b,4
TachyonLink_Send_Loop:
;Now put a bit on the data line, clock low
xor a
rr e
ccf
rla
sl1 a
out (0),a
;now pause
call TachyonLink_Pause
;clock high with a bit
xor a
rr e
ccf
rla
add a,a
out (0),a
call TachyonLink_Pause
djnz TachyonLink_Send_Loop
xor a
out (0),a
ret
;Receive routine:
Receive:
di
ld e,0
TachyonLink_Receive_Wait:
in a,(0)
rra
jr c,TachyonLink_Receive_Wait
ld a,2
out (0),a
call TachyonLink_Pause
xor a
out (0),a
ld b,4
;Ready to receive
TachyonLink_Receive_Loop:
in a,(0)
rra
jr c,TachyonLink_Receive_Loop
;The clock went low...store data
in a,(0)
rra
rra
rr e
TachyonLink_Receive_Wait2:
in a,(0)
rra
jr nc,TachyonLink_Receive_Wait2
;The clock went high
in a,(0)
rra
rra
rr e
djnz TachyonLink_Receive_Loop
ld b,1
ld a,e
ret
TachyonLink_Pause:
;This pause is used by both routines, don't forget to copy it if you split them up.
ex (sp),hl
ex (sp),hl
push bc
pop bc
ret
sendit:
ld hl,screenname
ld a,(hl)
push hl
call Send
pop hl
inc hl
ld a,(hl)
push hl
call Send
pop hl
inc hl
ld a,(hl)
call Send
ld hl,buffer
ld b,60
sendloop:
ld a,(hl)
push hl
push bc
call Send
pop bc
pop hl
inc hl
djnz sendloop
ret
I am willing to include any other code necessary to find this problem. Thanks in advance for any help