2014-08-29 19:19:19 +00:00
|
|
|
;
|
|
|
|
; views.s
|
|
|
|
; Management routines for GUI views
|
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 8/15/14.
|
|
|
|
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
|
|
|
;
|
|
|
|
|
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
WG_FEATURE_UP = %00010000
|
|
|
|
WG_FEATURE_DN = %00100000
|
|
|
|
WG_FEATURE_LF = %00110000
|
|
|
|
WG_FEATURE_RT = %01000000
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGCreateView
|
2014-09-06 03:32:16 +00:00
|
|
|
; Creates and selects a new view
|
2014-09-16 15:41:48 +00:00
|
|
|
; PARAM0: Pointer to configuration struct (LSB)
|
|
|
|
; PARAM1: Pointer to configuration struct (MSB)
|
2014-08-29 19:19:19 +00:00
|
|
|
;
|
2014-09-16 15:41:48 +00:00
|
|
|
; Configuration struct:
|
2014-09-16 21:04:05 +00:00
|
|
|
; ID: View ID (0-f)
|
|
|
|
; ST: Style
|
2014-08-29 19:19:19 +00:00
|
|
|
; XX: Screen X origin
|
|
|
|
; YY: Screen Y origin
|
|
|
|
; SW: Screen width
|
|
|
|
; SH: Screen height
|
|
|
|
; VW: View Width
|
|
|
|
; VH: View Height
|
|
|
|
;
|
|
|
|
WGCreateView:
|
|
|
|
SAVE_AXY
|
2014-10-14 02:12:14 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
ldy #0
|
2014-09-17 01:01:08 +00:00
|
|
|
lda (PARAM0),y ; Find our new view record
|
|
|
|
pha ; Cache view ID so we can select when we're done
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl ; Records are 8 bytes wide
|
|
|
|
tax
|
|
|
|
|
2014-09-16 21:04:05 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
|
|
|
pha ; Cache style byte for later
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+2,x ; Screen Width
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+3,x ; Screen Height
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
pla
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+4,x ; Style
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
|
|
|
stz WG_VIEWRECORDS+6,x
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+7,x ; View Width
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+8,x ; View Height
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
|
|
|
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
|
|
|
stz WG_VIEWRECORDS+11,x
|
|
|
|
stz WG_VIEWRECORDS+12,x ; Initialize title
|
|
|
|
stz WG_VIEWRECORDS+13,x
|
2014-09-16 21:04:05 +00:00
|
|
|
|
2014-09-17 01:01:08 +00:00
|
|
|
pla
|
|
|
|
jsr WGSelectView ; Leave this as the active view
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
WGCreateView_done:
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGCreateCheckbox
|
|
|
|
; Creates a new checkbox
|
2014-09-16 15:41:48 +00:00
|
|
|
; PARAM0: Pointer to configuration struct (LSB)
|
|
|
|
; PARAM1: Pointer to configuration struct (MSB)
|
2014-09-05 23:31:33 +00:00
|
|
|
;
|
2014-09-16 15:41:48 +00:00
|
|
|
; Configuration struct:
|
2014-09-16 21:04:05 +00:00
|
|
|
; ID: View ID (0-f)
|
2014-09-05 23:31:33 +00:00
|
|
|
; XX: Screen X origin
|
|
|
|
; YY: Screen Y origin
|
2014-09-21 20:46:41 +00:00
|
|
|
; SL: String pointer (LSB)
|
|
|
|
; SH: String pointer (MSB)
|
2014-09-05 23:31:33 +00:00
|
|
|
;
|
|
|
|
WGCreateCheckbox:
|
|
|
|
SAVE_AXY
|
|
|
|
|
|
|
|
ldy #0
|
2014-09-17 01:01:08 +00:00
|
|
|
lda (PARAM0),y ; Find our new view record
|
|
|
|
pha ; Cache view ID so we can select when we're done
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2014-09-06 03:32:16 +00:00
|
|
|
asl ; Records are 16 bytes wide
|
2014-09-05 23:31:33 +00:00
|
|
|
tax
|
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
lda #1
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+2,x ; Initialize screen width
|
|
|
|
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
|
|
|
sta WG_VIEWRECORDS+7,x ; Initialize view width
|
|
|
|
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
lda #VIEW_STYLE_CHECK
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+4,x ; Style
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
|
|
|
stz WG_VIEWRECORDS+6,x
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
|
|
|
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
|
|
|
stz WG_VIEWRECORDS+11,x
|
2014-09-21 20:46:41 +00:00
|
|
|
|
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+12,x ; Title
|
2014-09-21 20:46:41 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+13,x
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-17 01:01:08 +00:00
|
|
|
pla
|
|
|
|
jsr WGSelectView ; Leave this as the active view
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
WGCreateCheckbox_done:
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGCreateButton
|
|
|
|
; Creates a new button
|
2014-09-16 15:41:48 +00:00
|
|
|
; PARAM0: Pointer to configuration struct (LSB)
|
|
|
|
; PARAM1: Pointer to configuration struct (MSB)
|
2014-09-05 23:31:33 +00:00
|
|
|
;
|
2014-09-16 15:41:48 +00:00
|
|
|
; Configuration struct:
|
2014-09-16 21:04:05 +00:00
|
|
|
; ID: View ID (0-f)
|
2014-09-05 23:31:33 +00:00
|
|
|
; XX: Screen X origin
|
|
|
|
; YY: Screen Y origin
|
|
|
|
; BW: Button width
|
2014-09-21 01:20:44 +00:00
|
|
|
; PL: Action callback (LSB)
|
|
|
|
; PH: Action callback (MSB)
|
2014-09-21 20:46:41 +00:00
|
|
|
; SL: Title string pointer (LSB)
|
|
|
|
; SH: Title string pointer (MSB)
|
2014-09-05 23:31:33 +00:00
|
|
|
WGCreateButton:
|
|
|
|
SAVE_AXY
|
|
|
|
|
|
|
|
ldy #0
|
2014-09-17 01:01:08 +00:00
|
|
|
lda (PARAM0),y ; Find our new view record
|
|
|
|
pha ; Cache view ID so we can select when we're done
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2014-09-06 03:32:16 +00:00
|
|
|
asl ; Records are 16 bytes wide
|
2014-09-05 23:31:33 +00:00
|
|
|
tax
|
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+2,x ; Screen width
|
|
|
|
sta WG_VIEWRECORDS+7,x ; View width
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
lda #1
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
|
|
|
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
lda #VIEW_STYLE_BUTTON
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+4,x ; Style
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
|
|
|
stz WG_VIEWRECORDS+6,x
|
|
|
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
2014-09-21 01:20:44 +00:00
|
|
|
|
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+10,x ; Callback
|
2014-09-21 01:20:44 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+11,x
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-21 20:46:41 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+12,x ; Title
|
2014-09-21 20:46:41 +00:00
|
|
|
iny
|
|
|
|
lda (PARAM0),y
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+13,x
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-17 01:01:08 +00:00
|
|
|
pla
|
|
|
|
jsr WGSelectView ; Leave this as the active view
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
WGCreateButton_done:
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGPaintView
|
|
|
|
; Paints the current view
|
|
|
|
;
|
|
|
|
WGPaintView:
|
2014-10-14 02:12:14 +00:00
|
|
|
SAVE_AXY
|
2014-08-29 19:19:19 +00:00
|
|
|
SAVE_ZPP
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
lda WG_VIEWRECORDS+4,y ; Cache style information
|
2014-09-21 01:20:44 +00:00
|
|
|
and #$f ; Mask off flag bits
|
2014-10-14 02:12:14 +00:00
|
|
|
pha
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
lda WG_VIEWRECORDS+0,y ; Fetch the geometry
|
2014-08-29 19:19:19 +00:00
|
|
|
sta PARAM0
|
2014-09-05 23:31:33 +00:00
|
|
|
lda WG_VIEWRECORDS+1,y
|
2014-08-29 19:19:19 +00:00
|
|
|
sta PARAM1
|
2014-09-05 23:31:33 +00:00
|
|
|
lda WG_VIEWRECORDS+2,y
|
2014-08-29 19:19:19 +00:00
|
|
|
sta PARAM2
|
2014-09-05 23:31:33 +00:00
|
|
|
lda WG_VIEWRECORDS+3,y
|
2014-08-29 19:19:19 +00:00
|
|
|
sta PARAM3
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
pla ; Draw outline
|
2014-09-07 23:06:25 +00:00
|
|
|
cmp #VIEW_STYLE_FANCY
|
|
|
|
beq WGPaintView_decorated
|
|
|
|
|
|
|
|
jsr WGStrokeRect
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
cmp #VIEW_STYLE_CHECK
|
|
|
|
beq WGPaintView_check
|
|
|
|
cmp #VIEW_STYLE_BUTTON
|
|
|
|
beq WGPaintView_button
|
|
|
|
bra WGPaintView_done
|
|
|
|
|
2014-09-07 23:06:25 +00:00
|
|
|
WGPaintView_decorated:
|
|
|
|
jsr WGFancyRect
|
|
|
|
jsr paintWindowTitle
|
|
|
|
bra WGPaintView_done
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
WGPaintView_check:
|
2014-09-06 03:32:16 +00:00
|
|
|
jsr paintCheck
|
|
|
|
bra WGPaintView_done
|
|
|
|
|
|
|
|
WGPaintView_button:
|
|
|
|
jsr paintButton
|
|
|
|
|
|
|
|
WGPaintView_done:
|
2015-01-16 02:52:32 +00:00
|
|
|
jsr WGPointerDirty ; The pointer BG may now be stale
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
RESTORE_ZPP
|
2014-10-14 02:12:14 +00:00
|
|
|
RESTORE_AXY
|
2014-09-06 03:32:16 +00:00
|
|
|
rts
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; paintCheck
|
|
|
|
; Paints the contents of a checkbox
|
|
|
|
; Y: Index into view records of checkbox to paint
|
2014-10-14 02:12:14 +00:00
|
|
|
; Side effects: Clobbers all registers,P0,P1
|
2014-09-06 03:32:16 +00:00
|
|
|
paintCheck:
|
|
|
|
lda WG_VIEWRECORDS+0,y ; Position cursor
|
2014-09-05 23:31:33 +00:00
|
|
|
sta WG_CURSORX
|
|
|
|
lda WG_VIEWRECORDS+1,y
|
|
|
|
sta WG_CURSORY
|
2014-09-06 03:32:16 +00:00
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+9,y ; Determine our visual state
|
2014-09-05 23:31:33 +00:00
|
|
|
and #$80
|
2014-09-06 03:32:16 +00:00
|
|
|
bne paintCheck_selected
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+9,y
|
|
|
|
and #$01
|
|
|
|
beq paintCheck_unselectedUnchecked
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
lda #'D'
|
2014-09-06 03:32:16 +00:00
|
|
|
bra paintCheck_plot
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
paintCheck_unselectedUnchecked:
|
|
|
|
lda #' '+$80
|
|
|
|
bra paintCheck_plot
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
paintCheck_selected:
|
|
|
|
lda WG_VIEWRECORDS+9,y
|
|
|
|
and #$01
|
|
|
|
beq paintCheck_selectedUnchecked
|
2014-09-05 23:31:33 +00:00
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
lda #'E'
|
|
|
|
bra paintCheck_plot
|
2014-09-06 00:14:37 +00:00
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
paintCheck_selectedUnchecked:
|
|
|
|
lda #' '
|
|
|
|
|
|
|
|
paintCheck_plot: ; Paint our state
|
|
|
|
jsr WGPlot
|
2014-09-21 20:46:41 +00:00
|
|
|
|
|
|
|
inc WG_CURSORX ; Prepare for title
|
|
|
|
inc WG_CURSORX
|
2014-10-03 19:22:19 +00:00
|
|
|
lda #CHAR_NORMAL
|
|
|
|
sta INVERSE
|
2014-09-21 20:46:41 +00:00
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+12,y
|
|
|
|
sta PARAM0
|
|
|
|
lda WG_VIEWRECORDS+13,y
|
|
|
|
sta PARAM1
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
paintCheck_titleLoop:
|
|
|
|
lda (PARAM0),y
|
|
|
|
beq paintCheck_done
|
|
|
|
ora #$80
|
|
|
|
jsr WGPlot
|
|
|
|
inc WG_CURSORX
|
|
|
|
iny
|
|
|
|
bra paintCheck_titleLoop
|
|
|
|
|
|
|
|
paintCheck_done:
|
2014-09-06 00:14:37 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; paintButton
|
|
|
|
; Paints the contents of a button
|
|
|
|
; Y: Index into view records of button to paint
|
2014-10-14 02:12:14 +00:00
|
|
|
; Side effects: Clobbers all registers,P0,P1,S1
|
2014-09-06 00:14:37 +00:00
|
|
|
paintButton:
|
2014-09-21 20:46:41 +00:00
|
|
|
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
2014-09-05 23:31:33 +00:00
|
|
|
sta PARAM0
|
2014-09-21 20:46:41 +00:00
|
|
|
lda WG_VIEWRECORDS+13,y
|
2014-09-05 23:31:33 +00:00
|
|
|
sta PARAM1
|
|
|
|
|
|
|
|
jsr WGStrLen ; Compute centering offset for title
|
|
|
|
lsr
|
|
|
|
sta SCRATCH1
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
|
|
|
lsr
|
|
|
|
sec
|
|
|
|
sbc SCRATCH1
|
2014-09-06 00:14:37 +00:00
|
|
|
sta SCRATCH1 ; Cache this for left margin rendering
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
lda #0 ; Position and print title
|
2014-09-06 00:14:37 +00:00
|
|
|
sta WG_LOCALCURSORX
|
|
|
|
lda #0
|
2014-09-05 23:31:33 +00:00
|
|
|
sta WG_LOCALCURSORY
|
2014-09-06 00:14:37 +00:00
|
|
|
jsr WGSyncGlobalCursor
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+9,y ; Is button highlighted?
|
|
|
|
and #$80
|
|
|
|
bne paintButton_titleSelected
|
2014-10-03 19:22:19 +00:00
|
|
|
lda #CHAR_NORMAL
|
|
|
|
sta INVERSE
|
2014-09-06 00:14:37 +00:00
|
|
|
lda #' '+$80
|
|
|
|
bra paintButton_titleMarginLeft
|
|
|
|
|
|
|
|
paintButton_titleSelected:
|
2014-10-03 19:22:19 +00:00
|
|
|
lda #CHAR_INVERSE
|
|
|
|
sta INVERSE
|
2014-09-06 00:14:37 +00:00
|
|
|
lda #' '
|
|
|
|
|
|
|
|
paintButton_titleMarginLeft:
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
paintButton_titleMarginLeftLoop:
|
|
|
|
cpx SCRATCH1
|
|
|
|
bcs paintButton_title ; Left margin finished
|
|
|
|
jsr WGPlot
|
|
|
|
inc WG_CURSORX
|
|
|
|
inc WG_LOCALCURSORX
|
|
|
|
inx
|
|
|
|
jmp paintButton_titleMarginLeftLoop
|
|
|
|
|
|
|
|
paintButton_title:
|
2014-09-05 23:31:33 +00:00
|
|
|
jsr WGPrint
|
2014-09-06 00:14:37 +00:00
|
|
|
ldx WG_VIEWRECORDS+2,y
|
|
|
|
stx SCRATCH1 ; Loop until right edge of button is reached
|
|
|
|
ldx WG_LOCALCURSORX
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-06 00:14:37 +00:00
|
|
|
paintButton_titleMarginRightLoop:
|
|
|
|
cpx SCRATCH1
|
|
|
|
bcs paintButton_done ; Right margin finished
|
|
|
|
jsr WGPlot
|
|
|
|
inc WG_CURSORX
|
|
|
|
inc WG_LOCALCURSORX
|
|
|
|
inx
|
|
|
|
jmp paintButton_titleMarginRightLoop
|
|
|
|
|
|
|
|
paintButton_done:
|
2014-08-29 19:19:19 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-07 23:06:25 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; paintWindowTitle
|
|
|
|
; Paints the title of a fancy window
|
|
|
|
; Y: Index into view records of view title to paint
|
2014-10-14 02:12:14 +00:00
|
|
|
; Side effects: Clobbers all registers,P0,P1,S1
|
2014-09-07 23:06:25 +00:00
|
|
|
paintWindowTitle:
|
2014-09-23 22:33:51 +00:00
|
|
|
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
2014-09-07 23:06:25 +00:00
|
|
|
sta PARAM0
|
2014-09-23 22:33:51 +00:00
|
|
|
lda WG_VIEWRECORDS+13,y
|
2014-09-07 23:06:25 +00:00
|
|
|
sta PARAM1
|
2014-09-16 21:04:05 +00:00
|
|
|
bne paintWindowTitle_compute
|
|
|
|
|
|
|
|
paintWindowTitle_checkNull:
|
|
|
|
lda PARAM0
|
|
|
|
beq paintWindowTitle_done
|
2014-09-07 23:06:25 +00:00
|
|
|
|
2014-09-16 21:04:05 +00:00
|
|
|
paintWindowTitle_compute:
|
2014-09-07 23:06:25 +00:00
|
|
|
jsr WGStrLen ; Compute centering offset for title
|
|
|
|
lsr
|
|
|
|
sta SCRATCH1
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
|
|
|
lsr
|
|
|
|
sec
|
|
|
|
sbc SCRATCH1
|
2014-09-16 15:41:48 +00:00
|
|
|
sta WG_LOCALCURSORX ; Position cursor
|
2014-09-07 23:06:25 +00:00
|
|
|
lda #-1
|
|
|
|
sta WG_LOCALCURSORY
|
2014-09-16 15:41:48 +00:00
|
|
|
jsr WGSyncGlobalCursor
|
2014-09-07 23:06:25 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
ldy #0
|
|
|
|
paintWindowTitleLoop:
|
|
|
|
lda (PARAM0),y
|
|
|
|
beq paintWindowTitle_done
|
|
|
|
ora #%10000000
|
|
|
|
jsr WGPlot ; Draw the character
|
|
|
|
iny
|
|
|
|
inc WG_CURSORX ; Advance cursors
|
|
|
|
bra paintWindowTitleLoop
|
2014-09-07 23:06:25 +00:00
|
|
|
|
|
|
|
paintWindowTitle_done:
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-03 00:43:09 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGEraseViewContents
|
|
|
|
; Erases the contents of the current view (interior contents only)
|
|
|
|
;
|
|
|
|
WGEraseViewContents:
|
2014-10-14 02:12:14 +00:00
|
|
|
SAVE_AY
|
2014-09-03 00:43:09 +00:00
|
|
|
SAVE_ZPP
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS,y ; Fetch the record
|
|
|
|
sta PARAM0
|
|
|
|
iny
|
|
|
|
lda WG_VIEWRECORDS,y
|
|
|
|
sta PARAM1
|
|
|
|
iny
|
|
|
|
lda WG_VIEWRECORDS,y
|
|
|
|
sta PARAM2
|
|
|
|
iny
|
|
|
|
lda WG_VIEWRECORDS,y
|
|
|
|
sta PARAM3
|
|
|
|
|
2014-10-03 19:22:19 +00:00
|
|
|
ldy #' '+$80
|
2014-09-03 00:43:09 +00:00
|
|
|
jsr WGFillRect
|
|
|
|
|
|
|
|
WGEraseViewContents_done:
|
|
|
|
RESTORE_ZPP
|
2014-10-14 02:12:14 +00:00
|
|
|
RESTORE_AY
|
2014-09-03 00:43:09 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGSelectView
|
|
|
|
; Selects the active view
|
|
|
|
; A: ID
|
|
|
|
;
|
|
|
|
WGSelectView:
|
|
|
|
sta WG_ACTIVEVIEW
|
|
|
|
|
|
|
|
; Initialize cursor to local origin
|
2014-10-14 02:12:14 +00:00
|
|
|
stz WG_LOCALCURSORX
|
|
|
|
stz WG_LOCALCURSORY
|
2014-08-29 19:19:19 +00:00
|
|
|
|
2014-09-01 18:18:36 +00:00
|
|
|
jsr cacheClipPlanes ; View changed, so clipping cache is stale
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
WGSelectView_done:
|
2014-09-06 03:32:16 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-07 18:22:32 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewFocus
|
|
|
|
; Shifts focus to the selected view
|
|
|
|
; Side effects: Changes selected view, repaints some views
|
|
|
|
;
|
|
|
|
WGViewFocus:
|
|
|
|
SAVE_AY
|
|
|
|
|
|
|
|
lda WG_ACTIVEVIEW ; Stash current selection
|
|
|
|
pha
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr unfocusCurrent
|
2014-09-07 18:22:32 +00:00
|
|
|
|
|
|
|
pla
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_FOCUSVIEW ; Focus on our current selection
|
|
|
|
jsr focusCurrent
|
2014-09-07 18:22:32 +00:00
|
|
|
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewUnfocus
|
|
|
|
; Unfocuses all views
|
|
|
|
; Side effects: Changes selected view, repaints some views
|
|
|
|
;
|
|
|
|
WGViewUnfocus:
|
|
|
|
pha
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr unfocusCurrent
|
2014-09-29 20:45:46 +00:00
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
sta WG_FOCUSVIEW
|
|
|
|
|
|
|
|
WGViewUnfocus_done:
|
|
|
|
pla
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewFocusNext
|
|
|
|
; Shifts focus to the next view
|
|
|
|
; Side effects: Changes selected view, repaints some views
|
|
|
|
;
|
|
|
|
WGViewFocusNext:
|
|
|
|
SAVE_AY
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr unfocusCurrent
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
WGViewFocusNext_loop:
|
2014-09-06 03:32:16 +00:00
|
|
|
inc WG_FOCUSVIEW ; Increment and wrap
|
|
|
|
LDY_FOCUSVIEW
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
2014-09-16 15:41:48 +00:00
|
|
|
bne WGViewFocusNext_wantFocus
|
2014-09-06 03:32:16 +00:00
|
|
|
lda #0
|
|
|
|
sta WG_FOCUSVIEW
|
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
WGViewFocusNext_wantFocus: ; Does this view accept focus?
|
|
|
|
LDY_FOCUSVIEW
|
|
|
|
lda WG_VIEWRECORDS+4,y
|
2014-09-21 01:20:44 +00:00
|
|
|
and #$f ; Mask off flag bits
|
2014-09-16 15:41:48 +00:00
|
|
|
cmp #VIEW_STYLE_TAKESFOCUS
|
|
|
|
bcc WGViewFocusNext_loop
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
WGViewFocusNext_focus:
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr focusCurrent
|
2014-09-06 03:32:16 +00:00
|
|
|
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-07 18:15:59 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewFocusPrev
|
|
|
|
; Shifts focus to the prev view
|
|
|
|
; Side effects: Changes selected view, repaints some views
|
|
|
|
;
|
|
|
|
WGViewFocusPrev:
|
|
|
|
SAVE_AXY
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr unfocusCurrent
|
2014-09-07 18:15:59 +00:00
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
WGViewFocusPrev_loop:
|
2014-09-07 18:15:59 +00:00
|
|
|
dec WG_FOCUSVIEW ; Decrement and wrap
|
2014-09-16 15:41:48 +00:00
|
|
|
bpl WGViewFocusPrev_wantFocus
|
2014-09-07 18:15:59 +00:00
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
WGViewFocusPrev_hadNone:
|
2014-09-07 18:15:59 +00:00
|
|
|
ldx #$f
|
|
|
|
WGViewFocusPrev_findEndLoop:
|
|
|
|
stx WG_FOCUSVIEW
|
|
|
|
LDY_FOCUSVIEW
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
2014-09-16 15:41:48 +00:00
|
|
|
bne WGViewFocusPrev_wantFocus
|
2014-09-07 18:15:59 +00:00
|
|
|
dex
|
|
|
|
bra WGViewFocusPrev_findEndLoop
|
|
|
|
|
2014-09-16 15:41:48 +00:00
|
|
|
WGViewFocusPrev_wantFocus: ; Does this view accept focus?
|
|
|
|
LDY_FOCUSVIEW
|
|
|
|
lda WG_VIEWRECORDS+4,y
|
2014-09-21 01:20:44 +00:00
|
|
|
and #$f ; Mask off flag bits
|
2014-09-16 15:41:48 +00:00
|
|
|
cmp #VIEW_STYLE_TAKESFOCUS
|
|
|
|
bcc WGViewFocusPrev_loop
|
|
|
|
|
2014-09-07 18:15:59 +00:00
|
|
|
WGViewFocusPrev_focus:
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr focusCurrent
|
|
|
|
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; unfocusCurrent
|
|
|
|
; Unfocuses current view, if any
|
|
|
|
; Side effects: Clobbers A,
|
|
|
|
; Leaves Y pointed at current focus view record
|
|
|
|
; Changes active view selection
|
|
|
|
unfocusCurrent:
|
|
|
|
lda WG_FOCUSVIEW
|
|
|
|
bmi unfocusCurrentDone ; No current focus
|
|
|
|
|
|
|
|
LDY_FOCUSVIEW ; Unfocus current view
|
|
|
|
lda WG_VIEWRECORDS+9,y
|
|
|
|
and #%01111111
|
|
|
|
sta WG_VIEWRECORDS+9,y
|
|
|
|
|
|
|
|
lda WG_FOCUSVIEW
|
2014-09-07 18:15:59 +00:00
|
|
|
jsr WGSelectView
|
2014-10-14 02:12:14 +00:00
|
|
|
jsr WGPaintView
|
2014-09-07 18:15:59 +00:00
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
unfocusCurrentDone:
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; focusCurrent
|
|
|
|
; Sets focus to desired view, and repaints
|
|
|
|
; Side effects: Clobbers A
|
|
|
|
focusCurrent:
|
|
|
|
lda WG_FOCUSVIEW
|
|
|
|
jsr WGSelectView
|
2014-09-07 18:22:32 +00:00
|
|
|
|
2014-10-17 18:08:14 +00:00
|
|
|
LDY_ACTIVEVIEW
|
2014-10-17 20:03:13 +00:00
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+4,y
|
|
|
|
and #$f ; Mask off flag bits
|
|
|
|
cmp #VIEW_STYLE_TAKESFOCUS
|
|
|
|
bcc focusCurrent_done
|
|
|
|
|
2014-09-07 18:15:59 +00:00
|
|
|
lda WG_VIEWRECORDS+9,y
|
|
|
|
ora #%10000000
|
|
|
|
sta WG_VIEWRECORDS+9,y
|
|
|
|
|
|
|
|
jsr WGPaintView
|
2014-10-17 20:03:13 +00:00
|
|
|
|
|
|
|
focusCurrent_done:
|
2014-09-07 18:15:59 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewFocusAction
|
|
|
|
; Performs the action of the focused view
|
2014-10-01 22:53:20 +00:00
|
|
|
; WG_GOSUB : Set if the caller should perform an Applesoft GOSUB
|
2014-09-06 03:32:16 +00:00
|
|
|
; Side effects: Changes selected view, Repaints some views
|
|
|
|
;
|
|
|
|
WGViewFocusAction:
|
2015-01-03 00:42:53 +00:00
|
|
|
SAVE_AXY
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
lda WG_FOCUSVIEW
|
|
|
|
bmi WGViewFocusAction_done
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
LDY_FOCUSVIEW
|
|
|
|
lda WG_VIEWRECORDS+4,y ; What kind of view is it?
|
2014-09-21 01:20:44 +00:00
|
|
|
and #$f ; Mask off flag bits
|
2014-09-06 03:32:16 +00:00
|
|
|
|
|
|
|
cmp #VIEW_STYLE_CHECK
|
|
|
|
beq WGViewFocusAction_toggleCheckbox
|
2014-10-25 19:01:14 +00:00
|
|
|
bra WGViewFocusAction_buttonClick ; Everything else treated like a button
|
2014-09-06 03:32:16 +00:00
|
|
|
|
|
|
|
WGViewFocusAction_toggleCheckbox:
|
2014-09-07 18:15:59 +00:00
|
|
|
lda WG_VIEWRECORDS+9,y ; Change the checkbox's state and redraw
|
2014-09-06 03:32:16 +00:00
|
|
|
eor #%00000001
|
|
|
|
sta WG_VIEWRECORDS+9,y
|
|
|
|
lda WG_FOCUSVIEW
|
|
|
|
jsr WGSelectView
|
|
|
|
jsr WGPaintView
|
2014-09-07 18:15:59 +00:00
|
|
|
; Fall through so checkboxes can have callbacks too
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-09-07 18:15:59 +00:00
|
|
|
; NOTE: Self-modifying code ahead!
|
2014-09-06 03:32:16 +00:00
|
|
|
WGViewFocusAction_buttonClick:
|
2014-09-21 01:20:44 +00:00
|
|
|
lda WG_VIEWRECORDS+4,y ; Are we an Applesoft button?
|
|
|
|
and #VIEW_STYLE_APPLESOFT
|
2014-09-21 20:08:41 +00:00
|
|
|
bne WGViewFocusAction_buttonClickApplesoft
|
2014-09-21 01:20:44 +00:00
|
|
|
|
2014-09-21 20:46:41 +00:00
|
|
|
lda WG_VIEWRECORDS+11,y ; Do we have a callback?
|
2014-09-07 18:15:59 +00:00
|
|
|
beq WGViewFocusAction_done
|
|
|
|
sta WGViewFocusAction_userJSR+2 ; Modify code below so we can JSR to user's code
|
2014-09-21 20:46:41 +00:00
|
|
|
lda WG_VIEWRECORDS+10,y
|
2014-09-07 18:15:59 +00:00
|
|
|
sta WGViewFocusAction_userJSR+1
|
|
|
|
|
|
|
|
WGViewFocusAction_userJSR:
|
2014-10-01 22:53:20 +00:00
|
|
|
jsr WGViewFocusAction_done ; Overwritten with user's function pointer
|
2014-09-21 01:20:44 +00:00
|
|
|
bra WGViewFocusAction_done
|
|
|
|
|
|
|
|
WGViewFocusAction_buttonClickApplesoft:
|
2014-10-01 22:53:20 +00:00
|
|
|
lda #0
|
|
|
|
sta WG_GOSUB
|
2014-09-21 01:20:44 +00:00
|
|
|
lda WG_VIEWRECORDS+10,y ; Do we have a callback?
|
|
|
|
beq WGViewFocusAction_mightBeZero
|
|
|
|
|
|
|
|
WGViewFocusAction_buttonClickApplesoftNotZero:
|
2015-01-14 21:29:12 +00:00
|
|
|
sta WG_GOSUBLINE
|
2014-09-21 01:20:44 +00:00
|
|
|
lda WG_VIEWRECORDS+11,y
|
2015-01-14 21:29:12 +00:00
|
|
|
sta WG_GOSUBLINE+1
|
2014-09-21 01:20:44 +00:00
|
|
|
|
|
|
|
WGViewFocusAction_buttonClickApplesoftGosub:
|
|
|
|
; Caller needs to handle Applesoft Gosub, so signal with a flag and return
|
2014-10-01 22:53:20 +00:00
|
|
|
lda #1
|
|
|
|
sta WG_GOSUB
|
2014-09-21 01:20:44 +00:00
|
|
|
bra WGViewFocusAction_done
|
|
|
|
|
|
|
|
WGViewFocusAction_mightBeZero:
|
|
|
|
lda WG_VIEWRECORDS+11,y
|
|
|
|
beq WGViewFocusAction_done
|
|
|
|
lda WG_VIEWRECORDS+10,y
|
|
|
|
bra WGViewFocusAction_buttonClickApplesoftNotZero
|
2014-09-06 03:32:16 +00:00
|
|
|
|
|
|
|
WGViewFocusAction_done:
|
2015-01-03 00:42:53 +00:00
|
|
|
RESTORE_AXY
|
2014-09-21 01:20:44 +00:00
|
|
|
WGViewFocusAction_knownRTS:
|
2014-08-29 19:19:19 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGPendingViewAction
|
|
|
|
; Performs the action of the pending view, if any
|
2014-10-11 23:12:15 +00:00
|
|
|
; Global flag set if the caller should perform an Applesoft GOSUB
|
2014-09-29 20:45:46 +00:00
|
|
|
; Side effects: Changes selected view, Repaints some views
|
|
|
|
;
|
|
|
|
WGPendingViewAction:
|
2014-10-25 19:01:14 +00:00
|
|
|
SAVE_AY
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
lda WG_PENDINGACTIONVIEW
|
|
|
|
bmi WGPendingViewAction_done
|
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
and #$f ; Select view in question
|
2014-09-29 20:45:46 +00:00
|
|
|
jsr WGSelectView
|
2014-10-25 19:01:14 +00:00
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+4,y
|
|
|
|
and #$f
|
|
|
|
cmp #VIEW_STYLE_FANCY ; Filter out fancy views with high-nybble of 0
|
|
|
|
bne WGPendingViewAction_chkCallback ; This prevents unnecessary redraws when clicking
|
|
|
|
lda WG_PENDINGACTIONVIEW ; in the content area
|
|
|
|
and #$f0
|
|
|
|
beq WGPendingViewAction_done
|
|
|
|
|
|
|
|
WGPendingViewAction_chkCallback:
|
2015-01-01 23:56:32 +00:00
|
|
|
; lda WG_VIEWRECORDS+10,y ; Optimization- only process things that can be clicked
|
|
|
|
; bne WGPendingViewAction_hasCallback
|
|
|
|
; lda WG_VIEWRECORDS+11,y
|
|
|
|
; beq WGPendingViewAction_done
|
2014-10-25 19:01:14 +00:00
|
|
|
|
|
|
|
WGPendingViewAction_hasCallback:
|
|
|
|
lda WG_PENDINGACTIONVIEW
|
|
|
|
and #$f0 ; Check for window features
|
|
|
|
beq WGPendingViewAction_content
|
|
|
|
|
|
|
|
cmp #WG_FEATURE_UP
|
|
|
|
beq WGPendingViewAction_up
|
|
|
|
cmp #WG_FEATURE_DN
|
|
|
|
beq WGPendingViewAction_down
|
|
|
|
cmp #WG_FEATURE_LF
|
|
|
|
beq WGPendingViewAction_left
|
|
|
|
cmp #WG_FEATURE_RT
|
|
|
|
bne WGPendingViewAction_done
|
|
|
|
|
|
|
|
lda #-1 ; Right arrow
|
|
|
|
jsr WGScrollXBy
|
|
|
|
jsr WGViewFocus
|
|
|
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
|
|
|
|
|
|
|
WGPendingViewAction_done: ; Centralized for branch range
|
|
|
|
lda #$ff
|
|
|
|
sta WG_PENDINGACTIONVIEW
|
|
|
|
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
WGPendingViewAction_up:
|
|
|
|
lda #1 ; Up arrow
|
|
|
|
jsr WGScrollYBy
|
|
|
|
jsr WGViewFocus
|
|
|
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
|
|
|
bra WGPendingViewAction_done
|
|
|
|
|
|
|
|
WGPendingViewAction_down:
|
|
|
|
lda #-1 ; Down arrow
|
|
|
|
jsr WGScrollYBy
|
|
|
|
jsr WGViewFocus
|
|
|
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
|
|
|
bra WGPendingViewAction_done
|
|
|
|
|
|
|
|
WGPendingViewAction_left:
|
|
|
|
lda #1 ; Left arrow
|
|
|
|
jsr WGScrollXBy
|
|
|
|
jsr WGViewFocus
|
|
|
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
|
|
|
bra WGPendingViewAction_done
|
|
|
|
|
|
|
|
WGPendingViewAction_content:
|
2014-09-29 20:45:46 +00:00
|
|
|
jsr WGViewFocus
|
|
|
|
jsr WGViewFocusAction
|
2014-10-01 22:53:20 +00:00
|
|
|
jsr delayShort
|
2014-09-29 20:45:46 +00:00
|
|
|
jsr WGViewUnfocus
|
|
|
|
|
2014-10-17 18:08:14 +00:00
|
|
|
jsr WGPointerDirty ; If we redrew anything, the pointer BG will be stale
|
2014-10-25 19:01:14 +00:00
|
|
|
bra WGPendingViewAction_done
|
2014-09-29 20:45:46 +00:00
|
|
|
|
2014-10-01 22:53:20 +00:00
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGPendingView
|
|
|
|
; Returns the view that is currently pending
|
|
|
|
; OUT A : Pending view ID, or $ff if none
|
|
|
|
;
|
|
|
|
WGPendingView:
|
|
|
|
lda WG_PENDINGACTIONVIEW
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-05 23:31:33 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewSetTitle
|
|
|
|
; Sets the title of the active view
|
|
|
|
; PARAM0: Null-terminated string pointer (LSB)
|
|
|
|
; PARAM1: Null-terminated string pointer (MSB)
|
|
|
|
WGViewSetTitle:
|
2014-10-14 02:12:14 +00:00
|
|
|
SAVE_AY
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
lda PARAM0
|
|
|
|
sta WG_VIEWRECORDS+12,y
|
2014-09-21 21:16:12 +00:00
|
|
|
lda PARAM1
|
|
|
|
sta WG_VIEWRECORDS+13,y
|
2014-09-05 23:31:33 +00:00
|
|
|
|
|
|
|
WGViewSetTitle_done:
|
2014-10-14 02:12:14 +00:00
|
|
|
RESTORE_AY
|
2014-09-05 23:31:33 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-07 18:15:59 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewSetAction
|
|
|
|
; Sets the callback action of the active view
|
|
|
|
; PARAM0: Null-terminated function pointer (LSB)
|
|
|
|
; PARAM1: Null-terminated function pointer (MSB)
|
|
|
|
WGViewSetAction:
|
|
|
|
SAVE_AY
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
lda PARAM0
|
|
|
|
sta WG_VIEWRECORDS+10,y
|
2014-09-21 21:16:12 +00:00
|
|
|
lda PARAM1
|
|
|
|
sta WG_VIEWRECORDS+11,y
|
2014-09-07 18:15:59 +00:00
|
|
|
|
|
|
|
WGViewSetAction_done:
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGSetCursor
|
|
|
|
; Sets the current local view cursor
|
2014-10-03 19:22:19 +00:00
|
|
|
; PARAM0: X
|
|
|
|
; PARAM1: Y
|
2014-08-29 19:19:19 +00:00
|
|
|
;
|
|
|
|
WGSetCursor:
|
2014-10-03 19:22:19 +00:00
|
|
|
pha
|
|
|
|
|
|
|
|
lda PARAM0
|
2015-01-13 20:55:14 +00:00
|
|
|
bpl WGSetCursor_StoreX
|
|
|
|
lda #0 ; Prevent negatives
|
|
|
|
|
|
|
|
WGSetCursor_StoreX:
|
2014-10-03 19:22:19 +00:00
|
|
|
sta WG_LOCALCURSORX
|
|
|
|
lda PARAM1
|
2015-01-13 20:55:14 +00:00
|
|
|
bpl WGSetCursor_StoreY
|
|
|
|
lda #0 ; Prevent negatives
|
|
|
|
|
|
|
|
WGSetCursor_StoreY:
|
2014-10-03 19:22:19 +00:00
|
|
|
sta WG_LOCALCURSORY
|
|
|
|
|
|
|
|
pla
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGSetGlobalCursor
|
|
|
|
; Sets the current global cursor
|
|
|
|
; PARAM0: X
|
|
|
|
; PARAM1: Y
|
|
|
|
;
|
|
|
|
WGSetGlobalCursor:
|
|
|
|
pha
|
|
|
|
|
|
|
|
lda PARAM0
|
|
|
|
sta WG_CURSORX
|
|
|
|
lda PARAM1
|
|
|
|
sta WG_CURSORY
|
|
|
|
|
|
|
|
pla
|
2014-08-29 19:19:19 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-10-03 19:22:19 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGSyncGlobalCursor
|
|
|
|
; Synchronizes the global cursor with the current local view's
|
|
|
|
; cursor
|
|
|
|
;
|
|
|
|
WGSyncGlobalCursor:
|
|
|
|
SAVE_AY
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
; Sync X
|
2014-08-29 19:19:19 +00:00
|
|
|
clc ; Transform to viewspace
|
|
|
|
lda WG_LOCALCURSORX
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+0,y
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
clc
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+5,y ; Transform to scrollspace
|
2014-08-29 19:19:19 +00:00
|
|
|
sta WG_CURSORX
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
; Sync Y
|
2014-08-29 19:19:19 +00:00
|
|
|
clc ; Transform to viewspace
|
|
|
|
lda WG_LOCALCURSORY
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+1,y
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
clc
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+6,y ; Transform to scrollspace
|
2014-08-29 19:19:19 +00:00
|
|
|
sta WG_CURSORY
|
|
|
|
|
|
|
|
WGSyncGlobalCursor_done:
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGScrollX
|
|
|
|
; Scrolls the current view horizontally
|
2014-09-03 00:43:09 +00:00
|
|
|
; A: New scroll amount
|
2014-08-29 19:19:19 +00:00
|
|
|
; Side effects: Clobbers A
|
|
|
|
;
|
|
|
|
WGScrollX:
|
|
|
|
phy
|
|
|
|
pha
|
2014-10-14 02:12:14 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
LDY_ACTIVEVIEW
|
2014-09-03 00:43:09 +00:00
|
|
|
pla
|
2015-01-13 21:00:39 +00:00
|
|
|
bmi WGScrollX_Store
|
|
|
|
lda #0 ; Prevent positive scroll values
|
|
|
|
|
|
|
|
WGScrollX_Store:
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+5,y
|
2014-09-01 18:18:36 +00:00
|
|
|
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
WGScrollX_done:
|
|
|
|
ply
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-09 01:00:40 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGScrollXBy
|
|
|
|
; Scrolls the current view horizontally by a delta
|
|
|
|
; A: Scroll delta
|
2014-10-14 02:12:14 +00:00
|
|
|
; Side effects: Clobbers A,S0
|
2014-09-09 01:00:40 +00:00
|
|
|
;
|
|
|
|
WGScrollXBy:
|
2014-10-14 02:12:14 +00:00
|
|
|
SAVE_XY
|
2014-09-09 01:00:40 +00:00
|
|
|
tax
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
|
|
|
txa
|
|
|
|
bpl WGScrollXBy_contentRight
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+2,y ; Compute left limit
|
|
|
|
sec
|
|
|
|
sbc WG_VIEWRECORDS+7,y
|
|
|
|
sta SCRATCH0
|
|
|
|
|
|
|
|
txa ; Compute new scroll value
|
|
|
|
clc
|
|
|
|
adc WG_VIEWRECORDS+5,y
|
|
|
|
cmp SCRATCH0 ; Clamp if needed
|
|
|
|
bmi WGScrollXBy_clampLeft
|
|
|
|
sta WG_VIEWRECORDS+5,y
|
|
|
|
bra WGScrollXBy_done
|
|
|
|
|
|
|
|
WGScrollXBy_clampLeft:
|
|
|
|
lda SCRATCH0
|
|
|
|
sta WG_VIEWRECORDS+5,y
|
|
|
|
bra WGScrollXBy_done
|
|
|
|
|
|
|
|
WGScrollXBy_contentRight:
|
|
|
|
clc ; Compute new scroll value
|
|
|
|
adc WG_VIEWRECORDS+5,y
|
2014-10-14 02:12:14 +00:00
|
|
|
beq @0 ; Clamp if needed
|
2014-09-09 01:00:40 +00:00
|
|
|
bpl WGScrollXBy_clampRight
|
|
|
|
@0: sta WG_VIEWRECORDS+5,y
|
|
|
|
bra WGScrollXBy_done
|
|
|
|
|
|
|
|
WGScrollXBy_clampRight:
|
|
|
|
lda #0
|
|
|
|
sta WG_VIEWRECORDS+5,y
|
|
|
|
|
|
|
|
WGScrollXBy_done:
|
2014-10-14 02:12:14 +00:00
|
|
|
RESTORE_XY
|
2014-09-09 01:00:40 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGScrollY
|
|
|
|
; Scrolls the current view vertically
|
2014-09-03 00:43:09 +00:00
|
|
|
; A: New scroll amount
|
2014-08-29 19:19:19 +00:00
|
|
|
; Side effects: Clobbers A
|
|
|
|
;
|
|
|
|
WGScrollY:
|
|
|
|
phy
|
|
|
|
pha
|
2014-10-14 02:12:14 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
pla
|
2015-01-13 21:00:39 +00:00
|
|
|
bmi WGScrollY_Store
|
|
|
|
lda #0 ; Prevent positive scroll values
|
|
|
|
|
|
|
|
WGScrollY_Store:
|
2014-10-14 02:12:14 +00:00
|
|
|
sta WG_VIEWRECORDS+6,y
|
2014-09-01 18:18:36 +00:00
|
|
|
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
WGScrollY_done:
|
|
|
|
ply
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-01 18:18:36 +00:00
|
|
|
|
2014-09-09 01:00:40 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGScrollYBy
|
|
|
|
; Scrolls the current view horizontally by a delta
|
|
|
|
; A: Scroll delta
|
2014-10-14 02:12:14 +00:00
|
|
|
; Side effects: Clobbers A,S0
|
2014-09-09 01:00:40 +00:00
|
|
|
;
|
|
|
|
WGScrollYBy:
|
2014-10-14 02:12:14 +00:00
|
|
|
SAVE_XY
|
2014-09-09 01:00:40 +00:00
|
|
|
tax
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
|
|
|
txa
|
|
|
|
bpl WGScrollYBy_contentDown
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+3,y ; Compute bottom limit
|
|
|
|
sec
|
|
|
|
sbc WG_VIEWRECORDS+8,y
|
|
|
|
sta SCRATCH0
|
|
|
|
|
|
|
|
txa ; Compute new scroll value
|
|
|
|
clc
|
|
|
|
adc WG_VIEWRECORDS+6,y
|
|
|
|
cmp SCRATCH0 ; Clamp if needed
|
|
|
|
bmi WGScrollYBy_clampTop
|
|
|
|
sta WG_VIEWRECORDS+6,y
|
|
|
|
bra WGScrollYBy_done
|
|
|
|
|
|
|
|
WGScrollYBy_clampTop:
|
|
|
|
lda SCRATCH0
|
|
|
|
sta WG_VIEWRECORDS+6,y
|
|
|
|
bra WGScrollYBy_done
|
|
|
|
|
|
|
|
WGScrollYBy_contentDown:
|
|
|
|
clc ; Compute new scroll value
|
|
|
|
adc WG_VIEWRECORDS+6,y
|
2014-10-14 02:12:14 +00:00
|
|
|
beq @0 ; Clamp if needed
|
|
|
|
bpl WGScrollYBy_clampBottom
|
2014-09-09 01:00:40 +00:00
|
|
|
@0: sta WG_VIEWRECORDS+6,y
|
|
|
|
bra WGScrollYBy_done
|
|
|
|
|
|
|
|
WGScrollYBy_clampBottom:
|
|
|
|
lda #0
|
|
|
|
sta WG_VIEWRECORDS+6,y
|
|
|
|
|
|
|
|
WGScrollYBy_done:
|
2014-10-14 02:12:14 +00:00
|
|
|
RESTORE_XY
|
2014-09-09 01:00:40 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-06 03:32:16 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewPaintAll
|
|
|
|
; Repaints all views
|
|
|
|
; Side effects: Changes selected view
|
|
|
|
;
|
|
|
|
WGViewPaintAll:
|
|
|
|
SAVE_AXY
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
WGViewPaintAll_loop:
|
|
|
|
txa
|
|
|
|
jsr WGSelectView
|
|
|
|
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
lda WG_VIEWRECORDS+2,y ; Last view?
|
|
|
|
beq WGViewPaintAll_done
|
|
|
|
|
2014-09-07 23:25:26 +00:00
|
|
|
jsr WGEraseViewContents
|
2014-09-06 03:32:16 +00:00
|
|
|
jsr WGPaintView
|
|
|
|
inx
|
|
|
|
bra WGViewPaintAll_loop
|
|
|
|
|
|
|
|
WGViewPaintAll_done:
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGViewFromPoint
|
|
|
|
; Finds a view containing the given point
|
|
|
|
; PARAM0:X
|
|
|
|
; PARAM1:Y
|
2014-10-25 19:01:14 +00:00
|
|
|
; OUT A: View ID (or high bit set if no match)
|
|
|
|
; For Fancy Views, Upper nibble returned indicates feature hit:
|
|
|
|
; 0000 : Content region
|
|
|
|
; 0001 : Scroll arrow up
|
|
|
|
; 0010 : Scroll arrow down
|
|
|
|
; 0011 : Scroll arrow left
|
|
|
|
; 0100 : Scroll arrow right
|
2014-09-29 20:45:46 +00:00
|
|
|
WGViewFromPoint:
|
|
|
|
SAVE_XY
|
2014-10-25 19:01:14 +00:00
|
|
|
SAVE_ZPS
|
2014-09-29 20:45:46 +00:00
|
|
|
|
|
|
|
ldx #$f ; Scan views backwards, because controls are usually at the end
|
|
|
|
|
|
|
|
WGViewFromPoint_loop:
|
|
|
|
txa
|
|
|
|
LDY_AVIEW
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
|
|
|
beq WGViewFromPoint_loopNext ; Not an allocated view
|
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
lda WG_VIEWRECORDS+4,y ; Fancy views are handled differently
|
|
|
|
and #$f
|
|
|
|
cmp #VIEW_STYLE_FANCY
|
|
|
|
beq WGViewFromPoint_loopFancy
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+2,y
|
|
|
|
sta SCRATCH0
|
|
|
|
lda WG_VIEWRECORDS+3,y
|
|
|
|
sta SCRATCH1
|
|
|
|
bra WGViewFromPoint_loopCheckBounds
|
|
|
|
|
|
|
|
WGViewFromPoint_loopFancy:
|
|
|
|
lda WG_VIEWRECORDS+2,y ; Include scrollbars
|
|
|
|
inc
|
|
|
|
sta SCRATCH0
|
|
|
|
lda WG_VIEWRECORDS+3,y
|
|
|
|
inc
|
|
|
|
sta SCRATCH1
|
|
|
|
|
|
|
|
WGViewFromPoint_loopCheckBounds:
|
2014-09-29 20:45:46 +00:00
|
|
|
lda PARAM0 ; Check left edge
|
|
|
|
cmp WG_VIEWRECORDS+0,y
|
|
|
|
bcc WGViewFromPoint_loopNext
|
|
|
|
|
|
|
|
lda PARAM1 ; Check top edge
|
|
|
|
cmp WG_VIEWRECORDS+1,y
|
|
|
|
bcc WGViewFromPoint_loopNext
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+0,y ; Check right edge
|
|
|
|
clc
|
2014-10-25 19:01:14 +00:00
|
|
|
adc SCRATCH0
|
2014-09-29 20:45:46 +00:00
|
|
|
cmp PARAM0
|
|
|
|
bcc WGViewFromPoint_loopNext
|
|
|
|
beq WGViewFromPoint_loopNext
|
|
|
|
|
|
|
|
lda WG_VIEWRECORDS+1,y ; Check bottom edge
|
|
|
|
clc
|
2014-10-25 19:01:14 +00:00
|
|
|
adc SCRATCH1
|
2014-09-29 20:45:46 +00:00
|
|
|
cmp PARAM1
|
|
|
|
bcc WGViewFromPoint_loopNext
|
|
|
|
beq WGViewFromPoint_loopNext
|
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
; Found a match (in X)
|
|
|
|
lda WG_VIEWRECORDS+4,y
|
|
|
|
and #$f ; Mask off flag bits
|
|
|
|
cmp #VIEW_STYLE_FANCY
|
|
|
|
bne WGViewFromPoint_matchDone
|
2014-09-29 20:45:46 +00:00
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
; For fancy views, check scrollbars as well
|
|
|
|
lda WG_VIEWRECORDS+0,y ; Right scroll bar?
|
|
|
|
clc
|
|
|
|
adc SCRATCH0
|
|
|
|
dec
|
|
|
|
cmp PARAM0
|
|
|
|
bne WGViewFromPoint_checkBottomScroll
|
|
|
|
|
|
|
|
lda PARAM1 ; Up arrow?
|
|
|
|
cmp WG_VIEWRECORDS+1,y
|
|
|
|
bne WGViewFromPoint_checkDownArrow
|
|
|
|
txa
|
|
|
|
ora #WG_FEATURE_UP
|
|
|
|
bra WGViewFromPoint_matchFancyDone
|
|
|
|
|
|
|
|
WGViewFromPoint_loopNext: ; Inserted here for branch range
|
2014-09-29 20:45:46 +00:00
|
|
|
dex
|
|
|
|
bmi WGViewFromPoint_noMatch
|
|
|
|
bra WGViewFromPoint_loop
|
|
|
|
|
2014-10-25 19:01:14 +00:00
|
|
|
WGViewFromPoint_checkDownArrow:
|
|
|
|
lda WG_VIEWRECORDS+1,y ; Down arrow?
|
|
|
|
clc
|
|
|
|
adc SCRATCH1
|
|
|
|
dec
|
|
|
|
dec
|
|
|
|
cmp PARAM1
|
|
|
|
bne WGViewFromPoint_matchDone
|
|
|
|
txa
|
|
|
|
ora #WG_FEATURE_DN
|
|
|
|
bra WGViewFromPoint_matchFancyDone
|
|
|
|
|
|
|
|
WGViewFromPoint_checkBottomScroll:
|
|
|
|
lda WG_VIEWRECORDS+1,y ; Bottom scroll bar?
|
|
|
|
clc
|
|
|
|
adc SCRATCH1
|
|
|
|
dec
|
|
|
|
cmp PARAM1
|
|
|
|
bne WGViewFromPoint_matchDone
|
|
|
|
lda PARAM0 ; Left arrow?
|
|
|
|
cmp WG_VIEWRECORDS+0,y
|
|
|
|
bne WGViewFromPoint_checkRightArrow
|
|
|
|
txa
|
|
|
|
ora #WG_FEATURE_LF
|
|
|
|
bra WGViewFromPoint_matchFancyDone
|
|
|
|
|
|
|
|
WGViewFromPoint_checkRightArrow:
|
|
|
|
lda WG_VIEWRECORDS+0,y ; Right arrow?
|
|
|
|
clc
|
|
|
|
adc SCRATCH0
|
|
|
|
dec
|
|
|
|
dec
|
|
|
|
cmp PARAM0
|
|
|
|
bne WGViewFromPoint_matchDone
|
|
|
|
txa
|
|
|
|
ora #WG_FEATURE_RT
|
|
|
|
|
|
|
|
WGViewFromPoint_matchFancyDone:
|
|
|
|
tax
|
|
|
|
|
|
|
|
WGViewFromPoint_matchDone:
|
|
|
|
RESTORE_ZPS
|
|
|
|
txa
|
|
|
|
RESTORE_XY
|
|
|
|
rts
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
WGViewFromPoint_noMatch:
|
2014-10-25 19:01:14 +00:00
|
|
|
RESTORE_ZPS
|
2014-09-29 20:45:46 +00:00
|
|
|
lda #$ff
|
|
|
|
RESTORE_XY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2014-09-01 18:18:36 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; cacheClipPlanes
|
|
|
|
; Internal routine to cache the clipping planes for the view
|
|
|
|
;
|
|
|
|
cacheClipPlanes:
|
|
|
|
SAVE_AY
|
|
|
|
|
|
|
|
; Compute clip planes in view space
|
|
|
|
LDY_ACTIVEVIEW
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
lda WG_VIEWRECORDS+5,y ; Left edge
|
2014-09-01 18:18:36 +00:00
|
|
|
eor #$ff
|
|
|
|
inc
|
|
|
|
sta WG_VIEWCLIP+0
|
|
|
|
|
|
|
|
clc
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+2,y ; Right edge
|
2014-09-01 18:18:36 +00:00
|
|
|
sta WG_VIEWCLIP+2
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
lda WG_VIEWRECORDS+7,y ; Right span (distance from window edge to view edge, in viewspace
|
2014-09-01 18:18:36 +00:00
|
|
|
sec
|
|
|
|
sbc WG_VIEWCLIP+2
|
|
|
|
sta WG_VIEWCLIP+4
|
|
|
|
|
2014-10-14 02:12:14 +00:00
|
|
|
lda WG_VIEWRECORDS+6,y ; Top edge
|
2014-09-01 18:18:36 +00:00
|
|
|
eor #$ff
|
|
|
|
inc
|
|
|
|
sta WG_VIEWCLIP+1
|
|
|
|
|
|
|
|
clc
|
2014-10-14 02:12:14 +00:00
|
|
|
adc WG_VIEWRECORDS+3,y ; Bottom edge
|
2014-09-01 18:18:36 +00:00
|
|
|
sta WG_VIEWCLIP+3
|
|
|
|
|
|
|
|
RESTORE_AY
|
|
|
|
rts
|
|
|
|
|
|
|
|
|