Commodore 128 Programmer's Reference Manual page 194

Hide thumbs Also See for 128:
Table of Contents

Advertisement

184
COMMODORE 128
appears in the first instruction you entered. You must have an RTS instruction at the end
U
of the routine if you want to return to BASIC. Often, the Kernal must be resident in the
current configuration in context in order to obtain results.
i" ■
The opcode is the 8502 instruction that is carried out by the microprocessor when
j |
your program is running. See the 8502 Instruction Set Table in Chapter 5 for allowable
^
instructions.
The operand is the address or value that is acted upon by the opcode in the
I
instruction. If the operand field is preceded by a pound sign (#), the opcode will act
lj
upon a constant value. If no pound sign is specified, the microprocessor assumes the
opcode will act upon an address.
\ j
Remember to separate each field in the instruction with at least one space. If you
[J
don't, the computer indicates that an error has occurred by displaying a question mark at
the end of the instruction.
Once a routine is displayed on the screen, the monitor allows shortcuts in entering
j
instructions. To display a listing of a machine language program, issue the DISASSEM-
°
BLE command as follows:
D 04000 04010 RETURN
\ j
The "D" stands for disassemble. The first number (04000) specifies the starting
memory location in which you want the contents displayed. The second number
^
specifies the end address in which to display.
Now for the shortcut. Since the address where the opcodes are stored is already on
^
the screen, you can simply move the cursor to the opcode field, type over the exist
ing opcode and operand on the screen, erase any unwanted characters and press
) j
RETURN
. The computer registers the instruction in memory by displaying the
[J
hexadecimal values for the opcode and operand directly to the left of the opcode
mnemonic you just entered. This is a faster and easier way of entering machine-
language routines, rather than typing the ASSEMBLE command and the address each
time you enter an instruction.
U
EXECUTING (RUNNING)
U
YOUR MACHINE-LANGUAGE PROGRAM
Lj
Once you have finished entering your machine language routine, you may execute it in
three different ways. Within the monitor, issue the GO or JUMP to Subroutine com
mand as follows:
J J
G F1800
(JMP)
^
J F1800
(JSR)
The G stands for GO, or go to the start address of the machine language program
j
in memory, and begin executing it at the specified address. The value following the
'-*
letter G refers to the start address of your routine. The J stands for Jump to Subrou
tine, similar to the JSR mnemonic in machine language.
j j
The third way to invoke a machine language routine is to exit the monitor by
jj

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents