diff --git a/applesoft.s b/applesoft.s index ff9fa09..9cc4e15 100644 --- a/applesoft.s +++ b/applesoft.s @@ -262,37 +262,6 @@ WGAmpersandStrArguments_done: WGAmpersand_VIEW: jsr WGAmpersandStrArguments -; lda WGAmpersandCommandBuffer -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+1 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+2 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+3 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+4 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+5 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+6 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+7 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+8 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+9 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+10 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+11 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+12 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+13 -; jsr PRBYTE -; lda WGAmpersandCommandBuffer+14 -; jsr PRBYTE - jsr WGCreateView jsr WGPaintView rts diff --git a/gui.s b/gui.s index df06213..add2d59 100644 --- a/gui.s +++ b/gui.s @@ -21,7 +21,7 @@ main: jsr WGInit jsr WG80 - rts + ;rts ;jmp tortureTestPrint ;jmp tortureTestRects @@ -76,7 +76,7 @@ main: jsr WGViewSetTitle jsr WGViewPaintAll - jsr testPaintContents +; jsr testPaintContents ; ldx #5 ; ldy #0 @@ -87,57 +87,6 @@ main: ; lda #-2 ; jsr WGScrollY -; lda WG_VIEWCLIP+0 -; jsr PRBYTE -; lda WG_VIEWCLIP+1 -; jsr PRBYTE -; lda WG_VIEWCLIP+2 -; jsr PRBYTE -; lda WG_VIEWCLIP+3 -; jsr PRBYTE -; lda WG_VIEWCLIP+4 -; jsr PRBYTE - -; lda WG_VIEWRECORDS+0 -; jsr PRBYTE -; lda WG_VIEWRECORDS+1 -; jsr PRBYTE -; lda WG_VIEWRECORDS+2 -; jsr PRBYTE -; lda WG_VIEWRECORDS+3 -; jsr PRBYTE -; lda WG_VIEWRECORDS+4 -; jsr PRBYTE -; lda WG_VIEWRECORDS+5 -; jsr PRBYTE -; lda WG_VIEWRECORDS+6 -; jsr PRBYTE -; lda WG_VIEWRECORDS+7 -; jsr PRBYTE -; lda WG_VIEWRECORDS+8 -; jsr PRBYTE - -; lda #testStr -; sta PARAM1 -; jsr WGPrint - -; lda #1 -; sta PARAM0 -; lda #1 -; sta PARAM1 -; lda #2 -; sta PARAM2 -; lda #2 -; sta PARAM3 -; ldx #'Q'+$80 -; jsr WGFillRect -; jsr WGStrokeRect -; jmp loop -; jsr waitForKey - -; jmp tortureTestRects keyLoop: lda KBD @@ -219,6 +168,7 @@ testPaintContents: ;; + jsr WGNormal ldx #0 ldy #4 jsr WGSetCursor @@ -321,16 +271,16 @@ read80ColSwitch_40: testView: - .byte "1007033e125019" ; 1:0, 7,3,62,18,80,25 + .byte $10,7,3,62,18,80,25 testCheck: - .byte "011004" + .byte 1,16,4 testButton1: - .byte "02230a0f" + .byte 2,35,10,15 testButton2: - .byte "03230d0f" + .byte 3,35,13,15 testStr: ; .byte "This is a test of the emergency broadcast system.",0; If this had been a real emergency, you would be dead now.",0 ; 107 chars diff --git a/guidemo.dsk b/guidemo.dsk index a1218e2..b5c3612 100644 Binary files a/guidemo.dsk and b/guidemo.dsk differ diff --git a/memory.s b/memory.s index 8e560fb..d310bb1 100644 --- a/memory.s +++ b/memory.s @@ -18,6 +18,7 @@ VIEW_STYLE_FANCY = $01 VIEW_STYLE_CHECK = $02 VIEW_STYLE_BUTTON = $03 +VIEW_STYLE_TAKESFOCUS = $02 ; Styles >= this one are selectable ; ROM entry points diff --git a/views.s b/views.s index 02e0a29..bef1f5f 100644 --- a/views.s +++ b/views.s @@ -11,10 +11,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGCreateView ; Creates and selects a new view -; PARAM0: Pointer to ASCII configuration string (LSB) -; PARAM1: Pointer to ASCII configuration string (MSB) +; PARAM0: Pointer to configuration struct (LSB) +; PARAM1: Pointer to configuration struct (MSB) ; -; Configuration string: "STXXYYSWSHVWVH" +; Configuration struct: ; ST: (4:4) Style:ID ; XX: Screen X origin ; YY: Screen Y origin @@ -28,7 +28,7 @@ WGCreateView: SAVE_ZPS ldy #0 - jsr scanHex8 + lda (PARAM0),y pha and #%00001111 ; Find our new view record @@ -46,19 +46,23 @@ WGCreateView: lsr pha - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen X inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen Y inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen Width inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen Height inx @@ -72,11 +76,13 @@ WGCreateView: sta WG_VIEWRECORDS,x inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; View Width inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; View Height WGCreateView_done: @@ -89,10 +95,10 @@ WGCreateView_done: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGCreateCheckbox ; Creates a new checkbox -; PARAM0: Pointer to ASCII configuration string (LSB) -; PARAM1: Pointer to ASCII configuration string (MSB) +; PARAM0: Pointer to configuration struct (LSB) +; PARAM1: Pointer to configuration struct (MSB) ; -; Configuration string: "STXXYY" +; Configuration struct: ; ST: (4:4) Reserved:ID ; XX: Screen X origin ; YY: Screen Y origin @@ -102,7 +108,7 @@ WGCreateCheckbox: SAVE_ZPS ldy #0 - jsr scanHex8 + lda (PARAM0),y and #%00001111 ; Find our new view record jsr WGSelectView @@ -112,11 +118,13 @@ WGCreateCheckbox: asl ; Records are 16 bytes wide tax - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen X inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen Y inx @@ -159,10 +167,10 @@ WGCreateCheckbox_done: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WGCreateButton ; Creates a new button -; PARAM0: Pointer to ASCII configuration string (LSB) -; PARAM1: Pointer to ASCII configuration string (MSB) +; PARAM0: Pointer to configuration struct (LSB) +; PARAM1: Pointer to configuration struct (MSB) ; -; Configuration string: "STXXYYBW" +; Configuration struct: ; ST: (4:4) Reserved:ID ; XX: Screen X origin ; YY: Screen Y origin @@ -172,7 +180,7 @@ WGCreateButton: SAVE_ZPS ldy #0 - jsr scanHex8 + lda (PARAM0),y and #%00001111 ; Find our new view record jsr WGSelectView @@ -182,15 +190,18 @@ WGCreateButton: asl ; Records are 16 bytes wide tax - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen X inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen Y inx - jsr scanHex8 + iny + lda (PARAM0),y sta WG_VIEWRECORDS,x ; Screen width inx @@ -425,11 +436,20 @@ paintWindowTitle: lsr sec sbc SCRATCH1 - sta WG_LOCALCURSORX + sta WG_LOCALCURSORX ; Position cursor lda #-1 sta WG_LOCALCURSORY + jsr WGSyncGlobalCursor - jsr WGPrint + ldy #0 +paintWindowTitleLoop: + lda (PARAM0),y + beq paintWindowTitle_done + ora #%10000000 + jsr WGPlot ; Draw the character + iny + inc WG_CURSORX ; Advance cursors + bra paintWindowTitleLoop paintWindowTitle_done: RESTORE_ZPS @@ -581,13 +601,20 @@ WGViewFocusNext: jsr WGSelectView jsr WGPaintView +WGViewFocusNext_loop: inc WG_FOCUSVIEW ; Increment and wrap LDY_FOCUSVIEW lda WG_VIEWRECORDS+2,y - bne WGViewFocusNext_focus + bne WGViewFocusNext_wantFocus lda #0 sta WG_FOCUSVIEW +WGViewFocusNext_wantFocus: ; Does this view accept focus? + LDY_FOCUSVIEW + lda WG_VIEWRECORDS+4,y + cmp #VIEW_STYLE_TAKESFOCUS + bcc WGViewFocusNext_loop + WGViewFocusNext_focus: lda WG_FOCUSVIEW ; Change state and repaint to reflect it jsr WGSelectView @@ -619,18 +646,25 @@ WGViewFocusPrev: jsr WGSelectView jsr WGPaintView +WGViewFocusPrev_loop: dec WG_FOCUSVIEW ; Decrement and wrap - bpl WGViewFocusPrev_focus + bpl WGViewFocusPrev_wantFocus ldx #$f WGViewFocusPrev_findEndLoop: stx WG_FOCUSVIEW LDY_FOCUSVIEW lda WG_VIEWRECORDS+2,y - bne WGViewFocusPrev_focus + bne WGViewFocusPrev_wantFocus dex bra WGViewFocusPrev_findEndLoop +WGViewFocusPrev_wantFocus: ; Does this view accept focus? + LDY_FOCUSVIEW + lda WG_VIEWRECORDS+4,y + cmp #VIEW_STYLE_TAKESFOCUS + bcc WGViewFocusPrev_loop + WGViewFocusPrev_focus: lda WG_FOCUSVIEW ; Change state and repaint to reflect it jsr WGSelectView