diff --git a/Documentation.md b/Documentation.md index 3883199..922b6ee 100644 --- a/Documentation.md +++ b/Documentation.md @@ -796,6 +796,24 @@ Not available &GET(A$) + +
+ +Miscellaneous Routines +---------------------- + +Other stuff you might need. + +####WGExit +Cleans up and shuts down WeeGUI. If you want your application to return cleanly to Applesoft when its down, you must call this. Otherwise you may get ProDOS complaining it is out of buffers, or other strange behaviour. + +
AssemblyApplesoft
+X:		WGExit
+
+&EXIT
+
+ +



diff --git a/ReadMe.md b/ReadMe.md index 7aec1bd..12ead5d 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -8,10 +8,6 @@ Known issues To Do: ------ -- Repainting a view while the mouse cursor is on it will cause artifacts when mouse moves -- Quitting sometimes leaves BASIC in inverted text mode -- Quitting with button highlighted leaves us in inverted text mode -- After initial run of basic demo, additional run fails with no buffers available - Make WGFillRect support 1 height and 1 width - If called in inverse mode, clear screen clears inverse - Fix unclosed PRE tags in documentation diff --git a/WeeGUI_MLI.s b/WeeGUI_MLI.s index 00b99ca..5e30a1c 100644 --- a/WeeGUI_MLI.s +++ b/WeeGUI_MLI.s @@ -63,3 +63,5 @@ WGScrollY = 58 WGScrollYBy = 60 WGEnableMouse = 62 WGDisableMouse = 64 +WGExit = 66 + diff --git a/applesoft.s b/applesoft.s index 0fb02ca..7936750 100644 --- a/applesoft.s +++ b/applesoft.s @@ -901,6 +901,16 @@ WGAmpersand_GETstore: rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGAmpersand_EXIT +; Shuts down WeeGUI +; &EXIT +WGAmpersand_EXIT: + jsr WGExit + jsr WGBottomCursor + rts + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGBottomCursor ; Leave the cursor state in a place that Applesoft is happy with @@ -1078,6 +1088,9 @@ WGAmpersandCommandTable: .byte TOKEN_GET,0,0,0,0,0 .addr WGAmpersand_GET +.byte "EXIT",0,0 +.addr WGAmpersand_EXIT + ;.byte TOKEN_GOSUB,0,0,0,0,0,0,0,0,0,0,0,0,0 ; For internal testing of the procedural gosub ;.addr WGAmpersand_GOSUB diff --git a/asmdemo.s b/asmdemo.s index adc9cb3..68f1c4b 100644 --- a/asmdemo.s +++ b/asmdemo.s @@ -159,6 +159,9 @@ keyLoop_focusOkay: keyLoop_quit: ldx #WGDisableMouse jsr WeeGUI + ldx #WGExit + jsr WeeGUI + rts testPaintContentsClick: diff --git a/weegui.dsk b/weegui.dsk index f3199cd..203f6b3 100644 Binary files a/weegui.dsk and b/weegui.dsk differ diff --git a/weegui.s b/weegui.s index 4e13f96..7a03553 100644 --- a/weegui.s +++ b/weegui.s @@ -71,7 +71,7 @@ WGEntryPointTable: .addr WGScrollYBy .addr WGEnableMouse .addr WGDisableMouse - +.addr WGExit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGInit @@ -129,6 +129,28 @@ WGInit_clearMemLoop: rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGInit +; Cleanup Should be called once at app shutdown +WGExit: + pha + + lda #CHAR_NORMAL + sta INVERSE + + ; Remove ourselves from ProDOS memory map + lda #%00000011 + trb MEMBITMAP + $0f + lda #$ff + trb MEMBITMAP + $10 + trb MEMBITMAP + $11 + lda #%11111100 + trb MEMBITMAP + $12 + + pla + rts + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WG80 ; Enables 80 column mode (and enhanced video firmware)