Open a file (relative or not)
.include "telestrat.inc" ; set the header FOPEN filename,O_RDONLY ; Macro open in readonly ; A register contains FP id rts filename: .asciiz "/opt/toto.txt"
Read X bytes
.include "telestrat.inc" ; set the header ; [IN] AY contains the length to read ; [IN] PTR_READ_DEST must be set because it's the ptr_dest ; [IN] TR0 contains the fd id ; Send the fp pointer lda #$01 ; 1 is the fd id of the file opened sta TR0 ; define target address lda #<$a000 sta PTR_READ_DEST lda #>$a000 sta PTR_READ_DEST+1 ; We read 8000 bytes lda #<8000 ldy #>8000 ; reads byte BRK_TELEMON XFREAD BRK_TELEMON XCLOSE
WRITE X bytes
.include "telestrat.inc" ; set the header #define PTR_READ_DEST $2c #define TR0 $0c FOPEN(_filename_open,O_WRONLY) fileopened sta saveFP lda #<_edition_buffer sta PTR_READ_DEST lda #>_edition_buffer sta PTR_READ_DEST+1 lda saveFP sta TR0 lda _length_of_file ldy _length_of_file+1 BRK_TELEMON(XFWRITE) BRK_TELEMON(XCLOSE) rts saveFP: .byt 0 _filename_open: .asciiz "/mytext.txt" _length_of_file: .byte 12,0 ; 12 bytes _edition_buffer: .byte "123456789012"
Close a file
.include "telestrat.inc" ; set the header lda #$01 ; fd id BRK_TELEMON XCLOSE rts
Create a folder
.include "telestrat.inc" MKDIR file1 ; call a macro rts file1: .asciiz "/jede/toulou/pouet"