[Coco] Assembler Program - Working!
Charles Shrader
charles.shrader at gmail.com
Sun Aug 17 12:25:19 EDT 2008
Just wanted to thank this group for their help with this little project.
Here's my working code. I apoligize ahead of the time for the formatting;
I'm
not sure how to get this to line up other than using the Courier font, and
I'd
Imagine the output from the List Server would change the font to something
else.
00100 ORG $3F00 ;Start location of code
00110 START JSR 43304 ;Clear Screen
00120 LDB #0 ;Initialize register B
00130 LDA #0 ;Initialize Accumulator
00135 STA DEVNUM ;Output to screen
00140 LDX #STMP ;Load start address STMP
00150 LOOP JSR $A1C1 ;Poll for keypress
00160 CMPA #0 ;Compare vs 0. If 0, no key
prs
00170 BEQ LOOP ;No keypress so keep polling
00180 STA ,X+ ;Store keypress in STMP,
inc X
00190 JSR [40962] ;Output keypress to screen
00192 INCB ;Increment counter
00194 CMPB #8 ;See if 8 keys have been
pressed
00200 BNE LOOP ;Keep polling until 8
keystrokes
00210 LDX #STMP ;Point to STMP for echo of
output
00220 LDA #32 ;Load A with ASCII code for
spc
00230 JSR [40962] ;Output character to screen
00231 CLRB ;Clear B Register
00240 LOOP2 LDA ,X ;Load A with 1st char of stored
str
00250 JSR [40962] ;Output to screen
00260 CMPB #8 ;Have we displayed all 8
chars?
00270 BNE LOOP2 ;If not, get next char in str
00280 RTS ;Return to caller
00290 STMP RMB $09 ;Define storage area STMP
00300 DEVNUM EQU $6F ;Location of output
00310 END START
What helped were adding a # sign in front of my memory location STMP.
How does the compiler treat a CMP function of a memory location if it
has a # designation rather than just the memory location without?
Also, using register B as a counter works better than trying to use
X even though it is incremented with the instruction LDA ,X+. I'll
probably use B as my counter in the future, and keep X as just an
index of sorts.
I may need some more help in the future so don't be surprised if I
surface again... Assembler can be quite tricky. Critique is also welcome!
Thanks again all!
Chuck Shrader
p.s. Just wanted to say for the record (outside of the context of the
recent 'heated' discussions) that Mark at Cloud9Tech and Boisy Pitre
are in my opinion businessmen of integrity. I have purchased some items
and software from them and had some initial problems, both individuals
went way beyond the call of duty to get my system working very well.
It's my opinion that they are a huge asset to this community. Thanks guys!
More information about the Coco
mailing list