Instruction manual

Input
low&hish
addresses
of
block
to
be
listed:Decima11
546,565
Figure 3
Figure 2
50000
FORD~BTOB+ll*CSTEPC:POKED,32:NEXTD:A
••
STR.(A):E=LEN(A.)
50010
FORF=BTOB+(E-l)*CSTEPC:POKEF.ASC(HID.(A
••
(F-B+C)/C,l»lNEXTF
50020
RETURN
OK
Figure 4
Beware
of
blank characters when
ex-
amining strings for video conversion!
12
screen positions ARE required!
It
is im-
portant
to
remember that when the
number is pushed into the display the
starting video address will always be the
mantissa sign position. This can be any
screen address but beware
of
overlapp-
ing when you try and print
off
the edge
of
the screen. The number
to
be
displayed
need not always be displayed in a left
to
right fashion.
By
changing the video in-
crementing factor many print angles
become possible. Here is a listing in a
clock fashion with the mantissa sign at
the starting video address.
100
FORD=53240T054271:POKED,32:NEXTD
110
B=53776
120
A=RND(2)*10~(RND(4)*10)
130
C=1:GOSUB50000
140
FORC=34T030STEP-l:GOSUB50000INEXTC
150
C=-1IGOSUB50000
160
FORC=-34TO-30:GOSUB50000:NEXTC
170
GOT0120
OK
MNE
A-DEC
O-DEC
ASCII
A-HEX
O-HEX
MNElif
valid)
JSR
546
32
0222
20
JSR
'?
547
171
0223
AB
***
AB
***
CMP
548
205
0224
CD
***
CD
***
JSR
549
32
0225
20
JSR
?
550
18
0226
12
***
12
***
?
551
52
4
0227
34
***
34
***
1
552
67
e
0228
43
1
Resync1?????1??????1?????????????????????????????1???????????????
EOR-I-X
553
65
A
0229
41
***
41
***
?
554
82
R
022A
52
***
52
***
BVe
555
80
P
022£1
50
***
50
***
?
556
63
?
022C
3F
***
3F
***
£IRK
557
0
022D
00
DRK
PHA
558
72
H
022E
48
PHA
TXA
559
138
022F
8A
TXA
CMP-II1M
560
201
0230
C9
CHP-IHH
?
561
67
C
0231
43
***
43
***
BNE
562
208
0232
DO
BNE
SBC-O-P-X
563
245
0233
F5
***
F5
***
NOP
564
234
0234
EA
NOP
NOP
565
234
0235
EA
NOP
Numeric To Video Conversion
This short BASIC routine will enable
you
to
print numeric variables on your
video
monitor
while your software is
busy generating real-time graphics. See
figure
(3).
The opeeration is not overly
complex. First the program clears the
screen positions which are going
to
have new characters placed there. This
is done by POKEing blanks there with a
FOR-NEXT loop. The number
that
you
are going
to
display is first converted
to
a string with the
STR$
function. The
length
of
the resultant string is found
with the
LEN
function. MID$
is
used with
a FOR·NEXT loop to dissect the string
into individual characters which are con-
verted
to
the correct values
to
be
POK'd
into
the screen memory with the ASC
function.
The display is a fixed format which
uses the
12
screen positions: the man-
tissa sign, 6
digits
of mantissa with a
decimal point, exponent sign and two
digits
of
exponent. Or ±
O.ooOOOE
±
00.
A GOSUB 1500 with 0
to
15
in H will
return the hexadecimal equivalent in H$.
GOSUB 1400 with 0
to
255
in 0 returns
the hex equivalent in
1$.
GOSUB 1300
with 0
to
65535 in R returns 0000 to FFFF
(hex) in J$. These last three routines are
"quick
and
dirty"
but may be
of
some
use
to
you at a later time. The data table
is easily modified to allow for future ex-
pansion.
Standard
RockwelllSybex
mnemonics are used except for the use
of
hyphens as opposed
to
commas (the
data statements wouldn't like these
too
well I fear).
translation saves much software. Il-
lustration 2 is a nonsense program,
there only to show you what it looks like
when it runs and how it runs. Hex lines
0228
to 022C show what happens when
the program runs into something
it
doesn't recognize; the string prompt
"CARP?". The response is always the
same: it prints the first line it
didn't
recognize followed by the row
of
ques-
tion marks and then four more lines
without trying
to
assign
an
"intelligent"
op-code or
do
anything else except get
ready to re-sync (or try) on the
fifth
byte
after the initial unlock. If
this
byte also
lacks a valid mnemonic the process is
repeated until it finally drops
out
and
finds one.
After you start the program,
it
will
ask you for the addresses of the lowest
byte and the highest byte
that
you want
it
to try
to
disassemble. This must be in-
put in decimal form as the program has
no provisions for a hexidecimal
to
decimal converter. The next thing
that
we'll do is examine the program
to
help
you to see how it works and where the
various routines are. Lines 100 through
730
comprise the data table. Each data
statement holds the information
to
decode four different
instructions
of
6502
op-codes and also
"fillers"
to
tell
the program when a non-existant in-
struction
is found. The
format
is
"MNEMONIC", NUMBER OF BYTES for
that instruction. If it is a non-existant in-
struction then the data statement for
it
will read: "?",9. Since as far as I know
there aren't any nine byte 6502 instruc-
tions, it sticks
out
quite well
amidst
a
forest
of
ones, twos, and threes.
Now
it's
time for the fun part. Line
1020 inputs the address range
to
be
worked on. Lines 1040 and 1050
print
the
header: Line 1070 sets the major loop
which cycles through the op-codes one
byte at a time.
1100
to
1120 cause the
data table
to
be
scanned until the cor-
rect op-code is found. The second state-
ment in line 1120
tells
the program the
total
number of lines
to
print
without
mnemonics when
it
gets
out
of
sync.
1130
to
1150 print the
leftmost
four col-
umns.
1220
to
1260
control
the
program's intelligence and tell
it
when
and when not
to
try
and print a
mnemonic in the rightmost column.
19:32
MICRO
--
The
6502 Journal
December,
1979