Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    Why do I get this I belive you should be able to shift by 8 just fine



    Code:
    
    Error : Illegal addressing mode
    
    lsl.w #8,d7
    
    
    Edit it appears that this is only caused using a macro I am using asm68k when just doing this without macro there are no errors but when using a macro I get an error why is that here are my macro's

    Fix16 means fixed point math each varible is 16 bits 8 for whole number and 8 for decimal.



    Code:
    
    fixu16:			macro whole,decimal
    
    	(whole>>8)+decimal;left shift the whole by 8 to form an 8.8 fixed16 varible
    
    	endm
    
    
    
    ;adding and subtracting are the same they do not need any special macros
    
    
    
    fixu16_multiply_varible_times_fixed:	macro in_out,whole,decimal
    
    	mulu.w	#(whole>>8)+decimal,in_out
    
    	lsr.l	#8,in_out
    
    	endm
    
    fixedu16_multply_two_varible		macro in_one,in_two
    
    				;outputs on two
    
    	mulu.w	in_one,in_two
    
    	lsr.l	#8,in_two
    
    	endm
    
    register_to_fixu16:	macro in
    
    	lsl.w	#8,in
    
    	endm
    
    fixu16_to_int_register:	macro in
    
    	lsr.w	#8,in
    
    	endm
    
    
     
    Last edited by a moderator: Jun 10, 2012
  2. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I believe this is caused because you have a macro within a macro, for some reason, asm68k has trouble allowing this, I hit a similar problem once...
     
  3. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    Even doing :



    Code:
    
    	register_to_fixu16 d7
    
    
    causes an error.

    When you mean macro in a macro you mean:



    Code:
    
    macro_one   macro_one_parameter,macro_two   macro_two_parameter
    
    
    Edit: fixed point is pretty easy with asm without macros so I guess I just have to accept that macros are partly broke in asm68k
     
    Last edited by a moderator: Jun 10, 2012
  4. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    Sonic master, try this:



    fixu16 macro whole,decimal
    (whole>>8)+decimal;left shift the whole by 8 to form an 8.8 fixed16 varible


    endm


    ;adding and subtracting are the same they do not need any special macros


    fixu16_multiply_varible_times_fixed: macro in_out,whole,decimal


    mulu.w #(whole>>8)+decimal,in_out


    lsr.l #8,in_out


    endm


    fixedu16_multply_two_varible macro in_one,in_two


    ;outputs on two


    mulu.w in_one,in_two


    lsr.l #8,in_two


    endm


    register_to_fixu16: macro in


    lsl.w #8,in


    endm


    fixu16_to_int_register: macro in


    lsr.w #8,in


    endm



    The problem here is that ASM68K recognizes 'd7' as a symbol, expecting it to hold some numeric value, which means the whole instruction will be treat as LSR/LSL to memory. Illegal addressing mode error occurs before undefined symbol error, because assembler doesn't check symbol names during the first pass. I don't think it's a bug, assembler just works this way, and you make it recognize 'd7' as a value.


    To fix this, put a backslash () before you use variables in your macro, and assembler will insert them as plain text instead of linking them as symbols.
     
  5. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Woops, no, I think your problem isn't the same as mine was, I wasn't reading carefully, disregard please...
     
  6. Sonic master

    Sonic master Well-Known Member Member

    Joined:
    Mar 27, 2010
    Messages:
    303
    Thank you Vliadikcomper you fixed my problem however it turns out that I was calculating fixed point wrong and the right way to do it is to simply times the value by 1<<#of fraction bits which is in my case 256 so I would times the value I want to convert to fixed point by 256 to get the correct value so I fixed my macros and it will only work with whole numbers but decimals do not work is there anyway to get decimals to work or do I just have to do it on a calculator it is not hard to do on a calculator anyways.



    Code:
    
    fixu16:			macro value
    
    	value*256;left shift the whole by 8 to form an 8.8 fixed16 varible
    
    	endm
    
    
    
    ;adding and subtracting are the same they do not need any special macros
    
    
    
    fixu16_multiply_register_times_fixed:	macro in_out,value
    
    	mulu.w	#value*256,in_out
    
    	lsr.l	#8,in_out
    
    	endm
    
    
    Edit: For me it seems that macros are causing more work not less because the names are all longer than the instructions (more typing) and there is no good way to call the macros something descriptive without a long name. Here is some code that multiplies an integer in d7 by 1.25



    Code:
    
    	lsl.w	#8,d7;convert to fixed point
    
    	mulu.w	#320,d7
    
    	lsr.l	#8,d7	;preserve the 8.8 format MUST BE LONG
    
    	lsr.w	#8,d7	;convert it back to an integer
    
    
    no macros needed.
     
    Last edited by a moderator: Jun 10, 2012
  7. Bluesfire

    Bluesfire Will Hack For Food. Member

    Joined:
    May 29, 2012
    Messages:
    23
    Location:
    Arizona.
    I am having issues editing the life icon on the 1-up box in Sonic 1. It uses a base icon and then just places tiles for the Sonic head over the base. I have no clue how to edit just the tiles for the Sonic head. I tried just replacing the whole sprite, like instead of having it use a base I just used a whole new sprite. That didn't end well. Could someone help me out?
     
  8. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Unload the mappings of the monitors, then just click the first tile of the icon and on the left in a 16x16 block you should see it. Click the box on the left and it will appear for you to edit. Export, edit, import, ????, Profit!.
     
    Last edited by a moderator: Jun 10, 2012
  9. Bluesfire

    Bluesfire Will Hack For Food. Member

    Joined:
    May 29, 2012
    Messages:
    23
    Location:
    Arizona.
    Thank you, AnimeMaster! You never cease to amaze me.


    EDIT: So I am editing the life icon and Character name. I put this into the art file:


    [​IMG]


    And get this in-game.


    [​IMG]


    How do I rid myself of the black bits around the name? They aren't on the actual sprite I made for this, and I made sure SonMapEd uses the purple I used. Is it a mappings error?


    PSEDIT: Uh. No idea why the pics uploaded to Imageshack so tiny. But I think you can understand what I mean. I put the sprite in, and got random black bits in the name.


    EDIT2: Okay. So I have started to edit the title screen. I have most of it correct, but there are two things that are going wrong.


    [​IMG]


    How do I make a yellow, and a pure black? The pallet for the title screen is so weird. I have tried that blue, green, yellow and red, and haven't gotten yellow.
     
    Last edited by a moderator: Jun 12, 2012
  10. DanielHall

    DanielHall Well-Known Member Member

    Joined:
    Jan 18, 2010
    Messages:
    860
    Location:
    North Wales
    The pictures are tiny, I can't read them.
     
  11. Captain British

    Captain British Newcomer Trialist

    Joined:
    May 23, 2012
    Messages:
    17
    Location:
    England
    I want to add the Yadorin (the pink spiky motobug fellow) from Spring Yard Zone as an enemy in the EHZ modification of my Sonic 2 hack, but I honestly have no idea where to start. Not the slightest clue. Could someone please either point me to a guide for creating/modifiying enemies or point me to the right places to look for me to figure it out on my own?
     
  12. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    NO FAN CHARACTER SHIT HERE!
     
  13. FinkMac

    FinkMac Swëdish Chef Member

    Joined:
    Jan 14, 2012
    Messages:
    54
    Location:
    Walk down the street. You will see a car. Tell the
    I have been looking everywhere of an understandable guide to modifying the level art in Sonic 1, however… I haven't come across any…


    My last attempt resulted in the levels looking like (TV static?)…


    How would I go about modifying the level art?
     
  14. Mike B Berry

    Mike B Berry A grandiose return Member

    Joined:
    Jun 6, 2012
    Messages:
    377
    Location:
    New places, newer motivation
    I use SonMapED, but there is a much simpler way to do such a thing. The Data Sega compressor and some art could work too. Currently, Im working on importing the S2B HPZ background onto Sonic 1's Title screen, Those are the programs I'll be working with. SonED2 and Tile Molester work just as well.


    Have you ever tried to customize 3 Different backdrops into one mashed BG? I have done it once, but I gave up when I couldn't Figure out how to load 3 Separate full palette sheets at the same time. But worse things have happened.


    Anyway, try these out and see where you go.
     
  15. FinkMac

    FinkMac Swëdish Chef Member

    Joined:
    Jan 14, 2012
    Messages:
    54
    Location:
    Walk down the street. You will see a car. Tell the
    I use SonMapEd for sprites… I tried to load level art, but I couldn't find the right palettes…
     
  16. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Load the level's palette in the program, so use the keys 1, 2, 3 and 4 (above the QWERTY) and they will show you the right palette on determinate pieces of tiles according the palette line they uses on the level which you loaded the art.
     
  17. Arctiq

    Arctiq OBJECTION! I WILL CROSS EXAMINE THE WITNESS' PET P Member

    Joined:
    Jun 2, 2012
    Messages:
    57
    When you're starting a hack, what should be the first thing that you should accomplish? I'm debating whether I should work on the art, the code, the levels, etc. I'm confused.
     
  18. TheJeli

    TheJeli Umm... Member

    Joined:
    Jun 20, 2011
    Messages:
    245
    Location:
    West London
    I always go for level layouts but level art may be a god place too.
     
  19. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    It depends on you goals, if you are going to completely revamp say a level's art then you may want to do that before layout editing so you can sort out your tiles,blocks, chunks, collision, etc. Then you can use your new chunks to shape your new layout. If perhaps your going for something simple(like just changing the ghz pattern) then you can start with layout.
     
    Last edited by a moderator: Jun 13, 2012
  20. Arctiq

    Arctiq OBJECTION! I WILL CROSS EXAMINE THE WITNESS' PET P Member

    Joined:
    Jun 2, 2012
    Messages:
    57
    But my hack is going to change everything from Sonic 1, also are there any tutorials on how to import objects and their textures into other levels so they will be seen and work correctly? I couldn't find any :(