VIC-20 Fastloader (WIP w/ other disk turbos projects?)
Moderator: Moderators
VIC-20 Fastloader (WIP w/ other disk turbos projects?)
Here is the disk turbo as used in VIMM. Code by Albert of Pu-239, I have just added a tiny bit of user interface to make it possible to use standalone and to run it from a ROM instead of being self-modifying.
How to use
SYS 40963 to initialize (transfer code to floppy drive)
SYS 40960,"PROGRAM" to load a file.
Please note that the program uses the last used device, as stored in PEEK(186). That means if you load the turbo from another drive, you will need to POKE 186,device before SYS 40963. If device is 0, it will default to 8.
The loader is able to handle wildcards, at least *. All files will be loaded back to their original location, i.e. ,8,1. This is something I'd want to make optional.
If you use regular LOAD commands, you might screw up the installed turbo, and unexpected things could happen. This is in particular true for if you LOAD"$". A complete program should come with a disk wedge that has commands for directory and other drive commands.
IMPORTANT: This is a piece of work. I don't know how reliable it is in its current form, and you may find it a bit buggy. The turbo loader is 1036 bytes excl. loading address, but in order to attach it as a cartridge in VICE, I padded it up to 4096 bytes.
Executable program: http://www.cbm.sfks.se/files/loader.prg
Source code: http://www.cbm.sfks.se/files/loader.asm
Have fun!
How to use
SYS 40963 to initialize (transfer code to floppy drive)
SYS 40960,"PROGRAM" to load a file.
Please note that the program uses the last used device, as stored in PEEK(186). That means if you load the turbo from another drive, you will need to POKE 186,device before SYS 40963. If device is 0, it will default to 8.
The loader is able to handle wildcards, at least *. All files will be loaded back to their original location, i.e. ,8,1. This is something I'd want to make optional.
If you use regular LOAD commands, you might screw up the installed turbo, and unexpected things could happen. This is in particular true for if you LOAD"$". A complete program should come with a disk wedge that has commands for directory and other drive commands.
IMPORTANT: This is a piece of work. I don't know how reliable it is in its current form, and you may find it a bit buggy. The turbo loader is 1036 bytes excl. loading address, but in order to attach it as a cartridge in VICE, I padded it up to 4096 bytes.
Executable program: http://www.cbm.sfks.se/files/loader.prg
Source code: http://www.cbm.sfks.se/files/loader.asm
Have fun!
Last edited by carlsson on Wed Dec 13, 2006 10:52 am, edited 1 time in total.
Anders Carlsson
Re: VIC-20 Fastloader
This is because when ATN gets asserted, the loader code returns to the normal DOS. This way you don't need to reset the drive after a demo.carlsson wrote:If you use regular LOAD commands, you might screw up the installed turbo
The drive "detection" is also done in the drive instead of in the computer, which was most convenient at the time. I simply checked if the 1581 job queue execute jump entry is present and assume 1581 is either jmp absolute or jmp (indirect) is found.
As I said in another thread, this loader is not as fast as it could be, but should still beat the standard load times. What do you think, should we make a little competition about how fast can we make this thing ?:-)
-Pasi
Cool!!! Is it possible to load files into block 5 as well to load cartridge images? If the program resides in the diskdrive, then I would guess so? Or? If not, then maybe you could put some of the code in the tape buffer instead...
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
The drive code is in the drive, the computer code is in the computer. The computer code could probably be located in the tape buffer. However, I'm not currently working on it, but I may try a faster version while I'm developing the next demo.Boray wrote:If the program resides in the diskdrive, then I would guess so? Or? If not, then maybe you could put some of the code in the tape buffer instead...
-Pasi
The program is fully relocatable, using the DASM assembler. I just put it into block 5 because 1) it is a common place for RAM/ROM and 2) I don't have any RAM expansion that maps into I/O blocks 2/3.
Of course one could load the program into one address, and then relocate the computer part to another location, just like it transfers the drive part to the disk drive upon startup. I haven't measured exactly how large the computer part is, but perhaps a half kilobyte?
Of course one could load the program into one address, and then relocate the computer part to another location, just like it transfers the drive part to the disk drive upon startup. I haven't measured exactly how large the computer part is, but perhaps a half kilobyte?
Anders Carlsson
- Mike
- Herr VC
- Posts: 4845
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
I'm on the way to make HYPRA-SYSTEM compatible with the 1571. This should only be a matter of adjusting some sub-routine calls in the drive code.
The common sub-set of both speeders is fast-load on the 1541. The VIMM disk-turbo then already supports the 1571, and even extends to the 1581. On the other hand, Hypra supports the storing of files.
What is missing entirely from both speeders, is 1581 support for saving.
Hypra stores files this way:
1. A file is opened normally.
2. Instead of the whole program, only two 0-bytes are written.
3. The file is closed. (I.e. the directory entry has now been created)
4. Then two blocks of code are loaded into the drive:
- Transfer one sector. (Resides in the stack)
- Write transferred sector onto disc. (Resides in buffer #0 and #1)
5. This code is executed, extending the one-sector PRG written in Step 2.
6. Finally, BAM and directory entry are corrected.
This needs to be transferred to the 1581.
Only lots of thoughts ATM, ... we'll see.
Michael
The common sub-set of both speeders is fast-load on the 1541. The VIMM disk-turbo then already supports the 1571, and even extends to the 1581. On the other hand, Hypra supports the storing of files.
What is missing entirely from both speeders, is 1581 support for saving.
Hypra stores files this way:
1. A file is opened normally.
2. Instead of the whole program, only two 0-bytes are written.
3. The file is closed. (I.e. the directory entry has now been created)
4. Then two blocks of code are loaded into the drive:
- Transfer one sector. (Resides in the stack)
- Write transferred sector onto disc. (Resides in buffer #0 and #1)
5. This code is executed, extending the one-sector PRG written in Step 2.
6. Finally, BAM and directory entry are corrected.
This needs to be transferred to the 1581.
Only lots of thoughts ATM, ... we'll see.
Michael
If you need, i've compiled Carlsson's fastloader for banks 1/2/3 too and for load it quickly from a disk, i've removed the 4kb limit so now is 5 blocks length only but i may recompile it at 4kb if you want.eslapion wrote:Do you think you could make it for I/O2 and I/O3 address range?
I've done othere modifications too.
Since i use it from disk i don't like to do SYS40963 and after SYS40960,"FILE"
So now i've changed sintax into SYS40960"FILE" without comma and without SYS40963 before that now is called automatically each time, it's a little bit slow but less verbose.
I've tried to implement the ,[8/9/10/11] but i don't know how to intercept it from command line SYS40960"FILE",[9] in any case if you type load"$",9 or poke186,9 before SYS40960"FILE" it work.
I've tried to implement the ,8,[0] too for now using a poke before so you can load file from start basic point too but the basic jump structure inside the file is not changed so a file saved in $1001, if you have 8k expansion, loads in $1201 but internal basic links remains at $1013 $1025 $1031 and doesn't change to $1213 $1225 $1231 etc. it requires some changes in load routines?
I've discovered that to fix the problem after loading you need to type:nbla000 wrote:[but internal basic links remains at $1013 $1025 $1031 and doesn't change to $1213 $1225 $1231 etc. it requires some changes in load routines?
SYS50483 (Rom Address $c533 linkprg Rechain Lines)
but now i must understand how to fix the loader i.e. where to put the JSR $C533 call (if i put it before the rts of getdone$: label the loader hangs)
- Mike
- Herr VC
- Posts: 4845
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
One thing to consider is, that the re-chaining of BASIC lines is done within the Basic LOAD command code, and not in the Load routine of the kernel. You'd not really want to re-chain upon ML code or graphics data ... furthermore 45/46 need to be fixed.
These are no issues for HYPRA, as only the kernel Load vector is diverted, and the re-chaining of an eventually loaded BASIC program and setting of 45/46 happens as usual within the LOAD command code.
Michael
These are no issues for HYPRA, as only the kernel Load vector is diverted, and the re-chaining of an eventually loaded BASIC program and setting of 45/46 happens as usual within the LOAD command code.
Michael
I must understand how to do, i modify the relative address in $330 $331 to $00 $a0 but after LOAD i get a sintax error, Mike says that the fast loader need to be compatible with the standard LOAD routine, but i don't know how at the moment and Mike it's a little bit busy for a while.carlsson wrote:Yes, it is a good idea to hook the turbo to the LOAD command in some way.
So i want to implement a DIR command $ that not use the memory like LOAD"$",8 but just display the result on video.
my idea is to add new commands to fastload a file and to display a directory:
/"FILE" for LOAD"FILE",8
%"FILE" for LOAD"FILE",8,1
/11"FILE" for LOAD"FILE",11
%11"FILE" for LOAD"FILE",11,1
$ for LOAD"$",8 + LIST (preserving program in memory and displaying long directories without an ?OUT OF MEMORY ERROR in unexpanded VIC")
$9 for LOAD"$",9 + LIST as above.
I need of course to tokenize these commads but for now i'm focalized on DIR routine.
I've extrapolated the DIR routine to a simple unexpanded program to examine a problem.
The Routine:
Code: Select all
; **************** program constants
OPEN = $ffc0 ; Open Vector [F40A] Open File
; Preparing: SETLFS, SETNAM
CLOSE = $ffc3 ; Close Vector [F34A] Close File
CLALL = $ffe7 ; Close All Channels And Files [F3EF]
SETLFS = $ffba ; Set Logical File Parameters
SETNAM = $ffbd ; Set Filename
CHROUT = $ffd2 ; chrout [F27A] Output One Character
; Preparing: OPEN, CHKOUT (no video)
; Errors: READST
CHKIN = $ffc6 ; Set Input [F2C7] Set Input Device
; Preparing: OPEN
CHRIN = $ffcf ; chrin [F20E] Input a byte
; Preparing: OPEN, CHKIN
; Errors: READST
READST = $ffb7 ; Read I/O Status Word
PRNINT = $ddcd ; print integer in X/A
main:
lda $ba ;0186 For now i look on 186 location only
cmp #$08
BPL IF132ELSE
lda #$08
sta $ba ;0186
IF132ELSE:
lda #$00
jsr SETNAM ;no name
lda #15
ldx $ba ;186
ldy #15
jsr SETLFS ;15,8,15
jsr OPEN ;open 15,8,15
lda #15
jsr CLOSE ;close 15
jsr READST
BEQ IF147ELSE
lda #<dirdevicenptxt
ldy #>dirdevicenptxt
jsr PRNSTR ; display an error message
rts ;return to basic
IF147ELSE:
lda #$03
ldx #<diropencmdtxt
ldy #>diropencmdtxt
jsr SETNAM ;"ui-"
lda #15
ldx $ba ;186
ldy #15
jsr SETLFS ;15,8,15
jsr OPEN ;open 15,8,15,"ui-"
lda #$01
ldx #<dircmdtxt
ldy #>dircmdtxt
jsr SETNAM ;"$"
lda #01
ldx $ba ;186
ldy #0
jsr SETLFS ;1,8,0
jsr OPEN ;open 1,8,0,"$"
jsr dirgetbyte
jsr dirgetbyte ;skip first 2 bytes
dirmainloop:
jsr dirgetbyte
jsr dirgetbyte ;skip first 2 bytes of single rows
jsr READST
BEQ IF177ELSE
jsr CLALL ;Close All Channels And Files
;lda #15
;jsr CLOSE ;close 15 <- not work, freeze
;lda #1
;jsr CLOSE ;close 1
rts ;return to basic
IF177ELSE:
lda #13 ;return
jsr CHROUT ;print character
jsr dirgetbyte
tay ; temp storage for PRNINT X value
jsr dirgetbyte
pha ; temp storage for PRNINT A value
tya ; temp get A from Y
tax ; X contain blocks len (lo-byte)
pla ; A contain blocks len (hi-byte)
jsr PRNINT ;print integer in X/A
lda #$20 ;space
jsr CHROUT ;print character
dirrowloop:
jsr dirgetbyte
BEQ IF200ELSE
jsr CHROUT ;print character in A
jmp dirrowloop
IF200ELSE:
lda #146 ;reverse off
jsr CHROUT ;print character
jmp dirmainloop
dirgetbyte:
ldx #$01
jsr CHKIN
jsr CHRIN
rts
diropencmdtxt byte "ui-"
dircmdtxt byte "$"
dirdevicenptxt byte "?DEVICE NOT PRESENT",13," ERROR",0
the first as displayed on this screenshot is that i got sometime and in random mode bad character from drive (1541/1581 tested on real Vic-20 but same problem in VICE with True Drive emulation) but mostly important the routine freeze in this LOOP:
Code: Select all
eedd 20 B2 E4 JSR $E4B2
eee0 B0 FB BCS $EEDD
eee2 58 CLI
e4b2 AD 1F 91 LDA $911F
e4b5 CD 1F 91 CMP $911F
e4b8 D0 F8 BNE $E4B2
e4ba 4A LSR A
e4bb 60 RTS
- Mike
- Herr VC
- Posts: 4845
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Hi,
displaying the directory is a little more complicated, as you really get a program named "$" from the drive, which incidentally is LISTable. Fortunately, there's a program named 'VIC Wedge', which already does the job - and a little bit more - at the READY prompt:
The last used drive is accessed, but you can switch to another drive with POKE 186,<nr>. And, for that matter, I've already integrated this utility into a new version of Hypra. Furthermore I've checked the 1571 compatibility of Hypra in VICE, and there doesn't seem to be any problem.
1581 compatibility, on the other hand, needs an extensive re-work on the drive code - I'm cross-checking with AAY1541 and AAY1581. There's also the issue of making Hypra compatible with NTSC (it is PAL only at the moment), which is probably only a matter of leaving out some NOP's in the computer's transfer code.
Work in progress,
Greetings,
Michael
displaying the directory is a little more complicated, as you really get a program named "$" from the drive, which incidentally is LISTable. Fortunately, there's a program named 'VIC Wedge', which already does the job - and a little bit more - at the READY prompt:
Code: Select all
@ (alone for itself): display drive status
@$ : display directory
@{command} : send {command} to drive.
/{filename} : load {filename} from drive.
1581 compatibility, on the other hand, needs an extensive re-work on the drive code - I'm cross-checking with AAY1541 and AAY1581. There's also the issue of making Hypra compatible with NTSC (it is PAL only at the moment), which is probably only a matter of leaving out some NOP's in the computer's transfer code.
Work in progress,
Greetings,
Michael
Thank's Mike, i'm happy to know that VIC Wedge is now integrated in your Hypra-Load, in any case just for fun i've solved the problem in this way:
Code: Select all
jsr OPEN ;open 1,8,0,"$"1
ldx #$01 ;moved here to fix problem
jsr CHKIN
jsr dirgetbyte
jsr dirgetbyte ;skip first 2 bytes
dirmainloop:
jsr dirgetbyte
jsr dirgetbyte ;skip first 2 bytes of single rows
jsr READST
BEQ IF177ELSE
lda #15
jsr CLOSE ;close 15
lda #1
jsr CLOSE ;close 1
ldx #$00
jsr CHKIN ;fix the freeze problem
;thanks to nippur72
rts ;return to basic
dirgetbyte:
;ldx #$01 moved above
;jsr CHKIN
jsr CHRIN
rts
I've made a first Fastloader beta version starting from Carlsson adapted project.
For now i've 2 version because there is a problem that i must understand so after a while working with a full version partial working i've decided to restart the project to see where is the problem.
In any case the full partial working version is here ** sources here **
you need 8k in bank 5 and load it with LOAD"FLOADER",8,1 + RESET
Current Status:
LOAD"FILENAME",DR TURBO OK
LOAD"FILENAME",DR,1 TURBO OK
VERIFY"FILENAME",DR TURBO OK
VERIFY"FILENAME",DR,1 TURBO OK
LOAD"$",DR USE STANDARD ROUTINES TO LOAD DIRECTORIES
LOAD"FILENAME",1,x USE STANDARD ROUTINES TO LOAD TAPES
The Known problems are:
The Vic freeze when you try to LOAD after these events before:
LOAD a program and stop the loading process with Run/STOP
LOAD and get a ?LOAD ERROR
VERIFY and get a ?VERIFY ERROR
Another problem that is present in the adapted Carlsson version too
is that if you try to load a file like "SGUISH" and exist before
in the directory a file called "SGUISH TES" the fastloader LOAD
always "SGUISH TES"
The beta version that you may download here** sources here** it's for testing pourpose only and is intend to discover the problems explained above.
You need 8k in bank 5 and load it with LOAD"FLOADER",8,1 + RESET
This version need a SYS41012 to inizialize the drive.
If i load a program all is ok but after a RUN and a reloading without reset the vic the next LOAD command freeze in these routines:
This doesn't occurs if i LOAD a lot of programs without RUN it.
Modifying the program i've discovered that this problem appears when i exit from loader with X and Y setted with last load address (necessary for the standard LOAD routines to rewrite all pointers) but i cannot change this part of program because i use standard routines not SYS command like carlsson.
** link removed because files are updated, see next posts
For now i've 2 version because there is a problem that i must understand so after a while working with a full version partial working i've decided to restart the project to see where is the problem.
In any case the full partial working version is here ** sources here **
you need 8k in bank 5 and load it with LOAD"FLOADER",8,1 + RESET
Current Status:
LOAD"FILENAME",DR TURBO OK
LOAD"FILENAME",DR,1 TURBO OK
VERIFY"FILENAME",DR TURBO OK
VERIFY"FILENAME",DR,1 TURBO OK
LOAD"$",DR USE STANDARD ROUTINES TO LOAD DIRECTORIES
LOAD"FILENAME",1,x USE STANDARD ROUTINES TO LOAD TAPES
The Known problems are:
The Vic freeze when you try to LOAD after these events before:
LOAD a program and stop the loading process with Run/STOP
LOAD and get a ?LOAD ERROR
VERIFY and get a ?VERIFY ERROR
Another problem that is present in the adapted Carlsson version too
is that if you try to load a file like "SGUISH" and exist before
in the directory a file called "SGUISH TES" the fastloader LOAD
always "SGUISH TES"
The beta version that you may download here** sources here** it's for testing pourpose only and is intend to discover the problems explained above.
You need 8k in bank 5 and load it with LOAD"FLOADER",8,1 + RESET
This version need a SYS41012 to inizialize the drive.
If i load a program all is ok but after a RUN and a reloading without reset the vic the next LOAD command freeze in these routines:
Code: Select all
LDA #$03
TEST BIT $911F
BNE TEST
Modifying the program i've discovered that this problem appears when i exit from loader with X and Y setted with last load address (necessary for the standard LOAD routines to rewrite all pointers) but i cannot change this part of program because i use standard routines not SYS command like carlsson.
** link removed because files are updated, see next posts
Last edited by nbla000 on Fri Mar 16, 2007 12:57 pm, edited 2 times in total.