From f2eef6ce01f912d2c789dca078b224bad9a7ea9f Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Wed, 12 Aug 2015 13:31:31 -0400 Subject: [PATCH] move common code around, more open stuff --- Makefile | 2 +- get_file_info.aii | 283 -------------------------------------- open.aii | 48 +++++-- params.aii | 341 ++++++++++++++++++++++++++++++++++++++++++++++ volume.aii | 18 +-- 5 files changed, 385 insertions(+), 307 deletions(-) create mode 100644 params.aii diff --git a/Makefile b/Makefile index a9c456f..d7357c1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SOURCES = main.aii volume.aii get_file_info.aii \ open.aii \ - id_disk.aii stubs.aii tables.aii device.aii + id_disk.aii stubs.aii tables.aii device.aii params.aii OBJECTS=$(SOURCES:.aii=.o) diff --git a/get_file_info.aii b/get_file_info.aii index b30e3cc..7476539 100644 --- a/get_file_info.aii +++ b/get_file_info.aii @@ -171,290 +171,7 @@ do_access proc rts endp -do_storage_type proc - with dp,fst_parms - lda disk_inode.mode - ; check for directory. GS/OS doesn't have concepts for other types (yet). - - phx ; save - and #S_IFMT ; $f000 - xba - lsr a - lsr a - lsr a - tax - jsr (table,x) - -table - dc.w unknown - dc.w fifo - dc.w chr - dc.w unknown - dc.w dir - dc.w unknown - dc.w blk - dc.w unknown - dc.w reg - dc.w unknown - dc.w lnk - dc.w unknown - dc.w sock - dc.w unknown - dc.w wht - dc.w unknown - -unknown - lda #0 - bra store -fifo: -chr: -blk: -lnk: -sock: -wht: - lda disk_inode.mode - and #S_IFMT - bra store - -dir - lda #$0d - bra store - -reg - lda #1 ; could base it on size but whatever! - ; drop through - -store - plx ; restore - sta [param_blk_ptr],y - rts - - endp - -do_file_type proc - - with dp,fst_parms - - lda disk_inode.mode - and #S_IFMT - cmp #S_IFDIR - beq dir - cmp #S_IFREG - beq reg - -unknown - lda #$00 - bra store - -dir - lda #$0f - bra store - -reg - lda #$06 ; binary - bra store - -store - sta [param_blk_ptr],y - rts - - - - endp - -do_aux_type proc - with dp,fst_parms - - lda #0 - sta [param_blk_ptr],y - rts - - endp - -do_eof proc - with dp,fst_parms - - lda disk_inode.size - sta [param_blk_ptr],y - - iny - iny - lda disk_inode.size+2 - sta [param_blk_ptr],y - rts - - endp - -do_blocks proc - with dp,fst_parms - with v1 - - ; not sure if minix supports sparse blocks. could just estimate - ; based on file size. - - phx ; save - phy ; save - - ; 7 direct blocks, 1 indirect block, 1 double indirect block. - ldx #0 - ldy #0 ; count -@loop - lda disk_inode.zone,x - beq @next - iny -@next - inx - inx - cpx #NR_DZONES*2 - bcc @loop - - ; y is number of direct blocks. - - ; check for indirect block... - lda disk_inode.zone + NR_DZONES * 2 - beq dib - -; -; count up indirect blocks... -; - iny - -dib - ; check for double indirect block - lda disk_inode.zone + (NR_DZONES + 1) * 2 - beq store -; -; count up double indirect blocks.... -; - - iny - -store - tya - ply - sta [param_blk_ptr],y - iny - iny - lda #0 - sta [param_blk_ptr],y - - plx ; restore - rts - endp - - -do_r_eof proc - with dp,fst_parms - - entry do_r_blocks -do_r_blocks - lda #0 - sta [param_blk_ptr],y - iny - iny - sta [param_blk_ptr],y - rts - endp - - -do_option_list proc - with dp,fst_parms - - ; if the option list is present, store my fst id. - - lda [param_blk_ptr],y - sta ptr - iny - iny - lda [param_blk_ptr],y - sta ptr+2 - - ora ptr - beq exit - - ; check if the option list ptr is large enough. - lda [ptr] - cmp #4 - bcc pre - - ; store the size of the option list. - ldy #2 - lda #2 - sta [ptr],y - - - lda [ptr] - cmp #6 - bcc bts - bra ok - - ; less than 4 is a parm range error. - ; less than the necessary option list size is a buf_too_small error. (but store the space required) - - -pre - lda #parm_range_err - sta tool_error - bra exit - -bts - - lda #buff_too_small - sta tool_error - bra exit - -ok - ldy #4 - lda #fst_id - sta [ptr],y - - -exit - rts - endp - - -do_create_date_time_0 proc - with fst_parms - - ; todo ... - - entry do_mod_date_time_0 -do_mod_date_time_0 - - lda #0 - sta [param_blk_ptr],y - iny - iny - sta [param_blk_ptr],y - - rts - endp - - -do_create_date_time proc - with fst_parms - - ; todo ... - - entry do_mod_date_time -do_mod_date_time - - lda #0 - sta [param_blk_ptr],y - iny - iny - sta [param_blk_ptr],y - iny - iny - sta [param_blk_ptr],y - iny - iny - sta [param_blk_ptr],y - - rts - endp path_to_inode proc diff --git a/open.aii b/open.aii index 47b21ee..493b42b 100644 --- a/open.aii +++ b/open.aii @@ -11,9 +11,29 @@ include 'records.equ' + import do_ignore + import do_refnum + import do_file_type + import do_aux_type + import do_storage_type + import do_option_list + import do_eof + import do_blocks + import do_r_eof + import do_r_blocks + import do_create_date_time + import do_mod_date_time + + entry do_fcr_access + entry check_resource + entry check_access + entry build_fcr + open procname export with fst_parms + with dev_parms + with dp ; find the inode... @@ -66,7 +86,7 @@ open_dcb_1 dc.w $04, do_ignore ; path dc.w $08, do_ignore ; request access dc.w $0a, do_ignore ; resource resourceNumber - dc.w $0c, do_access ; actual access + dc.w $0c, do_fcr_access ; actual access dc.w $0e, do_file_type dc.w $10, do_aux_type dc.w $14, do_storage_type @@ -83,7 +103,8 @@ open_dcb_1 build_fcr proc - + with dp + ; build filename string... lda #fcr.sizeof ldx #0 @@ -100,7 +121,7 @@ build_fcr proc ldy #vcr.open_count lda [my_vcr],y - inc + inc a sta [my_vcr],y lda #read_access @@ -133,8 +154,8 @@ build_fcr proc ; copy the disk inode - ldx #v1_inode.sizeof-2 - ldy #vcr.disk_inode + v1_inode.sizeof - 2 + ldx #disk_inode.sizeof-2 + ldy #fcr.disk_inode + fcr.disk_inode.sizeof - 2 ; is sizeof updated? @loop lda disk_inode,x @@ -154,7 +175,7 @@ check_resource procname ; verify the resourceNumber is ok ; sets a/carry on error. - with fstparms, dp + with fst_parms, dp lda