So I Was Trying to Make Multipe Charaters have a defernt level order, but when i Build i get this as an error SN 68k version 2.53 G:\HACK\SOURCE CODE 0.07\SONIC1.ASM(18226) : Error : Illegal value (198) G:\HACK\SOURCE CODE 0.07\SONIC1.ASM(18236) : Error : Illegal value (134) Assembly completed. 2 error(s) from 61610 lines in 2.98 seconds So I did the logical thing i look up 5 differnt guids as how to fix this but non of them worked Here is the Code: Obj3A_NextLevelCont: move.b ($FFFFFE10).w,d0 andi.w #7,d0 lsl.w #3,d0 move.b ($FFFFFE11).w,d1 andi.w #3,d1 add.w d1,d1 add.w d1,d0 cmpi.b #$1,($FFFFFFFE).w ; is Game mode1? beq.s Next1Level ; if yes, branch move.w LevelOrder(pc,d0.w),d0 ; load level from level order array jsr Obj3A_NextLevelcont2 Next1Level: cmpi.b #$1,($FFFFFF8B).w ; is P2? beq.s NextP2Level ; if yes, branch move.w Level1Order(pc,d0.w),d0 ; load level from original level order array jsr Obj3A_NextLevelcont2 NextP2Level: cmpi.b #$2,($FFFFFFFE).w ; is Demo verson? beq.s NextDemoLevel move.w LevelOrderT(pc,d0.w),d0 jsr Obj3A_NextLevelcont2 NextDemoLevel: move.w LevelOrderD(pc,d0.w),d0 Obj3A_NextLevelcont2: move.w d0,($FFFFFE10).w ; set level number tst.w d0 bne.s Obj3A_ChkSS move.b #0,($FFFFF600).w ; set game mode to level (00) Can Anyone help? And Yes I Do Have The files in correctly
Two things. First, slow down and try to clean up your English. No one can help you if they can't understand what you're asking. Second, it's harder for people to identify your issue when we can't see what lines correspond to the line numbers given by the errors.
Code branched from jsr and bsr jump back to the code that contained the jsr and bsr after the code being branched to hits an rts. Use jmp or bra instead. Also, those jsr's are unnecessary because they should be used only to jump across large amounts of code. So basically replace each jsr with bra.s.
We're going to need to see two things, mainly what line 18226 and 18236 are. Chances are that they're branch errors, but to find the correct line, it should be Ctrl+G in most editors.
I believe LevelOrder and Level1Order are too far from the instructions requesting them. Simplest solution to avoid this is to do something like this: Code: lea LevelOrder,a0 move.w (a0,d0.w),d0
Open your ASM file, and go to the line the error is reporting. For example: See that number in brackets? That's the line the error is on. So open your ASM file and Go To Line (Edit > Go To... / Ctrl+G in notepad and notepad 2) and put that number in. It will then take you to the line where the error is. Can you reply and post that line of code here? Do the same for both lines/errors. Then we know what we are looking at EDIT: Just noticed a double thread occured, even though they were 12 hours apart?! Anyway, merged them both together.
So then the code for the error lines are lsl.w #3,d0 and beq.s Next1Level ; if yes, branch But I found out that. LevelOrderT: incbin misc\lvl_ord_t.bin even LevelOrderD: incbin misc\lvl_ord_d.bin even Are the main cause for this Also how do you make code box?
So i tried this method and it worked, but now it does this to me after I beat a level. This was emulated on Kega Fussion Here is my newly coded code. Code: Obj3A_NextLevelCont: move.b ($FFFFFE10).w,d0 andi.w #7,d0 lsl.w #3,d0 move.b ($FFFFFE11).w,d1 andi.w #3,d1 add.w d1,d1 add.w d1,d0 cmpi.b #$1,($FFFFFFFE).w ; is Game mode1? beq.s Next1Level ; if yes, branch lea LevelOrder,a0 ; load level from level order array move.w (a0,d0.w),d0 bra.s Obj3A_NextLevelcont2 Next1Level: cmpi.b #$1,($FFFFFF8B).w ; is P2? beq.s NextP2Level ; if yes, branch lea Level1Order,a0 ; load level from original level order array move.w (a0,d0.w),d0 bra.s Obj3A_NextLevelcont2 NextP2Level: cmpi.b #$2,($FFFFFFFE).w ; is Demo verson? beq.s NextDemoLevel lea LevelOrder,a0 move.w (a0,d0.w),d0 bra.s Obj3A_NextLevelcont2 NextDemoLevel: lea LevelOrder,a0 move.w (a0,d0.w),d0 Obj3A_NextLevelcont2: move.w d0,($FFFFFE10).w ; set level number tst.w d0 bne.s Obj3A_ChkSS move.b #0,($FFFFF600).w ; set game mode to level (00) ; =========================================================================== Obj3A_ChkSS: ; XREF: Obj3A_NextLevel clr.b ($FFFFFE30).w ; clear lamppost counter tst.b ($FFFFF7CD).w ; has Sonic jumped into a giant ring? beq.s loc_C6EA ; if not, branch move.b #$10,($FFFFF600).w ; set game mode to Special Stage (10) bra.s Obj3A_Display2 ; =========================================================================== loc_C6EA: ; XREF: Obj3A_ChkSS move.w #1,($FFFFFE02).w ; restart level Obj3A_Display2: ; XREF: Obj3A_NextLevel, Obj3A_ChkSS bra.w DisplaySprite ; =========================================================================== ; --------------------------------------------------------------------------- ; Level order array ; --------------------------------------------------------------------------- LevelOrderT: incbin misc\lvl_ord_t.bin even LevelOrderD: incbin misc\lvl_ord_d.bin even LevelOrder: incbin misc\lvl_ord.bin even Level1Order: incbin misc_o\lvl_ord.bin even
Your screenshot is too big, and just pasting code you think may be the problem is about as helpful as wearing a blindfold while working on power lines. That little bit of white text on the left of the screen that's cut off due to running off-screen leftward? Gives a lot more helpful information than you think. Get a screenshot with the entire error, implement a debugger (flamewing's is quite popular), or if you really want to be weird, provide a savestate. Hell, even providing a ROM is somewhat helpful. You haven't provided much context, leaving bug identification to guesses by people that can make educated guesses based on the limited amount of symptoms you've provided. On another note, I'm getting the sense that you're just throwing things at the code to see if they work, rather than stopping and actually trying to understand. That won't end well for you. Slow down, learn what you're working with, and understand what's going on rather than relying on guides.
Sorry, That is just my resolution of my screen, I have a flat screen tv for a computer monitor, Next time i'll try and make it smaller.
The resolution of your screen is totally irrelevant if you take screenshots in a sane way. See here. One of the images is down, but you should get the point.
There was a "bra.s Obj3A_Display2" missing which may or may not have been responsible for the game crashing, additionally, the only two things I can see that may be wrong, is that "LevelOrderD" and "LevelOrderT" (I'm assuming that's P2) aren't ever read by the code, I assume you used "LevelOrder" as a placeholder? Anyway, the only other possible reason for the crash would be if those level order files contain a level zone/act ID which doesn't exist. Below is a revised and optimised version of what I'm "assuming" is the way you intended your checks, this below will only crash if you have a level zone/act ID in the level order files which doesn't exist yet. Any other crashing will be located elsewhere. Code: andi.w #3,d1 add.w d1,d1 add.w d1,d0 lea (LevelOrder).l,a0 ; load normal level order address move.b ($FFFFFFFE).w,d2 ; load game mode subq.b #$01,d2 ; minus 1 bmi.s Obj3A_NextLevelcont2 ; if it was 00, branch lea (Level1Order).l,a0 ; load mode 1 level order address tst.b ($FFFFFF8B).w ; has P2 been set? beq.s Obj3A_NextLevelcont2 ; if not, branch for mode 1 lea (LevelOrderT).l,a0 ; load P2 level order address (I assume "T" is P2?) tst.b d2 ; is this the Demo version? beq.s Obj3A_NextLevelcont2 ; if not, branch lea (LevelOrderD).l,a0 ; load Demo level order address Obj3A_NextLevelcont2: move.w (a0,d0.w),d0 move.w d0,($FFFFFE10).w ; set level number tst.w d0 bne.s Obj3A_ChkSS move.b #0,($FFFFF600).w ; set game mode to level (00) bra.s Obj3A_Display2 ; =========================================================================== Obj3A_ChkSS: ; XREF: Obj3A_NextLevel clr.b ($FFFFFE30).w ; clear lamppost counter tst.b ($FFFFF7CD).w ; has Sonic jumped into a giant ring? beq.s loc_C6EA ; if not, branch move.b #$10,($FFFFF600).w ; set game mode to Special Stage (10) bra.s Obj3A_Display2 ; =========================================================================== loc_C6EA: ; XREF: Obj3A_ChkSS move.w #1,($FFFFFE02).w ; restart level Obj3A_Display2: ; XREF: Obj3A_NextLevel, Obj3A_ChkSS bra.w DisplaySprite ; =========================================================================== ; --------------------------------------------------------------------------- ; Level order array ; --------------------------------------------------------------------------- LevelOrderT: incbin misc\lvl_ord_t.bin even LevelOrderD: incbin misc\lvl_ord_d.bin even LevelOrder: incbin misc\lvl_ord.bin even Level1Order: incbin misc_o\lvl_ord.bin even
I've been meaning to bite this topic, but been too lazy. Anywho, I would like to also offer a potential fix to your problem. Bear in mind, this code will only work properly if you've reverted all the code changes related to this back to stock. 1. replace Code: lea LevelOrder(pc),a1 with Code: bsr.w LevelOrder_PerCharacter 2.Then add this right above the LevelOrder. Code: ;=============================================================================== LevelOrder_PerCharacter: moveq #0,d1 ; set d1 to 0 move.b ($FFFFFFFE).w,d1 ; Character RAM is set as d1 variable lsl.b #6,d1 ; Math for table below lsr.w #4,d1 ; Same as above movea.l LevelOrderSequences(pc,d1.l),a1 rts ;------------------------------------------------------------------------------- LevelOrderSequences: dc.l LevelOrderT ; Sonic dc.l LevelOrderT ; Tails dc.l LevelOrderD ; Cocksucker McGee the Idiot of the West ;------------------------------------------------------------------------------- nop I give this version of the fix as it is cleaner. Also, it introduces a table, as there isn't a constant need to add in all of those checks like..... Code: cmpi.b #01,$FFFFFFFE ;check if it's Tails bsr.w DildoLevelCheck ; if so, go change whatever to whatever cmpi.b #02,$FFFFFFFE ;check if it's Cocksucker McGee the Idiot of the West bsr.w DildoLevelCheck2 ; if so, go change whatever to whatever part 2 Now you have a table that is only limited to how many characters you add.
Markey Jester I Really Like your Code as it is almost exactly what I had in mind. And your Explanation for why it does it is the best answer I find the most right. LevelOrderD was a mode that made it load the levels from the Sonic Hacking Contest 2015 build, not a character.
That doesn't even fucking make sense. I've been quiet about your complete stupidity and lack of ability to even understand the basics of asm68k as I've been VERY gererous as of recent. But let's have some real talk here. Talking with Markey, my code has an issue as it uses the Demo Mode RAM, a leftover issue of the shitty "Multiple Character" tutorial that you and all these newb idiot cunts use blindlessly and never bother learning how to use. The code I have prepared is adapted to the best of the shit you have provided, thought it could be optimized better. I used the RAM addresses you use. Please, don't be a cunt. I have this shit implemented in Sonic 2 working perfectly, albeit using the Character RAM as opposed, you know, like how it chooses multiple characters in the options menu. It's obvious you don't understand code or how to read code. The code I provided doesn't load characters, it loads level orders per character using the RAM address that tracks the characters. Once more, just using what you have provided. Third point. How does Markey's ass smell? With how much brown nosing you do, it's almostt impossible for you not to know. I'm not mad that you went with Markey's code, or that you didn't use mine. I'm mad that you're a cunt who is dumb as fucking bricks that insulted my intelligence. I know what my code does, do you? Apparently not. Learn how to code and stop asking people every three seconds for every line you need help with.
I'm Sorry If I upset you Super Egg, besides I figured it out, one of the lever orders was causing it to crash, so i removed it Every thing is working the way it should be. I Also implemented a debugger to my hack, so I can Fix the bugs. Also I didn't use Markey Jesters code, but I liked his reason for why it was crashing