include 'gsos.equ' include 'minix.equ' include 'fst.equ' include 'fst.macros' ; ; routines used to store data in parameter blocks ; ; input: ; x - must be preserved. ; y - offset in param_blk_ptr to store the value. ; ; outputs: ; x - must be preserved. ; set tool_error if error. ; do_ignore proc export rts endp do_file_sys_id proc export with dp with fst_parms lda #fst_id sta [param_blk_ptr],y rts endp ; assumes disk_inode is valid. do_storage_type proc export 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 ; assume disk_inode is valid. do_file_type proc export 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 export with dp,fst_parms lda #0 sta [param_blk_ptr],y rts endp ; assumes disk_inode is valid. do_eof proc export 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 ; file blocks, not disk blocks. do_blocks proc export 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 export with dp,fst_parms export 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 export 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 export with fst_parms ; todo ... export 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 export with fst_parms ; todo ... export 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 ; ; fcr-based items. ; do_refnum proc export with fst_parms, dp lda [