X16 Assembly Tutorial

Tutorials and help articles.

(Posts require approval. See pinned post.)
Forum rules
Post guides, tutorials, and other instructional content here.

This topic area requires approval, so please be patient while we review content to make sure it fits the expectations for this topic area.

Tech support questions should be asked in Hardware or Software support.
SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

X16 Assembly Tutorial

Post by SlithyMatt »

Lesson 17: FM Synthesis
wahsp
Posts: 20
Joined: Thu Apr 15, 2021 8:53 am

X16 Assembly Tutorial

Post by wahsp »


Wow! I didn't know the Commander X16 is capable of FM. I played around a lot with software synths over the years. FM is definitely one of the more interesting approaches to synthesis, if you ask me. There are so many directions you can take it in.

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

X16 Assembly Tutorial

Post by SlithyMatt »

Episode 18: Sprites
Nadia
Posts: 9
Joined: Thu May 20, 2021 4:00 am

X16 Assembly Tutorial

Post by Nadia »


@SlithyMatt Hi I am a new programmer who is having a lot of difficultly understanding the assembly tutorials. I did some basic tutorials for the x16 but the program I want to write would be very difficult to write in basic, which I why I decided that assembly may be my best option. Do you have any advice for figuring out assembly for a beginner. I understand that I am calling things and preforming operations at certain hexadecimal addresses but when things like stack pointers are brought up it becomes very confusing and I have trouble understanding what is going on when I call these hexadecimal addresses. I understand that this is supposed to be more advanced because I am writing machine code, so I am not faulting your tutorials... just wondering if you have any advice to make it easier to understand.

 

borgar
Posts: 52
Joined: Wed Mar 31, 2021 9:30 am
Location: Oslo

X16 Assembly Tutorial

Post by borgar »


There are plenty of tutorials for 6502 assembly out there (here is one that starts gently https://codeburst.io/an-introduction-to-6502-assembly-and-low-level-programming-7c11fa6b9cb9). It might not be a bad idea to do read a few such documents before jumping into videos.

I think you probably should not start out with something too ambitious for your first attempts. You probably can a lot of smaller programs without having to deal directly with the stack pointer. You can start by transferring parameters in the registers (A, X and Y) and/or direct memory addresses (Zero Page or not) and limit your self to implicit stack use with JSR/RTS.

I'd also recommend taking looking at Prog8 (https://prog8.readthedocs.io/en/latest/#). This gives you something a lot faster than Basic while not being as completely low level as assembly.  Prog8 allow inclusion of assembly into the program fairly gracefully when you need "full speed" and if you just need a few really fast (non-recursive) functions you don't not need to learn to use the program stack. And since Prog8 produces assembly output (before producing the binary with 64tass) it will also allow you to learn a lot from looking at the produced output when you are interested.

BTW, back in the day (80's) when I did some limited machine code programming I basically had no understanding of the stack and the only stack related commands I used was just JSR and RTS. But what I wrote then was basically stuff gleaned from some assembly examples in various C64 magazines and I probably only understood about half the 6502 instruction set.

Nadia
Posts: 9
Joined: Thu May 20, 2021 4:00 am

X16 Assembly Tutorial

Post by Nadia »



4 minutes ago, borgar said:




There are plenty of tutorials for 6502 assembly out there (here is one that starts gently https://codeburst.io/an-introduction-to-6502-assembly-and-low-level-programming-7c11fa6b9cb9). It might not be a bad idea to do read a few such documents before jumping into videos.



I think you probably should not start out with something too ambitious for your first attempts. You probably can a lot of smaller programs without having to deal directly with the stack pointer. You can start by transferring parameters in the registers (A, X and Y) and/or direct memory addresses (Zero Page or not) and limit your self to implicit stack use with JSR/RTS.



I'd also recommend taking looking at Prog8 (https://prog8.readthedocs.io/en/latest/#). This gives you something a lot faster than Basic while not being as completely low level as assembly.  Prog8 allow inclusion of assembly into the program fairly gracefully when you need "full speed" and if you just need a few really fast (non-recursive) functions you don't not need to learn to use the program stack. And since Prog8 produces assembly output (before producing the binary with 64tass) it will also allow you to learn a lot from looking at the produced output when you are interested.



BTW, back in the day (80's) when I did some limited machine code programming I basically had no understanding of the stack and the only stack related commands I used was just JSR and RTS. But what I wrote then was basically stuff gleaned from some assembly examples in various C64 magazines and I probably only understood about half the 6502 instruction set.



Thanks for the links. My first program I want to write would be an appointment Calendar for the x16 with some nice graphics for the day. Once program loads you type in the month that you want to add data to. then once on that screen you type in the day number which would open an editor to add times of reminders and description for that day. Once you are done writing all the appointments you have for that month you can save the updated calendar file either to the hard disc or to a floppy for load up later. I figured this maybe too hard to write in

basic so I thought maybe handling more variables would be more suited for assembly. Again thanks for the links, I will continue to follow the series on YT while also reading this more basic documentation and hopefully eventually everything will start clicking in my head.

x16tial
Posts: 177
Joined: Sun Feb 07, 2021 8:23 pm

X16 Assembly Tutorial

Post by x16tial »


This is a great 6502 tutorial: https://skilldrick.github.io/easy6502/

And pretty much all of what you learn there can be applied to the 65C02.    I basically started with that tutorial, and then did a bunch of stuff in the VICE C64 emulator.    At first I was using a Fast Load cartridge image and its built in monitor to do simple Assembly programs.  Then graduated to the Super Snapshot and its built in monitor, but also Turbo Macro Pro (this is all still on the C64).  @Robin Harbron in his 8-bit Show And Tell channel on YouTube turned me on to Super Snapshot and Turbo Macro Pro.  Here is his Assembly Language playlist: 





 

 

I'd recommend cutting your Assembly Language teeth on the C64 (the 6510 is a 6502 with just a few changes).  As the C64 is a fixed and known platform with 35+ years of information that can be easily found on the web.  Then once you're more comfortable with 6502 Assembly, start learning the in's and out's of the X16 and VERA, which should be relatively quick and easy at that point.

johnzo
Posts: 5
Joined: Tue Jul 20, 2021 11:18 am

X16 Assembly Tutorial

Post by johnzo »


just wanted to pop in and say thanks to Matt for these outstanding tutorials!  Looking at the slides, the scripts, and especially the nice clean per-topic demos, seems like there must be hours of work in each hour of video.

voltage
Posts: 9
Joined: Mon Aug 16, 2021 10:43 am

X16 Assembly Tutorial

Post by voltage »


I also want to give @SlithyMatt a huge shout out!

Thanks for the amazing tutorials, very high production value and well thought out and explained info.

I procrastinated the whole day away absorbing these vids, very much appreciated.  

rje
Posts: 1263
Joined: Mon Apr 27, 2020 10:00 pm
Location: Dallas Area

X16 Assembly Tutorial

Post by rje »


Matt, this is an absolutely GIGANTIC and USEFUL resource pile you've created.  I'm going to have to find time to watch them all.

Thank you!

 

Post Reply