Advertisement
wallyweek

TR-DOS save example

Nov 23rd, 2022
2,308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SaveExample
  2.     ld hl,FileDescriptor
  3.     ld c,#13        ;copy the file descriptor to TR-DOS system variables
  4.     call #3D13
  5.     ld a,9          ;find a file with matching 9 first bytes in the descriptor, i.e. just the filename and type
  6.     ld (#5D06),a
  7.     ld c,#0A
  8.     call #3D13
  9.     inc c           ;C will contain #FF if the file with this name wasn't found
  10.     ld c,#12        ;if it was found, mark the file descriptor as deleted
  11.     call nz,#3D13
  12.     ld hl,Address       ;save the file
  13.     ld de,Length
  14.     ld c,#0B
  15.     call #3D13
  16.     ret
  17.  
  18. FileDescriptor
  19.     DEFB "FILENAME"     ;8 characters
  20.     DEFB "C"        ;file type: code
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement