Mini-tutorials Thread - MDDC Edition

Messages
27
Sorry to break it to you, but no, it's not.
Code:
        movem.w obVelX(a0),d0/d2        ; 24 (16+(4*2))
        lsl.l   #8,d0                   ; 24 (8+(2*8))
        add.l   d0,obX(a0)              ; 24
        lsl.l   #8,d2                   ; 24 (8+(2*8))
        add.l   d2,obY(a0)              ; 24
                                        ; Total: 120
Code:
        lea     x_vel(a0),a5            ; 8
        move.l  (a5),d0                 ; 12
        move.w  d0,d1                   ; 4
        swap    d0                      ; 4
        ext.l   d1                      ; 4
        asl.l   #$8,d1                  ; 24 (8+(2*8))
        add.l   d1,-(a5)                ; 22
        ext.l   d0                      ; 4
        asl.l   #$8,d0                  ; 24 (8+(2*8))
        add.l   d0,-(a5)                ; 22
                                        ; Total: 128

"add.l dN,-(aN)" is 22 cycles, not 20, according to this and this. Even if it was 20, it'd total to 124 still. Honestly, the only way I see it being made any faster is to convert the velocity variables into 16.16 point instead of 8.8, so you can just do this:
Code:
        movem.l obVelX(a0),d0/d2        ; 32 (16+(8*2))
        add.l   d0,obX(a0)              ; 24
        add.l   d2,obY(a0)              ; 24
                                        ; Total: 80
mmmmmmmmmmm isnt this https://cdn.discordapp.com/attachments/702598107220672652/996493936665309275/asmcyclecount.html accurate ? cuz it told me the adding was 20 cycles .... or there is this method Do this in the object load i did this in obj37 ring loss which is the object that slows down any sonic game on the md honestly
Code:
               ext.l   d2
                ext.l   d3
                asl.l   #$8,d2
                asl.l   #$8,d3
                move.l  d2,x_vel(a1)
                move.l  d3,ObRingsYVel(a1)
and then replace object move calls in the loop by
Code:
       move.l  x_vel(a0),d0
        add.l   d0,x_pos(a0)
        move.l  ObRingsYVel(a0),d0
        add.l   d0,y_pos(a0)
which is the same speed as the method you posted really
 
Last edited:

βΈΈ π•―π–Šπ–›π–”π–“ βΈΈ

There's nothing left but faith
Member
Messages
66
Looks like it uses that old Amiga 68000 cycle count reference, too. Even then, according to that, it still adds up to 22, so I have no idea where 20 came from. Maybe a parsing error? Because, looking through the code, it looks like it *intended* to calculate 22.

Do this in the object load i did this
You'd be better off converting the table into 16.16 values instead. Even then, I think the real source of the slow down comes from the floor collision check. They only have the rings check for collision on certain frames for that reason.
 
Top