40 Best Machine Code Routines For C64
40 Best Machine Code Routines For C64
40 Best Machine Code Routines For C64
. 1]5~
I
~OOD~
(b@lIDill OO@(illTI1J~~
.
L5@OO mrn
- -
~(ID~~(IDlID(IDwrn ~
Duckworth
Contents
Preface
11
ROM Routines
26
27
30
34
36
42
6. Pixel scroll left: scrolls the screen one pixel to the left.
48
51
56
59
62
64
68
75
77
79
84
86
88
90
91
94
100
23. CHAR: puts a text or UOG character onto the highres screen.
101
108
110
113
116
122
130
135
137
139
141
143
149
153
157
161
167
40. Split screen: allows you to split the screen into text
and screen using raster interrupts. You specify where
the change is to take place and whether text or high res
is at the top or the bottom.
169
Preface
This book is not intended to teach you machine code on the
CBM 64. It contains 40 machine code routines that can be used
in your Basic or machine code programs to do things that are
not implemented in the standard BASIC or operating system
in your Commodore 64.
The book includes a listing of Supermon which is a public domain
assembler / disassembler written by Jim Butterfield (thanks Jim).
It can be used to enter the programs in this book if you do not
possess an assembler. The listings are all given twice: once in
an assembled listing from the PAL assembler from Proline
Software (this, along with POWER, is the best machine code
development package that I have seen), and once in a
disassembled version suitable for entering with Supermon or
similar.
I hope that you find the book useful and that the routines help
to improve your programs.
Acknowledgments
I would like to thank my parents Jack and Sheila Greenshields,
my sister Louise, Graeme Douglas, William Drummond, Mark
Kelly and all my relations for their encouragement.
M.G.
10
Supermon
There follows a listing of Supermon which is a public domain
assembler/disassembler/monitor. Thanks to Jim Butterfield for
this program. The Basic program which follows is used to enter
this assembler. You will need this assembler or a similar one to
enter all the programs in this book.
Supermon is listed as a hex dump, which is a listing of
hexadecimal numbers. This makes it easy to enter into a Basic
loader program.
To enter Supermon, type in the following commands in direct
mode (where < return> means press the return key), and then
type in the Basic loader and save it.
POKE 43,1 < return >
POKE 44,32 < return >
POKE8192,0 < return >
NEW < return >
Now run the loader and you will see the prompt:
.0800 ?
You will see that the first number corresponds with the first
number in the Supermon listing. This is where you type the data.
The first three lines that you would type are as follows. Type
the program in without spaces .
.0800 ? 001A086400992293
.0808 ? 1210101010535550
.0810 ? 45522036342D4D4F
Don't worry if you don't understand what you are typing in. Just
type exactly what is printed and it will work. It is worth it as
writing machine code using an assembler is far easier than doing
11
12
followed by parameters.
The first command that we will look at is 'A'. This stands for
ASSEMBLE and is the most frequently used command in any
assembler. It will be used for entering almost all the programs
in this book. The syntax for' A' is as follows:
A (start address in hex) (mnemonic) (operand).
e.g. A 1000 LOA # $10
The address is the starting address in hex. The mnemonic is the
assembly language command and the operand is the number
associated with the command if there is one.
After you press return from the first line, if it is incorrect syntax,
the computer will prompt you with an 'A' and the next address.
Therefore you need only enter the starting address, the assembler
does the rest. To leave the assembly press the return key.
Here is a simple example program which shows you how the
assembler works .
.A
.A
.A
.A
1000
1002
1005
1008
LOA # $00
STA $0020
STA $0021
RTS
This program makes the screen and the border black. Type it
in to see how to use the assembler. If you make an error the
computer will print a question mark. If this happens use the
normal screen editor and change the mistake and delete the
question mark. Press return and if the next address is prompted
then the line is now correct.
Now that you have typed this in, you may want to save the
program. The command to do this is'S'. The syntax is as follows:
S"name" ,device,start,end + 1
The total length of the name must not exceed 16 or a question
13
mark will be printed. The device is the device that the computer
is to save to: 01 is tape and 08 is disk. The O's before the number
are essential for correct syntax. The start is the starting address
in hex of the save. The end + 1 is the end address plus 1 that
the computer is to save to. The reason that you must save up
to the end + 1 is that the ROM routine used to save to memory
saves up to but not including the end address specified. All the
parameters must be separated by a comma.
The next command is the command to execute a program in
machine code from the assembler. It is 'G' and has the syntax:
o start
e.g. 0 1000
This command clears the screen and prints a page of commands.
To see more press 0 and return.
The next command is the same as '0' except that it prints a
continuous listing without clearing the screen. The command
is 'P' and it has the syntax:
P start end
It is mainly used when you want a printer listing. To print a
disassembly to the printer type the following in Basic:
OPEN4,4 : eM 04 : SYS38893
(The SYS assumes that the monitor is at its default position in
memory. If it isn't, use your address.)
14
The printer will print something and then you can type what
you want. You can use 'P' or 'M' (coming up next). To disable
the printer when it has finished type 'X' < return> (explained
later) and type CLOSE4. < return>.
Often you will want a listing of memory in hex (which Supermon
was listed in). This is done with the 'M' command which has
the syntax:
M start end
where start and end are in hex. This command may also be used
to the printer. You may also change memory by using this
command and then typing over values and pressing return at
the end of each line.
The monitor has a command to fill areas of memory with a
number. It is 'F' and it has the syntax:
F start end byte
where start and end are addresses in hex and byte is a byte in hex.
Supermon can move parts of memory to another part. The
command is 'T' which stands for transfer memory. It has the
syntax:
T oldstart oldend newstart
where oldstart, old end and newstart are addresses in hex.
If you want to find the contents of the registers at any time,
type the command 'R' on its own.
If you are working in the assembler and you want to load a
program into memory where it came from, there are two ways
to do this:
1. return to Basic and type LOADlname",device,1
e.g. To load the file hello from tape type LOAD"HELLO", 1, 1
15
Meaning
X
R
G FFD2
1 HES="0123436789ABCDEF"
10 PRINT"(CLR}"
20 FORA=2049T04587STEPS
30 GOSUBI000:REM CONVERT ADDRESS TO HEX
IN HS
40 PRINT".";HS;:INPUT AS:REM 8 HEX NUMBE
RS
50 FORX=ITOI6STEP2
16
60 BS=MIDS(AS,X,2)
70 GOSUB2000:REM CONVERT HEX NO. TO DECI
MAL
80 POKEA+X/2,HEX
90 NEXT:NEXT
100 INPUT"SAVE TO TAPE OR DISK";TDS
110 IFTDS="D"ORTDS="T"THEN120
115 GOT0100
120 IFTDS="D"THENDEV=8
130 IFTDS="T"THENDEV=l
140 FORA=0T034:READB:POKEA+49152,B:NEXT:
POKE49153,DEV:INPUT"ARE YOU SURE";SS
150 IFSS="N"THEN100
160 SYS49152: REM SAVE ASSEMBLER
170 PRINT"MACHINE CODE SAVED"
180 PRINT"IT MAY BE LOADED FROM TAPE OR
DISK IN THE NORMAL WAY LIKE A BASIC"
190 PRINT"PROGRAM AND THEN RUN"
200 END
1000 Nl=INT(A/4096):N6=(A/4096-N1)*16:N2
=INT(N6):N3=INTN6-N2)*16)
1010 N4=(N6-N2)*16)-N3)*16
1030 HS=MIDS(HES,N1+1,1)+MIDS(HES,N2+1,1
)+MIDS(HES,N3+1,1)+MIDS(HES,N4+1,1)
1040 RETURN
2000 FORV=1T016:B=V-1:IFLEFTS(BS,1)=MIDS
(HES,V,1)THEN2020
2010 NEXT
2020 HEX=B*16
2030 FORV=1T016:B=V-1:IFRIGHTS(BS,1)=MID
S(HES,V,1)THEN2050
2040 NEXT
2050 HEX=HEX+B
2060 PRINT HEX
2070 RETURN
10000 DATA 162,1,160,1,32,186,255,162,26
,160,192,169,8,32,189,255,162,236,160
10010 DATA 17,169,251,32,216,255,96,83,8
5,80,69,82,77,79,78,0
200000PEN15,8,15:INPUT#15,AS,BS,CS,DS:P
RINTAS,BS,CS,DS:CLOSE15
17
PC SR AC XR YR SP
.197FE 33 ee 28 ee F6
.:e8ee
.:e8m8
.:e81m
.:e818
.:e82m
.:e828
.:S83m
.:e838
.:m84m
.:S848
.:m85m
.:m858
.:m86m
.:m868
.:m87S
.:e878
.:S88e
.:e888
.:m89m
.:m898
.:m8AS
.:m8A8
.:m8Bm
.:m8B8
.:S8ce
.:S8C8
.:m8Dm
.:e8D8
.:m8Em
.:m8E8
.:m8Fm
.:e8F8
.:S9mm
.:mge8
.:m91m
.:m918
.:e92m
18
ee
12
45
4E
lA
ID
52
em
m8
ID
2S
31
112m 2m
2S 2m 2S
em 4B m8
2m 2E 2E
55 54 54
4C 44 mm
28 C2 28
35 36 AC
AA 31 32
AA AA AA
AA AA AA
AA AA AA
A5 2D 85
A5 37 85
Am ee A5
C6 22 Bl
DS e2 C6
Fm 2185
C6 23 C6
24 AA A5
37 De m2
9137 8A
C6 38 C6
9S B6 C9
85 33 A5
ee 4F 4F
ee 8D 16
8D 17 m3
me em D8
8D 3D 92
8D 3B 92
8A E9 92
mm em 8D
64
ID
36
m8
2m
2m
78
4A
45
66
34
C2
37
AA
AA
AA
22
24
22
22
23
26
22
26
C6
48
37
4F
38
4F
m3
A9
68
68
68
8D
39
8e
ID
34
6E
2e
2e
8e
49
52
88
33
28
29
AA
AA
AA
A5
A5
De
De
C6
A5
Bl
65
38
A5
68
De
85
4F
AD
8e
8D
8D
AA
3A
e2
99 22
53 55
2D 4D
mm 99
2m 2m
2m 2m
99 22
4D 2m
46 49
82 em
29 AA
34 34
ee ee
AA AA
AA AA
AA AA
2E 85
38 85
e2 C6
3C A5
22 Bl
22 Dm
22 18
25 48
C6 37
37 Dm
9137
ED A5
34 6C
AD E6
E7 FF
2m 9S
3E m2
3C m2
68 A8
m2 98
BA 8E
93
5e
4F
22
2e
2S
11
42
45
9E
32
29
ms
AA
AA
AA
23
25
23
22
22
e2
65
A5
68
m2
18
37
37
FF
me
FF
68
68
38
E9
3F
:0928
.:0930
.:0938
.:0940
.:0948
.:0950
.:0958
.:0960
.:0968
.:0970
.:0978
.:0980
.:0988
.:0990
.:0998
.:B9A0
.:09A8
.:09B0
.:09B8
.:09C0
.:09C8
.:09D0
.:09D8
.:09E0
.:09E8
.:09F0
.:09F8
.:0A00
.:0A08
.:0A10
.:0A18
.:0A20
.:0A28
.:0A30
.:0A38
.:0A40
.:0A48
.:0A50
.:0A58
.:0A60
.:0A68
02
2A
34
02
0D
EA
0D
EA
C9
A2
8A
BD
EC
3A
A9
54
0B
F1
A2
03
00
A9
48
4C
EA
20
A0
02
20
20
F8
20
20
~A
E1
A5
90
20
F0
FA
20
20
20
E6
E6
D0
EA
A9
EA
2E
0E
0A
C6
4C
02
08
FD
20
60
00
4C
C6
02
20
57
A2
D2
3B
20
48
8D
00
69
79
00
FF
C3
2E
41
E0
00
B7
57
57
C1
26
F8
A9
2E
EA
F0
DD
AA
FF
ED
A5
85
B0
33
20
00
ED
1D
85
57
FA
00
FF
20
48
FA
F8
20
FA
FA
EA
F0
C5
A0
FA
4C
90
F8
FD
FA
D0
60
68
00
20
EA
F9
B7
BD
00
FA
C2
1D
B1
F8
88
81
FA
60
C2
FD
00
00
E8
C2
FA
00
00
79
00
00
EA
3C
C1
3A
00
ED
03
00
00
00
06
20
68
00
57
20
C9
FF
C7
48
00
8D
A0
C1
00
FA
C1
00
A9
A9
00
EA
BD
E0
F8
00
20
F0
FA
20
90
EA
A6
A5
20
20
FA
20
D0
A2
A9
E6
CF
EA
85
FA
3E
20
00
FF
60
A5
39
00
20
C6
00
C1
20
3B
05
68
EA
EA
16
00
AD
B7
5C
00
3E
28
EA
26
C4
C2
8B
00
80
07
42 A9
52 D0
C2 D0
FF C9
EA EA
26 A2
00 EA
F8 00
F0 F5
D0 0C
00 48
CA 10
C1 8D
02 60
00 20
48 FA
1D D0
90 0B
C1 F0
33 F8
85 C1
60 98
A2 2E
EA EA
FF 00
D0 F5
AD 39
3A 02
F8 00
203E
90 33
F8 00
20 69
EA 20
D0 38
E5 C2
F8 00
F8 00
20 79
F8 00
2B 79
19
.:0A70
.:0A78
.:0A80
.:0A88
.:0A90
.:0A98
.:0AA0
.:0AA8
.:0AB0
.:0AB8
.:0AC0
.:0AC8
.:0AD0
.:0AD8
.:0AE0
.:BAE8
.:0AF0
.:0AF8
.:0B00
.:0B08
.:0B10
.:0B18
.:0B20
.:0B28
.:0B30
.:0B38
.:0B40
.:0B48
.:0B50
.:0B58
.:0B60
.:0B68
.:0B70
.:0B78
.:0B80
.:0B88
.:0B90
.:0B98
.:0BA0
.:0BA8
.:0BB0
20
FA 00
20 3E
D0 F8
FF C9
D1 20
80 F8
AE 3F
48 AD
48 AD
3E 02
AE 3F
0184
84 90
A9 02
20 F0
22 D0
F0 10
E6 B7
ED FA
F0 16
FA 00
F0 E5
0D 60
20 96
EA EA
F9 00
4C 47
C9 2C
20 69
2C D0
C1 85
69 FA
D0 98
F2 F9
C2 20
4A 4A
AA 68
48 8A
FF 09
06 60
C2 95
90
F8
4C
0D
79
00
02
3A
3C
40
02
BA
84
85
F9
14
C9
C8
00
C9
29
85
6C
F9
EA
A5
F8
D0
FA
AD
AE
00
EA
00
48
4A
29
20
30
A2
C0
EB
00
47
F0
FA
EA
9A
02
02
EA
9A
84
93
BC
C9
20
0D
C0
20
2C
0F
BA
30
00
A9
90
00
BA
00
20
A5
20
EA
4C
FA
4A
0F
D2
C9
02
68
A9
20
F8
BC
20
EA
78
48
AE
EA
6C
B9
A9
20
BD
CF
F0
10
CF
D0
F0
20
B3
D0
00
29
20
20
20
79
C2
CF
EA
47
m0
20
20
FF
3A
B5
95
08
A1
00
C9
90
EA
AD
AD
3D
EA
02
88
40
CF
F0
FF
29
D0
FF
DC
E9
CF
6C
D4
00
10
96
79
CF
FA
85
FF
EA
F8
A5
60
60
68
90
C0
C2
85
F8
20
20
03
EA
39
3B
02
EA
A0
84
85
FF
38
C9
91
EC
C9
20
C9
FF
32
EA
20
D0
F9
FA
FF
00
AF
C9
EA
00
C1
FA
FA
4C
02
48
CA
1D
00
CF
D0
20
EA
02
02
AC
EA
A0
B7
BB
C9
C9
22
BB
4C
0D
88
03
C9
03
EA
EF
C4
00
00
C9
A5
20
0D
20
A5
48
00
00
D2
69
B5
D0
.:0BB8
.:0BC0
.:0BC8
.:0BD0
.:0BD8
.:0BE0
.:0BE8
.:0BF0
.:0BF8
.:0C00
.:0C08
.:0C10
.:0CI8
.:0C20
.:0C28
.:0C30
.:0C38
.:0C40
.:0C48
.:0C50
.:0C58
.:0C60
.:0C68
.:0C70
.:0C78
.:0C80
.:0C88
.:0C90
.:0C98
.:0CA0
.:0CA8
.:0CB0
.:0CB8
.:0CC0
.:0CC8
.:0CD0
.:0CD8
.:0CE0
.:eCE8
.:eCFe
.:eCF8
F3
85
85
20
20
18
0A
20
C9
60
C1
26
F8
00
FA
FA
00
3F
A9
e0
60
A2
C0
A5
0E
4C
38
A8
20
20
20
90
FB
20
D0
IE
85
D0
FB
2e
2e
60
C2
C1
3E
3E
60
0A
AF
3A
A2
D0
D6
00
00
00
00
20
02
3F
20
E6
02
68
C3
88
33
E5
05
69
0C
2F
15
00
05
EB
65
C4
3D
0e
BB
D4
20
20
60
F8
F8
20
85
FA
90
02
08
C2
C9
8D
20
90
79
9A
20
54
C3
B5
95
A4
90
FB
Cl
IE
FA
FB
FB
A6
90
FB
20
C3
20
Al
Be
FA
FA
88
88
A9
00
00
AF
2A
00
02
2C
B4
D6
20
00
8F
09
FA
EA
D2
FD
D0
C0
27
C4
0B
00
85
60
00
00
00
26
5F
00
28
85
0C
Cl
34
e0
ee
FA
FA
00
C9
C9
FA
20
05
69
A2
C2
Cl
F0
00
FA
60
00
EA
FF
0e
02
48
CA
38
A5
A5
IE
20
20
20
20
D0
Al
20
FB
C3
FB
81
2e
4C
20
00
00
00
20
20
00
3E
2A
08
00
D0
60
F9
01
00
20
B0
EA
4C
CA
E6
B5
D0
E9
28
C3
98
D4
E5
E5
69
64
Cl
33
00
98
00
C3
B8
7D
69
90
90
85
D0
D0
0A
F8
38
29
00
02
20
60
20
20
3E
DE
EA
47
De
C4
27
F3
02
A4
A4
E5
FA
FA
FA
FA
20
81
F8
18
65
A6
2e
FA
FB
FA
02
02
2A
09
0E
0A
00
60
0F
B4
E6
3E
A9
CC
7C
F8
AE
EA
F8
FA
60
95
60
B0
29
C4
C2
00
00
00
e0
28
C3
00
A5
C4
26
28
ee
e0
e0
21
.:mDmm
.:mD88
.:mD18
.:mD18
.:mD28
.:8D28
.:8D38
.:mD38
.:8D48
.:8D48
.:8D58
.:8D58
.:8D60
.:0D68
.:0D70
.:0D78
.:0D88
.:0D88
.:0D90
.:0D98
.:0DA0
.:0DA8
.:0DB0
.:0DB8
.:0DC0
.:0DC8
.:0DD0
.:0DD8
.:0DE0
.:0DE8
.:0DF0
.:0DF8
.:0E08
.:0E08
.:0E10
.:0E18
.:0E20
.:0E28
.:0E30
.:0E38
.:0E40
22
2m
28
98
28
81
4C
28
28
28
3E
3E
CF
D8
20
02
89
28
EA
08
02
F3
00
8D
47
20
86
EA
20
85
A9
00
54
54
20
00
E0
A5
20
2A
A5
03
E5 FA
3E F8
14 85
2F FB
C1 28
ED FA
D4 FA
E5 FA
3E F8
F8 88
F8 08
FF C9
F1 F8
8F FA
E8 28
20 88
D8 EC
EA 28
A0 08
D0 0C
20 41
28 33
28 2F
F8 80
A5 C2
28 A9
EA EA
6A FC
C1 84
9120
A0 2C
FD 00
FD 08
D9 FC
68 20
03 D0
2A C9
C2 FC
98 8E
FD 00
20 A5
80 28
882m
1D A6
809m
33 F8
80 4C
882m
88 28
88 A2
C9 27
9D 1m
0D Fm
1C 8E
00 90
CF FF
FA 80
86 1C
57 FD
08 B1
C8 E8
FA 80
F8 80
FB 80
20 D4
85 21
93 20
EA A9
00 20
C2 C6
D2 FF
20 C2
20 41
A2 80
00 48
35 FD
12 A4
E8 B1
88 88
BD 2A
BD 30
FD 00
69
88
26
8C
88
47
69
69
88
D0
82
22
80
C6
C9
90
EA
88
C1
E4
28
A6
B8
FA
A2
D2
16
CA
1D
4C
F8
FA
08
28
00
1F
C1
D0
FF
FF
CA
FA 88
FA 88
D8 11
A5 1D
D8 EE
F8 88
FA 88
FA 88
88 28
14 28
E8 28
E8 28
88 81
9D 10
0D F0
B6 E0
EA EA
A2 00
DD 10
1C D0
54 FD
26 D0
DD 4C
00 85
00 00
FF EA
85 1D
FC 00
D0 F2
47 F8
00 20
00 20
A1 Cl
1F FD
A2 06
F08E
B8 1C
F2 86
00 20
00 F0
D0 D5
:0E48
.:0E50
.:0E58
:0E60
.:0E68
.:0E70
.:0E78
.:0E80
.:0E88
.:0E90
.:0E98
.:BEAB
.:BEA8
.:0EB0
.:0EB8
.:BEC0
.:BEC8
.:BED0
.:BED8
.:0EE0
.:BEE8
.:0EFB
.:0EF8
.:0F00
.:0FB8
.:0F1B
.:BF18
.:0F20
.:0F28
.:0F30
.:0F38
.:0F40
.:BF48
.:0F5B
.:BF58
.:0F60
.:0F68
.:0F70
.:BF78
.:0F8B
.:0F88
60 20
01 C8
86 1C
60 A5
0188
A8 4A
22 F0
AA BD
4A 4A
80 A9
BB 83
29 8F
FB 0B
20 88
60 B1
0120
9B F1
6B A8
B9 77
00 A0
88 D0
CA DB
4C D2
69 FA
69 FA
EA EA
0B 2B
00 85
F0 03
4C 47
A9 03
20 A1
85 C1
FC 00
FF 60
FA 00
CC FA
03 68
6E 11
F6 CA
FF C9
CD
98
20
1F
65
90
13
D9
4A
BB
2A
AA
4A
DB
C1
FE
A2
B9
FF
B5
F8
EC
FF
BB
B0
EA
72
C1
2B
F8
85
F8
A5
C5
2B
8E
BB
38
B2
D0
0D
FC
20
48
38
C1
0B
29
FE
29
B0
29
98
90
FA
2B
FA
03
37
BB
B6
69
A9
2B
2B
A2
EA
FC
84
2F
B0
1D
B0
21
28
D4
11
48
E9
6E
ED
F0
00
C2
FA
A4
90
4A
07
00
0F
AA
03
A0
08
C8
C2
00
C0
FF
85
29
3F
20
D4
E3
00
EA
00
C2
FB
20
20
D0
85
F0
FA
02
CA
3F
10
A2
1E
AA
FC
00
C2
01
B0
09
B0
DB
BD
85
03
4A
88
FC
C4
04
0B
29
26
2B
2C
FA
FA
0B
2B
2B
20
BB
D4
3E
F8
C2
03
BB
A2
DB
AB
02
02
C9
E8
00
A6
AA
C8
17
80
04
04
1D
1F
E0
4A
D0
00
1F
90
85
A9
28
D2
A9
00
00
86
57
CA
E1
BB
FA
F8
A5
4C
20
2B
B3
F9
B5
88
20
20
D0
8A
1C
10
60
C9
4A
4A
A0
FF
98
8A
B9
F2
A2
C8
F2
28
B0
2A
FF
0D
20
2B
28
FD
FC
FF
E9
B0
B0
20
46
D2
69
20
A2
4A
DB
CF
F0
23
.:8F9S FS 28 DS
.:SF98 9C FA S8
.:8FA8 C1 A9 38
.:8FA8 18 82 E8
.:8FBS SS 88 86
.:8FB8 F8 75 A2
.:8FC8 26 28 D9
.:SFC8 29 AA BC
.:8FD8 FF 88 28
.:8FD8 A2 86 E8
.:8FE8 F8 15 AS
.:SFE8 B8 21 28
.:8FF8 28 Cl FE
.:8FF8 EB 86 2A
.:1888 88 BD 2A
.:1888 88 D8 BS
.:1818 28 B8 FE
.:1818 FE 88 D8
.:1828 D8 A8 28
.:1828 FS 28 A5
.:1S38 28 1C FB
.:1838 84 AS 1E
.:1848 88 C8 DS
.:1848 A4 1F D8
.:1858 91 Cl 88
.:1858 C1 28 CA
.:1868 C2 EA EA
.:1868 28 C2 F8
.:1878 28 41 FA
.:1878 EA EA EA
.:1888 )88 A8 28
.:1888 98 F8 8E
.:1898 18 82 88
.:1898 28 68 C9
.:18A8 68 38 68
.:18A8 88 48 89
.:18B8 88 48 89
.:18B8 88 48 89
.:18C8 88 48 89
.:18C8 D8 8C 44
.:18D8 33 D8 8C
24
FE
A4
9D
DS
26
88
FC
37
B9
83
2A
BF
88
98
FF
CA
88
A6
69
29
88
18
FA
83
D8
FC
EA
88
88
EA
BF
86
E8
38
48
38
48
48
88
08
44
88
C1
18
DB
F8
88
88
FF
FE
D8
C9
FE
D8
8B
88
D8
D8
AS
FA
C9
98
8A
AS
19
F8
08
EA
28
28
EA
FE
lC
86
98
82
22
82
82
88
88
9A
B8
84
82
86
84
86
A6
SS
88
19
E8
88
C7
BC
28
D1
AB
28
88
9D
8A
4C
IE
C2
AS
85
EA
54
54
4C
88
A6
1D
83
45
45
45
45
22
11
18
8F 28
C2 85
E8 9D
28 A2
E6 26
1D A5
2A 86
BD 77
D8 E3
A4 1F
A9 38
D8 CC
88 D8
38 FF
B9 FE
F88A
28 B8
CS 1D
A4 1F
DS 1A
98 D8
ED FA
18 F6
88 88
26 91
C1 84
A8 41
FD 88
FD 88
B8 FD
D8 11
1D DD
A6 1C
C9 47
83 D8
33 D8
33 D8
B3 D8
44 33
22 44
22 44
.:19D8
.:19E9
.:19E8
.:19F9
.:lSFe
.:11""
: 11"8
.: 111"
: 1118
: 1129
: 1129
: 1139
: 1138
: 1149
: 1148
: 1159
: 1158
: 1169
: 1168
: 1178
: 1178
: 11816
: 1199
: 119"
: 1199
: 11A"
: 11A9
: 11B"
: 11B8
: 11CfiI
: 11C8
: 11DfiI
: 11D9
: 11E"
: 11E9
33
33
A9
99
ee
59
1C
9D
9"
23
A1
24
""
A5
A5
26
69
94
4A
A2
B2
1A
C4
3A
e4
F9
F7
D9
D0
99
90
9D
9"
9A
9A
9"
24
99
24
7C
69
69
62
44
74
72
A2
32
1A
CA
3B
46
16"
F8
F4
16fi1
FC
AC
8fi1
98
08
00
59
2C
1C
""
1D
29
53
9"
AE
""
29
23
94
E8
B4
F2
74
B2
26
26
52
48
35
fiI"
F9
FB
92
39
"fiI
FD
"fiI
F7
ED
2" efll 43
41 43 2fi1
2" 53 5fi1
""
49
40
21
4D
29
58
23
23
19
1B
1A
AE
99
53
Afil
88
94
28
A4
74
"fiI
26
48
4D
44
F9
56
""
FB
5B
"fiI
F7
2fi1
58
45
09
09
81
91
2C
24
5D
9D
AE
23
5B
A9
15
84
D9
54
"9
6E
8A
74
flI16
72
44
47
516
flI16
F9
"C
flI16
FD
46
flI16
216
52
52
19
62
82
92
23
24
8B
8B
69
24
5B
AD
9C
13
62
44
99
74
9"
72
22
72
44
59
2C
CC
""
FA
C"
""
F8
"D
53
29
22
22
13
99
86
28
"9
1B
1D
A8
53
A5
29
6D
34
5A
C8
B4
F4
fil8
44
fil8
88
A2
4C
41
F9
99
fiI"
FB
8A
fiI"
2"
52
59
29
44
78
99
4A
24
9"
A1
A1
19
19
69
9"
9C
11
48
54
fil8
CC
AA
69
flI8
C9
C9
53
42
88
F9
3E
fiI"
FD
FF
2"
29
52
29
25
ROM Routines
The routines in this book use various ROM routines to function.
They are as follows:
$AEFO: Check if the next character is a comma and skip it.
Otherwise print SYNTAX ERROR and return to Basic.
$A08A: Read next expression (variable, number, etc.) into the
FAC.
$B7F7: Change the value in the FAC into a 16 bit integer
(0-65535). If the number is too big then print illegal quantity error
and return to Basic. Otherwise put the low byte of the number
into $14 and the high byte into $15.
$B79E: Read the next expression in the BASIC text and put it
as a 8 bit integer in the X register. If the number is greater than
255 then print Illegal quantity error and return to Basic.
$B7EB: This routine reads two expressions or numbers separated
by a comma from the Basic text. The first is a 16 bit number
and the second is an 8 bit number. The 16 bit number is stored
in $14 and $15 and the 8 bit number is stored in the X register.
If either or both of the numbers are out of their ranges then the
program will stop and print an illegal quantity error. If the comma
is missing a syntax error with be displayed. Both these errors
return control to Basic.
$E104: This routine gets the file name, the device number and
the secondary address from the Basic text. It gives an error if
any of the above are wrong. It is used in preparation for loading,
saving or verifying a program, as in MSAVE/MLOAOI
MVERIFY.
26
1. Fill
The following routine allows you to fill an area of memory with
a byte. It is called by the following command:
SYS 28672,start address, end address, byte
e.g. to fill the text screen with 'A' characters and the colour
screen with 1 (white), type the following:
SYS 28672,1024,2023,1
SYS 28672,55296,56295,1
An error will be given if any of the numbers are too big or
negative.
20:
30:
7000
7S00
90:
7S00 20 FD AE
110:
7003 20 8A AD
140:
7006 20 F7 B7
170:
170:
7009 AS 14
700B 8S FB
.OPT P,OO
57000
IFILL ROUTINE
*-
;USES
.FB AND .FC
ISTORE TOP ADDRESS IN
;828 AND 829
JSR 5AEFD
;SCAN PAST COMMA
JSR SAD8A
;READ NUMBER AND PUT
I INTO FAC
JSR $B7F7
IGET NUMBER FROM FAC
.' AND PUT IN $14 AND $15
LDA 514
STA .FB
27
18":
18":
7""D A5 15
7""F 85 FC
2"":
7"11 2" FD AE
22":
23":
24":
248:
2\58:
25":
7"14
7"17
7"lA
781C
781F
7"21
2"
2"
A5
8D
A5
8D
8A AD
F7 B7
14
3C 83
15
3D "3
278:
288:
298:
388:
388:
3"":
7"24
7"27
782A
782D
7"2F
7"31
2"
28
28
A5
F"
4C
FD
8A
F7
15
"3
48
328:
7"34
328:
7"36
7"39
33":
783B
34":
7"3E
35":
7"48
36":
378:
7"43
378:
7"4\5
7"48
37":
7"4A
38":
398:
7"4D
784F
398:
78\52
398:
7854
48":
7"57
41":
7"\59
41":
7"5B
42":
78\5C
438:
78\5E
438:
7S5F
44":
]7""8-7"6"
A\5
8D
A8
AD
91
28
A\5
CD
F"
4C
A5
CD
F"
4C
E6
F"
6"
E6
68
6"
14
3E "3
28
LDA
STA
AE
AD
B7
B2
""FB3E "3
\57
FB
3C
"3
39
FC
3D
8B
39
FB
"1
FC
7"
"3
7"
83
7"
$15
$FC
JSR $AEFD
;SCAN PAST COMMA
JSR $AD8A
JSR $B7F7
LDA $14
STA 828
LDA $15
STA 829
JSR SAEFD
JSR SAD8A
JSR SB7F7
LDA $1\5
BEG! MORE
JMP $B248
.SB248 IS IG!ANT ERROR
MORE
LDA $14
STA 83"
LOOP
LDY 1t8
LDA 83"
STA ($FB),Y
JSR ADD
LDA $FB
CMP 828
BEG! CHECK
JMP LOOP
CHECK
LDA $FC
CMP 829
BEG! FINISH
JMP LOOP
ADD
INC SFB
BEG! FCPLUSl
RTS
FCPLUSl INC SFC
RTS
FINISH
RTS
B*
PC SR AC XR YR SP
.197FE 72 99 99 91 F6
7999
7993
7996
7999
799B
799D
799F
7911
7914
7917
791A
791C
791F
7921
7924
7927
792A
792D
792F
7931
7934
7936
7939
793B
793E
7949
7943
7945
7948
794A
794D
794F
79S2
7954
79S7
79S9
29
29
29
AS
85
A5
8S
29
29
29
AS
8D
AS
8D
29
29
29
AS
F9
4C
AS
8D
A9
AD
91
29
AS
CD
F9
4C
AS
CD
F9
4C
E6
F9
FD
8A
F7
14
FB
15
FC
FD
8A
F7
14
3C
1S
3D
FD
8A
F7
1S
S3
48
14
3E
S9
3E
FB
S7
FB
3C
93
39
FC
3D
SB
39
FB
91
AE
AD
B7
AE
AD
B7
93
93
AE
AD
B7
B2
93
93
79
93
79
93
79
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
BEQ
JMP
LDA
STA
LDY
LDA
STA
JSR
LDA
CMP
BEQ
JMP
LDA
CMP
BEQ
JMP
INC
BEG!
SAEFD
.AD8A
.B7F7
.14
$FB
.1S
SFC
.AEFD
SAD8A
.B7F7
.14
S933C
.1S
.933D
.AEFD
.AD8A
.B7F7
.1S
.7934
.B248
$14
S933E
..S99
S933E
'SFB) ~ Y
S79S7
SFB
S933C
S794D
S7939
SFC
$933D
.79SF
S7939
SFB
.795C
29
2. Move
The following routine allows you to move an area of memory
to another location. It has the syntax:
SYS 24576, start, finish,destination address.
e.g. to move the contents of the screen to 16384 type the
following:
SYS 24576,1024,2023,16384
The three numbers or variables must be no bigger than 65535.
If they are bigger then an error will be printed and control will
return to Basic.
28:
38:
6888
6888
.OPT P,OO
.6111111
IROUTINE
*-
TO MOVE ONE
AREA OF
;MEMORY TO ANOTHER
I
98:
1811:
1111 :
1211:
1311:
1411:
1SII:
6888
68113
6886
61189
688B
688E
611111
68
;SCAN COMMA
JSR
JSR
JSR
LDA
STA
LDA
STA
16S:
6813 28 FD AE
JSR
30
28
211
28
AS
8D
AS
8D
FD
8A
F7
14
78
1S
79
AE
AD
B7
68
SAEFD
SAD8A
SB7F7
.14
TEMP
S1S
TEMP+1
SAEFD
170:
180:
190:
200:
210:
220:
225:
230:
240:
250:
268:
278:
288:
6016
6019
601C
601E
6021
6023
6026
6029
602C
602F
6031
6034
6036
20
20
A5
8D
A5
8D
20
20
20
A5
8D
A5
8D
8A
F7
14
7A
15
7B
FD
8A
F7
14
7C
15
7D
291 :
291 :
292:
292:
293:
293:
294:
294:
388:
310:
328:
338:
348:
358:
368:
378:
6039
603C
603E
6041
6043
6046
6048
604B
604D
604F
6051
6053
6056
6058
605B
605D
AD
85
AD
85
AD
85
AD
85
A0
Bl
91
28
A5
CD
F0
4C
78
FB
79
FC
7C
FD
7D
FE
88
FB
FD
68
FB
7A
18
4F
488:
418:
428:
438:
448:
458:
468:
6068
6062
6064
6066
6868
686A
686C
E6
D8
E6
E6
D8
E6
68
FB
82
FC
FD
82
FE
AD
B7
60
60
AE
AD
B7
68
68
68
60
68
68
LOOP
68
68
68
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
STA
LDA
STA
SAD8A
SB7F7
S14
TEMP+2
S15
TEMP+3
.AEFD
.AD8A
.B7F7
.14
TEMP+4
S15
TEMP+5
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDY
LDA
STA
JSR
LDA
CMP
BEQ
JMP
TEMP
.FB
TEMP+l
.FC
TEMP+4
.FD
TEMP+5
.FE
..8
CSFB) ,Y
(SFD),Y
ADDONE
.FB
TEMP+2
CHECK
LOOP
INC
BNE
INC
INC
BNE
INC
RTS
.FB
MORE
.FC
.FD
RETURN
.FE
ADDONE
MORE
RETURN
31
498:
588:
518:
528:
686D
686F
6872
6874
A5
CD
F8
4C
FC
CHECK
7B 68
83
4F 68
..
FIN
6877
558:
6877 68
555:
6878
568:
]6888-6878
LDA
CMP
BEGl
JMP
RTS
TEMP
READY.
B*
PC SR AC XR YR SP
.197FE 72 88 08 81 F6
6888
6883
6086
6889
688B
688E
6010
6013
6816
6819
681C
681E
6821
6023
6826
6829
602C
682F
6831
6034
6836
32
28
28
28
A5
8D
A5
8D
28
28
20
A5
8D
A5
8D
28
20
28
A5
8D
A5
8D
FD
8A
F7
14
78
15
79
FD
8A
F7
14
7A
15
7B
FD
8A
F7
14
7C
15
7D
AE
AD
B7
68
68
AE
AD
B7
60
68
AE
AD
B7
68
68
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
STA
LDA
STA
$AEFD
$AD8A
$B7F7
$14
$6878
S15
$6879
SAEFD
SAD8A
$B7F7
S14
S607A
$15
S607B
SAEFD
.AD8A
.B7F7
.14
$687C
$15
$687D
$FC
TEMP+3
FIN
LOOP
*
*
6039
603C
603E
6041
6043
6046
6048
604B
604D
6R14F
6051
AD
85
AD
85
AD
85
AD
85
AIlJ
B1
91
78
FB
79
FC
7C
FD
7D
FE
60
60
61lJ
61lJ
IlJII
FB
FD
6056
6058
6115B
6R15D
6061lJ
6R162
A5
CD
F0
4C
E6
DIlJ
E6
E6
D0
E6
60
A5
CD
F0
4C
6064
6066
6068
606A
606C
606D
606F
6072
6074
6077 61lJ
FB
7A 6R1
111
4F 61lJ
FB
02
FC
FD
02
FE
FC
7B 60
03
4F 61lJ
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDY
LDA
STA
JSR
LDA
CMP
BEG!
JMP
INC
BNE
INC
INC
BNE
INC
RTS
LDA
CMP
BE6I
JMP
RTS
S6078
SFB
S6079
SFC
561lJ7C
SFD
S61lJ7D
SFE
..51lJ1lJ
(SFB) ~ Y
(5FD) ~ Y
561lJ6R1
.FB
.6R17A
56R16D
561lJ4F
5FB
S61lJ66
.FC
SFD
S606C
.FE
.FC
5607B
S61lJ77
5604F
33
3. Pause
The following routine allows a listing to be stopped at any time.
It will in fact stop any output to the screen that is printed. It
works by interrupting the character out routine and check to
see if the shift key has been pressed. If it has then it loops until
the key has been released.
The syntax is SYS 960. To disable it press run/stop and restore
simultaneously.
S'$C8
S3C2
S3C5
S3C7
S3CA
A9
8D
A9
8D
68
118:
S3CB
S3CC
S3CD
S3CE
S3CF
S3D8
S3D3
S3D5
S3D7
S3D8
03D9
03DA
MAIN
48
8A
48
98
48
AD 8D 82 LOOP
C9 81
F8 F9
68
A8
68
AA
CB
26 83
83
27 83
.OPT P,OO
968
*-
LDA
STA
LDA
STA
RTS
*<MAIN
886
*>MAIN
887
11111 :
118:
118:
118:
128:
138:
148:
168:
168:
16111:
16111:
34
PHA
TXA
PHA
TYA
PHA
LDA
CMP
BEG!
PLA
TAY
PLA
TAX
653
*1
LOOP
16S:
S3DB 68
17S:
S3DC 4C CA Fl
lS3CS-S3DF
PLA
JMP
.FICA
READY.
B*
PC SR AC XR YR SP
97FE 72 SS SS Sl F6
S3CS
S3C2
S3CS
S3C7
S3CA
S3CB
S3CC
S3CD
S3CE
S3CF
S3DS
S3D3
S3DS
S3D7
S3D8
S3D9
S3DA
S3DB
S3DC
A9
8D
A9
8D
6S
48
8A
48
98
48
AD
C9
FS
68
A8
68
AA
68
4C
CB
26 S3
S3
27 S3
8D S2
Sl
F9
CA Fl
LDA
STA
LDA
STA
RTS
PHA
TXA
PHA
TYA
PHA
LDA
CMP
BE61
PLA
TAY
PLA
TAX
PLA
JMP
...CB
.S326
...S3
SS327
SS28D
..SSl
.S3DS
.FICA
35
4. Function keys
The following program allows you to put commands onto the
function keys. It uses the IRQ interrupt to scan the keyboard.
There are listings in PAL and Supermon format to see how the
program works, but it is best to enter the program as the Basic
loader which follows. Any of the three ways works equally well
but it is easier to change the text to go on the function keys
from the Basic listing.
To turn the keys on type SYS 49152 (for the Basic listing, SYS
24576 for the other two). To turn them off press run/stop and
restore.
.OPT P,OO
S6S"S
*-
;ROUTINE TO SETUP
;FUNCTION KEYS
78
A9
8D
A9
8D
58
6S
8":
9":
1"":
11S:
12":
13":
14":
6SS"
6""1
6S"3
6""6
6SS8
60"B
6""C
17":
18S:
19S:
6"SD 48
6SSE 8A
6SSF 48
36
SEI
LDA
STA
LDA
STA
CLI
RTS
"D
14 "3
6"
15 "3
MAIN
PHA
TXA
PHA
tt<MAIN
788
tt>MAIN
789
200:
210:
220:
230:
240:
250:
260:
270:
6010
6011
6012
6014
6016
6018
601A
601C
98
48
A5
C5
F0
85
C9
D0
TYA
PHA
LDA
CMP
BEG!
STA
CMP
BNE
SC5
SFB
LOOP
$FB
*3
LOOPl
290:
308:
318:
601E A9 38
6828 8D 72 60
6823 4C 47 69
LDA
STA
JMP
*.30
C180
PRINT
330:
349:
359:
369:
379:
6826
6928
682A
682C
692F
LOOPl
84
08
99
72 69
47 69
CMP
BNE
LDA
STA
JMP
*4
LOOP2
*9
C180
PRINT
399:
499:
6832 C9 95
6934 D0 98
LOOP2
CMP
BNE
*5
LOOP3
429:
438:
448:
6836 A9 18
6938 8D 72 69
693B 4C 47 69
LDA
STA
JMP
*.18
C199
PRINT
460:
470:
480:
490:
603E
6049
6042
6044
LOOP3
06
28
20
72 69
CMP
BNE
LDA
STA
*6
LOOP
*$20
C100
510:
520:
530:
6047 AD 8D 02 PRINT
604A C9 01
684C D0 09
LDA
CMP
BNE
$928D
*1
PUTON
550:
560:
560:
570:
604E
6051
6052
6054
LDA
CLC
ADC
STA
C109
*8
C100
590:
6057 A2 00
LDX
*0
C5
FB
52
FB
03
08
C9
D9
A9
8D
4C
C9
D0
A9
8D
AD 72 69
18
69 08
8D 72 60
PUTON
37
6BB:
61B:
62B:
631l1:
641l1:
651l1:
66B:
67B:
68B:
69B:
7BB:
71B:
72B:
73B:
75B:
76B:
76B:
77B:
6B59 AC 72 6B
6B5C B9 73 6111 LOP
6B5F 9D 77 B2
611162 E8
6B63 C8
6B64 EIlI B8
6B66 DB F4
6B68 86 C6
6B6A 68
LOOP
6B6B A8
6B6C 68
6B6D AA
6B6E 68
6B6F 4C 31 EA
6B72 BB
6B73 4C 49 53 CUll
6B77 BD B4 B4
6B7B 52 55
6S7E SD S4
6B83 5S 52
6S88 04 04
6S8B 54 48
79B:
608F S4 04
8SB:
6B93 4C 4F
8SB:
6B97 S4 04
81B:
6B9B 53 41
81S:
6S9F B4 04
820:
6SA3 56 45
82S:
6SA9 04 04
83S:
6SAB 47 4F
830:
6SAF 04 04
J6BSS-6BB3
77S:
78S:
78S:
79S:
READY.
38
;
Clll1B
4E
04
49
04
45
04
41
04
56
04
52
54
04
LDY
LDA
STA
INX
INY
CPX
BNE
STX
PLA
TAY
PLA
TAX
PLA
JMP
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
.ASC
.BYT
CIBB
CIB1,Y
SB277,X
..S1lI8
LOP
$C6
$EA31
B
"LIST"
13,4,4,4
"RUNU
13,4,4,4,4
"PRINT4,4,4
"THEN"
4,4,4,4
"LOAD"
4,4,4,4
SAVE"
4,4,4,4
"VERIFY4,4
"GOTO"
4,4,4,4
B*
PC SR AC XR YR SP
.197FE 72 fIJfIJ fIJfIJ flJl F6
6fIJfIJfIJ
6flJflJl
6f1JflJ3
6f1JflJ6
6f1JflJ8
6f1JflJB
6f1JflJC
6f1JflJD
6f1JflJE
6f1JflJF
6flJlfIJ
6flJll
6f1J12
6f1J14
6f1J16
6f1J18
6flJ1A
6flJ1C
6flJ1E
6f1J2fIJ
6f1J23
6f1J26
6f1J28
6f1J2A
6f1J2C
6f1J2F
6f1J32
6f1J34
6f1J36
6f1J38
6f1J3B
6f1J3E
6f1J4fIJ
6f1J42
6f1J44
6f1J47
6f1J4A
78
A9
8D
A9
8D
58
6fIJ
48
8A
48
98
48
A5
C5
FfIJ
85
C9
DfIJ
A9
8D
4C
C9
DfIJ
A9
8D
4C
C9
DfIJ
A9
8D
4C
C9
DfIJ
A9
8D
AD
C9
flJD
14 flJ3
6fIJ
15 flJ3
C5
FB
52
FB
flJ3
flJ8
3fIJ
72
47
flJ4
flJ8
fIJfIJ
72
47
flJ5
flJ8
lfIJ
72
47
flJ6
28
2fIJ
72
8D
flJl
6fIJ
6fIJ
6fIJ
6fIJ
6fIJ
6fIJ
6fIJ
82
SEI
LDA
STA
LDA
STA
CLI
RTS
PHA
TXA
PHA
TYA
PHA
LDA
CMP
BEG
STA
CMP
BNE
LDA
STA
.JMP
CMP
BNE
LDA
STA
.JMP
CMP
BNE
LDA
STA
.JMP
CMP
BNE
LDA
STA
LDA
CMP
.. 5f1JD
5f1J314
..56fIJ
.flJ315
.C5
5FB
.6f1J6A
.FB
...83
56826
...3fIJ
.6f1J72
.6f1J47
...flJ4
56832
..5fIJfIJ
56f1J72
56f1J47
...flJ5
.6f1J3E
... lfIJ
S6f1J72
.6f1J47
..5f1J6
.6f1J6A
...2fIJ
56872
5f1J28D
,,5el
39
604C
604E
6031
6032
6834
6837
6839
683C
683F
6862
6863
6864
6S66
6S68
6S6A
6S6B
6S6C
6S6D
6S6E
6S6F
DS
AD
18
69
8D
A2
AC
B9
9D
E8
C8
ES
DS
86
68
A8
68
AA
68
4C
: 6S72
: 6S7A
: 6S82
: 6S8A
: 6S92
: 6S9A
: 6SA2
: 6SAA
: 6SB2
40
S9
72 6S
S8
72
SS
72
73
77
BNE
LDA
CLC
ADC
STA
LDX
LD'!'
LDA
STA
INX
IN'!'
CPX
BNE
STX
PLA
TAY
PLA
TAX
PLA
JMP
6S
6S
6S
82
S8
F4
C6
31 EA
SS
S4
S4
S4
S4
S4
S4
S4
S4
4C
32
3S
34
4C
33
36
47
SS
49
33
32
48
4F
41
43
4F
SS
33
4E
49
43
41
36
32
34
SS
.6S37
.6S72
...S8
.6S72
".SS
.6S72
.6S73,Y
.S277,X
...88
.6S3C
.C6
.EA31
54
"D
4E
4E
44
43
49
4F
"S
SD
S4
34
S4
S4
S4
46
S4
SS
S4
84
S4
84
S4
S4
39
S4
FF
S4
S4
S4
S4
S4
S4
S4
S4
SS
IB DATA 12B,169,16,141,2B,3,169,192,141,
21,3,SS,96,234,234,234,72,13S,72,152,72
15 DATA 165,197,197,251,24B,Sl,133,251,2
Bl,3,2BS,S,169,4S,141,B,193,76,74,192
2B DATA2Bl,4,2BS,S,169,B,141,B,193,76,74
,192,2Bl,5,2BS,S,169,16,141,B,193,76,74
25 DATA 192,2Bl,6,2BS,39,169,32,141,B,19
3,173,141,2,2Bl,1,2BS,S,173,B,193,lB5,S
3B DATA141,B,193,162,B,172,B,193,lS5,1,1
93,157,119,2,232,2BB,224,S,2BS,244,134
35 DATA19S,lB4,16S,lB4,17B,lB4,76,49,234
4B FORA=49152T049267:READB:POKEA,B:NEXT
5B FORA=BT07:READK$:FORB=lTOS:L=ASCMID
$(K$,B,1))):IFL=95THENL=13
55 IFL=47THENL=4
6B POKE494B9+(A*S)+B,L:NEXT:NEXT:POKE494
B9,4:SYS49152
7B DATAI/LIST~III"
S0 DATA"PRINTIII H
9B DATAI/RUN~IIIII/
leB DATA"THENIIII"
I1B DATA"LOADIIII"
12B DATA"SAVEIIII H
13B DATAuVERIFYII"
14B DATA"GOTOIIII"
READY.
41
5. IRQ clock
The clock routine is updated by the IRQ interrupt which is called
by the computer every 50th of a second. The routine used to
print line numbers for BASIC is used to print the time (10 byte
in X and high byte in A). It is not very good for using when typing
in a program as the cursor is always at the top of the screen
but it works fine in a program. The syntax to set the clock is
as follows:
SYS 28672,hours,minutes.
The clock is in 24 hour format, so remember to enter the time
in 24 hour format.
.OPT P,OO
.7"""
*-
;DISPLAYS A CLOCK AT
ITOP LEFT
;OF SCREEN
I
;TO SET TYPE
;SYS 24576,HOURS,MINS
;
7"""
7""3
7""6
7""7
7""9
2"
2"
8A
C9
B"
FD AE
9E B7
18
14
JSR
JSR
TXA
CMP
BCS
$AEFD
.B79E
#24
IGIERR
200:
708B 8D B7 70
STA
HOUR
220:
230:
240:
JSR
JSR
TXA
CMP
BCS
STA
SAEFD
SB79E
260:
270:
700E
7011
7014
7015
7017
7019
290:
701C 4C 22 70
JMP
SETUP
JMP
SB248
2~0:
20
20
8A
C9
B0
8D
FD AE
9E B7
3C
06
B8 70
*60
IGiERR
MINUTE
310:
701F 4C 48 B2 IGiERR
;
330:
340:
350:
360:
370:
380:
401lJ:
421lJ:
431lJ:
451lJ:
451lJ:
461lJ:
471lJ:
7022 78
7023 A9 3F
702~ 8D 14
7028 A9 70
702A 8D 15
702D AD B7
7031lJ AD B8
71lJ33 A9 1lJ0
71lJ3~ 8D B9
7038 A9 00
703A 8D BA
703D 58
703E 61lJ
SETUP
501lJ:
520:
531lJ:
INC
LDA
CMP
BCS
COUNTER
COUNTER
*61lJ
CHANGE
551lJ:
7049 4C 31 EA
JMP
SEA31
~70:
580:
CHANGE
704C A9 00
704E 8D BA 71lJ
LDA
STA
*0
COUNTER
601lJ:
611lJ:
620:
7051 EE B9 71lJ
71lJ54 AD B9 70
7057 C9 3C
INC
LDA
CMP
SECOND
SECOND
*60
03
03
70
71lJ
71lJ
71lJ
SEI
LDA
STA
LDA
STA
LDA
LDA
LDA
STA
LDA
STA
CLI
RTS
*<MAIN
788
*>MAIN
789
HOUR
MINUTE
*1lJ
SECOND
*0
COUNTER
;
~10:
43
638:
7839 B8 83
BCS
MINUTECHANGE
638:
785B 4C 8D 78
JMP
678:
688:
698:
788:
718:
728:
783E
7868
7863
7866
7869
786B
748:
786D 4C 8D 78
A9
8D
EE
AD
C9
B8
88
MINUTECHALDA
B9 78
STA
B8 78
INC
B8 78
LDA
3C
CMP
83
BCS
..8
SECOND
MINUTE
MINUTE
.. 68
HOURCHANGE
768:
778:
788:
798:
888:
818:
JMP
;
7878 A9 88
HOURCHANGLDA
7872 8D B8 78
STA
7875 EE B7 78
INC
7878 AD B7 78
LDA
787B C9 18
CMP
787D 98 8E
BCC
..8
MINUTE
HOUR
HOUR
.. 24
PRINT
838:
848:
858:
868:
878:
787F
7881
7884
7887
788A
LDA
STA
STA
STA
JMP
.. 8
SECOND
MINUTE
HOUR
SEA31
898:
988:
PRINT
788D A9 13
788F 28 D2 FF
LDA
JSR
SFFD2
928:
938:
948:
7892 A9 88
7894 AE B7 78
7897 28 CD BD
LDA
LDX
JSR
.. 8
HOUR
SBDCD
968:
978:
789A A9 3A
789C 28 D2 FF
LDA
JSR
$FFD2
998:
1888:
1818:
789F A9 88
78Al AE B8 78
78A4 28 CD BD
LDA
LDX
JSR
.. 8
MINUTE
$BDCD
1838:
78A7 A9 3A
LDA
tI":
44
A9
8D
8D
8D
4C
88
B9
B8
B7
31
78
78
78
EA
""I
:It" :
1040:
70A9 20 D2 FF
JSR
.FFD2
1060:
1070:
1080:
1090:
70AC
70AE
70Bl
70B4
A9
AE
20
4C
00
B9 70
CD BD
31 EA
LDA
LDX
JSR
JMP
10
SECOND
.BDCD
.EA31
70B7
1110:
70B8
1120:
1130:
70B9
70BA
114":
l700"-7"BB
00
00
00
"0
.BYT
.BYT
.BYT
.BYT
0
0
0
0
HOUR
MINUTE
SECOND
COUNTER
READY.
B*
PC SR AC XR YR SP
.197FE 72 00 "0 01 F6
7"""
7"03
7"06
7"07
7009
7"0B
7"0E
7"11
7014
7015
7"17
7"19
701C
7"lF
7022
7"23
7025
2"
20
8A
C9
B"
8D
2"
20
8A
C9
B0
8D
4C
4C
78
A9
8D
FD AE
9E B7
18
14
B7 70
FD AE
9E B7
3C
06
B8 70
22 7"
48 B2
3F
14 03
JSR
JSR
TXA
CMP
BCS
STA
JSR
JSR
TXA
CMP
BCS
STA
JMP
JMP
SEI
LDA
STA
.AEFD
.B79E
1.18
'7"lF
.70B7
.AEFD
.B79E
1.3C
'7"lF
'7"B8
.7022
.B248
1.3F
.0314
45
7828
782A
782D
7838
7833
7835
7838
783A
783D
793E
783F
7942
7845
7847
7849
784C
784E
7951
7854
7857
7859
795B
795E
7968
7863
7866
7869
786B
71i!J6D
71i!J78
7872
7875
7878
797B
71i!J7D
71i!J7F
7li!JSl
7li!JS4
7887
7li!JSA
71i!J8D
46
A9
8D
AD
AD
A9
8D
A9
SD
58
69
EE
AD
C9
B0
4C
A9
8D
EE
AD
C9
B8
4C
A9
SD
EE
AD
C9
BIi!J
4C
A9
SD
EE
AD
C9
78
H5 83
B7
B8
88
B9
88
BA
78
78
BA
BA
3C
83
31
80
BA
B9
B9
3C
93
8D
99
B9
BS
B8
3C
93
8D
90
B8
B7
B7
lS
91i!J 9E
A9 1i!J9
8D B9
8D BS
SD B7
4C 31
A9 13
78
78
78
70
EA
78
78
78
70
79
71i!J
70
78
78
71i!J
78
71i!J
70
78
EA
LDA
STA
LDA
LDA
LDA
STA
LDA
STA
CLI
RTS
INC
LDA
CMP
BCS
JMP
LDA
STA
INC
LDA
CMP
BCS
JMP
LDA
STA
INC
LDA
CMP
BCS
JMP
LDA
STA
INC
LDA
CMP
BCC
LDA
STA
STA
STA
JMP
LDA
..578
58315
578B7
578B8
..588
578B9
"588
579BA
S78BA
S70BA
...3C
S704C
SEA31
...00
S78BA
S79B9
.78B9
..S3C
5785E
5708D
..598
570B9
57li!JB8
578B8
..S3C
57879
578SD
"S01i!J
578BS
570B7
578B7
"51S
571i!J8D
..509
S7li!JB9
570B8
578B7
5EA31
..513
788F
7892
7894
7897
789A
789C
789F
78A1
78A4
78A7
78A9
78AC
78AE
78B1
78B4
78B7
78B8
78B9
78BA
28
A9
AE
28
A9
28
A9
AE
28
A9
28
A9
AE
28
4C
88
88
88
88
D2
88
B7
CD
3A
D2
88
B8
CD
3A
D2
88
B9
CD
31
FF
78
BD
FF
78
BD
FF
78
BD
EA
JSR
LDA
LDX
JSR
LDA
JSR
LDA
LDX
JSR
LDA
JSR
LDA
LDX
JSR
JMP
BRK
BRK
BRK
BRK
SFFD2
..S88
S78B7
SBDCD
..S3A
.FFD2
...88
.78B8
.BDCD
... 3A
SFFD2
..S88
.78B9
.BDCD
.EA31
47
*-
,,,:
",
",
""
48
P,OO
'1"""
532'"
tt248
BYTE
532'"
BYTE
BYTE
tt.FF
RESET
532'"
tt248
tt,
532'"
tt,
BYTE
CHARSCROLL
tt6
.0344
tt"
tt0
'''4''1, x
1937
239:
193A
249:
259:
193D
1949
269:
1943
279:
1946
289:
1949
299:
194C
399:
194D
319:
194E
329:
1959
339:
349:
1952
1953
339:
1933
369:
379:
1938
195A
389:
195B
399:
1 1999-103C
9D
BD
9D
BD
9D
BD
9D
E8
C8
C9
D9
E8
A9
CE
D9
69
97
99
Fl
F9
El
E9
Dl
D9
94
94
94
95
95
96
96
STA .9499, X
LDA .94Fl,X
STA .94F9,X
LDA .93El,X
STA .95E9,X
LDA .96Dl,X
STA $96D9,X
INX
INY
CPY tt$27
BNE LOOP
INX
LDY tt9
DEC $9344
BNE LOOP
RTS
.BYTE7
27
E2
99
44 93
DA
BYTE
READY.
B*
PC SR AC XR YR SP
; 97FE 72 99 99 91 F6
1999
1993
1995
1996
1999
199C
199F
1912
1914
1916
1917
191A
AD
29
18
6D
8D
CE
AD
C9
F9
69
AD
29
16 D9
F8
3B
16
5B
3B
FF
91
19
D9
19
19
16 D9
F8
LDA
AND
CLC
ADC
STA
DEC
LDA
CMP
BEG!
RTS
LDA
AND
$D916
...F8
$193B
$D916
$195B
.195B
tt.FF
.1917
$D916
tt$F8
49
UIlC
Ul1D
181F
1822
1824
1827
1RJ2A
1RJ2B
1RJ2D
1838
1RJ32
1834
1RJ37
183A
1RJ3D
1RJ48
1RJ43
1RJ46
1RJ49
1RJ4C
1RJ4D
184E
18SRJ
1RJS2
18S3
1RJSS
IRJS8
IRJSA
IRJSB
50
18
69
8D
A9
8D
28
6RJ
A9
8D
A2
ARJ
BD
9D
BD
9D
BD
9D
BD
9D
E8
C8
CRJ
DRJ
E8
ARJ
CE
D8
68
RJ7
87
16 D8
87
SB 18
2B 1RJ
RJ6
44
RJ8
RJ8
RJ1
RJ8
F1
F8
El
E8
Dl
D8
RJ3
84
84
RJ4
84
RJS
8S
86
86
27
E2
RJ8
44 RJ3
DA
CLC
ADC
STA
LDA
STA
JSR
RTS
LDA
STA
LDX
LDY
LDA
STA
LDA
STA
LDA
STA
LDA
STA
INX
INY
CPY
BNE
INX
LDY
DEC
BNE
RTS
???
..S87
.D816
..SRJ7
.lRJ5B
.lRJ2B
..SRJ6
.RJ344
...RJRJ
...RJRJ
.RJ4RJ 1 , X
.RJ48RJ,X
.RJ4F1,X
.RJ4F8,X
.RJSE1,X
S85ERJ,X
SRJ6D1,X
SRJ6DRJ,X
...27
SlRJ34
...RJRJ
.RJ344
.lRJ34
*-
P,OO
S1888
S3278
.. 248
BYTE
S3278
BYTE
BYTE
.. 8
RESET
..8
BYTE
S3278
.. 248
S3278
CHARSCROLL
.. 38
1824,X
1825,X
1824+48, X
182S+48,X
1824+88, X
1825+88,X
1824+128,X
51
228:
238:
238:
248:
248:
258:
258:
268:
268:
278:
278:
288:
288:
298:
298:
388:
388:
318:
318:
328:
328:
338:
338:
348:
348:
358:
358:
368:
368:
378:
378:
3811:
3811:
3911:
3911:
41111:
4"":
41":
41":
42":
42":
43":
52
183F
1842
1845
1848
184B
184E
1851
1854
1857
185A
185D
1868
1863
1866
1869
186C
186F
1872
1875
1878
187B
187E
1881
1884
1887
188A
188D
1898
1893
1896
1"99
1119C
1"9F
l"A2
l"A5
l11A8
l"AB
ll1AE
I"Bl
I11B4
I"B7
II1BA
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
79
A8
A1
C8
C9
F8
F1
18
19
48
41
68
69
98
91
B8
B9
E8
E1
88
89
38
31
58
59
88
81
A8
A9
D8
D1
F8
F9
28
21
48
49
7"
71
98
99
C"
84
84
84
84
84
84
84
85
85
85
85
85
85
85
85
85
85
85
85
86
86
86
86
86
86
86
86
86
86
86
86
116
86
flO
"7
"7
"7
"7
"7
"7
"7
"7
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
1825+128,X
1824+168,X
1825+168,X
1824+288,X
1825+288,X
1824+248,X
1825+248,X
1824+288,X
1825+288,X
1824+328,X
1825+328,X
1824+368,X
1825+368,X
1824+488,X
1825+488,X
1824+448,X
1825+448,X
1824+488,X
1825+488, X
1824+528,X
1825+528,X
1824+568, X
1825+568,X
1824+688,X
1825+688,X
1824+648,X
1825+648,X
1824+688,X
1825+688,X
1824+72", X
1825+72",X
1"24+76", X
1825+76",X
11124+8"", X
1"25+8"",X
1"24+84", X
1"25+84",X
1"24+88", X
1"25+88",X
1"24+92", X
1"25+92",X
1"24+96", X
lSBO
431':
lSCS
441':
lSCl
441':
lSC3
441':
lSC:!
441':
lSC8
451':
lSC9
461':
llSSS-lSCA
90
CA
ES
FS
4C
61'
1'1'
Cl 1'7
FF
1'3
2A 11'
FIN
BYTE
STA 11'25+961', X
OEX
CPX 4t.FF
BEG! FIN
JMP LOOP
RTS
BYTES
READY.
B*
PC SR AC XR YR SP
; 97FE 72 1'1' 1'1' 1'1 F6
11'1'1'
11'1'3
11'1'5
11'1'6
lSS9
lSSC
lSSF
11'12
lS14
11'16
lS17
lS19
lSlC
lSlF
11'21
11'24
lS27
11'28
lS2A
11'20
lS3S
AD
29
18
60
80
EE
AD
C9
FS
61'
A9
80
AD
29
80
21'
61'
A2
BO
90
BO
16 OS
F8
C9
16
C9
C9
1'8
1'1
1'1'
C9
16
F8
16
28
11'
OS
11'
11'
11'
OS
OS
11'
26
1'1' 1'4
1'1 1'4
28 1'4
LDA
AND
CLC
AOC
STA
INC
LOA
CMP
BEQ
RTS
LOA
STA
LOA
AND
STA
JSR
RTS
LOX
LOA
STA
LOA
.01'16
... F8
.lSC9
.OS16
.lSC9
.lSC9
".1'8
.11'17
".1'1'
.lSC9
.01'16
... F8
.01'16
.11'28
...26
.1'41'1', X
.1'41'1, X
.1'428, X
53
1033
1036
1039
103C
103F
1042
1043
1048
104B
104E
1"51
1054
1037
185A
103D
1060
1063
1066
1069
106C
106F
1072
1"75
1078
1"7B
1"7E
1081
1"84
1"87
1"8A
108D
1"90
1093
1"96
1"99
1"9C
1"9F
10A2
Itz!A5
10A8
10AB
54
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
Bll
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
BD
9D
29
50
31
78
79
A0
A1
C8
C9
F8
F1
18
19
40
41
68
69
90
91
B8
B9
E0
El
08
"9
30
31
58
39
8"
81
A8
A9
D0
Dl
F8
F9
20
21
48
49
04
04
04
04
04
04
84
04
84
"4
"4
05
"5
85
83
"5
05
05
05
05
05
05
"5
06
"6
06
"6
"6
"6
"6
06
06
"6
06
"6
"6
06
07
07
07
07
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
.0429, X
.0450, X
.0451,X
.8478, X
.0479, X
.04A0,X
.84A1, X
.04C8,X
.04C9,X
."4F0,X
."4F1,X
.0518,X
.8519,X
.8540, X
.0541,X
.0568, X
.8569, X
.0590, X
."591, X
.85B8,X
.05B9,X
."5E0,X
."5El,X
."608, X
.06"9, X
."630, X
."631, X
.0658, X
."639, X
."680, X
.0681,X
.06A8,X
.86A9,X
.06D",X
.06D1,X
.86F8,X
."6F9,X
.0720, X
.0721,X
.0748,X
."749, X
10AE
10Bl
10B4
10B7
10BA
10BD
10C0
10Cl
10C3
10C5
10CS
10C9
BD
9D
BD
9D
BD
9D
CA
E0
F0
4C
60
00
70 07
71 07
9S 07
99 07
C0 07
Cl 07
FF
03
2A 10
LDA
STA
LDA
STA
LDA
STA
DEX
CPX
BE6'I
JMP
RTS
BRK
.0770, X
.0771,X
.079S,X
.0799, X
.07C0,X
S07Cl,X
...FF
S10CS
S102A
55
8. Pixel scroll up
The routine here scrolls the screen up one pixel every time that
it is called.
To set up the screen for scrolling type SYS 16384.
To scroll the screen up one pixel type SYS 16398.
*-
56
4B2D
24B:
4B2F
24B:
4838
24l1J:
4832
248:
4835
258:
268:
483'
483A
2'8:
483B
288:
l4888-483C
29
18
69
8D
A9
28
6B
8'
F8
AND #248
CLC
ADC
STA 53265
LDA .. 13
JSR SFFD2
RTS
BYTE'
.,
8'
11 D8
8D
D2 FF
BYTE
READY.
B*
PC SR AC XR YR SP
.19'FE '2 88 88 81 F6
4888
4883
4885
4888
488A
488D
488E
4811
4813
4814
481'
481A
4B1D
4828
4822
4B24
4825
482'
482A
482D
AD
29
8D
A9
8D
68
AD
29
18
6D
8D
CE
AD
C9
F8
6B
A9
8D
AD
29
11 D8
F'
11 D8
8'
3B 48
11 D8
F8
3B 48
11 D8
3B 48
3B 48
FF
81
8'
3B 48
11 DB
F8
LDA
AND
STA
LDA
STA
RTS
LDA
AND
CL.C
ADC
STA
DEC
LDA
CMP
BEQ
RTS
LDA
STA
LDA
AND
.D811
...F'
.D811
".8'
.483B
.D811
...F8
.4B3B
.D811
.483B
.483B
...FF
.4B25
".8'
.483B
.D811
...F8
57
482F
4838
4832
483S
483'
483A
483B
58
18
69
8D 11 D8
A9 "D
28 D2 FF
68
8'
",
CLC
ADC
STA
LDA
JSR
RTS
???
".8'
.D811
...8D
.FFD2
*-
59
4827
482A
482D
482F
4832
4834
4837
2~8:
4839
268:
483C
278:
483E
288:
4841
298:
4843
388:
4846
318:
4848
328:
484A
338:
484B
348:
1 4888-484C
218:
228:
228:
228:
238:
248:
8D
AD
29
8D
A9
28
A9
28
A9
28
A9
28
A9
8~
4B
11
Fe
11
13
D2
11
D2
9D
D2
94
D2
88
DA
48
D8
STA BYTE
LDA ~326~
AND tt248
STA 53265
LDA It" (HOME)"
JSR 5FFD2
LDA 1t"(CUR DNP
JSR SFFD2
LDA tt (CUR L}H
JSR SFFD2
LDA ttll(INST DEL)
JSR 5FFD2
LDA 1t128
STA 218
RTS
BYTE8
D8
FF
FF
FF
FF
68
88
BYTE
READY.
B*
PC SR AC XR YR SP
,97FE 72 88 88 81 F6
4888 AD 11
4883 29 F7
488~ 8D 11
4888 A9 88
488A 8D 4B
488D 68
488E AD 11
4811 29 F8
4813 18
4814 6D 4B
4817 8D 11
481A EE 4B
481D AD 4B
60
D8
D8
48
D8
48
D8
48
48
LDA
AND
STA
LDA
STA
RTS
LDA
AND
CLC
ADC
STA
INC
LDA
SD811
ttSF7
SD811
ItS88
S484B
SD811
1t5F8
5484B
.D811
5484B
5484B
4020
4022
4824
4825
4027
482A
482D
482F
4832
4834
4837
4839
483C
483E
4841
4843
4846
4848
484A
484B
C9
F0
60
A9
8D
AD
29
8D
A9
28
A9
28
A9
28
A9
28
A9
85
68
88
08
81
88
4B 48
11 D8
Fe
11 D8
13
D2 FF
11
D2 FF
9D
D2 FF
94
D2 FF
88
DA
CMP
BEQ
RTS
LDA
STA
LDA
AND
STA
LDA
JSR
LDA
JSR
LDA
JSR
LDA
JSR
LDA
STA
RTS
BRK
...08
.4825
...88
S484B
SD811
..SF 8
SD811
... 13
SFFD2
... 11
SFFD2
...9D
SFFD2
..S94
SFFD2
...80
SDA
61
10. Colour
This routine allows you to change the screen colour, the border colour, the text colour, extended colours 1, 2 and 3 (or multicolour) in one command.
The syntax is as follows:
SYS 28672,screen colour, border colour,text colour,
multi1,multi2,multi3
NB. All parameters must be given.
12":
13S:
7"""
7""3
7""6
7""9
7""C
7""F
2"
2"
8D
2S
2"
8D
FD
37
21
FD
37
2"
AE
7"
D"
AE
7"
D"
15":
16":
18":
198:
288:
228:
238:
7"12
7"15
7"18
781B
781E
7"21
7824
2"
2"
8D
28
28
eD
28
FD
37
86
FD
37
22
FD
AE
7"
"2
AE
7"
D"
AE
8":
9":
lS":
11":
62
.OPT P,OO
S7""S
*-
SAEFD
PARAM
646
SAEFD
PARAM
~3282
SAEFD
7827
248:
268:
782A
278:
782D
7838
288:
388:
7833
318:
7836
328:
7837
328:
783A
338:
783B
783C
348:
J7888-783F
28
8D
28
28
8D
68
28
8A
68
4C
37
23
FD
37
24
78
D8
AE
78
D8
9E B7 PARAM
48 B2 161ERR
JSR
STA
JSR
JSR
STA
RTS
JSR
TXA
RTS
JMP
PARAM
~3283
.AEFD
PARAM
~3284
.B79E
.B248
READY.
B*
PC SR AC XR YR SP
.197FE 72 88 88 81 F6
7888
7883
7886
7889
788C
788F
7812
781~
7818
781B
781E
7821
7824
7827
7fl12A
782D
7838
7833
7fl136
7fl137
7fl13A
783B
783C
28
28
8D
28
28
8D
28
28
8D
28
2fl1
8D
28
28
aD
28
2fl1
8D
6fl1
28
8A
68
4C
FD
37
21
FD
37
28
FD
37
86
FD
37
22
FD
37
23
FD
37
24
AE
78
D8
AE
78
D8
AE
78
flI2
AE
7fl1
D8
AE
78
DflI
AE
78
D8
9E B7
48 B2
JSR
JSR
STA
JSR
JSR
STA
JSR
JSR
STA
JSR
JSR
STA
JSR
JSR
STA
JSR
JSR
STA
RTS
JSR
TXA
RTS
JMP
.AEFD
.7837
.D821
.AEFD
.7837
.D828
.AEFD
.7837
.8286
.AEFD
.7837
.DflI22
.AEFD
.7fl137
.DflI23
.AEFD
.7837
.D824
.B79E
.B248
63
11. Copy
This routine allows you to copy the contents of part of or all
of the character ROM to a specified part of RAM. This is to make
user defined characters easier to set up.
The syntax is SYS 24576,address,no. of pages to copy.
The address is where you want to start your character set at.
The number of pages to copy is the number of 256 byte blocks
of the ROM to copy down. Only whole numbers are allowed.
The character ROM is 16 blocks long. If you specify more than
16 then an illegal quantity error will occur.
e.g. To copy the whole character ROM down to location 8192
type the following:
SYS 24576,8192,16
or, to copy only the first K of the ROM down to location 12288
type:
SYS 24576,12288,4
To enable the character set use location 53272 or the change
banks routine in this book.
To enable the character set at location 8192 type:
POKE 53272,24
64
6fi1BB
6BBB
.OPT P,OO
*=
S6BBB
,ROUTINE TO MOVE
,CHARACTER
,ROM TO SPECIFIED
, LOCATION
,SYNTAX
;
lSB:
16B:
17":
18":
19":
211":
21":
23":
24":
2S":
26":
27":
28":
29":
311":
31":
32":
33":
34":
3S":
36":
375:
376:
38":
68BB
68B3
68B6
68B9
2B FD AE
2B 8A AD
2B F7 B7
6811
6814
6817
6818
681A
2"
2"
8A
C9
9"
4C
8S
A9
8D
A"
A9
8S
A9
8S
AS 14
68BB 8S FB
68BD AS 1S
6811F 8S FC
6fi11C
681F
6821
6823
6826
6828
682A
682C
682E
,SYS24S76,START,NO OF
,PAGES TO COPY
,WHERE PAGES ARE 2S6
,BYTES LONG
JSR SAEFD
JSR SAD8A
JSR SB7F7
LDA S14
STA SFB
LDA S1S
STA SFC
FD AE
9E B7
11
B3
48 B2
FD
MORE
BB
SB 6"
BB
FE
""
DB
FF
683B A9 BB
6832 8D BE DC
6fi13S A9 33
JSR
JSR
TXA
CMP
Bec
JMP
STA
LDA
STA
LDY
LDA
STA
LDA
STA
LDA
STA
LDA
SAEFD
SB79E
.. 17
MORE
SB248
SFD
."
.."
."
TEMP
SFE
.. 2B8
SFF
."
S6334
.. 51
65
390:
400:
410:
420:
430:
6037
6039
603B
603D
603E
85
B1
91
C8
D0
01
FE
FB
F9
STA
LDA
STA
INY
BNE
LOOP
450:
460:
470:
480:
6040
6043
6046
611J48
EE
AD
C3
B0
5B 61lJ
5B 611J
FD
07
INC
LDA
CMP
BCS
TEMP
TEMP
$FD
FINISH
311J0:
510:
5211J:
611J4A E6 FC
611J4C E6 FF
61lJ4E 4C 39 611J
INC
INC
JMP
$FC
SFF
LOOP
LDA
STA
LDA
STA
RTS
tt55
1
ttl
56334
5411J:
611J5l
550:
611J53
560:
cllJ55
570:
61lJ57
580:
611J5A
590:
611J5B
l611J00-611J5B
A9
85
A9
8D
61lJ
LOOP
;
37
FINISH
01
IIJl
0E DC
TEMP
READY.
B*
PC SR AC XR YR SP
; 97FE 72 1lJ0 1lJ0 IIJl F6
61lJIIJIIJ
61lJIIJ3
611J1IJ6
61lJ1lJ9
61lJIlJB
601lJD
61lJIIJF
66
21lJ
211J
211J
A5
85
A5
85
FD AE
8A AD
F7 B7
14
FB
15
FC
JSR
JSR
JSR
LDA
STA
LDA
STA
SAEFD
SAD8A
SB7F7
S14
SFB
S15
SFC
1
(SFE),Y
(SFB),Y
6011
6014
6017
6018
601A
601C
601F
6021
6023
6026
6028
602A
6f1J2C
6f1J2E
6f1J3fIJ
6f1J32
6f1J35
6f1J37
6f1J39
6f1J3B
6f1J3D
6f1J3E
6f1J4fIJ
6f1J43
6f1J46
6048
6f1J4A
604C
604E
6051
6f1J53
6055
6057
6f1J5A
20
20
8A
C9
90
4C
85
A9
8D
A0
A9
85
A9
85
A9
8D
A9
85
B1
91
C8
DfIJ
EE
AD
C5
BfIJ
E6
E6
4C
A9
85
A9
8D
60
FD AE
9E B7
11
03
48 B2
FD
00
58 60
00
fIJfIJ
FE
DfIJ
FF
fIJfIJ
flJE DC
33
01
FE
FB
F9
58
5B
FD
07
FC
FF
39
37
flJ1
flJ1
flJE
6fIJ
6fIJ
60
DC
JSR
JSR
TXA
CMP
BCC
JMP
STA
LDA
STA
LDY
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
INY
BNE
INC
LDA
CMP
BCS
INC
INC
JMP
LDA
STA
LDA
STA
RTS
SAEFD
SB79E
.. Sl1
S601F
SB248
SFD
..S00
S605B
..S00
.. SfIJfIJ
SFE
.. SD0
SFF
.. SfIJfIJ
SDCflJE
.. S33
SflJl
(SFE),Y
(SFB),Y
S6039
S6f1J5B
S605B
SFD
S6051
SFC
SFF
S6039
.. S37
S01
.. S01
SDCflJE
67
12. Sprite/char
If you are using sprites in a program the time will come when
you want to find what character the sprite is under or over. You
can see which one, but the computer cannot. Commodore kindly
made it possible for the video chip to detect if it has hit a character
or not, but not to detect which one. The following program does
this. It is written to detect the charcter under sprite O. To find
out which character it is, use SYS 16384 from Basic or JSR $4000
from machine code. The character code is returned in location
828 ($033C), so to find the character execute the routine and
PEEK or LOA(X or Y) location 828 ($033C)
No doubt you will want to check which character is under a
different sprite than sprite O. Rather than listing 8 programs, one
for each sprite, here is a list of what to change to make it work
for any sprite:
1. Change the first line from LOA $0000 to LOA $ hex location
of 'X' coordinate of the sprite that you want to test.
2. Change the line at address $400A to CMP # $ bit value of
sprite to be tested (sprite 0 = 1 through to sprite 7 = 128).
3. Change the line at address $400E to LOX $ hex location of
'X' coordinate of the sprite to be tested.
4. Change the line at address $4011 to LOA $ hex location of
'Y' coordinate of sprite to be tested.
5. Change the line at address $4032 to CMP # $ bit value of sprite
to be tested (as in 2).
The routine checks which character is under the top left 8 bytes
of the sprite (going down). i.e.
68
123
123
123
123
123
123
123
123
and so on ...
It checks the character under the 1s in the above diagram, but
this can be altered by changing two bytes in the program as
follows:
The line at location $4004 is SBe #$18. The number after the
SBe must never be less than $18 (24), but if you add one to
this value for every bit across the sprite then you can alter where
on the horizontal the routine will check. (This number must never
exceed $30 (48) if the sprite is not expanded in the 'X' direction
or $60 (96) if expanded.) Remember that as the sprite is expanded
each dot on the sprite is 2 dots wide, therefore you will need
to multiply the amount greater than $18 by two and add it to $18.
e.g. to get the routine to check for the rightmost 8 bits of an
unexpanded sprite, make the line SBe # $30.
Or, to get the routine to check for the 7th to the 15th bit across
in an expanded sprite, make the line SBe # (24 + 7*2) which
is SBe #$26.
To alter where the routine checks on the vertical change the
line at address $4015 (SBe #$3A). The rules for changing are
the same as for the 'X' direction. If the sprite is unexpanded
in the 'V' direction then the value is $3A + the byte down. If
the sprite is expanded then the value is $3A + 2* the byte down.
The value must never be less than $3A and if the sprite is unexpanded no greater than $4F (79) or if the sprite is expanded no
greater than $64 (100) for the routine.
e.g. to make the routine check for the bottom 8 bytes of the
sprite when it is unexpanded the line is SBe #$47.
69
or, to make the routine check for the 10th to the 18th byte down
in an expanded sprite the line is SBe #$3A + 2*10 which is
SBe #$4E
""
""
70
.OPT
*=
LDA
SEC
SBC
TAX
LDA
CMP
BNE
LDX
LDA
SEC
SBC
TAY
STX
STY
TYA
LSR
LSR
LSR
CLC
ADC
STA
TXA
LSR
LSR
LSR
STA
LDA
CMP
BNE
LDA
CLC
P,OO
$4"""
53248
.. 24
53264
.. 1
MORE
53248
53249
.. 58
X1STORE ;Xl
Y1STORE ; Y1
A
A
A
;Y2=Yl/8
.. 1
Y2STORE
A
A
A ; X2=X2/8
X2STORE
53264
.. 1
MOREl
X2STORE
1ge:
2ee:
21e:
22e:
23e:
24e:
25e:
26e:
27e:
28e:
2ge:
3ee:
31e:
32e:
33e:
340:
35e:
4e3A
4e3C
4e3F
4e42
4e45
4e47
4e4A
4e4D
4e5e
4e53
4e56
4e59
4e5B
4e5E
4e61
4062
4064
69
8D
AD
8D
A9
8D
2e
AD
6D
8D
AD
69
8D
AD
18
69
8D
380:
380:
3ge:
3ge:
40e:
41e:
420:
430:
440:
450:
46e:
470:
480:
4ge:
50e:
51e:
520:
530:
540:
550:
56e:
4e67
406A
406C
406F
4071
4073
4075
4078
4079
407B
407E
4080
4083
4085
4086
4089
408A
408D
4e8E
4090
4e93
AD
85
AD
85
Ae
Bl
eD
60
A9
8D
A2
4E
ge
18
6D
6A
6E
CA
De
8D
6e
lD
99
9B
96
28
97
79
99
94
94
95
ee
95
95
ADC tt29
STA X2STORE
LDA Y2STORE
STA NUMBERl
LDA tt4e
4e
STA NUMBER2
4e
JSR MULTIPLY
4e
LDA X2STORE
4e
ADC RESULT
4e
STA RESULT
4e
LDA RESULT+l
ADC tte
4e
STA RESULT+l
4e
LDA RESULT+l
CLC
04
ADC tt4
95 40
STA RESULT+l
; CHARACTER IN LOCATION
; IN LOCS RESULT AND RESULT+l
94 40
LDA RESULT
FB
STA SFB
95 4e
LDA RESULT+l
FC
STA SFC
e0
LDY tte
FB
LDA (SFB),Y
3C e3
STA 828
RTS
00
MULTIPLY LDA tt0
94 40
STA RESULT
08
LDX tt8
96 40 LOOP
LSR NUMBERl
e4
BCC NO ADD
CLC
97 4e
ADC NUMBER2
NO ADD
ROR A
94 4e
ROR RESULT
DEX
Fe
BNE LOOP
95 40
STA RESULT+l
RTS
4e
4e MOREl
4e
71
4"94
58":
59":
4"96
4"97
6"":
61":
4"98
62":
4"99
4"9A
63":
64":
4"9B
14"""-4"9C
"" ""
""
""
""
""
""
""
RESULT
NUMBER1
NUMBER2
X1STORE
X2STORE
Y1STORE
Y2STORE
WORD"
BYTE"
BYTE"
BYTE"
BYTE"
BYTE"
BYTE"
READY.
B*
PC SR AC XR YR SP
I 97FE 72 00 00 01 F6
4000
4003
4004
4006
4007
400A
400C
400E
4011
4014
401~
4017
4018
4018
401E
401F
4020
4021
4022
4023
4025
72
AD
38
E9
AA
AD
C9
D0
AE
AD
38
E9
A8
8E
8C
98
4A
4A
4A
18
69
8D
00 D0
18
10 D0
01
03
00 D0
01 D0
3A
98 40
9A 40
01
98 40
LDA
SEC
SBC
TAX
LDA
CMP
BNE
LDX
LDA
SEC
SBC
TAY
STX
STY
TYA
LSR
LSR
LSR
CLC
ADC
STA
.D000
... 18
.D010
...01
.4011
.D000
.D001
...3A
.4098
.409A
...01
.4098
492S
4929
492A
492B
492C
492F
4932
4934
4936
4939
493A
493C
493F
4942
4945
4947
494A
494D
4959
4953
4956
4959
495B
495E
4"61
4"62
4964
4"67
4"6A
4"6C
4"6F
4971
4"73
4975
4"78
4979
4"7B
497E
4"S"
49S3
4"85
SA
4A
4A
4A
SD
AD
C9
D9
AD
lS
69
SD
AD
SD
A9
SD
29
AD
6D
SD
AD
69
SD
AD
lS
69
8D
AD
85
AD
85
A"
Bl
SD
69
A9
8D
A2
4E
99
18
99 49
19 D9
01
09
99 49
lD
99
9B
96
2S
97
79
99
94
94
95
99
95
95
04
95
94
FB
95
FC
09
FB
3C
49
49
49
49
49
49
49
49
49
49
49
4"
4"
4"
93
09
94 49
0S
96 4"
04
TXA
LSR
LSR
LSR
STA
LDA
CMP
BNE
LDA
CLC
ADC
STA
LDA
STA
LDA
STA
JSR
LDA
ADC
STA
LDA
ADC
STA
LDA
CLC
ADC
STA
LDA
STA
LDA
STA
LDY
LDA
STA
RTS
LDA
STA
LDX
LSR
!.lCC
CLC
$4999
$D919
.. 591
$493F
$4999
.. 51D
$4999
$499B
$4996
...2S
$4997
54979
$4999
$4994
54994
54995
..599
54995
54995
"5"4
$4"95
54994
.FB
54995
.FC
"5"9
C5FB),Y
.933C
..599
$4994
"59S
$4996
$49S9
73
4086
4089
408A
408D
408E
4098
4893
4094
4895
4096
4897
4898
4899
489A
489B
74
6D
6A
6E
CA
D0
8D
68
88
88
88
00
88
00
08
88
97 40
94 40
F8
93 48
ADC
ROR
ROR
DEX
BNE
STA
RTS
BRK
BRK
BRK
BRK
BRK
BRK
BRK
BRK
$4097
$4094
$4888
$4095
13. Doke
The following routine allows you to POKE a 16 bit number into
two consecutive locations. This could be to change a RAM vector. It replaces the following line of Basic code:
a = number: hi = intI a/256): 10 = (a-number)*256: poke
address, lo:pokeaddress + 1,hi
To use the routine type SYS 960,address,number.
e.g. to change the output character routine to point to your own
routine at 828 (as in the list alter routine later) type SYS
960,806,828.
.OPT P,OO
968
*=
DOKE ROUTINE
SYNTAX SYS 968,
ADDRESS, VALUE
EG SYS16384,788,16384
118:
120:
130:
03C0 28 FD AE
03C3 28 8A AD
03C6 20 F7 B7
JSR
JSR
JSR
.AEFD
.AD8A
.B7F7
1~8:
03C9
03CB
03CD
03CF
LDA
STA
LDA
STA
.14
.FB
.15
.FC
160:
170:
180:
A5
85
A5
85
14
FB
15
Fe
75
20S:
21S:
22S:
S3Dl 2S FD AE
03D4 2S 8A AD
S3D7 2S F7 B7
JSR
JSR
JSR
SAEFD
SAD8A
SB7F7
24S:
25S:
26S:
27S:
28S:
29S:
03DA
S3DC
S3DE
S3ES
03E2
S3E4
LDY
LDA
STA
LDY
LDA
STA
IS
S14
(SFB),Y
11
S15
(SFB),Y
AS
AS
91
AS
AS
91
SS
14
FB
Sl
15
FB
31S:
03E6 6S
l03CS-03E7
RTS
READY.
B*
PC SR AC XR YR SP
; 97FE 72 S0 00 Sl F6
S3C0
03C3
03C6
S3C9
03CB
03CD
03CF
03Dl
S3D4
03D7
S3DA
03DC
S3DE
03ES
03E2
03E4
S3E6
76
2S
20
20
A5
85
A:I
85
20
20
2S
AS
AS
91
AS
AS
91
6S
FD
8A
F7
14
FB
lS
FC
FD
8A
F7
SS
14
FB
Sl
1:1
FB
AE
AD
B7
AE
AD
B7
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDY
LDA
STA
LDY
LDA
STA
RTS
.AEFD
.AD8A
$B7F7
.14
.FB
.1:1
.FC
$AEFD
$AD8A
.B7F7
I$SS
$14
($FB) ,Y
...Sl
$15
(.FB) ,Y
14. Deek
This routine is complementary to Doke. It allows you to read
the contents of two consecutive locations in memory. It replaces
the following line of Basic code:
PRINT PEEK(ADDRESS) + 256*PEEK(ADDRESS + 1)
The routine cannot create a variable (e.g. a = Deek (address)
is not possible).
The syntax for the routine is as follows:
SYS 828,address
28:
38:
B33C
B33C
.OPT P,OO
929
*=
SIMULATED DEEK
FUNCTION
ONLY USED TO PRINT
THE VALUE
IN TWO CONSECUTIVE
LOCATIONS IN 16 BIT
FORMAT
SYNTAX
SYS929,ADDRESS
EG. SYS92S,79S
WILL RETURN 59953
77
2H':
22.0:
23.0:
.033C 2.0 FD AE
.033F 2.0 8A AD
.0342 2.0 F7 B7
JSR
JSR
JSR
SAEFD
SAD8A
SB7F7
25.0:
26.0:
27.0:
28.0:
.0345
.0347
.0349
,034B
A5
85
A5
85
14
FB
15
FC
LDA
STA
LDA
STA
S14
SFB
S15
SFC
3.0.0:
31.0:
32.0:
33.0:
34.0:
,034D
,034F
.0351
.0352
.0353
A.0 .0.0
B1 FB
C8
AA
B1 FB
LDY
LDA
INY
TAX
LDA
.. .0
(SFB) ,Y
36.0:
0355 4C CD BD
JMP
$BDCD
(SFB) ,Y
l033C-,0358
READY.
B*
PC SR AC XR YR SP
; 97FE 72 0.0 00 01 F6
033C
033F
0342
0345
0347
0349
034B
034D
034F
.0351
0352
0353
0355
78
20
20
20
A5
85
A5
85
A0
B1
C8
AA
B1
4C
FD AE
8A AD
F7 B7
14
FB
15
FC
.00
FB
FB
CD BD
JSR
JSR
JSR
LDA
STA
LDA
STA
LDY
LDA
INY
TAX
LDA
JMP
$AEFD
.AD8A
.B7F7
$14
$FB
$15
$FC
"$00
(SFB),Y
($FB) ,Y
SBDCD
.OPT P,OO
$6000
*=
6000 78
6001 A9 32
SEl
LDA
'"<MAl
6003 8D 14 03
6006 A9 60
STA
LDA
788
,">MAl
40:
40:
40:
6008 8D 15 03
600B A9 0F
600D 8D 18 D4
STA
LDA
STA
789
'"15
54296
50:
50:
6010 A9 13
6012 8D 04 D4
LDA
STA
'"19
54276
50:
50:
6015 A9 40
6017 8D 05 D4
LDA
STA
'"64
54277
50:
601A 8D 06 D4
STA
54278
50:
601D 8D 0C D4
STA
54284
40:
40:
N
40:
40:
N
79
5a:
61l121l1 8D IlID D4
STA
54285
52:
52:
611123 A9 21
611125 8D IlIB D4
LDA
STA
n33
54283
55:
55:
55:
55:
55:
55:
611128
61l12A
61l12C
61l12E
61l131l1
611131
LDA
STA
STA
STA
CLI
RTS
nlll
251
252
253
7t;J:
71l1:
70:
LDX
LDY
251
252
Sill:
611132 A6 FB
MAIN
611134 A4 FC
611136
611136 BD 74 6111
LDA
TUNE,
X
91l1:
611139 8D IlIIl1 D4
STA
54272
61l13C BD A6 6 III
LDA
TUNE1
61l13F 8D 1117 D4
STA
54279
611142 BD A7 6 III
LDA
TUNE1
611145 8D illS D4
STA
5428111
1t;J1l1:
1,X
611148 BD 75 6 III
LDA
TUNE+
11 III :
61l14B 8D 01 D4
STA
54273
120:
131l1:
141l1:
LAY
151l1:
151l1:
61l14E A5 FD
61l151l1 C9 iliA
611152 Bill 1lI5
LDA
CMP
BCS
253
n11l1
NEXDE
611154 E6 FD
611156 4C 31 EA
INC
JMP
253
SEA31
161l1:
161l1:
161l1:
611159 A9 1110
61l15B 85 FD
61l15D E8
95:
-2,X
95:
95:
-l,X
95:
80
A9
85
85
85
58
6111
IlIIl1
FB
FC
FD
NEXDELAY LDA
STA
INX
nlll
253
16flJ:
16flJ:
16flJ:
16flJ:
16flJ:
16flJ:
16flJ:
6flJ5E
6flJ5F
6flJ6flJ
6flJ62
6flJ64
6flJ66
6flJ68
E8
C8
86
84
EflJ
BflJ
4C
165:
165:
165:
165:
6flJ6B
6flJ6D
6flJ6F
6flJ71
A2
85
85
4C
FB
FC
3flJ
flJ3
31 EA
INX
INY
STX
STY
CPX
BCS
.JMP
251
252
tt48
RE
SEA31
flJflJ
RE
FB
FC
31 EA
LDX
STA
STA
.JMP
ttflJ
251
252
SEA31
81
B*
PC SR AC XR YR SP
.197FE 72 flIflI flIflI flIl F6
6fl1fl1fl1
6fl1fl11
6fl1113
6fl1116
6fl1118
61111B
61111D
611111
61112
6111~
61117
6111A
6111D
61128
61123
61125
61128
6112A
6112C
6112E
61138
61131
61132
61134
61136
61139
6113C
6113F
61142
78
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
8D
8D
8D
A9
8D
A9
85
8~
8~
~8
68
A6
A4
BD
8D
BD
8D
BD
6114~ aD
61148 BD
6114B 8D
684E A~
611~8 C9
6852 BII
61154 E6
61156 4C
82
32
14 113
611
1~ 113
flIF
18 D4
13
84 D4
411
85 D4
86 D4
8C D4
8D D4
21
8B D4
811
FB
FC
FD
FB
FC
74
811
A6
87
A7
88
611
D4
611
D4
611
D4
7~ 611
81 D4
FD
8A
85
FD
31 EA
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
STA
STA
STA
LDA
STA
LDA
STA
STA
STA
eLI
RTS
LDX
LDY
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
CMP
BCS
INC
JMP
...32
$11314
...6fl1
.1I31~
...IIF
SD418
... 13
$D4114
...411
.D411~
SD4116
SD411C
SD411D
...21
SD411B
.. SIIII
SFB
SFC
SFD
.FB
.FC
.61174, X
.D4811
S6I1A6,X
SD487
S6I1A7,X
SD488
S6117~,X
SD481
.FD
...8A
S61159
SFD
SEA31
6.059
6.05B
6.05D
6.05E
6.05F
6.06.0
6.062
6.064
61666
6.068
6m6B
6m6D
6m6F
61671
61674
61676
61677
6.078
:
:
:
:
6.074
6m7C
6.084
6m8C
: 61694
: 6m9C
: 6mA4
: 68AC
: 6mB4
: 6mBC
: 6mC4
: 6mcc
: 6mD4
A9
85
E8
E8
C8
86
84
E.0
Bm
4C
A2
85
85
4C
C6
.0.0
16m
C6
e.0
FD
C6
7E
7E
16m
E3
B1
16m
72
9F
A3
A3
A3
8.0
2D
26
26
em
16
19
8.0
8B
89
87
87
e7
8m
LDA
STA
INX
INX
INY
STX
STY
CPX
BCS
JMP
LDX
STA
STA
JMP
DEC
BRI<
BRI<
DEC
FB
FC
3.0
e3
31 EA
em
FB
FC
31 EA
2D
2D
.016
16.0
4B
D6
B1
E3
mB
CD
93
35
93
35
Bm
16m
.0.0
22
1C
19
16
16m
mA
168
167
168
.07
16m
C6
7E
8D
8D
8D
168
72
9F
9F
168
B9
6C
168
.. S.0.0
SFD
SFB
SFC
..S3.0
S6.06B
.EA31
....016
SFB
.FC
SEA31
.2D
S2D
2D
26
1E
1E
1E
16m
mB
169
B9
16m
165
166
16m
34
4B
D6
4B
D6
16m
.016
16m
93
35
6C
B9
2B
22
1C
22
1C
16m
16m
16m
168
167
166
165
Bm 16m
83
935C
935E
9369
9363
9365
9368
936B
936E
9379
C9
F9
CE
D9
29
AD
80
A9
29
90
98
7A
9B
74
77
7A
90
74
MAIN
93
93
93 DOCR
93
93 NAOOCR
.OPT P,OO
*= S933C
= S9326
JSR SAEFD
JSR SB79E
STX COLUMN
LDA IBSOUT
STA OLDOUT
LDA IBSOUT+l
STA OLDOUT+l
LDA tt<MAIN
STA IBSOUT
LDA tt>MAIN
STA IBSOUT+l
RTS
CMP
BEG!
DEC
BNE
JSR
LOA
STA
LDA
JSR
tt13
DOCR
COUNT
NAODCR
NEWPRT
COLUMN
COUNT
tt13
NEWPRT
0373 60
270:
280:
0374 6C 78 03 NEWPRT
COLUMN
290:
0377 50
OLDOUT
300:
0378
0378
COUNT
310:
l033C-0378
RTS
(OLDOUT)
JMP
80
.BYT
=
=
*'OLDOUT+2
READY.
B*,
PC SR AC XR YR SP
; 97FE 72 00 01lJ 01 F6
1lJ33C
033F
0342
0345
0348
034B
034E
0351
0353
0356
0358
1lJ35B
035C
035E
1lJ361lJ
0363
0365
1lJ368
036B
036E
0371lJ
0373
0374
0377
21lJ
20
8E
AD
8D
AD
8D
A9
8D
A9
8D
61lJ
C9
F0
CE
DIlJ
21lJ
AD
8D
A9
21lJ
61lJ
6C
51lJ
FD
9E
77
26
78
27
79
5C
26
03
27
IlJD
1lJ8
7A
IlJB
74
77
7A
IlJD
74
AE
B7
03
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
1lJ3
78 1lJ3
0e
JSR
JSR
STX
LDA
STA
LDA
STA
LDA
STA
LDA
STA
RTS
CMP
BEG!
DEC
BNE
JSR
LDA
STA
LDA
JSR
RTS
JMP
BVC
SAEFD
SB79E
SIlJ377
SIlJ326
SIlJ378
SIlJ327
SIlJ379
"SSC
S0326
...1lJ3
SIlJ327
...0D
SIlJ368
SIlJ37A
SIlJ370
SIlJ374
SIlJ377
SIlJ37A
.. SIlJD
SIlJ374
(S0378)
SIlJ379
85
17. Old
This routine allows a program accidentally newed to be recovered. It also works after a SYS 64738 or SYS 58260 (cold or
warm start). If the old routine is not in memory when you need
it, do not worry: it can be loaded in after the new and executed
and the program will still be recovered.
To use type SYS 300.
To load into memory after a new type LOAD"OLD",8,1 (or
LOAD"OLD",1,1) and then SYS 300.
*=
READY.
86
PC SR AC XR YR SP
.;97FE 72 00 00 01 F6
B*
PC SR AC XR YR SP
; 97FE 72 00 00 01 F6
012C
012E
0130
0132
0133
0137
0138
013A
013C
.913E
.914.9
0142
A9
A0
91
20
A3
18
69
85
A5
69
85
4C
FF
01
2B
33 A3
22
02
2D
23
.9'"
2E
5E A6
LDA
LDY
STA
JSR
LDA
CLC
ADC
STA
LDA
ADC
STA
JMP
#SFF
#.01
('2B) ,Y
.A333
$22
#.02
$2D
$23
# .90
$2E
$A65E
87
18. Graph
This routine is the graph (or high res) command. It turns on the
high res screen which is located at 24576 and the colour memory
at 16384. It does not clear the screen.
To use type SYS 49152.
.OPT P,OO
.C888
*-
; GRAPH FUNCTION 26
"8:
98:
C888 A9 16
C882 aD 88 DD
118:
128:
C88~
A9 8a
C88" aD 18 D8
C88A
C""D
C""F
1~":
C"12
lC"8"-C"13
148:
148:
148:
READY.
88
AD 11 D"
"9 28
aD 11 D"
6"
LDA tt$16
STA ~6~"6
; CHANGE BLOCK
LDA
STA
LDA
ORA
STA
RTS
tta
~3272
~326~
tt32
~3265
B*
PC SR AC XR YR SP
; 97FE 72 ee es el F6
cees A9
cee2 SD
cees A9
eee7 SD
eeeA AD
ceeD e9
ceeF SD
ce12 6e
16
ee DD
es
lS De
11 DS
2e
11 DS
LDA
STA
LDA
STA
LDA
ORA
STA
RTS
... 16
.DDse
...es
.DelS
.Dell
...2e
.Dell
89
19. NRM
This is the complementary routine to graph. It turns the high
res screen off and returns to the normal text screen.
To use type SYS 49174.
B*
PC SR AC XR YR SP
.197FE 72 IS IS 11 F6
Cl16
Cl18
CllB
CllD
Cl21
Cl22
Cl25
90
A9
8D
A9
8D
A9
8D
61
1~
18 De
lB
11 DI
17
11 DD
LDA
STA
LDA
STA
LDA
STA
RTS
... 15
.Dl18
... lB
.Dlll
... 17
.DDII
20. CLG
This routine clears the high res screen. Two parameters are required. The first defines the drawing colour and the second the
background colour. Both are values between 0 and 15 and are
the same as the usual text colours.
To use type SYS 49190, drawing colour, background colour.
*=
91
15m:
15m:
16m:
16m:
17m:
18m:
19m:
2mm:
21m:
cm57
cm59
cm5B
cm5D
cm5F
cm61
cm63
C"65
C"66
22":
C"68
23":
C"6A
24":
C"6C
25m:
C"6E
26m:
C"7"
27":
C"73
28":
C"75
C"78
29":
C"7B
3"":
31":
C"7E
32":
C"81
cm82
32":
32":
C"84
C"85
33":
lC"26-CS85
A9
85
A9
85
Am
A9
91
C8
D"
E6
A6
E"
D"
AD
A2
9D
9D
9D
9D
E8
Dm
6"
m"
FB
6"
FC
m"
m"
FB
LOOP
FB
FC
FC
8"
F3
85 C"
m"
4" LOOP1
41
42
43
""
""
""
""
F1
FIN
LDA
STA
LDA
STA
LDY
LDA
STA
INY
BNE
INC
LDX
CPX
BNE
LDA
LDX
STA
STA
STA
STA
INX
BNE
RTS
.. m
SFB
.. 96
SFC
.. m
.. m
CSFB) ,Y
READY.
B*
PC
SR AC XR YR SP
"1 F6
. I 97FE 72 "m
C"26
C"29
C"2C
C"2F
C"31
C"33
C"36
92
2"
2"
2"
A5
F"
4C
A5
FD
SA
F7
15
"3
48
14
AE
AD
B7
""
B2
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
SAEFD
SAD8A
SB7F7
$15
SC"36
SB248
514
LOOP
SFC
SFC
.. 128
LOOP
FIN
.."
S4""",X
S41mm,X
$42"", X
.43"",X
LOOP1
C038
C03B
C03E
C041
C044
C046
C048
C04B
C04D
C04E
C04F
C050
C051
C054
C057
C059
C05B
C05D
C05F
C061
C063
cm65
C066
C068
Cm6A
C06C
C06E
C070
C073
cm75
C078
C07B
C07E
C081
C882
C884
8D
20
20
20
AS
F0
4C
A5
0A
0A
0A
0A
0D
8D
A9
85
A9
85
A0
A9
91
C8
D0
E6
A6
Em
D0
AD
A2
9D
9D
9D
9D
E8
8S
FD
8A
F7
15
03
48
14
B2
85 C0
85 C0
016
FB
616
FC
00
0m
FB
FB
FC
FC
8m
F3
85 C0
00
1616 48
016 41
016 42
mf6 43
Df6 Fl
60
C0
AE
AD
B7
STA
JSR
JSR
JSR
LDA
BEQ
JMP
LDA
ASL
ASL
ASL
ASL
ORA
STA
LDA
STA
LDA
STA
LDY
LDA
STA
INY
BNE
INC
LDX
CPX
BNE
LDA
LDX
STA
STA
STA
STA
INX
BNE
RTS
SC08S
SAEFD
SAD8A
SB7F7
S15
SC04B
SB248
S14
SC085
SC085
..S00
SFB
..S60
SFC
..S00
..S00
CSFB),Y
SC063
SFC
SFC
..S80
SC063
scm85
..S00
S400m,x
S4100,X
S4200,X
S4380,X
SC075
93
21. Plot
This routine plots a point Oil the high res screen . It requires
two parameters: the X coordinate (0-319) and the Y coordinate
(0-199) to be plotted.
The syntax is SYS 49286,X coord, Y coord.
.OPT P,OO
*= $C0SA
$14
=
;AND $15
50:
CaSA
caSA
6a:
70:
Ca8A
cmSA
sa:
98:
cmSA
lmm:
cmSA
13m:
cmSA A9 mm
14m:
cmsc SD 3A Cl
TEMP
=
SCREEN
=
CHECKCOM =
COORD
=
FALSE
=
TRUE
=
SET
LDA
SETl
STA
$FD
$6ma0
$AEFD
$B7EB
255
0
ttTRUE
RSFLAG
15m:
OM
16m:
17m:
lsm:
cmSF 2m FD AE
JSR
CHECKC
cm92 2m EB B7
cm95 E0 CS
cm97 B0 5E
JSR
CPX
BCS
COORD
tt2mm
TOOBIG
19m:
cm99 A5 14
LDA
XCOORD
20m:
21m:
+1
cm9B C9 40
cm9D A5 15
CMP
LDA
tt<32m
XCOORD
94
220:
230:
240:
250:
260:
270:
280:
290:
300:
Y
310:
320:
1, Y
330:
C09F E9 01
C0Al B0 54
SBC
BCS
tt>320
TOOBIG
TXA
LSR
LSR
LSR
ASL
TAY
LDA
TABLE,
STA
LDA
TEMP
TABLE+
C0Bl 85 FE
STA
TEMP+l
C0A3 8A
C0A4 4A
C0A5 4A
C0A6 4A
C0A7 0A
C0A8 A8
C0A9 B9 F8 C0
;MULTIPLY PUT IN
C0AC 85 FD
C0AE B9 F9 C0
340:
350:
0111
360:
370:
380:
390:
C0B3 8A
C0B4 29 07
TXA
AND
#%0000
C0B6
C0B7
C0B9
C0BB
18
65 FD
85 FD
A5 FE
CLC
ADC
STA
LDA
TEMP
TEMP
TEMP+l
400:
410:
C0BD 69 00
C0BF 85 FE
ADC
STA
#0
TEMP+l
420:
C0Cl A5 14
LDA
XCOORD
430:
0111
440:
450:
C0C3 29 07
AND
#'.0000
C0C5 A8
C0C6 A5 14
TAY
LDA
XCOORD
C0C8 29 F8
AND
#'.1111
C0CA
C0CB
C0CD
C0CF
CLC
ADC
STA
LDA
TEMP
TEMP
TEMP+l
460:
1000
470:
480:
490:
500:
18
65 FD
85 FD
A5 FE
95
510:
+1
520:
C0Dl 65 15
ADC
XCOORD
C0D3 85 FE
STA
TEMP+l
530:
540:
550:
EN
560:
570:
C0D5 A5 FD
C0D7 18
C0D8 69 00
LDA
CLC
ADC
TEMP
C0DA 85 FD
C0DC A5 FE
STA
LDA
TEMP
TEMP+1
580:
EN
590:
C0DE 69 60
ADC
tt>SCRE
C0E0 85 FE
STA
TEMP+1
C0E2 A2 00
C0E4 A1 FD
LDX
LDA
.. 0
<TEMP,
C0E6 2C 3A C1
BIT
RSFLAG
630:
C0E9 10 06
C0EB 39 32 C1
640:
K,Y
C0EE 4C F4 C0
650:
C0F1 19 2A C1
660:
,Y
C0F4 81 FD
670:
X)
C0F6 60
680:
C0F7 60
690:
C0F8
700:
C0F8 00 00 4"
710:
N,2*N,3*N,4*N
C1"2 40 06 80
72":
N,7*N,8*N,9*N
C1"C 80 0C C0
73":
1*N, 12*N, 13*N,14*N
C116 C0 12 00
74":
6*N, 17*N, 18*N, 19*N
C120 00 19 40
75":
1*N,22*N,23*N,24*N
BPL
AND
SET2
ANDMAS
SET2
JMP
ORA
SET3
ORMASK
SET3
STA
(TEMP,
600:
610:
X)
620:
96
TOOBIG
N
TABLE
tt<SCRE
RTS
RTS
320
.WORD0*N,1*
.WORD5*N,6*
.WORD10*N,1
.WORD15*N,1
.WORD20*N,2
77":
C12A 8"
"""
78":
C12B 4"
.BYT %"110""
"""
79":
C12C 2"
.BYT %""1""
C12D 1"
.BYT %"""1"
C12E "8
.BYT %""""1
C12F "4
.BYT %fO""fO"
C13" "2
.BYT %"""""
C131 fOl
.BYT %""fO"fO
"""
8"":
"""
81":
"""
82":
1""
83":
"1"
84"=
""1
86":
111
87":
111
88"=
111
89":
111
9"":
111
91":
"11
92":
1"1
93":
11"
C132 7F
ORMASI<
ANDMASI<
.BYT %1""""
.BYT 'YofOllll
C133 BF
.BYT %1"111
C134 DF
.BYT %11fOll
C135 EF
.BYT %111fOl
C136 F7
.BYT %1111"
C137 FB
.BYT %11111
C138 FD
.BYT %11111
C139 FE
.BYT %11111
C13A
95":
]C"8A-C13B
""
RSFLAG
.BYT "
READY.
97
B*
PC SR AC XR YR SP
; 97FE 72 flJflJ flJflJ flJl F6
CflJSA A9 flJflJ
CflJSC SD JA Cl
CflJSF 2flJ FD AE
CflJ92 2flJ EB B7
CflJ95 EflJ CS
CflJ97 BflJ SE
CflJ99 A5 14
CflJ9B C9 4flJ
CflJ9D A5 15
CflJ9F E9 flJ1
CflJAl BflJ 54
CflJA3 SA
CflJA4 4A
CflJA5 4A
CflJA6 4A
CflJA7 flJA
CflJAS AS
CflJA9 B9 FS CflJ
CflJAC S5 FD
CflJAE B9 F9 CflJ
CflJB1 S5 FE
CflJB3 SA
CflJB4 29 flJ7
CflJB6 lS
CflJB7 65 FD
CflJB9 S5 FD
CflJBB A5 FE
CflJBD 69 aflJ
CflJBF S5 FE
CflJCl A5 14
CflJC3 29 flJ7
CflJC5 AS
CflJC6 A5 14
CflJCS 29 FS
CflJCA 1S
CflJCB 65 FD
CflJeD S5 FD
98
LDA
STA
JSR
JSR
CPX
BCS
LDA
CMP
LDA
SBC
BCS
TXA
LSR
LSR
LSR
ASL
TAY
LDA
STA
LDA
STA
TXA
AND
CLC
ADC
STA
LDA
ADC
STA
LDA
AND
TAY
LDA
AND
CLC
ADC
STA
..SflJflJ
SC13A
SAEFD
$B7EB
"SCS
SCflJF7
S14
..S4flJ
S15
..SflJl
SCflJF7
.CflJFS,Y
SFD
SCflJF9,Y
SFE
"$flJ7
SFD
.FD
.FE
.. SflJflJ
SFE
$14
..SflJ7
S14
... FS
.FD
SFD
CtlCF
CtlDl
CtlD3
CtlD5
CtlD7
C"D8
CtlDA
C"DC
CtlDE
C"EIlJ
CtlE2
C"E4
CtlE6
C"E9
C"EB
CIlJEE
CtlFl
C"F4
CIlJF6
CIlJF7
A5
65
85
A5
18
69
85
A5
69
85
A2
Al
2C
FE
15
FE
FD
IlJIlJ
FD
FE
61lJ
FE
IlJIlJ
FD
JA Cl
11lJ 1lJ6
J9
4C
19
81
61lJ
61lJ
: CIlJF8
: C11lJ1lJ
: C11lJ8
J2 Cl
F4 CIlJ
2A Cl
FD
LDA
ADC
STA
LDA
CLC
ADC
STA
LDA
ADC
STA
LDX
LDA
BIT
BPL
AND
JMP
ORA
STA
RTS
RTS
$FE
$15
$FE
$FD
...1lJ1lJ
.FD
.FE
... 61lJ
.FE
...1lJ1lJ
C.FD,X)
SC1JA
.CIlJFl
.C132,Y
.CIlJF4
.C12A,Y
C.FD,X)
81lJ 1lJ2
8" 1lJ7
80 IlJC
81lJ 11
81lJ 16
81lJ lB
21lJ 11lJ
IlJJ
08
0D
12
C0 17
C0 lC
CIlJ
CIlJ
CIlJ
CIlJ
1lJ8 1lJ4
DF EF F7 FB
C9 F0 08 21lJ
99
22. Unplot
This routine is complementary to Plot. It unplots a point on the
high res screen. Just type in the routine below and unplot is
ready.
To use type SYS 49286,X,Y
30' *=SC0S6
40' LDA .. SFF
50' BNE SET1
READY.
PC SR AC XR YR SP
.,97FE 72 0'0' 0'0' 0'1 F6
100
CBS6 A9 FF
LDA ttSFF
cess De flJ2
BNE scesc
23. Char
This routine puts a character onto the high res screen. You specify three parameters: the X coordinate (0-39), the Y coordinate
(0-24) and the character code (screen code).
The syntax is SYS 49467,X,Y,char code
70:
80:
90:
100:
100:
100:
110:
120:
130:
140:
140:
14m:
150:
C13B
C13E
C141
C144
C146
C148
C14A
C14D
C150
C153
C155
C157
C159
4C
20
20
A5
C9
B0
8D
20
20
A5
C9
B0
8D
48
FD
ID
14
28
Fl
48
FD
ID
14
19
E2
4C
B2
AE
C2
170:
180:
190:
200:
210:
220:
C15C
C15F
C162
C164
C167
C16A
AD
8D
A9
8D
20
AD
48
48
08
49
28
46
C2
C2
C2
AE
C2
C2
C2
C2
C2
.OPT P,OO
SC13B
*=
;CHAR X,Y,CHARACTER,
;EOR OR DELETE
ERROR
JMP SB248
JSR SAEFD
JSR PARAMS
LDA S14
CMP .. 40
BCS ERROR
STA XSTORE
JSR SAEFD
JSR PARAMS
LDA S14
CMP .. 25
BCS ERROR
STA YSTORE
;TOTAL = Y*320 + X*8
LDA XSTORE
STA MULTI
LDA .. 8
STA MULT2
JSR MULTIPLY
LDA RESULT
101
23.0:
24.0:
25.0:
C16D 85 FB
C16F AD 47 C2
C172 85 FC
STA
LDA
STA
.FB
RESULT+1
.FC
;NOW
28.0:
29.0:
399:
31.0:
32B:
33B:
339:
33B:
33B:
34B:
35.0:
35B:
369:
369:
379:
379:
389:
399:
4.09:
41.0:
429:
429:
439:
449:
45.0:
46.0:
47.0:
47.0:
48.0:
49.0:
59.0:
5.0.0:
51B:
52.0:
53.0:
54.0:
102
C174
C177
C17A
C17C
C17F
C182
C185
C188
C18B
C18E
C199
C193
C196
C199
C19C
C19E
CIAl
CIA2
CIA4
CIA6
CIA9
CIAA
ClAD
CIBB
CIBl
CIB3
CIB6
CIB7
CIB9
CIBC
CIBE
CIBF
CIC2
CIC4
CIC6
CIC9
AD
8D
A9
8D
4C
48
28
49
2B 2B
AD 46
8D 5B
AD 47
8D 51
A2 B7
AD 46
6D 5B
8D 46
AD 47
69 B.0
8D 47
CA
D.0 EC
A2 97
AD 47
18
6D 51
8D 47
CA
D9 F3
AD 47
18
69 69
8D 47
A5 FB
18
6D 46
85 FB
A5 FC
6D 47
85 FC
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
Y=32.0*Y
LDA
STA
LDA
STA
JSR
LDA
STA
LDA
STA
LDX
LOOP12
LDA
ADC
STA
LDA
ADC
STA
DEX
BNE
LDX
LOOP14
LDA
CLC
ADC
STA
DEX
BNE
LDA
CLC
ADC
STA
LDA
CLC
ADC
STA
LDA
ADC
STA
YSTORE
MULTl
.. 49
MULT2
MULTIPLY
RESULT
STORERES
RESULT+l
STORERES+l
.. 7
RESULT
STORERES
RESULT
RESULT+l
.. B
RESULT+l
LOOP12
.. 7
RESULT+l
STORERES+l
RESULT+l
LOOP14
RESULT+l
...6.0
RESULT+l
.FB
RESULT
.FB
.FC
RESULT+l
.FC
559:
569:
579:
589:
599:
699:
619:
629:
639:
641l1:
C1CB
C1CE
C1Dl
C1D3
C1D6
C1D9
C1DC
C1DE
C1El
C1E4
29
29
A5
8D
AD
8D
A9
8D
2111
AD
651l1:
661l1:
679:
C1E7 85 FD
C1E9 AD 47 C2
C1EC 18
671l1:
68S:
699:
699:
69S:
691l1:
69S:
71l1S:
711l1:
729:
73S:
73S:
74S:
75S:
761l1:
77S:
78S:
79S:
8es:
81S:
829:
829:
829:
829:
839:
849:
C1ED
ClEF
C1Fl
C1F3
C1F6
C1F7
C1F9
C1FB
C1FD
C1FF
C21l11
C21l13
C2e5
C21l17
C2S9
C2SB
C2eD
C21e
C213
C215
C217
C219
C21B
C21C
C21D
C229
69
85
A9
8D
78
A9
85
A9
Bl
91
E6
Dill
FD
lD
14
4E
4E
48
98
49
2B
46
AE
C2
C2
C2
C2
C2
C2
C2
De
FE
ge
4A C2
33
01
llIe
FD
FB
FB
92
FC
FD
e2
FE
4A C2
4A C2
III 8
E6
37
e1
E6
E6
DS
E6
EE
AD
C9
De
A9
85
58
69
29 8A AD
29 F7 B7
JSR SAEFD
JSR PARAMS
LDA S14
STA CHAR
LDA CHAR
STA MULTl
LDA tt8
STA MULT2
JSR MULTIPLY
LDA RESULT
; CHARACTER LOCATION
STA SFD
LDA RESULT+l
CLC
;ADD .D9 TO SD99S
ADC ttsDe
STA SFE
LDA tt9
STA COUNT
SEI
LDA tt51
STA .91
LDY tt9
LOOPl
LDA (SFD),Y
STA (SFB),Y
INC SFB
BNE Nl
INC SFC
Nl
INC SFD
BNE N2
INC SFE
N2
INC COUNT
LDA COUNT
CMP tt8
BNE LOOPl
LDA tt55
STA 1
CLI
RTS
PARAMS
JSR SAD8A
JSR SB7F7
103
C223
85":
C225
85":
C227
86":
C22A
86":
C22B
87":
C22D
88":
C23"
89":
C232
9"":
C235
91":
C237
92":
C238
93":
C23B
94":
C23C
95":
C23F
96":
C24"
97":
C242
98":
C245
99":
1""": C246
1"1": C248
1"2": C249
1"3": C24A
1"4": C24B
1"5": C24C
1"6": C24D
1"7": C24E
1"8": C24F
1"9": C25"
lC13B-C252
AS
F"
4C
6"
A9
8D
A2
4E
9"
18
6D
6A
6E
CA
D"
8D
6"
15
"3
48 B2
LDA S15
BEQ FINROUT
JMP SB248
FINROUT RTS
MULTIPLY LDA tt"
"9
46 C2
STA RESULT
LDX tt8
"8
48 C2 LOOP21
LSR MULTl
BCC LOOP9
"4
CLC
49 C2
ADC MULT2
LOOP9
ROR A
46 C2
ROR RESULT
DEX
BNE LOOP21
F"
47 C2
STA RESULT+l
RTS
RESULT
WORD"
MULTl
.BYT
MULT2
.BYT
COUNT
.BYT
XSTORE
.BYT
YSTORE
.BYT
EORFLAG .BYT
CHAR
.BYT
STORE
.BYT
STORERES WORD"
"" ""
""
"
"
"
"
""
""
""
""
""
""
""
"" ""
""
"
"
READY.
B*
PC SR AC XR YR SP
; 97FE 72
"1 F6
"" ""
CIJB 4C 48 B2
CIJE 2" FD AE
C141 2" ID C2
104
JMP SB248
JSR SAEFD
JSR SC21D
C144
C146
C148
C14A
C14D
C159
C153
C155
C157
C159
C15C
C15F
C162
C164
C167
C16A
C16D
C16F
C172
C174
C177
C17A
C17C
C17F
C182
C185
C188
C18B
C18E
C199
C193
C196
C199
C19C
C19E
C1Al
C1A2
C1A4
C1A6
C1A9
C1AA
A5
C9
B9
8D
29
29
A5
C9
B9
8D
AD
8D
A9
8D
29
AD
85
AD
85
AD
8D
A9
8D
29
AD
8D
AD
8D
A2
AD
6D
8D
AD
69
8D
CA
D9
A2
AD
18
6D
14
28
Fl
41
FD
lD
14
19
E2
4C
4B
48
98
49
2B
46
FB
47
FC
4C
48
28
49
21
46
59
47
51
97
46
59
46
47
99
47
C2
AE
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
C2
EC
97
47 C2
51 C2
LDA
CMP
ICS
STA
JSR
JSR
LDA
CMP
ICS
STA
LDA
STA
LDA
STA
JSR
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JSR
LDA
STA
LDA
STA
LDX
LDA
ADC
STA
LDA
ADC
STA
DEX
ENE
LDX
LDA
CLC
ADC
$14
41.28
$C13B
$C24B
$AEFD
SC21D
$14
ttS19
SC131
SC24C
$C24B
SC248
ttS98
SC249
SC22B
SC246
SFB
SC247
SFC
SC24C
SC248
ttS28
SC249
SC22B
SC246
SC259
SC247
SC251
41.97
SC246
SC259
SC246
SC247
ttS99
SC247
SC199
41.97
.C247
.C251
105
ClAD
CIBS
CIBl
CIB3
CIB6
CIB7
CIB9
CIBC
CIBE
CIBF
CIC2
CIC4
CIC6
CIC9
CICB
CICE
CIDl
CID3
CID6
CID9
CIDC
CIDE
CIEl
CIE4
CIE7
CIE9
CIEC
CIED
ClEF
CIFl
CIF3
CIF6
CIF7
CIF9
CIFB
CIFD
CIFF
C2S1
C2S3
C205
C207
106
8D
CA
DS
AD
18
69
8D
A~
47 C2
F3
47 C2
6S
47 C2
FB
18
6D 46
85 FB
A~ FC
6D 47
85 FC
2S FD
2S ID
A5 14
8D 4E
AD 4E
8D 48
A9 S8
8D 49
2S 2B
AD 46
8~ FD
AD 47
18
69 DS
8~ FE
A9 SS
8D 4A
78
A9 33
85 Sl
AS SS
Bl FD
91 FB
E6 FB
DS S2
E6 FC
E6 FD
C2
C2
AE
C2
C2
C2
C2
C2
C2
C2
C2
C2
STA
DEX
BNE
LDA
CLC
ADC
STA
LDA
CLC
ADC
STA
LDA
ADC
STA
JSR
JSR
LDA
STA
LDA
STA
LDA
STA
JSR
LDA
STA
LDA
CLC
ADC
STA
LDA
STA
SEI
LDA
STA
LDY
LDA
STA
INC
BNE
INC
INC
SC247
SCIA6
SC247
"56S
SC247
5FB
SC246
5FB
SFC
SC247
SFC
SAEFD
SC21D
514
SC24E
SC24E
SC248
"SS8
SC249
SC22B
SC246
SFD
SC247
"5DS
SFE
...SS
SC24A
"S33
SSl
.. SSS
(SFD) ,Y
(SFB),Y
SFB
SC2S7
SFC
SFD
C209
C20B
C20D
C210
C213
C215
C217
C219
C21B
C21C
C21D
C220
C223
C225
C227
C22A
C22B
C22D
C230
C232
C235
C237
C238
C23B
C23C
C23F
C240
C242
C245
D0
E6
EE
AD
C9
D0
A9
85
58
60
20
20
A5
F0
4C
60
A9
8D
A2
4E
991
18
6D
6A
6E
CA
D0
8D
60
912
FE
4A C2
4A C2
918
E6
37
911
8A AD
F7 B7
15
913
48 B2
910
46 C2
918
48 C2
914
49 C2
46 C2
F0
47 C2
BNE
INC
INC
LDA
CMP
BNE
LOA
STA
CLI
RTS
JSR
JSR
LOA
BEG!
JMP
RTS
LOA
STA
LOX
LSR
BCC
CLC
ADC
ROR
ROR
DEX
BNE
STA
RTS
SC20D
SFE
SC24A
SC24A
.. S08
SCIFD
..S37
.01
SAD8A
SB7F7
S15
SC22A
SB248
...00
SC246
.. S08
SC248
.C23B
SC249
SC246
.C232
.C247
.:C246 091 00 00 00 00 00 00 00
.:C24E 9191 00 091 00 10 CF A5 BA
107
PAL
2
2.0:
3.0:
.OPT P,OO
828
*=
ROUTINE TO CHANGE
BANK FOR
VIC II CHIP
SYNTAX
SYS 828, BANK (.0-3)
13f(J:
14.0:
15.0:
16.0:
17f(J:
18.0:
f(J33C
.033F
f(J342
.0343
.0345
.0347
2f(J
2.0
8A
C9
9f(J
4C
.05
.03
48 B2
2f(Jf(J:
21.0:
22.0:
23.0:
24.0:
.034A
.034B
.034E
.0351
f(J354
AA
BD
80
BD
80
63
18
67
88
108
FD AE
9E B7
MORE
.03
0.0
.03
.02
JSR
JSR
TXA
CMP
BCC
JMP
SAEFD
SB79E
#5
MORE
SB248
TAX
LOA
STA
LOA
STA
L53272,X
53272
L648,X
648
25.0:
26.0:
27.0:
28.0:
29.0:
.0357
.035A
.035D
.035F
.0362
BD
8D
A9
2.0
6.0
6B .03
.0.0 DD
93
D2 FF
LDA
STA
LDA
JSR
RTS
31.0:
.0363 15 15 15 L53272
.0367 .04 .04 .04 L648
32.0:
.036B 47 46 45 L56576
33.0:
l.033C-.036F
L56576,X
56576
#"to
SFFD2
.BYT 21,21,21,21
.BYT 4,4,4,4
.BYT 71,7.0,69,68
READY.
B*
PC
SR AC XR YR SP
; 97FE 72 .0.0 .0.0 .01 F6
.033C
.033F
.0342
.0343
.0345
.0347
.034A
.034B
.034E
.0351
.0354
.0357
.035A
.035D
.035F
.0362
2.0
2.0
8A
C9
9.0
4C
AA
BD
8D
BD
8D
BD
8D
A9
2.0
6.0
FD AE
9E B7
.05
.03
48 B2
63
18
67
88
6B
.03
D.0
.03
.02
.03
.0ta DD
93
D2 FF
JSR
JSR
TXA
CMP
Bce
JMP
TAX
LDA
STA
LDA
STA
LDA
STA
LDA
JSR
RTS
SAEFD
SB79E
#S.05
S.034A
SB248
S.0363,X
SD.018
S.0367,X
S.0288
S.036B,X
SDD.0.0
#S93
SFFD2
109
25. Invert
This routine inverts all or some of the high res screen (it can
invert any part of memory).
The syntax is SYS 49746,start,invert
*=
916:
C252 216 FD AE
lee:
C255 216 8A AD
1116:
1216:
1216:
1316:
1316:
C258
C25B
C25D
C25F
C261
1516:
C263 216 FD AE
1616:
1716:
1816:
1816:
1916:
1916:
C266
C269
C26C
C26E
C271
C273
110
216
A5
85
A5
85
216
216
A5
8D
A5
8D
F7 B7
14
FB
15
FC
8A
F7
14
3C
15
3D
AD
B7
163
163
C276
21":
C278
22":
C27A
23":
C27C
24":
C27E
25":
C281
26":
C283
26":
C286
26":
C288
27":
C28B
28":
C28D
28":
C29"
28":
C292
29":
C295
3"":
C297
3"":
C299
31":
C29A
32":
C29C
32":
C29D
33":
lC252-C29E
A"
A9
51
91
2"
A5
CD
F"
4C
AS
CD
F"
4C
E6
F"
6"
E6
6"
6"
LOOP
""
FF
FB
FB
95
FB
3C
"3
76
FC
3D
"B
76
FB
"1
C2
"3
C2
CHECK
"3
C2
ADD
FC
FCPLUS1
FINISH
LDY
LDA
EOR
STA
JSR
LDA
CMP
BEQ
JMP
LDA
CMP
BEQ
JMP
INC
BEQ
RTS
INC
RTS
RTS
tt"
tt255
(SFB),Y
(.FB) ,Y
ADD
.FB
828
CHECK
LOOP
.FC
829
FINISH
LOOP
.FB
FCPLUS1
SFC
READY.
B*
PC SR AC XR YR SP
; 97FE 72
"1 F6
C252
C255
C258
C25B
C25D
C25F
C261
C263
2"
2"
2"
A5
85
A5
85
2"
""AE""
FD
8A
F7
14
FB
15
FC
FD
AD
B7
AE
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
.AEFD
$AD8A
.B7F7
514
.FB
$15
.FC
SAEFD
111
C266
C269
C26C
C26E
C271
C273
C276
C278
C27A
C27C
C27E
C281
C283
C286
C288
C28B
C28D
C290
C292
C295
C297
C299
C29A
C29C
C29D
112
20
20
A5
8D
A5
8D
A0
A9
51
91
20
A5
CD
F0
4C
A5
CD
F0
4C
E6
F0
60
E6
60
60
8A
F7
14
3C
15
3D
00
FF
FB
FB
95
FB
3C
03
76
FC
3D
0B
76
FB
01
FC
AD
B7
03
03
C2
03
C2
03
C2
JSR
JSR
LDA
STA
LDA
STA
LDY
LDA
EOR
STA
JSR
LDA
CMP
BEG
JMP
LDA
CMP
BEG
JMP
INC
BEG!
RTS
INC
RTS
RTS
SAD8A
SB7F7
S14
S033C
S15
S033D
..S00
..SFF
(SFB) ,Y
(SFB) ,Y
SC295
SFB
S033C
SC28B
SC276
SFC
S033D
SC29D
SC276
SFB
SC29A
SFC
26. Organ
The following is a simple interrupt driven organ program. It allows you to playa tune on the keyboard whether a program
is running or not. The program could run with a sound shaping
program, for example.
The keys used are as follows:
qwertyuiop@* t
and the space bar to turn the notes off
To turn on the organ type SYS 49152.
.OPT P,OO
$C9f219
*=
5121:
59:
C99f21 78
Cf21f211 A9 1F
SEI
LDA
#<MAIN
5121:
69:
C9f213 8D 14 93
Cf21f216 A9 C9
STA
LDA
788
#>MAIN
6121:
79:
7121:
79:
7121:
79:
7121:
79:
7121:
79:
Cf2198
Cf21f21B
C99D
Cf211f21
Cf21l2
Cf2115
C9l7
Cf21lA
C9lD
Cf211E
93
STA
LDA
STA
LDA
STA
LDA
STA
STA
CLI
RTS
789
#15
54296
#33
54276
#<56
54277
54278
8D
A9
8D
A9
8D
A9
8D
8D
58
6121
15
f21F
18
21
1214
38
95
1216
D4
D4
D4
D4
113
90:
1m,,:
10":
11":
A,X
12":
TE
13":
130:
13":
14":
15":
160:
cmlF
C"21
C"23
C"25
A5
A2
A"
DD
MAIN
C5
0m
"m
43 C" LOOP
E8
C8
C8
Em "F
D" F4
4C 31 EA
PLAYNOTE
180:
C"34
B9
51
C"34
19":
C"
BLE,Y
C"37 8D "1 D4
19":
cm3A B9 52 C"
19":
BLE+l,Y
D4
C"3D 8D
19":
31
EA
4C
cm4"
20":
3E
C"43
21":
"9 "E KEYDATA
4,17,22,25,3",33,38,41
cm4D 2E 31 36
22":
54,6"
""
... DA
LDX
LDY
CMP
...."m
BEG!
PLAYNO
INX
INY
INY
CPX
BNE
JMP
.. 15
LOOP
$EA31
197
KEYDAT
LDA
*NOTETA
STA
LDA
54273
NOTETA
STA 54272
JMP $EA31
.BYT 62,9,1
.BYT 46,49,
PC SR AC XR YR SP
.197FE 72 ee ee el F6
114
CIlJIlJIlJ
CllJllJl
CIlJ1lJ3
CIlJ1lJ6
CIlJ1lJ8
CIlJSB
CIlJSD
CIlJ1S
CIlJ12
CllJl!5
CIlJ17
CIlJ1A
CIlJ1D
CIlJ1E
CIlJ1F
CIlJ21
CIlJ23
CIlJ25
CIlJ28
CIlJ2A
CIlJ2B
CIlJ2C
CIlJ2D
CIlJ2F
CIlJ31
CIlJ34
CIlJ37
CIlJ3A
CIlJ3D
CIlJ4S
78
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
8D
58
6S
A!5
A2
AIlJ
DD
FIlJ
E8
C8
C8
EIlJ
DS
4C
B9
8D
B9
8D
4C
: CS43
: CS4B
.:CS53
: CS5B
: CS63
: CS6B
IF
14
CS
15
IlJF
18
21
S4
38
S5
S6
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
STA
CLI
RTS
LDA
LDX
LDY
CMP
BEG!
INX
INY
INY
CPX
BNE
JMP
LDA
STA
LDA
STA
JMP
1lJ3
1lJ3
D4
D4
D4
D4
C!5
SS
SS
43 CS
SA
IlJF
F4
31
51
IlJl
52
IlJIlJ
31
3E
26
13
lC
2B
SS
EA
CS
D4
CS
D4
EA
S9
29
3F
D6
34
SIlJ
SE
2E
15
2S
2D
8S
.. SlF
SIlJ314
"SCS
SS315
..SIlJF
SD418
...21
.D4S4
"S38
SD41lJ5
.D4S6
SC5
".SS
...SIlJ
.CS43,X
.C1lJ34
...SF
.CS25
SEA31
SCS!51,Y
SD4S1
SCS!52,Y
.D4IlJS
SEA31
11 16 19 lE 21
36 3C 11 25
31
9A
5E
C6
DS
16
22
33
F3
E3
4B
61
AD
19 Bl
26 7E
39 AC
85 cm
115
27. Sound
This routine makes sound much easier to use. It allows you to
set the voice, volume, frequency and waveform for the sound.
The syntax is SYS 16384,voice,volume,frequency,waveform.
FOR A =
TO 65535 STEP100 :
SYS16384, 1, 15,A,33:NEXT:SYS16384, 1,0,0,33
The last statement turns off the sound.
.OPT P,OO
S4000
*=
SOUND ROUTINE
SYNTAX
SYS 16384,VOICE,
VOLUME,FRE~,WAVE
1116:
1216:
116
4000 20 FD AE
4003 20 8A AD
JSR
JSR
SAEFD
SAD8A
130:
140:
150:
160:
170:
4006
4009
400B
400D
400F
20
A5
D0
A5
8D
F7 B7
15
3F
14
DA 40
JSR
LDA
BNE
LDA
STA
$B7F7
$15
IGIERR
$14
VOICE
190:
200:
210:
220:
230:
240:
250:
4012
40H5
4018
401B
401D
401F
4021
20
20
20
A5
D0
A5
8D
FD
8A
F7
15
2D
14
DB
JSR
JSR
JSR
LDA
BNE
LDA
STA
$AEFD
$AD8A
$B7F7
$15
IGIERR
$14
VOLUME
270:
280:
290:
300:
310:
320:
330:
4024
4027
402A
402D
402F
4032
4034
20
20
20
A5
8D
A5
8D
FD
8A
F7
14
DD
15
DE
AE
AD
B7
JSR
JSR
JSR
LDA
STA
LDA
STA
$AEFD
$AD8A
$B7F7
$14
FREGI
$15
FREGI+1
350:
360:
370:
380:
390:
400:
410:
420:
430:
4037
403A
403D
4040
4042
4044
4046
4049
404C
20
20
20
A5
D0
A5
8D
4C
4C
FD
8A
F7
15
08
14
DC
4F
48
AE
AD
B7
JSR
JSR
JSR
LDA
BNE
LDA
STA
JMP
JMP
$AEFD
$AD8A
$B7F7
$15
IGIERR
$14
WAVE
DO
$B248
450:
450:
460:
470:
480:
480:
490:
500:
510:
404F
4051
4054
4057
4059
405A
405C
405E
4061
A2
AD
DD
F0
E8
E0
D0
4C
AD
00
DO
DC 40
DF 40 LOP
08
LDX
LDA
CMP
BEGI
INX
CPX
BNE
JMP
LDA
*0
WAVE
WAVETABLE,X
MORE
AE
AD
B7
40
40
40
40
40
B2 IGIERR
04
F6
4C 40
DA 40 MORE
*4
LOP
IGIERR
VOICE
117
52":
53":
54":
4"64 F" E6
4"66 C9 "4
4"68 B" E2
BEGI
CMP
BCS
IGiERR
.. 4
IGiERR
56":
5''':
58":
4"6A AD DB 4"
4"6D C9 10
4"6F B" DB
LDA
CMP
BCS
VOLUME
.. 16
IGiERR
60":
61":
40'1 AD DB 4"
4"'4 8D 18 D4
LDA
STA
VOLUME
54296
63":
40"
AD DA 40
LDA
VOICE
650:
660:
6'0:
680:
698:
40'A
40'C
40'E
4080
4882
C9
F0
C9
F0
4C
"1
CMP
BEGl
CMP
BEGl
JMP
.. 1
VOICEl
.. 2
VOICE2
VOICE3
'18:
'28:
'38:
'48:
'58:
'60:
"8:
'88:
'98:
8"":
4085
4088
488B
408D
4090
4093
4896
4899
489C
4"9F
AD
8D
A9
8D
8D
AD
8D
AD
8D
4C
DC
"4
80
05
06
DD
80
DE
01
D9
48 VOICEl
D4
LDA
STA
LDA
STA
STA
LDA
STA
LDA
STA
JMP
WAVE
542'6
.. 128
542"
542'8
FREGI
542'2
FREGl+l
542'3
FINISH
82":
83":
84":
858:
868:
8'8:
888:
890:
90":
910:
4"A2
40A5
4"A8
48AA
48AD
48B"
4"B3
4"B6
4"B9
4"BC
AD
8D
A9
8D
8D
AD
8D
AD
8D
4C
DC
"B
80
8C
"D
DD
8'
DE
"8
D9
4" VOICE2
D4
LDA
STA
LDA
STA
STA
LDA
STA
LDA
STA
JMP
WAVE
54283
.. 128
54284
54285
FREGl
542'9
FREGI+l
5428"
FINISH
118
"7
02
20
BF 48
D4
D4
40
D4
48
D4
4"
D4
D4
48
D4
40
D4
40
93.0:
94.0:
95.0:
96.0:
970:
98.0:
990:
1.0.0.0:
1.010:
48BF AD DC
40C2 8D 12
40C~ A9 80
40C7 8D 13
40CA 8D 14
48CD AD DD
48D0 8D 0E
40D3 AD DE
40D6 8D 0F
1030: 48D9
40DA
104.0:
1.050:
40DB
1060: 40DC
1070: 40DD
1080:
40DF
l4000-40E3
40 VOICE3
D4
D4
D4
4.0
D4
4.0
D4
60
.0.0
00
00
00 00
11 21 41
LDA
STA
LDA
STA
STA
LDA
STA
LDA
STA
WAVE
5429.0
tU28
54291
54292
FRE6I
54286
FRE6I+l
54287
FINISH
RTS
VOICE
.BYT .0
VOLUME
.BYT 0
WAVE
.BYT 0
FRE6I
.WORD0
WAVETABLE.BYT 17,33,65,129
READY.
B*
PC SR AC XR YR SP
97FE 72 0.0 0.0 01 F6
4000
4003
4006
4009
400B
400D
400F
4012
20
20
20
A5
D0
A5
8D
20
401~ 20
4018 20
401B A~
401D D0
401F A5
FD
8A
F7
H5
3F
14
DA
FD
8A
F7
15
2D
14
AE
AD
B7
40
AE
AD
B7
JSR
JSR
JSR
LDA
BNE
LDA
STA
JSR
JSR
JSR
LDA
BNE
LDA
.AEFD
SAD8A
SB7F7
.H5
S404C
S14
S40DA
SAEFD
SAD8A
.B7F7
.1~
S404C
S14
119
4921
4924
4927
492A
492D
492F
4932
4934
4937
493A
493D
4949
4942
4944
4946
4949
494C
494F
4931
4934
4937
4939
495A
495C
493E
4961
4964
4966
4968
496A
496D
496F
4971
4974
4977
4.07A
4.07C
4.07E
498.0
4982
4985
120
8D
29
29
29
A5
8D
A5
8D
29
29
29
A5
D9
A5
8D
4C
4C
A2
AD
DD
F9
E8
E9
D9
4C
AD
F9
C9
B9
AD
C9
B9
AD
8D
AD
C9
F.0
C9
F9
4C
AD
DB
FD
8A
F7
14
DD
15
DE
FD
8A
F7
13
98
14
DC
4F
48
99
DC
DF
98
94
F6
4C
DA
E6
94
E2
DB
1.0
DB
DB
18
DA
91
97
92
2.0
BF
DC
49
AE
AD
B7
49
49
AE
AD
B7
49
49
B2
49
49
49
49
49
49
D4
49
4.0
49
STA
JSR
JSR
JSR
LDA
STA
LDA
STA
JSR
JSR
JSR
LDA
BNE
LDA
STA
JMP
JMP
LDX
LDA
CMP
BEGI
INX
CPX
BNE
JMP
LDA
BEGI
CMP
BCS
LDA
CMP
BCS
LDA
STA
LDA
CMP
BEG!
CMP
BEG!
JMP
LDA
.49DB
.AEFD
.AD8A
.B7F7
.14
.49DD
S15
.49DE
.AEFD
.AD8A
SB7F7
.15
.494C
.14
"9DC
.494F
SB248
...99
.49DC
.49DF,X
.4961
...94
.4954
.494C
.49DA
S494C
...94
S494C
S49DB
... 19
.494C
.49DB
.D418
.49DA
...JiH
.4985
...92
.49A2
.49BF
.49DC
4088
408B
408D
4099
4093
4096
4099
409C
409F
40A2
40A5
40A8
40AA
40AD
40B9
40B3
40B6
4089
40BC
40BF
40C2
40C5
40C7
40CA
40CD
40D9
40D3
40D6
40D9
8D
A9
8D
8D
AD
8D
AD
8D
4C
AD
8D
A9
8D
8D
AD
8D
AD
8D
4C
AD
8D
A9
8D
8D
AD
8D
AD
8D
68
04
89
95
96
DD
99
DE
91
D9
DC
9B
89
8C
8D
DD
87
DE
88
D9
DC
12
88
13
14
DD
8E
DE
9F
D4
D4
D4
49
D4
40
D4
49
49
D4
D4
D4
49
D4
48
D4
48
48
D4
D4
D4
49
D4
48
D4
STA
LDA
STA
STA
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
STA
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
STA
LDA
STA
LDA
STA
RTS
.D404
...89
.D405
.D406
.49DD
.D499
.49DE
.D491
.40D9
.40DC
.D40B
...89
SD40C
.D49D
.49DD
SD497
.48DE
.D408
.48D9
.48DC
SD412
...80
.D413
.D414
.48DD
.D48E
.40DE
.D49F
.:49DA 80 90 09 99 99 11 21 41
.:49E2 81 99 BE 89 89 98 F8 09
121
28. Envelope
This routine is similair to Sound (above) but it allows you to set
the attack, decay, sustain and release as well.
Attack, decay, sustain and release are all betwen 0 and 15.
The syntax is SYS 16384, voice, volume, waveform, frequency,
attack, decay, sustain, release.
.OPT P,OO
.4888
*=
; ENVELOPE FUNCTION
;
128:
138:
14fJ:
1~8:
168:
178:
18fJ:
198:
2fJfJ:
218:
22fJ:
23fJ:
24fJ:
122
4fJ8fJ 28
4883 A~
488~ D8
4887 A~
48fJ9 8D
48fJC 28
4fJfJF A5
4811 D8
4813 A5
4fJ15 8D
4818 2fJ
4fJ1B A5
4fJ1D DfJ
24 41
1~
6D
14
2E
24
15
61
14
2F
24
15
55
41
41
41
41
; SYNTAX
;
;SYS16384,VOICE,VOLUME,
;WAVE,FREQ,A,D,S,R
JSR GETPARAM
LDA $1~
BNE IQERR
LDA $14
STA VOICE
JSR GETPARAM
LDA $15
BNE IG/ERR
LDA .14
STA VOLUME
JSR GETPARAM
LDA $15
BNE IG/ERR
250:
260:
270:
280:
290:
300:
310:
320:
330:
340:
350:
360:
370:
380:
390:
408:
410:
420:
430:
448:
430:
401F
4021
4024
4027
4029
402C
402E
4031
4034
4036
4038
403A
403C
403E
4041
4044
4046
4048
404A
404C
404E
A3
8D
20
A3
8D
A5
8D
20
A3
D0
A5
C9
B0
8D
20
A3
D8
A3
C9
B0
8D
14
30
24
14
31
15
32
24
15
3C
14
10
36
33
24
13
2C
14
10
26
34
470:
480:
490:
580:
318:
328:
330:
4051
4034
4036
4038
403A
403C
403E
330:
360:
370:
580:
398:
608:
610:
4061
4064
4066
4068
406A
406C
406E
630:
4071 4C 77 40
41
LDA
STA
JSR
LDA
STA
LDA
STA
JSR
LDA
BNE
LDA
CMP
BCS
STA
JSR
LDA
BNE
LDA
CMP
BCS
STA
$14
WAVE
GETPARAM
$14
FREQ
S15
FREQ+1
GETPARAM
$13
IQERR
$14
tH6
IQERR
ATTACK
GETPARAM
S13
IQERR
S14
tH6
IQERR
DECAY
20
A3
D0
A3
C9
B8
8D
24 41
13
1C
14
10
16
33 41
JSR
LDA
BNE
LDA
CMP
BCS
STA
GETPARAM
.13
IQERR
$14
.. 16
I6'lERR
SUSTAIN
20
A5
D0
A3
C9
B8
8D
24 41
13
0C
14
10
86
36 41
JSR
LDA
BNE
LDA
CMP
BCS
STA
GETPARAM
.13
I6'lERR
$14
.. 16
I6'lERR
RELEASE
JMP
DO
JMP
SB248
41
41
41
41
41
41
41
630:
4074 4C 48 B2 IQERR
123
671:
681:
691:
711:
4177
4B7A
407C
407E
AD
C9
B0
8D
2F 41 DO
U,
F6
18 D4
LDA
CMP
BCS
STA
VOLUME
.. 16
IG!ERR
54296
;CALCULATE ADSR
740:
751:
760:
770:
780:
790:
801:
810:
4081
4084
4085
4086
4087
4088
4089
408C
AD 34 41
4A
4A
4A
4A
18
6D 33 41
8D 37 41
LDA
LSR
LSR
LSR
LSR
CLC
ADC
STA
DECAY
A
A
A
A
831:
841:
851:
860:
870:
880:
891:
900:
408F
4092
4093
4094
4095
4096
4097
409A
AD 36 41
4A
4A
4A
4A
18
6D 35 41
8D 38 41
LDA
LSR
LSR
LSR
LSR
CLC
ADC
STA
RELEASE
A
A
A
A
921:
930:
941:
951:
960:
960:
970:
980:
409D
409F
40A2
40A5
40A7
40A8
40AA
40AC
A2
AD
DD
F0
E8
E0
D0
4C
00
30 41
39 41 LOOP
08
04
F6
48 B2 IG!ERRl
LDX
LDA
CMP
BEG!
INX
CPX
BNE
JMP
.. 4
LOOP
$B248 ; I G!ERR
1010:
1010:
1920:
1030:
40AF
40B2
40B4
40B6
AD
F0
C9
B0
2E 41 MORE
F8
04
F4
LDA
BEG!
CMP
BCS
VOICE
IG!ERRl
.. 4
IG!ERRl
1050:
40B8 C9 01
CMP
.. 1
124
ATTACK
AD
SUSTAIN
SR
.. 0
WAVE
WAVETABLE,X
MORE
1060:
1070:
1080:
1090:
40BA
40BC
40BE
40C0
F0
C9
F0
4C
07
02
24
05 41
BEGI
CMP
BEGI
JMP
VOICEl
.. 2
VOICE2
VOICE3
1120:
1130:
1140:
1150:
1160:
1170:
1180:
1190:
1200:
1210:
1220:
40C3
40C6
40C9
40CC
40CF
40D2
40D5
40D8
40DB
40DE
40El
AD
8D
AD
8D
AD
8D
AD
8D
AD
8D
4C
30
04
37
05
38
06
31
00
32
01
23
41 VOICEl
D4
41
D4
41
D4
41
D4
41
D4
41
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JMP
WAVE
54276
AD
54277
SR
54278
FREGI
54272
FREGI+l
54273
FINISH
1240:
1250:
1260:
1270:
1280:
1290:
1300:
1310:
1320:
1330:
1340:
40E4
40E7
40EA
40ED
40F0
40F3
40F6
40F9
40FC
40FF
4102
AD
8D
AD
8D
AD
8D
AD
8D
AD
8D
4C
30
0B
37
0C
38
0D
31
07
32
08
23
41 VOICE2
D4
41
D4
41
D4
41
D4
41
D4
41
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JMP
WAVE
54283
AD
54284
SR
54285
FREGI
54279
FREGI+l
54280
FINISH
1360:
1370:
1380:
1390:
1400:
1410:
1420:
1430:
1440:
1450:
4105
4108
410B
410E
4111
4114
4117
411A
411D
4120
AD
8D
AD
8D
AD
8D
AD
8D
AD
8D
30
12
37
13
38
14
31
0E
32
0F
41 VOICE3
D4
41
D4
41
D4
41
D4
41
D4
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
WAVE
54290
AD
54291
SR
54292
FREGI
54286
FREGI+l
54287
125
4123
4124
4127
412A
412D
412E
412F
413S
155~:
156S: 4131
157S: 4133
158S: 4134
159S: 4135
16S": 4136
161S: 4137
162S: 4138
163S: 4139
J4SSS-413D
148S:
149S:
lSSS:
lSlS:
152S:
153S:
154S:
6S
2S
2S
2S
6S
SS
SS
SS
SS
SS
"S
SS
SS
SS
FD
8A
F7
SS
""11 21
FINISH
RTS
AE GETPARAM JSR $AEFD
AD
JSR $AD8A
B7
JSR $B7F7
RTS
VOICE
.BYT S
VOLUME
.BYT S
WAVE
.BYT S
FRE61
WORD"
ATTACK
.BYT "
DECAY
.BYT
SUSTAIN .BYT
RELEASE .BYT
AD
.BYT
SR
.BYT
41 WAVETABLE.BYT 17,33,65,129
""
""
"
READY.
B*
PC SR AC XR YR SP
.197FE 72 SS "S S1 F6
4SSS
4"S3
4SS5
4SS7
4S"9
4SSC
4S"F
4S11
4S13
4S15
4S18
126
24
15
6D
14
2E
24
15
61
A5 14
8D 2F
2S 24
2S
A5
DS
A5
8D
2"
A5
41
41
41
D"
41
41
JSR
LDA
BNE
LDA
STA
JSR
LDA
BNE
LDA
STA
JSR
$4124
.15
.4874
.14
$412E
$4124
$15
$4874
$14
$412F
.4124
401B
401D
401F
4021
4024
4027
4029
402C
402E
4031
4034
4036
4038
403A
403C
403E
4041
4044
4046
4048
404A
404C
404E
4051
4054
4056
4058
405A
405C
405E
4061
4064
4066
4068
406A
406C
406E
4071
4074
4077
407A
A5
D0
A5
8D
20
A5
8D
A5
8D
20
A5
D0
A5
C9
B0
8D
20
A5
D0
A5
C9
B0
8D
20
A5
D0
A5
C9
B0
8D
20
A5
D0
A5
C9
B0
8D
4C
4C
AD
C9
15
55
14
30
24
14
31
15
32
24
15
3C
14
10
36
33
24
15
2C
14
10
26
34
24
15
1C
14
10
16
35
24
15
0C
14
10
06
36
77
48
2F
10
41
41
41
41
41
41
41
41
41
41
41
41
40
B2
41
LDA
BNE
LDA
STA
.JSR
LDA
STA
LDA
STA
.JSR
LDA
BNE
LDA
CMP
BCS
STA
.JSR
LDA
BNE
LDA
CMP
BCS
STA
.JSR
LDA
BNE
LDA
CMP
BCS
STA
.JSR
LDA
BNE
LDA
CMP
BCS
STA
.JMP
.JMP
LDA
CMP
$15
$4074
$14
$4130
$4124
$14
$4131
$15
$4132
$4124
$15
$4074
$14
"$10
$4074
$4133
$4124
$15
$4074
$14
"$10
$4074
$4134
$4124
$15
$4074
$14
"$10
.4074
$4135
$4124
.15
$4074
$14
"$10
$4074
.4136
.4077
SB248
$412F
... 10
127
4.07C
4.07E
4.081
4.084
4.0B~
4.086
4.087
4.088
4.089
4.08C
4.08F
4.092
4.093
4.094
4.09~
4.096
4.097
4.09A
4.09D
4.09F
4.0A2
4.0A3
4.0A7
4.0A8
4.0AA
4.0AC
4.0AF
4.0B2
4.0B4
4.0B6
4.0B8
4.0BA
4.0BC
4.0BE
4.0C.0
4.0C3
4.0C6
4.0C9
4.0CC
4.0CF
4.0D2
128
B.0
BD
AD
4A
4A
4A
4A
18
6D
8D
AD
4A
4A
4A
4A
18
6D
8D
A2
AD
DD
F.0
E8
E.0
D.0
4C
AD
F.0
C9
B.0
C9
F.0
C9
F.0
4C
AD
8D
AD
8D
AD
8D
F6
1B D4
34 41
33 41
37 41
36 41
35
38
.0.0
3.0
39
.08
41
41
41
41
.04
F6
48 B2
2E 41
F8
.04
F4
.01
.07
.02
24
.0~ 41
3.0 41
.04 D4
37 41
.05 D4
38 41
.06 D4
BCS
STA
LDA
LSR
LSR
LSR
LSR
CLC
ADC
STA
LDA
LSR
LSR
LSR
LSR
CLC
ADC
STA
LDX
LDA
CMP
BEQ
INX
CPX
BNE
JMP
LDA
BEQ
CMP
BCS
CMP
BEQ
CMP
BEQ
JMP
LDA
STA
LDA
STA
LDA
STA
$4.074
$D41B
$4134
$4133
$4137
$4136
$413~
$4138
"$.0.0
$413.0
$4139,X
$4.0AF
"$.04
$4.0A2
$B248
$412E
$4.0AC
....04
.4.0AC
"$.01
.4.0C3
"$.02
$4.0E4
$41.05
$413.0
$D4.04
$4137
$D4.05
$4138
$D4.06
4"D5
4"D8
4"DB
4.0DE
4"E1
4"E4
4"E7
4"EA
4"ED
4"F"
4.0F3
4.0F6
4"F9
4.0FC
4"FF
41"2
41"5
41"8
41"B
41"E
4111
4114
4117
411A
411D
412"
4123
4124
4127
412A
412D
AD
8D
AD
8D
4C
AD
8D
AD
8D
AD
8D
AD
8D
AD
8D
4C
AD
8D
AD
8D
AD
8D
AD
8D
AD
8D
60
2"
2"
2"
6"
31 41
D4
32 41
"1 D4
23 41
3" 41
"B D4
37 41
"C D4
38 41
"D D4
31 41
"7 D4
32 41
"8 D4
23 41
3" 41
12 D4
37 41
13 D4
38 41
14 D4
31 41
"E D4
32 41
"F D4
""
FD AE
SA AD
F7 B7
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
RTS
JSR
JSR
JSR
RTS
$4131
$D4.0"
$4132
$D4.01
$4123
S413"
SD4"B
S4137
$D4"C
$4138
$D4.0D
$4131
$D4.07
$4132
$D4"8
S4123
$413"
$D412
$4137
$D413
$4138
$D414
$4131
$D4.0E
$4132
$D4"F
$AEFD
$AD8A
$B7F7
129
29. DIR
This routine allows you to read the disk directory (of either or
both drives on a dual drive (not two 1541s)). It does not disturb
the program in memory.
The syntax is SYS 16384,drive
where drive is 0 or 1, or 2 if both drives are to be read.
2(1(1:
22(1:
23":
24":
130
3FFD 4C 48 B2 IGlERR
;DIR
4"(1(1 2(1 FD AE
4""3 2" 9E B7
4"(16 SA
JMP
SYNTAX
JSR
JSR
TXA
$B248
SYS 16384
$AEFD
$B79E
259:
269:
279:
279:
289:
299:
399:
319:
329:
339:
349:
4997
4999
499B
499D
499F
4911
4913
4915
4917
4919
491B
C9
B9
C9
F9
C9
D9
A9
85
A9
85
4C
93
F2
99
9F
91
16
31
FC
92
FD
2D 48
CMP
BCS
CMP
BEGI
CMP
BNE
LDA
STA
LDA
STA
JMP
tt3
IGiERR
tt9
ZERO
ttl
BOTH
tt"l"
.FC
tt2
FNLEN
DIR
369:
379:
389:
399:
499:
419:
429:
A9
85
A9
85
4C
A9
85
ZERO
39
FC
92
FD
2D 48
91
BOTH
FD
LDA
STA
LDA
STA
JMP
LDA
STA
*tt"9
4311:
491E
491E
4929
4922
4924
4926
4929
482B
.FC
tt2
FNLEN
DIR
ttl
FNLEN
458:
469:
479:
489:
499:
599:
519:
529:
539:
549:
559:
569:
579:
589:
599:
699:
619:
629:
639:
649:
492D
492F
4931
4933
4935
4937
4839
493B
483D
493F
4941
4943
4945
4847
4849
494C
494E
4951
4853
4856
A9
85
A9
85
A9
85
A9
85
A5
85
A9
85
A9
85
29
A5
29
A5
28
A4
99
DIR
99
24
FB
FB
BB
89
BC
FD
B7
98
BA
69
B9
D5 F3
BA
B4 FF
B9
96 FF
99
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JSR
LDA
JSR
LDA
JSR
LDY
tt9
ST
tt"s
TEMP
tt<TEMP
FNADD
tt>TEMP
FNADD+l
FNLEN
FNLENGTH
tt8
DEVNUM
tt.69
SECADR
SENDFNAM
DEVNUM
IECTALK
SECADR
SEND SEC
ST
131
6~":
66":
67":
68":
69":
7"":
71":
72":
73":
74":
4"58
4"5A
485C
485E
4861
4"63
D"
A"
84
2"
A6
3D
"6
FB
A5 FF
FC
8~ FC
486~ A4 9"
4"67 D" 2E
4"69 A4 FB
4"6B 88
7~":
4"6C D" EE
486E A4 FC
768:
77":
487" 2" CD BD
788:
4873 A9 2"
487~ 2" D2 FF
79":
4878 2" A3 FF
8"":
487B A6 9"
81":
487D D" 18
828:
487F AA
83":
84":
4"8" F" "6
4882 2" D2 FF
8~":
4883 4C 78 4"
86":
87":
4"88 A9 "D
88":
4"8A 2" D2 FF
89":
4"8D A3 C3
488F C9 3F
9"":
4891 F" "4
9"":
91":
4"93 A" "4
4"9~ D8 C3
92":
93":
4"97 2" 42 F6
948:
489A 6"
l3FFD-4"9B
READY.
132
DLISTl
DLIST3
DLIST2
DLIST4
BNE
LDY
STY
JSR
LDX
STA
LDY
BNE
LDY
DEY
BNE
LDY
JSR
LDA
JSR
JSR
LDX
BNE
TAX
BE61
JSR
JMP
LDA
JSR
LDA
CMP
BE61
LDY
BNE
JSR
RTS
DLIST4
#6
TEMP
IECINP
TEMP+l
TEMP+l
ST
DLIST4
TEMP
DLISTl
TEMP+l
LINENO
#.2"
PRINT
IECINP
ST
DLIST4
DLIST2
PRINT
DLIST3
#CR
PRINT
.C~
#63
DLIST4
#4
DLISTl
CLOSEFIL
B*
PC SR AC XR YR SP
; 9'FE '2 fIIfII fIIfII fill F6
4f11f11f11
4f11f113
4f11f116
4f11f11'
4f11f119
4f11f11B
4f11f11D
4f11f11F
4f1111
4f1113
4f11H5
4f111'
4f1119
4f111B
4f111E
4f112f11
4f1122
4f1124
4f1126
4f1129
4f112B
4f112D
4f112F
4f1131
4f1133
4f1135
4f113'
4f1139
4f113B
4f113D
4163F
2f11 FD AE
2f11 9E B'
8A
C9
BfII
C9
FfII
C9
DfII
A9
85
A9
85
4C
A9
85
A9
85
4C
A9
85
A9
85
A9
85
A9
85
A9
85
A5
85
A9
85
A9
85
f113
F2
fIIfII
fIIF
fill
16
31
FC
f112
FD
2D 4f11
3f11
FC
f112
FD
2D 4f11
fill
FD
16f11
9f11
24
FB
FB
BB
16f11
BC
FD
B'
168
4f1141
41643
BA
41645
616
B9
4164'
4f1149 216 D5 F3
4f114C A5 BA
JSR
JSR
TXA
CMP
BCS
CMP
BEQ
CMP
BNE
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
JSR
LDA
.AEFD
.B'9E
...fII3
.3FFD
...fIIfII
.4f111E
...flll
.4f1129
...31
.FC
...fII2
.FD
.482D
...3f11
.FC
...fII2
.FD
.4f112D
...flll
.FD
...fIIfII
.9f11
...24
.FB
...FB
.BB
...1616
.BC
.FD
.B'
...fII8
.BA
...616
SB9
.F3D5
.BA
133
404E
4051
4053
4056
4058
405A
4/15C
4/15E
4/161
4063
4/165
4067
4069
406B
4/16C
406E
4070
4073
4075
4/178
4/17B
407D
407F
4/180
4/182
4/185
4/188
408A
4/18D
4/18F
4/191
4093
4095
4097
409A
134
20
A5
20
A4
D0
A0
84
2/1
A6
85
A4
D/I
A4
88
D0
A4
20
A9
2/1
20
A6
D0
AA
F0
20
4C
A9
20
A5
C9
F/I
A0
D0
20
60
B4 FF
B9
96 FF
90
3D
06
FB
A5 FF
FC
FC
90
2E
FB
EE
FC
CD BD
2/1
D2 FF
A5 FF
90
18
06
D2
78
0D
D2
C5
3F
04
04
C5
42
FF
4/1
FF
F6
JSR
LDA
JSR
LDY
ENE
LDY
STY
JSR
LDX
STA
LDY
ENE
LDY
DEY
ENE
LDY
JSR
LDA
JSR
JSR
LDX
BNE
TAX
BEG!
JSR
JMP
LDA
JSR
LDA
CMP
BEG!
LDY
BNE
JSR
RTS
$FFB4
$B9
$FF96
$90
$4097
"$06
.FB
.FFA5
.FC
.FC
.9/1
.4097
.FB
.405C
.FC
.BDCD
...2/1
$FFD2
.FFA5
$90
$4097
.4088
.FFD2
$4078
"$0D
.FFD2
.C5
...3F
.4097
...04
.405C
.F642
30. MSAVE
The following routine allows you save any specified area of
memory. You specify the filename, the device, the secondary
address, the start address and the finishing address + 1.
The syntax is as follows:
SV.S 16384," name" ,device, 1,start, finish + 1
60:
70:
80:
90:
100:
110:
120:
130:
140:
150:
160:
170:
180:
190:
200:
210:
220:
4000
4S03
4S06
4009
400C
400F
4011
4012
4S14
4015
4S18
401B
4S1E
4020
4022
4S23
4025
4S26
20
20
20
20
20
A~
FD
D4
FD
8A
F7
14
AE
El
AE
AD
B7
48
A~
48
20
20
20
A6
A4
68
85
68
85
15
FD AE
8A AD
F7 B7
14
H5
FC
FB
.OPT P,OO
.4000
*=
JSR
JSR
JSR
JSR
JSR
LDA
PHA
LDA
PHA
JSR
JSR
JSR
LDX
LDY
PLA
STA
PLA
STA
.AEFD
SEID4
SAEFD
.AD8A
.B7F7
.14
.15
SAEFD
.AD8A
SB7F7
.14
.15
.FC
SFB
135
230:
4028 A9 FB
240:
402A 4C ~F E1
] 4000-482D
LDA
JMP
READY.
B*
PC SR AC XR YR SP
.19'FE '2 fIfI fIfI fll F6
400f1
4f1f13
4f1S6
416169
4f1f1C
40f1F
41611
4f112
4014
4f11~
41618
4f11B
4S1E
416216
4022
4f123
4S2~
20
216
20
216
216
A~
FD
D4
FD
8A
F'
14
AE
E1
AE
AD
B'
48
A~
1~
48
216
20
20
A6
A4
68
FD AE
8A AD
F' B'
14
13
8~
FC
68
4f126 8~ FB
4028 A9 FB
4f12A 4C ~F E1
136
JSR
JSR
JSR
JSR
JSR
LDA
PHA
LDA
PHA
JSR
JSR
JSR
LDX
LDY
PLA
STA
PLA
STA
LDA
JMP
SAEFD
SE1D4
SAEFD
SAD8A
SB'F'
S14
Sl~
SAEFD
SAD8A
SB'F'
S14
Sl~
SFC
SFB
..SFB
SE1~F
..SFB
SE1~F
31. MLOAD/MVERIFY
The following routine allows you to load or verify to or from a
specified area of memory. The load enables you to load into any
area of memory, whether it was saved from that area or not.
The verify allows you to verify a specific area of memory.
The syntax for M LOAD is as follows:
SYS 16394,"name",device, 1,start address
The syntax for MVERIFY is as follows:
SYS 16384,"name",device,1,start
BRAD TEMPLETON
28 FD
A9 81
8~ 8A
4C 11
2" FD
A9 8"
8S 8A
2" D4
2" FD
2" 8A
2" F7
A5 "A
A6 14
A4 15
4C 75
AE MVERIFY
4"
AE MLOAD
El LO
AE
AD
B7
El
.OPT P,OO
S4"""
JSR SAEFD
'.
LDA 11
STA SA
JMP LO
JSR SAEFD
LDA
STA SA
JSR SEID4
JSR SAEFD
JSR SAD8A
JSR SB7F7
LDA SA
LDX S14
LDY S15
JMP SE175
*=
I"
READY.
137
B*
PC SR AC XR YR SP
.197FE 72 00 00 01 F6
4000
4003
4005
4007
4B0A
40BD
40BF
4B11
4014
4017
401A
401D
4B1F
4B21
4B23
138
20
A9
85
4C
20
A9
85
20
2B
20
2B
A5
A6
A4
4C
FD AE
01
0A
11 40
FD AE
B0
BA
D4 El
FD AE
8A AD
F7 B7
0A
14
15
75 El
JSR
LDA
STA
JMP
JSR
LDA
STA
JSR
JSR
JSR
JSR
LDA
LDX
LDY
JMP
$AEFD
"$01
$0A
S4011
$AEFD
"$0B
SBA
$EID4
SAEFD
SAD8A
$B7F7
S0A
$14
$15
$E175
32. Disk
This routine allows you to send a command to the command
channel of the disk drive, e.g. initialise or format.
It replaces the following in Basic:
OPEN15,8,15,"COMMAND"
The syntax is as follows:
SYS 16384,"command"
4"""
4""3
4""5
4""8
4""B
4""E
4"1"
4,:112
2"
A9
2"
2"
2"
B"
A9
2"
FD AE
"F
C3 FF
16 4"
ce FF
1A
"F
C3 FF
JSR
LDA
J.SR
JSR
JSR
BCS
LDA
JSR
SAEFD
tU5
CLOSE
GETFPAR
OPEN
ERROR
tU5
CLOSE
139
220:
4015 60
RTS
I
240:
4016
4018
250:
401B
260:
401D
270:
280:
401E
290:
4020
300:
4023
4026
310:
320:
4029
330:
402A
l4000-402D
A9
20
A9
A8
A2
20
20
20
60
4C
a0
GETFPAR
BD FF
0F
a8
BA FF
a6 E2
S7 E2
F9 E0 ERROR
LDA
JSR
LDA
TAY
LDX
JSR
JSR
JSR
RTS
JMP
READY.
B*
PC SR AC XR YR SP
; 97FE 72 00 00 01 F6
4000
4003
4005
4008
400B
400E
4010
4012
4015
4016
4018
401B
401D
401E
4020
4023
4026
4029
402A
140
20
A9
20
20
20
B0
A9
20
60
A9
20
A9
A8
A2
20
20
20
60
4C
FD
0F
C3
16
C0
1A
0F
C3
AE
FF
40
FF
FF
00
BD FF
0F
08
BA FF
06 E2
57 E2
F9 E0
JSR
LDA
JSR
JSR
JSR
BCS
LDA
JSR
RTS
LDA
JSR
LDA
TAY
LDX
JSR
JSR
JSR
RTS
JMP
SAEFD
..S0F
SFFC3
.4016
SFFC0
.402A
...0F
SFFC3
.. S00
SFFBD
...0F
...08
SFFBA
SE206
SE2S7
SE0F9
.. 0
SETFNA
fUS
.. 8
SETFPA
NEXTGI
GETNAME
GIVERR
33. DERROR
This routine allows you to read the disk error channel in direct
mode or during a program.
It replaces the following BASIC program:
10
20
30
40
OPEN15,8,15
INPUT # 15,A$,B$,C$,O$,E$
PRINT A$;B$;C$;O$;E$
CLOSE15
.OPT P,OO
*= 54000
$90
=
SBA
SB9
=
5FFB4
SFF96
=
..
=
=
5FFA~
SFFD2
SFFAB
;DERROR COMMAND
J
150:
160:
170:
180:
190:
200:
41600
41602
41604
41606
41608
4160B
A9
85
A9
85
20
A9
00
90
08
BA
B4 FF
6F
LDA
STA
LDA
STA
JSR
LDA
#0
ST
#8
DEVNUM
IECTALK
#S6F
141
4BBD
2UJ:
4BBF
22B:
4B12
23B:
4B14
24B:
4B16
25B:
4B19
26B:
4B1C
27B:
4B1E
28B:
4B2B
29B:
4B23
3BB:
]4BBB-4024
85
2B
A4
DB
2B
2B
C9
DB
2B
6B
B9
96
9B
BA
A5
D2
BD
F2
AB
FF
LOOP
FF
FF
FF DERR4
STA
JSR
LDY
BNE
JSR
JSR
CMP
BNE
JSR
RTS
READY.
B*
PC SR AC XR YR SP
; 97FE 72 BB BB B1 F6
4BBB
4BB2
4BB4
4""6
4BB8
4"BB
4"BD
4"BF
4B12
4B14
4B16
4B19
4B1C
4B1E
4B2B
4B23
142
A9
85
A9
85
2"
A9
85
2"
A4
DB
2B
2B
C9
DB
2B
6B
BB
9B
B8
BA
B4
6F
B9
96
9B
BA
A5
D2
"D
F2
AB
FF
FF
FF
FF
FF
LDA
STA
LDA
STA
JSR
LDA
STA
JSR
LDY
BNE
JSR
JSR
CMP
BNE
JSR
RTS
ISBB
S9B
ISB8
SBA
SFFB4
IS6F
SB9
SFF96
S9B
S4B2"
SFFA5
SFFD2
IS"D
54B12
SFFAB
SECADR
SEND SEC
ST
DERR4
IECINP
PRINT
113
LOOP
UNTALK
2m:
3":
4m""
4m""
.OPT P,OO
*= $4"""
5":
4""" 2" FD AE
JSR
$AEFD
6":
4""3 2" 8A AD
JSR
$AD8A
7":
4m"6
JSR
$B7F7
90:
4m"9 A5 14
4""B 85 FB
LDA
STA
$14
$FB
1m,,:
2" F7 B7
143
400D 8D 96 40
STA
TEMPF
4010 A5 15
4012 85 FC
4014 8D 97 40
LDA
STA
STA
S15
SFC
TEMPF
140:
4017 20 FD AE
JSR
SAEFD
150:
401A 20 9E B7
JSR
SB79E
160:
170:
180:
ER
190:
401D 8A
401E 8D 95 40
4021 8D 94 40
TXA
STA
STA
TEMP
COUNT
4024 20 FD AE
JSR
SAEFD
200:
4027 20 9E B7
JSR
SB79E
210:
R
402A 8E 98 40
STX
COLOU
230:
240:
N
250:
260:
N
270:
280:
290:
402D 78
402E A9 3A
SEI
LDA
.. <MAl
4030 8D 14 03
4033 A9 40
STA
LDA
788
.. >MAI
4035 8D 15 03
4038 58
4039 60
STA
CLI
RTS
789
320:
ER
330:
403A CE 94 40 MAIN
DEC
COUNT
403D D0 38
BNE
FINIS
403F AD 95 40
4042 8D 94 40
LDA
STA
TEMP
COUNT
100:
B
110:
120:
120:
C
350:
360:
ER
144
4045
37~:
4047
380:
X
404A
390:
X
404D
400:
54272,X
410:
4050
54272,X
4053
420:
4054
430:
4056
440:
A2 00
BD 99 07 LOOP
LDX
LDA
#0
1945,
9D 98 07
STA
1944,
BD 99 DB
LDA
1945+
9D 98 DB
STA
1944+
E8
E0 27
D0 EF
INX
CPX
BNE
#39
LOOP
460:
470:
,Y
480:
481 :
4058 A0 00
405A B1 FB
LDY
LDA
#0
($FB)
405C C9 3F
405E B0 03
CMP
BCS
#63
SUBTR
482:
4060 4C 66 40
JMP
PUTON
483:
484:
500:
510:
MENT
520:
530:
540:
550:
R
560:
54272
4063
4064
4066
4069
38
SUBTR
E9 40
8D BF 07 PUTON
20 7A 40
SEC
SBC
STA
JSR
#64
1983
INCRE
406C
406E
406F
4071
A5 FC
18
69 D4
AD 98 40
LDA
CLC
ADC
LDA
$FC
4074 8D BF DB
STA
1983+
580:
4077 4C 31 EA FINISH
JMP
$EA31
590:
600:
407A E6 FB
407C D0 02
INCREMENTINC
BNE
$FB
CHECK
610:
407E E6 FC
INC
#212
COLOU
$FC
145
630:
640:
,Y
650:
660:
4080 A0 00
4082 B1 FB
670:
680:
B
690:
7.00:
C
710:
720:
730:
740:
750:
760:
77.0:
CHECK
LDY
LDA
H0
(SFB)
4084 C9 FF
4086 F0 01
CMP
BEG!
HSFF
RESET
4.088 60
4089 AD 96 40 RESET
RTS
LDA
TEMPF
4.08C 85 FB
4.08E AD 97 4.0
STA
LDA
.FB
TEMPF
STA
RTS
.BYT
.BYT
.BYT
.BYT
.BYT
.ASC
.FC
4091 85 FC
4.093 6.0
COUNTER
4.094 .0.0
TEMP
4095 00
TEMPFB
4096 .0.0
TEMPFC
4.097 0.0
COLOUR
4098 .00
4099 48 45 4C
7~0:
0 I AM A CBM 64 MICRO-"
40B3 43 4F 4D
790:
UTER AND I AM 64 "
40C8 FF
8.00:
J40.00-4.0C9
.ASC "COMP
.BYT .FF
B*
PC SR AC XR YR SP
; 97FE 72 .0.0 .0.0 40 F6
4.0.0.0
4.0.03
40.06
4.0.09
40.0B
4.0.0D
4.01.0
4.012
146
2.0
2.0
2.0
A5
85
8D
A5
85
FD
8A
F7
14
FB
96
15
FC
AE
AD
B7
40
JSR
JSR
JSR
LDA
STA
STA
LDA
STA
0
0
0
0
0
"HELL
.AEFD
$AD8A
.B7F7
.14
.FB
$4.096
515
SFC
4014
4017
401A
401D
401E
4021
4024
4027
402A
402D
422E
4032
4233
4035
4238
4039
423A
403D
423F
4042
4045
4247
404A
424D
4252
4053
4254
4256
4258
425A
425C
405E
4262
4063
4264
4266
4269
426C
426E
406F
4271
8D
20
20
8A
8D
8D
20
20
8E
78
A9
8D
A9
8D
58
62
CE
D2
AD
8D
A2
BD
9D
BD
9D
E8
E2
D2
A2
B1
C9
B2
4C
38
E9
8D
22
A5
18
69
AD
97 40
FD AE
9E B7
95
94
FD
9E
98
40
40
AE
B7
40
3A
14 23
42
15 23
94
38
95
94
22
99
98
99
98
40
40
40
27
27
DB
DB
27
EF
22
FB
3F
23
66 40
40
BF 27
7A 40
FC
D4
98 40
STA
JSR
JSR
TXA
STA
STA
JSR
JSR
STX
SEI
LDA
STA
LDA
STA
CLI
RTS
DEC
BNE
LDA
STA
LDX
LDA
STA
LDA
STA
INX
CPX
BNE
LDY
LDA
CMP
BCS
JMP
SEC
SBC
STA
JSR
LDA
CLC
ADC
LDA
$4097
$AEFD
$B79E
$4095
$4094
$AEFD
$B79E
$4098
"$3A
$2314
"$40
52315
$4094
54277
$4295
54294
"$00
$2799, X
$2798, X
5DB99,X
$DB98,X
"$27
$4047
"$20
($FB),Y
"$3F
54263
$4066
"$40
$27BF
$427A
$FC
"$D4
$4098
147
4S74
4S77
4S7A
4S7C
4S7E
4SSS
4SS2
4SS4
4SS6
4SSS
4SS9
4SSC
4SSE
4S91
4S93
SD
4C
E6
DS
E6
AS
B1
C9
FS
6S
AD
S5
AD
S5
6S
: 4S94
: 4S9C
: 4taA4
: 4SAC
: 4taB4
: 4SBC
: 4taC4
148
BF DB
31 EA
FB
S2
FC
SS
FB
FF
S1
STA
JMP
INC
BNE
INC
LDY
LDA
CMP
BEGl
RTS
LDA
STA
LDA
STA
RTS
96 4S
FB
97 4S
FC
SS
4C
41
2ta
4F
41
2ta
SS
4F
2ta
4D
4D
4E
36
SS
2S
43
49
5ta
44
34
Sta
49
42
43
55
2ta
2ta
$DBBF
$EA31
$FB
$4SSS
$FC
"$SS
(SFB),Y
... FF
$4SS9
flJta
2ta
4D
:52
:54
49
FF
$4S96
$FB
$4S97
$FC
4S
41
2ta
4F
45
2ta
AD
45
4D
36
2D
52
41
37
4C
2ta
34
43
2S
4D
41
5B:
7B:
8flJ:
9flJ:
9B:
9B:
IBB:
IB1:
IflJ2:
llB:
12flJ:
13flJ:
4BflJB
4BflJ3
4flJflJ6
4 flJflJ 9
4BflJB
4flJBD
4flJIB
4flJ12
4B15
4flJ18
4flJIB
4flJIE
2B
2B
2flJ
A5
FB
4C
A5
8D
2B
2B
2B
A5
FD
8A
F7
15
B3
48
14
8E
FD
8A
F7
15
AE
AD
B7
B2
4B
AE
AD
B7
.OPT P,OO
S4BBB
*=
SYSFLASH,COLOUR1,
COLOUR2,NO OF
CHANGES A SECOND
JSR SAEFD
JSR SAD8A
JSR SB7F7
LDA S15
BEG! MORE
JMP SB248
MORE
LDA S14
STA TEMP
JSR SAEFD
JSR SAD8A
JSR SB7F7
LDA S15
149
149:
159:
169:
179:
189:
199:
299:
219:
229:
239:
249:
249:
259:
259:
269:
279:
289:
299:
399:
319:
319:
329:
339:
349:
359:
369:
369:
379:
389:
399:
499:
499:
499:
419:
429:
439:
449:
449:
459:
46":
47":
150
4929
4922
4925
4927
492A
492D
4939
4933
4935
4937
493A
493C
493E
4941
4942
4944
4947
4949
494C
494D
4959
4953
4954
4954
4957
4959
495C
495E
4961
4963
4966
4969
4S6C
496F
4S72
4975
4978
497B
4"7E
4"81
4"82
F9
4C
A5
8D
29
29
29
A5
F9
4C
A5
F9
8D
78
A9
8D
A9
8D
58
AD
8D
69
93
48
14
8F
FD
8A
F7
15
93
48
14
43
99
CE
D9
AD
29
CD
F9
AD
8D
AD
8D
4C
AD
8D
AD
8D
4C
78
A9
91
25
21
9F
8F
9F
8F
21
9S
91
7E
8E
21
9S
91
31
B2
MOREl
49
AE
AD
B7
B2
MORE2
49
54
14 93
49
15 93
99 49
91 49
MAIN
31
49
DI
49
49
D9
4"
4"
49
49 D09
D9
49
4"
EA FINISH
RESET
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
BEG!
STA
SEI
LDA
STA
LDA
STA
CLI
LDA
STA
RTS
MOREl
$B248
$14
TEMP+l
$AEFD
$AD8A
$B7F7
$15
MORE2
$B248
$14
RESET
TEMP+2
*TEMP+3
DEC
BNE
LDA
AND
CMP
BEG!
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
JMP
SEI
LDA
I<MAIN
788
I>MAIN
789
TEMP+2
TEMP+3
FINISH
53281
115
TEMP+l
D09
TEMP+l
53281
TEMP+2
TEMP+3
FINISH
TEMP
53281
TEMP+2
TEMP+3
$EA31
149
48B:
4B84
49B:
4B87
5BB:
4B89
51B:
4B8C
52B:
4B8D
53B:
4"8E
14"BB-4B8E
8D 14 B3
A9 EA
8D 15 B3
58
6B
TEMP
STA
LDA
STA
CLI
RTS
788
.. 234
789
READY.
B*
PC SR AC XR YR SP
; 97FE 72 BB BB 4B F6
4"B"
4""3
4""6
4BB9
4BBB
4BBD
4B1"
4"12
4"15
4"18
4"1B
4"1E
4B2"
4B22
4B25
4"27
4B2A
4B2D
4B3B
4"33
4B35
4B37
2"
2"
2B
A5
FB
4C
A5
8D
2B
2B
2B
A5
FB
4C
A5
8D
2B
2B
2B
A5
FB
4C
FD
8A
F7
15
B3
48
14
8E
FD
8A
F7
15
"3
48
14
8F
FD
8A
F7
AE
AD
B7
B2
4"
AE
AD
B7
B2
4"
AE
AO
B7
15
"3
48 B2
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LOA
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LOA
BEG!
JMP
$AEFD
$AD8A
SB7F7
S15
S4B1B
SB248
S14
S4B8E
SAEFD
SAD8A
SB7F7
S15
S4B25
SB248
$14
S4"8F
SAEFD
SAD8A
SB7F7
.15
S4B3A
SB248
151
4"3A
4"3C
4"3E
4"41
4"42
4"44
4"47
4"49
4"4C
4"4D
4"5"
4"53
4"54
4"57
4"59
4"5C
4"5E
4"61
4"63
4"66
4"69
4"6C
4"6F
4"72
4"75
4"78
4"7B
4"7E
4"81
4"82
4"84
4"87
4"89
4"8C
4"8D
152
A5
F"
8D
78
A9
8D
A9
8D
58
AD
8D
6"
CE
D"
AD
29
CD
F"
AD
8D
AD
8D
4C
AD
8D
AD
8D
4C
78
A9
8D
A9
8D
58
6"
14
43
9" 4"
54
14 "3
4"
15 "3
9" 4"
91 4"
91
25
21
"F
8F
"F
8F
21
9"
91
7E
8E
21
9"
91
31
4"
D"
4"
4"
D"
4"
4"
4"
4"
D"
4"
4"
EA
31
14 "3
EA
15 "3
lDA
BEG!
STA
SEI
lDA
STA
lDA
STA
ClI
lDA
STA
RTS
DEC
BNE
lDA
AND
CMP
BEG!
lDA
STA
lDA
STA
JMP
lDA
STA
LDA
STA
JMP
SEI
LDA
STA
LDA
STA
ClI
RTS
514
54"81
54"9"
..554
5"314
"54"
5"315
54"9"
54"91
54"91
S4"7E
SD"21
"$"F
S4"8F
$4"72
$4"8F
SD"21
$4"9"
$4"91
S4"7E
$4"8E
$D"21
S4"9"
$4"91
$EA31
.. 531
5"314
..SEA
$"315
*=
153
160:
170:
180:
190:
200:
210:
220:
230:
240:
240:
250:
250:
260:
270:
280:
290:
300:
310=310:
320:
330:
340:
350:
360:
360:
370:
380:
390:
400:
400:
400:
410:
420:
430:
440:
440:
450:
460:
470:
480:
490:
154
4025
4027
402A
402D
4030
4033
4035
4037
403A
403C
403E
4041
4042
4044
4047
4049
404C
404D
4050
4053
4054
4054
4057
4059
405C
405E
4061
4063
4066
4069
406C
406F
4072
4075
4078
407B
407E
4081
4082
4084
4087
A5
8D
20
20
20
A5
F0
4C
A5
F0
8D
78
A9
8D
A9
8D
58
AD
8D
60
14
8F
FD
8A
F7
15
03
48
14
43
90
CE
D0
AD
29
CD
F0
AD
8D
AD
8D
4C
AD
8D
AD
8D
4C
78
A9
8D
A9
91
25
20
0F
8F
0F
8F
20
90
91
7E
8E
20
90
91
31
MOREl
40
AE
AD
B7
B2
MORE2
40
54
14 03
40
15 03
90 40
91 40
MAIN
40
D0
40
40
D0
40
40
40
40 D00
D0
40
40
EA FINISH
RESET
31
14 03
EA
LDA
STA
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
BEG!
STA
SEI
LDA
STA
LDA
STA
CLI
LDA
STA
RTS
S14
TEMP+l
SAEFD
SAD8A
SB7F7
S15
MORE2
SB248
S14
RESET
TEMP+2
*TEMP+3
DEC
BNE
LDA
AND
CMP
BEG!
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
JMP
SEI
LDA
STA
LDA
.. <MAIN
788
.. >MAIN
789
TEMP+2
TEMP+3
FINISH
53280
.. 15
TEMP+l
D00
TEMP+1
53280
TEMP+2
TEMP+3
FINISH
TEMP
53280
TEMP+2
TEMP+3
SEA31
.. 49
788
.. 234
588:
4889 8D 15 83
518:
488C 58
528:
488D 68
538:
488E
TEMP
l4888-488E
STA
CLI
RTS
789
READY.
B*
PC SR AC XR YR SP
; 97FE 72 88 88 4.9 F6
4888
4883
48.96
4889
488B
488D
4818
4812
4"15
4818
481B
481E
4828
4822
4825
4827
482A
482D
4838
4833
4835
4837
483A
483C
483E
28
28
28
A5
F8
4C
A5
8D
28
28
28
A5
F8
4C
A5
8D
28
28
28
A5
F8
4C
A5
F8
8D
FD
8A
F7
15
83
48
14
8E
FD
8A
F7
15
83
48
14
8F
FD
8A
F7
15
83
48
14
43
98
AE
AD
B7
B2
48
AE
AD
B7
B2
48
AE
AD
B7
B2
48
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
BEG!
STA
SAEFD
SAD8A
SB7F7
SH5
$4818
$B248
$14
S488E
SAEFD
$AD8A
$B7F7
$15
$4825
$B248
$14
$488F
$AEFD
$AD8A
$B7F7
$15
$483A
$B248
$14
S4881
S4898
155
4041
4042
4044
4047
4049
404C
404D
4050
4053
4054
4057
4059
405C
405E
4061
4063
4066
4069
406C
406F
4072
4075
4078
407B
407E
4081
4082
4084
4087
4089
408C
408D
156
78
A9
8D
A9
8D
58
AD
8D
60
CE
D0
AD
29
CD
F0
AD
8D
AD
8D
4C
AD
8D
AD
8D
4C
78
A9
8D
A9
8D
58
60
54
14 03
40
15 03
90 40
91 40
91
25
20
0F
8F
0F
8F
20
90
91
7E
8E
20
90
91
31
40
D0
40
40
D0
40
40
40
40
D0
40
40
EA
31
14 03
EA
15 03
SEI
LDA
STA
LDA
STA
CLI
LDA
STA
RTS
DEC
BNE
LDA
AND
CMP
BEG!
LDA
STA
LDA
STA
JMP
LDA
STA
LDA
STA
JMP
SEI
LDA
STA
LDA
STA
ell
RTS
"$54
$0314
"$40
$0315
$4090
$4091
$4091
$407E
$D020
"$0F
$408F
$4072
$408F
$D020
$4090
$4091
$407E
$408E
$D020
$4090
$4091
$EA31
"$31
$0314
"$EA
$0315
.OPT P,OO
$4000
*=
;SYNTAX FLASH 1 OR
;0
70:
4000 20 FD AE
JSR
$AEFD
80:
4003 20 8A AD
JSR
$AD8A
90:
4006 20 F7 B7
JSR
$B7F7
100:
110:
4009 AS 14
400B F0 13
LDA
BEG!
$14
RESET
120:
120:
1
130:
140:
400D 8D 67 40
4010 8D 68 40
STA
STA
TEMP
TEMP+
4013 78
4014 A9 2D
SEl
LDA
.. <MAl
157
150:
160:
N
170:
180:
190:
200:
220:
230:
240:
250:
260:
270:
290:
1
300:
3'10:
320:
330:
1
4016 8D 14 03
4019 A9 40
STA
LDA
788
H>MAI
401B
401E
401F
4020
4021
4023
4026
4028
402B
4.02C
4.02D
STA
CLI
RTS
SEI
LDA
STA
LDA
STA
CLI
RTS
DEC
789
TEMP+
4030 F0 03
4032 4C 31 EA
BEG!
JMP
MORE
$EA31
4035 AD 67 40 MORE
4.038 8D 68 40
LDA
STA
TEMP
TEMP+
8D
58
60
78
A9
8D
A9
8D
58
60
CE
15 03
RESET
31
14 03
EA
15 03
68 40 MAIN
H49
788
H234
789
; INVERT CHARACTERS
370:
380:
X
390:
400:
410:
X
403B A2 00
403D BD 00 04 LOOP
LDX
LDA
H0
1024,
4040 18
4041 69 80
4043 9D 00 04
CLC
ADC
STA
H128
1024,
430:
255,X
440:
450:
460:
255,X
4046 BD FF 04
LDA
1024+
4049 18
404A 69 80
404C 9D FF 04
CLC
ADC
STA
H128
1024+
404F BD FE 05
LDA
1024+
480:
158
255+255, X
4052 18
490:
4053 69 80
500:
4055 9D FE 05
510:
255+255, X
4058 BD
530:
255+255+255,X
405B 18
540:
405C 69
550:
405E 9D
560:
255+255+255,X
4061 E8
570:
580:
4062 D0
4064 4C
590:
CLC
ADC
STA
#128
1024+
FD 06
LDA
1024+
80
FD 06
CLC
ADC
STA
#128
1024+
D9
31 EA
INX
BNE
JMP
LOOP
SEA31
it-
TEMP
4067
600:
]4000-4067
READY.
B*
PC SR AC XR YR SP
.197FE 72 1616 f6flJ 416 F6
4flJflJf6
4f6flJ3
4flJflJ6
40flJ9
4f6flJB
4f6flJD
4flJlflJ
41613
41614
4flJ16
4flJ19
4flJIB
4flJIE
216
216
2flJ
A5
FflJ
8D
8D
78
A9
8D
A9
8D
58
FD
8A
F7
14
13
67
68
AE
AD
B7
4flJ
4flJ
2D
14 flJ3
4flJ
15 flJ3
JSR
JSR
JSR
LDA
BE6I
STA
STA
SEI
LDA
STA
LDA
STA
eLI
$AEFD
SAD8A
$B7F7
S14
S4flJ2flJ
S4flJ67
S4flJ68
#S2D
SflJ314
ttS4flJ
SflJ315
159
401F
40216
4021
4823
4826
4828
402B
402C
402D
48316
4032
4.033
4838
483B
483D
48416
4.041
4843
4.046
4.049
4.04A
484C
4.04F
4.052
4.053
4.035
4.038
4.03B
4.03C
4.03E
4.061
4.062
4.064
4867
160
616
78
A9
8D
A9
8D
38
616
CE
Ff6
4C
AD
8D
A2
BD
18
69
9D
BD
18
69
9D
BD
18
69
9D
BD
18
69
9D
E8
Df6
4C
216
31
14 163
EA
H5 163
68
163
31
67
68
1616
1616
416
EA
416
416
164
816
1616 164
FF 164
816
FF 164
FE 163
816
FE 163
FD 166
816
FD 166
D9
31 EA
Df6 AD
RTS
SEI
LDA
STA
LDA
STA
CLI
RTS
DEC
BEQ
JMP
LDA
STA
LDX
LDA
CLC
ADC
STA
LDA
CLC
ADC
STA
LDA
CLC
ADC
STA
LDA
CLC
ADC
STA
INX
BNE
JMP
JSR
"$31
$16314
"$EA
$16313
S4f668
S4f635
SEA31
S4f667
541668
...1616
Sf64f6f6,X
"$816
Sf64f6f6,X
$f64FF,X
...816
Sf64FF,X
Sf63FE,X
..S8f6
5f63FE,X
.f66FD, X
...816
Sf66FD, X
54f63D
.EA31
SADDf6
.OPT P,OO
S40"0
*=
; SYNTAX
SYSFLASH,COLOURI
,COLOUR2,NO OF
CHANGES A SECOND
80:
4000 20 FD AE
.JSR
SAEFD
90:
4003 20 8A AD
.JSR
SAD8A
100:
4006 20 F7 B7
.JSR
SB7F7
110:
110:
110:
4009 A5 15
400B F0 03
400D 4C 48 B2
LDA
BEQ
.JMP
S15
MORE
SB248
120:
130:
140:
4010 A5 14
MORE
4012 aD A5 40
4015 20 FD AE
LDA
STA
.JSR
S14
TEMP
SAEFD
161
15":
4"18 2" 8A AD
JSR
$AD8A
16":
4"lB 2" F7 B7
JSR
$B7F7
17":
18":
4"lE A5 15
4"2m F" m3
LDA
BEQ
$15
MOREl
19":
4m22 4C 48 B2
JMP
$B248
2"":
21":
1
22m:
4m25 A5 14
MOREl
4"27 8D A6 4"
LDA
STA
$14
TEMP+
4"2A 2m FD AE
JSR
$AEFD
23":
4m2D 2" 8A AD
JSR
$AD8A
24":
4m3m 2" F7 B7
JSR
$B7F7
25":
26":
4m33 A5 15
4m35 Fm "3
LDA
BEQ
$15
MORE2
27m:
4m37 4C 48 B2
JMP
$B248
28":
28":
4m3A A5 14
4m3C Fm 59
LDA
BEQ
$14
RESET
29m:
2
29":
3"":
4"3E 8D A7 4"
STA
TEMP+
4"41 78
4.042 A9 54
SEI
LDA
#<MAI
4.044 8D 14 m3
4.047 A9 4m
STA
LDA
788
#>MAI
4"49 8D 15 m3
4m4C 58
4.04D AD A7 4"
STA
CLI
LDA
789
4.05.0 8D A8 4"
STA
TEMP+
4.053 6.0
RTS
MORE2
31":
32.0:
N
33":
34.0:
35m:
2
35":
3
36":
162
TEMP+
370:
380:
3
390:
H
400:
4054
MAIN
4054 CE A8 40
DEC
*TEMP+
4057 D0 29
BNE
FINIS
4059 AD A4 40
LDA
STORE
410:
1
42":
405C CD A6 40
CMP
TEMP+
405F F0 12
BEG!
D00
4061 AD A6 40
LDA
TEMP+
4.064 8D A4 40
STA
STORE
4.067 20 85 40
4.06A AD A7 40
JSR
LDA
FILL
TEMP+
4.06D 8D A8 40
STA
TEMP+
4.070 4C 82 40
JMP
FINIS
510:
520:
4.073 AD A5 40 D00
4.076 8D A4 40
LDA
STA
TEMP
STORE
530:
540:
2
550:
3
4.079 20 85 40
4.07C AD A7 40
JSR
LDA
FILL
TEMP+
4.07F 8D A8 40
STA
TEMP+
570:
4082 4C 31 EA FINISH
JMP
$EA31
590:
600:
,X
610:
+255,X
620:
4S85 A2 00
FILL
4S87 9D 00 D8 LOOP
LDX
STA
tt0
55296
4S8A 9D FF D8
STA
55296
4S8D 9D FE D9
STA
55296
440:
1
450:
460:
470:
2
480:
3
490:
H
163
+255+255,X
4.09.0 9D FO OA
63.0:
+255+255+255,X
4.093 E8
64.0:
4.094 0.0 F1
65.0:
66.0:
4.096 6.0
4.097
69.0:
4.098
7.0.0:
4.09A
71.0:
4.09D
72.0:
4.09F
73.0:
4.0A2
74.0:
4.0A3
75.0:
76.0:
4.0A4
77.0:
4.0A5
14.0.0.0-4.0A5
78
A9
8D
A9
8D
58
6.0
.0.0
RESET
31
14 .03
EA
15 .03
STORE
TEMP
STA
55296
INX
BNE
RTS
LOOP
SEI
LDA
STA
LDA
STA
eLI
RTS
.BYT
=
READY.
B*
PC SR AC XR YR SP
,97FE 72 flJta flJta 4ta F6
4flJ.0flJ
4883
4886
4889
48flJB
488D
4818
4812
4815
4818
481B
481E
482ta
164
28
2flJ
2flJ
A5
F8
4C
A5
8D
28
28
28
A5
F8
FD
8A
F7
15
flJ3
48
14
A5
FD
8A
F7
15
83
AE
AD
B7
B2
48
AE
AD
B7
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
STA
JSR
JSR
JSR
LDA
BEG!
SAEFD
SAD8A
SB7F7
S15
S4.018
SB248
S14
S48A5
SAEFD
SAD8A
SB7F7
S15
S4825
#49
788
#234
789
.0
4022
4025
4027
402A
402D
4030
4033
4035
4037
403A
403C
403E
4041
4042
4044
4047
4049
404C
404D
4050
4053
4054
4057
4059
405C
405F
4061
4064
4067
406A
406D
4"70
4073
4076
4079
4"7C
407F
4"82
4085
4"87
4"8A
4C
A5
8D
20
20
20
A5
F0
4C
A5
F0
8D
78
A9
8D
A9
8D
58
AD
8D
6"
CE
D"
AD
CD
F0
AD
8D
20
AD
48
14
A6
FD
8A
F7
15
03
48
14
59
A7
B2
40
AE
AD
B7
B2
40
54
14 03
4"
15 03
A7 40
A8 40
A8
29
A4
A6
12
A6
A4
85
A7
A8
82
A5
A4
85
A7
A8
31
0"
40
4"
4"
4"
4"
40
40
40
4"
40
40
40
4"
40
EA
8D
4C
AD
8D
20
AD
8D
4C
A2
9D
D8
9D FF DB
""
JMP
LDA
STA
JSR
JSR
JSR
LDA
BEG!
JMP
LDA
BEG!
STA
SEI
LDA
STA
LDA
STA
CLI
LDA
STA
RTS
DEC
BNE
LDA
CMP
BEQ
LDA
STA
JSR
LDA
STA
JMP
LDA
STA
JSR
LDA
STA
JMP
LDX
STA
STA
.B248
514
.40A6
5AEFD
5AD8A
5B7F7
.15
.403A
.B248
514
.4097
.40A7
...54
50314
... 40
.0315
'4"A7
'4"A8
'4"A8
'4"82
'4"A4
'4"A6
.4073
.40A6
'4"A4
.4085
'4"A7
.40A8
'4"82
.40A5
.40A4
'4"85
.40A7
.40A8
5EA31
...,,"
5D8"",X
5D8FF,X
165
4B8D
4999
4B93
4994
4B96
4B97
4998
4B9A
499D
499F
49A2
49A3
49A4
166
9D
9D
E8
DB
69
78
A9
8D
A9
8D
58
6"
"B
FE D9
FD DA
F1
31
14 "3
EA
15 "3
STA
STA
INX
BNE
RTS
SEI
LDA
STA
LDA
STA
eLI
RTS
BRI<
$D9FE,X
$DAFD,X
$4B87
... 31
.9314
...EA
.B315
39. Print at
This routine allows you to print at any position on the screen
without using lots of cursor controls.
The syntax is as follows:
SYS960,X, Y, "text"
X is the column to start at and is between 0 and 39. Y is the
row to start at and is between 0 and 24. The text can be text
in quotes, strings, numbers, variables or any other legal print
statement.
6.0:
7.0:
8.0:
9.0:
1.0.0:
11.0:
12.0:
13.0:
14.0:
H5,0:
16.0:
17.0:
18.0:
19.0:
93C,0
,03C3
93C6
93C7
93C8
93CB
93CE
,03CF
93D,0
93Dl
93D2
93D3
93D6
.03D9
2.0
2.0
8A
48
2.0
2.0
8A
A8
68
AA
18
2.0
2.0
4C
FD AE
9E B7
FD AE
9E B7
F,0 FF
FD AE
A,0 AA
.OPT P,OO
96.0
*-
IPRINT AT ROUTINE
JSR SAEFD
JSR SB79E
TXA
PHA
JSR SAEFD
JSR SB79E
TXA
TAY
PLA
TAX
CLC
JSR SFFF,0
JSR SAEFD
JMP SAAA,0
167
BRK
200:
S3DC 00
l03C0-03DD
READY.
B*
PC SR AC XR YR SP
; 97FE 72 00 00 40 F6
S3C0
03C3
03C6
03C7
03C8
03CB
03CE
03CF
03D0
03D!
03D2
03D3
03D6
03D9
03DC
168
20
20
8A
48
20
20
8A
A8
68
AA
18
20
20
4C
00
FD AE
9E B7
FD AE
9E B7
F0 FF
FD AE
A0 AA
JSR
JSR
lXA
PHA
JSR
JSR
lXA
lAY
PLA
lAX
CLC
JSR
JSR
JMP
BRK
SAEFD
SB79E
SAEFD
SB79E
SFFF0
SAEFD
SAAA0
.OPT P,OO
.4000
*=
110:
120:
130:
4000 20 FD AE
4003 20 8A AD
4006 20 F7 B7
150:
160:
170:
180:
180:
4009
400B
400D
400F
4011
A5
D0
A5
D0
4C
15
2B
14
03
A5 40
;SYS16384,CHANGE,1=
;TEXT/0=HIRES
JSR .AEFD
JSR .AD8A
JSR .B7F7
LDA
BNE
LDA
BNE
JMP
.15
I GlERR
.14
MOR
RESET
169
190:
200:
210:
220:
230:
4014
4016
4018
401A
401C
C9
90
C9
B0
8D
31
MaR
20
FA
lC
FE 40
CMP
BCC
CMP
BCS
STA
tt49
IGiERR
tt250
IGiERR
TEMP
250:
260:
270:
280:
290:
300:
310:
320:
330:
340:
350:
360:
370:
380:
390:
400:
410:
410:
420:
420:
430:
430:
440:
440:
450:
460:
460:
470:
470:
4S0:
4S0:
490:
490:
401F
4022
4025
4028
402A
402C
402E
4030
4032
4035
4038
403B
403E
4041
4044
42146
4048
404A
404C
404F
4052
4054
4056
4059
405C
4"5F
4061
4063
4066
4069
406B
406D
4070
20
20
20
A5
D0
A5
C9
B0
8D
4C
4C
AD
8D
AD
C9
F0
A9
A2
SD
8E
A9
A2
8D
8E
4C
A9
A2
8D
8E
A9
A2
8D
8E
FD
8A
F7
15
0C
14
02
06
FF
3B
48
FE
F8
FF
01
17
0S
15
FA
FB
3B
IB
FC
FD
73
15
0S
FA
FB
IB
3B
FC
FD
JSR
JSR
JSR
LDA
BNE
LDA
CMP
BCS
STA
JMP
JMP
LDA
STA
LDA
CMP
BEG!
LDA
LDX
STA
STX
LDA
LDX
STA
STX
JMP
LDA
LDX
STA
STX
LDA
LDX
STA
STX
'AEFD
.AD8A
.B7F7
.15
IGiERR
.14
tt2
IG!ERR
TEMP+l
MORE
.B248
TEMP
RASTER
TEMP+l
ttl
TEXTTOP
tt8
tt21
TEXT
TEXT+l
tt59
tt27
HIRES
HIRES+l
SETUP
tt21
tts
TEXT
TEXT+l
tt27
tt59
HIRES
HIRES+l
510:
4073
AE
AD
B7
40
40
B2 IG!ERR
40 MORE
40
40
40
40
40
40
40
TEXT TOP
40
40
40
40
;
170
SETUP
529:
539:
549:
559:
569:
579:
589:
599:
699:
619:
629:
639:
649:
659:
669:
679:
689:
699:
799:
719:
729:
739:
739:
749:
759:
759:
769:
769:
779:
779:
789:
789:
799:
799:
899:
899:
819:
829:
839:
849:
859:
4973
4974
4976
4"79
497B
497E
4989
4982
4985
4988
498A
498D
4999
4993
4996
4999
499B
499E
49A9
49A3
49A4
49A5
49A6
49A8
49AB
49AD
49B9
49B2
49B5
49B7
49BA
49BC
49BF
49Cl
4BC4
49C5
4BC6
4BC9
49CC
49CE
49D9
78
A9
8D
A9
8D
A9
85
AD
8D
A9
8D
AD
8D
AD
8D
A9
8D
A9
8D
58
69
78
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
58
69
AD
8D
29
F9
C6
7F
9D
91
lA
92
FB
F8
12
18
DC
D9
49
D9
11 D9
14
F6
15
F7
C6
14
49
15
93
49
93
49
93
93
RESET
31
14 93
EA
15 93
15
18 D9
lB
11 D9
99
lA D9
89
9D DC
19 DB MAIN
19 DB
91
IF
FB
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
CLI
RTS
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
CLI
RTS
LDA
STA
AND
BEG!
DEC
.. S7F
SDC9D
..S91
SD91A
...92
SFB
RASTER
SD912
... 18
SD911
S9314
FIN-2
S9315
FIN-l
.. <MAIN
788
.. >MAIN
789
.. 49
788
.. 234
789
.. 21
53272
.. 27
53265
..9
.D91A
.. 128
56333
SD919
SD919
..S91
LOOP
SFB
171
40D2
86":
4"D4
8''':
88":
4"D6
89":
4"D8
4"DA
9"":
91":
4"DD
92":
4"E"
4"E3
93":
94":
4"E6
4"E9
95":
40EC
96":
4"ED
9''':
4"EF
98":
990:
4"F"
10"0: 4"Fl
1010: 4"F2
1020: 4"F3
103": 40F4
1040: 40FS
1"4": 4"F8
10S0: 40F8
1060: 4"FA
10'0: 40FC
1"8": 40FE
]4000-41"0
1"
A9
85
A6
BD
8D
BD
8D
BD
8D
8A
F"
68
A8
68
AA
68
4"
4C
"4
"1
FB
FB
F8
12
FA
18
Fe
LOOP9
4"
D"
40
D"
40
11 D"
"6
LOOP
31 EA LOOPl
FIN
96 "0
RASTER
15
TEXT
"8
3B IB
HIRES
00
TEMP
""
BPL
LDA
STA
LDX
LDA
STA
LDA
STA
LDA
STA
TXA
BEG!
PLA
TAY
PLA
TAX
PLA
RTI
JMP
LOOP9
#S"l
SFB
SFB
RASTER, X
SD"12
TEXT,X
532'2
HIRES,X
SD"ll
172
2"
2"
2"
A5
D0
AS
D"
4C
C9
FD
8A
F'
15
2B
14
03
A5
31
AE
AD
B'
40
JSR
JSR
JSR
LDA
BNE
LDA
BNE
JMP
CMP
SEA31
.BYT 150,0
.BYT 8,21
.BYT 59,2'
WORD"
READY.
4000
40"3
4"06
4""9
4""B
400D
400F
4011
4014
LOOPl
SAEFD
$AD8A
$B'F'
S15
54"38
$14
$4014
54"A5
#531
4016
4018
401A
401C
401F
4022
4025
4028
402A
402C
402E
4030
4032
4035
4038
403B
403E
4041
4044
4046
4048
404A
404C
404F
4052
40S4
40S6
4059
40SC
40SF
4061
4063
4066
4069
406B
406D
4070
4073
4074
4076
4079
90
C9
B0
8D
20
20
20
A5
D0
AS
C9
B0
8D
4C
4C
AD
8D
AD
C9
F0
A9
A2
8D
8E
A9
A2
8D
8E
4C
A9
A2
8D
8E
A9
A2
8D
8E
78
A9
8D
A9
20
FA
1C
FE
FD
8A
F7
15
0C
14
02
06
FF
3B
48
FE
F8
FF
01
17
08
15
FA
FB
3B
1B
FC
FD
73
15
08
FA
FB
1B
3B
FC
FD
40
AE
AD
B7
40
40
B2
40
40
40
40
40
40
40
40
40
40
40
40
7F
0D DC
01
BCC
CMP
BCS
STA
JSR
JSR
JSR
LDA
BNE
LDA
CMP
BCS
STA
JMP
JMP
LDA
STA
LDA
CMP
BEQ
LDA
LDX
STA
STX
LDA
LDX
STA
STX
JMP
LDA
LDX
STA
STX
LDA
LDX
STA
STX
SEI
LDA
STA
LDA
S4038
ttSFA
S4038
S40FE
SAEFD
SAD8A
SB7F7
S15
S4038
S14
tt.02
S4038
S40FF
S403B
SB248
S40FE
.40F8
S40FF
ttS01
S405F
ttS08
ttS15
S40FA
540FB
ttS3B
ttS1B
S40FC
S40FD
S4073
tt.15
ttS08
S40FA
S40FB
ttS1B
ttS3B
S40FC
S40FD
ttS7F
SDC0D
ttS01
173
487B
487E
4888
4882
4885
4888
408A
488D
4898
4893
4896
4899
489B
489E
48A8
48A3
48A4
48A5
48A6
48A8
48AB
48AD
48B8
48B2
48B5
48B7
48BA
48BC
48BF
48Cl
48C4
48C5
48C6
48C9
48CC
48CE
48D8
48D2
4.3D4
48D6
48D8
174
8D
A9
85
AD
8D
A9
8D
AD
8D
AD
8D
A9
8D
A9
8D
58
68
78
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
A9
8D
58
68
AD
8D
29
F8
C6
18
A9
85
A6
lA D8
02
FB
F8 40
12 D8
18
11 De
14 83
F6 48
15 83
F7 48
C6
14 83
48
15 fa3
31
14 0:S
EA
15 83
15
18 D8
lB
11 D0
88
lA D8
88
0D DC
19 D8
19 D0
81
lF
FB
84
81
FB
FB
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
CLI
RTS
SEI
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
LDA
STA
CLI
RTS
LDA
STA
AND
BEG!
DEC
BPL
LDA
STA
LDX
SD81A
..S82
SFB
S48F8
SD812
... 18
SD811
S8314
S48F6
.8315
S48F7
.. SC6
S8314
..S48
S8315
..S31
.8314
4ISEA
.8315
4IS15
.D818
..SlB
SD811
..S88
SD81A
... 88
SDC8D
SD819
.D819
4IS81
S48EF
SFB
S48D8
..S81
SFB
SFB
4eDA
4eDD
4eEe
4eE;,j;
4eE6
4eE9
4eEC
4eED
4eEF
4eFe
4eFl
4eF2
4eF3
4eF4
40F5
BD
8D
BD
SD
BD
SD
SA
Fe
6S
AS
6S
AA
6S
40
4C
F8
12
FA
18
FC
4e
De
4e
De
4e
11 De
e6
31 EA
LDA
STA
LDA
STA
LDA
STA
TXA
BEG!
PLA
TAY
PLA
TAX
PLA
RTI
S4eF8,X
SDe12
S4eFA,X
SDelS
S4eFC,X
SDell
S4eF5
JMP SEA31
: 4eFS 96 ee es 15 3B IB ee ee
175
40 BEST
MACHINE CODE
ROUTINES
FOR THE 64
All the machine code programs in this
book, including Supermon, are
available on one cassette at 7.95,
direct from Duckworth. Send a
cheque/postal order (or order by
phone with your Access or
Barclaycard number) and the cassette
will be sent post-free.
We publish many other books and
cassettes, including Exploring
Adventures on the 64, Advanced Basic
& Machine Code for the 64 and
Impossible Routines for the 64.
Write in for a catalogue
DUCKWORTH
The Old Piano Factory
43 Gloucester Crescent
LondonNWl
Telephone: 01 485 3484