Mercurial > hg > Members > kono > nitros9-code
changeset 2436:ca3aa5472761
RFM can simulate open,readln,close
author | aaronwolfe |
---|---|
date | Tue, 23 Feb 2010 17:07:06 +0000 |
parents | f3f09398780b |
children | d26e96c40194 |
files | level1/modules/rfm.asm level1/modules/rfmdrv.asm |
diffstat | 2 files changed, 189 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- 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 + else + ldu >D.DWSubAddr + endc + + jsr 6,u + leas 3,s ;clean stack + + * now send path string + + * copy path string + + ldx <D.Proc get curr proc desc + ldb P$Task,x get task # + + ldx ,s ; orig U is on stack + ldx R$X,x ; should be X from caller + leay pathtmp,pcr + + clra + pshs a + +open1 os9 f$ldabx + sta ,y+ + leax 1,x + inc ,s + cmpa #$0D + bne open1 + + * send to server + clra + ldb ,s ; leave a byte on stack for response + tfr d,y + leax pathtmp,pcr + jsr 6,u + + * read response from server -> 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 + else + 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 + else + 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 <D.DWSubAddr else @@ -122,9 +244,34 @@ puls x ldy #107 jsr 6,u - - - + + + * copy path string + + ldx <D.Proc get curr proc desc + ldb P$Task,x get task # + + ldx ,s + ldx R$X,x ; should be X from caller + leay pathtmp,pcr + + clra + pshs a + +send1 os9 f$ldabx + sta ,y+ + leax 1,x + inc ,s + cmpa #$0D + bne send1 + + * send to server + clra + puls b + tfr d,y + leax pathtmp,pcr + jsr 6,u + puls u clrb rts