Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - 65816 ASM not making any sens to me... | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1927/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-21-05 10:06 AM Link | Quote
Well, I've been trying to make an SNES ROM, but nothing is uploading to the VRAM as it should (Zstate has nothing in the areas of VRAM I uploaded to), but SNES9x lists the DMA I used as (for the most part) uploading to VRAM, except for one data bit(that I need to figure out as well- everything looks the way it should in NOTEPAD). I've posted all the files I used to make the ROM so far, as well as some extra files. I've tried many different things, but since I can't figure it out, I was wondering if someone could help me figure out where I've gone wrong.

Sonic.fig and files

So yeah, if you could please tell me what I did wrong, I'd be very appreciative, since I'm lost. Also, if this is the wrong forum, I'm sorry, I didn't know which else to put it in, it seems to be a programming isue.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 2180/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 10-21-05 04:26 PM Link | Quote
Um... well I can think of a few things that look funny to me based on my experience.

GSD logs a DMA transfer to CGRAM of 4096 ($1000) bytes. And CGRAM is only $200 bytes long if I remember correctly. The transfer is incrementing... but you then have a DMA transfer from only $20 bytes offset from that... I don't understand that at all.

i.e. $28000 -> CGRAM $1000 bytes (abridged)
$28020 -> VRAM address $0C00, which if you view in GSD is actually $1800, but whatever.

Next, you have no data uploaded to your TA, or tile address. So you have no characters in memory to even build a tile map with. Well... unless of course you wanted it misaligned by $800 bytes.

The what's used profile in GSD says your TA is at $1000 and your BA (base address) is at $400. Again those are VRAM addresses so you just shift them left once to ge the byte address.

So... if you want more help I think you'll have to describe exactly what you were trying to do. I don't feel like wading through all your asm files to "guess" what your problem is.
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1929/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-21-05 06:15 PM Link | Quote
Well, I was trying to get the program to display a logo using the files in LOGO.GFXINC, but they weren't uploading correctly like I'd hoped, check LShow.asm for how I did the uploads (calls a routine or two in loadgraphics.asm).

I couldn't figure out where I went wrong with the palette DMA settings... it seemed to use that length whether I set Y to #$1000 or set it to #$0010. The T.A. and B.A. addresses are correct, though. Thanks you very much, though, for identifing where I went wrong, when I kinda burnd out.

Oh, and although the DMA for the palette loads 4096 bytes (I only wanted to load 16), after that it loads up the GFX, but apparently that's wrong as well.

I suppose I oughta boot that comp up now, that someone figured that out.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 2183/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 10-22-05 03:51 AM Link | Quote
Ok, i'm not sure what doc you used to find $4306 as the base of the size of the transfer, but it's actually $4305. $4305 is the low byte, -6 is the high byte. I just edited that in the rom to $4305 and now I get a big blank Red Screen. So yeah it worked.

I'll post other corrections as I see them.

edit: got it to display something, but I think I forgot to make it an incrementing transfer...

edit2: noticed that at the beginning of the rom you are trying to do LDA #$0000 and then TCD, but the assembler just picked it up as A9 00 5B which means you havent' actually done anything there... Not like it matters, it's at $0000 by default. It must be a quirk of WLA DX that is has no idea how to handle that code just by itself. What you should do is tag a .W on to it.


(edited by MathOnNapkins on 10-21-05 07:07 PM)
(edited by MathOnNapkins on 10-21-05 07:42 PM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1941/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-22-05 04:44 AM Link | Quote
Hm. I went back and worked with the fixes you gave me, and got the red screen too (It was to let me know when the palette changes actually occurred correctly).

Now, my only problem is getting the MVN statement I've added in to work, since I need to copy 2048 bvytes from 02:9020 to 7F:1000. The problem is, nothign I try there works. Also, I used some pre-existing documents that I got when I downlaoded the "super nintendo starter kit" a year or so ago, and used them because they let me get a little jump start, so I didn't code that section. I'll remake the .rar with the latest files if you'd like. Also, I have to fix the palette file (I believe I mixed up the endian-format in it), but it should display the GFX in logo.bin, under "GFX". I also repointed the GFX addresses in VRAM to not waste space.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 2184/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 10-22-05 05:02 AM Link | Quote
.db $54
.db $02
.db $7F ; wtf, is this a mvn instruction? <-- my comment

Just for humor.

edit: Hm... well it appeared to me that your MVN instruction was incorrectly formatted. The source bank actually comes last in the rom (but first in an assembler). So it should be

.db $54
.db $7F
.db $02

or MVN $02, $7F.

However, strangely this seems to cause your palette DMA transfer to not trigger . Weird. I need to look and see where it triggers in the rom to verify that the code is executing. I don't know if it was something I did, or something you did, but your code that does LDA #$81 : STA $4200... well after I changed this code around I think the MVN switched the data bank to $7F. Hence it was writing to $7F:4200 and not $00:4200 O_o. I wrote a little hook to fix that. But still your palette stuff doesn't show up now... very weird.


(edited by MathOnNapkins on 10-21-05 08:54 PM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1942/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-22-05 06:43 AM Link | Quote
Huh. MVN 02 7F is how it appeared in the trace though, using geiger's SNES 9x debugger. Reading from a .Zstate, the only problem was that the tilemap was not being transferred to 7F:1000 in the RA, and hence the NMI procedure (in quicksetup.asm, "Vblank") was only transferring a load of zeroes to the tilemap in VRAM.

I also tried using MVP, and qwitching X and Y around (they were mixed up at one point...) but that didn't work either, but te problem seems to be the transfer of the raw tilemap from the ROM to the RAM not occurring correctly. I also tried using the WRAM registers for a memory-fill operation (Qwertie's SNES guide mentioned doing that, since it uses a RAM address), but that only made the DMA screw up (enabling DMA channel 5 with "lda #$01 (byte) sta $420B"... WTF.), although it still seemed to work for a little bit afterwards, and then the stack kinda screwed up in an RTS command, but removing the WRAM-memory-fill DMA code fixed that. Wierd, because I hadn't pushed or pulled anything in the code. Oh, and the code at the beginning is not actually mine. Cheap on my part, but it saved time, needing only a skim to find out where to place the VRAM addresses.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 2185/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 10-22-05 06:52 AM Link | Quote
It would appear that the "display" in GSD is faulty. I checked breakpoints on writes to $7F:1000 and in your original no breakpoint occurs. I swapped the bytes and the breakpoint occurs. But now I'm encountering some issues with the Data Bank being $7F in several places. Apparently the Block Move instructions manipulate those transparently. Why is this a problem? Well if you're writing to the 128K of WRAM obviously the PPU Registers aren't being written to, it's a seperate memory map. So i'm finding a way to make it so right after the MVN we'll get LDA #$00 : PHA : PLB.

In your original... this was far from a problem b/c the Data bank remained $02, which mirrors with all other non WRAM banks, ie. $00 through $6F. That is an approximate range, so don't take me too literally. $70 is usually SRAM of course, Not sure what happens between $71 and $7D

edit: one slight note that is rather unimporant, but when you do block moves, you set A to one minus the amount of bytes you want to move. So you should change it to LDA #$07FF.


(edited by MathOnNapkins on 10-21-05 09:53 PM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1946/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-22-05 07:09 AM Link | Quote
I don't think I added it in, and it sounds almost like you're stuck with a hex editor when it comes to working with this ROM... Do you want me to include the compiler/linker as well in a .rar? I use wla-65816.exe, if it's important. I'll keep your sidenote about block moves in mind, that'll help when it comes to moving more important data like gameplay tilemaps and that (yes, I have a lot more notes on the project, but they're all planning notes for the game itself, not the code as it is currently)

I suppose if I try a read breakpoint on $02:9020... Anyways, right now I'm back to the (useless) MVN opcode, but I'll keep trying as well. Thanks for taking so much time to help me out so far.

On a completely unrelated note... why is my minipic not showing up...? *goes off to check*
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 2186/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 10-22-05 09:03 AM Link | Quote
I'm doing straight rom editing b/c I don't like working with WLA DX. I prefer to use Xkas, myself. edit2: plus, would you have noticed the errors I noticed by looking at the ASM files? Most likely not. To truly know if the ASM will work correctly you must have a superb understanding of how your assembler will behave in any situation.

I noticed some of the code was from Neviksti, and possibly other sources, so I'm taking that into account, though just b/c it's third party doesn't mean you shouldn't take the time to look at it and make sure it works. IMO, it does a lot of unnecessary initialization.

Another example of faulty TCD commands (don't know if this is you or not), is LDA #$00 : TCD. Even though the M flag is set, the TCD instruction sends the whole 16 bit C accumulator (i.e. A and B). So I noticed that quite often this is setting the direct page to $FF00. Not very safe . If you wanted to stay in 8 bit mode, I'd do:

LDA #$00
XBA
LDA #$00
TCD

Again, still trying to figure out what ails this. I looked at the rom in TLP and tried to see what sort of graphics you wanted displayed.

As far as my previous comment about doing $7F:4200, that meant that the NMI interrupt was not being reactivated, and hence your rom was hanging on the $CB, or WAI instruction.

I'll mention again that I don't think your tile map or graphics are being blittled to the right locations. BG1 is the only one set to be displayed, but its VRAM addresses are:

BA: $0800, TA: $1000

I don't know if you fixed that in your latest release b/c I haven't downloaded it yet.

Hehhhhhh.... OH SHI-

I figured out why the hooks I was doing to change the Data Bank Register back to $00 were failing. silly me. I forgot you were doing all the phb plb shit at the end and beginning of routines. And... btw if you're going to do stuff like a lot that you might as well make it a macro.

Edit3: Well I thought I had everything working... but GSD is telling me that every DMA transfer except for the one that uploads the graphics is working. The tile map is perfectly fine in memory. And i even had it displaying something resembling a logo for a while. But I had two copies going at the same time and didn't notice so I think I kept fighting against myself to keep all the changes I was making. I'm too fed up with it today so good luck on your own. What it said that struck me as being odd was that all the DMA transfers except for the ones using $2180, the Palette upload, and the graphics uploads, were using "write mode 1". The exceptions I mentioned were using write mode 0. At this time I can't figure out what that means in terms of the PPU registers. It even started telling me that I was reading from CGRAM instead of writing. Again, a symptom of I probably had two hex editor windows open simultaneously and intermittently.


(edited by MathOnNapkins on 10-22-05 12:19 AM)
(edited by MathOnNapkins on 10-22-05 01:10 AM)
(edited by MathOnNapkins on 10-22-05 02:52 AM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1949/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 10-23-05 01:50 AM Link | Quote
Yea, the TCD was my fault. And yeah, I studied the files quite closely, as well as changed some oo the setting in them. Still, hanging on the WAI isn't going to be as much of a problem, since it's the last part of the ROM, some code meant to stop the SNES from skipping into random crap. so, the palette was uploading to one register only (they're supposed to), but the graphics weren't uploading correctly? Im pretty sure I fixed that, though.

Thanks for the help, I'll keep working on it with what you mentioned and try to get it working.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - 65816 ASM not making any sens to me... | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.007 seconds.