MGTK: Add GetDeskPat/SetDeskPat commands

This commit is contained in:
Joshua Bell 2019-02-24 11:27:37 -08:00
parent a428ba81be
commit 0978840c10
4 changed files with 61 additions and 4 deletions

19
MGTK.md
View File

@ -902,6 +902,25 @@ Parameters:
.byte activate 0=deactivate, 1=activate
```
#### GetDeskPat ($4F)
Get address of desktop pattern.
Parameters:
```
.addr pattern (out) 8x8 pixel pattern
```
#### SetDeskPat ($50)
Set new desktop pattern. Note that this does NOT redraw anything.
Applications can show/hide a full-screen window to force a redraw.
Parameters:
```
.res 8 pattern 8x8 pixel pattern
```
# Creating Applications and DeskTop Desk Accessories
### Application Use

View File

@ -2269,7 +2269,9 @@ volume:
.proc erase_desktop_icon
lda #0
sta LA3B7
MGTK_CALL MGTK::SetPattern, checkerboard_pattern
MGTK_CALL MGTK::GetDeskPat, addr
MGTK_CALL MGTK::SetPattern, 0, addr
;; fall through
.endproc

View File

@ -376,6 +376,8 @@ jump_table:
;; Extra Calls
.addr BitBltImpl ; $4D BitBlt
.addr SetMenuSelectionImpl; $4E SetMenuSelection
.addr GetDeskPatImpl ; $4F GetDeskPat
.addr SetDeskPatImpl ; $50 SetDeskPat
;; Entry point param lengths
;; (length, ZP destination, hide cursor flag)
@ -493,6 +495,8 @@ param_lengths:
;; Extra Calls
PARAM_DEFN 16, $8A, 0 ; $4D BitBlt
PARAM_DEFN 2, $82, 0 ; $4E SetMenuSelection
PARAM_DEFN 0, $00, 0 ; $4F GetDeskPat
PARAM_DEFN 0, $00, 0 ; $50 SetDeskPat
;;; ============================================================
;;; Pre-Shift Tables
@ -4939,6 +4943,7 @@ bottom: .word screen_height-1
.byte $00,$00,$00,$00,$00,$00,$00,$00
desktop_pattern:
checkerboard_pattern:
.byte %01010101
.byte %10101010
@ -10300,10 +10305,31 @@ mouse_firmware_hi: ; e.g. if mouse is in slot 4, this is $C4
mouse_operand: ; e.g. if mouse is in slot 4, this is $40
.byte 0
.endproc ; mgtk
;;; ============================================================
;;; GetDeskPat
.proc GetDeskPatImpl
ldax #desktop_pattern
jmp store_xa_at_params
.endproc
;;; ============================================================
;;; SetDeskPat
.proc SetDeskPatImpl
ldy #.sizeof(MGTK::Pattern)-1
: lda (params_addr),y
sta desktop_pattern,y
dey
bpl :-
rts
.endproc
;;; ============================================================
.endproc ; mgtk
;; Room for future expansion
PAD_TO $8580

View File

@ -490,12 +490,22 @@ ActivateCtl = $4C ; Activate/deactivate scroll bar
;;; .byte which_ctl ctl_*_scroll_bar
;;; .byte activate 0=deactivate, 1=activate
;;; $4D ???
;;; --------------------------------------------------
;;; Extra Calls
BitBlt = $4D
;;; (input length: 16 bytes)
;;; $4E ???
SetMenuSelection = $4E
;;; (input length: 2 bytes)
GetDeskPat = $4F
;;; .addr pattern (out) Address of desktop pattern
SetDeskPat = $50
;;; .res 8 pattern 8x8 pixel pattern to use for desktop
;;; ============================================================
;;; Graphics Primitives Constants