Flashload problems
Flashload problems
What are the main reasons a program will not load with 'instant' load (e.g. Flashload), when it does load with the speeded up versions (e.g. edgeloader in ZX-Spin). I've made my first program that includes a machine code loader that loads 5 data blocks (no header) by CALLing 1366 with a 1 second pause between them, and it loads on 3 emulators using speeded up, but not with flash.
EDIT - tell a lie. It does load with flash and speed in SPIN, but not in FUSE or Spectaculator.
EDIT - tell a lie. It does load with flash and speed in SPIN, but not in FUSE or Spectaculator.
- PROSM
- Manic Miner
- Posts: 476
- Joined: Fri Nov 17, 2017 7:18 pm
- Location: Sunderland, England
- Contact:
Re: Flashload problems
I'm not too familiar with the technical details of flash loading, but in my experience I've never had it fail on a headerless loader, including my own. If you're comfortable sharing it, it could be useful to see the source code for your loader.
All software to-date
Working on something, as always.
Working on something, as always.
Re: Flashload problems
Yep not shy here. Here's the code (all ORGd below 32768):
Code: Select all
;
loadbanks: ;The load screen, bank 0 and rest of RAM has loaded by the BASIC loader, now do the top banks using ASM
ld ix,banks
ld b,5 ;number of banks
lbklp: push bc
ld e,60
call blp ;delay between loads
ld a,(ix+0)
inc ix
call setbank
push ix
ld ix,49152 ;destination
ld de,65535-49152 ; code length
ld a,255 ;255 means data not header
scf ;means load not verify
call 1366 ;ROM loader routine
ld a,16 ;always revert back to bank 0
call setbank
pop ix
pop bc
djnz lbklp
ret
;
banks: db 17,19,20,22,23
;
;(the end part of another routine)
blp: ld b,17 ;delay routine one pass of this held in E is about one frame
clp0: ld c,0
clp: dec c
jr nz,clp
djnz clp0
dec e
jr nz,blp
ret
;
;interrupts are disabled all the time so not bothering with (23388) system variable
setbank: ;arrive A holding bank 16,17,19,20,22
ld bc,32765
out (c),a
ret
;
- lister_of_smeg
- Microbot
- Posts: 145
- Joined: Thu Nov 16, 2017 1:44 pm
Re: Flashload problems
The ROM loader is enabling interrupts before returning. So there's two small windows (after this EI until you page bank 0 in, and after you page your destination bank in until the DI near the start the ROM loader) where an interrupt could occur and mess things up.
I have no idea whether this has anything to do with the issue, but you could try a DI after return from the ROM loader, and also keeping (23888) updated (as DI alone would still leave a tiny window for a interrupt to occur whilst they are enabled).
LD_BYTES: https://skoolkid.github.io/rom/asm/0556.html
SA/LD-RET: https://skoolkid.github.io/rom/asm/053F.html
I have no idea whether this has anything to do with the issue, but you could try a DI after return from the ROM loader, and also keeping (23888) updated (as DI alone would still leave a tiny window for a interrupt to occur whilst they are enabled).
LD_BYTES: https://skoolkid.github.io/rom/asm/0556.html
SA/LD-RET: https://skoolkid.github.io/rom/asm/053F.html
- PROSM
- Manic Miner
- Posts: 476
- Joined: Fri Nov 17, 2017 7:18 pm
- Location: Sunderland, England
- Contact:
Re: Flashload problems
I agree, it could be interrupt trouble. I remember being pretty strict about keeping 23388 up-to-date on my loader, so that might be part of why it worked with flash-loading.
This probably has nothing to do with it, but I was also a little confused by this line:
...which means you're trying to load a block of 16383 bytes in length (16K minus one byte). It's fine if your blocks on the tape are that size as well, but it just stuck out to me as odd that you're not using the full bank.
EDIT: Fixed typo in the address of the BANKM system variable
This probably has nothing to do with it, but I was also a little confused by this line:
Code: Select all
ld de,65535-49152 ; code length
EDIT: Fixed typo in the address of the BANKM system variable
Last edited by PROSM on Fri Oct 27, 2023 3:38 pm, edited 1 time in total.
All software to-date
Working on something, as always.
Working on something, as always.
Re: Flashload problems
Cheers @lister_of_smeg @PROSM . I forgot that 1366 will EI. I'm not convinced that's causing the load problem (I'll test it this weekend), but it means I've been running what I thought was a 'safe' program with interrupts on. So that needs fixing either way. I chose DI at the last minute as memory was very tight.
The block length are indeed 16383 so that's not a mistake. I can see why you think it's odd my doing it that way though. Let's say 128K paging addled my brain :–)
The block length are indeed 16383 so that's not a mistake. I can see why you think it's odd my doing it that way though. Let's say 128K paging addled my brain :–)
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Flashload problems
You could save a byte here by doing this:R-Tape wrote: ↑Fri Oct 27, 2023 11:11 am Yep not shy here. Here's the code (all ORGd below 32768):
Code: Select all
; ld a,255 ;255 means data not header scf ;means load not verify call 1366 ;ROM loader routine ;
Code: Select all
scf ;sets Carry
sbc a,a ;subtracts Carry (0 – 1 = 255)
call 1366
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
- Lethargeek
- Manic Miner
- Posts: 744
- Joined: Wed Dec 11, 2019 6:47 am
Re: Flashload problems
even more intriguing is why in rare cases flashload works but edgeloader fails
happened to me a few times, can't recall which files now though
Re: Flashload problems
It's sorted now - thanks all. I also reduced the pause between blocks to 1 second - I counted 60 frames when I should have been counting 50. Works in SPIN, FUSE, Spectulator.
To my surprise—if Retrovirtual Machine is accurate—it only takes just over 13 minutes to load virtually all of RAM and 5 full banks. I expected nearer 20. It must have been Ast's nifty optimisation
To my surprise—if Retrovirtual Machine is accurate—it only takes just over 13 minutes to load virtually all of RAM and 5 full banks. I expected nearer 20. It must have been Ast's nifty optimisation
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Flashload problems
Wait until you write your first turbo-loader. You’ll cut down loading times to mere seconds.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.