I always loved the [SNES](http://en.wikipedia.org/wiki/Snes). For me it was the last piece of hardware on which i enjoyed gaming. Nothin hit me again like Mario Kart or Yoshis Island. But that’s a different story.
Since my [Amiga 500](http://en.wikipedia.org/wiki/Amiga_500) days i loved to programm in ASM, but never really had the opportunity to code lately,since x86 ASM is really awful to code. But [68000er]( http://en.wikipedia.org/wiki/Motorola_68000) ASM was always fun. So the SNES could be a good target? Yep ! The Snes uses a pimped up 6502, called 65816. It’s faster, uses 16-bit operations and has 24bit address space. To get some code running on the SNES i used the [WLA](http://users.tkk.fi/~vhelin/wla.html) Assembler. So what does is look like ?
init_plane_0: ldx.w #plane_0 ; assign vram location $1000 to $2116/7 stx $2116 ldx #$0000 init_plane_0_loop: lda.w text_0,x ; get ascii text data and #$3f ; we only want the first 64 characters ; convert ascii to c64 screen code sta $2118 stz $2119 ; clear unwanted bits, no h/v flipping inx cpx #$0400 ; transfer entire screen ; $20*$20=$0400 (1024 bytes) bne init_plane_0_loop
Yo, old skool. So i started to write a little Amiga [Cracktro](http://en.wikipedia.org/wiki/Cracktro) Style demo. I setup my devel enviroment using the WLA Assembler and vanilla Makefiles. Since i didn’t get my [Super Wild Card](http://www.robwebb.clara.co.uk/backup/ffe/ffeswcdx.html) Backupstation working, i tested the code against [ZNES]( http://www.zsnes.com/) Emu. Also i wrote some python scripts to generate sine tables and copper bar includes. I made some color gardients with [GIMP]( http://www.gimp.org/) and converted then into asm includes to use then as raster interrupt lookuptables. Hm i think it took me week from start reading the 65816 specs, till i had this little thingy running. It’s far away from optimal code. Sometimes it’s jerking and no sound also. But so what, my first SNES release and iam proud that i got something runing on that machine. Learned how use [HDMA](http://filebox.vt.edu/users/rogrubb3/SNESDev/SNESDocs/GrogHDMA.txt) tables and about [Nintendo’s](http://www.nintendo.com) weired [memory map](http://einsteinsbreakfast.com/snes/docs/rom/SNES memory mapping 2.txt) (what is a zero page ???never had an [C-64](http://en.wikipedia.org/wiki/Commodore_64))….So what did come out? Have look at it.



[Picture 1](http://optixx.org/images/snes/ascii01.jpg)
[Picture 2](http://optixx.org/images/snes/ascii02.jpg)
[Picture 3](http://optixx.org/images/snes/ascii03.jpg)
[Source](http://optixx.org/download/ascii.tar.gz)
Comments closed