Nerdy Nights week 3 to 8 for Asm6

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: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Nerdy Nights week 3 to 8 for Asm6

Post by tokumaru »

tsu wrote:DB can be used to make a varible too? It seemed to work, but I hope I'm using it right.
It sorta works sometimes, but it's wrong. DB is meant for inserting bytes using the suplied values in ROM, while DSB reserves the requested number of bytes in RAM.
I want to used it for 1 byte variables:
foo dsb 4 ; for my four byte variable
bar db 0
IIRC, that does work, but is weird because the 0 (or whatever value you use) doesn't have any meaning. It's confusing to have a number in your source code that doesn't do anything.
; or even just db if a default fill value let's me omit it:
foofoo db ; one byte variable
The correct thing to do would be to use dsb 1, even if it needs a little more typing, because the meaning is clear (reserve 1 byte).
User avatar
donato-zits-
Posts: 47
Joined: Fri Jun 03, 2022 11:14 am
Contact:

Re: Nerdy Nights week 3 to 8 for Asm6

Post by donato-zits- »

mikaelmoizt wrote: Tue Dec 02, 2014 12:50 pm About to learn the basics of NES assembler coding? Reading the Nerdy Nights and studying how it all works?
Here is something I took the liberty of making to get away from NESASM3. With permission ofcourse.
Asm 6 will work just as fine, with some minor changes in syntax, and an easier layout.

*I know there are other assemblers out there. Some people still like NESASM3. This is just for helping out a little.
thanks for that! I'm having problems in make the right "path" to the CC65 assembler in a system windows7 thata I 'have here in another PC, now I will get going ahead in my compile trys with 2 compilers, one in each PC
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Nerdy Nights week 3 to 8 for Asm6

Post by unregistered »

donato-zits- wrote: Thu Jul 21, 2022 5:17 pmnow I will get going ahead in my compile trys with 2 compilers, one in each PC
I am ONLY ATTEMPTING to say that assembling and assemblers is NOT the same as compile and compilers.


Compilers translate code written into assembly machine code that works on whatever machine where the compiling takes place.

Assemblers translate their assembler code into ONLY the assembly machine code, that runs on a certain chip, that the assembler was created for. :)


EDIT: Sry all. Thank you Gilbert.
Last edited by unregistered on Fri Jul 22, 2022 4:01 pm, edited 2 times in total.
User avatar
Gilbert
Posts: 564
Joined: Sun Dec 12, 2010 10:27 pm
Location: Hong Kong
Contact:

Re: Nerdy Nights week 3 to 8 for Asm6

Post by Gilbert »

unregistered wrote: Thu Jul 21, 2022 9:15 pm I am ONLY ATTEMPTING to say that assembling and assemblers is NOT the same as compile and compilers.

Compilers translate code written into assembly code that works on whatever machine where the compiling takes place.

Assemblers translate their assembler code into ONLY the assembly code, that runs on a certain chip, that the assembler was created for. :)
Actually:
Compilers translate (usually relatively higher-level language) code written into code that works on the target system. The code in question can be among many things, including some sort of symbolic byte codes to be executed by certain virtual machines, or in the case of binaries, machine code.

Assemblers translate their assembler code into ONLY machine code (technically assembly code != machine code, for example the three letters "NOP" in 6502 assembles into a single byte "$EA" in machine code), that runs on the target chip.

You see that while they're not 100% the same (assembler is a type of compiler, so compiling is a more general term), in not that serious sense people just use the terms compiling and assembling interchangeably.

...err... What is the topic of this thread again?
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Nerdy Nights week 3 to 8 for Asm6

Post by unregistered »

Gilbert wrote: Thu Jul 21, 2022 10:32 pm
unregistered wrote: Thu Jul 21, 2022 9:15 pm I am ONLY ATTEMPTING to say that assembling and assemblers is NOT the same as compile and compilers.

Compilers translate code written into assembly code that works on whatever machine where the compiling takes place.

Assemblers translate their assembler code into ONLY the assembly code, that runs on a certain chip, that the assembler was created for. :)
Actually:
Compilers translate (usually relatively higher-level language) code written into code that works on the target system. The code in question can be among many things, including some sort of symbolic byte codes to be executed by certain virtual machines, or in the case of binaries, machine code.

Assemblers translate their assembler code into ONLY machine code (technically assembly code != machine code, for example the three letters "NOP" in 6502 assembles into a single byte "$EA" in machine code), that runs on the target chip.

You see that while they're not 100% the same (assembler is a type of compiler, so compiling is a more general term), in not that serious sense people just use the terms compiling and assembling interchangeably.
Ah, yes I agree with you Gilbert on much of what you said. Thank you. :) I totally forgot about machine code, but that’s what I was talking about when I wrote “assembly code”. My “assembler code” was talking about the NOP type code you mentioned.


It’s a terribly tiny matter, but I believe compilers are a separate entity from assemblers. They both produce machine code, but compilers are too far away from machine code, so the machine code they create is usually slower than that produced by an assembler (that’s IF the assembly code is written by a competent programmer).


Yes Gilbert, machine code is technically != to assembly code, but it’s really the same thing, just a simple translation. That’s why compiling is != to assembling, in my minuscule book at least. :)
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Nerdy Nights week 3 to 8 for Asm6

Post by Pokun »

I think an assembler is definitely a type of compiler technically speaking, since compiling is a pretty broad term for about any kind of automatic conversion of code or data. But using the terms "compiler" or "compiling" when talking about assembly is just confusing since most people will think of a high-level language compiler like a C-compiler, so the terms "assembler" and "assembly" should definitely be used in that context.

Assembly and machine code are indeed different things, a microprocessor can't really understand written assembly unless it's rewritten as machine code, which is normally a very direct translation or perhaps more of a decipher. Although assembly and machine code are sometimes used interchangeably I don't think it's a cause of misunderstanding very often, except for beginner programmers that don't yet know exactly what the terms means.
User avatar
donato-zits-
Posts: 47
Joined: Fri Jun 03, 2022 11:14 am
Contact:

Re: Nerdy Nights week 3 to 8 for Asm6

Post by donato-zits- »

too mucha people migrate from NESASM assembler to CC65 or ASM6 but here we have the NESASM in your maximun respect decopiling the SMB3 perfectly, the people here for sure already knows that but well...I,leastwise, do not have see this archive before, and now I arrive in the conclusion that do not matter the assembler that someone use, the great success is about know how everycode goes and get function, I really appreciate someone to give me classes about to find this way,even a remote class since that no one like too mucha this stuff here where I live; here where I live(florianópolis, Brasil) I find only one professor, but he seems to be not the right person because the classes group that he is given class are all about C# lenguage, in other words, he is not in this vibe at all,but he are planing to give me a expensive particular class that I suspect that will maybe to be no so benetit...
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Nerdy Nights week 3 to 8 for Asm6

Post by tokumaru »

Assemblers aren't even required to make games, you could very well just insert opcodes directly into an hex editor and end up with a great game... Assemblers do help though, mainly by allowing you to use labels and mnemonics instead of numbers for everything. Different assemblers will provide extra help, but if you're generally careful and have your own ways of maintaining organization you can do without all the fancy stuff. You can definitely make SMB3 using NESASM or any other assembler.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Nerdy Nights week 3 to 8 for Asm6

Post by Pokun »

To be fair NESASM has more functions and things than ASM6 which is pretty bare bones, but NESASM is also more limiting in certain ways (the bank stuff).
Post Reply