News:

11 March 2016 - Forum Rules

Main Menu

How do I use the output of PCX2SNES in a ROM?

Started by Videogamer555, February 02, 2011, 05:40:27 PM

Previous topic - Next topic

Videogamer555

I tried to use the ".include" to insert the data from PCX2SNES. Now here's the real problem. It keeps saying it's overflowing rom banks. Is my picture too large? I'm just using the standard 256x224 SNES screen size so my image will fill the screen. But it keeps telling me it won't fit in the rom bank. Please help.

KaioShin

What address are you putting it at? Do you know what a rom bank is?
All my posts are merely personal opinions and not statements of fact, even if they are not explicitly prefixed by "In my opinion", "IMO", "I believe", or similar modifiers. By reading this disclaimer you agree to reply in spirit of these conditions.

Videogamer555

#2
Quote from: KaioShin on February 02, 2011, 05:46:57 PM
What address are you putting it at? Do you know what a rom bank is?

It's a certain portion of the rom chip. And there's like 8 of them in the rom that comes as the default ASM tutorial used for WLA.

How do those homebrew SNES slideshow roms with the anime girls pictures store like 20 pics or more, each full sized 256x224, if just one such pic is gonna overflow the rom bank?

Here's one line of palette data as the output of PCX2SNES
    .db $40, $00, $32, $0A, $0F, $7F, $31, $01, $37, $06, $B8, $0A, $1E, $07, $05, $05

What does ".db" do, and why are the numbers given as $hh (the format for an address) instead of #$hh (the format for data)?

Also once .db does whatever to that data, how do I retrieve it? (PCX2SNES should have output LDA STA pairs instead of this .db crap).

BRPXQZME

Quote from: Videogamer555 on February 02, 2011, 05:50:30 PM
What does ".db" do, and why are the numbers given as $hh (the format for an address) instead of #$hh (the format for data)?
.db means data that comes in bytes.

#$hh is not the format for data, nor $hh is the format for addresses; an address is itself data. What the #$hh does in 65c816 assembly is invoke the direct addressing mode on the appropriate instructions (that lets the assembler know to assemble instructions that will use the data literally rather than as an address).

Quote from: Videogamer555 on February 02, 2011, 05:50:30 PM
Also once .db does whatever to that data, how do I retrieve it? (PCX2SNES should have output LDA STA pairs instead of this .db crap).
It is inserted at wherever in the code the .db directive is placed. If you assembled machine code by hand and replaced equivalent assembly code with .db directives that specified the end result of the assembly, you would end up with identical results when you run the code (and have gone to a lot of trouble to do something the hard way, but this is just an example).

You wouldn't want to waste load and store operations on data that just sits there; it would take up more room (a lot more room) and requires the system to do unnecessary work.

If you place a label right in front of the .db directive you need, that label will fill in for the address of the data, just like a label would indicate an address for code. There is no intrinsic difference between data and code; code is just data that a CPU can run. Now, some computers take advantage of this and store code and data separately so that the code can run faster and the data doesn't ever get "run", but in an abstract logical sense, they are the same.

(As to if you need specific instructions on how to use it, you'll have to wait for someone who actually does SNES assembly and not just assembly in general)
we are in a horrible and deadly danger

Videogamer555

Quote from: BRPXQZME on February 02, 2011, 06:15:55 PM
Quote from: Videogamer555 on February 02, 2011, 05:50:30 PM
What does ".db" do, and why are the numbers given as $hh (the format for an address) instead of #$hh (the format for data)?
.db means data that comes in bytes.

#$hh is not the format for data, nor $hh is the format for addresses; an address is itself data. What the #$hh does in 65c816 assembly is invoke the direct addressing mode on the appropriate instructions (that lets the assembler know to assemble instructions that will use the data literally rather than as an address).

Quote from: Videogamer555 on February 02, 2011, 05:50:30 PM
Also once .db does whatever to that data, how do I retrieve it? (PCX2SNES should have output LDA STA pairs instead of this .db crap).
It is inserted at wherever in the code the .db directive is placed. If you assembled machine code by hand and replaced equivalent assembly code with .db directives that specified the end result of the assembly, you would end up with identical results when you run the code (and have gone to a lot of trouble to do something the hard way, but this is just an example).

You wouldn't want to waste load and store operations on data that just sits there; it would take up more room (a lot more room) and requires the system to do unnecessary work.

If you place a label right in front of the .db directive you need, that label will fill in for the address of the data, just like a label would indicate an address for code. There is no intrinsic difference between data and code; code is just data that a CPU can run. Now, some computers take advantage of this and store code and data separately so that the code can run faster and the data doesn't ever get "run", but in an abstract logical sense, they are the same.

(As to if you need specific instructions on how to use it, you'll have to wait for someone who actually does SNES assembly and not just assembly in general)

Ok say I label my data like this.

MyDat:
.db $00, $01, $02, $03
.db $04, $05, $06, $07
.db $08, $09, $0a, $0b
.db $0c, $0d, $0e, $0f


Now how do I use that data. Lets say now this represented some data that I wished to now implement. How do I use LDA and STA to access the data stored in MyDat so that it can then be used?

Ryusui

You'd use MyDat as a base pointer and increment it to point to the rest of the values in the series. I'm a little fuzzy as to the syntax; it's not consistent from compiler to compiler.

EDIT: Alternately, and slightly less elegantly, you could store it to a specific address with an .org statement and use that address for pointer calculation.
In the event of a firestorm, the salad bar will remain open.

Videogamer555

Quote from: Ryusui on February 02, 2011, 07:10:55 PM
You'd use MyDat as a base pointer and increment it to point to the rest of the values in the series. I'm a little fuzzy as to the syntax; it's not consistent from compiler to compiler.

EDIT: Alternately, and slightly less elegantly, you could store it to a specific address with an .org statement and use that address for pointer calculation.

SInce WLA is popular, aren't most img to snes type programs already optimized for working with wla?

Ryusui

I wouldn't know. I never even heard of WLA until I joined up with the Breath of Fire 2 retranslation project.
In the event of a firestorm, the salad bar will remain open.

Nightcrawler

Quote from: Videogamer555 on February 02, 2011, 07:25:23 PM
Quote from: Ryusui on February 02, 2011, 07:10:55 PM
You'd use MyDat as a base pointer and increment it to point to the rest of the values in the series. I'm a little fuzzy as to the syntax; it's not consistent from compiler to compiler.

EDIT: Alternately, and slightly less elegantly, you could store it to a specific address with an .org statement and use that address for pointer calculation.

SInce WLA is popular, aren't most img to snes type programs already optimized for working with wla?

Huh? An image conversion program simply will output image data in the target binary format. In other words, it just makes an image in SNES format. It doesn't have anything to do with your assembler or code.

The program gives you binary data. It's up to you to insert that in your ROM and write the code to figure out how to use it...
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations