I attempted some sprite multiplexing on the DS but didn't get it working.. It'll be great to see a homebrew game using it, because all I've seen is a few little demos.. DS needs more mega particle filled shooty games.
Show us yer programming projects!
- nyarla
- Baaaaaa!

- Posts: 2820
- Joined: Tue Jan 14, 2003 1:53 pm 0
- Location: i said kiss me you're beautiful these are truly the last days
- Contact:
Re: Show us yer programming projects!
Hey, awesome sdetoni.
I attempted some sprite multiplexing on the DS but didn't get it working.. It'll be great to see a homebrew game using it, because all I've seen is a few little demos.. DS needs more mega particle filled shooty games.
I attempted some sprite multiplexing on the DS but didn't get it working.. It'll be great to see a homebrew game using it, because all I've seen is a few little demos.. DS needs more mega particle filled shooty games.
Re: Show us yer programming projects!
I can believe it, just spent better part of 2 days debugging my 500 lines of code because it just wasn't quite right, and just couldn't figure it out. Turned out to be a number of issues, along with the usual Doh! programming errors, there was the horiz interrupt which turns out isn't called every scan line, more like every 8 or so scan lines which kind confused me as my code was based on every scan line. Once I knew that, everything fell in place and my sprite (especially 8x8 pixel ones) stopped blinking randomly for no apparent reason.nyarla wrote:Hey, awesome sdetoni.
I attempted some sprite multiplexing on the DS but didn't get it working..
Still a few things to build into the framework before game coding starts:
Sprite/tile based collision detection working.
Blitter type function for bobs with colour keying (so dmacopy() seems a no go here)
I've added my example below with source, regard the code as a complete
hack at this stage.
- Attachments
-
- testApp.zip
- (1.1 MiB) Downloaded 38 times
Re: Show us yer programming projects!
Blimey crikey, the pure FM loader only bloody works. So far, just running a scrolly message, but even at unreadably fast speeds I still have half my delay slot T states spare at 2kbps transfer rates.
Took me longer to get Emu to read and write WAV files
.
The current figures look like this:
Those are the nominal timeslices for reading the state at exactly half way between the putative state change and the next sync pulse. The timing's loose enough that plus or minus 20% should be fine (although with a WAV file as the source the timing won't become marginal until it gets right up to the line, of course).
Took me longer to get Emu to read and write WAV files
The current figures look like this:
Code: Select all
Freq Timeslice Timeslices/frame Total timeslice
2048Hz 1111 T 40 44440
3000Hz 704 T 60 42240
4096Hz 470 T 80 37600 - evilpaul
- Baaaa!

- Posts: 811
- Joined: Wed Sep 29, 2004 2:01 pm 0
- Location: #ukscene, helsinki branch
- Contact:
Re: Show us yer programming projects!
Haha.. sounding pretty good! :)
[My blog - http://evilpaul.org] [My demos - http://atebit.org] [Twitter - http://twitter.com/evilpaul_atebit][My inspiration - http://bitethis.org]
Re: Show us yer programming projects!
The real danger is how much fun I'm having trying to work out optimal Spectrum graphics techniques and routines. Biggest realisation so far is POP rr to load two bytes and increment the target for a trivial 10 cycles - way more than twice as fast as any alternative. I don't need the SP (the IX and IY regs are completely useless for most things if you're pressed for time, but they work really well as a RISC-esque link register, for no more cost than a call/ret pair).
Even after that, I chopped 150 cycles off my character printing routine last night, so I've now well over half the delay slot free.
Even after that, I chopped 150 cycles off my character printing routine last night, so I've now well over half the delay slot free.
Re: Show us yer programming projects!
There you go again, Dio - I was just about to make a(nother) start to my Speccy emulator and you've put me off again with your bloody cleverness and skill. Damn you!
Wife says "thanks" though because it saves her becoming a coding widow (again)...
Just got hold of a mint Rodnay Zaks Z80 book to motivate me and some other old Speccy coding books (a Melbourne House asm one was one of them).
I was thinking of doing it in C#...I know, I know!! Before you all start yelling, it's mainly because I need to get upto speed with C# (I'm C++ normally) for work and this seemed a non-trivial project I'm interested in to keep me going. I could do it in C++ and convert it but that probably won't give me the experience that I'm looking for.
Any hints? I'm basically starting from scratch having never really coded on the Speccy (apart from BASIC) and expect it to be a bit of a slog but I'm hoping that some of the asm stuff will feed back to improving my low-level x86 knowledge (also useful for work).
And if I get stuck, I can always get Dio and evilPaul to talk technical over my head to (maybe) help
Just got hold of a mint Rodnay Zaks Z80 book to motivate me and some other old Speccy coding books (a Melbourne House asm one was one of them).
I was thinking of doing it in C#...I know, I know!! Before you all start yelling, it's mainly because I need to get upto speed with C# (I'm C++ normally) for work and this seemed a non-trivial project I'm interested in to keep me going. I could do it in C++ and convert it but that probably won't give me the experience that I'm looking for.
Any hints? I'm basically starting from scratch having never really coded on the Speccy (apart from BASIC) and expect it to be a bit of a slog but I'm hoping that some of the asm stuff will feed back to improving my low-level x86 knowledge (also useful for work).
And if I get stuck, I can always get Dio and evilPaul to talk technical over my head to (maybe) help
Re: Show us yer programming projects!
After a break of more than a year (by the time I get it released), ZXSpin 7 is getting better and better:

And (IMO) speccy gaming doesn't get any better than running it at 1280x800 with Hq3x, scanlines and Gigascreen blending with the paper area zoomed in as far as possible :-)

And (IMO) speccy gaming doesn't get any better than running it at 1280x800 with Hq3x, scanlines and Gigascreen blending with the paper area zoomed in as far as possible :-)
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
- The Caffeine Kid
- Baaaaaaa!

- Posts: 5691
- Joined: Mon Mar 01, 2004 9:24 pm 0
- XBL Gamertag: TheCaffeineKid
- PSN: caffeinekid
- Yahoo Messenger: caffeinekid
- Location: Wakefield
- Contact:
Re: Show us yer programming projects!
Oooh that's looking and sounding pretty sweet! Gimme gimme! 
Re: Show us yer programming projects!
@Barney: nnnnnnnggggggg!

Re: Show us yer programming projects!
I'm currently re-writing the graphics engine, as the old 0.666 version doesn't handle widescreen very well - and it's not going well.
I've got three threads - the VCL thread which handles messages and windows and shit, the emulation thread which runs at high priority, and sleeps whilst waiting for sound synch - and the render thread which runs at low priority to give an automatic frameskip. Currently, the render thread is giving me headaches when returning from fullscreen back to windowed mode. It is supposed to be suspended during the transition, but it's silently dying when it tries to render using objects that have been freed prior to being recreated. It shouldn't be trying to render anything
And D3D is giving me headaches again - not throwing any errors (all results are DD_OK) but if I try to re-initialise after setting the cooperative level back to DDSCL_NORMAL, it hangs ZXSpin. Aero gets disabled during fullscreen mode but fails to come back in after switching to windowed. If I Sleep(1000) after switching before I head back into re-creating the Direct3D objects, it works fine but feels very, very hackish
I've got three threads - the VCL thread which handles messages and windows and shit, the emulation thread which runs at high priority, and sleeps whilst waiting for sound synch - and the render thread which runs at low priority to give an automatic frameskip. Currently, the render thread is giving me headaches when returning from fullscreen back to windowed mode. It is supposed to be suspended during the transition, but it's silently dying when it tries to render using objects that have been freed prior to being recreated. It shouldn't be trying to render anything
And D3D is giving me headaches again - not throwing any errors (all results are DD_OK) but if I try to re-initialise after setting the cooperative level back to DDSCL_NORMAL, it hangs ZXSpin. Aero gets disabled during fullscreen mode but fails to come back in after switching to windowed. If I Sleep(1000) after switching before I head back into re-creating the Direct3D objects, it works fine but feels very, very hackish
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
Re: Show us yer programming projects!
The Spectrum's a great first emulation project because it's dead easy; it's just a CPU glued to some memory and one very basic custom chip.Loada wrote:Any hints? I'm basically starting from scratch having never really coded on the Speccy (apart from BASIC) and expect it to be a bit of a slog but I'm hoping that some of the asm stuff will feed back to improving my low-level x86 knowledge (also useful for work).
I'd start out by writing a bit of code that copies a full Spectrum screen to the PC screen in a continuous loop. Then you just bolt the emulator on to that. (In the long term you'll need something more advanced, but at least initially copying the screen once per frame is fine).
After that you need to start emulating. By far the most important thing for any emulator is a decent CPU core. Write the 'fetch' loop, make every instruction 'undefined' in the instruction table, causing a breakpoint, and start it fetching on something (the ROM, most likely). Then write a few instructions as it breakpoints.
After you've got a few working, review what you've got and check that it all looks like the patterns will work - you don't want to write 100 instructions and then realise that the way you're doing the fetch loop is all wrong, or that you're killing yourself with complicated ways of handling operands. In particular, at this point you have to make a tricky decision between trying to reuse as much code as possible - which will drive you mad in the beginning but save you a fair old chunk of time at the end - or writing all 600-odd instructions pretty much individually. For a beginner, the former might be out of reach, but you might be smarter than I was
You can then write the bulk of the rest of the instructions, BUT LEAVE A BREAKPOINT IN EVERY ONE until it's tested. Test it with single-stepping, repeating and modifying the operands a bit if they're too boring to be useful, exhaustively working through the possibilities: if you write a whole core and just let it run there will be a hundred tiny bugs and you'll never find them. You want to get rid of most of them by code inspection.
In the same way, once you start writing the code that lets the CPU talk to the outside world, breakpoint any path you haven't implemented yet and don't bother until you see it being used.
Once you can actually run a Spectrum, there's the instruction exercisers "ZEXDOC" and "ZEXALL" which will test the whole lot for you in microscopic detail. Once you pass that, your CPU core is fine.
A debugger bolted on, even a very noddy one, is an absolute godsend once you start looking for more obscure problems, but for the Spectrum it's hardly a necessity, and it does add a big chunk of extra Getting Started Cliff to climb.
Re: Show us yer programming projects!
Yeah, fullscreen is disabled in Emu at the moment because of all sorts of twitchy little issues, and even in windowed mode I still haven't worked out a way I like to get it to survive the screensaver kicking in.Barney wrote:And D3D is giving me headaches again - not throwing any errors (all results are DD_OK) but if I try to re-initialise after setting the cooperative level back to DDSCL_NORMAL, it hangs ZXSpin. Aero gets disabled during fullscreen mode but fails to come back in after switching to windowed. If I Sleep(1000) after switching before I head back into re-creating the Direct3D objects, it works fine but feels very, very hackish
Re: Show us yer programming projects!
You can never have enough Speccy emulators! Get stuck in, there's tonnes of help here on the forum. There's currently only one viable .net emulator out there and the author is a nice chap. Everyone who writes one has there own take on what they think a speccy emulator should be, and it's great to see other emulators and how they do things.Loada wrote:@Barney: nnnnnnnggggggg!![]()
Snakey on these very boards (though I wasn't a member then) guided me on a contention bug that I'd totally missed. Writing a z80 core isn't hard, but it's effing laborious... Accurate contention is a sod though!
So get going, let's see what you come up with
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
Re: Show us yer programming projects!
I feel your pain.Dio wrote:Yeah, fullscreen is disabled in Emu at the moment because of all sorts of twitchy little issues, and even in windowed mode I still haven't worked out a way I like to get it to survive the screensaver kicking in.Barney wrote:And D3D is giving me headaches again - not throwing any errors (all results are DD_OK) but if I try to re-initialise after setting the cooperative level back to DDSCL_NORMAL, it hangs ZXSpin. Aero gets disabled during fullscreen mode but fails to come back in after switching to windowed. If I Sleep(1000) after switching before I head back into re-creating the Direct3D objects, it works fine but feels very, very hackish
I've fixed (hopefully) the D3D bug - it was pretty stupid of me. To get a nice fullscreen mode, I use a dummy window which has no non-client area, blown up to fullscreen. D3D was attached to that and everything was sweet until I come to destroy the window (or hide it) when going back to windowed mode. I tried attaching D3D to the ZXSpin window, even in fullscreen, and it works nicely now. Just a hundred and one other bugs to fix - and that's just in the display routines...
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."
- evilpaul
- Baaaa!

- Posts: 811
- Joined: Wed Sep 29, 2004 2:01 pm 0
- Location: #ukscene, helsinki branch
- Contact:
Re: Show us yer programming projects!
Oooo! Nice looking gigascreen support! Now that could come in handy... ;)
When's the likely release date?
When's the likely release date?
[My blog - http://evilpaul.org] [My demos - http://atebit.org] [Twitter - http://twitter.com/evilpaul_atebit][My inspiration - http://bitethis.org]



