This example describes how to call CD, MKDIR and RM commands
;-------------------------------------- ; open 1,12,15,"x:name" : close 1 ;-------------------------------------- *= $1000 setnam = $ffbd setlfs = $ffba close = $ffc3 open = $ffc0 ldx #12 ;HDD ldy #15 ;command canal lda #1 jsr setlfs lda #endname-inputname ldx #<inputname ldy #>inputname jsr setnam jsr open lda #1 jsr close rts ;-------------------------------------- ; inputname .text "S:TESTFILE" ; endname = * ;Delete ; inputname .text "M:TESTDIR" ; endname = * ;Mkdir ; inputname .text "I:" ; endname = * ;Hdinit1 (IDE64 DOS V0.64 or higher) inputname .text "C:/TMP" endname = * ;Cd ;--------------------------------------
This example describes how to read and print a directory in standard form
*= $1000 ;KERNAL setlfs = $ffba setnam = $ffbd open = $ffc0 close = $ffc3 chkin = $ffc6 chkout = $ffc9 clrchn = $ffcc chrin = $ffcf ;chrout = $ffd2 chrout = $e716 ;chrout to screen clall = $ffe7 ;------------------------------ ; print DIR ;------------------------------ lda #1 ldx #<namebuff ldy #>namebuff jsr setnam lda #1 ldx $ba ldy #0 jsr setlfs jsr open ldx #$01 jsr chkin jsr chrin ;startaddress jsr chrin ;$0401 main_loop = * jsr chrin ;next basic line jsr chrin ; - "" - jsr chrin ;line number - number of blocks tax jsr chrin ldy $90 bne dir_end jsr $bdcd ;Print # to ASCII lda #$20 jsr chrout ;space jsr chrin small_loop = * ldy $90 bne dir_end jsr chrout jsr chrin cmp #0 bne small_loop lda #$0d jsr chrout bne main_loop dir_end = * lda #1 jsr close jsr clall clc rts namebuff .text "$"
This example describes how to use fast READ/WRITE calls for copying files
("INPUT-FILE" in "BIN" directory, to "OUTPUT-FILE" in "TMP" directory)
*=$1000 setnam = $ffbd setlfs = $ffba chkin = $ffc6 chkout = $ffc9 clall = $ffe7 close = $ffc3 open = $ffc0 read = $def4 write = $def1 ;-------------------------------------- ; Buffer from $2000 to $5fff ; StartAdd = $20 BlockSize = $40 ;-------------------------------------- lda #1 ldx #12 ;HDD ldy #0 ;Secondary address for read jsr setlfs lda #outputname-inputname ldx #<inputname ldy #>inputname jsr setnam lda #$01 jsr open ;Open input file lda #2 ldx #12 ;HDD ldy #1 ;Secondary address for write jsr setlfs lda #status-outputname ldx #<outputname ldy #>outputname jsr setnam lda #$02 jsr open ;Open output file lda #$00 sta $fb lda #StartAdd ;Buffer start address sta $fc loop_copy = * ldx #$01 jsr chkin lda #$fb ;Pointer to zeropage with start address ldx #$00 ldy #BlockSize ;Block size jsr read ;READ lda $90 pha ;Status to stack txa pha ;Real length of buffer (low) to stack ldx #$02 jsr chkout pla tax lda #$fb jsr write ;WRITE pla and #$40 beq loop_copy lda #$02 jsr close ;Close output file lda #$01 jsr close ;Close input file jsr clall rts ; inputname .text "/BIN/INPUT-FILE" outputname .text "/TMP/OUTPUT-FILE" status .byte 0 ;--------------------------------------