Home »
Digital Archaeology »
Computer Arcana »
Commodore »
Commodore 8-bit »
Closing a file in Assembly on the VIC-20
Closing a file in Assembly on the VIC-20 [message #409055] |
Thu, 17 June 2021 04:55 |
|
Originally posted by: Lawrence Woodman
Hello Everyone,
I've been trying to save some memory on the VIC-20 to a file on disk but
seem to be having some problems when it comes to close the file. At the
moment the file saves the data properly from assembly but I have to use
'CLOSE 8' from basic to prevent it having an asterisk next to the name in
the directory entry.
I have created a piece of code which replicates the problem below if
anyone has any ideas where I'm going wrong I'd be very grateful.
; Basic Stub
TOK_SYS = $9E ; SYS token
.byt $01, $10 ; Load address ($1001)
* = $1001
.word basicEnd ; Next Line link, here end of Basic program
.word 1 ; The line number for the SYS statement
.byt TOK_SYS ; SYS token
.asc " "
.asc "4110" ; Start of machine language
.byt 0 ; End of Basic line
basicEnd .word 0 ; End of Basic program
; KERNEL/BASIC ROM Routines
CLOSE = $FFC3
SAVE = $FFD8
SETLFS = $FFBA
SETNAM = $FFBD
main
lda #$07 ; Length of file name
ldx #<filename ; Low byte of file name location
ldy #>filename ; High byte of file name location
jsr SETNAM ; Set the name
lda #$08 ; Logical file number
ldx #$08 ; Device number
ldy #$01 ; Secondary address - $01 because saving
jsr SETLFS ; Set above parameters
lda #<flash ; Low byte of start of memory block to save
sta $C1
lda #>flash ; High byte of start of memory block to save
sta $C2
lda #$C1 ; Pointer to location of start address
ldx #<(flashend+1) ; Low byte of (end of memory block + 1)
ldy #>(flashend+1) ; High byte of (end of memory block + 1)
jsr SAVE ; Perform save
lda #$08 ; Logical file number
jsr CLOSE ; Close the file
rts
filename .asc "FLASH"
;=================================
; Block of memory to save
;=================================
flash lda $900F ; Record initial screen border/background combo
ldx #$FF ; First combo is $FF
setcombo stx $900F ; Set screen border/background combo
; Time delay
ldy #$FF
delay dey
bne delay
dex ; Next combo
bne setcombo
sta $900F ; restore initial screen border/background combo
flashend rts
Thanks in advance
Lorry
---
Advanced Use of .LBR Files on CP/M
https://techtinkering.com/articles/advanced-use-of-lbr-files -on-cpm/
|
|
|
|
|
Closing a file in Assembly on the VIC-20
By: Anonymous on Thu, 17 June 2021 04:55
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Thu, 17 June 2021 07:29
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Thu, 17 June 2021 14:56
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Fri, 18 June 2021 02:56
|
|
|
Closing a file in Assembly on the VIC-20
By: Anonymous on Fri, 18 June 2021 04:54
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Mon, 21 June 2021 04:12
|
|
|
Closing a file in Assembly on the VIC-20
By: Anonymous on Mon, 21 June 2021 04:28
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Thu, 24 June 2021 04:08
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Wed, 30 June 2021 04:49
|
|
|
Re: Closing a file in Assembly on the VIC-20
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Fri, 18 June 2021 04:04
|
|
|
Re: Closing a file in Assembly on the VIC-20
|
|
|
Re: Closing a file in Assembly on the VIC-20
By: Anonymous on Wed, 30 June 2021 04:51
|
Goto Forum:
Current Time: Thu Sep 26 19:56:34 EDT 2024
Total time taken to generate the page: 0.00327 seconds