Page 1 of 1

Flood (game) - issues with d64

Posted: Sun Jan 30, 2022 8:57 am
by javierglez
This is about the new game I made. The problem is, when I launch it off a d64 from the filebrowser with SD2IEC, it starts, but after some time it freezes.

So in the releases thread I have attached a folder to copy to the SD card and then the filebrowser launches the game correctly. I don't know if this way around works for "TheVIC20".

The thing is, I'd like to fix this issue. My game loads the different levels from disk and use SETLFS, SETNAM and LOAD kernal routines. I don't know how to debug. I guess the filebrowser does some changes in the lower 1kB that my code doesn't like.

Re: Flood (game) - issues with d64

Posted: Tue Feb 01, 2022 1:58 pm
by javierglez
It may have something to do with memory inicialization, and not with SD2IEC. I'll try to configure the emulator not to fill the memory with zeros. I have pretty much the same program converted to run on a C16 and it has some errors too. But for C16 it makes no difference if it's a folder or a disk image. If I reset the computer, eventually the game seems to run.

Re: Flood (game) - issues with d64

Posted: Wed Feb 02, 2022 4:09 am
by nbla000
The problem is, when I launch it off a d64 from the filebrowser with SD2IEC, it starts, but after some time it freezes.
Do you mean my CBM-FileBrowser "FB20-8K" in your case? right?
It may have something to do with memory inicialization, and not with SD2IEC.
Talking about my CBM-FileBrowser it uses stantard kernal locations except some temp bytes in these locations:

Code: Select all

0022-0025   34-37    Utility pointer area
0026-002A   38-42    Product area for multiplication
0057-0060   87-96    Misc numeric work area
00FB-00FE  251-254  Operating system free zero page space
In any case I've tried to reset these values before RUN but this didn't solved the problem, I will investigate further.

PS: I've noticed that the game is not centered for NTSC machines.

Re: Flood (game) - issues with d64

Posted: Wed Feb 02, 2022 5:04 am
by nbla000
OK, the problem is the tape buffer ($33C-$3FF), you should initialize/clean this area at startup since it could contain any kind of data even if you don't use CBM-FileBrowser.

Re: Flood (game) - issues with d64

Posted: Thu Feb 03, 2022 1:40 pm
by javierglez
Thanks for checking the program nbla.
I'll check the NTSC screen margin values with VICE. It detects if PAL/NTSC with
lda $EDE4
cmp #$C
I found a bug in the hi-score update BTW.

I'm not suspicious of filebrowser, it's just that I use it to mount the d64 image and to change folders in general.

I burned the image to a real floppy and the game didn't freeze, but had a minor graphical glitch at level 5.

I think I don't use the kernal routines properly. Although I have no idea why I have different results with the emulator, the real floppies and the SD2IEC. (edit: The results are consistent)

I use, to load the graphics file and to load the level file:

Code: Select all

nexdaca
        ldx #<nextfilechar ; <-pointers to file names
        ldy #>nextfilechar
        jsr loadbin 
        ldx #<nextfilemap
        ldy #>nextfilemap
        jsr loadbin 
        jmp sigjuego


loadbin
        stx addrlo
        sty addrhi

        ldx #8 ; device number
        ldy #1 ; direccion secundaria, 0 para relocalizar si LOADSP, diferente cargar en su direccion
        jsr SETLFS 
        lda #filenamelength
        ldx addrlo
        ldy addrhi
        jsr SETNAMS 
        lda #0 ; indica carga 1 indicaria verificacuon
        jsr LOADSP 
        rts
I have a C16 version too, doesn't freeze but has more glitches. I'll try to do some debugging, as it has the MC monitor embedded. But I've never done this.

(I think Chysn or somebody else put a link to the kernel disassembly but I can't find the thread. I should check what LOADSP does OK I found it:http://www.fox-ts.co.uk/shared/vic20ker ... l#LAB_F542)

Re: Flood (game) - issues with d64

Posted: Thu Feb 03, 2022 2:32 pm
by srowe
You should at least check the carry bit after each LOADSP call, Cb=1 indicates an error.

Re: Flood (game) - issues with d64

Posted: Thu Feb 03, 2022 2:45 pm
by javierglez
srowe wrote: Thu Feb 03, 2022 2:32 pm You should at least check the carry bit after each LOADSP call, Cb=1 indicates an error.
If it doesn't load some data (some file), the current data remains, the game doesn't make sense anymore, but it doesn't crash.
It could only be an issue if a file is corrupt, but then the issues when running wouldn't be consistent.
After all it's a game not a utility.

It may be my sound interrupt interfering with the loading

Re: Flood (game) - issues with d64

Posted: Thu Feb 03, 2022 4:04 pm
by javierglez
Maybe I should remove the release until I fix it. I didn't suspect it would run in the emulator but not in the real machine

Re: Flood (game) - issues with d64

Posted: Fri Feb 04, 2022 2:04 am
by nbla000
Thanks for checking the program nbla.
Your welcome, I like debug sessions :wink:
I'm not suspicious of filebrowser, it's just that I use it to mount the d64 image and to change folders in general.
I'm really happy that many people use my CBM-FileBrowser on their CBM machine, there will be a new 1.7 version (currently in beta testing) for pi1541 compatibility and few additional features.

Re: Flood (game) - issues with d64

Posted: Fri Feb 04, 2022 8:42 am
by javierglez
OK it definitely had to do with the tape buffer, although I aim to initialize all the variables, some weren't.

With regards to the disk error checking (I use a nonexistant filename to skip updating graphics), SD2IEC requires clearing the error channel before attemping to load a file again, so I added code to read the error channel.

It is being somewhat interesting to debug with the C16 and the embedded monitor.

I hope to have the program fixed in a few days.

Re: Flood (game) - issues with d64

Posted: Wed May 11, 2022 5:34 am
by javierglez
I finally fixed the initialization bugs and modified a little bit the player's control and changed the random generator for a pseudo random generator. I'm going to leave it here for a while anyway before releasing.
floodvic.zip
(31.06 KiB) Downloaded 144 times
flood_grafs_sc1-2.jpg

Re: Flood (game) - issues with d64

Posted: Fri Jun 03, 2022 4:52 am
by javierglez
I changed a couple of things at the suggestion of Luca from the C16 forum and posted an updaded version on the 2022 releases thread

Re: Flood (game) - issues with d64

Posted: Fri Jun 03, 2022 5:14 am
by chysn
Very nicely done, looks sharp! My high score is in the 5000 range so far.

Re: Flood (game) - issues with d64

Posted: Fri Jun 03, 2022 7:17 am
by javierglez
Thank you Chysn.
There's a combination of 2 keys that, when pressed simulataneously, the current level is skipped, but then you don't get the points ofc. But I'll keep as a secret for the moment