Old school 3-D Vector Gaphics on new system
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: Old school 3-D Vector Gaphics on new system
Me too - I'm following, but don't find myself with much to say. It's good to see the development of a project, including the ups and downs.
Cheers
Ed
Cheers
Ed
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: Old school 3-D Vector Gaphics on new system
The software has really changed alot. I have a few macros now.
side_map1: side of a square from LUT1.
square_map1:use side_map1 to draw 4 lines using the LUT1 circle coordinates.
side_map2: side of a square from LUT2.
square_map2:use side_map2 to draw 4 lines using the LUT2 circle coordinates.
cube_map12: use square_map1 & square_map2 to draw 2 squares and 4 interconnecting lines.
VIDEO
This pic below is before rotation:
side_map1: side of a square from LUT1.
square_map1:use side_map1 to draw 4 lines using the LUT1 circle coordinates.
side_map2: side of a square from LUT2.
square_map2:use side_map2 to draw 4 lines using the LUT2 circle coordinates.
cube_map12: use square_map1 & square_map2 to draw 2 squares and 4 interconnecting lines.
Code: Select all
side_map1 .MACRO ;1st SQUARE OF CUBE FROM SINEWAVE MAP 1
LDY START
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDY STOP
LDA scratchx1,Y
STA lx1
LDA scratchy1,Y
STA ly1
.ENDM
square_map1 .MACRO
LDA OFFSET
STA START
LDA #256
CLC
ADC OFFSET
STA STOP
side_map1
LDA #256
CLC
ADC OFFSET
STA START
LDA #512
CLC
ADC OFFSET
STA STOP
side_map1
LDA #512
CLC
ADC OFFSET
STA START
LDA #768
CLC
ADC OFFSET
STA STOP
side_map1
LDA #768
CLC
ADC OFFSET
STA START
LDA OFFSET
STA STOP
side_map1
.ENDM
side_map2 .MACRO ;2nd SQUARE OF CUBE FROM SINEWAVE MAP 1
LDY START
LDA scratchx2,Y
STA lx0
LDA scratchy2,Y
STA ly0
LDY STOP
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
.ENDM
;2nd SQUARE OF CUBE
square_map2 .MACRO
LDA OFFSET
STA START
LDA #256
CLC
ADC OFFSET
STA STOP
side_map2
LDA #256
CLC
ADC OFFSET
STA START
LDA #512
CLC
ADC OFFSET
STA STOP
side_map2
LDA #512
CLC
ADC OFFSET
STA START
LDA #768
CLC
ADC OFFSET
STA STOP
side_map2
LDA #768
CLC
ADC OFFSET
STA START
LDA OFFSET
STA STOP
side_map2
.ENDM
cube_map12 .MACRO ;MAP A CUBE
square_map1 ;SQUARE1
square_map2 ;SQUARE2
LDY OFFSET ;DIAGONAL INTERCONNECTS
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #256
CLC
ADC OFFSET
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #512
CLC
ADC OFFSET
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #768
CLC
ADC OFFSET
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
.ENDMThis pic below is before rotation:
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: Old school 3-D Vector Gaphics on new system
I had an issue to resolve before full rotation in the video above. In that video, it is only 1/4 rotation. It is based on the value 'OFFSET' from 0-255. Higher values resulted in (0,0) coordinates because it was going out of range in the LUT, which is only an 10-bit, 1024 range. SO I modified it...
I made a modification to the above macro's, it's is almost 100% I had to mask off unneeded bits for the LUTs, also I added more to the delay for the video($FFFF instead of $03FF)... I just posted a new video, slowed down.
This is the main control loop now (not previously posted), :
ANOTHER VIDEO Still an error. Gotta figure it out, then on to 2 planes. EDIT:BAH! The first AND mask in the square_map1 macro is wrong, 1 too many 1's . The replace function must have skipped over the very first one when I was editing. 
Code: Select all
side_map1 .MACRO ;1st SQUARE OF CUBE FROM SINEWAVE MAP 1
LDY START
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDY STOP
LDA scratchx1,Y
STA lx1
LDA scratchy1,Y
STA ly1
.ENDM
square_map1 .MACRO
LDA OFFSET
STA START
LDA #256
CLC
ADC OFFSET
AND #%0000011111111111 ;mask off unneeded bits to accommodate 10-bit LUT max value
STA STOP
side_map1
LDA #256
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA #512
CLC
ADC OFFSET
AND #%0000001111111111
STA STOP
side_map1
LDA #512
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA #768
CLC
ADC OFFSET
AND #%0000001111111111
STA STOP
side_map1
LDA #768
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA OFFSET
STA STOP
side_map1
.ENDM
side_map2 .MACRO ;2nd SQUARE OF CUBE FROM SINEWAVE MAP 1
LDY START
LDA scratchx2,Y
STA lx0
LDA scratchy2,Y
STA ly0
LDY STOP
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
.ENDM
;2nd SQUARE OF CUBE
square_map2 .MACRO
LDA OFFSET
STA START
LDA #256
CLC
ADC OFFSET
AND #%0000001111111111
STA STOP
side_map2
LDA #256
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA #512
CLC
ADC OFFSET
AND #%0000001111111111
STA STOP
side_map2
LDA #512
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA #768
CLC
ADC OFFSET
AND #%0000001111111111
STA STOP
side_map2
LDA #768
CLC
ADC OFFSET
AND #%0000001111111111
STA START
LDA OFFSET
STA STOP
side_map2
.ENDM
cube_map12 .MACRO ;MAP A CUBE
square_map1 ;SQUARE1
square_map2 ;SQUARE2
LDY OFFSET ;DIAGONAL INTERCONNECTS
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #256
CLC
ADC OFFSET
AND #%0000001111111111
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #512
CLC
ADC OFFSET
AND #%0000001111111111
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
LDA #768
CLC
ADC OFFSET
AND #%0000001111111111
TAY
LDA scratchx1,Y
STA lx0
LDA scratchy1,Y
STA ly0
LDA scratchx2,Y
STA lx1
LDA scratchy2,Y
STA ly1
.ENDMThis is the main control loop now (not previously posted), :
Code: Select all
rcube LDX #0
triplot LDA #%0000011111100000 ;green pixels
STA color
STX OFFSET
BCF1C $FFFE ;Branch if Control Flag 1 is Clear (0), CF1 is VSYNC input, so branch to itself and wait until vsync = 1, a non display period
cube_map12
LDY #$03FF
GH DEY
BNE GH
LDA #%0000000000000000 ;black pixels. clear previous plot
STA color
BCF1C $FFFE
cube_map12
INX
CPX #1023 ;cycle through the LUTs
BNE triplot
triplot2 LDA #%0000011111100000 ;green pixels
STA color
STX OFFSET
BCF1C $FFFE ;Branch if Control Flag 1 is Clear (0), CF1 is VSYNC input, so branch to itself and wait until vsync = 1, a non display period
cube_map12
LDY #$03FF
GH2 DEY
BNE GH2
LDA #%0000000000000000 ;black pixels. clear previous plot
STA color
BCF1C $FFFE
cube_map12
DEX
BNE triplot2
JMP rcube
Last edited by ElEctric_EyE on Wed Apr 09, 2014 7:58 pm, edited 1 time in total.
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: Old school 3-D Vector Gaphics on new system
This video shows correct motion. I changed the delay value to speed it up also. Now on to the Z plane! 