diff --git a/Documentation.md b/Documentation.md index c1ccb05..1b750cb 100644 --- a/Documentation.md +++ b/Documentation.md @@ -425,6 +425,29 @@ Configuration block consists of five bytes: +####WGCreateProgress +Creates a new WeeGUI progress bar view. This is a specialized version of WGCreateView, and its parameters are similar. + + + +
AssemblyApplesoft
+X:		WGCreateProgress
+PARAM0: Pointer to configuration block (LSB)
+PARAM1:	Pointer to configuration block (MSB)
+
+Configuration block consists of five bytes:
+	0:	View ID (0-15)
+	1:	Left edge of progress bar
+	2:	Top edge of progress bar
+	3:	Width of progress bar
+
+&PROG(	View ID,
+		Left edge,
+		Top edge,
+		Width)
+
+ + ####WGCreateButton Creates a new WeeGUI button view. This is a specialized version of WGCreateView, and its parameters are similar. @@ -667,6 +690,19 @@ Not available +####WGSetValue +Sets the currently selected view's value. Currently only useful for progress bar views. + + + +
AssemblyApplesoft
+X:		WGSetState
+A: 		new value
+
+&SETV(value) +
+ +
Cursor Routines diff --git a/Makefile b/Makefile index ec09704..7f97f1a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ CL65=cl65 AC=AppleCommander.jar -ADDR=7d00 +ADDR=7b00 ADDRDEMO=6000 PGM=weegui diff --git a/V2Make.scpt b/V2Make.scpt index 4d4f1c6..098ef00 100644 Binary files a/V2Make.scpt and b/V2Make.scpt differ diff --git a/WeeGUI_MLI.s b/WeeGUI_MLI.s index dddda1a..ae8a306 100644 --- a/WeeGUI_MLI.s +++ b/WeeGUI_MLI.s @@ -21,7 +21,7 @@ PARAM3 = $09 ; WeeGUI entry point ; Set up your call, then do a JSR to this address. ; -WeeGUI = $7d04 ; 7d00 +WeeGUI = $7b04 ; 7c00 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -66,4 +66,7 @@ WGDisableMouse = 64 WGDeleteView = 66 WGEraseView = 68 WGExit = 70 +WGCreateProgress = 72 +WGSetState = 74 + diff --git a/applesoft.s b/applesoft.s index 086170e..0617d82 100644 --- a/applesoft.s +++ b/applesoft.s @@ -435,6 +435,65 @@ WGAmpersand_CHKBX: rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGAmpersand_PROG +; Create a progress bar +; &PROG(id,x,y,width) +WGAmpersand_PROG: + jsr WGAmpersandBeginArguments + + jsr WGAmpersandIntArgument + sta WGAmpersandCommandBuffer+0 + jsr WGAmpersandNextArgument + + jsr WGAmpersandIntArgument + sta WGAmpersandCommandBuffer+1 + jsr WGAmpersandNextArgument + + jsr WGAmpersandIntArgument + sta WGAmpersandCommandBuffer+2 + jsr WGAmpersandNextArgument + + jsr WGAmpersandIntArgument + sta WGAmpersandCommandBuffer+3 + + jsr WGAmpersandEndArguments + + CALL16 WGCreateProgress,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 + + rts + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGAmpersand_SETV +; Set the 'value' field of the selected view +; &SETV(v) +WGAmpersand_SETV: + jsr WGAmpersandBeginArguments + + jsr WGAmpersandIntArgument + pha + + jsr WGAmpersandEndArguments + + pla + sta PARAM0 + jsr WGSetState + + jsr WGPaintView + jsr WGBottomCursor + + rts + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGAmpersand_BUTTN ; Create a button @@ -1149,6 +1208,12 @@ WGAmpersandCommandTable: .byte "EXIT",0,0 .addr WGAmpersand_EXIT +.byte "PROG",0,0 +.addr WGAmpersand_PROG + +.byte "SETV",0,0 +.addr WGAmpersand_SETV + ;.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/memory.s b/memory.s index eb060e2..117fc3d 100644 --- a/memory.s +++ b/memory.s @@ -16,11 +16,12 @@ CHAR_FLASH = $7f VIEW_STYLE_STEALTH = $00 VIEW_STYLE_PLAIN = $01 VIEW_STYLE_FANCY = $02 -VIEW_STYLE_CHECK = $03 -VIEW_STYLE_BUTTON = $04 +VIEW_STYLE_PROGRESS = $03 +VIEW_STYLE_CHECK = $04 +VIEW_STYLE_BUTTON = $05 -VIEW_STYLE_TAKESFOCUS = $03 ; Styles >= this one are selectable +VIEW_STYLE_TAKESFOCUS = $04 ; Styles >= this one are selectable VIEW_STYLE_APPLESOFT = $80 ; High nybble flag bit for views created from Applesoft diff --git a/views.s b/views.s index 21357c6..de0d059 100644 --- a/views.s +++ b/views.s @@ -157,6 +157,98 @@ WGCreateCheckbox_done: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGCreateProgress +; Creates a new progress bar +; PARAM0: Pointer to configuration struct (LSB) +; PARAM1: Pointer to configuration struct (MSB) +; +; Configuration struct: +; ID: View ID (0-f) +; XX: Screen X origin +; YY: Screen Y origin +; PW: Progress width +; +WGCreateProgress: + SAVE_AXY + + ldy #0 + lda (PARAM0),y ; Find our new view record + pha ; Cache view ID so we can select when we're done + + asl + asl + asl + asl ; Records are 16 bytes wide + tax + + iny + lda (PARAM0),y + sta WG_VIEWRECORDS+0,x ; Screen X + + iny + lda (PARAM0),y + sta WG_VIEWRECORDS+1,x ; Screen Y + + iny + lda (PARAM0),y + sta WG_VIEWRECORDS+2,x ; Screen width + sta WG_VIEWRECORDS+7,x ; View width + + lda #1 + sta WG_VIEWRECORDS+3,x ; Screen height + sta WG_VIEWRECORDS+8,x ; View height + + lda #VIEW_STYLE_PROGRESS + sta WG_VIEWRECORDS+4,x ; Style + + stz WG_VIEWRECORDS+5,x ; Initialize scrolling + stz WG_VIEWRECORDS+6,x + + stz WG_VIEWRECORDS+9,x ; Initialize state + stz WG_VIEWRECORDS+10,x ; Initialize callback + stz WG_VIEWRECORDS+11,x + + iny + lda (PARAM0),y + sta WG_VIEWRECORDS+12,x ; Title + iny + lda (PARAM0),y + sta WG_VIEWRECORDS+13,x + + pla + jsr WGSelectView ; Leave this as the active view + +WGCreateProgress_done: + RESTORE_AXY + rts + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; WGSetState +; Sets state field in view record +; PARAM0: Value +; +WGSetState: + SAVE_AXY + + LDY_ACTIVEVIEW + + lda WG_VIEWRECORDS+9,y + and #$80 + sta SCRATCH0 + lda PARAM0 + and #$7F + ora SCRATCH0 + sta WG_VIEWRECORDS+9,y ; State (preserving bit 7) + +WGSetState_done: + RESTORE_AXY + rts + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGCreateButton ; Creates a new button @@ -286,6 +378,8 @@ WGPaintView: beq WGPaintView_check cmp #VIEW_STYLE_BUTTON beq WGPaintView_button + cmp #VIEW_STYLE_PROGRESS + beq WGPaintView_progress bra WGPaintView_done WGPaintView_decorated: @@ -297,6 +391,10 @@ WGPaintView_check: jsr paintCheck bra WGPaintView_done +WGPaintView_progress: + jsr paintProgress + bra WGPaintView_done + WGPaintView_button: jsr paintButton @@ -372,6 +470,49 @@ paintCheck_done: rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; paintProgress +; Paints the contents of a progress bar +; Y: Index into view records of progress bar to paint +; Side effects: Clobbers all registers,P0,P1 +paintProgress: + lda WG_VIEWRECORDS+1,y ; Top edge + sta PARAM1 + + lda #1 + sta PARAM3 + + lda WG_VIEWRECORDS+9,y ; Progress value as width + sta PARAM2 + beq paintProgress_noFill ; skip if nothing to draw + + lda WG_VIEWRECORDS+0,y ; Left edge + sta PARAM0 + phy + ldy #$20 ; inverse space + jsr WGFillRect + ply + +paintProgress_noFill: + lda WG_VIEWRECORDS+2,y ; full width + sec + sbc WG_VIEWRECORDS+9,y ; Progress value + beq paintProgress_done ; skip if nothing to draw + sta PARAM2 + + lda WG_VIEWRECORDS+0,y ; left edge + clc + adc WG_VIEWRECORDS+9,y ; Progress value + sta PARAM0 + + ldy #$A0 ; space + jsr WGFillRect + +paintProgress_done: + rts + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; paintButton ; Paints the contents of a button diff --git a/weegui.dsk b/weegui.dsk index 98af77c..a3ce4ca 100644 Binary files a/weegui.dsk and b/weegui.dsk differ diff --git a/weegui.s b/weegui.s index 47e627d..4168d1e 100644 --- a/weegui.s +++ b/weegui.s @@ -7,7 +7,7 @@ ; -.org $7d00 +.org $7b00 ; Common definitions @@ -74,7 +74,8 @@ WGEntryPointTable: .addr WGDeleteView .addr WGEraseView .addr WGExit - +.addr WGCreateProgress +.addr WGSetState ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGInit @@ -86,10 +87,13 @@ WGInit: ; ; See section 5.1.4 in the ProDOS 8 Technical Reference Manual ; for an explanation of these values. We're reserving memory - ; pages $7e-$95 so that ProDOS won't use our memory for file + ; pages $7b-$95 so that ProDOS won't use our memory for file ; buffers, or allow Applesoft to step on us ; ; Byte in System Bitmap : Bit within byte + ; 0f:100 + ; 0f:011 + ; 0f:010 ; 0f:001 ; 0f:000 ; 10:111 .. 10:000 @@ -100,16 +104,16 @@ WGInit: ; 12:100 ; 12:011 ; 12:010 - lda #%00000011 + lda #%00001111 tsb MEMBITMAP + $0f - lda #$ff + lda #%11111111 tsb MEMBITMAP + $10 tsb MEMBITMAP + $11 lda #%11111100 tsb MEMBITMAP + $12 ; Protect us from Applesoft by setting up HIMEM - lda #$7c ; 7d00 (really 7cff) + lda #$7a ; 7b00 (really 7aff) sta LINNUMH lda #$ff sta LINNUML @@ -155,7 +159,7 @@ WGExit: jsr SETHI ; Remove ourselves from ProDOS memory map - lda #%00000011 + lda #%00001111 trb MEMBITMAP + $0f lda #$ff trb MEMBITMAP + $10