Sonic and Sega Retro Message Board: Basic Questions & Answers thread - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

Basic Questions & Answers thread NEWBIES: Start here!

#856 User is offline FraGag 

Posted 19 December 2008 - 03:17 PM

  • Posts: 630
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6

View PostMalevolence, on Dec 18 2008, 03:45 PM, said:

Syntax Highlighted Code: ASM
	[color= #00bfff;]jsr[/color]	RandomNumber
[color= #00bfff;]andi[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color][color= #ff0000;]1[/color],d0
[color= #00bfff;]tst[/color].[color= #00bfff;]b[/color] d0
[color= #00bfff;]beq[/color].[color= #00bfff;]s[/color] Routine
[color= #00bfff;]bra[/color].[color= #00bfff;]s[/color] OtherRoutine


I believe that should work.

You don't need to put the TST here, as the ANDI instruction will set the flags the same way TST would, making the TST redundant. Also, you won't need the last BRA if the code is directly after.

#857 User is offline Anthall 

Posted 19 December 2008 - 04:04 PM

  • Spambot
  • Posts: 235
  • Joined: 21-August 08
  • Gender:Male
  • Location:Leicester, UK
  • Project:Sonic the Hedgehog - The Final Showdown
  • Wiki edits:60
Thanks Malevolence and FraGag for your help. I have 2 questions though.

1. Is it possible to have more than two outcomes?

2. What does the #1 mean?

Thanks

#858 User is offline Malevolence 

Posted 19 December 2008 - 04:17 PM

  • Posts: 272
  • Joined: 13-March 08
  • Gender:Male
  • Wiki edits:12
It is possible to have more than one but you're going to have to make a whole table. The 1 makes sure that the result is either 1 or 0 (if you do an and 1 to the value of 0111 you'll get a 0001, if you do it to the value of 0110 you'll get a 0, and takes a value in binary and keeps all bits that are the same in both values).

#859 User is offline nineko 

Posted 19 December 2008 - 04:32 PM

  • I am the Holy Cat
  • Posts: 5238
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Is the andi really needed, since tst will check one bit anyway?

#860 User is offline FraGag 

Posted 19 December 2008 - 04:45 PM

  • Posts: 630
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6

View Postnineko, on Dec 19 2008, 04:32 PM, said:

Is the andi really needed, since tst will check one bit anyway?

You're confusing BTST and TST. TST will test the whole operand (according to its size attribute), while BTST will test a single bit, which is specified in the left operand.

Anthall, if your number of outcomes is a power of 2 (2, 4, 8, 16, etc.), it's quite easy to set up:
Syntax Highlighted Code: ASM
		[color= #00bfff;]jsr[/color]	RandomNumber	[color= #adadad; font-style: italic;]; call the pseudo-random number generator[/color]
[color= #00bfff;]andi[/color].[color= #00bfff;]b[/color] [color= #ff0000;]#[/color]xx,d0 [color= #adadad; font-style: italic;]; restrict the number to a valid range[/color]
[color= #00bfff;]move[/color].[color= #00bfff;]w[/color] RandomJumps(pc,d0.[color= #00bfff;]w[/color]),d0
[color= #00bfff;]jsr[/color] RandomJumps(pc,d0.[color= #00bfff;]w[/color]) [color= #adadad; font-style: italic;]; call a random jump routine[/color]
[color= #adadad; font-style: italic;]; code continues here[/color]
 
RandomJumps:
[color= #00bfff;]dc[/color].[color= #00bfff;]w[/color] RandomJump1-RandomJumps
[color= #00bfff;]dc[/color].[color= #00bfff;]w[/color] RandomJump2-RandomJumps
[color= #00bfff;]dc[/color].[color= #00bfff;]w[/color] RandomJump3-RandomJumps
[color= #00bfff;]dc[/color].[color= #00bfff;]w[/color] RandomJump4-RandomJumps
 
RandomJump1:
[color= #adadad; font-style: italic;]; code here[/color]
[color= #00bfff;]rts[/color] [color= #adadad; font-style: italic;]; don't forget the rts![/color]
[color= #adadad; font-style: italic;]; do the same for all other RandomJump routines[/color]

In the code above, replace xx with (the number of outcomes - 1) * 2 (still assuming it's a power of 2), e.g. for 16 outcomes, use (16-1)*2 = 30 (or $1E in hex). If the number of outcomes isn't a power of 2, you'll have to use a modulo instead of ANDI; use the DIVU instruction for that (which is much slower).

#861 User is offline nineko 

Posted 19 December 2008 - 05:03 PM

  • I am the Holy Cat
  • Posts: 5238
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251

View PostFraGag, on Dec 19 2008, 10:45 PM, said:

View Postnineko, on Dec 19 2008, 04:32 PM, said:

Is the andi really needed, since tst will check one bit anyway?

You're confusing BTST and TST. TST will test the whole operand (according to its size attribute), while BTST will test a single bit, which is specified in the left operand.
Right, that. BTST could have been used in this case.

#862 User is offline filmzombie 

Posted 19 December 2008 - 06:05 PM

  • The real spindash...
  • Posts: 155
  • Joined: 15-December 08
  • Gender:Male
  • Location:England- The Land of Tea
  • Project:Sonic Synthesis
I am still having trouble getting SonicED1 to load my save states properly. It keeps claiming the files are corrupted.

I will eventually work out why these Sonic 1 originals I keep loading turn out to be completely useless with my system. However, does it matter what emulator you use to save the game in the first place?

I am using Kega Fusion and it is struggling to even open Sonic 1 originals themsleves. With hacks it is completely fine.



Also- after using the save state of a hack I managed to open the actual Editor screen for SonicED, just to try messing about and practising until I gain some basic footing.

But I find the control system perplexing. Is there any other tools I'm suppossed to be using? Draw Mode...Select Mode. It seems I'm just using these to erase bits of background. And by highlighting certain pallette boxes I've so far only succeeded in making the backgrounds of certain tiles become highly distorted.


So to sum up. Two questions:

1- Is my current emulator the reason why my Sonic 1 ROM refuses to load properly?

2- Can someone give me a basic rundown of SonicED's control system?

#863 User is offline FraGag 

Posted 19 December 2008 - 06:13 PM

  • Posts: 630
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6
First off, it's SonED, not SonicED. If you have trouble using SonED, read the Readme file. You may also want to try SonED2, which doesn't require savestates, but instead requires a split disassembly (get one here: Disassemblies). If you split and build right away and don't get a working ROM, then you're not using a clean Sonic 1 ROM; search again.

#864 User is offline filmzombie 

Posted 19 December 2008 - 06:53 PM

  • The real spindash...
  • Posts: 155
  • Joined: 15-December 08
  • Gender:Male
  • Location:England- The Land of Tea
  • Project:Sonic Synthesis
All of the ReadMe Files are empty. I opened them up and my notepad just came up with a blank page.


However, I will explore SonEd2. If it doesn't use save states it will be easier.

Thanks for the advise.

#865 User is offline Thundertimi 

Posted 20 December 2008 - 08:49 AM

  • Posts: 259
  • Joined: 21-April 08
  • Gender:Male
  • Project:Sonic Retro (Artwork team)
  • Wiki edits:2
There is stupid question, but I hope I get answer.

Only thing what I can do, is art somewhat, but now im trying to learn something.

How I can make object hurt sonic?
If sonic break eggman monitor, how can I make it hurt Sonic.

Obj2E_ChkEggman:	; XREF: Obj2E_Move
		addq.b	#2,$24(a0)
		move.w	#29,$1E(a0)
		move.b	$1C(a0),d0
		cmpi.b	#1,d0; does monitor contain Eggman?
		bne.s	Obj2E_ChkSonic
		rts	; Eggman monitor does nothing


Do I need to replace that last text whit something?
Im totally newb whit this.

Or is it that simple?
This post has been edited by Thundertimi: 20 December 2008 - 08:49 AM

#866 User is offline nineko 

Posted 20 December 2008 - 09:09 AM

  • I am the Holy Cat
  • Posts: 5238
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Obj2E_ChkEggman:	; XREF: Obj2E_Move
		addq.b	#2,$24(a0)
		move.w	#29,$1E(a0)
		move.b	$1C(a0),d0
		cmpi.b	#1,d0; does monitor contain Eggman?
		bne.s	Obj2E_ChkSonic
		move.l	a0,a1
		move.l	a0,-(sp)
		lea	($FFFFD000).w,a0
		jsr	Touch_ChkHurt
		move.l	(sp)+,a0
		rts
In this way, the Eggman monitor will hurt Sonic in the same way a badnik would: if you have a shield, you'll lose the shield; if you are invincible, you won't be hurt; if you have rings, you'll lose them; if you have no rings, you'll die.
This post has been edited by nineko: 20 December 2008 - 09:10 AM

#867 User is offline Thundertimi 

Posted 20 December 2008 - 10:15 AM

  • Posts: 259
  • Joined: 21-April 08
  • Gender:Male
  • Project:Sonic Retro (Artwork team)
  • Wiki edits:2
Oh, and I just testing and learning, so how I can do this.

If I kill buzz bomber, I got hurt.

#868 User is offline Anthall 

Posted 20 December 2008 - 10:17 AM

  • Spambot
  • Posts: 235
  • Joined: 21-August 08
  • Gender:Male
  • Location:Leicester, UK
  • Project:Sonic the Hedgehog - The Final Showdown
  • Wiki edits:60

View PostThundertimi, on Dec 20 2008, 03:15 PM, said:

Oh, and I just testing and learning, so how I can do this.

If I kill buzz bomber, I got hurt.


Try this:

Obj2E_ChkEggman:			; XREF: Obj2E_Move
		addq.b	#2,$24(a0)
		move.w	#29,$1E(a0)
		move.b	$1C(a0),d0
		cmpi.b	#1,d0		; does monitor contain Eggman?
		bne.s	Obj2E_ChkXXXX
		tst.b	($FFFFFE2D).w	; is Sonic invincible?
		bne.s	ChkEggmanNO	; if yes, branch
		tst.w	($FFFFD030).w	; is Sonic invulnerable?
		bne.s	ChkEggmanNO	; if yes, branch
		lea	($FFFFD000).w,a0
		jsr	HurtSonic
 
ChkEggmanNO:
		rts


Change XXXX to the name of the monitor after this code.
This post has been edited by Anthall: 20 December 2008 - 10:27 AM

#869 User is offline Thundertimi 

Posted 20 December 2008 - 11:29 AM

  • Posts: 259
  • Joined: 21-April 08
  • Gender:Male
  • Project:Sonic Retro (Artwork team)
  • Wiki edits:2
Thanx guys, now I understand some stuff.

#870 User is offline Anthall 

Posted 20 December 2008 - 11:50 AM

  • Spambot
  • Posts: 235
  • Joined: 21-August 08
  • Gender:Male
  • Location:Leicester, UK
  • Project:Sonic the Hedgehog - The Final Showdown
  • Wiki edits:60
Almost forgot:

Thank you FraGag and Malevolence for your help!

Now I can add some intresting ideas to my hack!
This post has been edited by Anthall: 20 December 2008 - 11:51 AM

  • 311 Pages +
  • ◄ First
  • 56
  • 57
  • 58
  • 59
  • 60
  • Last ►
    Locked
    Locked Forum

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

  1. Bing