Reputation: 1629
I have to program in assembly the 6502. I was forced to use the emulator Vice 128 I was told that the Commodore 128 is compatible with the instructions of 6502 I am a novice and I was made a practical demonstration but I did not understand anything. There was an interface of 80 columns which passed with a command (which one?) The instructions in machine language or assembly (the program) were entered directly on this matrix of 80 columns. Also the data are entered in this matrix. So is this matrix the memory? Each line represents what? I was told that this is disassembled code 6502. But I do not know what it means I'm very confused
I want to run this simple program that performs the sum of two numbers. The two numbers are stored in the first page to the word zero and to the word one. I want to store the result in the second word of the first page. I imagined that the first line contains 80 words. Is that right? So I put here the data in hexadecimal (3 and 2).
$03 $02
LDA $00
ADC $01
STA $02
But I have a syntax error. I hope someone can help me because it escapes me how things work. Thanks in advance
Upvotes: 2
Views: 407
Reputation: 453
How to run a disassembled code 6502?
You have to assemble back the code.
Each 6502 instruction stands for 1, 2, or 3 bytes, the first is called the opcode, the optional second or third is the data used by the instruction (the operand).
You need a program to translate the instruction mnemonics to bytes. There were many such programs on the Commodore.
The Commodore 128 had a built-in monitor that let you enter instructions to assemble directly. You can enter it by typing MONITOR
at the BASIC prompt. You would need to first set the address, then use "assemble" commands. Then use the "go" command at the starting address to run it. Use BASIC POKE command to set locations containing data, before you enter the monitor. The address 0B00
is a good address to use as it's the tape buffer which is unused except during tape I/O.
Good luck.
Upvotes: 2
Reputation: 1152
Fir'st, in 6502, we use we deal with bytes, not words. (it's an 8 bit architecture)
You don't mention which macro assembler you are using, but I assume that its trying to interpret $03 as an op code, not data. I looked up two options in ca65 you can use
.BYTE $03 $02
in dasm you use
HEX 03 02
In addition, 6502 has no concept of 80 anything (words, lines whatever). The only 80 I can think of is the old terminals that had 80 columns. I don't see how this is relevant here.
Upvotes: 3