It is currently Sat Dec 16, 2017 12:33 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Mar 11, 2017 11:24 am 
Offline
User avatar

Joined: Wed Apr 07, 2010 1:14 am
Posts: 484
Location: Iran
Binary, Decimal, Hexadecimal numbers :

* 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, ...

Image

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

Image

* Need more info then read this : Hexadecimal

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

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


Explanation :

* Download Notepad++ and start NES programming!

Image

* 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
 Profile  
 
PostPosted: Sat Mar 11, 2017 8:18 pm 
Offline

Joined: Wed Nov 30, 2016 4:45 pm
Posts: 93
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
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 5 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