mirror of
https://github.com/mi57730/a2d.git
synced 2025-01-05 18:29:21 +00:00
prodos macros for das
This commit is contained in:
parent
de85dad1c1
commit
f1bd7e8825
@ -99,7 +99,7 @@ skip: lda #0
|
||||
sta offscreen_flag
|
||||
lda ROMIN2
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, grafport
|
||||
rts
|
||||
|
||||
.proc routine
|
||||
@ -135,7 +135,7 @@ offscreen_flag:
|
||||
;; Is skipping this responsible for display redraw bug?
|
||||
;; https://github.com/inexorabletash/a2d/issues/34
|
||||
: MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, grafport
|
||||
lda getwinport_params_window_id
|
||||
cmp #da_window_id
|
||||
bne :+
|
||||
@ -189,7 +189,7 @@ goaway: .byte 0
|
||||
|
||||
.proc getwinport_params
|
||||
window_id: .byte 0
|
||||
.addr port_params
|
||||
.addr grafport
|
||||
.endproc
|
||||
getwinport_params_window_id := getwinport_params::window_id
|
||||
|
||||
@ -614,9 +614,8 @@ base: .word 16
|
||||
|
||||
farg: .byte $00,$00,$00,$00,$00,$00
|
||||
|
||||
.proc title_bar_decoration ; Params for MGTK::PaintBits
|
||||
left: .word 115 ; overwritten
|
||||
top: .word $FFF7 ; overwritten
|
||||
.proc title_bar_bitmap ; Params for MGTK::PaintBits
|
||||
viewloc: DEFINE_POINT 115, $FFF7, viewloc
|
||||
mapbits:.addr pixels
|
||||
mapwidth: .byte 1
|
||||
reserved: .byte 0
|
||||
@ -630,8 +629,7 @@ pixels: .byte px(%1000001)
|
||||
.byte px(%1001001)
|
||||
.endproc
|
||||
|
||||
;; param block for a QUERY_SCREEN and SET_STATE calls, and ref'd in GetWinPort call
|
||||
.proc port_params
|
||||
.proc grafport
|
||||
viewloc: DEFINE_POINT 0, 0
|
||||
mapbits: .word 0
|
||||
mapwidth: .word 0
|
||||
@ -645,7 +643,7 @@ penmode: .byte 0
|
||||
textback: .byte 0
|
||||
textfont: .addr 0
|
||||
.endproc
|
||||
.assert * - port_params = 36, error
|
||||
.assert * - grafport = 36, error
|
||||
|
||||
.byte 0 ; ???
|
||||
|
||||
@ -752,8 +750,8 @@ init: sta ALTZPON
|
||||
lda LCBANK1
|
||||
MGTK_CALL MGTK::SetZP1, preserve_zp_params
|
||||
MGTK_CALL MGTK::OpenWindow, winfo
|
||||
MGTK_CALL MGTK::InitPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, port_params ; set clipping bounds?
|
||||
MGTK_CALL MGTK::InitPort, grafport
|
||||
MGTK_CALL MGTK::SetPort, grafport ; set clipping bounds?
|
||||
MGTK_CALL MGTK::FlushEvents
|
||||
lda #$01
|
||||
sta event_params::kind
|
||||
@ -914,7 +912,7 @@ loop: lda routine,x
|
||||
beq exit ; if so, exit DA
|
||||
clear: lda #'C' ; otherwise turn Escape into Clear
|
||||
|
||||
trydel: cmp #$7F ; Delete?
|
||||
trydel: cmp #CHAR_DELETE ; Delete?
|
||||
beq :+
|
||||
cmp #$60 ; lowercase range?
|
||||
bcc :+
|
||||
@ -1572,24 +1570,24 @@ draw_title_bar:
|
||||
lda winfo::left
|
||||
clc
|
||||
adc #offset_left
|
||||
sta title_bar_decoration::left
|
||||
sta title_bar_bitmap::viewloc::xcoord
|
||||
bcc :+
|
||||
inx
|
||||
: stx title_bar_decoration::left+1
|
||||
: stx title_bar_bitmap::viewloc::xcoord+1
|
||||
ldx winfo::top+1
|
||||
lda winfo::top
|
||||
sec
|
||||
sbc #offset_top
|
||||
sta title_bar_decoration::top
|
||||
sta title_bar_bitmap::viewloc::ycoord
|
||||
bcs :+
|
||||
dex
|
||||
: stx title_bar_decoration::top+1
|
||||
: stx title_bar_bitmap::viewloc::ycoord+1
|
||||
MGTK_CALL MGTK::SetPortBits, screen_port ; set clipping rect to whole screen
|
||||
MGTK_CALL MGTK::PaintBits, title_bar_decoration ; Draws decoration in title bar
|
||||
MGTK_CALL MGTK::PaintBits, title_bar_bitmap ; Draws decoration in title bar
|
||||
lda #da_window_id
|
||||
sta getwinport_params::window_id
|
||||
MGTK_CALL MGTK::GetWinPort, getwinport_params
|
||||
MGTK_CALL MGTK::SetPort, port_params
|
||||
MGTK_CALL MGTK::SetPort, grafport
|
||||
MGTK_CALL MGTK::ShowCursor
|
||||
jsr display_buffer2
|
||||
rts
|
||||
|
@ -23,31 +23,10 @@ stash_stack: .byte $00
|
||||
filename:
|
||||
PASCAL_STRING "MD.SYSTEM"
|
||||
|
||||
.proc open_params
|
||||
params: .byte 3
|
||||
name: .addr filename
|
||||
buffer: .addr $0900
|
||||
ref_num:.byte 0
|
||||
.endproc
|
||||
|
||||
.proc set_mark_params
|
||||
params: .byte 2
|
||||
ref_num:.byte 0
|
||||
pos: .byte $03,$00,$00
|
||||
.endproc
|
||||
|
||||
.proc write_params
|
||||
params: .byte 4
|
||||
ref_num:.byte 0
|
||||
buffer: .addr write_buffer
|
||||
request:.word sizeof_write_buffer
|
||||
trans: .word 0
|
||||
.endproc
|
||||
|
||||
.proc close_params
|
||||
params: .byte 1
|
||||
ref_num:.byte 0
|
||||
.endproc
|
||||
DEFINE_OPEN_PARAMS open_params, filename, $900
|
||||
DEFINE_SET_MARK_PARAMS set_mark_params, 3
|
||||
DEFINE_WRITE_PARAMS write_params, write_buffer, sizeof_write_buffer
|
||||
DEFINE_CLOSE_PARAMS close_params
|
||||
|
||||
write_buffer:
|
||||
.byte 0,0
|
||||
|
@ -505,7 +505,7 @@ piece16:
|
||||
.byte px(%0000000),px(%0000000),px(%0000000),px(%0000000)
|
||||
|
||||
|
||||
.proc fill_rect_params
|
||||
.proc paintrect_params
|
||||
DEFINE_RECT 1, 0, default_width, default_height
|
||||
.endproc
|
||||
|
||||
@ -539,7 +539,7 @@ piece16:
|
||||
.byte $00
|
||||
|
||||
;; line across top of puzzle (bitmaps include bottom edges)
|
||||
.proc set_pos_params
|
||||
.proc moveto_params
|
||||
xcoord: .word 5
|
||||
ycoord: .word 2
|
||||
.endproc
|
||||
@ -977,10 +977,10 @@ after_click:
|
||||
|
||||
draw_window:
|
||||
MGTK_CALL MGTK::SetPattern, pattern_speckles
|
||||
MGTK_CALL MGTK::PaintRect, fill_rect_params
|
||||
MGTK_CALL MGTK::PaintRect, paintrect_params
|
||||
MGTK_CALL MGTK::SetPattern, pattern_black
|
||||
|
||||
MGTK_CALL MGTK::MoveTo, set_pos_params
|
||||
MGTK_CALL MGTK::MoveTo, moveto_params
|
||||
MGTK_CALL MGTK::Line, line_params
|
||||
|
||||
jsr draw_all
|
||||
|
@ -150,36 +150,15 @@ params_start:
|
||||
|
||||
;;; ProDOS MLI param blocks
|
||||
|
||||
.proc open_params
|
||||
.byte 3 ; param_count
|
||||
.addr pathname ; pathname
|
||||
.addr $0C00 ; io_buffer
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.endproc
|
||||
|
||||
.proc get_eof_params
|
||||
.byte 2 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
length: .byte 0,0,0 ; EOF (lo, mid, hi)
|
||||
.endproc
|
||||
|
||||
hires := $2000
|
||||
hires_size := $2000
|
||||
|
||||
.proc read_params
|
||||
.byte 4 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
buffer: .addr hires ; data_buffer
|
||||
request:.word hires_size ; request_count
|
||||
.word 0 ; trans_count
|
||||
.endproc
|
||||
DEFINE_OPEN_PARAMS open_params, pathbuff, $C00
|
||||
DEFINE_GET_EOF_PARAMS get_eof_params
|
||||
DEFINE_READ_PARAMS read_params, hires, hires_size
|
||||
DEFINE_CLOSE_PARAMS close_params
|
||||
|
||||
.proc close_params
|
||||
.byte 1 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.endproc
|
||||
|
||||
.proc pathname ; 1st byte is length, rest is full path
|
||||
.proc pathbuff ; 1st byte is length, rest is full path
|
||||
length: .byte $00
|
||||
data: .res 64, 0
|
||||
.endproc
|
||||
@ -264,14 +243,14 @@ nextwinfo: .addr 0
|
||||
|
||||
;; Check that an icon is selected
|
||||
lda #0
|
||||
sta pathname::length
|
||||
sta pathbuff::length
|
||||
lda selected_file_count
|
||||
beq abort ; some file properties?
|
||||
lda path_index ; prefix index in table
|
||||
bne :+
|
||||
abort: rts
|
||||
|
||||
;; Copy path (prefix) into pathname buffer.
|
||||
;; Copy path (prefix) into pathbuff buffer.
|
||||
: src := $06
|
||||
dst := $08
|
||||
|
||||
@ -284,14 +263,14 @@ abort: rts
|
||||
inc src
|
||||
bne :+
|
||||
inc src+1
|
||||
: copy16 #(pathname::data), dst
|
||||
jsr copy_pathname ; copy x bytes (src) to (dst)
|
||||
: copy16 #(pathbuff::data), dst
|
||||
jsr copy_pathbuff ; copy x bytes (src) to (dst)
|
||||
|
||||
;; Append separator.
|
||||
lda #'/'
|
||||
ldy #0
|
||||
sta (dst),y
|
||||
inc pathname::length
|
||||
inc pathbuff::length
|
||||
inc dst
|
||||
bne :+
|
||||
inc dst+1
|
||||
@ -324,16 +303,16 @@ abort: rts
|
||||
sta src
|
||||
bcc :+
|
||||
inc src+1
|
||||
: jsr copy_pathname ; copy x bytes (src) to (dst)
|
||||
: jsr copy_pathbuff ; copy x bytes (src) to (dst)
|
||||
|
||||
jmp open_file_and_init_window
|
||||
|
||||
.proc copy_pathname ; copy x bytes from src to dst
|
||||
.proc copy_pathbuff ; copy x bytes from src to dst
|
||||
ldy #0 ; incrementing path length and dst
|
||||
loop: lda (src),y
|
||||
sta (dst),y
|
||||
iny
|
||||
inc pathname::length
|
||||
inc pathbuff::length
|
||||
dex
|
||||
bne loop
|
||||
tya
|
||||
@ -401,11 +380,11 @@ exit:
|
||||
|
||||
;; If bigger than $2000, assume DHR
|
||||
|
||||
lda get_eof_params::length ; fancy 3-byte unsigned compare
|
||||
lda get_eof_params::eof ; fancy 3-byte unsigned compare
|
||||
cmp #<(hires_size+1)
|
||||
lda get_eof_params::length+1
|
||||
lda get_eof_params::eof+1
|
||||
sbc #>(hires_size+1)
|
||||
lda get_eof_params::length+2
|
||||
lda get_eof_params::eof+2
|
||||
sbc #^(hires_size+1)
|
||||
bcs dhr
|
||||
|
||||
|
@ -158,41 +158,16 @@ params_start:
|
||||
|
||||
;;; ProDOS MLI param blocks
|
||||
|
||||
.proc open_params
|
||||
.byte 3 ; param_count
|
||||
.addr pathname ; pathname
|
||||
.addr $0C00 ; io_buffer
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.endproc
|
||||
DEFINE_OPEN_PARAMS open_params, pathbuff, $C00
|
||||
|
||||
default_buffer := $1200
|
||||
|
||||
.proc read_params
|
||||
.byte 4 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
buffer: .addr default_buffer ; data_buffer
|
||||
.word $100 ; request_count
|
||||
.word 0 ; trans_count
|
||||
.endproc
|
||||
DEFINE_READ_PARAMS read_params, default_buffer, $100
|
||||
DEFINE_GET_EOF_PARAMS get_eof_params
|
||||
DEFINE_SET_MARK_PARAMS set_mark_params, 0
|
||||
DEFINE_CLOSE_PARAMS close_params
|
||||
|
||||
.proc get_eof_params
|
||||
.byte 2 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.byte 0,0,0 ; EOF (lo, mid, hi)
|
||||
.endproc
|
||||
|
||||
.proc set_mark_params
|
||||
.byte 2 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.faraddr 0 ; position (lo, mid, hi)
|
||||
.endproc
|
||||
|
||||
.proc close_params
|
||||
.byte 1 ; param_count
|
||||
ref_num:.byte 0 ; ref_num
|
||||
.endproc
|
||||
|
||||
.proc pathname ; 1st byte is length, rest is full path
|
||||
.proc pathbuff ; 1st byte is length, rest is full path
|
||||
length: .byte $00
|
||||
data: .res 64, $00
|
||||
.endproc
|
||||
@ -352,14 +327,14 @@ maprect: DEFINE_RECT 0, 0, default_width, default_height
|
||||
|
||||
;; Check that an icon is selected
|
||||
lda #0
|
||||
sta pathname::length
|
||||
sta pathbuff::length
|
||||
lda selected_file_count
|
||||
beq abort ; some file properties?
|
||||
lda path_index ; prefix index in table
|
||||
bne :+
|
||||
abort: rts
|
||||
|
||||
;; Copy path (prefix) into pathname buffer.
|
||||
;; Copy path (prefix) into pathbuff buffer.
|
||||
: src := $06
|
||||
dst := $08
|
||||
|
||||
@ -372,14 +347,14 @@ abort: rts
|
||||
inc src
|
||||
bne :+
|
||||
inc src+1
|
||||
: copy16 #(pathname::data), dst
|
||||
jsr copy_pathname ; copy x bytes (src) to (dst)
|
||||
: copy16 #(pathbuff::data), dst
|
||||
jsr copy_pathbuff ; copy x bytes (src) to (dst)
|
||||
|
||||
;; Append separator.
|
||||
lda #'/'
|
||||
ldy #0
|
||||
sta (dst),y
|
||||
inc pathname::length
|
||||
inc pathbuff::length
|
||||
inc dst
|
||||
bne :+
|
||||
inc dst+1
|
||||
@ -422,7 +397,7 @@ abort: rts
|
||||
sta src
|
||||
bcc :+
|
||||
inc src+1
|
||||
: jsr copy_pathname ; copy x bytes (src) to (dst)
|
||||
: jsr copy_pathbuff ; copy x bytes (src) to (dst)
|
||||
|
||||
;; Clear selection (why???)
|
||||
copy16 #JUMP_TABLE_CLEAR_SEL, call_main_addr
|
||||
@ -430,12 +405,12 @@ abort: rts
|
||||
|
||||
jmp open_file_and_init_window
|
||||
|
||||
.proc copy_pathname ; copy x bytes from src to dst
|
||||
.proc copy_pathbuff ; copy x bytes from src to dst
|
||||
ldy #0 ; incrementing path length and dst
|
||||
loop: lda (src),y
|
||||
sta (dst),y
|
||||
iny
|
||||
inc pathname::length
|
||||
inc pathbuff::length
|
||||
dex
|
||||
bne loop
|
||||
tya
|
||||
@ -944,10 +919,10 @@ end: rts
|
||||
jsr assign_fixed_font_width_table_if_needed
|
||||
jsr set_file_mark
|
||||
lda #<default_buffer
|
||||
sta read_params::buffer
|
||||
sta read_params::data_buffer
|
||||
sta $06
|
||||
lda #>default_buffer
|
||||
sta read_params::buffer+1
|
||||
sta read_params::data_buffer+1
|
||||
sta $07
|
||||
lda #0
|
||||
sta L0945
|
||||
@ -1173,17 +1148,17 @@ loop: lda $1300,y
|
||||
read: lda #0
|
||||
sta L0945
|
||||
jsr read_file_page
|
||||
lda read_params::buffer+1
|
||||
lda read_params::data_buffer+1
|
||||
cmp #>default_buffer
|
||||
bne :+
|
||||
inc read_params::buffer+1
|
||||
inc read_params::data_buffer+1
|
||||
: rts
|
||||
.endproc
|
||||
|
||||
;;; ==================================================
|
||||
|
||||
.proc read_file_page
|
||||
copy16 read_params::buffer, store+1
|
||||
copy16 read_params::data_buffer, store+1
|
||||
|
||||
lda #' ' ; fill buffer with spaces
|
||||
ldx #0
|
||||
@ -1203,7 +1178,7 @@ store: sta default_buffer,x ; self-modified
|
||||
sta DESTINATIONLO
|
||||
lda #$FF
|
||||
sta ENDLO
|
||||
lda read_params::buffer+1
|
||||
lda read_params::data_buffer+1
|
||||
sta DESTINATIONHI
|
||||
sta STARTHI
|
||||
sta ENDHI
|
||||
|
@ -337,6 +337,14 @@ eof: .faraddr eo
|
||||
.endproc
|
||||
.endmacro
|
||||
|
||||
.macro DEFINE_GET_EOF_PARAMS name
|
||||
.proc name
|
||||
param_count: .byte 2
|
||||
ref_num: .byte 0
|
||||
eof: .faraddr 0
|
||||
.endproc
|
||||
.endmacro
|
||||
|
||||
.macro DEFINE_RENAME_PARAMS name, pn, np
|
||||
.if .xmatch(.string(pn), "pathname")
|
||||
;; If 'pathname' is passed then expansion yields a circular reference.
|
||||
|
Loading…
Reference in New Issue
Block a user