Indeed, though one person is trying to be helpful but in a "this is my assembler code" sort of way. *sigh*rubber_jonnie wrote: Mon Apr 28, 2025 3:21 pm Good luck!!!
Not a very good response form the QL forum it seems![]()
I'm *GUESSING* that this is how you write and read bits to/from the IPC, but it's purely a guess:
Code: Select all
;***
;
; ipc_write_bit - Write a bit to the IPC with timeout.
;
; d0.b - Bit to be written in bit 0.
; d1.w - Timeout in number of retries reading the status bit.
; (Must be given)
;
; Returned values.
;
; d1.w - Zero if timeout error otherwise undefined.
;
;***
ipc_write_bit:
movem.l d2-d7/a0-a6,-(SP)
lea zx83_w_ipcwreg,a0 ; Load the ZX8302 registers into a0 and a1
lea zx83_r_cstatus,a1
rol.b #1,d0 ; Move the data bit to be bit 1
or.b #%00001100,d0 ; Or it with the rest of the required register content.
move.b d0,(a0) ; Write it to the IPC Write register.
ipc_write_bit_loop1: ; Loop around checking the status bit (6)
move.b (a1),d3
btst #6,d3
dbeq d1,ipc_write_bit_loop1 ; If it's not set then go around d1.w + 1 times.
addi.w #1,d1 ; Add 1 to d1. If the loop has completed then this will be -1
; We need it to be 0 as an error condition.
movem.l (SP)+,d2-d7/a0-a6
rts
;***
;
; ipc_read_bit - Read a bit from the IPC with timeout.
;
; Parameters
;
; d1.w - Timeout in number of retries reading the status register.
; (Must be given)
; Returns
;
; d0.b - Bit returned in bit 0 of the byte.
; d1.w - Timed out if 0 otherwise undefined.
;
;***
ipc_read_bit:
movem.l d2-d7/a0-a6,-(SP)
lea zx83_r_cstatus,a0 ; Load the address of the communication status register into a0
ipc_read_bit_loop1:
move.b (a0),d2 ; Get the contents of the communications status register into d2
btst #6,d2 ; Is the IPC acknowledge bit set?
dbeq d1,ipc_read_bit_loop1 ; No? If d1 is > -1 go around again.
addi.w #1,d1 ; If the timeout failed then d1 will be -1, so add 1.
andi.b #%1000000,d2 ; Mask off all the bits we're not interested in.
ror.b #7,d2 ; Move it to bit 0
move.b d2,d0 ; Copy it to d0
movem.l (SP)+,d2-d7/a0-a6
rts

