macros for ProDOS MLI params

This commit is contained in:
Joshua Bell 2018-02-25 20:28:23 -08:00
parent aa8e79e944
commit 5cc74da7ec
7 changed files with 175 additions and 198 deletions

View File

@ -33,13 +33,7 @@ loop: lda src,y
MLI_CALL QUIT, quit_params
.proc quit_params
params: .byte 4
.byte 0
.word 0
.byte 0
.word 0
.endproc
DEFINE_QUIT_PARAMS quit_params
.endproc ; install_as_quit
;;; ==================================================
@ -60,34 +54,13 @@ reinstall_flag: ; set once prefix saved and reinstalled
splash_string:
PASCAL_STRING "Loading Apple II DeskTop"
pathname:
filename:
PASCAL_STRING "DeskTop2"
.proc read_params
params: .byte 4
ref_num:.byte 0
buffer: .addr $1E00 ; so the $200 byte mark ends up at $2000
request:.word $0400
trans: .word 0
.endproc
.proc close_params
params: .byte 1
ref_num:.byte 0 ; close all
.endproc
.proc prefix_params
params: .byte 1
buffer: .addr prefix_buffer
.endproc
.proc open_params
params: .byte 3
path: .addr pathname
buffer: .addr $1A00
ref_num:.byte 0
.endproc
DEFINE_READ_PARAMS read_params, $1E00, $400 ; so the $200 byte mark ends up at $2000
DEFINE_CLOSE_PARAMS close_params
DEFINE_SET_PREFIX_PARAMS prefix_params, prefix_buffer
DEFINE_OPEN_PARAMS open_params, filename, $1A00
start: lda ROMIN2
@ -248,33 +221,14 @@ prefix_buffer:
jmp start
.proc open_params
params: .byte 3
path: .addr pathname
buffer: .addr $3000
ref_num:.byte 0
.endproc
DEFINE_OPEN_PARAMS open_params, filename, $3000
.proc read_params
params: .byte 4
ref_num:.byte 0
buffer: .addr 0
request:.word 0
trans: .word 0
.endproc
DEFINE_READ_PARAMS read_params, 0, 0
.proc close_params
params: .byte 1
ref_num:.byte 0
.endproc
DEFINE_CLOSE_PARAMS close_params
DEFINE_SET_MARK_PARAMS set_mark_params, $580 ; This many bytes before the good stuff.
.proc set_mark_params
params: .byte 2
ref_num:.byte 0
pos: .faraddr $580 ; This many bytes before the good stuff.
.endproc
pathname:
filename:
PASCAL_STRING "DeskTop2"
;;; Consecutive segments are loaded, |size| bytes are loaded at |addr|
@ -349,8 +303,8 @@ loop: lda segment_num
continue:
asl a
tax
copy16 segment_addr_table,x, read_params::buffer
copy16 segment_size_table,x, read_params::request
copy16 segment_addr_table,x, read_params::data_buffer
copy16 segment_size_table,x, read_params::request_count
php
sei
MLI_CALL READ, read_params
@ -394,7 +348,7 @@ segment_num: .byte 0
tax
lda segment_dest_table+1,x
sta dst+1
lda read_params::buffer+1
lda read_params::data_buffer+1
sta src+1
clc
adc segment_size_table+1,x
@ -435,7 +389,7 @@ max_page:
tax
lda segment_dest_table+1,x
sta dst+1
lda read_params::buffer+1
lda read_params::data_buffer+1
sta src+1
clc
adc segment_size_table+1,x

View File

@ -4252,16 +4252,8 @@ L6454: jsr L653F
MGTK_CALL MGTK::PaintRect, fill_rect_params
jmp L6556
.proc alloc_interrupt_params
count: .byte 2
int_num:.byte 0
code: .addr interrupt_handler
.endproc
.proc dealloc_interrupt_params
count: .byte 1
int_num:.byte 0
.endproc
DEFINE_ALLOC_INTERRUPT_PARAMS alloc_interrupt_params, interrupt_handler
DEFINE_DEALLOC_INTERRUPT_PARAMS dealloc_interrupt_params
L646F:
lda #$00

View File

@ -39,31 +39,10 @@ item_label:
;;; ==================================================
.proc open_params
param_count: .byte 3
pathname: .addr str_desktop2
io_buffer: .addr $1C00
ref_num: .byte 0
.endproc
.proc set_mark_params
param_count: .byte 2
ref_num: .byte 0
position: .faraddr $131E0
.endproc
.proc read_params
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr load_target
request_count: .word $0200
trans_count: .word 0
.endproc
.proc close_params
param_count: .byte 1
ref_num: .byte 0
.endproc
DEFINE_OPEN_PARAMS open_params, str_desktop2, $1C00
DEFINE_SET_MARK_PARAMS set_mark_params, $131E0
DEFINE_READ_PARAMS read_params, load_target, $200
DEFINE_CLOSE_PARAMS close_params
str_desktop2:
PASCAL_STRING "DeskTop2"

View File

@ -31,32 +31,12 @@ LAB37 := $AB37
;;; ==================================================
.proc open_params
param_count: .byte 3
pathname: .addr filename
io_buffer: .addr $1C00
ref_num: .byte 0
.endproc
DEFINE_OPEN_PARAMS open_params, filename, $1C00
filename: PASCAL_STRING "DeskTop2"
.proc read_params
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr 0
request_count: .word 0
trans_count: .word 0
.endproc
.proc set_mark_params
param_count: .byte 2
ref_num: .byte 0
position: .faraddr $133E0
.endproc
.proc close_params
param_count: .byte 1
ref_num: .byte 0
.endproc
DEFINE_READ_PARAMS read_params, 0, 0
DEFINE_SET_MARK_PARAMS set_mark_params, $133E0
DEFINE_CLOSE_PARAMS close_params
.byte $00,$00

View File

@ -1066,26 +1066,9 @@ L1239: .byte $00
;;; ==================================================
.proc on_line_params
param_count: .byte 2
unit_num: .byte 0
data_buffer: .addr $1C00
.endproc
.proc read_block_params
param_count: .byte 3
unit_num: .byte 0
data_buffer: .addr $1C00
block_num: .word 0
.endproc
.proc write_block_params
param_count: .byte 3
unit_num: .byte 0
data_buffer: .addr prodos_loader_blocks
block_num: .word 0
.endproc
DEFINE_ON_LINE_PARAMS on_line_params, $1C00
DEFINE_READ_BLOCK_PARAMS read_block_params, $1C00, 0
DEFINE_WRITE_BLOCK_PARAMS write_block_params, prodos_loader_blocks, 0
L124A: .byte $00

View File

@ -1271,25 +1271,9 @@ L9C09: sta $D2AC
yax_call launch_dialog, $0C, $D2AC
rts
.proc open_params
param_count: .byte 3
pathname: .addr $1C00
io_buffer: .addr $800
ref_num: .byte 0
.endproc
.proc write_params
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr $C00
request_count: .word $800
trans_count: .word 0
.endproc
.proc flush_close_params
param_count: .byte 1
ref_num: .byte 0
.endproc
DEFINE_OPEN_PARAMS open_params, $1C00, $800
DEFINE_WRITE_PARAMS write_params, $C00, $800
DEFINE_CLOSE_PARAMS flush_close_params
L9C26: addr_call L9E2A, $1C00
inc $1C00
@ -1328,35 +1312,13 @@ L9C81: yax_call MLI_RELAY, FLUSH, flush_close_params
yax_call MLI_RELAY, CLOSE, flush_close_params
rts
.proc open_params2
param_count: .byte 3
pathname: .addr $9C9A
io_buffer: .addr $800
ref_num: .byte 0
.endproc
DEFINE_OPEN_PARAMS open_params2, $9C9A, $800
L9C9A: PASCAL_STRING "Selector.List"
.proc read_params2
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr $C00
request_count: .word $800
trans_count: .word 0
.endproc
.proc write_params2
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr $C00
request_count: .word $800
trans_count: .word 0
.endproc
.proc close_params2
param_count: .byte 1
ref_num: .byte 0
.endproc
DEFINE_READ_PARAMS read_params2, $C00, $800
DEFINE_WRITE_PARAMS write_params2, $C00, $800
DEFINE_CLOSE_PARAMS close_params2
L9CBA: yax_call MLI_RELAY, OPEN, open_params2
beq L9CCF
@ -1541,19 +1503,7 @@ L9E40: .addr $1234
lda LCBANK1
rts
.proc get_file_info_params
param_count: .byte $A
pathname: .addr 0
access: .byte 0
file_type: .byte 0
aux_type: .word 0
storage_type: .byte 0
blocks_used: .word 0
mod_date: .word 0
mod_time: .word 0
create_date: .word 0
create_time: .word 0
.endproc
DEFINE_GET_FILE_INFO_PARAMS get_file_info_params
L9E61: jsr L9E74
stax get_file_info_params::pathname

View File

@ -115,3 +115,142 @@ end:
.res res - (end - data), 0
.endif
.endmacro
.macro DEFINE_OPEN_PARAMS name, pn, io
.if .xmatch(.string(pn), "pathname")
;; If 'pathname' is passed then expansion yields a circular reference.
.error "Can't pass 'pathname' label to DEFINE_*_PARAMS"
.endif
.proc name
param_count: .byte 3
pathname: .addr pn
io_buffer: .addr io
ref_num: .byte 0
.endproc
.endmacro
.macro DEFINE_READ_PARAMS name, db, rc
.proc name
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr db
request_count: .word rc
trans_count: .word 0
.endproc
.endmacro
.macro DEFINE_WRITE_PARAMS name, db, rc
.proc name
param_count: .byte 4
ref_num: .byte 0
data_buffer: .addr db
request_count: .word rc
trans_count: .word 0
.endproc
.endmacro
.macro DEFINE_CLOSE_PARAMS name
.proc name
param_count: .byte 1
ref_num: .byte 0
.endproc
.endmacro
.macro DEFINE_FLUSH_PARAMS name
.proc name
param_count: .byte 1
ref_num: .byte 0
.endproc
.endmacro
.macro DEFINE_GET_FILE_INFO_PARAMS name
.if .xmatch(.string(pn), "pathname")
;; If 'pathname' is passed then expansion yields a circular reference.
.error "Can't pass 'pathname' label to DEFINE_*_PARAMS"
.endif
.proc name
param_count: .byte $A
pathname: .addr 0
access: .byte 0
file_type: .byte 0
aux_type: .word 0
storage_type: .byte 0
blocks_used: .word 0
mod_date: .word 0
mod_time: .word 0
create_date: .word 0
create_time: .word 0
.endproc
.endmacro
.macro DEFINE_SET_MARK_PARAMS name, pos
.proc name
param_count: .byte 2
ref_num: .byte 0
position: .faraddr pos
.endproc
.endmacro
.macro DEFINE_ON_LINE_PARAMS name, db
.proc name
param_count: .byte 2
unit_num: .byte 0
data_buffer: .addr db
.endproc
.endmacro
.macro DEFINE_READ_BLOCK_PARAMS name, db, bn
.proc name
param_count: .byte 3
unit_num: .byte 0
data_buffer: .addr db
block_num: .word bn
.endproc
.endmacro
.macro DEFINE_WRITE_BLOCK_PARAMS name, db, bn
.proc name
param_count: .byte 3
unit_num: .byte 0
data_buffer: .addr db
block_num: .word bn
.endproc
.endmacro
.macro DEFINE_ALLOC_INTERRUPT_PARAMS name, ic
.proc alloc_interrupt_params
param_count: .byte 2
int_num: .byte 0
int_code: .addr ic
.endproc
.endmacro
.macro DEFINE_DEALLOC_INTERRUPT_PARAMS name
.proc dealloc_interrupt_params
param_count: .byte 1
int_num: .byte 0
.endproc
.endmacro
.macro DEFINE_QUIT_PARAMS name
.proc name
param_count: .byte 4
.byte 0
.word 0
.byte 0
.word 0
.endproc
.endmacro
.macro DEFINE_SET_PREFIX_PARAMS name, pn
.if .xmatch(.string(pn), "pathname")
;; If 'pathname' is passed then expansion yields a circular reference.
.error "Can't pass 'pathname' label to DEFINE_*_PARAMS"
.endif
.proc prefix_params
param_count: .byte 1
pathname: .addr pn
.endproc
.endmacro