Show us yer programming projects!

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
Post Reply
User avatar
hukka
Baaa!
Baaa!
Posts: 213
Joined: Sun Nov 21, 2004 1:42 am 0
Location: Finland
Contact:

Re: Show us yer programming projects!

Post by hukka »

sack wrote:How seperated are your graphics/logic code?

It'd be interesting to see how an ST/megadrive port would work
I'd say pretty well separated, most graphics stuff is in separate subroutines or macros. I'll be happy to give out the sources if anyone wants to try porting it!

Junosix wrote:Blimey hukka, that's excellent! How have you done the music? .MOD files or emulated NES soundchip?
Thanks! The music's a Protracker module, but I sampled the instruments from the original NES game to make it sound as close to the original as feasible.
Signature
User avatar
noodles
Baaaaaa!
Baaaaaa!
Posts: 2053
Joined: Wed May 15, 2002 1:04 pm 0
Location: France

Re: Show us yer programming projects!

Post by noodles »

Firefox wrote: What style of coding do you use? Layers of macros, or just reams and reams of straight assembler?
Sorry if I sound like a noob but what is the difference between macros and straight assembler ? Aren't the macros just bits of assembler code ?
User avatar
hukka
Baaa!
Baaa!
Posts: 213
Joined: Sun Nov 21, 2004 1:42 am 0
Location: Finland
Contact:

Re: Show us yer programming projects!

Post by hukka »

noodles wrote:Sorry if I sound like a noob but what is the difference between macros and straight assembler ? Aren't the macros just bits of assembler code ?
Macros can be used to make the code much more readable, with advanced macros you can basically even make the code look like a higher level language. Example from my code that gets called a lot:

Code: Select all

	; Plays a sample on SFX_CHANNEL (if 0, auto choose)
	; parameters: 1=Sample#
	;
	macro	PlaySample
		ifnd	NOAUDIO
		push	d0
		moveq	\1, d0
		bsr	SamplePlay
		pop	d0
		endif
	endm
A singular line of "PlaySample #SAMPLE_SOMETHING" looks way cleaner in the code than just copypasting the whole block above. Also if I change the SamplePlay subroutine so that, for example, the calling convention changes, I only need to make a single modification to the macro instead of looking for calls all over the code.
Signature
User avatar
noodles
Baaaaaa!
Baaaaaa!
Posts: 2053
Joined: Wed May 15, 2002 1:04 pm 0
Location: France

Re: Show us yer programming projects!

Post by noodles »

hukka wrote: A singular line of "PlaySample #SAMPLE_SOMETHING" looks way cleaner in the code than just copypasting the whole block above. Also if I change the SamplePlay subroutine so that, for example, the calling convention changes, I only need to make a single modification to the macro instead of looking for calls all over the code.
Ah, just like a function call without parameters then.
What assembler did you use ?
I still miss the Amiga and the 68000... such a waste of a great platform.

Hmm just noticed there is a parameter in your code. This has more possibilities than I thought.
Is it specific to the assembler you are using or is there some sort of standard ?
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Show us yer programming projects!

Post by gravy »

Most macro systems have loops and conditionals which make them useful for generating code.

It's very handy if you need to get some efficiency from unrolling loops for stuff like scrolling routines. You can end up with kbs of code that you really really wouldn't want to be typing in by hand :D
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

A subtle way of sabotaging a codebase that I have seen on occasion is to expand a load of macros, and check in the expanded version. Everything still works, but is suddenly impossible to maintain.

At least I assume it was sabotage.
User avatar
hukka
Baaa!
Baaa!
Posts: 213
Joined: Sun Nov 21, 2004 1:42 am 0
Location: Finland
Contact:

Re: Show us yer programming projects!

Post by hukka »

noodles wrote:Hmm just noticed there is a parameter in your code. This has more possibilities than I thought.
Is it specific to the assembler you are using or is there some sort of standard ?
It's standard syntax, I think mainly the amount of possible parameters differs between assemblers. Some assemblers have various related extra features too. Macros are pretty powerful if you use them right!
I use VASM, and a setup where I can crossassemble from Windows (Notepad++) straight to an Amiga executable and launch it in WinUAE by a single keypress. Pretty handy!
Signature
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6653
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: Show us yer programming projects!

Post by venusian »

If you add enough macros you'll end up with a C compiler. It's a slippery slope.
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Show us yer programming projects!

Post by gravy »

venusian wrote:If you add enough macros you'll end up with a C compiler. It's a slippery slope.
:D
User avatar
GoatFoam
Baaaaa!
Baaaaa!
Posts: 1255
Joined: Tue Dec 12, 2006 11:05 am 0
Location: Brizzle
Contact:

Re: Show us yer programming projects!

Post by GoatFoam »

A bad C compiler at that.
User avatar
noodles
Baaaaaa!
Baaaaaa!
Posts: 2053
Joined: Wed May 15, 2002 1:04 pm 0
Location: France

Re: Show us yer programming projects!

Post by noodles »

hukka wrote: It's standard syntax, I think mainly the amount of possible parameters differs between assemblers. Some assemblers have various related extra features too. Macros are pretty powerful if you use them right!
I use VASM, and a setup where I can crossassemble from Windows (Notepad++) straight to an Amiga executable and launch it in WinUAE by a single keypress. Pretty handy!
I had AsmOne back in the day as it was considered the reference assembler at the time. Did you ever try using it (or another asm dev environment) directly in WinUAE ?
User avatar
tufty
Sheepie Whore
Sheepie Whore
Posts: 12524
Joined: Fri Jan 07, 2005 4:52 pm 0
Location: French Alps

Re: Show us yer programming projects!

Post by tufty »

GoatFoam wrote:A bad C compiler at that.
Not necessarily, although it's unlikely to be a *good* one. C is low-level enough that naive compilation barely requires turing-completeness.

I know it's not quite the same, but my first cut "not good enough" scheme compiler, when given "scheme-normal" code, produced far better ARM assembler than GCC did for the equivalent "c-normal" C code (with optimisation turned off); in some cases it produced something close to what GCC produced with -O3. This latter was largely down to the CPS transform on tail-calls turning "looping" code into a sequence of jumps; as long as no register spilling was required, it produced pretty damn tight code.
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
User avatar
hukka
Baaa!
Baaa!
Posts: 213
Joined: Sun Nov 21, 2004 1:42 am 0
Location: Finland
Contact:

Re: Show us yer programming projects!

Post by hukka »

I've released my game now, more info and ADF download at http://hukka.yiff.fi/sk2/ !
Signature
User avatar
PaulCunningham
Baaaaa!
Baaaaa!
Posts: 1218
Joined: Sun Jan 18, 2004 11:47 pm 0
Location: Walsall, England
Contact:

Re: Show us yer programming projects!

Post by PaulCunningham »

I'm making (another) scrolly shooter. Love to hear your views.
Windows alpha here...
PaladinSetup.exe

Image

Image

Image

Things I think I need to add / do:
  • Difficulty levels
  • Analogue stick swapping
  • Lots of gameplay tweaks
Of course, if you find any bugs, let me know about those too!
Cheers,
Paul Cunningham
Pumpkin Games
User avatar
toxibunny
Baaaaaaa!
Baaaaaaa!
Posts: 5906
Joined: Thu Jun 17, 2004 11:59 pm 0
Location: limb clock land

Re: Show us yer programming projects!

Post by toxibunny »

those screenshots look _amazing_.
I made a deviantart page.
'....The baron is a gay old rogue with an eye for the ladies....'
Post Reply