From 58deae7241e42f3b13ec10f0d2dcbe2a38aeb7fc Mon Sep 17 00:00:00 2001 From: Quinn Dunki Date: Sun, 21 Sep 2014 13:08:41 -0700 Subject: [PATCH] - Fixed callbacks on machine language buttons - Fixed AppleSoft flag not getting set properly on buttons and checkboxes - Added macros for 16 and 32 bit function calls - Some code cleanup --- applesoft.s | 28 ++++++--------------- gui.s | 71 ++++++++-------------------------------------------- guidemo.dsk | Bin 143360 -> 143360 bytes macros.s | 30 ++++++++++++++++++++++ unit_test.s | 14 +++-------- views.s | 2 +- 6 files changed, 51 insertions(+), 94 deletions(-) diff --git a/applesoft.s b/applesoft.s index 976e69b..db3915e 100644 --- a/applesoft.s +++ b/applesoft.s @@ -336,10 +336,7 @@ WGAmpersandStructArguments_cleanup: WGAmpersandStructArguments_done: ply - lda #WGAmpersandCommandBuffer - sta PARAM1 + PARAM16 WGAmpersandCommandBuffer RESTORE_AXY rts @@ -413,12 +410,8 @@ WGAmpersand_WINDOW: jsr WGAmpersandEndArguments - lda #WGAmpersandCommandBuffer - sta PARAM1 + CALL16 WGCreateView,WGAmpersandCommandBuffer - jsr WGCreateView jsr WGEraseView jsr WGPaintView jsr WGBottomCursor @@ -445,17 +438,13 @@ WGAmpersand_CHKBOX: jsr WGAmpersandEndArguments - lda #WGAmpersandCommandBuffer - sta PARAM1 - - jsr WGCreateCheckbox + CALL16 WGCreateCheckbox,WGAmpersandCommandBuffer LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view lda #VIEW_STYLE_APPLESOFT ora WG_VIEWRECORDS+4,y - + sta WG_VIEWRECORDS+4,y + jsr WGPaintView jsr WGBottomCursor @@ -496,15 +485,12 @@ WGAmpersand_BUTTN: jsr WGAmpersandEndArguments - lda #WGAmpersandCommandBuffer - sta PARAM1 - jsr WGCreateButton + CALL16 WGCreateButton,WGAmpersandCommandBuffer LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view lda #VIEW_STYLE_APPLESOFT ora WG_VIEWRECORDS+4,y + sta WG_VIEWRECORDS+4,y lda WGAmpersandCommandBuffer+6 ; Set the button text sta PARAM0 diff --git a/gui.s b/gui.s index 5f2e786..c630656 100644 --- a/gui.s +++ b/gui.s @@ -22,66 +22,23 @@ main: jsr WGInit jsr WG80 -; lda #0 -; lda #testTitle1 -; sta PARAM1 -; jsr WGStoreStr - rts ;jmp tortureTestPrint ;jmp tortureTestRects jsr WGDesktop - lda #testView - sta PARAM1 - jsr WGCreateView + CALL16 WGCreateView,testView + CALL16 WGViewSetTitle,testTitle0 - lda #testTitle0 - sta PARAM1 - jsr WGViewSetTitle + CALL16 WGCreateCheckbox,testCheck - lda #testCheck - sta PARAM1 - jsr WGCreateCheckbox + CALL16 WGCreateButton,testButton1 + CALL16 WGViewSetTitle,testTitle1 + CALL16 WGViewSetAction,testCallback - lda #testButton1 - sta PARAM1 - jsr WGCreateButton - - lda #testTitle1 - sta PARAM1 - jsr WGViewSetTitle - - lda #testCallback - sta PARAM1 - jsr WGViewSetAction - - lda #testButton2 - sta PARAM1 - jsr WGCreateButton - - lda #testTitle2 - sta PARAM1 - jsr WGViewSetTitle + CALL16 WGCreateButton,testButton2 + CALL16 WGViewSetTitle,testTitle2 jsr WGViewPaintAll ; jsr testPaintContents @@ -180,11 +137,7 @@ testPaintContents: ldx #0 ldy #4 jsr WGSetCursor - lda #testStr - sta PARAM1 - jsr WGPrint + CALL16 WGPrint,testStr bra testPaintContents_done ;; @@ -199,11 +152,7 @@ testPaintContents_loop: adc #'A' sta testStr3 - lda #testStr3 - sta PARAM1 - jsr WGPrint + CALL16 WGPrint,testStr3 iny cpy #25 diff --git a/guidemo.dsk b/guidemo.dsk index 2a63faa9e80ad3cf2a02b7fd5eaad653aa342fd9..c0892f4fd5ace6bacc88501a4e871b2b0be1cd43 100644 GIT binary patch delta 3637 zcmai1eQZLifiSCc6C5N=_t-RgG23K(LKXW|Zi)qN@N^?A-U^ z#3|dJoO{nb=iGD7{hjmfI}vXdiZ=^KuFdf*Dr1&D<($hfe`jha@w-p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zuCX5Lh_it${`$7<`jL5CJLfOFtDOTm1`qRopssKmu*twg{xSuw1gMJ)n&wbLEAi(d V0sraLzeIOwJ`C)yCPpV%{@+addr + sta PARAM1 +.endmacro + + +.macro CALL16 func,addr + PARAM16 addr + jsr func +.endmacro + + +.macro PARAMQUAD p0,p1,p2,p3 + lda #p0 + sta PARAM0 + lda #p1 + sta PARAM1 + lda #p2 + sta PARAM2 + lda #p3 + sta PARAM3 +.endmacro + +.macro CALLQUAD func,p0,p1,p2,p3 + PARAMQUAD p0,p1,p2,p3 + jsr func +.endmacro + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Rendering macros ; diff --git a/unit_test.s b/unit_test.s index 18b5b73..4bc998b 100644 --- a/unit_test.s +++ b/unit_test.s @@ -26,11 +26,7 @@ tortureTestPrint: jsr WGScrollY tortureTestPrint_init: - lda #testPrintView - sta PARAM1 - jsr WGCreateView + CALL16 WGCreateView,testPrintView lda #0 jsr WGSelectView @@ -113,13 +109,9 @@ tortureTestPrint_print: VBL_SYNC jsr WGEraseViewContents - lda #unitTestStr - sta PARAM1 + CALL16 WGPrint,unitTestStr - jsr WGPrint - jsr WGPrint + jsr WGPrint ; Do it again ; jmp tortureTestPrint_lock jsr delayShort diff --git a/views.s b/views.s index a46f20c..07ff99f 100644 --- a/views.s +++ b/views.s @@ -745,7 +745,7 @@ WGViewFocusAction_toggleCheckbox: WGViewFocusAction_buttonClick: lda WG_VIEWRECORDS+4,y ; Are we an Applesoft button? and #VIEW_STYLE_APPLESOFT - beq WGViewFocusAction_buttonClickApplesoft + bne WGViewFocusAction_buttonClickApplesoft lda WG_VIEWRECORDS+10,y ; Do we have a callback? beq WGViewFocusAction_done