Hello, new here, and need best recommandations.

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

unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Hello, new here, and need best recommandations.

Post by unregistered »

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: Select all

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: Select all

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.
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: Hello, new here, and need best recommandations.

Post by Kasumi »

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.
-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.
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.
-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.
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.
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: Select all

;==========

sta $03A0
sta $03A1
sta $03A2
sta $03A3
sta $03A4
sta $03A5
sta $03A6
As is this:

Code: Select all

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: Select all

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.
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.
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Hello, new here, and need best recommandations.

Post by pubby »

There's videos on youtube explaining binary math.
DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean »

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: Select all

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.
Sprite-0002.gif
Sprite-0002.gif (3.18 KiB) Viewed 10251 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."
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: Hello, new here, and need best recommandations.

Post by JRoatch »

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.
DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean »

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.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: Hello, new here, and need best recommandations.

Post by JRoatch »

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?
DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean »

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.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: Hello, new here, and need best recommandations.

Post by JRoatch »

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: Select all

.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: Select all

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: Select all

hello world
Second line
DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean »

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: Select all

.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: Select all

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: Select all

hello world
Second line
Okay. Elaborate or explain each by each about the code.

Unless this is actually cmd hello world code?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Hello, new here, and need best recommandations.

Post by tokumaru »

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

Re: Hello, new here, and need best recommandations.

Post by tokumaru »

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.
JRoatch
Formerly 43110
Posts: 422
Joined: Wed Feb 05, 2014 7:01 am
Contact:

Re: Hello, new here, and need best recommandations.

Post by JRoatch »

Yes it's is a "hello world" of sorts, but with the intention that we know that we can use asm6.

Like many command line programs, asm6 reads input, does some processing, and writes some output.
The input and output are files. In this case should contain what the first and last code boxes have.

The second code box is what you type in the command line prompt to command asm6 to do it's thing.

If you get stuck, explain a bit of what you tried when figuring out my instructions.
DocWaluigean
Posts: 205
Joined: Sun Jun 17, 2018 6:41 pm

Re: Hello, new here, and need best recommandations.

Post by DocWaluigean »

tokumaru wrote:
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.
That's true. But unfortunately, it may be difficult as there's a picky situations where I want something and what I don't want something from template: Like I want 1MB graphic, but I don't want music-limit stuff, which requires me to understand more about templates or mapper.
It's waaaaaaaaay too soon to be thinking about mappers and audio expansions.
True. Although chances where I may learn very fast if the guide is really good!
If you plan on following the Nerdy Nights tutorials to the letter, then NESASM is the way to go.
Not at this time. I'm still giving NHC a try to learn many.
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.
If I can't make up names for codes, there's chances for me [or anyone] to forget connective mnemonics for me [or anyone] to understand or recognize the opcodes or other words. I would've struggle more with ,x / ,y / ,a if I never made up the name, "Charter Comma". Think about if I were young man [like 11 or 14] who really wants to learn 6502, but struggles with complex words like increments. It's one of obstacles where I want to tackle, and also help for autistic people.
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.
Ah, I understand.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Hello, new here, and need best recommandations.

Post by tepples »

DocWaluigean wrote:If I can't make up names for codes, there's chances for me [or anyone] to forget connective mnemonics for me [or anyone] to understand or recognize the opcodes or other words. I would've struggle more with ,x / ,y / ,a if I never made up the name, "Charter Comma".
Would "index comma" have worked?
Post Reply