ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


    Centiseconds in Sonic 1

    Share

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Centiseconds in Sonic 1

    Post  OuricoDoido on Wed Jun 01, 2011 11:33 pm



    To download the Source Code and the compiled ROM, click here:
    http://goo.gl/bphDe

    If you want add the Centiseconds in Sonic 1, follow the step below.


    In sonic1.asm, go to Hud_ChkLives and add this line:
    Code:
          bsr.s   CentiSecond


    Now below this code:
    Code:
    Hud_End:
          rts

    Add these lines:
    Code:
    CentiSecond:
          move.l   #$75400003,d0
          moveq   #0,d1
          move.b   ($FFFFFE25).w,d1 ; load   frames
          mulu.w   #$1AA,d1
          lsr.l   #8,d1
          jsr   Hud_Secs
          rts


    In \_maps\obj21.asm, change all the code by this code fully commented:
    Code:
    ; ---------------------------------------------------------------------------
    ; Sprite mappings - SCORE, TIME, RINGS
    ; ---------------------------------------------------------------------------
          dc.w byte_1C5BC-Map_obj21, byte_1C5F0-Map_obj21
          dc.w byte_1C624-Map_obj21, byte_1C658-Map_obj21
          
          ; Y-Pos, layout, VDP (2bytes - plane, pallet line (2bits), flip, mirror, first tile (11bits) - ), X-Pos
    byte_1C5BC:   dc.b $C
          dc.b $80, $D, $80, 0, 0      ; SCOR
          dc.b $80, $D, $80, $18,   $20   ; E + score left numbers
          dc.b $80, $D, $80, $20,   $40   ; score right numbers
          dc.b $90, $D, $80, $10,   0   ; TIME
          dc.b $90, $D, $80, $28,   $28   ; minutes : seconds
          dc.b $90, 1, $80, $2A, $48   ; :
          dc.b $90, 5, $80, $E0, $50   ; centiseconds
          dc.b $A0, $D, $80, 8, 0      ; RING
          dc.b $A0, 1, $80, 0, $20   ; S
          dc.b $A0, 9, $80, $30, $30   ; number of rings
          dc.b $40, 5, $81, $A, 0      ; lives icon
          dc.b $40, $D, $81, $E, $10   ; lives counter
          dc.b 0
    byte_1C5F0:   dc.b $C
          dc.b $80, $D, $80, 0, 0      ; SCOR
          dc.b $80, $D, $80, $18,   $20   ; E + score left numbers
          dc.b $80, $D, $80, $20,   $40   ; score right numbers
          dc.b $90, $D, $80, $10,   0   ; TIME
          dc.b $90, $D, $80, $28,   $28   ; minutes : seconds
          dc.b $90, 1, $80, $2A, $48   ; :
          dc.b $90, 5, $80, $E0, $50   ; centiseconds
          dc.b $A0, $D, $A0, 8, 0      ; RING
          dc.b $A0, 1, $A0, 0, $20   ; S
          dc.b $A0, 9, $80, $30, $30   ; number of rings
          dc.b $40, 5, $81, $A, 0      ; lives icon
          dc.b $40, $D, $81, $E, $10   ; lives counter
          dc.b 0
    byte_1C624:   dc.b $C
          dc.b $80, $D, $80, 0, 0      ; SCOR
          dc.b $80, $D, $80, $18,   $20   ; E + score left numbers
          dc.b $80, $D, $80, $20,   $40   ; score right numbers
          dc.b $90, $D, $A0, $10,   0   ; TIME
          dc.b $90, $D, $80, $28,   $28   ; minutes : seconds
          dc.b $90, 1, $80, $2A, $48   ; :
          dc.b $90, 5, $80, $E0, $50   ; centiseconds
          dc.b $A0, $D, $80, 8, 0      ; RING
          dc.b $A0, 1, $80, 0, $20   ; S
          dc.b $A0, 9, $80, $30, $30   ; number of rings
          dc.b $40, 5, $81, $A, 0      ; lives icon
          dc.b $40, $D, $81, $E, $10   ; lives counter
          dc.b 0
    byte_1C658:   dc.b $C
          dc.b $80, $D, $80, 0, 0      ; SCOR
          dc.b $80, $D, $80, $18,   $20   ; E + score left numbers
          dc.b $80, $D, $80, $20,   $40   ; score right numbers
          dc.b $90, $D, $A0, $10,   0   ; TIME
          dc.b $90, $D, $80, $28,   $28   ; minutes : seconds
          dc.b $90, 1, $80, $2A, $48   ; :
          dc.b $90, 5, $80, $E0, $50   ; centiseconds
          dc.b $A0, $D, $A0, 8, 0      ; RING
          dc.b $A0, 1, $A0, 0, $20   ; S
          dc.b $A0, 9, $80, $30, $30   ; number of rings
          dc.b $40, 5, $81, $A, 0      ; lives icon
          dc.b $40, $D, $81, $E, $10   ; lives counter
          even
    Was added the ":" and the "centiseconds" in each of 4 maps.
    avatar
    Karate Cat

    Mensagens : 83
    Data de inscrição : 2011-04-22

    Re: Centiseconds in Sonic 1

    Post  Karate Cat on Thu Jun 02, 2011 5:36 am

    Very Nice!

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Re: Centiseconds in Sonic 1

    Post  OuricoDoido on Thu Jun 02, 2011 1:05 pm

    To Fix the Frame Counter Bug, that because this tutorial is shown in start of each level, use this guide.
    How to Fix the Frame Counter Bug

    This bug is from ORIGINAL SONIC 1, and adding the Centiseconds you can see it in start of all levels.

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Re: Centiseconds in Sonic 1

    Post  OuricoDoido on Mon Jun 06, 2011 10:35 pm

    After apply this guide How to Fix the Frame Counter Bug, we need correct the centiseconds when start from a lamppost.

    Go to LevSz_ChkLamp, and between these two lines:
    Code:
          jsr   Hud_Secs
          movem.l   (sp)+,d0-a6
    Add this code:
    Code:
          move.l   #$75400003,d0
          moveq   #0,d1
          move.b   ($FFFFFE25).w,d1 ; load   frames
          mulu.w   #$1AA,d1
          lsr.l   #8,d1
          jsr   Hud_Secs

    To get a better effect when starting from a lamppost, to not always show the same time, go to Obj79_LoadInfo and comment or delete these lines:
    Code:
          move.b   #59,($FFFFFE25).w
          subq.b   #1,($FFFFFE24).w
    These lines say that the frame counter need be set to 59 and subtract 1 from seconds counter.


    How work the centiseconds counter?

    It work like the minutes counter and seconds counter, but have a difference, need convert the number of frames in number of centiseconds.

    First a number is loaded, in this case the number of frames, after is converted to centiseconds (59 frames -> 99 centiseconds).

    Second, the game get the correct art based on this number (centiseconds) and put it in VRAM, our case in F5C0 or tile number 7AE.

    Third, the map use these tiles to show the centiseconds on screen, in this method is not being necessary decompress all the art in VRAM.

    OuricoDoido
    Admin

    Mensagens : 46
    Data de inscrição : 2011-01-09
    Current Project : Sonic Open Source Project

    Re: Centiseconds in Sonic 1

    Post  OuricoDoido on Tue Jun 07, 2011 6:23 pm

    How the How to Fix the Frame Counter Bug was fixed, now this code is fixed too.

    To download the ROM and the Source Code with these fixes, click here:
    http://goo.gl/mpmgw

    Scott4

    Mensagens : 1
    Data de inscrição : 2012-01-20

    Re: Centiseconds in Sonic 1

    Post  Scott4 on Fri Jan 20, 2012 3:49 pm

    I know it's been forever since anybody's posted in this topic, but when I added the CentiSecond lines in sonic1.asm, it kept telling me "Error (1-- bytes) out of range". What am I doing wrong? Sad

    TheBityBity

    Mensagens : 15
    Data de inscrição : 2011-12-09

    Re: Centiseconds in Sonic 1

    Post  TheBityBity on Sat Jan 21, 2012 7:43 pm

    OMG! U SUX!!!

    TheBityBity

    Mensagens : 15
    Data de inscrição : 2011-12-09

    Re: Centiseconds in Sonic 1

    Post  TheBityBity on Sat Jan 21, 2012 7:44 pm

    Just a joke.

    What you could do, is open the main ASM file with E.N.A.E., and delete the two symbols that appear at the start.

    HackedSonic

    Mensagens : 1
    Data de inscrição : 2012-12-01

    Re: Centiseconds in Sonic 1

    Post  HackedSonic on Mon Dec 03, 2012 6:45 pm

    Scott4 wrote:I know it's been forever since anybody's posted in this topic, but when I added the CentiSecond lines in sonic1.asm, it kept telling me "Error (1-- bytes) out of range". What am I doing wrong? Sad

    I think once you added this, you got that error.

    Code:

    CentiSecond:
          move.l  #$75400003,d0
          moveq  #0,d1
          move.b  ($FFFFFE25).w,d1 ; load  frames
          mulu.w  #$1AA,d1
          lsr.l  #8,d1
          jsr  Hud_Secs
          rts

    It happened because of the TimeOver branch. In the branch where it said TimeOver, replace the command that's there with
    jsr (Jump to SubRoutine) or jmp (JuMP). Either way, it should work, but if it doesn't work-- I can't help.
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Centiseconds in Sonic 1

    Post  Green Snake on Sat Dec 08, 2012 3:30 am

    HackedSonic wrote:
    Scott4 wrote:I know it's been forever since anybody's posted in this topic, but when I added the CentiSecond lines in sonic1.asm, it kept telling me "Error (1-- bytes) out of range". What am I doing wrong? Sad

    I think once you added this, you got that error.

    Code:

    CentiSecond:
          move.l  #$75400003,d0
          moveq  #0,d1
          move.b  ($FFFFFE25).w,d1 ; load  frames
          mulu.w  #$1AA,d1
          lsr.l  #8,d1
          jsr  Hud_Secs
          rts

    It happened because of the TimeOver branch. In the branch where it said TimeOver, replace the command that's there with
    jsr (Jump to SubRoutine) or jmp (JuMP). Either way, it should work, but if it doesn't work-- I can't help.

    You know, this is Megamix stolen content. I mean this guide, and all guides by Ouricodoido.
    avatar
    TheRetroGuy

    Mensagens : 21
    Data de inscrição : 2012-10-21

    Re: Centiseconds in Sonic 1

    Post  TheRetroGuy on Fri May 03, 2013 1:17 pm

    Green Snake wrote:
    HackedSonic wrote:
    Scott4 wrote:I know it's been forever since anybody's posted in this topic, but when I added the CentiSecond lines in sonic1.asm, it kept telling me "Error (1-- bytes) out of range". What am I doing wrong? Sad

    I think once you added this, you got that error.

    Code:

    CentiSecond:
          move.l  #$75400003,d0
          moveq  #0,d1
          move.b  ($FFFFFE25).w,d1 ; load  frames
          mulu.w  #$1AA,d1
          lsr.l  #8,d1
          jsr  Hud_Secs
          rts

    It happened because of the TimeOver branch. In the branch where it said TimeOver, replace the command that's there with
    jsr (Jump to SubRoutine) or jmp (JuMP). Either way, it should work, but if it doesn't work-- I can't help.

    You know, this is Megamix stolen content. I mean this guide, and all guides by Ouricodoido.

    I checked the code from Megamix and it's different from this.
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Centiseconds in Sonic 1

    Post  Green Snake on Fri May 03, 2013 4:48 pm

    Compare homing attack codes. I see barely any difference
    avatar
    Green Snake

    Mensagens : 2094
    Data de inscrição : 2012-04-07
    Localização : I do not even know
    Current Project : nope

    Re: Centiseconds in Sonic 1

    Post  Green Snake on Sun May 19, 2013 11:45 am


    Sponsored content

    Re: Centiseconds in Sonic 1

    Post  Sponsored content


      Current date/time is Wed Aug 23, 2017 5:55 am