Questo esempio descrive come chiamare i comandi CD, MKDIR e RM
;--------------------------------------
; open 1,12,15,"x:name" : close 1
;--------------------------------------
*= $1000
setnam = $ffbd
setlfs = $ffba
close = $ffc3
open = $ffc0
ldx #12 ;HDD
ldy #15 ;canale comando
lda #1
jsr setlfs
lda #finenome (endname)-nome in ingresso (inputname)
ldx #<inputname
ldy #>inputname
jsr setnam
jsr open
lda #1
jsr close
rts
;--------------------------------------
; inputname .text "S:TESTFILE"
; endname = * ;Delete (Cancella)
; inputname .text "M:TESTDIR"
; endname = * ;Mkdir (crea dir)
; inputname .text "I:"
; endname = * ;Hdinit1 (IDE64 DOS V0.64 o sup.)
inputname .text "C:/TMP"
endname = * ;Cd
;--------------------------------------
Questo esempio mostra come leggere e visualizzare una directory
in formato standard
*= $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 (carattere su schermo)
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 (indirizzo di partenza)
jsr chrin ;$0401
main_loop = *
jsr chrin ;next basic line (prossima linea basic)
jsr chrin ; - "" -
jsr chrin ;line number - number of blocks (numero linea - numero di blocchi)
tax
jsr chrin
ldy $90
bne dir_end
jsr $bdcd ;Print # to ASCII (visualizza # in ASCII)
lda #$20
jsr chrout ;space (spazio)
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 "$"
Questo esempio mostra come usare chiamate veloci READ/WRITE per copiare files
(da "INPUT-FILE" in "BIN" directory, a "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 da $2000 a $5fff
;
StartAdd = $20
BlockSize = $40
;--------------------------------------
lda #1
ldx #12 ;HDD
ldy #0 ;indirizzo secondario per lettura
jsr setlfs
lda #outputname-inputname
ldx #<inputname
ldy #>inputname
jsr setnam
lda #$01
jsr open ;apre file in input
lda #2
ldx #12 ;HDD
ldy #1 ;indirizzo secondario per scrittura
jsr setlfs
lda #status-outputname
ldx #<outputname
ldy #>outputname
jsr setnam
lda #$02
jsr open ;apre file in output
lda #$00
sta $fb
lda #StartAdd ;indirizzo di partenza Buffer
sta $fc
loop_copy = *
ldx #$01
jsr chkin
lda #$fb ;puntatore alla pagina zero con indirizzo di partenza
ldx #$00
ldy #BlockSize ;dimensione blocco
jsr read ;LETTURA
lda $90
pha ;Status nello stack
txa
pha ;lunghezza reale del buffer (low) nello stack
ldx #$02
jsr chkout
pla
tax
lda #$fb
jsr write ;SCRITTURA
pla
and #$40
beq loop_copy
lda #$02
jsr close ;chiude output file
lda #$01
jsr close ;chiude input file
jsr clall
rts
;
inputname .text "/BIN/INPUT-FILE"
outputname .text "/TMP/OUTPUT-FILE"
status .byte 0
;--------------------------------------