Recommendations for VIC-20 assembly tutorial, tools

Basic and Machine Language

Moderator: Moderators

Post Reply
USA_Joe
Vic 20 Drifter
Posts: 23
Joined: Wed May 31, 2023 11:14 am
Location: USA_California
Occupation: Retired

Recommendations for VIC-20 assembly tutorial, tools

Post by USA_Joe »

I'm new to assembly language, and I would like to learn it for the VIC-20. I have some source code that I would like to examine to see if I can find a bug(s) that is present (I didn't write the code). Before I can do that, I need to learn assembly for the VIC-20, and I need a recommendation on a good tool to write, edit, save, load, assemble, etc on the VIC-20. I have several ebooks on VIC-20 assembly, but they all tend to lean towards a specific tool that I need enter the code for, and then hopefully run it without errors. If this is the best method, that's fine. I just need to know.

Any and all recommendations on a good tutorial and tools are appreciated!

Joe
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by Mike »

USA_Joe wrote:I have some source code that I would like to examine to see if I can find a bug(s) that is present (I didn't write the code).
That is a somewhat strange motivation to start out with 6502 machine language, but then so be it.

You might want to take a look at my VICMON primer. Only requirements are the bare machine, the VICMON cartridge and some storage medium, alternatively, all that in emulation.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by srowe »

USA_Joe wrote: Sun Jan 28, 2024 12:39 pm I'm new to assembly language, and I would like to learn it for the VIC-20.
There's a range of books that could be of help, which one(s) that will work for you depends on your background, how much knowledge you already have of the hardware, etc.

https://commodore.bombjack.org/generic/ ... essors.htm
I have some source code that I would like to examine to see if I can find a bug(s) that is present (I didn't write the code).
This is quite an advanced stage in your learning journey. There are tools that claim to do automatic reverse engineering but there are so many subtle idioms with writing 6502 assembler that it takes experience to understand what exactly the code is doing.

To start with I would
  1. Read some of the introductory books
  2. Look at some well-commented code
  3. Experiment writing and debugging simple applications
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by chysn »

USA_Joe wrote: Sun Jan 28, 2024 12:39 pm I need a recommendation on a good tool to write, edit, save, load, assemble, etc on the VIC-20.
Note: Shameless self-promotion lies ahead.

wAx is the finest native assembler ever released for the VIC-20. If you get the wAxpander Deluxe Edition (with the printed manual*), you'll find copious tutorials and examples. Most of what you learn about VICmon's syntax will apply, but VICmon treats the actual VIC-20 as an afterthought, and the cartridge version will set you back about the same amount of money for something that does less and lacks the expansion memory.

Here's just one of many examples.... Mike's primer on VICmon is excellent, but observe the absurd process for entering string data. This isn't just Mike's process design; it's literally the way to do it with VICmon! Meanwhile, check out the wAx wiki** for wAx's myriad memory editor capabilities.

Whatever you decide to do, enjoy the journey. You're in the right place!

https://www.etsy.com/listing/1171784258 ... xe-edition
________________
* Get the manual PDF: https://github.com/Chysn/VIC20-wAx2/blo ... Manual.pdf
** Or see the wiki here: https://github.com/Chysn/VIC20-wAx2/wiki/Memory-Editor
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by D-Type »

Once you get it assembled to a binary image, you might consider single stepping the code it in MAME Debugger, I've successfully debugged someone else's broken code this way.

MAME Debugger is very robust and has good options for live viewing memory in resizeable windows and setting breakpoints, much better than the basic Debugger functonality in VICE.

If you're feeling brave a bit later, you could also consider analysis in Ghidra, a bit of a steep learning curve, but end results are excellent.

Have a look at my (almost complete) JETPAC Reverse Engineering GitHub README.md for a flavour of what's possible from scratch, before doing it I knew nothing next to nothing about the VIC or 6502:
https://github.com/phillipeaton/JETPAC_ ... isassembly
P*h*i*l*l*i*p EEaattoon in real life
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by MrSterlingBS »

Hello,

For me, the tools from chibi have established themselves.
There I can then switch very quickly either to a program from disk or tape or to a module. Of course, this is only possible in conjunction with the VICE emulator. If you have any questions about usage, I'm happy to help.

Best regards
Sven

https://www.chibiakumas.com/6502/vic20.php
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by thegg »

Hi,
You might like to take a look at CBM prg Studio. It is a Windows IDE giving you the ability to develop software for the VIC 20 and other Commodore machines in both Basic and assembly. The assembler is straight forward to use and is supported by a help facility and tutorials. The IDE has a built in debugger which is good enough for simple debugging. It is also simple to run programs directly in Vice and use the Vice debugging facilities.

I have used it to develop the games I have shared on this forum and find it ideal. Take a look. There is a new release just available.

Whatever you choose, you will find good support here on Denial.
User avatar
AndyH
Vic 20 Afficionado
Posts: 364
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by AndyH »

Love CBM PRG Studio, I use it for creating some BASIC things. I also used C64 Studio which integrates the VICE debugging directly into the editor. My favourite tool is Turbo Rascal, which is a Pascal language and you can break out to assembler at any time.
--
AndyH
HEWCO | Vic 20 blog
User avatar
Soloman
Vic 20 Amateur
Posts: 44
Joined: Fri Sep 22, 2023 1:46 am
Location: Bilthoven, Netherlan
Occupation: Data-analyst

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by Soloman »

I am learning assembler with this book: Compute! Machine language for beginners. Written by Richard Mansfield. You can download this book for free. It is for the 6502-chip and among onthers, the VIC-20.
USA_Joe
Vic 20 Drifter
Posts: 23
Joined: Wed May 31, 2023 11:14 am
Location: USA_California
Occupation: Retired

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by USA_Joe »

Thank you for all of the replies! I greatly appreciate it!

It is a strange motivation to learn assembly, but it ignited the fire just the same. To be specific, I have a copy of some VIC 20 Diagnostic firmware that has a bug when it comes to determining how to display on the screen (I get odd colors). My real VIC 20 is NTSC, and the code was tested on VICE for both PAL and NTSC, and it works under VICE (I was told this by the developer). But on my VIC 20, I get those odd character colors. So there is a bug somewhere in the software. And I like to try and fix things on my own, so there's the spark resulting in the ignited interest is assembly.

I've read on a few boards that determining a PAL VIC 20 from a NTSC VIC 20 via software apparently requires taking into account the number of rasterlines and cycles per line available per system. Of course, this is information I might be able to use later. For now, it's just information to bookmark.

I do have several of the books mentioned, and I have downloaded and used (once) CMB Prg Studio. I will have to look at all of the other resources mentioned.

Thank you once again!

Joe
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Recommendations for VIC-20 assembly tutorial, tools

Post by Mike »

USA_Joe wrote:To be specific, I have a copy of some VIC 20 Diagnostic firmware that has a bug when it comes to determining how to display on the screen (I get odd colors).
Are you sure this is not due to a hardware bug (faulty colour RAM, for example) in your VIC-20 itself? In that case it would be a waste of time to search for a bug in the Diagnostic firmware.

Please note that this kind of software employs techniques not readily used in other kinds of programs - you will find lots of code that seems to serve no purpose, yet it checks whether CPU, registers, data bus, address bus, RAM, ROM and I/O work as supposed by executing instructions that are supposed to return results that would normally be taken for granted ... if the hardware is O.K.

Those techniques are unlikely to be explained in your average assembly tutorials being out there.
Post Reply