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

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

Post by unregistered »

unregistered wrote:
tokumaru wrote:...So you don't have to replace anything, just read my example as if I had writen "vblank" instead of "NMI".
*Big sigh of relief* :) Thank you.
waaaaaaait. Um, isn't "NMI" more correct than "vblank"? A vblank is an NMI... but aren't there other NMI?? So, if that is a yes, then it would make more sense for it to be called "NMI"... i guess, right? I'm almost to the point, because it is used in FamiTone, where I'm going to change it to NMI from vblank. Please help me. :)

edit: --------------------
a reply to you, qbradq, isnt wirtten yet. Sorry. :(
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

NMI is an interrupt signal that begins to be asserted at the start of vertical blanking. NMI ends when vblank ends, but NMI also ends on $2002 read. In fact, turning $2000 bit 7 off and on during a single vblank (without reading $2002) causes multiple NMIs. An NMI handler can end before or after NMI ends. The behavior of $2003-$2007 depends on vblank state, disirregardless of NMI state.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

It doesn't matter what you call it, as long as you do it consistently. From a technical perspective "NMI" is not the same as "VBlank". VBlank is a period when we are allowed to make changes to VRAM, and the NMI is an interrupt that fires when this period starts, so that we can be sure to make use of it.

VBlanks are the only source of NMIs on the NES, the IRQs are the ones that can be generated by different sources, such as the APU or mappers.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

tepples wrote:The behavior of $2003-$2007 depends on vblank state, disirregardless of NMI state.
Going to stick with vblank! Thanks tepples! :)
tokumaru wrote:It doesn't matter what you call it, as long as you do it consistently. From a technical perspective "NMI" is not the same as "VBlank". VBlank is a period when we are allowed to make changes to VRAM, and the NMI is an interrupt that fires when this period starts, so that we can be sure to make use of it.

VBlanks are the only source of NMIs on the NES, the IRQs are the ones that can be generated by different sources, such as the APU or mappers.
Great dialogue! :)

Thanks so much tokumaru and tepples! :D I'm not going to change it to NMI; I promise. : )
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

I'm trying to build my .nes file, but I recieve errors that say Unknown label. and Can't determine address. All of the errors are listed being in my FamiTone music file that was created for me by FamiTone with the -asm6 flag. All of the errors are found on lines that just have a @label (temporary label). There is only one regular label at the top and i tried to add regular label at the bottom, but it listed thta line as an error too. I'm so lost as to what to do now :? ... could you help me?
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

Time to move to NESASM3? :P
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

3gengames wrote:Time to move to NESASM3? :P
hehe asm6 continues to rock. :)

So, God helped me make progress again!!! :D But, my question should go to Shiru...
User avatar
qbradq
Posts: 972
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

Have you seen QASM? It's totally super awesome. It'll even clean your toilets!

Actually it is still likely to have bugs :( I wouldn't recommend it for a newer developer due to that. You might hit a bug in the assembler and think you're doing something wrong.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

qbradq wrote:Have you seen QASM? It's totally super awesome. It'll even clean your toilets!

Actually it is still likely to have bugs :( I wouldn't recommend it for a newer developer due to that. You might hit a bug in the assembler and think you're doing something wrong.
Haha :lol: , that's pretty good (edit: i'm sorry for my failure at being honest here) : ) Thanks for sharing........ and a reply to you is still on its way. :(

edit: Spent some time learning about qasm from qasm_dev.zip. It's exciting and fun! :D I'm looking forward to it. :)
Last edited by unregistered on Sat Jun 04, 2011 9:51 pm, edited 1 time in total.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

In asm6 when trying to understand .enum and .ende they use $200. What do the 3 digits mean?
[color=orange]README.TXT[/color] wrote: Reassign PC and suppress assembly output. Useful for defining
variables in RAM.

ENUM $200
foo: db 0
foo2: db 0
ENDE
Does $200 = $0200 or $2000 or what else? Is this three digit implementation only in asm6? Is it only used with .enum? Could you use 4 digits? What important thing did I miss reading? :?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

unregistered wrote:Does $200 = $0200 or $2000 or what else?
$0200
Is this three digit implementation only in asm6?
No.
Is it only used with .enum?
No.
Could you use 4 digits?
Yes.
What important thing did I miss reading? :?
None, he was just skipping the leading zero. Sometimes people use only 3 digits when referencing RAM on the NES because the NES has only $800 bytes of it.
User avatar
Dwedit
Posts: 4922
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

You completely misunderstood what enum does.

It temporarily changes the Current Address ($), and temporarily stops any bytes from being emitted in the output, but addresses continue to increase as bytes or instructions are defined.

So you do ENUM $200. You set the current address to $200, so your next label starts there. You have a .db 0, so the address goes up by 1, and the next label uses that address.

Later you do .ende, so it gets out of ENUM mode, and goes back to generating code as usual, at the previous address that was used before enum mode was turned on.

You use enum mode to define a bunch of labels in a block using space-filling syntax, instead of adding 1 to previously defined addresses in chains.

With enum mode:

.enum $200
label1: .db 0
label2: .db 0
label3: .dw 0
label4: .dsb 32
label5: .db 0
.ende

Without enum mode:

label1 = $200
label2 = label1 + 1
label3 = label2 + 1
label4 = label3 + 2
label5 = label4 + 32
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

BTW, .enum is great for declaring variables. You can have .enum blocks wherever you want, as they don't mess up the program counter. I use it, for example, to declare "local" variables, variables that are used only during parts of the program, so there's no need to waste RAM locations for them permanently.

After the global variables of each page, I put a marker label:

Code: Select all

	.enum $0300 ;variables in page 3

SomeArray .dsb 64
MyVariable .dsb 1
AnotherVariable .dsb 1
Pointer .dsb 2
LocalVariables3 ;this marks the starting point for local variables

	.ende
And then, at the top of each module's file I do something like this:

Code: Select all

	.enum LocalVariables3 ;local variables in page 3

LocalVariable .dsb 1
AnotherOne .dsb 2
SmallArray .dsb 12

	.ende
And I can continue to fill page 3 from where I left off. This is the safest and most organized way I found to reuse RAM in different parts of the program. You can safely rearrange/add/remove global variables and as long as the total doesn't extrapolate the memory you have free it will still work fine.
User avatar
qbradq
Posts: 972
Joined: Wed Oct 15, 2008 11:50 am

Post by qbradq »

qasm_dev.zip is actually older than the current release right now :D Grab qasm_v0_05.zip for the latest. If you want to learn about how an assembler is coded in the classic style have a look at qasm_v0_01.zip. That is a traditional two-pass assembler without expressions and macros.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Post by unregistered »

tokumaru, thank you for answering all of my questions! :) Makes sense.

Dwedit, wow, thank you! Now I have an extensive understanding of enum mode; and even know what it would be like to not have enum mode! :D Which is really helpfull, to me!
tokumaru wrote:I use it, for example, to declare "local" variables, variables that are used only during parts of the program, so there's no need to waste RAM locations for them permanently.
!!So that means we could declare a variable... and then, later on, since the previous variable was local... and we are in a different area of code, we could declare another variable in the same spot!? That would be incredible... like REALLY! :D Just like local variables in C++? If I understood you correctly here, could you answer this next question? If all of the files combine in to one single .asm file then how does this work when there is just one file? The whole thing doesn't make sense to me... there's something I'm missing. :(
qbradq wrote:If you want to learn about how an assembler is coded in the classic style have a look at qasm_v0_01.zip.
Maybe this could help me understand what im missing above. Cause the local variables in an asm program is what im missing AND your assembler probagbly deals with local variables. Thanks qbradq. : )
Post Reply