Author Topic: Strange bug  (Read 2479 times)

0 Members and 1 Guest are viewing this topic.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Strange bug
« on: December 22, 2010, 03:03:34 pm »
Ok, so working on The Blue Platform, my menu routine stopped working, even though I hadn't touched it. what happens is that, when I go past the second menu item it just quits, but when I debug I can't seem to figure out why. So I'm going to the community for support, here is the program with a di \ halt right after a keypress, so to figure out how this happens, load it in an emulator, run it and press down, it will just do what I'm showing in the screenshot. Here is the code http://eeems.pastebin.com/bcaWfMt2

EDIT: ok, found where the error is happening, call menusete, when it is called for the second time after pressing down (to draw the new hand thing, first is to erase it) instead of calling the correct routine it just crashes out of the program, no idea why.
Code: [Select]
menupickdraw:
push bc ;don't want to effect
push af ;all the registers
push hl ;so lets push them onto the stack
ld a,6 ;lets now set the correct x location
;--------------------------------------------------------------------------------------
call menusete ;and y <<---------HERE
;--------------------------------------------------------------------------------------
ld b,8 ;and width
ld ix,menupicker ;and give it the right sprite
call putSprite8xb ;draw it now!
pop hl ;and now we restore
pop af ;all the registers
pop bc ;back to normal that we need
ret ;routine done!
« Last Edit: December 22, 2010, 03:18:54 pm by Eeems »
/e

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Strange bug
« Reply #1 on: December 22, 2010, 03:24:18 pm »
thepenguin77 found the bug for me, I had a djnz _ where I should have had a djnz -_ in menusete :P feeling a little stupid
/e

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Strange bug
« Reply #2 on: December 22, 2010, 03:28:25 pm »
I'm confused what is going on with the labels in this program, it seems you have 3 or more labels named _ ?  2 of which are both inside your menusete sub.

EDIT: Oh okay :P

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Strange bug
« Reply #3 on: December 22, 2010, 03:31:52 pm »
I'm confused what is going on with the labels in this program, it seems you have 3 or more labels named _ ?  2 of which are both inside your menusete sub.

EDIT: Oh okay :P
yeah, I'm using SPASM, so I'm using it's relative labels feature. Any label _ is relative so to access it you just do
Quote
--_ : two prior
-_ : previous
+_ or _ : next
++_ : next after next
http://www.revsoft.org/phpBB3/viewtopic.php?f=21&t=685&sid=a8c9b56532b80d07c3bf302543fa7af5
/e

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Strange bug
« Reply #4 on: December 22, 2010, 03:32:36 pm »
Ooooh i see, well that would be the issue then XD