mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-20 02:29:11 +00:00
MGTK: Start using structs
This commit is contained in:
parent
94e02e4a72
commit
8b3d056d7f
@ -1432,7 +1432,7 @@ base: .word 10 ; vertical text offset (to baseline)
|
|||||||
jmp endif
|
jmp endif
|
||||||
else: MGTK_CALL MGTK::DrawText, prop_str
|
else: MGTK_CALL MGTK::DrawText, prop_str
|
||||||
|
|
||||||
endif: ldx #MGTK::mapinfo_size - 1
|
endif: ldx #.sizeof(MGTK::MapInfo) - 1
|
||||||
loop: lda default_port,x
|
loop: lda default_port,x
|
||||||
sta winfo::port,x
|
sta winfo::port,x
|
||||||
dex
|
dex
|
||||||
|
@ -2549,11 +2549,11 @@ L5464: lda active_window_id
|
|||||||
lda active_window_id
|
lda active_window_id
|
||||||
jsr window_lookup
|
jsr window_lookup
|
||||||
stax $06
|
stax $06
|
||||||
ldy #MGTK::winfo_offset_port+MGTK::grafport_offset_maprect
|
ldy #MGTK::winfo_offset_port+MGTK::GrafPort::maprect
|
||||||
L5479: lda ($06),y
|
L5479: lda ($06),y
|
||||||
sta rect_E230-(MGTK::winfo_offset_port+MGTK::grafport_offset_maprect),y
|
sta rect_E230-(MGTK::winfo_offset_port+MGTK::GrafPort::maprect),y
|
||||||
iny
|
iny
|
||||||
cpy #MGTK::winfo_offset_port+MGTK::grafport_offset_maprect+8
|
cpy #MGTK::winfo_offset_port+MGTK::GrafPort::maprect+8
|
||||||
bne L5479
|
bne L5479
|
||||||
ldx #$00
|
ldx #$00
|
||||||
L5485: cpx cached_window_icon_count
|
L5485: cpx cached_window_icon_count
|
||||||
@ -4002,21 +4002,21 @@ L6112: ldy #$14
|
|||||||
|
|
||||||
lda ($06),y
|
lda ($06),y
|
||||||
sec
|
sec
|
||||||
sbc port_copy+MGTK::grafport_offset_viewloc_xcoord
|
sbc port_copy+MGTK::GrafPort::viewloc+MGTK::Point::xcoord
|
||||||
sta L6197
|
sta L6197
|
||||||
iny
|
iny
|
||||||
lda ($06),y
|
lda ($06),y
|
||||||
sbc port_copy+MGTK::grafport_offset_viewloc_xcoord+1
|
sbc port_copy+MGTK::GrafPort::viewloc+MGTK::Point::xcoord+1
|
||||||
sta L6197+1
|
sta L6197+1
|
||||||
iny
|
iny
|
||||||
|
|
||||||
lda ($06),y
|
lda ($06),y
|
||||||
sec
|
sec
|
||||||
sbc port_copy+MGTK::grafport_offset_viewloc_ycoord
|
sbc port_copy+MGTK::GrafPort::viewloc+MGTK::Point::ycoord
|
||||||
sta L6199
|
sta L6199
|
||||||
iny
|
iny
|
||||||
lda ($06),y
|
lda ($06),y
|
||||||
sbc port_copy+MGTK::grafport_offset_viewloc_ycoord+1
|
sbc port_copy+MGTK::GrafPort::viewloc+MGTK::Point::ycoord+1
|
||||||
sta L6199+1
|
sta L6199+1
|
||||||
|
|
||||||
ldx active_window_id
|
ldx active_window_id
|
||||||
@ -4394,7 +4394,7 @@ L650D: .word 0
|
|||||||
lda active_window_id
|
lda active_window_id
|
||||||
jsr window_lookup
|
jsr window_lookup
|
||||||
stax ptr
|
stax ptr
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_maprect + 7
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::maprect + 7
|
||||||
ldx #7
|
ldx #7
|
||||||
: lda grafport2::cliprect,x
|
: lda grafport2::cliprect,x
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
@ -8216,7 +8216,7 @@ addr: .addr 0
|
|||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
port_copy:
|
port_copy:
|
||||||
.res MGTK::grafport_size+1
|
.res .sizeof(MGTK::GrafPort)+1
|
||||||
|
|
||||||
.proc copy_window_portbits
|
.proc copy_window_portbits
|
||||||
ptr := $6
|
ptr := $6
|
||||||
@ -8232,7 +8232,7 @@ port_copy:
|
|||||||
sta port_copy,x
|
sta port_copy,x
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
cpx #MGTK::grafport_size
|
cpx #.sizeof(MGTK::GrafPort)
|
||||||
bne :-
|
bne :-
|
||||||
jsr pop_zp_addrs
|
jsr pop_zp_addrs
|
||||||
rts
|
rts
|
||||||
@ -8252,7 +8252,7 @@ port_copy:
|
|||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
cpx #MGTK::grafport_size
|
cpx #.sizeof(MGTK::GrafPort)
|
||||||
bne :-
|
bne :-
|
||||||
jsr pop_zp_addrs
|
jsr pop_zp_addrs
|
||||||
rts
|
rts
|
||||||
@ -8277,7 +8277,7 @@ port_copy:
|
|||||||
stax winfo_ptr
|
stax winfo_ptr
|
||||||
|
|
||||||
;; Screen space
|
;; Screen space
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_viewloc + 3
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::viewloc + 3
|
||||||
ldx #3
|
ldx #3
|
||||||
: lda (winfo_ptr),y
|
: lda (winfo_ptr),y
|
||||||
sta pos_screen,x
|
sta pos_screen,x
|
||||||
@ -8286,7 +8286,7 @@ port_copy:
|
|||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
;; Window space
|
;; Window space
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_maprect + 3
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::maprect + 3
|
||||||
ldx #3
|
ldx #3
|
||||||
: lda (winfo_ptr),y
|
: lda (winfo_ptr),y
|
||||||
sta pos_win,x
|
sta pos_win,x
|
||||||
@ -8370,7 +8370,7 @@ pos_win: .word 0, 0
|
|||||||
jsr window_lookup
|
jsr window_lookup
|
||||||
stax winfo_ptr
|
stax winfo_ptr
|
||||||
|
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_viewloc + 3
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::viewloc + 3
|
||||||
ldx #3
|
ldx #3
|
||||||
: lda (winfo_ptr),y
|
: lda (winfo_ptr),y
|
||||||
sta pos_screen,x
|
sta pos_screen,x
|
||||||
@ -8378,7 +8378,7 @@ pos_win: .word 0, 0
|
|||||||
dex
|
dex
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_maprect + 3
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::maprect + 3
|
||||||
ldx #3
|
ldx #3
|
||||||
: lda (winfo_ptr),y
|
: lda (winfo_ptr),y
|
||||||
sta pos_win,x
|
sta pos_win,x
|
||||||
|
@ -236,7 +236,7 @@ rts2: rts
|
|||||||
;;; Copy port params (36 bytes) to/from active port addr
|
;;; Copy port params (36 bytes) to/from active port addr
|
||||||
|
|
||||||
.proc apply_active_port_to_port
|
.proc apply_active_port_to_port
|
||||||
ldy #MGTK::grafport_size-1
|
ldy #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda (active_port),y
|
: lda (active_port),y
|
||||||
sta current_grafport,y
|
sta current_grafport,y
|
||||||
dey
|
dey
|
||||||
@ -245,7 +245,7 @@ rts2: rts
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc apply_port_to_active_port
|
.proc apply_port_to_active_port
|
||||||
ldy #MGTK::grafport_size-1
|
ldy #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda current_grafport,y
|
: lda current_grafport,y
|
||||||
sta (active_port),y
|
sta (active_port),y
|
||||||
dey
|
dey
|
||||||
@ -3758,7 +3758,7 @@ poly_maxima_xh_table:
|
|||||||
jsr SetSwitchesImpl
|
jsr SetSwitchesImpl
|
||||||
|
|
||||||
;; Initialize port
|
;; Initialize port
|
||||||
ldx #MGTK::grafport_size-1
|
ldx #.sizeof(MGTK::GrafPort)-1
|
||||||
loop: lda standard_port,x
|
loop: lda standard_port,x
|
||||||
sta $8A,x
|
sta $8A,x
|
||||||
sta current_grafport,x
|
sta current_grafport,x
|
||||||
@ -3864,7 +3864,7 @@ store_xa_at_y:
|
|||||||
;;; InitPort
|
;;; InitPort
|
||||||
|
|
||||||
.proc InitPortImpl
|
.proc InitPortImpl
|
||||||
ldy #MGTK::grafport_size-1 ; Store 36 bytes at params
|
ldy #.sizeof(MGTK::GrafPort)-1 ; Store 36 bytes at params
|
||||||
loop: lda standard_port,y
|
loop: lda standard_port,y
|
||||||
sta (params_addr),y
|
sta (params_addr),y
|
||||||
dey
|
dey
|
||||||
@ -4938,7 +4938,7 @@ stack_ptr_save:
|
|||||||
lda stack_ptr_save
|
lda stack_ptr_save
|
||||||
sta stack_ptr_stash
|
sta stack_ptr_stash
|
||||||
|
|
||||||
ldy #MGTK::grafport_size-1
|
ldy #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda ($82),y
|
: lda ($82),y
|
||||||
sta current_grafport,y
|
sta current_grafport,y
|
||||||
dey
|
dey
|
||||||
@ -6913,7 +6913,7 @@ get_from_ax:
|
|||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
; copy first 16 bytes of grafport to $B7
|
; copy first 16 bytes of grafport to $B7
|
||||||
ldy #MGTK::winfo_offset_port + MGTK::grafport_offset_pattern-1
|
ldy #MGTK::winfo_offset_port + MGTK::GrafPort::pattern-1
|
||||||
: lda (window),y
|
: lda (window),y
|
||||||
sta current_winport - MGTK::winfo_offset_port,y
|
sta current_winport - MGTK::winfo_offset_port,y
|
||||||
dey
|
dey
|
||||||
@ -7712,7 +7712,7 @@ previous_port:
|
|||||||
.res 2
|
.res 2
|
||||||
|
|
||||||
update_port:
|
update_port:
|
||||||
.res MGTK::grafport_size
|
.res .sizeof(MGTK::GrafPort)
|
||||||
|
|
||||||
.proc BeginUpdateImpl
|
.proc BeginUpdateImpl
|
||||||
jsr window_by_id_or_exit
|
jsr window_by_id_or_exit
|
||||||
@ -7794,7 +7794,7 @@ win_port: .addr 0
|
|||||||
jsr prepare_winport
|
jsr prepare_winport
|
||||||
bcc err_obscured
|
bcc err_obscured
|
||||||
|
|
||||||
ldy #MGTK::grafport_size-1
|
ldy #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda current_grafport,y
|
: lda current_grafport,y
|
||||||
sta (params_addr),y
|
sta (params_addr),y
|
||||||
dey
|
dey
|
||||||
@ -7824,7 +7824,7 @@ win_port: .addr 0
|
|||||||
: lda (window),y
|
: lda (window),y
|
||||||
sta current_grafport - MGTK::winfo_offset_port,y
|
sta current_grafport - MGTK::winfo_offset_port,y
|
||||||
iny
|
iny
|
||||||
cpy #MGTK::winfo_offset_port + MGTK::grafport_size
|
cpy #MGTK::winfo_offset_port + .sizeof(MGTK::GrafPort)
|
||||||
bne :-
|
bne :-
|
||||||
|
|
||||||
ldx #2
|
ldx #2
|
||||||
@ -7887,7 +7887,7 @@ win_port: .addr 0
|
|||||||
bcc :+
|
bcc :+
|
||||||
inc ptr+1
|
inc ptr+1
|
||||||
|
|
||||||
: ldy #MGTK::grafport_size-1
|
: ldy #.sizeof(MGTK::GrafPort)-1
|
||||||
loop: lda ($82),y
|
loop: lda ($82),y
|
||||||
sta (ptr),y
|
sta (ptr),y
|
||||||
dey
|
dey
|
||||||
@ -10047,7 +10047,7 @@ out_of_boundsl:
|
|||||||
not_left:
|
not_left:
|
||||||
sta set_input_key
|
sta set_input_key
|
||||||
|
|
||||||
ldx #MGTK::grafport_size-1
|
ldx #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda $A7,x
|
: lda $A7,x
|
||||||
sta $0600,x
|
sta $0600,x
|
||||||
dex
|
dex
|
||||||
@ -10057,7 +10057,7 @@ not_left:
|
|||||||
jsr kbd_menu_by_shortcut
|
jsr kbd_menu_by_shortcut
|
||||||
php
|
php
|
||||||
|
|
||||||
ldx #MGTK::grafport_size-1
|
ldx #.sizeof(MGTK::GrafPort)-1
|
||||||
: lda $0600,x
|
: lda $0600,x
|
||||||
sta $A7,x
|
sta $A7,x
|
||||||
dex
|
dex
|
||||||
|
@ -182,14 +182,14 @@ LD134: .byte 0
|
|||||||
.byte 0
|
.byte 0
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
grafport: .res MGTK::grafport_size, 0
|
grafport: .res .sizeof(MGTK::GrafPort), 0
|
||||||
|
|
||||||
.proc getwinport_params
|
.proc getwinport_params
|
||||||
window_id: .byte 0
|
window_id: .byte 0
|
||||||
port: .addr grafport_win
|
port: .addr grafport_win
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
grafport_win: .res MGTK::grafport_size, 0
|
grafport_win: .res .sizeof(MGTK::GrafPort), 0
|
||||||
|
|
||||||
asl $EA
|
asl $EA
|
||||||
.byte 0
|
.byte 0
|
||||||
|
60
mgtk.inc
60
mgtk.inc
@ -571,29 +571,45 @@ inpoly_outside := $00
|
|||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
;;; Offsets
|
;;; Offsets
|
||||||
|
|
||||||
mapinfo_offset_viewloc := 0
|
.struct Point
|
||||||
mapinfo_offset_viewloc_xcoord := 0
|
xcoord .word
|
||||||
mapinfo_offset_viewloc_ycoord := 2
|
ycoord .word
|
||||||
mapinfo_offset_mapbits := 4
|
.endstruct
|
||||||
mapinfo_offset_mapwidth := 6
|
|
||||||
mapinfo_offset_maprect := 8
|
|
||||||
mapinfo_size := 16
|
|
||||||
|
|
||||||
grafport_offset_viewloc := 0
|
.struct Rect
|
||||||
grafport_offset_viewloc_xcoord := 0
|
x1 .word
|
||||||
grafport_offset_viewloc_ycoord := 2
|
y1 .word
|
||||||
grafport_offset_mapbits := 4
|
x2 .word
|
||||||
grafport_offset_mapwidth := 6
|
y2 .word
|
||||||
grafport_offset_maprect := 8
|
.endstruct
|
||||||
grafport_offset_pattern := 16
|
|
||||||
grafport_offset_colormasks := 24
|
.struct Pattern
|
||||||
grafport_offset_penloc := 26
|
bits .res 8
|
||||||
grafport_offset_penwidth := 30
|
.endstruct
|
||||||
grafport_offset_penheight := 31
|
|
||||||
grafport_offset_penmode := 32
|
.struct MapInfo
|
||||||
grafport_offset_textback := 33
|
viewloc .tag Point
|
||||||
grafport_offset_textfont := 34
|
mapbits .word
|
||||||
grafport_size := 36
|
mapwidth .byte
|
||||||
|
reserved .byte
|
||||||
|
maprect .tag Rect
|
||||||
|
.endstruct
|
||||||
|
|
||||||
|
.struct GrafPort
|
||||||
|
viewloc .tag Point
|
||||||
|
mapbits .addr
|
||||||
|
mapwidth .byte
|
||||||
|
reserved .byte
|
||||||
|
maprect .tag Rect
|
||||||
|
pattern .tag Pattern
|
||||||
|
colormasks .byte 2
|
||||||
|
penloc .tag Point
|
||||||
|
penwidth .byte
|
||||||
|
penheight .byte
|
||||||
|
penmode .byte
|
||||||
|
textback .byte
|
||||||
|
textfont .addr
|
||||||
|
.endstruct
|
||||||
|
|
||||||
winfo_offset_window_id := 0
|
winfo_offset_window_id := 0
|
||||||
winfo_offset_options := 1
|
winfo_offset_options := 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user