From 20444d67239f43166a2734b27838356a7b32e19f Mon Sep 17 00:00:00 2001 From: 4am Date: Tue, 17 Apr 2018 22:28:22 -0400 Subject: [PATCH] MOAR MACROS --- src/glue.onbeyond.a | 9 ++++----- src/macros.a | 5 +++++ src/parse.common.a | 2 +- src/parse.gameinfo.a | 10 +++++----- src/parse.prefs.a | 2 +- src/prodos.path.a | 2 +- src/ui.common.a | 6 +++--- src/ui.main.a | 5 ++--- src/ui.main.keys.a | 10 +++++----- src/ui.resume.a | 2 +- src/ui.versions.a | 2 +- 11 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/glue.onbeyond.a b/src/glue.onbeyond.a index 75312ff..14e872c 100644 --- a/src/glue.onbeyond.a +++ b/src/glue.onbeyond.a @@ -122,9 +122,8 @@ SetInterpreterOptions jsr okvs_as_boolean beq SetInterpreterOptionsExceptForce40 lda #$CE - !byte $2C + +HIDE_NEXT_2_BYTES ; execution falls through here - ;------------------------------------------------------------------------------ ; SetInterpreterOptionsExceptForce40 ; set options struct based on global preferences store, except always specify @@ -143,7 +142,7 @@ SetInterpreterOptionsExceptForce40 jsr okvs_as_boolean beq + lda #0 - !byte $2C + +HIDE_NEXT_2_BYTES + lda #1 sta kOnBeyondCase @@ -153,7 +152,7 @@ SetInterpreterOptionsExceptForce40 jsr okvs_as_boolean beq + lda #1 - !byte $2C + +HIDE_NEXT_2_BYTES + lda #0 sta kOnBeyondScriptToFile @@ -163,7 +162,7 @@ SetInterpreterOptionsExceptForce40 jsr okvs_as_boolean beq + lda #1 - !byte $2C + +HIDE_NEXT_2_BYTES + lda #0 sta kOnBeyondAutoScript diff --git a/src/macros.a b/src/macros.a index 456b6f1..3cde894 100644 --- a/src/macros.a +++ b/src/macros.a @@ -53,3 +53,8 @@ PARAM = $00 sta .ptr sty .ptr+1 } + +; use BIT to swallow the following 2-byte opcode +!macro HIDE_NEXT_2_BYTES { + !byte $2C +} diff --git a/src/parse.common.a b/src/parse.common.a index 59850e4..d621c56 100644 --- a/src/parse.common.a +++ b/src/parse.common.a @@ -89,7 +89,7 @@ ParseKeyValueText and #1 sta gVal ; single-character values get converted to #$00 or #$01 in prefs store lda #0 - !byte $2C + +HIDE_NEXT_2_BYTES .useMaxLength lda #$FD ; SMC sta .appendMaxLength ; all other values get upgraded to max_length so we can update them in place diff --git a/src/parse.gameinfo.a b/src/parse.gameinfo.a index 7d0c0fc..18efc7c 100644 --- a/src/parse.gameinfo.a +++ b/src/parse.gameinfo.a @@ -94,11 +94,11 @@ LoadGameInfo cmp #$26 ; '&' -> open-apple mousetext beq .oa ora #$80 ; all other characters -> set high bit - !byte $2C + +HIDE_NEXT_2_BYTES .null lda #$00 - !byte $2C + +HIDE_NEXT_2_BYTES .ca lda #$40 - !byte $2C + +HIDE_NEXT_2_BYTES .oa lda #$41 sta ($FE),y bra .convertSectionLoop @@ -200,11 +200,11 @@ CheckForSavedGames bne + lda auxtype and #$0F - !byte $2C + +HIDE_NEXT_2_BYTES + lda #$FF ; no save slot sta gLastSavedGameSlot lda #1 - !byte $2C + +HIDE_NEXT_2_BYTES .no lda #0 sta gHasSavedGames rts diff --git a/src/parse.prefs.a b/src/parse.prefs.a index 21f63ea..19e190e 100644 --- a/src/parse.prefs.a +++ b/src/parse.prefs.a @@ -139,7 +139,7 @@ addGameToPrefs addBooleanFromStore lda #$24 ; BIT opcode - !byte $2C + +HIDE_NEXT_2_BYTES addStringFromStore lda #$80 ; BRA opcode sta .skipOverBooleanLogic diff --git a/src/prodos.path.a b/src/prodos.path.a index 3d92563..8c64e63 100644 --- a/src/prodos.path.a +++ b/src/prodos.path.a @@ -39,7 +39,7 @@ ResetPath !zone { AddToPathWithHighBit ldx #$80 - !byte $2C + +HIDE_NEXT_2_BYTES AddToPath ldx #0 stx .mask diff --git a/src/ui.common.a b/src/ui.common.a index 7bacb3e..b85bb76 100644 --- a/src/ui.common.a +++ b/src/ui.common.a @@ -100,10 +100,10 @@ ClearPendingInput !zone { CreateRadio ldx #WGCreateRadio - !byte $2C ; hide next 2 bytes + +HIDE_NEXT_2_BYTES CreateCheckbox ldx #WGCreateCheckbox - !byte $2C ; hide next 2 bytes + +HIDE_NEXT_2_BYTES CreateButton ldx #WGCreateButton stx .type @@ -255,7 +255,7 @@ GetCheckedRadioButton .max=*+1 cmp #$FD ; SMC bcc - - !byte $2C + +HIDE_NEXT_2_BYTES .found pla clc rts diff --git a/src/ui.main.a b/src/ui.main.a index 1faa22a..2c7c413 100644 --- a/src/ui.main.a +++ b/src/ui.main.a @@ -46,7 +46,7 @@ PaintMain stz gViewInUse+ID_VERSIONS ldx #1 ; flag - clear screen before painting stx gMainScreenPaintDirty - !byte $2C + +HIDE_NEXT_2_BYTES RepaintMainIfDirty ldx #0 ; flag - do not clear screen before painting lda gMainScreenPaintDirty @@ -254,8 +254,7 @@ PaintInfoView jsr CreateNullTerminatedString ; copies string to kNullTerminatedBuffer +LDADDR kNullTerminatedBuffer ; now use that as the buffer to print the last line - !byte $2C - ; execution falls through here + +HIDE_NEXT_2_BYTES MultiPrint stz SAVE ; VTAB, but 0-indexed stx .printLineLength+1 diff --git a/src/ui.main.keys.a b/src/ui.main.keys.a index 7a4c353..8c7ac3a 100644 --- a/src/ui.main.keys.a +++ b/src/ui.main.keys.a @@ -76,7 +76,7 @@ HandleKey beq .handleScrollDown .handleScrollUp lda #$01 - !byte $2C ; hide next LDA + +HIDE_NEXT_2_BYTES .handleScrollDown lda #$FF pha @@ -115,16 +115,16 @@ HandleKey bra .xyzzyReset .x lda #1 - !byte $2C + +HIDE_NEXT_2_BYTES .y1 lda #2 - !byte $2C + +HIDE_NEXT_2_BYTES .z1 lda #3 - !byte $2C + +HIDE_NEXT_2_BYTES .z2 lda #4 - !byte $2C + +HIDE_NEXT_2_BYTES .xyzzyReset lda #0 .xyzzyStoreAndExit diff --git a/src/ui.resume.a b/src/ui.resume.a index 1e669a9..315cdf5 100644 --- a/src/ui.resume.a +++ b/src/ui.resume.a @@ -110,7 +110,7 @@ ResumeDialog lda gLastSavedGameSlot ; initial checked radio button = last save slot + 1 bmi + inc - !byte $2C + +HIDE_NEXT_2_BYTES + lda #ID_RESUME_NEWGAME ; if last save slot is invalid, just check 'new game' ldx #WGSelectView jsr WeeGUI diff --git a/src/ui.versions.a b/src/ui.versions.a index d5a35bf..92d2846 100644 --- a/src/ui.versions.a +++ b/src/ui.versions.a @@ -221,7 +221,7 @@ HandleVersionsKey cpx iNumVersions ; find 'next' view ID (wrapping around to 1) bcs + inx - !byte $2C + +HIDE_NEXT_2_BYTES + ldx #1 bra .gotNewID .previous