Page 1 of 1

12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 1:27 am
by Plectic Produx
I am a 12-year-old learning to program! I know STA, LDA, and ADC. I am also interested in the Xbox 360 Motherboard :mrgreen: When i boot up whats the first address the 6502 goes to?

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 1:56 am
by BigDumbDinosaur
Plectic Produx wrote:
I am a 12-year-old learning to program! I know STA, LDA, and ADC. I am also interested in the Xbox 360 Motherboard :mrgreen: When i boot up whats the first address the 6502 goes to?
Following reset, the 6502 will load a start address from $FFFC and $FFFD, those two addresses being collectively referred to as the reset vector. The address at the reset vector, which is stored least significant byte first, will contain the first instruction in the reset code.

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 2:01 am
by GARTHWILSON
I see BDD posted while I was writing. I'll post this anyway, even though he answered the question.

Welcome! I wish I had had this opportunity when I was 12, but common folk back then never saw a computer. Computers were few, far away, and ominous, and the few people who worked on them seemed next to God or something.

When the processor comes out of reset, it reads the reset vector at addresses $FFFC-FFFD to find out where to start executing. You will put the beginning address of your reset routine there. The reset routine does basic stuff to get the computer going, like set up the I/O and initialize the stack and various variables and then launch into your monitor or OS or even an application in ROM. So for example, if your reset routine starts at $814E, you would put $4E in address $FFFC, and $81 in address $FFFD—yes, low byte first, which you'll find out later has a good reason, to enable faster execution in many situations. (You probably wouldn't start out at $814E without a good reason; but suppose, again in our hypothetical situation, that your ROM started at $8000 and you had some data and subroutines laid down before getting to the reset routine.)

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 2:55 am
by barrym95838
Plectic Produx wrote:
I am a 12-year-old learning to program! I know STA, LDA, and ADC ...
Welcome! I believe you have come to the right place to increase your 6502 vocabulary. I knew that machine language existed when I was twelve years old, but it remained a mystery for a few more years ... "Dancing Demon" and "Invasion Force" on the TRS-80 Model 1 in junior high-school gave me a glimpse at the lightning quickness, but the built-in TRS-80 ML monitor was pitiful, so I didn't pursue the Z-80 path. Two years later, my parents helped me buy an 8-bit Apple, and it had a great built-in ML monitor, thanks to Woz. I bought it for the hi-res graphics and quality keyboard, and kept it for the 6502 inside, because I became hopelessly fascinated with 6502 assembly, as I explained in an old thread here:
Quote:
I have been fascinated with 6502 assembly language since 1981, when I mis-typed a DATA statement for a ML sound routine in an Applesoft moon landing program in Softside Magazine, and my Apple ][+ dropped me into the monitor. 6502 assembly is so brilliantly amazing to me. Like Icy said in an old thread which Garth likes to quote, programming the 6502 makes my brain feel good, and it's more of a treat than a chore for me.
I was 15 at the time, and learning (advanced) English, Spanish, French, Trigonometry ... my IQ had probably just about peaked then, and my brain was gobbling up knowledge like a giant alien sponge ... so much so that by the time I reached age 19 I thought I knew everything! Boy, was I wrong ...

Mike B.

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 6:41 am
by ttlworks
Plectic Produx wrote:
I am a 12-year-old learning to program!
Welcome to the forum.

My first computer was the Elektor Junior computer,
had to learn "how to code" after soldering this 6502 hobby kit at age 13...

In my opinion the first Book about the Junior computer is nice reading material for a beginner:
http://retro.hansotten.nl/uploads/eljun ... unior1.pdf

BTW: there is a nice description of the 6502 instruction set starting at page 138 of this book.

Hmm... realizing that I had soldered a computer before the IBM PC was invented suddenly makes me feel a little bit old. ;)

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 8:29 am
by Cray Ze
I was doing the same thing at the same age, I think one thing to try and get a grasp on early is the use of zeropage and the address indexing modes associated with the X and Y registers. Looking at other people's code and trying to understand what it's doing will increase your own skill level too.

Re: 12 year old Learning to program 6502

Posted: Mon Apr 03, 2017 3:59 pm
by White Flame
Which 6502 computer are you using to learn?

Thinking back to my time learning this, I've always had a lack of access to tools & information. I was struggling about with my C64 User's Guide, which didn't get into ML at all, and eventually got a Programmer's Reference Guide from a bargain bin, but still no assembler; the ROM in my machine had a simple memory monitor (no asm/disasm), and I was trying to build an assembler in BASIC but usually ended up with hand-assembled DATA bytes. Oh to have internet access with other computer enthusiasts at the time!

Re: 12 year old Learning to program 6502

Posted: Wed Apr 05, 2017 3:21 pm
by cbmeeks
Welcome!

I also started assembly language programming when I was 12 (43 now...ugh). You're very lucky in that you have a swarm of friendly, knowledgeable people on here that can help you out.

One suggestion I have (if you really want to learn the 6502) is to program one directly. Maybe find an old Commodore 64 or use an emulator such as VICE.

I programmed on real hardware back then with only magazines to help me out. Times have changed. :-D