Programs: Made the 3d renderer spin the 3d model

This commit is contained in:
(Tim) Efthimis Kritikos 2024-02-16 21:55:42 +00:00
parent 7ae98d8353
commit 519c762287

View File

@ -5,25 +5,68 @@ MOV $0x00FF,%R4h
MOV $0xFFFF,%R1l MOV $0xFFFF,%R1l
MOV $0xFFFF,%R1h MOV $0xFFFF,%R1h
MOV %R1,(%R4) MOV %R1,(%R4)
MOV $0x0008,%R7l
MOV $0x0000,%R7h #The number of rotate,render itrations
:MAIN_LOOP
PUSH %R7
PUSH %R6
CALL $RENDER CALL $RENDER
MOV $>DATA_START,%R0l CALL $SPIN
MOV $<DATA_START,%R0h POP %R6
MOV (%R0),%R1 POP %R7
MOV $0x3f4c,%R4h #0.8 SUB %R6,%R7
MOV $0xcccd,%R4l JMP,NZ $MAIN_LOOP
FADD %R4,%R1
MOV %R1,(%R0)
CALL $RENDER
MOV $>DATA_START,%R0l
MOV $<DATA_START,%R0h
MOV (%R0),%R1
MOV $0x3f4c,%R4h #0.8
MOV $0xcccd,%R4l
FADD %R4,%R1
MOV %R1,(%R0)
CALL $RENDER
HALT HALT
:SPIN
MOV $>DATA_START,%R0l
MOV $<DATA_START,%R0h
MOV $0x001A,%R7l
MOV $0x0000,%R7h #The number of points (x2 lines)
MOV $0x0001,%R6l
MOV $0x0000,%R6h #constant 1
MOV $0x0004,%R5l
MOV $0x0000,%R5h #Constant 4
:SPIN_LOOP
#Read in a point R1:x R2:y R3:z
MOV (%R0),%R1
ADD %R5,%R0
MOV (%R0),%R2
ADD %R5,%R0
MOV (%R0),%R3
MOV $0x3e4c,%R4h
MOV $0xcccd,%R4l #The angle to rotate by
COS %R4
PUSH %R1
FMUL %R4, %R1
MOV $0x3e4c,%R4h
MOV $0xcccd,%R4l #The angle to rotate by
SIN %R4
FMUL %R3,%R4
FADD %R4,%R1
SUB %R5,%R0
SUB %R5,%R0
MOV %R1,(%R0)
ADD %R5,%R0
ADD %R5,%R0
MOV $0x3e4c,%R4h
MOV $0xcccd,%R4l #The angle to rotate by
SIN %R4
POP %R1
FMUL %R4,%R1
MOV $0x3e4c,%R4h
MOV $0xcccd,%R4l #The angle to rotate by
COS %R4
FMUL %R4,%R3
FSUB %R1,%R3
MOV %R3,(%R0)
ADD %R5,%R0
SUB %R6,%R7
JMP,NZ $SPIN_LOOP
:RENDER :RENDER
MOV $>DATA_START,%R0l MOV $>DATA_START,%R0l
MOV $<DATA_START,%R0h MOV $<DATA_START,%R0h
@ -54,8 +97,8 @@ ADD %R5,%R0
FSUB %R4,%R1 FSUB %R4,%R1
FSUB %R4,%R2 FSUB %R4,%R2
MOV $0x3e99,%R4h MOV $0x3f80,%R4h
MOV $0x999a,%R4l MOV $0x0000,%R4l
FADD %R4,%R3 FADD %R4,%R3
FADD %R4,%R3 FADD %R4,%R3
FADD %R4,%R1 FADD %R4,%R1
@ -78,8 +121,8 @@ ADD %R5,%R0
FSUB %R4,%R1 FSUB %R4,%R1
FSUB %R4,%R2 FSUB %R4,%R2
MOV $0x3e99,%R4h MOV $0x3f80,%R4h
MOV $0x999a,%R4l MOV $0x0000,%R4l
FADD %R4,%R3 FADD %R4,%R3
FADD %R4,%R3 FADD %R4,%R3
FADD %R4,%R1 FADD %R4,%R1
@ -102,38 +145,38 @@ RET
:DATA_START :DATA_START
#0,0,0 #0,0,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#0,0,1 #0,0,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
#0,0,0 #0,0,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#1,0,0 #1,0,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#0,0,0 #0,0,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#0,1,0 #0,1,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
@ -145,7 +188,7 @@ DDW $0x3f800000
#1,1,0 #1,1,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
@ -156,7 +199,7 @@ DDW $0x3f800000
#1,0,1 #1,0,1
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
@ -167,90 +210,90 @@ DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
#0,1,1 #0,1,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
#0,1,1 #0,1,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
#0,1,0 #0,1,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#0,1,1 #0,1,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
#0,0,1 #0,0,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
#0,1,0 #0,1,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#1,1,0 #1,1,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#0,1,0 #0,1,0
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#1,1,0 #1,1,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#0,0,1 #0,0,1
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
#1,0,1 #1,0,1
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000
#1,0,0 #1,0,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#1,1,0 #1,1,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
#1,0,0 #1,0,0
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x00000000 DDW $0xbf800000
#1,0,1 #1,0,1
DDW $0x3f800000 DDW $0x3f800000
DDW $0x00000000 DDW $0xbf800000
DDW $0x3f800000 DDW $0x3f800000