PORT .BY $00,$00,$00,$00 INIT LDA #$80 STA $DD03 // CIA2 PortB Bit7 as OUT LDA $DD01 // force Clock-Stretching (SuperCPU) STA $DD01 // and release Port RTS READ LDA $DC01 // read Port1 AND #$1F STA PORT+$00 LDA $DC00 // read Port2 AND #$1F STA PORT+$01 LDA $DD01 // CIA2 PortB Bit7 = 1 ORA #$80 STA $DD01 LDA $DD01 // read Port3 AND #$1F STA PORT+$02 LDA $DD01 // CIA2 PortB Bit7 = 0 AND #$7F STA $DD01 LDA $DD01 // read Port4 PHA // Attention: FIRE for Port4 on Bit5, NOT 4! AND #$0F STA PORT+$03 PLA AND #$20 LSR ORA PORT+$03 STA PORT+$03 RTS