Jump to content
IGNORED

Help with Corrupted Graphics


BydoEmpire

Recommended Posts

Hi all.  I'm guess there's just something I don't understand about 7800 basic and how graphics need to be laid out.  I've been adding a lot of sprites lately, and working on updating tilesets.  I've got it to a state where my main weapon ends up firing background tiles instead of the actual weapon sprite.  Shifting around the order of incgraphics changes which sprite is corrupted, but the results is the same.  Moving my tileset to the last things included locks up the game immediately.  Interesting I was experimenting with including different tilesets for different levels and that locked up as well, so I took that out for the time being. I'm guessing it's the same fundamental problem.  I'm hoping it's not a memory-trashing bug, because that's going to be a lot tougher to fix without a good debugger.

 

Output:


d:\dev\a7800\7800basic\fantasy\fantasy7800>7800bas fantasy.bas
7800basic v0.16 Nov 21 2020 15:38:56

*** (): INFO, GFX Block #0 starts @ $C000
        tileset_wd_lvl1_alt scoredigits_8_wide_centered
        alphabet_8_wide wizlefttop1 wizlefttop2 wizrighttop1
        wizrighttop2 wizleftbottom1 wizleftbottom2 wizrightbottom1
        wizrightbottom2 ghosttop_l_1 ghostbottom_l_1 ghosttop_r_1
        ghostbottom_r_1 sword_l_0 sword_l_1 sword_l_2 sword_l_3 sword_r_0
        sword_r_1 sword_r_2 sword_r_3 arrow_u_8x8 arrow_ur_8x8
        arrow_r_8x8 arrow_dr_8x8 arrow_d_8x8 arrow_dl_8x8 arrow_l_8x8
        arrow_ul_8x8 fireball_8x8_0 fireball_8x8_1 fireball_8x8_2
        fireball_8x8_3 bolt_u bolt_ur
*** (): INFO, GFX block #0 has 0 bytes left (0 x 16 bytes)


*** (): INFO, DMA hole #0 starts @ $D000
        no code defined for DMA hole

*** (): INFO, GFX Block #1 starts @ $E000
        bolt_r bolt_dr bolt_d bolt_dl bolt_l bolt_ul spider1 spider2 spider3
        spider4 mummy_l_1c mummy_l_2c mummy_r_1c mummy_r_2c tentacle_1mc
        tentacle_2mc tentacle_3mc tentacle_4mc goblin_l_1 goblin_l_2
        goblin_l_3 goblin_l_4 goblin_r_1 goblin_r_2 goblin_r_3 goblin_r_4
*** (): INFO, GFX block #1 has 3264 bytes left (204 x 16 bytes)


7800basic compilation complete.
User-defined 7800.asm found in current directory
INFO: Label 'bulletvelocity_slow_lo' changed from $00c5 to $00d9
INFO: Label 'bulletvelocity_med_lo' changed from $00f0 to $0004
INFO: Label 'bulletvelocity_med_hi' changed from $0085 to $0086
INFO: Label 'bulletvelocity_fast_lo' changed from $001b to $002f
   stack allowance: 30 nested subroutines.
   the canary is situated at: $1c1
   13789 bytes of ROM space left in the main area.
     $1880 to $1fff used as zone memory, allowing 31 display objects per zone.
     2359 bytes left in the 7800basic reserved area.

Complete. (0)
Read $C000 bytes of cartridge data.
Cartridge hash area is from $F000 to $FFFF.
Cartridge signature for 'd:\dev\a7800\7800basic\fantasy\fantasy7800\fantasy.bas.bin' appears to be empty.
Encrypting... 00 01 success!

A valid cartridge signature is:
08 87 8d 4a 6f 5a 4d 48  c5 be e3 aa 28 41 64 71
73 f9 25 fa c3 a9 a5 4e  01 3c 7e 2c f2 7e 66 0f
45 6b 7f 3c 94 06 ce 9b  d1 ab c4 42 70 a1 2a b3
96 37 62 a1 e8 50 8d 4f  8c ae 91 38 29 af 1e b9
ce 84 08 1d f8 59 f7 6a  0b 02 a6 18 10 a7 2a ac
9b e3 76 b0 12 23 16 27  f3 51 97 a1 27 07 2e 2f
cb 63 29 16 79 af e8 eb  e0 c8 cb 9b 86 55 a0 f4
bf d2 c2 6f 0a 7e 70 1b

Wrote back 120 bytes to 'd:\dev\a7800\7800basic\fantasy\fantasy7800\fantasy.bas.bin'.

7800header 0.10 Nov 21 2020 15:39:01
  opened parameter file a78info.cfg
7800makecc2 v0.1
  The ROM 'd:\dev\a7800\7800basic\fantasy\fantasy7800\fantasy.bas.bin' is compatible with CC2.

d:\dev\a7800\7800basic\fantasy\fantasy7800>

Section of code with graphics included:

  set romsize 48k

  displaymode 160A

  set screenheight 192

  incgraphic gfx/tileset_wd_lvl1_alt.png 160A 0 1 2 3
  ;incgraphic gfx/tileset_wd_lvl2_castle.png 160A 0 1 2 3
  incgraphic gfx/scoredigits_8_wide_centered.png
  incgraphic gfx/alphabet_8_wide.png 160A 0 2 1 3 
  
	rem ** these shouldn't be 320A, but they've always worked so I left them as-is since I need to replace anyways
  incgraphic gfx/wizlefttop1.png 320A 0 1 2 3
  incgraphic gfx/wizlefttop2.png 320A 0 1 2 3
  incgraphic gfx/wizrighttop1.png 320A 0 1 2 3
  incgraphic gfx/wizrighttop2.png 320A 0 1 2 3
  incgraphic gfx/wizleftbottom1.png 320A 0 1 2 3
  incgraphic gfx/wizleftbottom2.png 320A 0 1 2 3
  incgraphic gfx/wizrightbottom1.png 320A 0 1 2 3
  incgraphic gfx/wizrightbottom2.png 320A 0 1 2 3

  incgraphic gfx/ghosttop_l_1.png 320A 0 1 2 3
  incgraphic gfx/ghostbottom_l_1.png 320A 0 1 2 3
  incgraphic gfx/ghosttop_r_1.png 320A 0 1 2 3
  incgraphic gfx/ghostbottom_r_1.png 320A 0 1 2 3
 
  incgraphic gfx/sword_l_0.png
  incgraphic gfx/sword_l_1.png
  incgraphic gfx/sword_l_2.png
  incgraphic gfx/sword_l_3.png
  incgraphic gfx/sword_r_0.png
  incgraphic gfx/sword_r_1.png
  incgraphic gfx/sword_r_2.png
  incgraphic gfx/sword_r_3.png

  incgraphic gfx/arrow_u_8x8.png
  incgraphic gfx/arrow_ur_8x8.png
  incgraphic gfx/arrow_r_8x8.png
  incgraphic gfx/arrow_dr_8x8.png
  incgraphic gfx/arrow_d_8x8.png
  incgraphic gfx/arrow_dl_8x8.png
  incgraphic gfx/arrow_l_8x8.png
  incgraphic gfx/arrow_ul_8x8.png
 
  incgraphic gfx/fireball_8x8_0.png
  incgraphic gfx/fireball_8x8_1.png
  incgraphic gfx/fireball_8x8_2.png
  incgraphic gfx/fireball_8x8_3.png
  incgraphic gfx/bolt_u.png
  incgraphic gfx/bolt_ur.png
  incgraphic gfx/bolt_r.png		<-- most of these bolt graphics end up getting corrupted (i.e. you shoot tiles)
  incgraphic gfx/bolt_dr.png
  incgraphic gfx/bolt_d.png
  incgraphic gfx/bolt_dl.png
  incgraphic gfx/bolt_l.png
  incgraphic gfx/bolt_ul.png

  rem ** include enemy sprites 
  incgraphic gfx/spider1.png
  incgraphic gfx/spider2.png
  incgraphic gfx/spider3.png
  incgraphic gfx/spider4.png

  incgraphic gfx/mummy_l_1c.png
  incgraphic gfx/mummy_l_2c.png
  incgraphic gfx/mummy_r_1c.png
  incgraphic gfx/mummy_r_2c.png
  
  incgraphic gfx/tentacle_1mc.png
  incgraphic gfx/tentacle_2mc.png
  incgraphic gfx/tentacle_3mc.png
  incgraphic gfx/tentacle_4mc.png

  incgraphic gfx/goblin_l_1.png
  incgraphic gfx/goblin_l_2.png
  incgraphic gfx/goblin_l_3.png
  incgraphic gfx/goblin_l_4.png
  incgraphic gfx/goblin_r_1.png
  incgraphic gfx/goblin_r_2.png
  incgraphic gfx/goblin_r_3.png
  incgraphic gfx/goblin_r_4.png

 

Edited by BydoEmpire
Link to comment
Share on other sites

I believe all of my sprites are 8x16.  The same bolt pngs work fine if I rearrange the order, as do al the other weapons.  What's interesting is that all the sprites after the first two bolts are fine (the enemy sprites, for example). However, if I move the tilesets to be the last thing included, it hangs on boot.

Link to comment
Share on other sites

Out of the blue I started getting WARNING: bad non-variable value on some incgraphic calls.  I stuck a couple of unused pngs where it was getting corrupted*, and those are the lines it's complaining about.  Weird.  Still runs fine, though.


d:\dev\a7800\7800basic\fantasy\fantasy7800>7800bas fantasy.bas
7800basic v0.16 Nov 21 2020 15:38:56
*** (695): WARNING, bad non-variable value
*** (695): WARNING, bad non-variable value
*** (695): WARNING, bad non-variable value
*** (695): WARNING, bad non-variable value
*** (696): WARNING, bad non-variable value
*** (696): WARNING, bad non-variable value
*** (696): WARNING, bad non-variable value
*** (696): WARNING, bad non-variable value
*** (697): WARNING, bad non-variable value
*** (697): WARNING, bad non-variable value
*** (697): WARNING, bad non-variable value
*** (697): WARNING, bad non-variable value
*** (698): WARNING, bad non-variable value
*** (698): WARNING, bad non-variable value
*** (698): WARNING, bad non-variable value
*** (698): WARNING, bad non-variable value
*** (699): WARNING, bad non-variable value
*** (699): WARNING, bad non-variable value
*** (699): WARNING, bad non-variable value
*** (699): WARNING, bad non-variable value

image.thumb.png.a2b62ce8595eefc361e6a1f66a0c8a62.png

 

* This is such a "we have to submit to 1st party TONIGHT" type of hack workaround. ;) 

Edited by BydoEmpire
Link to comment
Share on other sites

16 hours ago, BydoEmpire said:

I believe all of my sprites are 8x16.  The same bolt pngs work fine if I rearrange the order, as do al the other weapons.  What's interesting is that all the sprites after the first two bolts are fine (the enemy sprites, for example). However, if I move the tilesets to be the last thing included, it hangs on boot.

 

As a test, before the first bolt graphic, try adding a "newbank". This will end the graphics bank prematurely and move those two bolts into the same bank that contains the other bolts. See if the corruption stops with that.

 

  • Thanks 1
Link to comment
Share on other sites

5 hours ago, Mord said:

 

As a test, before the first bolt graphic, try adding a "newbank". This will end the graphics bank prematurely and move those two bolts into the same bank that contains the other bolts. See if the corruption stops with that.

 

Gives me a compilation error:
 

d:\dev\a7800\7800basic\fantasy\fantasy7800>7800bas fantasy.bas
7800basic v0.16 Nov 21 2020 15:38:56
*** (699): ERROR, unknown keyword 'newbank'.
Compilation failed.
d:\dev\a7800\7800basic\fantasy\fantasy7800>

 

Is this a command in a newer version of 7800 basic?  IDK which one I'm using, but I didn't see it in the docs.

Edited by BydoEmpire
Link to comment
Share on other sites

I think Mord was referring to newblock, which ends the current graphics block, and moves on to the next one.

 

Regarding the "WARNING, bad non-variable value" entries, I think it's possible your source code has somehow gotten some weird non-printable characters in it. ADS sometimes does this when you copy and paste text.

 

The problem doesn't seem easily fixed from the ADS side. If you're up to it, you could PM me a zipped copy of your source directory, and I can see if I can get 7800basic to filter out the bad characters. (assuming I'm right here, about the issue you're seeing.)

  • Thanks 1
Link to comment
Share on other sites

6 hours ago, RevEng said:

I think Mord was referring to newblock, which ends the current graphics block, and moves on to the next one.

 

Regarding the "WARNING, bad non-variable value" entries, I think it's possible your source code has somehow gotten some weird non-printable characters in it. ADS sometimes does this when you copy and paste text.

 

The problem doesn't seem easily fixed from the ADS side. If you're up to it, you could PM me a zipped copy of your source directory, and I can see if I can get 7800basic to filter out the bad characters. (assuming I'm right here, about the issue you're seeing.)

Adding a newblock worked!  Thanks so much!

 

Is there any limit to how often or in what situations you can or should use newblock?

 

FWIW, I zipped up my whole source folder and PM'd you.

Edited by BydoEmpire
Link to comment
Share on other sites

27 minutes ago, BydoEmpire said:

Is there any limit to how often or in what situations you can or should use newblock?

newblock should definitely be used to fix a particular situation, as indiscriminate use will burn through your graphics space in the rom. For certain purposes, you need to keep graphics together in the same block - e.g. all tile graphics need to be together in the same block together. e.g. all animation frames for a sprite need to be in the same block.

 

To accomplish that you need to paying attention to where the 7800basic compile message say your graphics went. To group certain graphics together, you put the related incgraphic commands together. When you have a sprite animation straddling two blocks, you can use "newblock" in front of them to shove them all into the new block. (it would be good to see how much space you lost that way, and if it's substantial, then stick some other small graphics before the "newblock")

 

Hopefully that makes sense.

  • Thanks 1
Link to comment
Share on other sites

Yeah, newblock was what I meant - been so long since I've used it myself.  Last time I used it for debugging I remember making the newbank typo myself.  Regardless it's best to try to avoid using newblock unless you have nothing new to add to the existing block.  Using it for debugging odd errors like this can be helpful however!

 

If you use it to sort graphics to different blocks, just remember to remove it when the bank it's trying to closed is completely full of graphics or it'll close off a different block instead and result in odd out of space errors despite having a completely empty block of graphics.

 

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...