mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2025-01-08 14:29:46 +00:00
add progress bar view
This commit is contained in:
parent
abbe73c2ad
commit
b04af05f79
@ -425,6 +425,29 @@ Configuration block consists of five bytes:
|
||||
</table>
|
||||
|
||||
|
||||
####WGCreateProgress
|
||||
Creates a new WeeGUI progress bar view. This is a specialized version of WGCreateView, and its parameters are similar.
|
||||
|
||||
<table width="100%">
|
||||
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
|
||||
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
|
||||
</pre></td><td><pre>
|
||||
&PROG( View ID,
|
||||
Left edge,
|
||||
Top edge,
|
||||
Width)
|
||||
</pre></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
####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
|
||||
</table>
|
||||
|
||||
|
||||
####WGSetValue
|
||||
Sets the currently selected view's value. Currently only useful for progress bar views.
|
||||
|
||||
<table width="100%">
|
||||
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
|
||||
X: WGSetState
|
||||
A: new value
|
||||
</td><td>
|
||||
&SETV(V value)
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
Cursor Routines
|
||||
|
2
Makefile
2
Makefile
@ -11,7 +11,7 @@
|
||||
|
||||
CL65=cl65
|
||||
AC=AppleCommander.jar
|
||||
ADDR=7d00
|
||||
ADDR=7b00
|
||||
ADDRDEMO=6000
|
||||
|
||||
PGM=weegui
|
||||
|
BIN
V2Make.scpt
BIN
V2Make.scpt
Binary file not shown.
@ -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,6 @@ WGDisableMouse = 64
|
||||
WGDeleteView = 66
|
||||
WGEraseView = 68
|
||||
WGExit = 70
|
||||
WGCreateProgress = 72
|
||||
|
||||
|
||||
|
65
applesoft.s
65
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 value (state)
|
||||
; &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
|
||||
|
||||
|
128
asmdemo.s
128
asmdemo.s
@ -33,136 +33,32 @@ main:
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Show off rendering speed with some snazzy rectangle painting
|
||||
;
|
||||
; Stack:
|
||||
; Curr X
|
||||
; Curr Y
|
||||
; Curr Width
|
||||
; Curr Height
|
||||
|
||||
ldx #WGClearScreen
|
||||
ldx #WGDesktop
|
||||
jsr WeeGUI
|
||||
|
||||
lda #<progressData
|
||||
sta PARAM0
|
||||
lda #>progressData
|
||||
sta PARAM1
|
||||
ldx #WGCreateProgress
|
||||
jsr WeeGUI
|
||||
|
||||
animateRects:
|
||||
lda #38 ; Initialize
|
||||
pha
|
||||
lda #11
|
||||
pha
|
||||
lda #2
|
||||
pha
|
||||
lda #2
|
||||
pha
|
||||
|
||||
animateRectsEvenLoop:
|
||||
@0: lda $C019 ; Sync to VBL
|
||||
bmi @0
|
||||
|
||||
ldx #WGClearScreen
|
||||
ldx #WGPaintView
|
||||
jsr WeeGUI
|
||||
|
||||
tsx
|
||||
inx
|
||||
lda $0100,x ; Load Height, then modify
|
||||
sta PARAM3
|
||||
inc
|
||||
inc
|
||||
sta $0100,x
|
||||
cmp #25
|
||||
bcs animateRects
|
||||
|
||||
inx ; Load Width, then modify
|
||||
lda $0100,x
|
||||
sta PARAM2
|
||||
inc
|
||||
inc
|
||||
inc
|
||||
inc
|
||||
inc
|
||||
inc
|
||||
sta $0100,x
|
||||
|
||||
inx ; Load Y, then modify
|
||||
lda $0100,x
|
||||
sta PARAM1
|
||||
dec
|
||||
sta $0100,x
|
||||
|
||||
inx ; Load X, then modify
|
||||
lda $0100,x
|
||||
sta PARAM0
|
||||
dec
|
||||
dec
|
||||
dec
|
||||
sta $0100,x
|
||||
|
||||
ldy #64
|
||||
ldx #WGFillRect
|
||||
jsr WeeGUI
|
||||
ldx #WGStrokeRect
|
||||
jsr WeeGUI
|
||||
|
||||
jsr delayShort
|
||||
jsr delayShort
|
||||
jsr delayShort
|
||||
jsr checkKbd
|
||||
|
||||
bra animateRectsEvenLoop
|
||||
|
||||
|
||||
delayShort: ; ~1/30 sec
|
||||
pha
|
||||
phx
|
||||
phy
|
||||
|
||||
ldy #$06 ; Loop a bit
|
||||
delayShortOuter:
|
||||
ldx #$ff
|
||||
delayShortInner:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
dex
|
||||
bne delayShortInner
|
||||
dey
|
||||
bne delayShortOuter
|
||||
|
||||
ply
|
||||
plx
|
||||
pla
|
||||
rts
|
||||
|
||||
checkKbd:
|
||||
lda KBD
|
||||
bpl checkKbdDone
|
||||
sta KBDSTRB
|
||||
|
||||
cmp #241 ; 'q' with high bit set
|
||||
bne checkKbdDone
|
||||
|
||||
ldx #WGExit
|
||||
jsr WeeGUI
|
||||
pla ; Pull our own frame off the stack...
|
||||
pla
|
||||
pla
|
||||
pla
|
||||
pla ; ...four local variables + return address...
|
||||
pla
|
||||
rts ; ...so we can quit to ProDOS from here
|
||||
|
||||
checkKbdDone:
|
||||
rts
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
progressData:
|
||||
.byte 0,20,5,30
|
||||
|
||||
brunCmdLine:
|
||||
.byte "BRUN weegui",$8d,0
|
||||
|
||||
|
||||
; Suppress some linker warnings - Must be the last thing in the file
|
||||
.SEGMENT "ZPSAVE"
|
||||
.SEGMENT "EXEHDR"
|
||||
|
7
memory.s
7
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
|
||||
|
||||
|
141
views.s
141
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
|
||||
|
BIN
weegui.dsk
BIN
weegui.dsk
Binary file not shown.
17
weegui.s
17
weegui.s
@ -7,7 +7,7 @@
|
||||
;
|
||||
|
||||
|
||||
.org $7d00
|
||||
.org $7b00
|
||||
|
||||
; Common definitions
|
||||
|
||||
@ -74,7 +74,7 @@ WGEntryPointTable:
|
||||
.addr WGDeleteView
|
||||
.addr WGEraseView
|
||||
.addr WGExit
|
||||
|
||||
.addr WGCreateProgress
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGInit
|
||||
@ -86,10 +86,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 $7c-$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 +103,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 +158,7 @@ WGExit:
|
||||
jsr SETHI
|
||||
|
||||
; Remove ourselves from ProDOS memory map
|
||||
lda #%00000011
|
||||
lda #%00001111
|
||||
trb MEMBITMAP + $0f
|
||||
lda #$ff
|
||||
trb MEMBITMAP + $10
|
||||
|
Loading…
Reference in New Issue
Block a user