Archive for April, 2008

Battle of the loRom layout

Wednesday, April 30th, 2008

It’s now been a few days that I’m in a battle with the ROM layout. I’m starting to have huge ressource, a bit less than 32kb. So I tried to put that in an other bank. That was monday. Since it does’t working until this morning, after reading many documents and analysing other roms.

Now everything goes well except thatmy favoriteemu/debugger the so called “Snes9X1.43.ep9r8.exe” isn’t working with it. It’s mixing the bank access and copies the actual code into VRAM and not the data coming from from bank 1. Now all the other emu are working great (was not the case of bsnes before).

I provide you the .smc format rom. If you have any idea why it’s not working don’t hesitate to contact me ASAP via the comments on this post.

Here are some info about the rom layout from the linking process :

Section: ORG:    ROM ORG:  SIZE:
CODE     008000  000000      4CCH (  1228)
UDATA    000000  ------       10H (    16)
vectors  00FFE4  007FE4       1CH (    28)
registra 00FFB0  007FB0       2FH (    47)
bank4    018000  008000     7F40H ( 32576)
Total                       8467H ( 33895)

The huge data is in bank4 section. Address is set to 01:8000 and in the rom it’s at 8000. Main code is at address 00:8000 and rom is 0000. The registration data of the cart is set to mode 20 (lorom)

If you have any other question -> comments.

Here is the Rom for you testing and analysing.

See ya, Lint

PS : Easter egg in the rom (tested working on bsnes and znes) … Hint … play with your pad (i said too much, I know !!!)

FIXED !!! Look at the comments !!! 

WDC C Compiler for 65816 in action [PART II]

Friday, April 25th, 2008

Hey all…

I managed to do a real quick update today. I’m back with both pad reading and background scrolling as promised. Scrolling was all easy to implement. Pad reading function was more difficult to get working. It’s mainly due to a bug or a bad usage from myself when linking. It don’t like return the padStatus struct. So i needed to modify my function to make it return a word and then cast. Here is code in details :

typedef struct padStatus{
	byte right:1;
	byte left:1;
	byte down:1;
	byte up:1;
	byte start:1;	// Enter
	byte select:1;	// Space
	byte Y:1;	// X
	byte B:1;	// C
	byte Dummy:4;
	byte R:1;	// Z
	byte L:1;	// A
	byte X:1; 	// S
	byte A:1;	// D
} padStatus;
word readPad(byte padNumber) {
    word test;

    // Enable pad reading
    *(byte*)0x4200 = 0x01;

    padNumber = padNumber << 1;
    test = (word) *(byte*)0x4218+padNumber << 8;
    test |= (word) *(byte*)0x4219+padNumber;

    return test;

This allow to easily read the pad and then doing stuff like : if(pad1->left) … wich is quite nice.

I have contact WDC about the bug and i will keep you updated.

For you information here is the scrool code :

word padValue1;
padStatus *pad1;
byte HScroll = 0;
// Pointer hacker for typecasting padStatus
pad1 = (padStatus *) &padValue1;
// Loop forever
while(1) {

	// Read pad1 value
	padValue1 = readPad((byte) 0);

	if(pad1->left) {
	} else if(pad1->right) {

	// Plane 0 scroll register
	*(byte*) 0x210d = HScroll;

Full archive is available here as usual.

For any question, problem getting the code to compile, … please don’t hesitate to post a comment. I will then be glad to answer you.

So whats next ? What about a two simple effects and debug function to print text on screen ? Sounds nice …

++ Lint

WDC C Compiler for 65816 in action [PART I]

Wednesday, April 23rd, 2008

As promised here is the release of the previous teaser that you saw earlier on this blog. A few months ago I already had talked about the WDC C Compiler. I know that SNES is used to be coded in asm directly and so not using a high level language like C. So why C ? Just because i didn’t wanted to attack a big project with only the use of asm, since it’s been about at least 10 years that I have’t touched 65816 opcodes. C allow me to code high level and to get slowly in touch with generated code to fix problem with my snes9x emu/debugger.

Where to start ? Get the source code and at the file layout of the archive :

/ressource : contains .pcx file to display + generated ressource
/tools : contains tool to convert ressource gfx files
ressource.asm : WDC asm to include binary ressource
ressource.h : header file to includes ressource
main.c : main Rom code
StartupSnes.asm : ROM layout directive and Snes init code
kungfu.smc : pre generated ROM file
make.bat : compile the code and create ROM file kungfu.smc
makeClean.bat : clean up file generated by make.bat
makeRessource.bat : create the tile, map and palette files

I’m now going to in depth for certain parts of the code.

Kung Fu Master Title Screen


First contact with WDC 65816 C Compiler in action [Teaser]

Wednesday, April 23rd, 2008

It’s been 24 hours that I’m extensively playing with the WDC C Compiler for SNES. And I finally managed to get a first piece of code working with it. Not that much at the moment, just a writing to VRAM with DMA and from there displaying a screen in MODE 1.

Kung Fu master Teaser

 I will come back as soon as posible with source code and comments.

++ Lint

[REQUEST] Tweety still picture source code

Monday, April 21st, 2008

I’m once getting ‘uber’ nostalgic.

A about 15 years I started to code on the SNES. The first piece of code that I assembled was this demo : “tweety still picture“. At the time the demo was distributed with source code. Can you please help me found the source code?

A link, an email.. everything is welcome. I really want to see that source code once again.

Thanks in advance,

See ya, Lint

Mental procreation

Wednesday, April 16th, 2008

Just a tiny post to make you discover he revival of a series of articles that where published back then in the ZZAP64. “Mental procreation” or  the game diary of “Morpheus” on the C64.

It’s a good reading when back in time games were made by only one developper and that it was the same person that was also doing the GFX.

See ya, Lint

WikiBooks – Super NES Programming

Friday, April 11th, 2008

Here is the first website I’m going to present to you :

This site is just wonderfull when you start coding the SNES. The basic stuff is really well explained. It’s a must read for any beginner. This wiki is updated on a regular basis but not that much neither, so dont except to find a new tutorial every week.  Now you know it’s a wiki, so we are free to update it as well.

See ya, Lint

Such a small scene …

Tuesday, April 8th, 2008

This weekend I haven’t worked much on my projects. But I have looking around for retro gaming website, and mostly the one talking about new custom hardware. Custom hardware on SNES is mostly reserved to backup units or cart modding. Real homebrew hardware is quite impossible to find, believing it don’t exists. The only piece of hardware that have read about recently is the ULTRA16 mod by D4S.

No SNES but a load of Commodore 64 stuff and a bunch of other stuff for old computers. Many, many, many stuff going from custom cables to harddrives, card reader and so on. I know that the Commodore 64 is the computer that selled the best ever. Almost everybody who is 35 years old got one when they were younger. But so many custom hardware seems crazy to me. Someone had even created a SID port of Guitar Hero that play with PS2 guitar on the commodore 64. How crazy !!! Don’t expect to see that coming soon on the SNES.

I talked a few months ago with a friend that is part of the Megadrive scene. He told me that there is maybe 20 good regular coder left on Megadrive. 20 might seems a lot .. but in a worldwide view it’s like nothing. One of the irc channel that i idle on is #snesdev on efnet networks, about 7 users …. and a few words typed in everyweek. Sometimes not a single word is said in weeks. I dunno how many regular coders there is for the SNES maybe 20 also… not more…

The website talking about SNES development seems to start dying since year 2000. More and more broken links, server shutdown. Only a few continue the archiving of the docs, many thanks for them. The only community that seems really alive are the ROM translators. And they do very good work…

One other thing is that I think that more people use emulator when it comes to console than computer. That’s maybe also why no custom hardware is develloped.

Anyway, if you are SNES active developper, spread the information, show what you are doing, blog every day (even if you are a beginner). Myself I will try to get people to be interested more deeply into SNES software and hardware. I believe there is a sleeping scene… We need just need to make it true once more …

I will start referencing more SNES related website soon so new comers landing on this will ahve stuff to see and for already SNES coder there is may be a few site missing. Don’t hesitate to send me more links, it’s more likely that I’m going to miss some of them.

Now I’m maybe totally wrong about all this. If it’s the case don’t hesitate to get back to me trough the comments on this posts.

++ Lint

Already soldout

Monday, April 7th, 2008

Noooo … i’s already soldout !!! A few months ago I talked with”D4S” about his ultra16 mod for the SNES. He told it will go soon in production and be a limited number of 50 pieces. I discovered today that the sale had started and that the 50 pieces went soldout in 4 days. I guess that some of those units will reappear soon on Ebay but not a at good price…

Ultra16 pcb

Damn …

Here is the link for your information. It’s worth a read to see all the feture of this unversal ‘switchless” SNES. D4S really did a wonderfull job. He’s probably the most active coder on the really small SNES scene. Good job man !

See ya, Lint

74HCT688 8-bit comparator (PART 1)

Wednesday, April 2nd, 2008

After two nights of struggle, I finally got that IC to output something that was looking nice to me. Once again there is no secrets just read the fucking datasheet (RTFDS). This time i had read the datasheet to check about the pinout and the voltage. I had just missed reading the “function table”. I was wrongly assuming that the G or E pin was in the need to be high in order to accept an input. The other thing i got wrong was the fact that i tought that the 74HCT688 will output high on “P=Q” being true, no, it’s just the inverse … when condition is false it output high and when it’s true output low.

74HCT688 function table

So what’s next ? First I want to finish the breadboard layout like I wanted it to be. That means : 1 eight position dip-switch, 1 74HCT688 and a led My experimentation will be to compare 4 high bits with 4 low bits of the dip-swith and to turn on the led on when high and low bits match. Currently, this is my breadboard.

Part one of 74HCT688 experimentation

As you can see I now need to wire the dip-switch to the IC and get somekind of inverter or XOR gate to turn on the led when result is low.

See ya, Lint