(Updated April 22, 2025) signed8bit.asmLoad Workspace ; This is the start of the 8-bit library. define CHROUT $ffd2 define LZF $30 ; This is test code for the 8-bit printing LDY #0 NUMLOOP: LDA NUMBERS,Y STA $31 ; LSB PHA ; SAVE JSR S8OUT ; PRINT AS SIGNED LDA #7 ; ‘\t’ JSR CHROUT PLA … Read More “Chapter 6502-A – 8-, 16-, and 32-bit Printing.” »
Author: William Jojo
(Updated February 18, 2025) Table of Contents Overview Printing Numbers – Part I Bigger Numbers Bigger Math Printing Numbers – Part II Overview In previous chapters, we’ve glossed over details on numbers and mathematics. This is simply because math on this CPU is hard. Remember that all we can do is add. Even subtraction is … Read More “Chapter 6502-6 – Numbers and Math” »
(Updated April 7, 2025) Table of Contents Overview The First Regex The Better Regex – Part I The Better Regex – Part II Conclusion Overview Overview As we build the program to score and print a series of marks representing a complete game, we should also consider how to measure whether the scoring is legitimate. … Read More “Bowling Regex” »
(Updated November 20, 2024) Overview The process of tokenizing a BASIC program converts the text to a sequence of compressed codes mixed with ASCII (PETSCII) characters. The idea is to have the “compiling” of the code completed and work within an intermediate representation that: Reduces the space occupied by the program. Speeds interpretation of the … Read More “C64 BASIC Tokenizing” »
class Untitled { public static void genPal1() { for( int x = 0; x
import java.io.FileNotFoundException; import java.util.Scanner; import java.io.FileReader; import java.io.PrintWriter; public class Project { public static void main(String[] args) throws FileNotFoundException { String line, rev; int x; Scanner inFile = new Scanner(new FileReader(“Word Salad”)); PrintWriter outFile = new PrintWriter(“copy.txt”); while ( inFile.hasNext() ) { line = inFile.next().toUpperCase(); //System.out.println(line); rev = “”; for ( x = line.length() – … Read More “Project 5 Showcase” »
if (player == ‘S’) { if (computer == ‘B’) { System.out.println(“Computer wins with ” + names[rand] + “.”); } else if (computer == ‘P’) { System.out.println(“Computer had ” + names[rand] + “. You won with ” + names[choices.indexOf(player)] + “.”); wins++; } else { System.out.println(“It’s a draw!”); } } else if (player == ‘P’) { … Read More “Project 4 Showcase” »
String number; int radix; for (int i = 0; i < args.length; i++) { number = args[i].substring(0,args[i].indexOf(':')); radix = Integer.parseInt(args[i].substring(args[i].indexOf(':') + 1)); System.out.println(number + " base " + radix + " is " + Integer.parseInt(number, radix) + " base 10."); } if(args.length>0){ //Checking for input from user for(String input:args){ //Loop to parse //Find the numerical … Read More “Variations on a theme – 111 – Project 1” »
(Updated February 15, 2025) Table of Contents Multi-way If Test Arrays Subroutines Self-modifying Code Multi-way If Test We will use the following code to demonstrate several features once used on the 6502. Example1.asmLoad Workspace define CHROUT $FFD2 start: jsr printres lda #$65 sec sbc #$84 beq printzero bvs printovf bmi printneg bpl printpos end: brk … Read More “Chapter 6502-5 – Beyond the Basics” »
(Updated February 15, 2025) Table of Contents Moving Data Simple Math Compare and Branch Overflow Moving Data While this is a 16-bit addressable space, we can only perform operations 8 bits at a time because our registers are also 8-bit wide. As such, working with 16-bit or 32-bit quantities means some code repetition. Let’s begin … Read More “Chapter 6502-4 – The Basics” »