Add 'Screen Saver' DA, issue #27. Also adds DrawMenu to MGTK, fixes #136.

This commit is contained in:
Joshua Bell 2019-03-10 20:40:05 -07:00
parent 088ee11777
commit a79eba08d1
8 changed files with 426 additions and 118 deletions

10
MGTK.md
View File

@ -920,6 +920,16 @@ Parameters:
.res 8 pattern 8x8 pixel pattern
```
#### DrawMenu ($51)
Redraws the current menu bar. Useful after full-screen operations.
Note that hilite state of menu bar items is not restored; this must
be done by manual calls to `HiliteMenu`
Parameters:
```
.res 8 pattern 8x8 pixel pattern
```
# Creating Applications and DeskTop Desk Accessories

View File

@ -38,6 +38,8 @@ https://github.com/inexorabletash/a2d/issues
* Shows an on-screen keyboard map and indicates which key is pressed.
* Run Basic Here
* Launch BASIC.SYSTEM with PREFIX set to the current window's pathname. (#42)
* Screen Saver
* Homage to Jack Eastman's classic. More to come. (#27)
Note that several of the new Desk Accessories will not work with older versions
of Apple II DeskTop/MouseDesk, due to dependence on new APIs.

View File

@ -18,6 +18,8 @@ New desk accessories:
* Shows an on-screen keyboard map, and indicates which key is pressed.
* [Run Basic Here](run.basic.here.s)
* Launches BASIC.SYSTEM with PREFIX set to current window's directory.
* [Screen Saver](screen.saver.s)
* Visual distractions.
See [API.md](API.md) for programming details

View File

@ -7,3 +7,4 @@ eyes
screen.dump
run.basic.here
key.caps
screen.saver

382
desk.acc/screen.saver.s Normal file
View File

@ -0,0 +1,382 @@
.setcpu "65C02"
.include "apple2.inc"
.include "../inc/apple2.inc"
.include "../mgtk.inc"
.include "../desktop.inc"
.include "../macros.inc"
;;; ============================================================
.org $800
da_start:
jmp start
save_stack:.byte 0
.proc start
tsx
stx save_stack
;; Copy DA to AUX
copy16 #da_start, STARTLO
copy16 #da_start, DESTINATIONLO
copy16 #da_end, ENDLO
sec ; main>aux
jsr AUXMOVE
;; Transfer control to aux
sta RAMWRTON
sta RAMRDON
;; run the DA
jsr init
;; tear down/exit
sta RAMRDOFF
sta RAMWRTOFF
ldx save_stack
txs
rts
.endproc
;;; ============================================================
;;; Animation Resources
toaster_height = 32
toaster_width = 64
toaster_count = 4
xpos_table:
.word screen_width+toaster_width
.word screen_width+toaster_width+150
.word screen_width+toaster_width+300
.word screen_width+toaster_width+450
ypos_table:
.word AS_WORD(-toaster_height)
.word AS_WORD(-toaster_height)+160
.word AS_WORD(-toaster_height)+40
.word AS_WORD(-toaster_height)+99
frame_table:
.byte 0,1,2,3
;;; ============================================================
;;; Graphics Resources
da_window_id = 100
event_params: .tag MGTK::Event
.proc window_title
.byte 0 ; length
.endproc
.proc winfo
window_id: .byte da_window_id ; window identifier
options: .byte MGTK::Option::dialog_box
title: .addr window_title
hscroll: .byte MGTK::Scroll::option_none
vscroll: .byte MGTK::Scroll::option_none
hthumbmax: .byte 32
hthumbpos: .byte 0
vthumbmax: .byte 32
vthumbpos: .byte 0
status: .byte 0
reserved: .byte 0
mincontwidth: .word screen_width
mincontlength: .word screen_height
maxcontwidth: .word screen_width
maxcontlength: .word screen_height
.proc port
viewloc: DEFINE_POINT 0, 0
mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth
maprect: DEFINE_RECT 0, 0, screen_width, screen_height
.endproc
pattern: .res 8, 0
colormasks: .byte MGTK::colormask_and, MGTK::colormask_or
penloc: DEFINE_POINT 0, 0
penwidth: .byte 1
penheight: .byte 1
penmode: .byte MGTK::notpencopy
textback: .byte $7F
textfont: .addr DEFAULT_FONT
nextwinfo: .addr 0
.endproc
.proc paintbits_params
viewloc: DEFINE_POINT 0,0,viewloc
mapbits: .addr 0
mapwidth: .byte 10
reserved: .byte 0
maprect: DEFINE_RECT 0,0,toaster_width-1,toaster_height-1
.endproc
notpencopy: .byte MGTK::notpencopy
penXOR: .byte MGTK::penXOR
.proc getwinport_params
window_id: .byte da_window_id
.addr grafport
.endproc
grafport: .tag MGTK::GrafPort
;;; ============================================================
;;; DA Init
.proc init
MGTK_CALL MGTK::HideCursor
MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::SetPort, winfo::port
MGTK_CALL MGTK::InitPort, grafport
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::SetPenMode, notpencopy
MGTK_CALL MGTK::PaintRect, grafport + MGTK::GrafPort::maprect
MGTK_CALL MGTK::FlushEvents
.endproc
;;; ============================================================
;;; Main Input Loop
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
lda event_params + MGTK::Event::kind
cmp #MGTK::EventKind::button_down ; was clicked?
beq exit
cmp #MGTK::EventKind::key_down ; any key?
beq exit
jsr animate
jmp input_loop
exit:
MGTK_CALL MGTK::DrawMenu
sta RAMWRTOFF
sta RAMRDOFF
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
sta RAMWRTON
sta RAMRDON
;; Force desktop redraw
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop
.endproc
;;; ============================================================
;;; Animate
.proc animate
MGTK_CALL MGTK::SetPort, grafport
MGTK_CALL MGTK::SetPenMode, penXOR
;; For each toaster...
copy #toaster_count-1, index
loop:
;; Stash current toaster's values
ldx index
copy frame_table,x, frame
txa
asl
tax
copy16 xpos_table,x, xpos
copy16 ypos_table,x, ypos
;; Erase previous pos
copy16 xpos, paintbits_params::viewloc::xcoord
copy16 ypos, paintbits_params::viewloc::ycoord
lda frame
asl ; *2
tax
copy16 toaster_frames,x, paintbits_params::mapbits
MGTK_CALL MGTK::PaintBits, paintbits_params
;; Move
add16 ypos, #1, ypos
sub16 xpos, #4, xpos
;; Wrap Y
cmp16 ypos, #screen_height
bvc :+
eor #$80
: bmi :+
copy16 #AS_WORD(-toaster_height), ypos
:
;; Wrap X
cmp16 xpos, #AS_WORD(-toaster_width)
bvc :+
eor #$80
: bpl :+
copy16 #screen_width+toaster_width, xpos
:
;; Next frame
inc frame
lda frame
cmp #4 ; num frames
bne :+
copy #0, frame
:
;; Draw new pos
copy16 xpos, paintbits_params::viewloc::xcoord
copy16 ypos, paintbits_params::viewloc::ycoord
lda frame
asl ; *2
tax
copy16 toaster_frames,x, paintbits_params::mapbits
MGTK_CALL MGTK::PaintBits, paintbits_params
;; Store updated values
ldx index
copy frame, frame_table,x
txa
asl
tax
copy16 xpos, xpos_table,x
copy16 ypos, ypos_table,x
;; Next
dec index
bmi :+
jmp loop
: rts
index: .byte 0
xpos: .word 0
ypos: .word 0
frame: .byte 0
.endproc
;;; ============================================================
toaster_frames:
.addr toaster_bits1
.addr toaster_bits2
.addr toaster_bits3
.addr toaster_bits2
toaster_bits1:
.byte px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1001100),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111110),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1100111),px(%1110011),px(%0000111),px(%1111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111111),px(%1001111),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111001),px(%1111111),px(%0000000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%1111111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%0000001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111100),px(%1111111),px(%1110011),px(%0011000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1110011),px(%1111001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1001111),px(%1111111),px(%1001100),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1001111),px(%1100111),px(%1111111),px(%1111110),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111110),px(%0111111),px(%1111110),px(%0110011),px(%0000000),px(%0000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%0011111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111001),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1110011),px(%1111111),px(%1001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%0000000),px(%0111100),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1001111),px(%1111001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111100),px(%0000111),px(%1110000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0001111),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1111111),px(%1100000),px(%0000011),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1111100),px(%0000000),px(%0001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011110),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
toaster_bits2:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000111),px(%1111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1110011),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111001),px(%1111111),px(%0000000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1111111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%1111000),px(%0000011),px(%1100000),px(%0000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111111),px(%0000111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1111111),px(%0000000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1110000),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%1111111),px(%1000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111110),px(%0111111),px(%1111111),px(%1110011),px(%0011000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111001),px(%1111111),px(%1111001),px(%1111111),px(%1111111),px(%1000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1111111),px(%1111111),px(%1001100),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%1100111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1001100),px(%1111110),px(%0110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111100),px(%0000000),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1000000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0001111),px(%1111110),px(%0000000),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1111111),px(%1100000),px(%0000011),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1111100),px(%0000000),px(%0001100),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011110),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
toaster_bits3:
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000001),px(%1111111),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000011),px(%1111111),px(%1111111),px(%1111000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0000000),px(%0111111),px(%1100000),px(%0000000),px(%0011111),px(%1110000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%0011111),px(%1000000),px(%0000001),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000011),px(%1111000),px(%0000000),px(%1111111),px(%1000000),px(%0000000),px(%0111111),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0111111),px(%0000000),px(%0001111),px(%1100000),px(%0000000),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000001),px(%1111100),px(%0000000),px(%0111111),px(%1111000),px(%0000011),px(%1100000),px(%0000000)
.byte px(%0000111),px(%1000000),px(%0011111),px(%1000000),px(%0000111),px(%1111111),px(%0000111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%0011110),px(%0000000),px(%1111000),px(%0000000),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%0011111),px(%1110011),px(%1100000),px(%0001111),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100001),px(%1111111),px(%0000000),px(%0111100),px(%1111111),px(%1111111),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0001111),px(%1111001),px(%1110011),px(%1111111),px(%1111111),px(%1111111),px(%1111100),px(%1100000),px(%0000000)
.byte px(%1100111),px(%1000000),px(%1111111),px(%1001111),px(%1111111),px(%1111111),px(%1111111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%1100110),px(%0111100),px(%0000111),px(%1001111),px(%1111110),px(%0001111),px(%1111111),px(%1000000),px(%1100000),px(%0000000)
.byte px(%1100110),px(%0000011),px(%1100110),px(%0111111),px(%1111001),px(%1110000),px(%0000000),px(%0001111),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0000011),px(%1100110),px(%0111111),px(%1100111),px(%1111111),px(%0011110),px(%0111100),px(%1111001),px(%1000000)
.byte px(%1100000),px(%0110011),px(%1100110),px(%0111111),px(%1100111),px(%1111100),px(%1111001),px(%1110011),px(%1100111),px(%1000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1100111),px(%1111111),px(%1100111),px(%1001111),px(%0011110),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0001111),px(%1111001),px(%1111111),px(%1111111),px(%1111100),px(%1111110),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0001100),px(%1111110),px(%0111111),px(%1111001),px(%1111111),px(%1111000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000011),px(%0000111),px(%1001111),px(%1111111),px(%1001111),px(%1111000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%1111111),px(%1110011),px(%1111111),px(%1111111),px(%1100000),px(%0000000)
.byte px(%1100000),px(%0110000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%1111111),px(%1111111),px(%0000000),px(%0000000)
.byte px(%1100000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000000),px(%0011111),px(%1111100),px(%0000000),px(%0000000)
.byte px(%0011000),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0000011),px(%1100001),px(%1110000),px(%0000000),px(%0000000)
.byte px(%0000110),px(%0000000),px(%0000110),px(%0000000),px(%0000000),px(%0111100),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000001),px(%1110000),px(%0000110),px(%0000000),px(%0011111),px(%1000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0001111),px(%0000110),px(%0001111),px(%1100000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
.byte px(%0000000),px(%0000000),px(%1111111),px(%1110000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000),px(%0000000)
;;; ============================================================
da_end:

View File

@ -378,6 +378,7 @@ jump_table:
.addr SetMenuSelectionImpl; $4E SetMenuSelection
.addr GetDeskPatImpl ; $4F GetDeskPat
.addr SetDeskPatImpl ; $50 SetDeskPat
.addr DrawMenuImpl ; $51 DrawMenu
;; Entry point param lengths
;; (length, ZP destination, hide cursor flag)
@ -497,6 +498,7 @@ param_lengths:
PARAM_DEFN 2, $82, 0 ; $4E SetMenuSelection
PARAM_DEFN 0, $00, 0 ; $4F GetDeskPat
PARAM_DEFN 0, $00, 0 ; $50 SetDeskPat
PARAM_DEFN 0, $00, 0 ; $51 DrawMenu
;;; ============================================================
;;; Pre-Shift Tables
@ -5640,6 +5642,7 @@ need_savebehind:
sta savebehind_usage+1
copy16 params_addr, active_menu
draw_menu_impl:
jsr get_menu_count ; into menu_count
jsr hide_cursor_save_params
jsr set_standard_port
@ -5776,7 +5779,7 @@ filler: ldx menu_item_index
: rts
.endproc
DrawMenuImpl := SetMenuImpl::draw_menu_impl
.proc get_menu_and_menu_item
ldx menu_index

View File

@ -505,6 +505,9 @@ GetDeskPat = $4F
SetDeskPat = $50
;;; .res 8 pattern 8x8 pixel pattern to use for desktop
DrawMenu = $51 ; Redraw menu bar
;;; (no parameters)
;;; ============================================================
;;; Graphics Primitives Constants

View File

@ -23,7 +23,7 @@
;;; | MP Dst | | MP Dst |
;;; $1580 +-----------+ +-----------+
;;; | | | |
;;; | MP Src | | Menu Save |
;;; | MP Src | | |
;;; $1100 +-----------+ +-----------+
;;; | | | |
;;; | DA | | DA (Copy) |
@ -34,12 +34,6 @@
hires := $2000 ; HR/DHR images are loaded directly into screen buffer
hires_size = $2000
;; Menu bits saved/restored
menu_rows = 13
menu_cols = 40
menu_save_area := $1100 ; Past DA code (need $410 bytes)
menu_save_size = menu_cols * 2 * menu_rows ; 5 pages
;; Minipix/Print Shop images are loaded/converted
minipix_src_buf = $1200 ; Load address
minipix_src_size = 576
@ -47,7 +41,6 @@
minipix_dst_size = 26*52
.assert (minipix_src_buf + minipix_src_size) < minipix_dst_buf, error, "Not enough room for Minipix load buffer"
.assert (menu_save_area + menu_save_size) < minipix_dst_buf, error, "Not enough room for menu save area"
.assert (minipix_dst_buf + minipix_dst_size) < WINDOW_ICON_TABLES, error, "Not enough room for Minipix convert buffer"
;;; ============================================================
@ -81,9 +74,6 @@ save_stack:.byte 0
jsr init
;; tear down/exit
sta ALTZPON
lda LCBANK1
lda LCBANK1
sta RAMRDOFF
sta RAMWRTOFF
@ -215,24 +205,7 @@ base: .word 0
.endproc
.proc event_params ; queried to track mouse-up
kind: .byte $00
;;; if state is MGTK::EventKind::key_down
key := *
modifiers := *+1
;;; otherwise
xcoord := *
ycoord := *+2
.res 4 ; space for both
.endproc
default_width = 560
default_height = 192
default_left = 0
default_top = 0
event_params: .tag MGTK::Event
.proc window_title
.byte 0 ; length
@ -250,16 +223,16 @@ vthumbmax: .byte 32
vthumbpos: .byte 0
status: .byte 0
reserved: .byte 0
mincontwidth: .word default_width
mincontlength: .word default_height
maxcontwidth: .word default_width
maxcontlength: .word default_height
mincontwidth: .word screen_width
mincontlength: .word screen_height
maxcontwidth: .word screen_width
maxcontlength: .word screen_height
.proc port
viewloc: DEFINE_POINT default_left, default_top
viewloc: DEFINE_POINT 0, 0
mapbits: .addr MGTK::screen_mapbits
mapwidth: .word MGTK::screen_mapwidth
maprect: DEFINE_RECT 0, 0, default_width, default_height
maprect: DEFINE_RECT 0, 0, screen_width, screen_height
.endproc
pattern:.res 8, 0
@ -275,10 +248,6 @@ nextwinfo: .addr 0
.proc init
sta ALTZPON
lda LCBANK1
lda LCBANK1
copy #0, mode
;; Get filename by checking DeskTop selected window/icon
@ -376,7 +345,6 @@ end: rts
sta close_params::ref_num
MGTK_CALL MGTK::HideCursor
jsr stash_menu
MGTK_CALL MGTK::OpenWindow, winfo
MGTK_CALL MGTK::SetPort, winfo::port
jsr set_color_mode
@ -394,7 +362,7 @@ end: rts
.proc input_loop
MGTK_CALL MGTK::GetEvent, event_params
lda event_params::kind
lda event_params + MGTK::Event::kind
cmp #MGTK::EventKind::button_down ; was clicked?
beq exit
cmp #MGTK::EventKind::key_down ; any key?
@ -402,9 +370,9 @@ end: rts
bne input_loop
on_key:
lda event_params::modifiers
lda event_params + MGTK::Event::modifiers
bne input_loop
lda event_params::key
lda event_params + MGTK::Event::key
cmp #CHAR_ESCAPE
beq exit
cmp #' '
@ -415,11 +383,20 @@ on_key:
exit:
jsr set_bw_mode
MGTK_CALL MGTK::HideCursor
;; Restore menu
MGTK_CALL MGTK::DrawMenu
sta RAMWRTOFF
sta RAMRDOFF
yax_call JUMP_TABLE_MGTK_RELAY, MGTK::HiliteMenu, last_menu_click_params
sta RAMWRTON
sta RAMRDON
;; Force desktop redraw
MGTK_CALL MGTK::CloseWindow, winfo
DESKTOP_CALL DT_REDRAW_ICONS
jsr unstash_menu
MGTK_CALL MGTK::ShowCursor
MGTK_CALL MGTK::ShowCursor
rts ; exits input loop
.endproc
@ -611,76 +588,6 @@ done: sta PAGE2OFF
rts
.endproc
;;; ============================================================
;;; Stash/Unstash Menu Bar
;;; Have not yet figured out how to force the menu to
;;; redraw, so instead we save the top 13 rows of the
;;; screen to a scratch buffer and restore after
;;; destroying the window.
.proc stash_menu
src := $08
dst := $06
copy16 #menu_save_area, dst
sta PAGE2ON
jsr inner
sta PAGE2OFF
inner:
lda #0 ; row #
rloop: pha
tax
copy hires_table_lo,x, src
copy hires_table_hi,x, src+1
ldy #menu_cols-1
cloop: lda (src),y
sta (dst),y
dey
bpl cloop
add16 dst, #menu_cols, dst
pla
inc
cmp #menu_rows
bcc rloop
rts
.endproc
.proc unstash_menu
src := $08
dst := $06
copy16 #menu_save_area, src
sta PAGE2ON
jsr inner
sta PAGE2OFF
inner:
lda #0 ; row #
rloop: pha
tax
copy hires_table_lo,x, dst
copy hires_table_hi,x, dst+1
ldy #menu_cols-1
cloop: lda (src),y
sta (dst),y
dey
bpl cloop
add16 src, #menu_cols, src
pla
inc
cmp #menu_rows
bcc rloop
rts
.endproc
;;; ============================================================
;;; Minipix images
@ -814,5 +721,3 @@ done: rts
;;; ============================================================
da_end:
.assert * <= menu_save_area, error, "DA overlapping menu save area"