Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vectrex Adapter 3D Rotation

47 views
Skip to first unread message

Kokovec

unread,
Dec 27, 2011, 8:54:57 PM12/27/11
to
With a little help from a friend overseas (thanks Dan!) I finally got
the Vectrex Adapter spinning a 3D object around its origin.
I'm even including the assembly listing of the program that was
uploaded to the Vec in the video.

http://youtu.be/w9puhgqZJic



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Vectrex Adapter Demo ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Formated for Kingswood compiler ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This program does the following: ;
; ;
; === Rotates a 3D object around X,Y,Z,XYZ axis ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




include "vecbios.txt"


AngleX equ $c880 ;2 bytes: X Angle (0-360)
AngleY equ $c882 ;2 bytes: Y Angle (0-360)
AngleZ equ $c884 ;2 bytes: Z Angle (0-360)
Counter equ $c886 ;General Counter

Object1_Add equ $8000 ;Start address of Object 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The following are registers used by Adapter API ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Rot_X equ $c7d0 ;2 bytes: Pointer Rot_X Register
Rot_Y equ $c7d2 ;2 bytes: Pointer Rot_Y Register
Rot_Z equ $c7d4 ;2 bytes: Pointer Rot_Y Register
Vec_Command equ $c7e3 ;Pointer to Command Register
Object_Num equ $c7e4 ;Pointer to Object Number Register
List_Type equ $c7e5 ;Pointer to Object List Type (2D/3D) Register
Num_Points equ $c7e6 ;Pointer to Number of Points in Object List
Register
Object_Pointer equ $c7e7 ;Pointer to Object Relative Vector List
Register



org $0000

; Magic Init Block
fcb $67,$20
fcc "GCE 2011"
fcb $80
fdb Music
fdb $f850
fdb $30b8
fcc "VECTREX 3D TEST"
fcb $80,$0

;*** Copy 3D Point List RAM ***
clrb
ldx #Point1_List ;point to start of point list in ROM
ldy #Object1_Add ;point to start of Object list
Mem_Loop
lda,x ;get point in ROM
sta,y ;store point in RAM
leax 1,x ;next point in ROM
leay 1,y ;next point in RAM
incb
cmpb #66 ;do all points
bne Mem_Loop

clr Counter ;clear general counter
ldd #00 ;Set all angles to 0
std AngleX
std AngleY
std AngleZ
std Rot_X
std Rot_Y
std Rot_Z

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Here we load up params for Object1 ;;;
;;;We fill in info about the Object ;;;
;;;We also tell adapter where we want the vector list saved ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

lda #1 ;Vec Command = Fill Object List
sta Vec_Command
lda #1 ;Object Number is 1
sta Object_Num
lda #1 ;Set list type as 3D
sta List_Type
lda #22 ;set number of 3D points in object
sta Num_Points
ldd #Object1_Add ;set pointer to Object address
std Object_Pointer ;Vec will expect vector list to be here when
drawing
lda $C7ff ;A call to this address tells adapter to start working
jsr Wait_PB6 ;Wait for adapter to give RAM back to Vectrex


Main_Loop
jsr Increase_X ;Rotate about X-axis
jsr Increase_Y ;Rotate about Y-axis
jsr Increase_Z ;Rotate about Z-axis
jsr Rotate_XYZ ;Rotate about XYZ
jsr Draw_Ship ;Draw the ship
bra Main_Loop


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; These routines rotate ship about cardinal axes ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Increase_X
lda Counter ;only go around once
cmpa #0
bne IX_Done
ldd AngleX ;increase Angle-X by 1
addd #1
cmpd #360 ;don't go over 360 degrees
bne Keep_Increasing_X
inc Counter ;we're done... onto Y rotation
ldd #00
Keep_Increasing_X
std AngleX ;save Angle (Vec local)
std Rot_X ;save Angle (Adapter Register)
IX_Done
rts

Increase_Y
lda Counter
cmpa #1
bne IY_Done
ldd AngleY
addd #1
cmpd #360
bne Keep_Increasing_Y
inc Counter
ldd #00
Keep_Increasing_Y
std AngleY
std Rot_Y
IY_Done
rts

Increase_Z
lda Counter
cmpa #2
bne IY_Done
ldd AngleZ
addd #1
cmpd #360
bne Keep_Increasing_Z
inc Counter
ldd #00
Keep_Increasing_Z
std AngleZ
std Rot_Z
IYZDone
rts


Rotate_XYZ
lda Counter
cmpa #3
bne RXYZ_Done
ldd AngleZ
addd #1
cmpd #360
bne RXYZ_Continue
clr Counter
ldd #00
RXYZ_Continue
std AngleZ
std Rot_Z
std Rot_X
std Rot_Y
RXYZ_Done
rts


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This routine rotates and draws the ship ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Draw_Ship
lda #2 ;Vec Command = Rotate Object Around Center
sta Vec_Command
lda #1 ;Object number = 1
sta Object_Num
lda $C7ff ;A call to this address tells adapter to start working
jsr Wait_PB6 ;wait for adapter to finish
jsr Wait_Recal ;recalibrate
ldb #00 ;now draw the ship...
jsr Moveto_d
jsr Intensity_7F
lda Object1_Add
deca
ldb #128
ldx #Object1_Add+1
jsr Draw_VL_ab
rts

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Here we wait for PB6 to go low ;;;
;;; PB6 High = Adapter has control of extended RAM ;;;
;;; OK to access ROM and local Vec RAM ($c880-$cbea) ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Wait_PB6
lda Via_port_b
anda #%01000000
cmpa #%01000000
beq Wait_PB6
lda #00 ;Reset Vec Command Register
sta Vec_Command
rts



Music
fdb $fee8
fdb $feb8
fcb $0,$80
fcb $0,$80


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is the 3D object Point List (object space) ;;;
;; It is not a Vector List ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Point1_List
fcb 0,0,0
fcb 0,20,-20
fcb 0,0,-40
fcb 0,-20,-20
fcb 0,0,0
fcb 20,0,-20
fcb 0,0,-40
fcb -20,0,-20
fcb 0,0,0
fcb -40,-20,80
fcb -17,0,80
fcb 17,0,80
fcb 40,-20,80
fcb 0,0,0
fcb -17,0,80
fcb -13,10,60
fcb 13,10,60
fcb 17,0,80
fcb 0,0,0
fcb 13,10,60
fcb -13,10,60
fcb 0,0,0




Kokovec

unread,
Dec 27, 2011, 9:59:19 PM12/27/11
to
Here's the working YouTube link: http://www.youtube.com/watch?v=6009wwKVDlA

Kokovec

Dave McCooey

unread,
Dec 28, 2011, 2:39:04 AM12/28/11
to
On Dec 27, 6:59 pm, Kokovec <koko...@gmail.com> wrote:
> Here's the working YouTube link:http://www.youtube.com/watch?v=6009wwKVDlA
>
> Kokovec

Very cool!

The ship looks like it's from Tailgunner.

-Dave

Kokovec

unread,
Dec 28, 2011, 4:41:16 AM12/28/11
to

>
> Very cool!
>
> The ship looks like it's from Tailgunner.
>
> -Dave

Yes! A tribute to the next great FURY release.

FURY

unread,
Dec 28, 2011, 5:35:59 AM12/28/11
to
> Yes! A tribute to the next great FURY release.


Thanks :)

I noticed it right away and gave you an instant "like" at youtube!

hcmffm

unread,
Dec 28, 2011, 3:10:07 PM12/28/11
to
The smooth animation looks really great, Kokovec. Another interesting
hardware project of you. How many objects (/ lines / elements / points ?)
could be animated at a time?

I like the idea of having an extra hardware for more sophisticated games and
wonder whether games could be programmed based on such an extra hardware. I
guess it will only work if ...
... costs of the extra hardware are comparatively low so that any dedicated
Vectrex player / collector could afford it.
... some developers develop games for this extra hardware
... the extra hardware really offers some extras (3D calculation, ... ?)

- Helmut




FURY

unread,
Dec 28, 2011, 3:52:31 PM12/28/11
to

Well, I've already agreed to develop for it when I first
learned about it a while back, so count me in!

VectrexMad!

unread,
Dec 28, 2011, 4:24:45 PM12/28/11
to
On Dec 28, 8:52 pm, FURY <GeoF...@aol.com> wrote:
> Well, I've already agreed to develop for it when I first
> learned about it a while back, so count me in!

Dan, this shows a lot of promise - look forward to seeing more.
Fury, that's great news.
Long live the Vectrex!

VectrexMad!
http://www.vectrex.co.uk

Kokovec

unread,
Dec 28, 2011, 7:20:32 PM12/28/11
to
Lots of work to do before it can become a viable Vectrex add-on.
Each object is limited to 256 3D points and the number of objects is
limited by available RAM for both the Vec and the adapter (about 16K
each).
I only have one adapter so it would be tough at this point for a
programmer to dev against it.
I might make another one when time permits. However the current
adapter uses a PSOC3 and I might wait for the production version of
the PSOC5. The latter micro is faster with a 32 bit ARM Cortex.
In the meantime I plan on adding a bunch of functions to assist in
both 3D and 2D program development.

K
0 new messages