Sonic and Sega Retro Message Board: Problem with SonLVL (Sonic 2 GitHub disassembly) - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

Problem with SonLVL (Sonic 2 GitHub disassembly) readme.txt doesn't help

#1 User is offline Trinitronity 

Posted 25 January 2016 - 03:47 PM

  • Posts: 20
  • Joined: 21-January 16
So I was starting to make a small ROM hack of Sonic 2, and my first step was to change pallettes and names of Zones before going into the more meaty stuff.
Now the problem is: Whenever I press "Build & Run" in order to test my hack in its current form, I get this error on the s2.log file:
> > >s2.asm(26622): error: symbol undefined
> > > Off_TitleCardLetters
> > > 	move.b	Off_TitleCardLetters(pc,d0.w),d0
> > >s2.asm(26622): error: addressing mode not allowed here
> > > 	move.b	Off_TitleCardLetters(pc,d0.w),d0

So I went to the offending place, and found this:
LoadTitleCard:
	bsr.s	LoadTitleCard0
	moveq	#0,d0
	move.b	(Current_Zone).w,d0
	move.b	Off_TitleCardLetters(pc,d0.w),d0
	lea	TitleCardLetters(pc),a0
	lea	(a0,d0.w),a0
	move.l	#vdpComm(tiles_to_bytes(ArtTile_LevelName),VRAM,WRITE),d0

And to be honest: I really don't understand what's going on here, but it was like that in the original disassembly, so technically, it shouldn't give any problems.
But it does... -_-
So I would be glad if someone could tell me what going on here and how I could fix my problem. Thanks in advance!
This post has been edited by Trinitronity: 25 January 2016 - 03:47 PM

#2 User is offline MainMemory 

Posted 25 January 2016 - 03:53 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 4137
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
OK, first off, this problem isn't even remotely related to SonLVL. Secondly, look below the LoadTitleCard routine, you should see something like this:
; byte_15820:
Off_TitleCardLetters:
	dc.b TitleCardLetters_EHZ - TitleCardLetters	; 0
	dc.b TitleCardLetters_EHZ - TitleCardLetters	; 1
	dc.b TitleCardLetters_EHZ - TitleCardLetters	; 2
	dc.b TitleCardLetters_EHZ - TitleCardLetters	; 3
	dc.b TitleCardLetters_MTZ - TitleCardLetters	; 4
	dc.b TitleCardLetters_MTZ - TitleCardLetters	; 5
	dc.b TitleCardLetters_WFZ - TitleCardLetters	; 6
	dc.b TitleCardLetters_HTZ - TitleCardLetters	; 7
	dc.b TitleCardLetters_HPZ - TitleCardLetters	; 8
	dc.b TitleCardLetters_EHZ - TitleCardLetters	; 9
	dc.b TitleCardLetters_OOZ - TitleCardLetters	; A
	dc.b TitleCardLetters_MCZ - TitleCardLetters	; B
	dc.b TitleCardLetters_CNZ - TitleCardLetters	; C
	dc.b TitleCardLetters_CPZ - TitleCardLetters	; D
	dc.b TitleCardLetters_DEZ - TitleCardLetters	; E
	dc.b TitleCardLetters_ARZ - TitleCardLetters	; F
	dc.b TitleCardLetters_SCZ - TitleCardLetters	; 10
	even

 ; temporarily remap characters to title card letter format
 ; Characters are encoded as Aa, Bb, Cc, etc. through a macro
 charset 'A',0	; can't have an embedded 0 in a string
 charset 'B',"\4\8\xC\4\x10\x14\x18\x1C\x1E\x22\x26\x2A\4\4\x30\x34\x38\x3C\x40\x44\x48\x4C\x52\x56\4"
 charset 'a',"\4\4\4\4\4\4\4\4\2\4\4\4\6\4\4\4\4\4\4\4\4\4\6\4\4"
 charset '.',"\x5A"

; Defines which letters load for the continue screen
; Each letter occurs only once, and  the letters ENOZ (I.e. ZONE) aren't loaded here
; However, this is hidden by the titleLetters macro, and normal titles can be used
; (the macro is defined near SpecialStage_ResultsLetters, which uses it before here)

; word_15832:
TitleCardLetters:

TitleCardLetters_EHZ:
	titleLetters	"EMERALD HILL"

And so on. My best guess is that something you did removed or renamed the 'Off_TitleCardLetters' label.

#3 User is offline Trinitronity 

Posted 26 January 2016 - 04:37 AM

  • Posts: 20
  • Joined: 21-January 16
Well, I have this:
; byte_15820:
	include	"TitleCards_Setup.asm"
; word_15832:
TitleCardLetters:

Which was the result of me trying to change the level names with Selbi's text editor:
http://info.sonicret..._Code_Generator
If this is a bad thing, then tough luck, this is the only way for me to change zone names.

#4 User is offline MainMemory 

Posted 26 January 2016 - 11:09 AM

  • Every day's the same old thing... Same place, different day...
  • Posts: 4137
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
You were following the 2007 guide for zone title cards, you should have followed the Hg guide. The disassembly now on GitHub used to be hosted on a Mercurial (Hg) repository, and an SVN repository before that, so GitHub, Git, Hg, and SVN all refer to the same disassembly. Although it appears that Selbi only describes the setup for the letters to be loaded in Hg if you click on the "?" button in the editor, not in the setup guide.

Just replace the 'include "TitleCards_Setup.asm"' with the part from the original disassembly that I posted earlier and type in the zone name below.

#5 User is offline Trinitronity 

Posted 26 January 2016 - 11:39 AM

  • Posts: 20
  • Joined: 21-January 16
Wait, HG guide? What do you mean?
I hope you don't mean the one where I have to use SonMapEd or Flex in order to change level names, because I really cannot use those programs. I just can't.

#6 User is offline MainMemory 

Posted 26 January 2016 - 12:25 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 4137
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
No, in S2TCG, there are sections for 2007 and Hg. At least, there should be if it's recent enough.

#7 User is offline Trinitronity 

Posted 26 January 2016 - 01:53 PM

  • Posts: 20
  • Joined: 21-January 16
Ah, okay.
I now replaced the old part with what you posted, and now I get this error:
> > >s2.asm(20964): error: jump distance too big
> > > 	bsr.w	SingleObjLoad2

So I took a look at the code again, and...
; loc_10372:
Obj17_MakeHelix:
	bsr.w	SingleObjLoad2
	bne.s	Obj17_Main
	addq.b	#1,subtype(a0)
	move.w	a1,d5
	subi.w	#Object_RAM,d5
    if object_size=$40
	lsr.w	#6,d5
    else
	divu.w	#object_size,d5
    endif
	andi.w	#$7F,d5
	move.b	d5,(a2)+
	move.b	#4,routine(a1)
	_move.b	d4,id(a1) ; load obj17
	move.w	d2,y_pos(a1)
	move.w	d3,x_pos(a1)
	move.l	mappings(a0),mappings(a1)
	move.w	#make_art_tile(ArtTile_ArtNem_GHZ_Spiked_Log,2,0),art_tile(a1)
	bsr.w	Adjust2PArtPointer2
	move.b	#4,render_flags(a1)
	move.b	#3,priority(a1)
	move.b	#8,width_pixels(a1)
	move.b	d6,objoff_3E(a1)
	addq.b	#1,d6
	andi.b	#7,d6
	addi.w	#$10,d3
	cmp.w	x_pos(a0),d3
	bne.s	+
	move.b	d6,objoff_3E(a0)
	addq.b	#1,d6
	andi.b	#7,d6
	addi.w	#$10,d3
	addq.b	#1,subtype(a0)
+	dbf	d1,Obj17_MakeHelix ; repeat d1 times (helix length)

Well, let's say I have absolutely no idea why I get the error...
Would be glad if someone could help me.

#8 User is offline Clownacy 

Posted 26 January 2016 - 02:05 PM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
I googled 'error: jump distance too big' and got a pretty good answer.

#9 User is offline Trinitronity 

Posted 26 January 2016 - 04:17 PM

  • Posts: 20
  • Joined: 21-January 16
Hmm...but the thing is: I never added any new object. Heck, I didn't even change the level layouts yet, so why does it happen? I'm confused...

#10 User is offline Clownacy 

Posted 26 January 2016 - 05:40 PM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
Obj17, being a leftover from S1, is one of the first objects in the game's code; SingleObjLoad2 comes after the last object's code. In the Git disasm, between Obj17_MakeHelix and SingleObjLoad2, there're 10000 lines of code. The title cards/level results object sit right between them, around the 5000 mark. Your new sprite mappings are probably what increased that gap.

#11 User is offline Trinitronity 

Posted 27 January 2016 - 03:29 AM

  • Posts: 20
  • Joined: 21-January 16
Well, I checked, and the only thing changed between Obj17_MakeHelix and the SingleObjLoad2 after Obj17_MakeHelix' SingleObjLoad2 is word_15832, and even then the only thing I changed there are the names.
Some of the new names are shorter than the old names, and some new names are longer than the old names.
Anyway, how exactly do I increase the distance of the branches? Add empty code? And if yes, then where?

#12 User is offline Natsumi 

Posted 27 January 2016 - 05:54 AM

  • Miss Fox
  • Posts: 168
  • Joined: 08-February 12
  • Gender:Female
  • Location:Otter's lap
  • Project:Being with my boyfriend
read the link Clownacy gave earlier on the thread. It answers your question.

#13 User is offline Trinitronity 

Posted 27 January 2016 - 05:56 AM

  • Posts: 20
  • Joined: 21-January 16
I did read the link, and I found this:

Quote

Increase the distance of the branches.

But the thing is: I don't know how to do that. Like, at all. Do I have to insert empty code somewhere in order to increase the distance of the branches or what?

#14 User is offline Clownacy 

Posted 27 January 2016 - 06:33 AM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 696
  • Joined: 06-July 13
  • Gender:Not Telling
Read more, geez. Also,

Quote

Some of the new names are shorter than the old names, and some new names are longer than the old names.

Well, there's your problem. The names count as data, too. You may have shortened some of them, but the longer ones probably took up whatever space you saved, and then some.
This post has been edited by Clownacy: 27 January 2016 - 06:40 AM

#15 User is offline Trinitronity 

Posted 27 January 2016 - 08:05 AM

  • Posts: 20
  • Joined: 21-January 16
Hmm, so I have to implement jumps by replacing the offending bsr with a jsr.
Sadly, this gives me this message now:
> > >s2.asm(20964): error: invalid operand size
> > > 	jsr.w	SingleObjLoad2

Sorry if I'm asking stupid questions, but it's the first time I'm doing fullblown ASM, and it really takes me a while to understand certain things, so sorry.

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users