Jump to content
IGNORED

Help desperately needed: streamlining the CIN code


8bit-Dude

Recommended Posts

 

Trying to do this kind of mode through a DLI per scanline is not effective, because DLIs trigger at the start of a scanline while the change needs to occur at the end, so the DLIs will eat almost all the CPU in STA WSYNC anyway. To get significant CPU back requires using an IRQ instead, as Rybags notes.

Hey Phaeron,

Flash helped me a lot getting the OS ROM functioning again, by following your instructions. I have attached the resulting code.

But as you predicted, there is not a lot of CPU time left for anything, so FPS on my actual game is very low (3 times lower than C64).

If I wanted to use IRQ, would it be a lot of effort modifying again the code?

Atari-CIN.zip

Link to comment
Share on other sites

Another timesaving hint for DLIs - instead of WSync you can pad out with NOPs to get a delay. You have to allow for jitter though.

Also preload registers for colour changes etc. though if you're using WSync there's usually not a lot of time to do stuff.

I tried adding 20 nops at the beginning of the loop. The image still displays correctly (20 is the max, at 21 sync is lost).

However, the FPS of the game does not improve.

loop:
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	nop
	eor #$c0
	sta wsync
	sta prior
	dex
	bne loop
Edited by 8bit-Dude
Link to comment
Share on other sites

Altirra debugger can also be of help, you can set traps then single-step and have a visual of what's going on, esp scanline position of current instruction.

 

You'll probably benefit more by using a Pokey timer, but would best be served there by maximum optimization of the IRQ entry, ie use the system vector @ $FFFE.

Link to comment
Share on other sites

Altirra debugger can also be of help, you can set traps then single-step and have a visual of what's going on, esp scanline position of current instruction.

 

You'll probably benefit more by using a Pokey timer, but would best be served there by maximum optimization of the IRQ entry, ie use the system vector @ $FFFE.

Could you point me to an existing example of such programming method? I have no idea where to start with implementing this. :-S

Link to comment
Share on other sites

Hey Phaeron,

Flash helped me a lot getting the OS ROM functioning again, by following your instructions. I have attached the resulting code.

But as you predicted, there is not a lot of CPU time left for anything, so FPS on my actual game is very low (3 times lower than C64).

If I wanted to use IRQ, would it be a lot of effort modifying again the code?

3x slower on a machine 1,x faster... ;) I guess we should help here ;)

Link to comment
Share on other sites

I totally cannot help as i didn't get much further than BASIc, PASCAL and C programming but:

 

This looks like a very fun project and game....always loved Atari's Sprint arcade games.

 

Some general thoughts that crossed my mind, please take them as positive feedback :)

 

1) the intro screen. Do we really want those muddy C64 colors ? A8 can do so much better, look at the Rastaconverter pictures.....or am I missing something about the intro screen that is special ?

2) I watched the C64 youtube video. I'm sure you have other issues now but.....that sound.......seriously drove me crazy after one minute.....I'm sure POKEY can do a lot better recreating some engine sounds....

3) be absolutely sure to support Atari's driving control. This is the only thing that can emulate the feel of the arcade games which have proper steering wheels. This would make a great game a brilliant game IMHO.

4) It's brilliant that it will support online cross platform play....how will that work on real hardware or will this be emulator only ?

  • Like 3
Link to comment
Share on other sites

Using NOPs will break things on an accelerator, if that matters.

 

I neglected that... in the context of this game it might be worth putting a speed test in and just use a routine with WSync for accelerated CPUs.

Loss of speed wouldn't be an issue, you'd probably want to put slowdowns elsewhere anyway.

Link to comment
Share on other sites

Sorry can't help at the moment either (only a few more months, please god), but love the idea. Totally agree with Level42.

You're going to need a proper collaborator if you're going to use cycle sucking modes such as CIN for a few more colours, unless you want to spend a lot more time learning 6502 and the platform. As you know better than most, these vastly different 8 bit systems don't play well with generic code!

  • Like 2
Link to comment
Share on other sites

1) the intro screen. Do we really want those muddy C64 colors ? A8 can do so much better, look at the Rastaconverter pictures.....or am I missing something about the intro screen that is special ?

2) I watched the C64 youtube video. I'm sure you have other issues now but.....that sound.......seriously drove me crazy after one minute.....I'm sure POKEY can do a lot better recreating some engine sounds....

3) be absolutely sure to support Atari's driving control. This is the only thing that can emulate the feel of the arcade games which have proper steering wheels. This would make a great game a brilliant game IMHO.

4) It's brilliant that it will support online cross platform play....how will that work on real hardware or will this be emulator only ?

Please ignore that video, it is very old and not representative of the current status of the game.

The C64 version is ready, and got much better FPS than shown on that old video. The sounds are also improved, etc...

I have original C64 and XE at home, with ethernet cards (DragonCart in case of A8). So I am testing the game at each step on actual hardware as well as emulators.

  • Like 3
Link to comment
Share on other sites

Sorry can't help at the moment either (only a few more months, please god), but love the idea. Totally agree with Level42.

You're going to need a proper collaborator if you're going to use cycle sucking modes such as CIN for a few more colours, unless you want to spend a lot more time learning 6502 and the platform. As you know better than most, these vastly different 8 bit systems don't play well with generic code!

 

I wish I could use one the built-in gaphics modes, but they absolutely suck. I am attaching below a comparison of original track (256 colors), converted to CIN and G10, to make the point (there is also the C64 version thrown in).

 

If someone with the needed skills could hook up with me, I would really appreciate it. Ideally, I want to run IRQs (instead of DLIs), and switch off the ROM while still having the necessary functions for the game (timers, keyboard, file reading).

post-53448-0-02476300-1509270486.png

post-53448-0-96515800-1509270517.png

post-53448-0-91738200-1509270521.png

post-53448-0-73759600-1509270668.png

Edited by 8bit-Dude
  • Like 3
Link to comment
Share on other sites

In order to help veterans understand better my problems, I am attaching here the sources of a cross-platform tech demo for C64/A8.

The D64 in VICE gets 32 FPS, whereas the ATR in Altirra gets 12 FPS.

 

Could the vets (Flash? Rybags? Popmilo? Phaeron? Irgend? Schlortt?) help me improve the file /include/Atari/CIN.a65 as follows:

(1) Use IRQs instead of DLI vector, to speed up the code.

(2) Add refresh for timer/keyboard/joystick, so the OS ROM can be disabled? (I badly need the memory to run the full game).

 

Many thanks in advance guyz!

sources.zip

demo.atr

demo.d64.zip

post-53448-0-38170800-1509283222_thumb.png

Edited by 8bit-Dude
Link to comment
Share on other sites

I wish I could use one the built-in gaphics modes, but they absolutely suck. I am attaching below a comparison of original track (256 colors), converted to CIN and G10, to make the point (there is also the C64 version thrown in).

 

Just my 2 € cents:

  • especially if this is your first Atari project: keep it simple!
  • like said: CIN is (for most users) unacceptable for a game in PAL land. So reducing the CPU load isn't the only problem...
  • I did a very quick and rough conversion of the C64 graphics you've attached. No DLIs (yet), plain ANTIC 4. Maybe this is already sufficient.

    Two remarks:

    1. you may have to change your player flickering logic as a DLI covers now 8 scan lines (no really a problem, vertical distribution area is just increased)

    2. since the 5th colour is in use, the slicks of the cars (all missiles using the 5th colour too) would be blue according to my mock-up

 

post-7778-0-15545400-1509282097.png

 

Hope this helps too...

 

Edit: Silly me, there are of course DLIs due to the font changes. Thanks to the abstraction G2F delivers, I forgot this simple fact.

8bs.xex

Edited by Irgendwer
  • Like 2
Link to comment
Share on other sites

  • especially if this is your first Atari project: keep it simple!
  • like said: CIN is (for most users) unacceptable for a game in PAL land. So reducing the CPU load isn't the only problem...
  • I did a very quick and rough conversion of the C64 graphics you've attached. No DLIs (yet), plain ANTIC 4. Maybe this is already sufficient.

Hmmm, not that bad actually... though clearly not as good as C64 equivalent.

When I stumbled on CIN, my hope was that I could achieve equivalent (or better) GFX.

 

In the end, gameplay matters more, so perhaps in the shorterm I could latch onto this.

Could you tell me how you produce the image and code to display it?

 

P.S: the game uses pixel color to determine speed. Grey/Yellow for the track (full speed), Purple for walls (0), and everywhere else slow speed.

Link to comment
Share on other sites

Hmmm, not that bad actually... though clearly not as good as C64 equivalent.

 

Thanks. The C64 has surely an advantage in this field thanks to the colour ram.

(So if you now discover nice in-game graphics in an Atari game, you know that the developer and artist weren't easygoing and can praise more their efforts... ;-) )

As an advantage your FPS should be now higher compared to the C64 version.

 

 

In the end, gameplay matters more, so perhaps in the shorterm I could latch onto this.

 

QFT

 

In the end,Could you tell me how you produce the image and code to display it?

 

For the mock-up I've used Graph2Font: http://g2f.atari8.info/

The general principle is an Antic 4 screen which is covered by characters. Since 128 characters of a single font aren't enough to cover the full diversity of your screens, the character base is changed via DLI if needed.

I've attached the source G2F, you can save also the assembly code in the application and inspect that.

 

P.S: the game uses pixel color to determine speed. Grey/Yellow for the track (full speed), Purple for walls (0), and everywhere else slow speed.

 

I see. Easiest solution which comes to my mind would a "background-40x24-array" covering these limitations in char resolution. If you have memory left, you could just create a second bitmap matching the depiction restrictions too.

8bs.g2f.zip

Edited by Irgendwer
  • Like 2
Link to comment
Share on other sites

Thanks for the input Irgend. I am going to mull over this the next couple of days, and see if it can get me progressing a little faster (I have already consummed 4 weeks of my entire freetime on this PMG/GFX stuff).

Meanwhile, if some generous soul could look into ways to accelerate the CIN rendering, I would be very grateful.

Link to comment
Share on other sites

while I am clearly not up to speed these days might I make a suggestion... not all coders, graphists, and such make their way to this section of Atari Age...

also, there is nothing wrong with trying different method of display and speed... who knows what breakthrough you will make...there are tricks and hidden ways of getting quite a bit out of the Atari... a bit of racing against the clock and doing things when you think nothings looking or doing things while the machine can't really act on it....making changes mid stride...I suggest taking this to this forum...

http://atariage.com/forums/forum/51-atari-5200-8-bit-programming/

you will find yourself puled in many directions... and may even find some team mates who know what I vaguely refer to.. in the end you might find some wisdom and understanding to pull off one heck of a piece of software..... to make it shine you may find the only programming 100% shared between the two networked platforms will be the network comms between the two... and the layout... Keep a positive attitude.... more code has hit the bit bucket on the floor than has ever been put into most works, it's hard to throw away something you worked so hard to make, but then remake it completely and it's even better! you will have such gratification in that achievement that you will continue endlessly until it's as good as it can be and you let it loose in the world.

Edited by _The Doctor__
  • Like 1
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...