Programs: Improved the 3d rendering code but this yielded only a marginal increase in fps

This commit is contained in:
(Tim) Efthimis Kritikos 2024-02-17 20:43:41 +00:00
parent a031119272
commit 184cba5adf

View File

@ -23,47 +23,40 @@ MOV $>DATA_START,%R0l
MOV $<DATA_START,%R0h MOV $<DATA_START,%R0h
MOV $0x001A,%R7l MOV $0x001A,%R7l
MOV $0x0000,%R7h #The number of points (x2 lines) MOV $0x0000,%R7h #The number of points (x2 lines)
MOV $0x0001,%R6l
MOV $0x0000,%R6h #constant 1
MOV $0x0004,%R5l MOV $0x0004,%R5l
MOV $0x0000,%R5h #Constant 4 MOV $0x0000,%R5h #Constant 4
MOV $0x0008,%R2l
MOV $0x0000,%R2h #Constant 8
MOV $0x3e4c,%R6h
MOV $0xcccd,%R6l #The angle to rotate by
:SPIN_LOOP :SPIN_LOOP
#Read in a point R1:x R2:y R3:z #Read in a point R1:x R3:z
MOV (%R0),%R1 MOV (%R0),%R1
ADD %R5,%R0 ADD %R2,%R0
MOV (%R0),%R2
ADD %R5,%R0
MOV (%R0),%R3 MOV (%R0),%R3
MOV $0x3e4c,%R4h MOV %R6,%R4
MOV $0xcccd,%R4l #The angle to rotate by
COS %R4 COS %R4
PUSH %R1 PUSH %R1
FMUL %R4, %R1 FMUL %R4, %R1
MOV $0x3e4c,%R4h MOV %R6,%R4
MOV $0xcccd,%R4l #The angle to rotate by
SIN %R4 SIN %R4
FMUL %R3,%R4 FMUL %R3,%R4
FADD %R4,%R1 FADD %R4,%R1
SUB %R5,%R0 SUB %R2,%R0
SUB %R5,%R0
MOV %R1,(%R0) MOV %R1,(%R0)
ADD %R5,%R0 ADD %R2,%R0
ADD %R5,%R0 MOV %R6,%R4
MOV $0x3e4c,%R4h
MOV $0xcccd,%R4l #The angle to rotate by
SIN %R4 SIN %R4
POP %R1 POP %R1
FMUL %R4,%R1 FMUL %R4,%R1
MOV $0x3e4c,%R4h MOV %R6,%R4
MOV $0xcccd,%R4l #The angle to rotate by
COS %R4 COS %R4
FMUL %R4,%R3 FMUL %R4,%R3
FSUB %R1,%R3 FSUB %R1,%R3
MOV %R3,(%R0) MOV %R3,(%R0)
ADD %R5,%R0 ADD %R5,%R0
SUB %R6,%R7 DEC %R7
JMP,NZ $SPIN_LOOP JMP,NZ $SPIN_LOOP
@ -72,8 +65,6 @@ MOV $>DATA_START,%R0l
MOV $<DATA_START,%R0h MOV $<DATA_START,%R0h
MOV $0x000D,%R7l MOV $0x000D,%R7l
MOV $0x0000,%R7h MOV $0x0000,%R7h
MOV $0x0001,%R6l
MOV $0x0000,%R6h
MOV $0x0004,%R5l MOV $0x0004,%R5l
MOV $0x0000,%R5h MOV $0x0000,%R5h
MOV $0xFFFC,%R4l MOV $0xFFFC,%R4l
@ -81,60 +72,53 @@ MOV $0x00FF,%R4h
MOV $0x0002,%R1l MOV $0x0002,%R1l
MOV $0x0000,%R1h #Clear the frame MOV $0x0000,%R1h #Clear the frame
MOV %R1,(%R4) MOV %R1,(%R4)
MOV $0x3f80,%R6h
MOV $0x0000,%R6l
MOV $0xFFFC,%R4l
MOV $0x00FF,%R4h
:RENDER_LOOP :RENDER_LOOP
MOV $0xFFFF,%R1l MOV $0xFFFF,%R1l
MOV $0xFFFF,%R1h MOV $0xFFFF,%R1h
MOV %R1,(%R4) MOV %R1,(%R4)
#Read in a point R1:x R2:y R3:z #Read in a point R1:x R2:y R3:z
MOV $0x3f4c,%R4h #0.8
MOV $0xcccd,%R4l
MOV (%R0),%R1 MOV (%R0),%R1
ADD %R5,%R0 ADD %R5,%R0
MOV (%R0),%R2 MOV (%R0),%R2
ADD %R5,%R0 ADD %R5,%R0
MOV (%R0),%R3 MOV (%R0),%R3
ADD %R5,%R0 ADD %R5,%R0
FSUB %R4,%R1 FSUB %R6,%R1
FSUB %R4,%R2 FSUB %R6,%R2
MOV $0x3f80,%R4h FADD %R6,%R3
MOV $0x0000,%R4l FADD %R6,%R3
FADD %R4,%R3 FADD %R6,%R1
FADD %R4,%R3 FADD %R6,%R2
FADD %R4,%R1
FADD %R4,%R2
FDIV %R3,%R1 FDIV %R3,%R1
FDIV %R3,%R2 FDIV %R3,%R2
MOV $0xFFFC,%R4l
MOV $0x00FF,%R4h
MOV %R1,(%R4) MOV %R1,(%R4)
MOV %R2,(%R4) MOV %R2,(%R4)
MOV $0x3f4c,%R4h #0.8
MOV $0xcccd,%R4l
MOV (%R0),%R1 MOV (%R0),%R1
ADD %R5,%R0 ADD %R5,%R0
MOV (%R0),%R2 MOV (%R0),%R2
ADD %R5,%R0 ADD %R5,%R0
MOV (%R0),%R3 MOV (%R0),%R3
ADD %R5,%R0 ADD %R5,%R0
FSUB %R4,%R1 FSUB %R6,%R1
FSUB %R4,%R2 FSUB %R6,%R2
MOV $0x3f80,%R4h FADD %R6,%R3
MOV $0x0000,%R4l FADD %R6,%R3
FADD %R4,%R3 FADD %R6,%R1
FADD %R4,%R3 FADD %R6,%R2
FADD %R4,%R1
FADD %R4,%R2
FDIV %R3,%R1 FDIV %R3,%R1
FDIV %R3,%R2 FDIV %R3,%R2
MOV $0xFFFC,%R4l
MOV $0x00FF,%R4h
MOV %R1,(%R4) MOV %R1,(%R4)
MOV %R2,(%R4) MOV %R2,(%R4)
SUB %R6,%R7 DEC %R7
JMP,NZ $RENDER_LOOP JMP,NZ $RENDER_LOOP
MOV $0x0003,%R1l MOV $0x0003,%R1l
MOV $0x0000,%R1h #Display the frame MOV $0x0000,%R1h #Display the frame