mirror of
https://github.com/ksherlock/minix.fst.git
synced 2024-12-08 06:49:17 +00:00
set mark
This commit is contained in:
parent
cf591b2d73
commit
f4881d056a
3
Makefile
3
Makefile
@ -1,7 +1,8 @@
|
||||
|
||||
|
||||
SOURCES = main.aii volume.aii get_file_info.aii \
|
||||
open.aii get_dir_entry.aii get_mark.aii get_eof.aii close.aii \
|
||||
open.aii get_dir_entry.aii get_mark.aii set_mark.aii get_eof.aii \
|
||||
close.aii \
|
||||
id_disk.aii stubs.aii tables.aii device.aii params.aii data.aii
|
||||
|
||||
OBJECTS=$(SOURCES:.aii=.o)
|
||||
|
28
records.equ
28
records.equ
@ -201,4 +201,30 @@ eof DS.L 1
|
||||
EOFRec begin_struct
|
||||
eofRefNum DS.B 2
|
||||
eofPosition DS.B 4
|
||||
end_struct
|
||||
end_struct
|
||||
|
||||
IORecGS begin_struct
|
||||
pCount DS.W 1
|
||||
refNum DS.W 1
|
||||
dataBuffer DS.L 1 ; Pointer
|
||||
requestCount DS.L 1
|
||||
transferCount DS.L 1
|
||||
cachePriority DS.W 1
|
||||
end_struct
|
||||
|
||||
FileIORec begin_struct
|
||||
fileRefNum DS.B 2
|
||||
dataBuffer DS.B 4
|
||||
requestCount DS.B 4
|
||||
transferCount DS.B 4
|
||||
end_struct
|
||||
|
||||
|
||||
SetPositionRecGS begin_struct
|
||||
pCount DS.W 1
|
||||
refNum DS.W 1
|
||||
base DS.W 1
|
||||
displacement DS.L 1
|
||||
end_struct
|
||||
|
||||
|
||||
|
165
set_mark.aii
Normal file
165
set_mark.aii
Normal file
@ -0,0 +1,165 @@
|
||||
|
||||
string asis
|
||||
|
||||
include 'gsos.equ'
|
||||
include 'minix.equ'
|
||||
include 'fst.equ'
|
||||
|
||||
include 'fst.macros'
|
||||
|
||||
include 'M16.Debug'
|
||||
|
||||
include 'records.equ'
|
||||
|
||||
my_dp record dp.__end
|
||||
|
||||
displacement ds.w 1
|
||||
omark ds.l 1
|
||||
mark ds.l 1
|
||||
|
||||
IF *>=$d4 THEN
|
||||
AERROR 'dp -- too large.'
|
||||
ENDIF
|
||||
endr
|
||||
|
||||
import init_fcr
|
||||
|
||||
set_mark procname export
|
||||
|
||||
with dp, my_dp, fst_parms
|
||||
|
||||
jsr init_fcr
|
||||
|
||||
|
||||
ldy #fcr.mark
|
||||
lda [my_fcr],y
|
||||
sta mark
|
||||
sta omark
|
||||
|
||||
iny
|
||||
iny
|
||||
lda [my_fcr],y
|
||||
sta mark+2
|
||||
sta omark+2
|
||||
|
||||
lda call_class
|
||||
bne class1
|
||||
|
||||
; class 0 - { uint16_t refNum; uint32_t offset }
|
||||
class0
|
||||
ldy #MarkRec.position
|
||||
lda [param_blk_ptr],y
|
||||
sta mark
|
||||
iny
|
||||
iny
|
||||
lda [param_blk_ptr],y
|
||||
sta mark+2
|
||||
brl check
|
||||
|
||||
class1
|
||||
|
||||
ldy #SetPositionRecGS.displacement
|
||||
lda [param_blk_ptr],y
|
||||
sta displacement
|
||||
iny
|
||||
iny
|
||||
lda [param_blk_ptr],y
|
||||
sta displacement+2
|
||||
|
||||
ldy #SetPositionRecGS.base
|
||||
lda [param_blk_ptr],y
|
||||
cmp #3+1
|
||||
bcs pre
|
||||
asl a ; x 2
|
||||
jmp (table,x)
|
||||
|
||||
table
|
||||
dc.w absolute,eof_minus,mark_plus,mark_minus
|
||||
|
||||
pre
|
||||
lda #parm_range_err
|
||||
sec
|
||||
rtl
|
||||
|
||||
absolute
|
||||
; mark = displacement
|
||||
lda displacement
|
||||
sta mark
|
||||
lda displacement+2
|
||||
sta mark
|
||||
bra check
|
||||
eof_minus
|
||||
; mark = eof - displacement
|
||||
lda disk_inode.size
|
||||
sec
|
||||
sbc displacement
|
||||
sta mark
|
||||
lda disk_inode.size+2
|
||||
sbc displacement+2
|
||||
sta mark+2
|
||||
bra check
|
||||
mark_plus
|
||||
; mark = mark + displacement
|
||||
lda mark
|
||||
clc
|
||||
adc displacement
|
||||
sta mark
|
||||
lda mark+2
|
||||
adc displacement+2
|
||||
sta mark+2
|
||||
bra check
|
||||
mark_minus
|
||||
; mark = mark - displacement
|
||||
|
||||
lda mark
|
||||
sec
|
||||
sbc displacement
|
||||
sta mark
|
||||
lda mark+2
|
||||
sbc displacement+2
|
||||
sta mark+2
|
||||
|
||||
check
|
||||
; negative mark?
|
||||
lda mark+2
|
||||
bmi oor
|
||||
|
||||
; mark > eof ?
|
||||
;lda mark+2
|
||||
cmp disk_inode.size+2
|
||||
beq @lw
|
||||
bcc update
|
||||
bra oor
|
||||
|
||||
@lw
|
||||
; check the low-word
|
||||
lda mark
|
||||
cmp disk_inode.size
|
||||
beq update
|
||||
bcc update
|
||||
|
||||
oor
|
||||
lda #out_of_range
|
||||
sec
|
||||
rtl
|
||||
|
||||
update
|
||||
|
||||
ldy #fcr.mark
|
||||
lda mark
|
||||
sta [my_fcr],y
|
||||
iny
|
||||
iny
|
||||
lda mark+2
|
||||
sta [my_fcr],y
|
||||
|
||||
; in the future...update data_zone, data_block
|
||||
; if mark was moved to a different block.
|
||||
|
||||
lda #0
|
||||
clc
|
||||
rtl
|
||||
|
||||
endp
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user