Manipulate a byte

When you get a tweet like this thrown at you, the only thing to do is to take another visit to the wonderful world of the C128 monitor. Let’s say that we were to make a program using assembler. We will store it at address 4096. Enter the machine code monitor by typing MONITOR, and view the current disassembled instructions at 4096 by typing D 1000.

The command for entering a line of assembly code is called A. You have to keep in mind that the disassembled machine code that D is displaying, has a slightly different format than the assambly you type in. Basically you type A, followed by the target address, the name of the instruction, and an operand (if any).

To simply enter a byte into memory, use the F command. Like the POKE command in Commodore Basic, you use F to set a 8-bit value at a specific address. The difference between POKE and F, is that F takes two addresses, and fills the given range with the given value, while POKE only deals with one address at the time. You would need to make an iteration, perhaps using FOR, to have POKE to fill a range. Type F, followed by the start and end address, and concluded with the byte. This will change one single byte at the address 4096:

F 1000 1000 3

Type M 1000 to see the effect.

Leave a Reply

Your email address will not be published. Required fields are marked *