Page 1 of 1

Hangman for the Commander X16

Posted: Wed Jan 08, 2020 8:16 pm
by Voyager_sput
Hello everyone!

I thought it would be a fun project to learn 6502 assembly by taking a BASIC program from an old computer book and rewrite the BASIC code line by line in assembler. I'm amazing how much BASIC does for you, even the simplest of functions require some creative thinking to get working in assembler.

I'm not the most creative of people, but it was a great way for me to learn about 8-bit and 16-bit logic. From how to print lines of text on screen, capture user input or how to deal with line and character control (and quirks of the Commander X16 emulator). Trying to add a few small features like a blinking cursor was good fun!

Hangman may not be the most interesting game to play, but i'm curious to hear what you all think about this little project. I've included the files you need to assemble and run it yourself (or just run the binary in the Emulator).

The source code is in the Sources folder, there's a modified version of Keiths BasicFunctions.asm file in the SrcAll file you'll need to assemble the game, since i'm using Keiths PrintChar function, but modified it for some more character and line control. I've also included the Font bitmap in the ResAll folder if you don't have Keiths DevTools. There's also a build binary in the BldX16 folder. You can run the binary in the Commander X16 Emulator r35 or r36 (haven't tried any older versions).

Looking forward to read your tips and advice to improve my understanding of assembler!

Cheers, Marc

Re: Hangman for the Commander X16

Posted: Thu Jan 09, 2020 11:04 pm
by akuyou
I had a quick go at this yesterday, It's fantastic, though it seems my wordiness* is a bit lacking these days, as I didn't do very well!

It's a very impressive project to take on as your first effort as I imagine it must have been pretty complex in places, and it seems to work superbly - I need to have more of a go at it later when I get time.

What do you plan for it next... is this done, or are you planning to add graphical or gameplay changes?

Keep up the good work,

Keith

* https://www.reddit.com/r/TheSimpsons/co ... wordiness/

Re: Hangman for the Commander X16

Posted: Fri Jan 10, 2020 2:05 pm
by Voyager_sput
Hi Keith,

I considered this project to be 'done'. I could change the ASCII art for the hangman around for some sprites. But I have a different project in mind to make better use of the sprites then a static picture of a person handing by a rope... ;)

This was more of a project to bridge the gap for me between a 'higher' level programming language like BASIC and Assembler. I feel like I learned a great deal on how to code for a 6502 CPU.

If you poke the game hard enough, i'm sure a bug or two would pop up. I know of one issue where it might not like it if the letter you guess consists of more then one letter :shock: ...

I also feel like the code could be cleaner or more optimized. But i'm honestly not sure how, or where to do that. Still lots to learn :)