# HG changeset patch # User aaronwolfe # Date 1267161886 0 # Node ID 597d98fc261e0ada4b35638c7cd5ce7813b83bc2 # Parent b4c438d60d714fb67060249f6b6d5fe70a46df39 RFM: never say die diff -r b4c438d60d71 -r 597d98fc261e level1/modules/rfm.asm --- a/level1/modules/rfm.asm Fri Feb 26 05:24:11 2010 +0000 +++ b/level1/modules/rfm.asm Fri Feb 26 05:24:46 2010 +0000 @@ -22,18 +22,9 @@ mod eom,RFMName,tylg,atrv,RFMEnt,size - rmb $0000 size equ . - org $0000 - -pathlen rmb 1 -pathnum rmb 1 -origu rmb 2 -xfersz rmb 2 -bufptr rmb 2 - RFMName fcs /RFM/ fcb edition @@ -61,35 +52,32 @@ lbra setstt Set Status lbra close Close path -create stu origu,pc - - * put path # on stack - lda ,y - sta pathnum,pc - pshs a - - * put rfm op on stack - ldb #DW.create +create ldb #DW.create bra create1 -open stu origu,pc +open ldb #DW.open +create1 pshs u,y ; RD Regs + + ldx PD.DEV,y ; to our static storage + pshs x ; PD.DEV PD Regs * put path # on stack lda ,y - sta pathnum,pc - pshs a + sta V.PATHNUM,x + pshs a ; p# PD.DEV PD Regs * put rfm op and DW op on stack - ldb #DW.open - -create1 lda #OP_VFM - pshs d + + lda #OP_VFM + pshs d ; DWOP RFMOP p# PD.DEV PD Regs + * TODO lets not create multiple buffers when multiple open/create on same path * get system mem - ldd #256 + ldd #256 os9 F$SRqMem ; ask for D bytes (# bytes server said is coming) - stu bufptr,pc ; store pointer to our memory + ldx 3,s ; PD.DEV + stu V.BUF,x leax ,s ; point X to stack ldy #3 ; 3 bytes to send @@ -101,60 +89,58 @@ endc jsr 6,u - leas 3,s ;clean stack + leas 3,s ;clean stack PD.DEV PD Regs * now send path string * copy path string - clr pathlen,pc + leas -1,s ; use stack for counter 0 PD.DEV PD Regs + clr ,s ; set size ctr to 0 ldx B - leas -1,s ;room for response byte - leax ,s + leax ,s ldy #1 jsr 3,u - * free system mem - ldd #256 - ldu bufptr,pc - os9 F$SRtMem - * pull server's response into B - puls b + puls b ; PD.DEV PD Regs tstb beq open2 orcc #1 ;set error -open2 ldu origu,pc +open2 leas 4,s ; Regs + puls u ; clean stack rts makdir lda #DW.makdir @@ -166,15 +152,7 @@ seek lda #DW.seek lbra sendit -read stu origu,pc - - * put path # on stack - lda ,y - sta pathnum,pc - pshs a - - * put rfm op on stack - ldb #DW.read +read ldb #DW.read bra read1 ; join readln routine @@ -184,17 +162,21 @@ -readln stu origu,pc ; store pointer to caller's register stack +readln ldb #DW.readln +read1 pshs y,u + + ldx PD.DEV,y ; to our static storage + pshs x ; PD.DEV PD Regs * put path # on stack lda ,y - sta pathnum,pc ;also store, not really needed (yet?) - pshs a + sta V.PATHNUM,x + pshs a ; p# PD.DEV PD Regs * put rfm op and DW op on stack - ldb #DW.readln -read1 lda #OP_VFM - pshs d + + lda #OP_VFM + pshs d ; DWOP RFMOP p# PD.DEV PD Regs leax ,s ; point X to stack ldy #3 ; 3 bytes to send @@ -208,10 +190,10 @@ * send dw op, rfm op, path # jsr 6,u - leas 3,s ;clean stack + leas 3,s ;clean stack - PD.DEV PD Regs * put caller's Y on stack (maximum allowed bytes) - ldx origu,pc + ldx 4,s ldx R$Y,x pshs x @@ -229,24 +211,20 @@ * store size clra - puls b - std xfersz,pc + puls b ;PD.DEV PD Regs + * check for 0 tstb beq readln1 ; 0 bytes = EOF * read the data from server if > 0 - - * get system mem - pshs u ; save U for later (ptr to dwsub) - os9 F$SRqMem ; ask for D bytes (# bytes server said is coming) - stu bufptr,pc ; store pointer to our memory - puls u ; get dwsub ptr back into U - + pshs d ;xfersz PD.DEV PD Regs + * load data from server into mem block - ldx bufptr,pc - ldy xfersz,pc + ldx 2,s ; pd.dev + ldx V.BUF,x + ldy ,s ;xfersz jsr 3,u * F$Move @@ -258,9 +236,9 @@ * move from our mem to caller - ldy xfersz,pc ;Y = byte count (already set?) + puls y ;Y = byte count (already set?) - PD.DEV PD Regs - ldx origu,pc + ldx 4,s ldu R$X,x ; U = caller's X = dest ptr lda