;4 player adapter sample code by gpz/hit ;D&H adapter ASM ;--------------------------------------- joy3reg = $02 ; example joy-regs joy4reg = $03 btemp = $04 ; temp for display ;--------------------------------------- ; main ;--------------------------------------- *= $1000 ; ; usual irq setup ; sei lda #>irq sta $0315 lda # bit 2 input lda $dd00 ;read cia 2 p.A and #%00000100 ;check bit 2 asl a asl a ora joy3reg sta joy3reg ; ; read button joy 4 ; lda #$ff ;serial data register sta $dc0c;=> writing $ff causes ;cia to output some ;count signals at cnt1 lda $dd0c ;read cia 2 serial in beq fire ;button press if zero lda joy4reg ora #%00010000 sta joy4reg fire ; ; restore cia 2 registers ; ciasave1 lda #$00 sta $dd00 ciasave2 lda #$00 sta $dd02 rts ;--------------------------------------- setup ;--------------------------------------- ;warning: do not mess around with this ; unless you really know what ; you are doing! wrong cia setup ; may toast your cia's ! ;--------------------------------------- ; ; cia 2 setup ; lda #$00 ; port b direction sta $dd03 ; => input lda #$01 sta $dd04 ; timer a lowbyte lda #$00 sta $dd05 ; timer a highbyte lda #%00010001 sta $dd0e ; control register a ; timer: start ; continous ; forced load ; serial port: input ; ; cia 1 setup ; lda #$01 sta $dc04 ; timer a lowbyte lda #$00 sta $dc05 ; timer a highbyte lda #%01010001 sta $dc0e ; control register a ; timer: start ; continous ; forced load ; serial port: output lda #$ff ;serial data register sta $dc0c;=> writing $ff causes ;cia to output some ;count signals at cnt1 rts