8x16 and whatever else unreg wants to know

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
tokumaru
Posts: 11692
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: 8x16 and whatever else unreg wants to know

Post by tokumaru » Mon Apr 16, 2018 10:56 am

Even when using CHR-ROM, addresses $0000-$1FFF can be used to READ from the pattern tables, as some NROM and CNROM games did back in the day. Since these games had very limited PRG-ROM space, they used some of the CHR-ROM space to hold data.

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Mon Apr 16, 2018 2:28 pm

tokumaru wrote:Even when using CHR-ROM, addresses $0000-$1FFF can be used to READ from the pattern tables, as some NROM and CNROM games did back in the day. Since these games had very limited PRG-ROM space, they used some of the CHR-ROM space to hold data.
That's really cool! Thank you for sharing, tokumaru! :D

I never thought of doing that :oops:; but, was pondering if we could somehow transfer bank15 from ROM to CHR-RAM to bank!15, our 15th bank if the P bit is set inside "CHR bank 0" (using SXROM), in ROM; but, that's not possible, I think, because ROM can only be set during assembly and RAM must be set after assembly.

There isn't ever a time when one could make a transfer from RAM to ROM. Remember learning that earlier in this thread, I think. :)

tepples
Posts: 21973
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: 8x16 and whatever else unreg wants to know

Post by tepples » Mon Apr 16, 2018 3:48 pm

unregistered wrote:There isn't ever a time when one could make a transfer from RAM to ROM.
True of mask ROM, false of flash memory. Some recent homebrew games, such as Study Hall, save by writing back to flash instead of using battery RAM.

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Mon Apr 30, 2018 10:35 am

Trying to use a signed comparison because a part of our game needs one, I believe; my question, after reading this really helpful page, is: is the SO pin free from connections to it in our game?

After using bvs in our game before and it, our game, working just fine on the powerpack, it seems to me that the 6502.org article, linked above, is talking about editing other already-created games. :?

lidnariq
Posts: 9381
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: 8x16 and whatever else unreg wants to know

Post by lidnariq » Mon Apr 30, 2018 10:38 am

unregistered wrote:Trying to use a signed comparison because a part of our game needs one, I believe; my question, after reading this really helpful page, is: is the SO pin free from connections to it in our game?
Yes, the SO pin is floating inside the 2A03. (Visual2A03 node 11246)

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Mon Apr 30, 2018 2:41 pm

Thanks lidnariq! :) So there must be different 2A03s inside NESes? Or did 6502.org make that 5.2 section for people who attach things to the SO pin? Well, that pin is inside the 2A03 chip... so maybe I'll go research this on my own so my questions aren't rediculous. :)

tepples
Posts: 21973
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: 8x16 and whatever else unreg wants to know

Post by tepples » Mon Apr 30, 2018 2:51 pm

The 2A03 contains a second source 6502, a PSG, and a primitive DMA controller. The SO pin of the 6502 in the 2A03 isn't connected to anything.

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Mon Apr 30, 2018 3:13 pm

tepples wrote:The 2A03 contains a second source 6502, a PSG, and a primitive DMA controller. The SO pin of the 6502 in the 2A03 isn't connected to anything.
Thank you so much tepples! That's excellent! It's great to not have to worry about the SO pin! :mrgreen: :D Learned from this wikipedia page that the SO pin is at the upper right corner of the 6508 chip... and so that's what it means to connect something to the pin. :idea: Thank you lidnariq and tepples for helping my small understanding of the SO pin. :)

edit: It is also nice to understand that 6502.org explains about 6502 chips used in many different types of machines. And that the NES's 2A03 is a unique 6502-based chip. :)

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Thu May 24, 2018 11:14 am

Just trying to get a variable to display in hex format using the Lua Script Window of Mesen. After some searching I discovered that C functions can be used in Lua and that I would need to use a C function to convert the integer to hex format. And after opening a pdf titled libc.pdf pages 286-290 showed me that printf can transform integers into hex formated numbers. (I've never used C or Lua before; well, played with Lua yesterday.) My Lua file says something that includes:

Code: Select all

altoX = emu.readWord(0x0038, emu.memaType.cpuDebug)
emu.drawString(12, 30, "38 | altoX: " .. printf("%4X"), 0xFFFFFF, 0xFF000000, 1)
It says:
Loading script...
Script loaded successfully.
MemDisplay00.lua:16: attempt to call a nil value (global 'printf')
etc.
Did try to add int before the text on the line where altoX was assigned but, received an error. Please help me; I don't know how to make this work. :?

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: 8x16 and whatever else unreg wants to know

Post by thefox » Thu May 24, 2018 11:18 am

You'll want to use string.format (e.g., string.format("%4X", 1234))
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Thu May 24, 2018 1:47 pm

Thank you so much thefox! :mrgreen: :D Replacing printf("%4X") with string.format("%4.4X", altoX) caused the 80 to be preceeded by 00 (for the high byte)! Precision is so cool! (When our game starts she is at 0080 and that's what it shows. :))

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Thu Oct 11, 2018 1:04 pm

Kasumi[color=#FFFF00] in [url=http://forums.nesdev.com/viewtopic.php?p=112830#p112830]the middle of page 67[/url][/color] wrote:Anytime you add a number and result would have been greater than the byte can hold, the carry is set. Otherwise it is cleared.
I realize now that you were talking about addition, but wouldn't the carry always be affected after subtraction too?

If so, since the carry flag is affected by cpx, why does cpx #00 not clear the carry... ohh, think I get it now... you would say, "Anytime you subtract a number and the result would have been less than the byte can hold, the carry is cleared. Otherwise it is set." That seems correct to me. I'm so happy now!! :mrgreen: :D


edit: Kasumi already answered this in the same post in page 67:
Kasumi wrote:1. The carry is ALWAYS taken into account when you use adc or sbc, so make sure it's right for the operation you intend to do before that operation runs. (Clear before addition, set before subtraction)
2. The carry will become the opposite of what you would normally initialize it to if the operation goes outside the boundaries of a byte. (So if an addition would have yielded more than 255, or a subtraction would have yielded less than 0.) Otherwise, the carry becomes what you would normally initialize it to.
:oops:


final-edit: highlighted most important part of quote. | 20181012: corrected 69 to 67 :oops:

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Thu Jan 31, 2019 5:23 pm

hi everyone,

I am blessed to be able to present a small asm6 fork named asm6_. I'm clueless about if anyone will care. All it does is allow a user to use a -u flag when creating a NES file. That -u flag currently allows the listing file to be created with:
1.) REPTs contracted
2.) MACROs expanded

This really helps my browsing through our .lst file because most of our banks begin with a .rept 256 and that causes lots of repetitions of 256 lines. Thankfully, now with the -u flag none of those 256 lines appear in our listing file. :D

I really like looking at our expanded macros and, if God works with me on this again, I hope to also remove the macro definitions from the .lst file when using the -u flag bc they just sit there doing nothing for me. :)

The asm6_.zip contains: asm6_.c, asm6_.exe, and README_.TXT. ...in the same format as asm6.zip.

asm6_.zip <that's hosted on my unsecure website. My website has been unchanged for a looong time, oh well.

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Thu Jan 31, 2019 6:47 pm

If anyone cares, the asm6_.zip file^ now contains asm6_ version 1.6_0.11... its -? flag has been updated to show "README_.TXT". Sorry for the wasted post.

unregistered
Posts: 1071
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered » Fri Feb 01, 2019 4:20 pm

Thought it was interesting that my, edit of loopy's asm6.exe, asm6_.exe was so much larger than loopy's asm6.exe after really trying to accomplish asm6_.exe working with as little changes as possible. Now, it is much smaller, after I used certain gcc compiler options and then running strip with certain options on that asm6_.exe, and still works the same, at least it does for me after some quick testing. :)

The file, link is in my post two-posts-above this post, has been replaced again. :)


This is my first time creating an executable file for others to use.

final edit. 20190202 ~11AM

Post Reply