Jump to content



2

NTSC test needed


38 replies to this topic

#26 analmux OFFLINE  

analmux

    Stargunner

  • 2,033 posts

Posted Sun Oct 4, 2009 12:11 PM

View Postpr0be, on Sat Oct 3, 2009 3:35 PM, said:

I looked into disassembled SMB source code (smbdis.asm) and i have felling that it would be easier to write all code from scratch that modifing and analyzing orginal source code (Yep it is well commented but i don't think that i would have patient to do it ;)

it's quite impressive that you manage to run nes code on atari, i don't know exactly how nes handles a sprites but i suppose that very similar that my multiplexer so i think that sprites is not a problem... more difficult would be changing engine to use LMS feature to scroll screen
Thanks for the CPU usage tests. It seems there should be plenty of CPU time left in the SMB. It seems we both might want to build a 'bridge', however we start building on different sides. What's 'in the middle' is still hidden in some clouds.

Well, I'm already excited to make SMB run (and it's original code) on atari. I played SMB for the 1st time when I was just a little boy, say 8 years old. At that time my dad had bought the Atari 800 xl and was doing some gfx algorithms in basic. He learned me the basics, some ML and other stuff. The only game we had was on a tape (we only had A8 + Tape), it was Jigsaw puzzles (Parthenon/Bavarian castle). During the game the puzzle pieces were scrolling in the upper or lower border of the screen, and it was really 'scrolling by hand'. The programmers didn't use HW/Antic scrolling features. They really ROL/RORed all gfx data around on a gfx 7 type of screen. I never saw HW scrolling before. Then somewhat later I visited a friend who had a NES + SMB. The screen was scrolling smooth and my mouth fell open. I thought SMB is really no option for A8. Years later I learned about HW/Antic scrolling and started wondering: SMB must be possible on A8, -in some way-......years go by....

Now (20 years later): I printed the whole doc of the SMB source, and if I have to wait for a train or bus, or somewhere else, I'm studying it. It's not my primary goal to do the whole porting, but I'm just curious if it would be possible, and in which sense. I'm really learning much of just reading how they (the guys from nintendo) solved some problems. So no time is wasted for me anyway :) ... F.e. how they manage task control is really interesting. They use some kind of 'software CPU instruction' (JumpEngine). It works like a jump table, depending on the value of Acc. This acc can be anything, and can be increased/decreased when one particular 'subtask' is finished. Then, the next time (possibly next VBI) it will execute the next step. Imagine the main VBI routine making several JSRs to sub-treads of tasks, most of them independent from each other. So, (to me) it looks like an interesting method of some 'prehistoric multitasking' system.....

Sorry for the whole story ;) (of topic off now)


About the scrolling / LMS. The screen handling parts of the SMB code is concentrated in a small part of the total source code. It can be changed to do screens / fill the buffers the atari-way. So, that's not really the hardest part I think. The hardest part is still the sprites. The NES and the SMB code are dealing with sprites in some intermediate steps. The sprite shuffling routine is needed to handle correct flickering when the number of sprites in a scanline exceeds 8. These routines could however be disactivated, the whole shuffling stuff. Some code might need to be reorganized, or put into a different order. So, I'm afraid especially the sprite part must be rewritten for a large part.

#27 pr0be OFFLINE  

pr0be

    Space Invader

  • 12 posts

Posted Wed Oct 7, 2009 4:55 AM

I looked into NES hardware spec about sprites (http://nesdev.parodius.com/NESDoc.pdf, pages 16-25), and it seems to be more complicated than I thought.
on SMB one game sprite are build with 4-8 or even 16?(Bowser) hardware sprites, so it is first problem to deal - change sprite handling. I don't study SMB code much so I don't know how engine handle sprites, but we would need to change that part to form with each game object would have be represented by only one hardware sprite (except Browser - we need two multicolored PMG sprites for him)


here is short description how my multiplexer hande sprites:

the sprite table took 256bytes from $xx00 to $xxff, each sprite took 8bytes, so first sprite uses $xx00-$xx07, second $xx08-$xx0f and so on...

each sprite are descripted by 8bytes:
offset 0: sprite height (from 1-255, 0 for unused)
offset 1: sprite screen X position (from 0-255)
offset 2: sprite screen Y position (from 0-255)
offset 3: sprite color 1
offset 4: sprite color 2
offset 5: pointer to shapedate (lo byte)
offset 6: pointer to shapedata (hi byte)
offset 7: sprite priority (used by sprite shuffler to determine what sprite to reject and with sprite to draw when we have more than 2 sprites per charline)

maximum of 32 sprites can be handled...


if You have any idea how to implement this multiplexer on SMB orginal code, please let me know... my study of the orginal SMB code ended when I face "jsr JumpEngine" :D

#28 xxl OFFLINE  

xxl

    Moonsweeper

  • 465 posts
  • Location:KRAKOW/Poland

Posted Wed Oct 7, 2009 6:09 AM

"jsr JumpEngine" what is this?

#29 pr0be OFFLINE  

pr0be

    Space Invader

  • 12 posts

Posted Wed Oct 7, 2009 7:44 AM

View Postxxl, on Wed Oct 7, 2009 6:09 AM, said:

"jsr JumpEngine" what is this?

it's a "mysterious" routine in SMB :D see smbdis.asm and search for "JumpEngine"...

Attached Files



#30 analmux OFFLINE  

analmux

    Stargunner

  • 2,033 posts

Posted Wed Oct 7, 2009 9:32 AM

Well, the "jsr JumpEngine" instruction is nothing more than a jump command with more than one arguments. Just by looking at the instruction, it is a JSR call, but it should be treated as a JMP, as the data after it is just data, and no new instructions to be executed when returning from the JSR. Anyway if one needs an indexed JSR, one needs to do JSR to a part of code which calls for the "jsr JumpEngine".

It is followed by an unspecified number (<128) of 16bit values, i.e. jump vectors.

Load accumulator with a value from 0 to 127, do "jsr JumpEngine", and it will jump to the vector of the next address + 2*acc.

f.e. the following will execute Routine 3
 jsr ExampleRoutine
 ...(other stuff)...

ExampleRoutine
 lda #3
 jsr JumpEngine
 dta a(Routine0)
 dta a(Routine1)
 dta a(Routine2)
 dta a(Routine3)
 dta a(Routine4)

Routine0
 ...(stuff)...
 rts

Routine1
 ...(stuff)...
 rts

Routine2
 ...(stuff)...
 rts

Routine3
 ...(stuff)...
 rts

Routine4
 ...(stuff)...
 rts
After the rts in Routine3 is executed, the CPU will return to "other stuff"!

The JumpEngine routine computes the new jump address: It will pull the saved return address PCL,PCH from stack, add 2*acc(+1), and stores it at $06,$07 and does a JMP ($06) (indirect jump to vector stored in $06,$07).


The SMB3 ROM also contains this type of instruction. Years ago I already studied the SMB3 ROM, and found this JumpEngine method. I'm a bit excited it's also used in the SMB1 ROM.

Edited by analmux, Wed Oct 7, 2009 9:43 AM.


#31 xxl OFFLINE  

xxl

    Moonsweeper

  • 465 posts
  • Location:KRAKOW/Poland

Posted Wed Oct 7, 2009 9:46 AM

oryginal jetpac game use the same 'task manager' - i rewrite it in jetboy http://www.atarimani...ERSION_ID=20326

#32 Kaz atarionline.pl OFFLINE  

Kaz atarionline.pl

    Moonsweeper

  • 408 posts
  • Location:Poland

Posted Sat Mar 13, 2010 2:57 AM

I glued Tezz's pic, Analmux' music and Pr0be's engine together in short video clip, looks nice :)



#33 Heaven/TQA OFFLINE  

Heaven/TQA

    Quadrunner

  • 8,105 posts
  • Location:Baden-Württemberg, Germany

Posted Sat Mar 13, 2010 3:05 AM

the video looks good and the music sounds fresh... not often heard the "metal" sound...

#34 Syfo-Dyas OFFLINE  

Syfo-Dyas

    Dragonstomper

  • 539 posts
  • Location:NW Ohio

Posted Sat Mar 13, 2010 4:55 AM

WOW!

Mario almost feels EXACTLY as it should! Almost! My God!

Contra was also amazing! I loved the music, though it seems to need fleshed out a tad as it got a little too high pitched at times.
As for the screen flicker. Might more RAM clear that up at all?

Edited by Syfo-Dyas, Sat Mar 13, 2010 5:03 AM.


#35 Philsan ONLINE  

Philsan

    River Patroller

  • 2,335 posts
  • New Orleans Saints Super Bowl XLIV Champions
  • Location:Switzerland

Posted Sat Mar 13, 2010 8:13 AM

Beautiful title, awesome music, wonderful engine.
What is the status of Pr0be's project?
This game deserves to be done!

#36 Tezz OFFLINE  

Tezz

    Stargunner

  • 1,799 posts
  • Location:Manchester, England

Posted Sat Mar 13, 2010 9:49 AM

Nice one Kaz :)
I'm still very much looking forward to the new game that Pr0be, Born and 'ooz started last year.

#37 Kaz atarionline.pl OFFLINE  

Kaz atarionline.pl

    Moonsweeper

  • 408 posts
  • Location:Poland

Posted Sat Mar 13, 2010 9:49 AM

View PostSyfo-Dyas, on Sat Mar 13, 2010 4:55 AM, said:

As for the screen flicker. Might more RAM clear that up at all?

There are flicking sprites only, not the whole screen. As far as I know it is feature of sprites multiplication (like in "Crownland" game) and extra RAM can't change it. However, I suppose it shouldn't be so visible after code optimization. Pr0be is the best person to answer your question.

#38 Syfo-Dyas OFFLINE  

Syfo-Dyas

    Dragonstomper

  • 539 posts
  • Location:NW Ohio

Posted Sat Mar 13, 2010 12:35 PM

Correction, Sprite Flicker. :)

#39 analmux OFFLINE  

analmux

    Stargunner

  • 2,033 posts

Posted Mon Mar 15, 2010 5:51 PM

View PostKaz atarionline.pl, on Sat Mar 13, 2010 2:57 AM, said:

I glued Tezz's pic, Analmux' music and Pr0be's engine together in short video clip, looks nice :)



Thanks for making this ;) However, it seems you used the non-fixed version of the "Instrumentarium" tune, i.e. the original of March 2009. Also replying a bit to Syfo-Dyas: The remixed version was a bit more balanced. F.e. I softened some of the 'metal guitar' parts (i.e. the high-pitched stuff / stuff with a lot of higher harmonics).

Anyway, it might give a non-A8-standard feeling. Maybe it's possible to really combine the tune & the scroller / PM-multiplexer. The tune is in RMT 100Hz mode. This eats 15% of CPU time. The PM multiplexer can use the rest of it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users