Talking to the IPC: How do you do it from low level?

Anything QL Software or Programming Related.
User avatar
Pr0f
QL Wafer Drive
Posts: 1548
Joined: Thu Oct 12, 2017 9:54 am

Re: Talking to the IPC: How do you do it from low level?

Post by Pr0f »

For the IPC > ZX8302 the communication is similar:

;
; Send 8 bits
;
IPC_Send_8:
mov r5,#008H
jmp L0358
;
; Send 4 bits
;
IPC_Send_4:
swap a
mov r5,#004H
L0358:
rl a
mov r6,a
jb0 L0369
L035C:
in a,p2
jb7 L035C
movx @r0,a
anl p2,#07FH
movx @r0,a
orl p2,#080H
mov a,r6
djnz r5,L0358
ret
;
L0369:
in a,p2
jb7 L0369
movx @r0,a
orl p2,#080H
movx @r0,a
mov a,r6
djnz r5,L0358
ret

R5 is used as a loop counter - doing either 4 or 8 passes. At L035C - we read P2 port looking for it to drop to 0 - in other words - we can't transmit any bits until the ZX8302 tells us by dropping COMDATA to 0.

Depending on whether the bit to be sent is a 0 or 1:

If a 0 is to be sent :

As soon as we see COMDATA go to 0 we pulse /WR line low on the IPC (bit 6 of the port for reading IPC (COMCTL), and then perform a literal AND on P2 (preserve other values on the port but reset bit 7 - this sends a 0 on COMMDATA and we send another /WR pulse (COMCTL) and then set COMDATA back to 1 and loop around for the next bit

If a 1 is to be sent:

As soon as we see COMDATA go to 0 we pulse /WR line low on the IPC (bit 6 of the port for reading IPC (COMCTL), and then perform a literal OR on P2 (preserve other values on the port but set bit 7 - this sends a 1 on COMMDATA and we send another /WR pulse (COMCTL) and loop around for the next bit

So in both cases for writing bits - COMCTL will pulse low twice - once before and once after the bit sent, and in both cases we wait for COMDATA to go low before we send anything, leaving it high after sending


User avatar
Pr0f
QL Wafer Drive
Posts: 1548
Joined: Thu Oct 12, 2017 9:54 am

Re: Talking to the IPC: How do you do it from low level?

Post by Pr0f »

Ah - I see someone replied in the time it was taking me to write my reply - lol.


stephen_usher
Super Gold Card
Posts: 524
Joined: Tue Mar 11, 2014 8:00 pm
Location: Oxford, UK.
Contact:

Re: Talking to the IPC: How do you do it from low level?

Post by stephen_usher »

Looks like, at least on emulators (qlay3, which has IPC emulation), you don't have to send tree bits per bit, just one at a time.

I managed to get the RESET command working but selftest doesn't seem to want to take an argument to echo, but that may be an emulator bug as I doubt anyone tested that.

I've had to put the diag ROM project on hold now as I have to build a model railway for RetroFest2025 (Steam, in Swindon, 31st May, 1st June) and I only have four and a bit weeks! (*gulp*)


Post Reply