It is currently Mon May 20, 2019 7:22 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Thu Feb 21, 2019 3:33 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
FrankenGraphics wrote:
The easiest way is to simply drag and drop your text file onto asm6.exe. If your code contains syntax errors, you'll hardly notice anything and it won't produce a file. If your code is error-free, then it will produce a file (theNameOfYourTextfile.bin) in the same folder. So this method is good when you want to do something quick. But it's probably not the best method if you don't know your way around the syntax just yet.

But the proper way (most of the time) is to either:

A)
-open command prompt in your project folder
-type: asm6 yourMainCodeTextFile.asm myGame.nes listing.txt

or

B)
-make a new text file
-type this:
Code:
asm6 yourMainCodeTextFile.asm myGame.nes listing.txt
pause

-and save as "assemble.bat" or something like that.
-double click assemble.bat

the pause is important to be able to have a chance to get a look at the program readout.

obviously, replace my mockup file names with something that makes sense to your project.


as a suggestion, keep a copy of asm6 in each project folder. It simplifies things like not needing to specify full paths in the command line or batch (.bat) file.


For reference, here's what the readme file says:
Code:
Usage:

        asm6 [-options] sourcefile [outputfile] [listfile]

Options:

        -?         Show some help
        -l         Create listing
        -L         Create verbose listing (expand REPT, MACRO)
        -d<name>:  Define a symbol and make it equal to 1
   -q         Quiet mode (suppress all output unless there's an error)
        Default output is <sourcefile>.bin
        Default listing is <sourcefile>.lst


It says other things too that are important to read.

I'll see if I can get mine to work here in a few minutes.
I just wanted to know if I would have to make a game loop for this game or not... I know that the games FPS is 60 for most nes games.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 3:51 am 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2014
Location: Gothenburg, Sweden
You don't need a loop for a 6502 program to assemble or execute, but it is certainly practical.

There are many steps left before you need to bother about frames etc, but the cliffs' notes of it is that a frame is automatically drawn every 60th or 50th fraction of a second as long as you've turned rendering on. Between the time it takes rendering a frame, there's also a brief period where the PPU is available for interfacing with the program.

To be able to update what's being rendered, you should:

-write an NMI loop (there are good templates on the nesdev wiki)
-set the NMI vector to a label that is at the top of your NMI loop.
-after your start/warmup/initialization routine, enable NMI

NMI (non maskable interrupt) is hardwired to happen once per frame on the NES: when the last frame is done rendering and you have a pocket of time between it and the time for rendering the next frame. It is during this time you do stuff like uppdating video memory and read the controllers. During rendering, on the other hand, you do game logic and write to update buffers which the NMI routine in turn can pick up when it is their time again.

a vector could be described a sort of an "emergency number" that the cpu will call everytime something very specific happens. The 6502 has three such hotdial/emergency numbers/vectors:
NMI (described above)
reset (when the reset button is pressed)
break (when the BRK instruction is used - this instruction is typically only used by programmers when debugging, and isn't something you typically find in completed software).

These three addresses must be stored at the end of the 64kB range that the CPU can view. It will always look for them there.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 7:01 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
FrankenGraphics wrote:
You don't need a loop for a 6502 program to assemble or execute, but it is certainly practical.

There are many steps left before you need to bother about frames etc, but the cliffs' notes of it is that a frame is automatically drawn every 60th or 50th fraction of a second as long as you've turned rendering on. Between the time it takes rendering a frame, there's also a brief period where the PPU is available for interfacing with the program.

To be able to update what's being rendered, you should:

-write an NMI loop (there are good templates on the nesdev wiki)
-set the NMI vector to a label that is at the top of your NMI loop.
-after your start/warmup/initialization routine, enable NMI

NMI (non maskable interrupt) is hardwired to happen once per frame on the NES: when the last frame is done rendering and you have a pocket of time between it and the time for rendering the next frame. It is during this time you do stuff like uppdating video memory and read the controllers. During rendering, on the other hand, you do game logic and write to update buffers which the NMI routine in turn can pick up when it is their time again.

a vector could be described a sort of an "emergency number" that the cpu will call everytime something very specific happens. The 6502 has three such hotdial/emergency numbers/vectors:
NMI (described above)
reset (when the reset button is pressed)
break (when the BRK instruction is used - this instruction is typically only used by programmers when debugging, and isn't something you typically find in completed software).

These three addresses must be stored at the end of the 64kB range that the CPU can view. It will always look for them there.


I kinda get the picture I also drag and dropped my Main.asm into the asm6 creating the bin file. Does this mean that I did everything okay? or am I missing out on something? I noticed it didn't create a .nes file.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 7:13 am 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2014
Location: Gothenburg, Sweden
that’s all right. bin is just asm6 standard file extention output. Rename it .nes and it will be associated to your preferred emulator. Now, provided that you have writtwn a header at the top of your code, the file will be run by the emulator.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 7:36 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
FrankenGraphics wrote:
that’s all right. bin is just asm6 standard file extention output. Rename it .nes and it will be associated to your preferred emulator. Now, provided that you have writtwn a header at the top of your code, the file will be run by the emulator.


Just followed this guys tutorial on Youtube I think I understand a bit of it although I haven't created a header yet.
I'm guessing that allows the emulator to know what kind of file it is and other properties it requires for it to run.

https://www.youtube.com/watch?v=JgdcGcJga4w

This is actually quite fun so far! :P


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 8:33 am 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2014
Location: Gothenburg, Sweden
That's right - the header tells the emulator what sort of medium to emulate. Games came on all sorts of variant cartridge PCB:s (and also disks for the famicom) that expanded on the original feature set of the console. These variations are offhandedly referred to as mappers, even though "mapper" technically refers to a specific device on a pcb that maps a wider range of addresses than the cpu natively can view. For example, the standard cartridge variant NROM (a good starting point for anyone) technically has no mapper: Just 32kB:s of program ROM, and 8kB:s of separate graphics ROM. This makes it straightforward to begin with.

I think it is important to mention at this point that for running your software on the physical console itself, you shout not include the header. That's just for emulators.

Oh yeah, his tutorial is both informative and fun. I think it's a great replacement or alternative to "nerdy nights".


There's one thing you need to know about asm6 that makes it a bit devious... if you mispell an instruction or do something else that is not accepted by its syntax, it will treat that typo as a label. That can result in bugs that the assembler won't warn you about. So be careful to double check your spelling and syntax if something seems to be off.

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 10:41 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
FrankenGraphics wrote:
That's right - the header tells the emulator what sort of medium to emulate. Games came on all sorts of variant cartridge PCB:s (and also disks for the famicom) that expanded on the original feature set of the console. These variations are offhandedly referred to as mappers, even though "mapper" technically refers to a specific device on a pcb that maps a wider range of addresses than the cpu natively can view. For example, the standard cartridge variant NROM (a good starting point for anyone) technically has no mapper: Just 32kB:s of program ROM, and 8kB:s of separate graphics ROM. This makes it straightforward to begin with.

I think it is important to mention at this point that for running your software on the physical console itself, you shout not include the header. That's just for emulators.

Oh yeah, his tutorial is both informative and fun. I think it's a great replacement or alternative to "nerdy nights".


There's one thing you need to know about asm6 that makes it a bit devious... if you mispell an instruction or do something else that is not accepted by its syntax, it will treat that typo as a label. That can result in bugs that the assembler won't warn you about. So be careful to double check your spelling and syntax if something seems to be off.


I've actually got quite a bit of errors when running the basic

Code:
LDA #$01
STA $0200
LDA #$05
STA $0201
LDA #$08
STA $0202


I don't think I did anything wrong with it either. I feel like I am missing out on something obvious here :|


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 9:54 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
I got it to work :lol:

Edit: I got an error

ld65: Warning: c:\cc65\cfg/nes.cfg(63): Segment 'HEADER' does not exist
ld65: Warning: c:\cc65\cfg/nes.cfg(63): Segment 'STARTUP' does not exist
ld65: Warning: c:\cc65\cfg/nes.cfg(63): Segment 'VECTORS' does not exist
ld65: Warning: c:\cc65\cfg/nes.cfg(63): Segment 'CHARS' does not exist


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 10:03 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11345
Location: Rio de Janeiro - Brazil
Weren't you using ASM6?


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 10:48 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
tokumaru wrote:
Weren't you using ASM6?


Yes although I needed to do this (Below)

Code:
-STEP ONE-

ca65 blinktest.asm -o blink.o -t nes

-STEP TWO-

ld65 blinktest.o -o blinktest.nes -t nes


What I did was

-STEP ONE-
Code:
cc65 blinktest.asm -o blink.o -t nes <=  :lol:
ca65 blinktest.asm -o blink.o -t nes


yeah.. kinda messed it up when compiling


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 10:53 am 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 143
Location: Edmonton, Canada
test_matsu wrote:
tokumaru wrote:
Weren't you using ASM6?

Yes although I needed to do this (Below)


You are not using asm6, you are using cc65 :) It is different assembler/compiler.

You can download asm6 here: http://3dscapture.com/NES/asm6.zip (the version from the nesdev wiki, I'm not sure if I should advise the fork, as I don't use asm6)

Edit: added link to asm6


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 11:11 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
yaros wrote:
test_matsu wrote:
tokumaru wrote:
Weren't you using ASM6?

Yes although I needed to do this (Below)


You are not using asm6, you are using cc65 :) It is different assembler/compiler.

You can download asm6 here: http://3dscapture.com/NES/asm6.zip (the version from the nesdev wiki, I'm not sure if I should advise the fork, as I don't use asm6)

Edit: added link to asm6


Lol I am, I just started to use it.


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 11:39 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11345
Location: Rio de Janeiro - Brazil
Wait, ere you using ASM6 or ca65? It can't be both!


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 11:52 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
tokumaru wrote:
Wait, ere you using ASM6 or ca65? It can't be both!


I just used this guys tutorial from ZERO PAGES
https://www.youtube.com/watch?v=JgdcGcJ ... 2613182640


Top
 Profile  
 
PostPosted: Fri Feb 22, 2019 12:05 pm 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2014
Location: Gothenburg, Sweden
Yeah Michael is using ca65, and his tutorials are really nice to follow.

Did you figure out how to use .segments?

_________________
http://www.frankengraphics.com - personal NES blog


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group