[Coco] Need help with Assembler Program

Roger Taylor operator at coco3.com
Sat Feb 2 22:33:45 EST 2008


At 12:23 PM 2/2/2008, you wrote:

>Greetings!
>
>I'm playing with EDTASM++ in an emulator (I've just ordered a real
>cartridge from Cloud-9) and am having
>Some problems with an "example" program I found on the internet.
>
>When I assemble, I get no errors.  But when I try to execute the
>program, I get unusual results.

You never said what kind of results you are getting.



>I'm wondering if the subroutines I'm referencing aren't located where
>this listing shows them.
>
>I'm running on Dave Kiel's Coco 2 emulator.  Here are some of the
>subroutines that this program calls:
>
>JSR     43304 -   this is supposed to do a CLS routine.
>JSR     [40962] - this should be a CHROUT subroutine.
>
>I take it that an address in brackets [] is a relative address - the
>data at memory location 40962 is
>a pointer to the actual location of the CHROUT subroutine?


And address in brackets is an "indirect" address, meaning the 16-bit 
value stored at that address is address used.
Yes, [40962] or .... Heeeeere we go again, for the swear-by-hex guys, 
[$A002], makes no difference to me, holds a 16-bit address pointer to 
the CHROUT routine.



>I'm wondering if these subroutine locations are actually for a Coco3
>perhaps??

All CoCo models, starting from the first one.  That is probably one 
of the most called ROM routines in CoCo history, right next to the 
STDIN or KEYIN routine.  I think $A000 and $A002 were meant to be the 
STDIN/STDOUT routines and they should work with different devices.





>The entire test program I'm trying to get running is:
>
>00050   ORG     $4000
>00100 START    JSR     43304           CLS SUBROUTINE
>00110          LDA     #65             ASCII A
>00120 AGAIN    JSR     [40962]         CHROUT SUBROUTINE
>00130                  INCA            NEXT IN ALPHABET
>00140                  CMPA    #91     ONE PAST ASCII Z?
>00150                  BNE     AGAIN
>00160                  LDA     #32     ALPHABET DONE
>00170                  LDB     #6      PRINT 6 SPACES
>00180 REPEAT   JSR     [40962]
>00190                  DECB
>00200                  BNE     REPEAT
>00210 LOOP      BRA    LOOP
>00210                  END      START


Don't assume register A or B is preserved after calling 
[40962].  Even if they are, or one is, consider doing a "pshs a,b" 
before calling, and "puls b,a" after.
Note the changes I made, line 00050, 00150, and 00210
Assemble, save to disk, LOADM from BASIC and try again.






More information about the Coco mailing list