Writing Your First Program - Commodore VIC-20 Programmer's Reference Manual

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

WRITING YOUR FIRST PROGRAM
If
you
have used the POKE statement in BASIC to put characters
onto the screen, you will be aware that the character codes for
POKEing are different to CBM ASCII character values. For
example,
jf
you enter:
PRINT ASC("A") (and press <RETURN> )
The
VIC
20 will respond with:
65
READY,
However, to put an "A" onto the screen
by
POKEing, the coce is
1. Since the screen memory starts at 7680 (decimal), or4096 if
you
have
eK
or more of expansion memory, by entering:
<CLR> (To clear the screen)
POKE 7680,1 (and <RETURN»
(NOTE: POKE 4096,1 on a
VIC
20
with BK or more of
expansion memory)
The "P" in the POKE statement should now be an "A" We will
now do this in machine language. Type the following in VICMon:
(Your cursor should be flashing alongside
a "."
right now.)
.A 1400 LOA #$01 (and press <RETURN> )
The VIC will prompt you with:
,A
1402 •
Type:
.A 1402 STA $1 EOO (or STA $1000 on a
VIC
.20
with BK or more of expansion memory)
The STA instruction stores the contents of the accumulator in a
specified memory location. The VIC will now prompt you with:
,A 1405 •
Now enter:
,A
1405 BRK
Clear the screen, and type:
G
1400
132

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents