Tuesday, October 4, 2022

Raytracing Code Changes to Run the Code on a Color Computer 1 & 2

These are the changes needed to run this on a Color Computer 1 or 2 in PMODE 4 graphics mode using color artifacting.
The changes are related to graphics mode (lines 5, 6, and 80), horizontal resolution (lines 9 and 30), generating the shadow (line 48), and the high speed mode (line 0)

Copy the code from the original post and paste it into the VCC emulator.
Then copy and paste the code below into VCC.  It will overwrite the lines needed to run it on the Color Computer 1 & 2.
The crosshatch code in line 48 could use some work do to how PMODE3, and artifacting interact with the math, but it's not too bad as is.

 




0 POKE 65495,0

5 PMODE4,1:PCLS:SCREEN1,1:PMODE3,1

REM DELETE LINE 6
6

9 RX=0:RY=0:RZ=0:T=0:OX=0:OY=0:OZ=0:X1=0:X2=0:A=0:B=1:C=2:D=5:E=-1:F=1/256:G=1/2:H=192:M=1/5:J=.95:L=.001

30 FOR X = 0 to 255

48 IF FA=A THEN FA=((X AND B)<>(Y AND B))+B

80 PSET(X,Y,FA)

6 comments:

  1. I got a bit lost with this last change for the Coco 1 & 2 -- I get an out of data error on line 20. With the "REM DELETE LINE 6", I am wondering if I missed a change in there somewhere because I don't see a previous post that includes a line 6.

    ReplyDelete
    Replies
    1. type in the previous code, then make these changes, including deleting line 6. I'll check it out to make sure something didn't get dropped.

      Delete
    2. Okay, if you got an out of data error on a coco 1&2, you probably didn't replace line 0.

      Delete
    3. Line 0 looks okay to me. It has the poke and then line 5 has the pmode,pcls,screen,pmode statements. Line 30 looks like where it tripped me up, with the data statements being moved to 12000. I think in this case line 40 would also need to be deleted since the data is also at 12001. I now get a syntax error at 11000 because of the hex numbers. I'm actually *reading* the code now to understand what it does. Good exercise.

      Delete
    4. This comment has been removed by the author.

      Delete
  2. I think I got it now! Went back to the original listing then added those changes.

    ReplyDelete