new to the 6502 of things
Re: new to the 6502 of things
Somehow I was reminded of a manual for an apple ii program which I think does a good job of introducing machine code and assembly language programming. See this previous thread:
The Visible Computer - 6502
The manual is here (pdf).
Perhaps also see this other previous thread:
Best way to start learning 6502 Assembler
Keep trying: you will find that the lightbulb will come on, at some point, and things will make sense.
The Visible Computer - 6502
The manual is here (pdf).
Perhaps also see this other previous thread:
Best way to start learning 6502 Assembler
Keep trying: you will find that the lightbulb will come on, at some point, and things will make sense.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: new to the 6502 of things
That "MACHINE LANGUAGE FOR BEGINNERS" book has an intended audience -- hobbyists who already know BASIC and their machine fairly well. If you aren't in that group, then a bit of confusion is certainly understandable, even for a sharp guy like yourself. Congratulations on your pending arrival! Plan for some late nights with that one.
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
so i have taken on board the recommendations , but some one them e reads are mainly for the apple from what i can make out. ,
I'm gravitating toward the commodore / vic / c64 etc. i have again hit a learning wall again so i bought another book! this time 6502 machine language , for beginners it has quite abit of humour within it which was quite nice to read although I'm not if it was meant to be funny in places .. anyway i engaging a page regarding the following
7 6 5 4 3 2 1 0
MSB <<<< >>>> LSB
1 0 1 1 0 1 0 0
ok so the book then starts talking about "high order byte" & "lower order byte" , but doesn't really explain what they are and how to work out from the example above which is actually from the book. i have attempted to read up on it from various places but its not really explaining how to work them out...
now my theory is it whatever half adds up to the most out of decimal value , is that the high order byte too? or am i barking up the wrong tree.?
I'm gravitating toward the commodore / vic / c64 etc. i have again hit a learning wall again so i bought another book! this time 6502 machine language , for beginners it has quite abit of humour within it which was quite nice to read although I'm not if it was meant to be funny in places .. anyway i engaging a page regarding the following
7 6 5 4 3 2 1 0
MSB <<<< >>>> LSB
1 0 1 1 0 1 0 0
ok so the book then starts talking about "high order byte" & "lower order byte" , but doesn't really explain what they are and how to work out from the example above which is actually from the book. i have attempted to read up on it from various places but its not really explaining how to work them out...
now my theory is it whatever half adds up to the most out of decimal value , is that the high order byte too? or am i barking up the wrong tree.?
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: new to the 6502 of things
oscilloscope wrote:
now my theory is it whatever half adds up to the most out of decimal value , is that the high order byte too? or am i barking up the wrong tree.?
Suppose you have the number 1234 sitting in memory. A memory cell can only hold 0-255, so the number is stored in two pieces. In the case of 1234, the first or lower memory cell will contain 210. The second or higher memory cell will contain 4. The number would be interpreted as 4 × 256 + 210. This is a universal idiom with the 6502 family, in which 4 is the high order byte or most significant byte, and 210 is the low order byte or least significant byte.
As you can see, numbers that exceed 255 are stored "backwards" in memory in multiple pieces. We call the backwards storage method "little-endian."
In hexadecimal, 1234 would be represented as $04D2, the dollar sign indicating that this is a hexadecimal value. Within that number, $D2 is the least significant byte and $04 is the most significant byte.
Last edited by BigDumbDinosaur on Thu Oct 28, 2021 4:26 pm, edited 1 time in total.
x86? We ain't got no x86. We don't NEED no stinking x86!
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
BigDumbDinosaur wrote:
oscilloscope wrote:
now my theory is it whatever half adds up to the most out of decimal value , is that the high order byte too? or am i barking up the wrong tree.?
Suppose you have the number 1234 sitting in memory. A memory cell can only hold 0-255, so the number is stored in two pieces. In the case of 1234, the first or lower memory cell will contain 210. The second or higher memory cell will contain 4. The number would be interpreted as 4 × 256 + 210. This is a universal idiom with the 6502 family, in which 4 is the high order byte, or most significant byte, and 210 is the low order byte or least significant byte.
As you can see, numbers that exceed 255 are stored "backwards" in memory in multiple pieces. We call the backwards storage method "little-endian."
In hexadecimal, 1234 would be represented as $04D2, the dollar sign indicating that this is a hexadecimal value. Within that number, $D2 is the least significant bye and $04 is the most significant byte.
oh my , so here goes . I have just watched a video on big & little endian. now its got me thinking , so little-endian flips the bits backwards so there high bits are on the left... apposed to the right , so it the cells add up to the high end side of the >>> 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0
and i fathom the 6502 runs on little-endian binary notation ? i know i have repeated some of what you said but i think its sinking in slowly. and the brain is flexing and it feels good to learn...
now that being said so the high side would be the most significant bit? as is its in little-endian?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: new to the 6502 of things
oscilloscope wrote:
so little-endian flips the bits backwards so there high bits are on the left... opposed to the right
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
GARTHWILSON wrote:
oscilloscope wrote:
so little-endian flips the bits backwards so there high bits are on the left... opposed to the right
I just large question all written out as i was trying to make sense of the big & little endian notations and byte order etc , and i think i had a light bulb moment. although i could be very wrong.
so big-endian is written positional numbering notation like 1 ,2 ,3 ,4, ,5 etc little endian is reversed 5 , 4 , 3 , 2 , 1 , appreciate that is not a to scale of binary and hex i'm just trying to make sense of it all. i feel i am close. , and the least significate bit would be 5 on big endian ? , and the most sign most significate bit on little endian is 1 ?
all?
i did get a little confused from the page you linked me and jumping from 3-4 different places to make sense of the notations.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: new to the 6502 of things
oscilloscope wrote:
i feel i am close. , and the least significate bit would be 5 on big endian ? , and the most sign most significate bit on little endian is 1 ?
There was another twist when 16-bit processors got into the mix (see middle-endian or The NUXI problem), but you probably don't need to dig that deeply to gain a working understanding.
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: new to the 6502 of things
barrym95838 wrote:
There was another twist when 16-bit processors got into the mix (see middle-endian or The NUXI problem), but you probably don't need to dig that deeply to gain a working understanding.
I have to mildly admonish you not to add to his confusion with the NUXI problem. It's not applicable to a 65(C)02 system, so better if we keep it out of the discussion.
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: new to the 6502 of things
oscilloscope wrote:
so big-endian is written positional numbering notation like 1 ,2 ,3 ,4, ,5 etc little endian is reversed 5 , 4 , 3 , 2 , 1 , appreciate that is not a to scale of binary and hex i'm just trying to make sense of it all. i feel i am close. , and the least significate bit would be 5 on big endian ? , and the most sign most significate bit on little endian is 1 ?
As Garth said, endianess has nothing to do with bits, only bytes. Please reread my earlier explanation and DO NOT THINK IN TERMS OF BITS!
x86? We ain't got no x86. We don't NEED no stinking x86!
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
BigDumbDinosaur wrote:
barrym95838 wrote:
There was another twist when 16-bit processors got into the mix (see middle-endian or The NUXI problem), but you probably don't need to dig that deeply to gain a working understanding.
I have to mildly admonish you not to add to his confusion with the NUXI problem. It's not applicable to a 65(C)02 system, so better if we keep it out of the discussion.
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
BigDumbDinosaur wrote:
oscilloscope wrote:
now my theory is it whatever half adds up to the most out of decimal value , is that the high order byte too? or am i barking up the wrong tree.?
Suppose you have the number 1234 sitting in memory. A memory cell can only hold 0-255, so the number is stored in two pieces. In the case of 1234, the first or lower memory cell will contain 210. The second or higher memory cell will contain 4. The number would be interpreted as 4 × 256 + 210. This is a universal idiom with the 6502 family, in which 4 is the high order byte or most significant byte, and 210 is the low order byte or least significant byte.
As you can see, numbers that exceed 255 are stored "backwards" in memory in multiple pieces. We call the backwards storage method "little-endian."
In hexadecimal, 1234 would be represented as $04D2, the dollar sign indicating that this is a hexadecimal value. Within that number, $D2 is the least significant byte and $04 is the most significant byte.
I have read it over and over again.... so i have some questions....
So memory cell 1 has 210. memory cell 2 has 4. so why times 4 x 256 --- ? is it because 4 is half of the 8 bits :shugs: , and 256 is becauseeee 0-255 can hold in a memory cell.?
so is the higher memory cell (2) is that because its physically higher in the number chain?
so little endian is backwards.... which I'm understanding slowly at a snail pace....
ah man its harder then i thought i think
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: new to the 6502 of things
oscilloscope wrote:
So memory cell 1 has 210. memory cell 2 has 4. so why times 4 x 256 --- ? is it because 4 is half of the 8 bits :shugs: , and 256 is becauseeee 0-255 can hold in a memory cell.?
so is the higher memory cell (2) is that because its physically higher in the number chain?
so is the higher memory cell (2) is that because its physically higher in the number chain?
Code: Select all
4 D 2
0100 1101 0010The $4D2 goes into your two memory locations this way:
Code: Select all
Memory address 0001 holds the $D2 which is 11010010 in binary.
Memory address 0002 holds the 4 which is 00000100 in binary.http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
-
oscilloscope
- Posts: 16
- Joined: 14 Sep 2021
Re: new to the 6502 of things
GARTHWILSON wrote:
oscilloscope wrote:
So memory cell 1 has 210. memory cell 2 has 4. so why times 4 x 256 --- ? is it because 4 is half of the 8 bits :shugs: , and 256 is becauseeee 0-255 can hold in a memory cell.?
so is the higher memory cell (2) is that because its physically higher in the number chain?
so is the higher memory cell (2) is that because its physically higher in the number chain?
Code: Select all
4 D 2
0100 1101 0010The $4D2 goes into your two memory locations this way:
Code: Select all
Memory address 0001 holds the $D2 which is 11010010 in binary.
Memory address 0002 holds the 4 which is 00000100 in binary.i do have a tendency to over think things and assume something is far more difficult when it comes to learning things , i have stuck with binary as it makes sense.. well sort of, i still need the 128 , 64 , 32 etc etc to hover around when i am understanding it, i work it out in binary then change it to hex..
i do hope it clicks soon , the whole odd way the RAM numbering locations , is a whole different head ache i'm not looking forward too.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: new to the 6502 of things
oscilloscope wrote:
i do have a tendency to over think things and assume something is far more difficult when it comes to learning things , i have stuck with binary as it makes sense.. well sort of, i still need the 128 , 64 , 32 etc etc to hover around when i am understanding it, i work it out in binary then change it to hex..
You mentioned using the C64. One of our kids used it extensively with GEOS to write reports 'n' stuff in junior high, but I never got familiar with it. I do remember however that its BASIC only let the user deal with numbers in decimal, which I never could figure out, since certain things are easier in hex and it had to convert internally anyway.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?