# HG changeset patch # User aaronwolfe # Date 1266944826 0 # Node ID ca3aa5472761105a2502a436f7546944ee5d3b2b # Parent f3f09398780b9495d65b81033d4e2e0f207d327d RFM can simulate open,readln,close diff -r f3f09398780b -r ca3aa5472761 level1/modules/rfm.asm --- a/level1/modules/rfm.asm Sun Feb 21 06:25:53 2010 +0000 +++ b/level1/modules/rfm.asm Tue Feb 23 17:07:06 2010 +0000 @@ -19,8 +19,11 @@ rev set 0 edition equ 1 - mod eom,RFMName,tylg,atrv,RFMEnt,0 + mod eom,RFMName,tylg,atrv,RFMEnt,size +pathtmp rmb 256 +size equ * + RFMName fcs /RFM/ fcb edition @@ -50,8 +53,66 @@ create lda #DW.create lbra sendit -open lda #DW.open - lbra sendit + +open pshs u + + * put path # on stack + lda ,y + pshs a + + * put rfm op and DW op on stack + ldb #DW.open + lda #OP_VFM + pshs d + + leax ,s ; point X to stack + ldy #3 ; 3 bytes to send + ifgt Level-1 + ldu D.DWSubAddr + endc + + jsr 6,u + leas 3,s ;clean stack + + * now send path string + + * copy path string + + ldx B + leax ,s + ldy #1 + jsr 3,u + puls b + + puls u + rts + makdir lda #DW.makdir lbra sendit chgdir lda #DW.chgdir @@ -64,52 +125,113 @@ lbra sendit write lda #DW.write lbra sendit -readln lda #DW.readln - lbra sendit + +readln pshs u + + * put path # on stack + lda ,y + pshs a + + * put rfm op and DW op on stack + ldb #DW.readln + lda #OP_VFM + pshs d + + leax ,s ; point X to stack + ldy #3 ; 3 bytes to send + ifgt Level-1 + ldu D.DWSubAddr + endc + + jsr 6,u + leas 3,s ;clean stack + + * send max bytes + ldx ,s + ldx R$Y,x + pshs x + leax ,s + ldy #2 + jsr 6,u + + leas 1,s + + * read # bytes (0 = eof) + leax ,s + ldy #1 + jsr 3,u + + puls b + bne readln1 + + * eof + ldb #211 + orcc #1 + puls u + rts + + * read B chars into mem at addr in caller's X + * first into our buffer INCOMPLETE/FUBAR +readln1 pshs b + leax pathtmp,pcr + clra + tfr d,y + jsr 3,u + + puls u ; done with dwsub + + + + clrb + rts + + writln lda #DW.writln lbra sendit getstt lda #DW.getstt lbra sendit setstt lda #DW.setstt lbra sendit -close lda #DW.close - lbra sendit - + +close pshs u + + * put path # on stack + lda ,y + pshs a + + * put rfm op and DW op on stack + ldb #DW.close + lda #OP_VFM + pshs d + + leax ,s ; point X to stack + ldy #3 ; 3 bytes to send + ifgt Level-1 + ldu D.DWSubAddr + endc + + jsr 6,u + leas 3,s ;clean stack + + clrb + puls u + rts + + * just send OP_VMF + vfmop sendit pshs u pshs y pshs a - - * put diag info in PD.FST - leay PD.FST,y - - stu ,y++ ; U from IOman - - ldx R$X,u ; should be X from caller - stx ,y++ - - ldx 1,s ; Y from ioman - stx ,y++ - - ldx R$X+PD.RGS,x ; should be X from caller - stx ,y++ - - * 10 bytes from X? - clrb -sleep1 lda ,x+ - sta ,y+ - incb - cmpb #10 - bne sleep1 - - - - lda #OP_VFM ; load command - pshs a ; command store on stack - leax ,s ; point X to stack - ldy #2 ; 2 byte to send + lda #OP_VFM ; load command + pshs a ; command store on stack + leax ,s ; point X to stack + ldy #2 ; 2 byte to send ifgt Level-1 ldu