Cinematronics Assembler Question

From: Christopher V. Moore <cmoore_at_heartlab.heartlab.com>
Date: Thu Mar 26 1998 - 15:33:02 EST

Hi All,

As I've previously posted, I've been working on an assember in C++ for the
Cinematronics
boards using Zonn's nmemonics. I've added support for labels and I'd like
to test it out
by writing a small program to draw a line on the screen.

I wrote the code using Zonn's example vector draw routine and tried running
it on his
emulator. All I get is a blank screen. Zonn suggested I add the 'wai'
instruction but
that didn't work. I believe all the instructions are being assembled
correctly and my
problem is I'm just doing something wrong in the program. However, I'm in an
open loop situation and am having trouble debugging.

I'd like to get this project finished up, and I've found that in this case
sometimes a
second pair of eyes can spot problems that I can't see. Could one of you
Cinematronics
gurus please take a quick look at my listing and let me know if I'm way off
base with
this example program?

Thanks,
-Chris

 *** Start Of Assembly Listing ***
.ORG $0
 *** Set the address to 0 (0)
Reassembling forward reference at line number: 18 and address: 000000
Reassembling forward reference at line number: 53 and address: 000019
Reassembling forward reference at line number: 59 and address: 000020
0000:
0000:
0000: ; Routine -- Draw Vector
0000: ;
0000: ; $4 = Start Y position of vector to be drawn
0000: ; $5 = End Y position of vector to be drawn
0000: ; $6 = Start X position of vector to be drawn
0000: ; $7 = End X position of vector to be drawn
0000: ;
0000: ; $F = Return address
0000: ;
0000: ; All addresses are located in the current bank
0000: ; and the 'P' register is left unchanged.
0000: ;
0000: ; It is assumed the intensity of the line has already
0000: ; been set using the 'OUT 6' instruction.
0000:
0000: ; Setup the labels for the arguments
0000: 48 00 ldj MainProg
0002: 58 jmp [j]
.ORG $4
 *** Set the address to 4 (4)
0004: StartY:
.ORG $5
 *** Set the address to 5 (5)
0005: EndY:
.ORG $6
 *** Set the address to 6 (6)
0006: StartX:
.ORG $7
 *** Set the address to 7 (7)
0007: EndX:
0007:
0007: 00 clr ; Dummy entry to fool this buggy assembler!
0008:
0008:
0008:
0008: ; Setup for Zonn's Vector Draw Code. Draw a diagonal
0008: ; line.
0008:
0008: 00 MainProg: clr
0009: 20 64 add #100
000b: 80 ldp #0
000c: d6 sta StartX
000d: d4 sta StartY
000e: 00 clr
000f: 20 c8 add #200
0011: d7 sta EndX
0012: d5 sta EndY
0013:
0013: 00 clr
0014: ;
0014: 21 add #1
0015: 90 out 6
0016:
0016: DrawVec:
0016: ; Start of Zonn's Vector Drawing Code.
0016:
0016: a4 lda StartY ; Get Start Y in A-reg
0017: 57 usb
0018: a6 lda StartX ; Get start X in B-reg
0019: 4b 10 ldj Loop1 ; Point to next instruction
001b: Loop1:
001b: 5a jdr [j] ; Loop until previous draw in done
001c: f0 vin ; Set starting address, reset Line Length reg
001d: 08 lda #$800 ; Setup A-reg for timing loop
001e: 20 41 add #$41 ; $841 = Loop $41 times
0020: 42 20 ldj Loop2 ; Point to next instruction
0022: Loop2:
0022: 31 sub #$1 ; Decrement timing loop counter
0023: 5f nop ; MI flag not set until next instruction
0024: 59 jmi [j] ; If A-reg still negative, loop
0025: a5 lda EndY ; Get Y end position in A-reg
0026: 74 sub StartY ; Subtract start to get length
0027: 57 usb
0028: a7 lda EndX ; Get X end position in B-reg
0029: 57 usb
002a: 76 sub StartX ; Subtract start to get length
002b: e4 llt ; Load the Line Length Timer
002c: 64 add StartY ; Add Y start to A-reg to get Y end
002d: 57 usb
002e: 66 add StartX ; Add X start to B-reg to get X end
002f: e0 vdr ; Start vector drawing
0030: e5 wai ; Waste time to fool the jdr instruction
0031: ; at the start of the loop to make sure
0031: ; the vector gets drawn
0031:
0031:
0031: ;cmp ReturnAdr ; Set I-reg to point to return address.
0031: ;ldj [i] ; Load J-reg with return address.
0031: ;jmp [j] ; Return to caller.
0031:
0031: 48 00 ldj MainProg ; Start the loop over again.
0033: 58 jmp [j]
0034:
0034:

*** There are 8 parsed labels ****

 Label Number Label Address
----------------------------------------------
 0001 MainProg 000008
         Forward LDJ Reference At: 000000
         Backward LDJ Reference At: 000031
 0002 StartY 000004
         Backward Immediate Reference At: 00000d
         Backward Immediate Reference At: 000016
         Backward Immediate Reference At: 000026
         Backward Immediate Reference At: 00002c
 0003 EndY 000005
         Backward Immediate Reference At: 000012
         Backward Immediate Reference At: 000025
 0004 StartX 000006
         Backward Immediate Reference At: 00000c
         Backward Immediate Reference At: 000018
         Backward Immediate Reference At: 00002a
         Backward Immediate Reference At: 00002e
 0005 EndX 000007
         Backward Immediate Reference At: 000011
         Backward Immediate Reference At: 000028
 0006 DrawVec 000016
 0007 Loop1 00001b
         Forward LDJ Reference At: 000019
 0008 Loop2 000022
         Forward LDJ Reference At: 000020

 *** End Of Assembly Listing ***

--
Christopher V. Moore -- Principal Engineer
Heartlab, Inc. - 101 Airport Rd - Westerly, RI 02891
Phone: (401) 596-0592 - Fax: (401) 596-8562 - Email: cmoore@heartlab.com
                                                              
Received on Thu Mar 26 12:28:59 1998

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:31:51 EDT