********************************************************************************
* ABM for the Apple II, by Silas Warner *
* Copyright 1980 Muse Software *
* *
* This is a subroutine used to read the joystick or paddles. The code is *
* modified directly by the Applesoft "ADJUST" program. *
********************************************************************************
* Disassembly by Andy McFadden, using 6502bench SourceGen v1.7.1. *
* Last updated 2020/08/06 *
********************************************************************************
BUTN0 .eq $c061 ;R switch input 0 / open-apple
MON_PREAD .eq $fb1e ;read paddle specifed by X-reg, return in Y-reg
.org $0300
********************************************************************************
* Reads X-axis paddle. *
* *
* On exit: *
* A-reg: paddle value (0-255) *
********************************************************************************
0300: 4c 0c 03 ReadPdlX jmp DoReadPdlX
********************************************************************************
* Reads Y-axis paddle. *
* *
* On exit: *
* A-reg: paddle value (0-255) *
********************************************************************************
0303: 4c 15 03 ReadPdlY jmp DoReadPdlY
********************************************************************************
* Read button that fires outer/center missiles. *
* *
* On exit: *
* Carry set if button changed state and is pressed *
********************************************************************************
0306: 4c 20 03 GetOuterBtn jmp DoGetOuterBtn
********************************************************************************
* Read button that fires inner missiles. *
* *
* On exit: *
* Carry set if button changed state and is pressed *
********************************************************************************
0309: 4c 3a 03 GetInnerBtn jmp DoGetInnerBtn
030c: a2 00 DoReadPdlX ldx #$00 ;0-3 (POKE 781,n)
030e: 20 1e fb jsr MON_PREAD ;do paddle read
0311: 98 tya
0312: 49 00 eor #$00 ;$00 or $ff (POKE 787,n); flips axis
0314: 60 rts
0315: a2 01 DoReadPdlY ldx #$01 ;0-3 (POKE 790,n)
0317: 20 1e fb jsr MON_PREAD ;do paddle read
031a: 98 tya
031b: 49 00 eor #$00 ;$00 or $ff (POKE 796,n); flips axis
031d: 60 rts
031e: 00 00 .junk 2
0320: a2 00 DoGetOuterBtn ldx #$00 ;0-2 (POKE 801,n); determines button #
0322: bd 61 c0 lda BUTN0,x ;read button
0325: 29 80 and #$80
0327: a0 00 :_Prev ldy #$00
0329: 8d 28 03 sta :_Prev+1 ;save for next time
032c: c9 00 :_Press cmp #$00 ;$00 or $80 (POKE 813,n); determines pressed state
032e: f0 07 beq :NoFire ;no change, return with carry clear
0330: cc 2d 03 cpy :_Press+1 ;is it pressed?
0333: d0 02 bne :NoFire ;no, return with carry clear
0335: 38 sec
0336: 60 rts
0337: 18 :NoFire clc
0338: 60 rts
0339: 00 .junk 1
033a: a2 00 DoGetInnerBtn ldx #$00 ;0-2 (POKE 827,n); determines button number
033c: bd 61 c0 lda BUTN0,x ;read button
033f: 29 80 and #$80
0341: a0 00 :_Prev ldy #$00
0343: 8d 42 03 sta :_Prev+1 ;save for next time
0346: c9 00 :_Press cmp #$00 ;$00 or $80 (POKE 839,n); determines pressed state
0348: f0 07 beq :NoFire ;no change, return with carry clear
034a: cc 47 03 cpy :_Press+1 ;is it pressed?
034d: d0 02 bne :NoFire ;no, return with carry clear
034f: 38 sec
0350: 60 rts
0351: 18 :NoFire clc
0352: 60 rts
0353: 00 00 00 00+ .junk 13