AppleIIAsm-Collection/disks/disk1_stdio/T.GPBX.SUB
nathanriggs f5c097e70f STDIO disk 0.3.0 update
- added error handling
- no more massive library; just a subroutine per file. This is because Merlin doesn't like large files.
- added a "minify" BASIC utility that gets rid of *most* comments in a source textfile. This dramatically reduces space used if you're not terribly interested in non-inline comments.
- TFILL,THLIN,TVLIN and TPUT not directly access the video memory (page one), making for a much faster draw without interfering COUT.
- some stylistic changes, primarily to TFILL
- change required files to minified versions only. The whole files can be found on disk 2.
- got a norovirus so pretty much couldn't do anything requiring sustained attention, so focused on small things here and not on my dayjob. Cool.
- created a required.vars file that separates variables and settings from the other required files. Not minified.
- This current bout of revision will probably be the last, once all initial 6 disks are revamped, that focuses on all subroutines/macros in a given library at a single push. After this round, commits will be done on a subroutine or related file basis.
2019-01-13 23:48:09 -05:00

132 lines
3.0 KiB
Plaintext

*
*``````````````````````````````*
* GPBX :: GET PADDLE BUTTON X *
* *
* GETS STATE OF PADDLE BUTTON *
* SPECIFIED AND RET 0, 1 IN A *
*- -*
* CLOBBERS: *
* *
* FLAGS: ???----- REG: A-YM *
*- -*
* CYCLES: ??? *
* SIZE: *
*- -*
* USAGE: *
* LDA #>(ADDRESS) *
* PHA *
* LDA #<(ADDRESS) *
* PHA *
* JSR GPBX *
* *
* --- WHERE: *
* *
* BUTTON 0 = $C061 (PB0) *
* BUTTON 1 = $CO62 (PB1) *
* BUTTON 2 - $C063 (PB2) *
* BUTTON 3 = $C060 (PB3) *
*- -*
* ENTRY *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* LOW BYTE OF PDL BTN ADDRESS *
* HI BYTE OF PDL BTN ADDRESS *
*- -*
* EXIT *
* *
* TOP OF STACK *
* *
* LOW BYTE OF RETURN ADDRESS *
* HI BYTE OF RETURN ADDRESS *
* *
* A = 1 IF PRESSED, 0 IF NOT *
* X = UNCHANGED *
* Y = GARBAGE *
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
*
* CHANGE THIS LATER TO ACCEPT ALL BUTTONS, 0-4
*
GPBX
*
** SAVE RETURN ADDRESS
*
PLA
STA RETADR
PLA
STA RETADR+1
*
** GET PARAMETER
*
PLA
STA ADDR1 ; ZERO PAGE
PLA
STA ADDR1+1
*
*
********************************
*
** ERROR CONTROL
*
********************************
*
LDA ERRCTRL
CMP #1
BEQ :CHKERR
JMP :ERREND
:CHKERR
LDA ADDR1+1
CMP #$C0 ; MAX COL + 1
BNE :BADHI
LDA ADDR1
CMP #$64
BCS :BADLO
LDA ADDR1
CMP #$60
BCC :BADLO
JMP :ERREND
:BADHI
_ERR :E_SID;:E_BHI;:E_DMP1;RETURN;#10
JMP :ERREND
:BADLO
_ERR :E_SID;:E_BLO;:E_DMP1;RETURN;#10
*
********************************
*
:ERREND
*
********************************
*
*
LDY #$00
LDA (ADDR1),Y ; IF BTN = PUSHED
BMI :1
JMP :0
:1
LDY #$01 ; BTN PUSHED;A=1
JMP :EXIT
:0
LDY #$00 ; BTN NOT PUSHED;A=0
*
:EXIT
*
** RESTORE RETURN ADDRESS
*
LDA RETADR+1
PHA
LDA RETADR
PHA
*
TYA ; BTN FLAG MOVE TO A
RTS
*
** DATA
*
:E_SID ASC "GPBX (PBX MACRO)",00
:E_DMP1 ASC "DUMPING RETURN BLOCK...",00
:E_BHI ASC "BAD HIGH BYTE--NOT A PADDLE BUTTON!.",00
:E_BLO ASC "BAD LOW BYTE--NOT A PADDLE BUTTON",00
*