It is currently Tue Oct 16, 2018 9:54 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 341 posts ]  Go to page Previous  1 ... 19, 20, 21, 22, 23  Next
Author Message
PostPosted: Wed Oct 03, 2018 8:50 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10892
Location: Rio de Janeiro - Brazil
DocWaluigean wrote:
What features does ca65 have that ASM6 doesn't?

A more robust macro system that allows you to automate repetitive tasks, more advanced memory management that allows you to fill ROM and RAM non-linearly (i.e. source code organized by context), modular assembly (you can assemble parts of your program separately and combine them later), and so on.

Most of these are things you don't know you need when you're starting out, but as your programs grow more complex, you start to wish there were better ways to organize the source code and keep everything easy to maintain, and that's when you realize that ca65 can help you.


Top
 Profile  
 
PostPosted: Wed Oct 03, 2018 8:57 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 149
tokumaru wrote:
DocWaluigean wrote:
What features does ca65 have that ASM6 doesn't?

A more robust macro system that allows you to automate repetitive tasks, more advanced memory management that allows you to fill ROM and RAM non-linearly (i.e. source code organized by context), modular assembly (you can assemble parts of your program separately and combine them later), and so on.

Most of these are things you don't know you need when you're starting out, but as your programs grow more complex, you start to wish there were better ways to organize the source code and keep everything easy to maintain, and that's when you realize that ca65 can help you.


It sounds like something I'd do if I was in charge of NESMaker but for free.

Ah. But unfortunately it's all in CMD right?


Top
 Profile  
 
PostPosted: Thu Oct 04, 2018 6:00 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20657
Location: NE Indiana, USA (NTSC)
The 8-bit value itself isn't signed or unsigned. The context is signed or unsigned, and the value has an interpretation within that context.

In an unsigned context:

%00000101 means 5
%11111011 means 251

The same 8-bit values in a signed context:

%00000101 means 5
%11111011 means -5

The context is distinguished implicitly by what instructions occur around them, such as what thresholds are used in CMP, which branch instructions, and the like. There's no "unsigned mode" or "signed mode" that you have to put the processor into, the way there are "8-bit mode" and "16-bit mode" on a different CPU.

If you need a mouse-driven front-end to ca65, as opposed to something that works from command prompts, batch files, and makefiles, you could try NESICIDE.


Top
 Profile  
 
PostPosted: Thu Oct 04, 2018 9:53 am 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 936
Location: cypress, texas
DocWaluigean wrote:
unregistered wrote:
Note: we will deal with #255 as the hardware (the 6502) sees it... in binary: #11111111b
11111111 is positive [unsigned]

and 11111111 is negative [signed]

because, like tepples said, bit7 is set and so the "signed" way of using 11111111 makes that represent a negative number (-1).

You can experiment with Windows 10's Calculator to better understand signed and unsigned. Open Calculator, click the three horizontal lines in the upper left, click "Programmer's Mode". Click on the QWORD until it reads BYTE. Click on BIN. Type or click 11111111. Notice that the signed decimal value, next to DEC, reads -1. Now click BYTE again and it will goto QWORD. Then click the C to clear the calculator. Next type or click 11111111 again. Now the value next to DEC will read 255 (that's the unsigned version of #11111111b).

Windows 10's Calculator's Programmer's Mode always switches the decimal version (next to DEC) to signed when the left most bit of the value is set. Have to go... sorry.


It's alright.. I'm a little confused though.

So...

00000000 is unsigned

00100000 is unsigned

01000000 is signed

10000000 is signed

11000000 is signed

11010101 is signed

Is this what it means?...
Not quite... like tepples just said, signed and unsigned are just contexts or ways of thinking about binary values... i.e.

00000000 binary is interpreted as 0 (unsigned decimal) and 0 (signed decimal)

10000000 binary is interpreted as 128 (unsigned decimal) or -128 (signed decimal)

Signed (there are various ways of signed) and unsigned were created in many students' Master's Theses. A day was spent by me searching through part of the UT in Austin library with Master's Theses. It was so exciting for me to just hold look at some of the documents where these cool ways, of using binary values, were birthed! :D Those Theses were written a little bit after the time-frame when the computer was discovered/invented/implemented, I think.

The contexts, as tepples wisely taught, are only relevant to certain code... i.e.
Code:
lda Potatoe
bmi +n
  ;code for positive signed values here
+n
  ;code for negative signed values here

;this bmi branches with signed decimal values -1 through -128.  But, for this simple code it may be preferrable to think that this bmi branches for all binary values with bit7 set.  Those are just two valid ways of thinking of this code. :)



edit: Remember to play with Windows' Calculator. If you open the Calculator app in Windows 10 and change it into "Programmer" mode as was explained on the previous page and in the quote above... it's super helpful! :) If you change "Programmer" mode use 8-bits (BYTE), and then click the up arrow key, you can play with RoL and RoR. Click the up arrow again to change those buttons back to Lsh and Rsh. 6502 equivalents are: rol, ror, asl, and lsr. :)


final edit: if you decide to use an assembler that requires CMD, like ASM6, make sure to create a batch file. My batch file is named "assemble.bat" and it contains:
Code:
asm6 -L yourfilename.asm yourgamefilename.nes
@echo  on %date% at %time% :)
Now all I have to do to build my .nes file is open CMD, change to the directory containing my "assemble.bat", and type assemble and press enter.
Typing out the first line each time caused me problems after a while and tokumaru helped me to start using a batch file. :) (Note: the second line is susposed to start with @


added 10/08/2018


Last edited by unregistered on Mon Oct 08, 2018 1:52 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Oct 06, 2018 1:36 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1250
Quote:
After this lesson, can we learn about how to turn program on from scratch with blank screen before we can go on to the next lesson?

No. Like I said, the 18th was basically the end. I don't have time anymore for more lessons. Even assuming I did have time, still no. There's a lot more I'd teach before doing anything at all with the NES. It's not to be mean. It's just not a good idea to try to avoid all the things you don't yet know while trying to build a ROM.
Quote:
-Do I ALWAYS have to put LDX #$## at the start of each? or Each label always reset if outside of the labels or the BME/BDA labels stuff?

You put # when you want a number, and you don't put # when you want an address. Branches work with addresses, so you don't want a #. I am not sure what you mean by labels resetting.
Quote:
A : You CANNOT use Register A for absolute effect! [Only X and Y can do it.]

You can totally use A with the absolute addressing mode. There's no such thing as absolute,a like absolute,x or absolute,y if that's what you mean.
Quote:
-The Absolute Effect [Or The "Compass-Comma" I made it up]

Don't make up terms! And especially don't introduce made up terms before you define them. You used your new term absolute effect in the quote above "You CANNOT use Register A for absolute effect!" but how am I supposed to know what that is when you only defined it below, right here?

For more than 30 years, the already existing terms have been in use. You are creating a barrier for experienced people understanding you when you make up new things.
Quote:
The numbers in STA 200/1/2 is treated as a file cabinet, and when you did LDA 200,X which is 1, you "basically pull out the file cabinet box, and take the numbers that's stored into Address Code $0201, which is 2." And that result, Register A is now holding number 2?

Yes.
Quote:
I don't know why no responses on other things that could help give insights; a lot of teachers in the past is willing to answer different questions that could help out students more. Being there for students even most ridiculous questions [at least in topic] raises confidences, curiosity, and trust....

I said three weeks ago, and a couple times since that I would not have much time for this anymore after September 18th. It is far after September 18th.

This is a horizontal line that can be made a loop.
Code:
;==========

sta $03A0
sta $03A1
sta $03A2
sta $03A3
sta $03A4
sta $03A5
sta $03A6


As is this:
Code:
sta $03BF
sta $03BE
sta $03BD
sta $03BC
sta $03BB
sta $03BA
sta $03B9

;=========

Note that it's writing to sequential addresses, it's just backwards. ($03B9 is first.) If you rearrange them like this:
Code:
sta $03B9
sta $03BA
sta $03BB
sta $03BC
sta $03BD
sta $03BE
sta $03BF
;=========

It should make it more clear that it's a sequence.
Quote:
Here's the problem; I don't know how It supposed to work with the number from, "IF 0, GOTO LABEL" style. At this knowledge, there is no, "IF #==#, GOTO LABEL" style. When I tried the zero, it painted a lot of things until the X = 0. The only thing I got it good is on the last part of coding.

Because that's how the loops end. With a branch on zero. If you want to check other numbers, yes, you need to learn a new instruction. But you don't need to do so to complete the assignment, or I'd have taught it.

For the purposes of this assignment, If you want to stop at any random address, that's the address you use before the ",x". This works because zero plus anything equals that thing.

zero plus $456 = $456. zero plus $03B9 equals $03B9. You can stop on any address when X equals zero.

So if X is zero, sta $456,x will store the value in A to $456. If X is zero, sta $03B9,x will store the value in A to $03B9.

I'm not gonna get into signed/unsigned stuff that really requires a new lesson and I have much more sporadic time now. Apologies if the next post is in another week.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Sat Oct 06, 2018 7:05 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 380
There's videos on youtube explaining binary math.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 6:46 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 149
If I stay too long in this lesson, I will surely be feeling to quit, so I don't want to take the risk. I can always go back and perfect it.

Code:
lda #$04
ldx #$1F
toplineloop:
sta $0200,x
dex
bne toplineloop
sta $0200

;===

sta $0220 ; Hat Vertically [Up/Down]
sta $023F
sta $0240
sta $025F
sta $0260
sta $027F
sta $0280
sta $029F
sta $02A0
sta $02BF
sta $02C0
sta $02DF
sta $02E0
sta $02FF
sta $0300
sta $031F
sta $0320
sta $033F
sta $0340
sta $035F
sta $0360
sta $037F
sta $0380
sta $039F

;==========
;XXXXXXXXXXXXXXXXXXXXXXXX

;LDA #$04
;LDX #$9
;middle1:
;sta $03A0,x
;DEX
;CMP $03B9
;BEQ middle1
;XXXXXXXXXXXXXXXXXXXXXXXXX

;---------------

;XXXXXXXXXXXXXXXXXXXXX
;lda #$04
;ldx #$B9
;j:
;sta $03A0,x
;dex
;bne j
;sta $0200

;XXXXXXXXXXXXXXXXXXXXXXXXXXXXX

;-----------

sta $03A0
sta $03A1
sta $03A2
sta $03A3
sta $03A4
sta $03A5
sta $03A6
sta $03BF
sta $03BE
sta $03BD
sta $03BC
sta $03BB
sta $03BA
sta $03B9

;=========

sta $0398
sta $0397
sta $0396
sta $0395
sta $0394
sta $0387
sta $0388
sta $0389
sta $038A
sta $038B

;=========

sta $0370
sta $0371
sta $0372
sta $0373
sta $036F
sta $036E
sta $036D
sta $036C

;========

ldx #$0D ; Eye Color Light Green Left
stx $038C
stx $03AC
stx $03CC
stx $03EC

ldy #$0E ; Eye Color Light Blue Right

sty $0393
sty $03B3
sty $03D3
sty $03F3

;========

lda #$01 ; Lip color White
sta $04AA
sta $04CB
sta $04CC
sta $04CD
sta $04CE
sta $04CF
sta $04D0
sta $04D1
sta $04D2
sta $04D3
sta $04D4
sta $04B5

;---
lda #$08

sta $03C0
sta $03DF
sta $03E0
sta $03FF
sta $0400
sta $041F
sta $0420
sta $043F
sta $0440
sta $045F
sta $0460
sta $047F
sta $0480
sta $049F
sta $04A0
sta $04BF
sta $04C0
sta $04DF
sta $04E0
sta $04FF
sta $0500
sta $051F
sta $0520
sta $053F
sta $0540
sta $055F
sta $0560
sta $057F
sta $0580
sta $059F
sta $05A0
sta $05BF
sta $05C0
sta $05DF



;***********************

LDX #$E0

bottomlineloop:
sta $05DF,x
dex
bne bottomlineloop


If lesson is stopped for a while, or long time, I want to thank you so much Kasumi for helping me progress immensely compare to my previous knowledge of 6502 when I sign up here.

Now... even though I don't know all knowledge, I need to find someway to keep learning or to get to learning on turning on NES. So I made an animation with Aseprite to show the example of what I want after the 3 2 1 stuff.

Attachment:
Sprite-0002.gif
Sprite-0002.gif [ 3.18 KiB | Viewed 154 times ]


So if the lesson is done for now or for long time at this timeline, the first test I need is to make NES turn on 100% without using any already-created templates. Like the first posts, I got ASM6 and Notepad ++. And then something about iNES mirror something...? Around in those CPU NES, there's an Address Code I gotta find that "If it get's STA'd into 1, the entire system will be on for NES."


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 8:02 pm 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 359
Location: us-east
DocWaluigean wrote:
The first test I need is to make NES turn on 100% without using any already-created templates.

There are many beginning steps in a running NES game/program, each of which can be considered "turned on at 100%" by various people.
  1. The cartage is in and the CPU loads bytes $fffc and $fffd into the Program Counter (PC). The emulator equivalent would be to successfully load a ROM without it throwing an error at you.
  2. The graphics chip (PPU) is warmed up a few thousand CPU cycles later.
  3. Various NES and Cartridge hardware have been initialized to a sane state.
  4. Memory is cleared, and or your own program logic is initialized.
  5. The contents of your first screen or scene is loaded and displayed.
  6. The game/program is waiting for the next frame, and or input from the controller pads.

At which point would you consider it 100% booted?

If it's to the point where that animated GIF is animating on the NES, Then the step of setting up the contents of your scene is going to be very complicated. This would require knowing how to format all those animated GIF frames into data suitable for the graphics chip, or being able to use tools that can do that job for you.


Last edited by JRoatch on Tue Oct 09, 2018 8:26 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 8:24 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 149
JRoatch wrote:
DocWaluigean wrote:
The first test I need is to make NES turn on 100% without using any already-created templates.

There are many beginning steps in a running NES game/program, each of which can be considered "turned on at 100%" by various people.
  1. The cartage is in and the CPU loads bytes $fffc and $fffd into the Program Counter (PC). The emulator equivalent would be to successfully load a ROM without it throwing an error at you.
  2. The graphics chip (PPU) is warmed up a few thousand CPU cycles later.
  3. Various NES and Cartridge hardware have been initialized to a sane state.
  4. Memory is cleared, and or your own program logic is initialized.
  5. The contents of your first screen or scene is loaded and displayed.
  6. The game/program is waiting for the next frame, and or input from the controller pads.

At which point would you consider it 100% booted?


For my view of 100% booted:

-It shows gray, default color.
-ABSOULTELY NO error upon boot-up.
-Able to place any code into the ASM after boot-up succeed.
-It can be turn on WITHOUT pre-made preset, template, NROM template that koisuki maded, anything pre-made and pre-created
-You can put ANY any code into the booted ASM without facing limit or problems because of pre-made or something.
-If it's easy for me to study to make the lesson elementary.

I sometimes repeat myself, but I want to know the core-corest details about 6502 Assembly, and for NES. So with knowledge of booting up NES and others:

Outside of knowledge, it will strongly motivate me to keep going in NES more persistence than before.

Inside of knowledge, I will able to pull Satoru Iwata and able to be "The Superman" of 6502 like his extreme knowledge of programming many years ago, and I could successfully make teachings for kids at best rate possible.

[I might not explain well?]

EDIT:

About animating? That's the few steps after I got it boot up. The animation with chalkboard is a type of objective or mission of my idea.

Also, it would be good if I could just put "Hello World!" in similar style of difficulty as just typing out "PRINT "HELLO WORLD!", but with tiles instead.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 8:41 pm 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 359
Location: us-east
When the default gray color shows, that's when the the graphics chip has warmed up. All you'll need is a valid .nes file. Frankly it's kind of odd you specifically don't want a template for this part as that is basically all you need to succeed in generating such a file. It's like saying we need a 8.5 by 11 inch piece of paper but it can't be precut.

Sorry if I got lost in the thread, which assembler will you be using?


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 8:53 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 149
JRoatch wrote:
When the default gray color shows, that's when the the graphics chip has warmed up. All you'll need is a valid .nes file. Frankly it's kind of odd you specifically don't want a template for this part as that is basically all you need to succeed in generating such a file. It's like saying we need a 8.5 by 11 inch piece of paper but it can't be precut.

Sorry if I got lost in the thread, which assembler will you be using?


If I use a template, I will literally be missing out on everything on starting to make the base for .NES ASM stuff. I may never learn how to make it compatible for mapper, support NES music of N106, etc. if I rely on template too much.

Besides, in real life, the paper made by hand is verry out-dated and difficult to make for pre-cut. XD I'd love to make a canvas for watercolor and acrylic, but it gets too complex and real life money for me to do it.

They mention NESASM3 is the most popular for beginners because of Bunnyboy. Tokumaru saided ASM6 [NESASM6 I call it.] is the best for beginners, and ca65 is for advanced homebrewers atm.

I feel I'll go with ASM6.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 9:15 pm 
Offline
Formerly 43110
User avatar

Joined: Wed Feb 05, 2014 7:01 am
Posts: 359
Location: us-east
Ok, so let's see if we can get asm6 to work.

in a plain text editor such as Windows Notepad enter and save the following as "test.asm"
Code:
.db "hello world", $0d, $0a, "Second line", $0d, $0a

In a round about way, this will basically instruct asm6 to make a file that is just 2 lines of plain text (not a nes file or anything yet).

Then in a command line window tell asm6 to assemble it
Code:
asm6.exe test.asm output.txt

This step might difficult if you don't know what a command line window is, or how to use it. I'm assuming a lot here.

If successful there will be a file named "output.txt" that contains the text
Code:
hello world
Second line


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 9:24 pm 
Offline

Joined: Sun Jun 17, 2018 6:41 pm
Posts: 149
JRoatch wrote:
Ok, so let's see if we can get asm6 to work.

in a plain text editor such as Windows Notepad enter and save the following as "test.asm"
Code:
.db "hello world", $0d, $0a, "Second line", $0d, $0a

In a round about way, this will basically instruct asm6 to make a file that is just 2 lines of plain text (not a nes file or anything yet).

Then in a command line window tell asm6 to assemble it
Code:
asm6.exe test.asm output.txt

This step might difficult if you don't know what a command line window is, or how to use it. I'm assuming a lot here.

If successful there will be a file named "output.txt" that contains the text
Code:
hello world
Second line


Okay. Elaborate or explain each by each about the code.

Unless this is actually cmd hello world code?


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 9:32 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10892
Location: Rio de Janeiro - Brazil
DocWaluigean wrote:
If I use a template, I will literally be missing out on everything on starting to make the base for .NES ASM stuff.

Quite the contrary! It's better to study/dissect/break a known good template to figure it out than start from nothing without knowing what to do. You need quite a bit of knowledge about the NES architecture and how assemblers work to be able to create a valid .NES file on your own from scratch, and most newbies *don't* have that knowledge. You can't become a painter only from studying how paints and paintbrushes work, you have to see how other painters do it in practice.

Quote:
I may never learn how to make it compatible for mapper, support NES music of N106, etc. if I rely on template too much.

It's waaaaaaaaay too soon to be thinking about mappers and audio expansions.

Quote:
They mention NESASM3 is the most popular for beginners because of Bunnyboy.

If you plan on following the Nerdy Nights tutorials to the letter, then NESASM is the way to go.

Quote:
Tokumaru saided ASM6 [NESASM6 I call it.] is the best for beginners

Please don't make up names for stuff, it's confusing. ASM6 and NESASM are equally easy to use, but they have slightly different syntax. The number 1 annoying thing about NESASM is that it forces you to use 8KB banks, regardless of the actual bank size of the mapper you're using.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 9:34 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10892
Location: Rio de Janeiro - Brazil
DocWaluigean wrote:
Unless this is actually cmd hello world code?

He's teaching you the basics of ASM6 so you understand how it translates a source file into a binary file. Once you get that, you can start changing the source file so the output is not any binary file, but a valid NES file.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 341 posts ]  Go to page Previous  1 ... 19, 20, 21, 22, 23  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: battagline 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