Page 4 of 5

X16 Assembly Tutorial

Posted: Thu Aug 19, 2021 3:56 pm
by rje

Summary of Matt's Videos, as I run through them

Requirements:

 

IF YOU'RE NEW TO THE 6502 OR ASSEMBLY LANGUAGE, START HERE

Lesson One (27m): Foundations. What assembly language is, the 6502 architecture (and related processors), registers, memory addresses and how instructions work.  The anatomy of an assembly language program at 14:00.  lda, inc, sta, and rts.  cl65 invocation at 18:00.  Examining the .list and .PRG at 20:00.  X16 debugger at 23:00.

Lesson Two (32m): Addressing modes. X16 Memory Map intro.  Addressing modes 4:00.  Examples 11:30.  Jump table 22:00.  Build script 26:00, execute & debug.

 

IF YOU'RE A NOVICE, START HERE

Lesson Three (24m): Flow control.  C versus assembly 1:00. Status register and compares 5:45. Loops (C versus assembly) 12:00. Functions (C versus assembly) 13:30.  X16 KERNAL 16:00.  Example program 16:45.

Lesson Four (22m): Unsigned math and logic.  Add- and Subtract-with-carry 3:00. 16-bit arithmetic 5:45.  Inc and Dec 8:00.  Mul and div overview 9:20.  Shift and rotate 11:00.  Bitwise ops 13:20. Logicals 14:50.  Example 16:00.

 

IF YOU DID SOME ASSEMBLY ON SOMETHING ELSE, START HERE

Lesson Five (21m): The Program Stack.  JSR and RTS 6:28. RTI 7:10.  Push and Pull 7:45. Stack transfers 8:50.  Examples of playing with the stack; also .asciiz 11:30.

Lesson Six (22m): New bit test and branch opcodes in the 65C02.  The old BIT 3:00. TRB and TSB 5:45.  BBRn, BBSn, RMBn, SMBn 7:00.  Example 12:00.

Lesson Seven (19m): The rest of the 65C02's instruction set.  Basically Lesson Six, part Deux.  Also, ERRATA for previous sessions starting at 10:00.  Example 12:00.

 

IF YOU'RE NEW TO COMMODORE, BUT NOT 65C02, START HERE

Lesson Eight (36m): The KERNAL.   ROM banks 3:00. Jump table example: CHROUT 4:00. Hacking the jump table 6:00. CHRIN 9:25. GETIN 10:40. Keyboard buffer 11:30. SCREEN 12:50. PLOT 14:00. File load (SETLFS, SETNAM, LOAD) 15:10.  Saving a memory block to file (SAVE) 20:45.  Example involving screen mode, keyboard input, and load/save to file 20:50

 

IF YOU'RE NEW TO THE COMMANDER X16, BUT NOT THE KERNAL OR 65C02, START AT LESSON NINE.

 

 

 

 


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 2:34 am
by Jared_R

I finished the first two videos and have been mesmerized although im feeling lost a bit with some of the stuff that is being discussed. Im thinking that is a me issue and will need to watch the videos a few more times to wrap my head around it. Otherwise this is good content that helps expose assembly to people who've never done it! 


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 3:02 am
by Edmond D


On 2/5/2022 at 6:34 PM, Jared_R said:




I finished the first two videos and have been mesmerized although im feeling lost a bit with some of the stuff that is being discussed. Im thinking that is a me issue and will need to watch the videos a few more times to wrap my head around it. Otherwise this is good content that helps expose assembly to people who've never done it! 



There are many other videos on the 6502 if SlithyMatt's aren't working for you. He won't get offended if you watch someone else, like Ben Eater's build a 6502 computer (which I've yet to watch, but have seen some of his other series) This example is just one of many others that will help you as you journey onward. Consider some great books, such as the Machine Language for Beginners, published by Compute back in the eighties.



You can always return to SlithyMatt's work at some future time. He would most likely be happy you've started programming assembly, and he won't feel cheated on. ?

 





 


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 3:13 am
by Jared_R


On 2/5/2022 at 9:02 PM, Edmond D said:






You can always return to SlithyMatt's work at some future time. He would most likely be happy you've started programming assembly, and he won't feel cheated on. ?

 



Ha! I hope not, his videos are good. I have looked at Ben Eaters videos and bought that kit when it was first started, I just havent had the time to get to the Hello world video yet. I'll have to check out the book and try it out, any others I should look at?


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 7:47 am
by kliepatsch

I have started 6502 assembly with this website: https://skilldrick.github.io/easy6502/

(Although I've had previous experience with x86 assembly.)

I think if you know how to use an ordinary programming language, the most important new aspects in assembly are


  1. Processor registers. You cannot simply operate on as many variables as you like (imagine writing a command like a=b+c*d). Instead, you have to work with a limited set of processor registers, which are essentially variables that are constantly reused for new purposes.


  2. Processor flags. These are essential for program flow. Instead of writing "for i=1 to 10 do something" or "if a=b then do something", you have to use processor flags and conditional jumps ("branches") to control the program flow.


I think when you understood those things, you are good to go

Edit: when I wrote this, I was in a hurry. What I meant was, that these two concepts are the extra challenges, anyone coming from a higher programming language should be extra aware of. You should read about these things and get at least a rough idea about them, before proceeding to learn about assembly instructions.


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 7:08 pm
by Edmond D


On 2/5/2022 at 7:13 PM, Jared_R said:




I'll have to check out the book and try it out, any others I should look at?



The second book is a good followup from the first, as an assembler is the book's project. It builds onward as it's an applied example of what and how to achieve a usefully tool step by step. There are many pieces that  can be taken and used in other applications. 



Given the wide range of tools for assembly on the X16,  another assembler isn't needed in my opinion. So I'd suggest picking a tool and focusing on reporting issues if any in using. Freedback from users is worth gold, and developers who wisely understand and improve their tools are platinum. 



And don't forget to have fun along the way! ?

PS - Give a shout out to those who produce educational material that helped you. Slithy likes "Likes."


X16 Assembly Tutorial

Posted: Sun Feb 06, 2022 11:45 pm
by Ed Minchau


On 2/5/2022 at 7:34 PM, Jared_R said:




I finished the first two videos and have been mesmerized although im feeling lost a bit with some of the stuff that is being discussed. Im thinking that is a me issue and will need to watch the videos a few more times to wrap my head around it. Otherwise this is good content that helps expose assembly to people who've never done it! 



Better yet, try it yourself. Learn to do by doing.


X16 Assembly Tutorial

Posted: Sun Nov 20, 2022 6:07 pm
by kaos

I keep returning to this page whenever I want to see how 65c02 assembly works: https://en.wikibooks.org/wiki/65c02_Assembly

It is easily searchable, and contains (al)most everything useful related to the specifically the CPU.

 

Also the 64TASS documentation: https://tass64.sourceforge.net/#contents

Or the cc65/cl65 assemblers documentation: https://cc65.github.io/

 

I believe the best way to learn, is to do something with it, rather than attempting to learn passively. Write some code, or write the documentation.


Re: X16 Assembly Tutorial

Posted: Sat Jan 28, 2023 1:28 am
by atomSmash
Hey SlithyMatt, I notice the youtube links are no longer available in the early posts of this thread. I'm just curious if that's a technical glitch of the forum? Or perhaps they're out-of-date? Or maybe I have something wrong on my end.

Re: X16 Assembly Tutorial

Posted: Sat Jan 28, 2023 6:58 am
by Edmond D
They seem to still be online here - https://www.youtube.com/watch?v=gqwIzbT ... SL1tkSTRI_