It is currently Thu Jun 21, 2018 2:25 pm

 All times are UTC - 7 hours

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: NES Programming Tutorial : Source Code StructurePosted: Sat Mar 11, 2017 11:24 am

Joined: Wed Apr 07, 2010 1:14 am
Posts: 484
Location: Iran

* We use decimal numbers (0 ~ 9) in our usual usage to count : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ...

* Computers use binary numbers (0 and 1) : 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, ...

* Long series of binary numbers are not pleasant for human eye, so we force computers to show us hexadecimal numbers (0 ~ F) : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, ...

* You can use windows calculator to convert Binary, Decimal and Hexadecimal numbers to each other :

/////////////////////////////////////////////////////////////////////////////////////////////////

Code:
;NES Programming Tutorial
;Level 1 : Source Code Structure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;PRG codes \$8000 ~ \$FFFF (32KB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;CHR data \$0000 ~ \$1FFF (8KB)

Explanation :

* Lines starting with ; are just comment

* Save the file with the name of : "Game.asm"

* Game.asm is called source code, because it has codes, right?

That's all for today!

/////////////////////////////////////////////////////////////////////////////////////////////////

Exercise :

Write your name inside of the source code as a comment!

/////////////////////////////////////////////////////////////////////////////////////////////////

Files :
Game.asm

/////////////////////////////////////////////////////////////////////////////////////////////////

Former Level : NES Programming Tutorial : Intro
Next Level : NES Programming Tutorial : iNES Header

Last edited by FARID on Thu Mar 16, 2017 11:55 pm, edited 12 times in total.

Top

 Post subject: Re: NES Programming Tutorial : Source Code StructurePosted: Sat Mar 11, 2017 8:18 pm

Joined: Wed Nov 30, 2016 4:45 pm
Posts: 110
Location: Southern California
Chapter 18 of my 6502 primer is "Program-Writing: Where Do I Start?", at http://wilsonminesco.com/6502primer/PgmWrite.html . I wrote it in response to a 6502.org forum post years ago which was typical of several such posts. It said, "and no one really ever tells you in what program do you put the code." It's not NES-specific, but it should be very helpful.

There's also chapter 20 of the same 6502 primer, on programming tips, at http://wilsonminesco.com/6502primer/PgmTips.html . There are a lot of suggestions to improve code efficiency, readability, and productivity.

There are plenty of other relevant 6502-oriented articles on the same site for when the person reaches an intermediate programming level, for example the 6502 stacks treatise in 19 sections plus appendices, at http://wilsonminesco.com/stacks/, and the one on forming program structures in assembly language by using macros, at http://wilsonminesco.com/StructureMacros/index.html, and the one on simple ways to do multitasking without a multitasking OS, at http://wilsonminesco.com/multitask/index.html .

_________________
http://WilsonMinesCo.com/ lots of 6502 resources

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki