Search found 2739 matches

by dougeff
Sun Sep 27, 2020 3:27 pm
Forum: Newbie Help Center
Topic: How to manually change background tiles (and their palettes)
Replies: 6
Views: 111

Re: How to manually change background tiles (and their palettes)

I guess the error is called "missing operator" (since tiles[0] could be considered an Lvalue)... and a good compiler should give this warning.

"warning: statement with no effect"
by dougeff
Sun Sep 27, 2020 3:12 pm
Forum: Newbie Help Center
Topic: How to manually change background tiles (and their palettes)
Replies: 6
Views: 111

Re: How to manually change background tiles (and their palettes)

How can you have an expression without an Lvalue?

Code: Select all

tiles[0] - 2;
    tiles[1] - 2;
    tiles[2] - 16;
    tiles[3] - 16;
These should throw an error. Or a warning. If they don't, this is a bug in cc65 that needs fixed.
by dougeff
Sun Sep 27, 2020 11:10 am
Forum: Newbie Help Center
Topic: CC65 how to optimize 16 bit variable assignment?
Replies: 6
Views: 108

Re: CC65 how to optimize 16 bit variable assignment?

This should work

Code: Select all

__asm__ ("lda %v", i);
    __asm__ ("asl a");
    __asm__ ("tay");
    __asm__ ("lda %v,y", playery );
    __asm__ ("sta %v,y", oldy );
    __asm__ ("lda %v+1,y", playery );
    __asm__ ("sta %v+1,y", oldy );
by dougeff
Sun Sep 27, 2020 10:18 am
Forum: Newbie Help Center
Topic: CC65 how to optimize 16 bit variable assignment?
Replies: 6
Views: 108

Re: CC65 how to optimize 16 bit variable assignment?

Is "i" declared as unsigned char?

It should be able to optimize for an array of 256 bytes of less.

Or, maybe the problem is that it is an array of ints. Yes. I think it needs to be an array of chars. I don't remember. I'm also away from my keyboard.
by dougeff
Sun Sep 27, 2020 8:55 am
Forum: Newbie Help Center
Topic: CC65 how to optimize 16 bit variable assignment?
Replies: 6
Views: 108

Re: CC65 how to optimize 16 bit variable assignment?

I know this will sound stupid, but cc65 can't handle 2 arrays on the same line of code. There are workarounds, but if you aren't having slow down issues, I would just forget about it. (example of a stupid workaround) temp is a 16 bit zeropage variable... temp = playery[i]; oldy[i] = temp; another ex...
by dougeff
Sat Sep 26, 2020 6:04 pm
Forum: General Stuff
Topic: Looks like NESCartDB is down (again)...
Replies: 61
Views: 23929

Re: Looks like NESCartDB is down (again)...

Thanks brizzo. Cool. :beer:
by dougeff
Thu Sep 24, 2020 5:43 am
Forum: SNESdev
Topic: CA65 Bit-shift During Compilation Isn't Working Properly
Replies: 18
Views: 535

Re: CA65 Bit-shift During Compilation Isn't Working Properly

There are between 1 and 4 BG layers, depending on which mode you are in.

By 24 bytes, I assume you mean 3 bits per pixel (bpp), like Super Mario World uses. That's a form of software compression. Those are expanded to 4 bpp (with the upper 8 color being blank). All SNES sprites are 4 bpp (16 color).
by dougeff
Wed Sep 23, 2020 1:07 pm
Forum: NES Music
Topic: turning nsf file to bin for .incbin
Replies: 4
Views: 139

Re: turning nsf file to bin for .incbin

NSF format doesn't really conform to any real NES mapper. It's sort of a mixed bag of all possible sound systems. so... I'm going to say that it can't be done.

I think you would need to redo it in Famitracker, and export it as .bin
by dougeff
Tue Sep 22, 2020 4:54 pm
Forum: Newbie Help Center
Topic: Having slow down after only 10 sprites on screen
Replies: 5
Views: 162

Re: Having slow down after only 10 sprites on screen

With cc65, lower your expectations. I use fairly optimal C code, and it maxes out at around 8 objects on screen at once. x4 sprites per object = 32 sprites total.

(with music and collision code, and movement logic for each object).
by dougeff
Tue Sep 22, 2020 2:24 pm
Forum: SNESdev
Topic: CA65 Bit-shift During Compilation Isn't Working Properly
Replies: 18
Views: 535

Re: CA65 Bit-shift During Compilation Isn't Working Properly

Lots of things could be happening. JSR to a subroutine that changes the status flag to 8 bit. NMI or IRQ code that changes the status flag to 8 bit.

I believe there is a SEP somewhere causing the problem. You will have to step through the code in a debugger to find it or do a trace log.
by dougeff
Mon Sep 21, 2020 9:28 am
Forum: Newbie Help Center
Topic: .incbin giving me an error
Replies: 11
Views: 264

Re: .incbin giving me error

If you are using NESASM, you need to indent assembler directives. I think 2-3 spaces is enough, goes before the .incbin

labels, on the other hand need no indenting.
by dougeff
Sun Sep 20, 2020 12:22 pm
Forum: SNESdev
Topic: RAM values on power on?
Replies: 5
Views: 201

Re: RAM values on power on?

But not reliably random that you could use initial RAM values as random numbers. It might be all zeroes. It might be all FF.

The emulators that fill RAM with random numbers is just as misleading as emulators that fill with zero.
by dougeff
Mon Sep 14, 2020 3:59 pm
Forum: Newbie Help Center
Topic: Question on background tiles(and how to put them into the PPU)
Replies: 6
Views: 244

Re: Question on background tiles(and how to put them into the PPU)

Tiles are 8x8 pixels. The screen is 256x240 pixels. That means 32 tiles wide and 30 tiles tall. A formula to calculate a PPU address, in tiles position is... $2000 + (tile Y * 32) + tile X where tile X is 0 to 31, and tile Y is 0 to 29. You take that PPU address, send it High byte, then Low byte to ...
by dougeff
Sun Sep 13, 2020 7:22 am
Forum: Newbie Help Center
Topic: Putting famitone SFX in another bank
Replies: 5
Views: 337

Re: Putting famitone SFX in another bank

Looking at famitone2.s Everything between FamitoneUpdate: and .if (FT_SFX_ENABLE) ;process all sound effects can go in the bank with the music code. Slap a RTS there. You need to include _FTChannelUpdate and _FT2SetInstrument and the note table. And the DPCM functions.. (have the word "sample" in th...
by dougeff
Sun Sep 13, 2020 7:07 am
Forum: Newbie Help Center
Topic: Putting famitone SFX in another bank
Replies: 5
Views: 337

Re: Putting famitone SFX in another bank

The music update can be split into 2 parts, the song and the sfx. The song code only writes to a buffer, then it checks each sfx channel, then it copies the buffer to the APU registers. You can put the song part in one bank and the sfx part on another bank, and call them sequentially. By the way, if...