Specifications

>g 1000
>r
start at $2000, to push all registers on
the User Stack, and then to break back to
PC D
X Y U S
CC DP
the monitor. Before you try this, be sure
: 1005
0102
0304 0506 1ff4 0220 cO 00
to overtype the D, X, and Y registers to
>d Iff4-2000 show the values at left. We need the val
1ff4
cO
Condition Code (CC)
12
ues to track what happens (don't reset PC
Iff 5
01
A (D high byte) 11
or the User Stack Pointer, which will be
Iff 6 02
B (D low byte) 10 at 0000 before the 'run'.) Then give your
Iff 7
00 Direct Page (DP)
9
>g 1000. After the run, dump registers as
1ff8
03
High byte, X 8 we show at left. Note that the User Stack
Iff 9
04
Low byte, X
7
Pointer (U) has decremented to $1ff4. The
1ffa
05
High byte, Y
6
stack 'stacks' downward. I have annotated
1ffb 06
Low byte, Y
5
the memory contents from $2000, where we
1ffc
02
High Byte, S pointer
4 started the stack, to $1ff4, at bottom.
1ffd
20 Low Byte, S pointer
3
The 'push order' of the stack is clearly
1ffe 10 High Byte, PC
2
shown, left. Note: the stack pointer not
1fff
05
Low Byte, PC 1
used (here, the Hardware Stack Pointer),
2000 XX (Order)
is saved. If we had pushed all this onto
the Hardware stack, we would have saved
the value in the User Stack Pointer instead. Of necessity, the 'pull order* of
the stack is the opposite of the push order.
Thus we see that 'pshs x,d' places the contents of the X register onto the
stack before the contents of the D register. The stack pointer shows the last
location on the stack which was filled. Hence the pointer is decremented be
fore a value is stored. (And, therefore, subd ,s in the length example subtracts
the value of the start address which was originally saved in the D register from
the count which was obtained in the adjusted value of the X register.)
The use and misuse of the stack is such an important topic that it will be
treated in an article as soon as I can get to it (no more than a year!).
Music generation on the SuperPET is a very complicated topic. The examples
presented will generate no sound unless you find and correct the error. In all
examples the nop instruction is incorrect. Assembly language operates sooo fast
that the ear can't detect the sound presented in one millionth of a second. But
the 6809 has a special instruction to handle such events which the 6502 lacks,
and you'll find it in the Waterloo Assembly-Language manual (as well as at the
end of this column if you get tired of learning while searching). When generat
ing sound with 6502 code, you need elaborate delay routines to obtain the timing
which will appear to the ear to be music.
There are specific boards designed for use on the 8032 (SuperPET) which allow
the creation of pleasing musical compositions. The capabilities of the Commodore
64 with its SID chip are even more spectacular (my brother owns a 64, and both
the color and sound always amaze me. I even purchased a TI-99/^A recently to get
first-hand experience with color and sound capabilities). And though I thought
that a SuperPET could not have additional boards added, a letter from Col. Stal
lings states that he has the MTU music board and software.
We are now going to produce a few sounds from SuperPET. I can't even read
music, so don't expect a treatise on composing sonatas. The basic information is
contained in the book, Programming the PET/CBM, by Raeto Collins West, published
by COMPUTE! Books. More information is found in CURSOR (no longer published) and
by Gregory Yob in one of his Creative Computing columns.
SuperPET Gazette, Vol.I No.11
-177-
December 1983/January 1984