Jump to content
IGNORED

Java mobile games to Atari lynx games (Theory)


Europatari

Recommended Posts

24 minutes ago, solo/ng said:

I 100% disagree here.

Alright, here's an example from 68000:

SEnemy_PlaceToTrackCenter:
{
    register d0:CenterX
		; CenterX = XMin + (XMax-XMin) / 2
	CenterX.w = SEnemy.MaxX - SEnemy.MinX
	signed CenterX.w >>= #1
	CenterX.w += SEnemy.MinX
	
	SEnemy.X = CenterX
rts
}

Resulting Asm code:
SEnemy_PlaceToTrackCenter:
;{
      ; CenterX = XMin + (XMax-XMin) / 2
    move.w (82, a5), d0
    sub.w (80, a5), d0
    asr.w #1, d0
    add.w (80, a5), d0
     
    move.w d0, (38, a5)
    rts
;}

It's much, much easier to come back to the C code after 3 months than the ASM code. Performance is the same.

 

Here's some more complex conditions to illustrate my point on readability:

C code:
SEnemy_ProcessStrafing:
{
	; Strafing
	register d1:strafeSpeed
	register d2:localX
	register d3:rFrame

	rFrame.w = Frame
	strafeSpeed.w = SEnemy.StrafeSpeed

	if.w (SEnemy.StrafeState == #STRAFE_SWITCHING)
	{	; Don't strafe for requested number of frames
		if.w (rFrame > SEnemy.FrameStrafe)
		{	; Time elapsed, continue strafing
			SEnemy.StrafeState = #STRAFE_STRAFING
		}
		jmp ai_strafing_done	; We need to bypass strafing, as the direction was already updated
	}
	if.w (SEnemy.StrafeState == #STRAFE_STRAFING)
	{
		if.w (SEnemy.StrafeDirection == #STRAFE_RIGHT)
		{	;	Rightwards
			localX.w = SEnemy.X + strafeSpeed
			if.w (localX > SEnemy.MaxX)
			{
				print.b	#255,128,24
				localX.w = SEnemy.MaxX
				SEnemy.StrafeDirection = #STRAFE_LEFT
				SEnemy.StrafeState = #STRAFE_SWITCHING
				SEnemy.FrameStrafe = SEnemy.StrafeSwitchingDelay + rFrame
			}
			SEnemy.X = localX
		}
		else
		{	;	Leftwards
			localX.w = SEnemy.X - strafeSpeed
			if.w (localX < SEnemy.MinX)
			{
				print.b	#0,100,24
				localX.w = SEnemy.MinX
				SEnemy.StrafeDirection = #STRAFE_RIGHT
				SEnemy.StrafeState = #STRAFE_SWITCHING
				SEnemy.FrameStrafe = SEnemy.StrafeSwitchingDelay + rFrame
			}
			SEnemy.X = localX
		}
	}
		ai_strafing_done:
		;
rts
}

Asm code:
SEnemy_ProcessStrafing:
    move.w Frame, d3
    move.w (48, a5), d1
    
    cmpi.w #STRAFE_SWITCHING, (46, a5)
    bne if_473_soe
        cmp.w (58, a5), d3
        ble if_474_soe
            move.w #STRAFE_STRAFING, (46, a5)
                if_474_soe:
        		jmp ai_strafing_done	; We need to bypass strafing, as the direction was already updated
            if_473_soe:
    cmpi.w #STRAFE_STRAFING, (46, a5)
    bne if_475_soe
        cmpi.w #STRAFE_RIGHT, (50, a5)
        bne if_476_soe
            move.w (38, a5), d2
            add.w d1, d2
            cmp.w (82, a5), d2
            ble if_477_soe
                DrawHex8mem  #255,128,24,63
                move.w (82, a5), d2
                move.w #STRAFE_LEFT, (50, a5)
                move.w #STRAFE_SWITCHING, (46, a5)
                move.w (52, a5), (58, a5)
                add.w d3, (58, a5)
                    if_477_soe:
            move.w d2, (38, a5)
            jmp if_476_eoe
                if_476_soe:
            move.w (38, a5), d2
            sub.w d1, d2
            cmp.w (80, a5), d2
            bge if_478_soe
                DrawHex8mem  #0,100,24,63
                move.w (80, a5), d2
                move.w #STRAFE_RIGHT, (50, a5)
                move.w #STRAFE_SWITCHING, (46, a5)
                move.w (52, a5), (58, a5)
                add.w d3, (58, a5)
                    if_478_soe:
            move.w d2, (38, a5)
                if_476_eoe:
            if_475_soe:
    		ai_strafing_done:
      ;
    rts
                                     
      

It is significantly more productive to come back and read the C code than Asm. No difference in performance.

Link to comment
Share on other sites

10 minutes ago, solo/ng said:

The rotation was just an example. You showed us cool looking screenshots (the word screenshot is important here) and I was actually excited to see what you submit.

Then I saw a super simple "road" that can be done even without any 3D calculations at all. On a stock A800. Where is the stuff!; )

 

Back in the days we had a realtime 3D engine on A800 (that could render for example 128 triangles tourus with backface culling and lightsourcing - in ~15 frames). All realtime, no precalc.

So I know "a little" how stuff like this can or cant be done on 6502. So the phrase "Performance-wise, my compiler will generate exact same code you would have written by hand" is just wrong and please dont say stuff like that because is false. It triggered me;).

 

Will wait for the finished compiler then!.

Again, you didn't read it. I explained before that I introduced during last few days of frantic coding a bug that caused the glitch in the more complex 3D art assets. The easiest workaround was to limit the number of polygons per single batch. I could have chosen to not have any RPG elements (and spend a day debugging the asm code) or go with the limited version. I chose the second, because I needed at least some gameplay.

 

Here's the most complex (others were simpler) road 3D art asset in game that didn't glitch - 10 triangles per segment, 50 per screen:

 

Lynx19.thumb.PNG.d69022e68be6c2598d483b38b8852796.PNG

 

Wait a second. I see what's going on here. You're just bringing the drama from Jaguar forums here. Spinning me up to come up with a detailed technical answer and then ignoring it completely (or spinning another BS), for the drama. You sure fooled me, I gotta hand it to you :lol:

 

Fool me once, shame on you

Fool me twice - where's that ignore list button ...

Link to comment
Share on other sites

Hey guys, just saying but we don't need any of this here. There's no need to show off how good your code is better than someone else's or how you're not impressed by something because you can do it better. We're here to share and to learn. If you really don't like something and just want to vent to say something snarky, maybe as the old saying goes...don't say anything at all. Keep it cool.

Link to comment
Share on other sites

56 minutes ago, VladR said:

Wait a second. I see what's going on here. You're just bringing the drama from Jaguar forums here. Spinning me up to come up with a detailed technical answer and then ignoring it completely (or spinning another BS), for the drama. You sure fooled me, I gotta hand it to you :lol:

 

Fool me once, shame on you

Fool me twice - where's that ignore list button ...

No idea about Jaguar and their forums because never been there. 

Feel free to ignore me.

 

@necrocia Yeah, you right, sorry. It wasnt my intention but one phrase jus triggered me (because its not true at all) EOT from me.

 

 

Link to comment
Share on other sites

24 minutes ago, enthusi said:

Well you can use labels in assembler as well ;-)

The assembler OUTPUT from C looks cryptic of course ;-)

But I am always fine with whatever produces something enjoyable in the end.

I could go a step further and say, that modern assemblers have an astonishing feature called COMMENTS ;)

  • Haha 1
Link to comment
Share on other sites

43 minutes ago, necrocia said:

There's no need to show off how good your code is better than someone else's or how you're not impressed by something because you can do it better.

Seriously ? That's not what I was doing. I was accused of spinning BS, so I showed a concrete example of a compiler output that I've been working on last ~10 months and that it does produce a code that has same speed as hand-written one.

 

But, I got fooled, as I didn't have any behavioral data on a person doing that. Which I do now.

 

Anyway, you're right. Regardless of how it started, there's no need for any of that.
 

 

If the tools that I created help me be significantly more productive are offending other people, then I'll stop posting about it. I admit, I was under naïve assumption that it might help other people, but I got cured of that ridiculous notion now :lol:

 

Link to comment
Share on other sites

4 hours ago, VladR said:

Alright, here's an example from 68000:


SEnemy_PlaceToTrackCenter:
{
    register d0:CenterX
		; CenterX = XMin + (XMax-XMin) / 2
	CenterX.w = SEnemy.MaxX - SEnemy.MinX
	signed CenterX.w >>= #1
	CenterX.w += SEnemy.MinX
	
	SEnemy.X = CenterX
rts
}

Resulting Asm code:
SEnemy_PlaceToTrackCenter:
;{
      ; CenterX = XMin + (XMax-XMin) / 2
    move.w (82, a5), d0
    sub.w (80, a5), d0
    asr.w #1, d0
    add.w (80, a5), d0
     
    move.w d0, (38, a5)
    rts
;}

It's much, much easier to come back to the C code after 3 months than the ASM code. Performance is the same.

 

Here's some more complex conditions to illustrate my point on readability:

It is significantly more productive to come back and read the C code than Asm. No difference in performance.

Well, calling this C is a bit exaggerated. I'd say it is a macro assembler but a nice syntax.
I'd try to get rid of the colon for labels and certainly the "rts" at the end of the function. And of course the "#" for immediate values.
 

For Lyxass/BLL/TurboAss users: It is also possible with the RS macros/pseudo OPs to have C like structures.

BTW: This is what GCC produces:

 

struct enemy {
  int maxx;
  int minx;
  int x,y;
};

void center(struct enemy * _en)
{
  _en->x = _en->minx + ((_en->maxx-_en->minx)>>1);
}


 

 		move.l 4(%sp),%a0
        move.l 4(%a0),%a1
        move.l (%a0),%d0
        sub.l %a1,%d0
        asr.l #1,%d0
        add.l %a1,%d0
        move.l %d0,8(%a0)

Not that bad, eh?

Link to comment
Share on other sites

7 hours ago, 42bs said:

Well, calling this C is a bit exaggerated.

I already said about dozen times that it's "C-like", not C  and it's more of a macro expander.

 

I don't want C, as :

- I have no interest in reusing other people's code

- I don't care for C's syntax because it's popular

- I only pick and choose features from C that make sense to me
 

7 hours ago, 42bs said:

I'd try to get rid of the colon for labels and certainly the "rts" at the end of the function. And of course the "#" for immediate values.

I wouldn't. I actually have very good reasons for it, based on last year worth of experience on Jaguar.

 

7 hours ago, 42bs said:

and certainly the "rts" at the end of the function

You keep missing the point that this is supposed to be embedded within ASM, not a full replacement. I don't need another language, I just need to make ASM as productive for long-term usage as humanly possible.

 

rts is not only much shorter to write than fugly return but it also doesn't needlessly catch your eye while you're browsing code

7 hours ago, 42bs said:

BTW: This is what GCC produces:


 		move.l 4(%sp),%a0
        move.l 4(%a0),%a1
        move.l (%a0),%d0
        sub.l %a1,%d0
        asr.l #1,%d0
        add.l %a1,%d0
        move.l %d0,8(%a0)

Not that bad, eh?

So you found the one of very few scenarios where it somehow automagically manages to produce reasonable code ? Good.

 

I worked with C on Jaguar for couple years before switched to straight assembler. I know exactly what kind of crappy 68000 code it produces, as I have been examining it after every compilation.

 

 

 

Oh, one more thing - you conveniently "forgot" to show me the RISC code that it produces for GPU and DSP :lol:

Link to comment
Share on other sites

3 hours ago, sage said:

boooring

 

4 hours ago, Europatari said:

if you are really fans of the "sophisticaded games on old handhelds" prank, then just sit-up for this thing:

https://atarigamer.com/lynx/game/MortalKombatIIAprilFools/123277073

 

I was always impressed with this demo... https://atarigamer.com/lynx/game/LynxTaxiMovieDemo/442159240

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...