2024-02-16 18:11:58 +00:00
|
|
|
MOV $0xFF0000,%SP
|
|
|
|
#Set up vector mode
|
|
|
|
MOV $0xFFFC,%R4l
|
|
|
|
MOV $0x00FF,%R4h
|
|
|
|
MOV $0xFFFF,%R1l
|
|
|
|
MOV $0xFFFF,%R1h
|
|
|
|
MOV %R1,(%R4)
|
2024-02-16 21:55:42 +00:00
|
|
|
MOV $0x0008,%R7l
|
|
|
|
MOV $0x0000,%R7h #The number of rotate,render itrations
|
|
|
|
:MAIN_LOOP
|
|
|
|
PUSH %R7
|
|
|
|
PUSH %R6
|
2024-02-16 18:11:58 +00:00
|
|
|
CALL $RENDER
|
2024-02-16 21:55:42 +00:00
|
|
|
CALL $SPIN
|
|
|
|
POP %R6
|
|
|
|
POP %R7
|
|
|
|
SUB %R6,%R7
|
|
|
|
JMP,NZ $MAIN_LOOP
|
|
|
|
HALT
|
|
|
|
|
|
|
|
:SPIN
|
2024-02-16 19:12:03 +00:00
|
|
|
MOV $>DATA_START,%R0l
|
|
|
|
MOV $<DATA_START,%R0h
|
2024-02-16 21:55:42 +00:00
|
|
|
MOV $0x001A,%R7l
|
|
|
|
MOV $0x0000,%R7h #The number of points (x2 lines)
|
|
|
|
MOV $0x0004,%R5l
|
|
|
|
MOV $0x0000,%R5h #Constant 4
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV $0x0008,%R2l
|
|
|
|
MOV $0x0000,%R2h #Constant 8
|
2024-03-01 21:00:22 +00:00
|
|
|
MOV $0x3ccc,%R6h
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV $0xcccd,%R6l #The angle to rotate by
|
2024-02-16 21:55:42 +00:00
|
|
|
:SPIN_LOOP
|
2024-02-17 20:43:41 +00:00
|
|
|
#Read in a point R1:x R3:z
|
2024-02-16 19:12:03 +00:00
|
|
|
MOV (%R0),%R1
|
2024-02-17 20:43:41 +00:00
|
|
|
ADD %R2,%R0
|
2024-02-16 21:55:42 +00:00
|
|
|
MOV (%R0),%R3
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV %R6,%R4
|
2024-02-16 21:55:42 +00:00
|
|
|
COS %R4
|
|
|
|
PUSH %R1
|
|
|
|
FMUL %R4, %R1
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV %R6,%R4
|
2024-02-16 21:55:42 +00:00
|
|
|
SIN %R4
|
|
|
|
FMUL %R3,%R4
|
2024-02-16 19:12:03 +00:00
|
|
|
FADD %R4,%R1
|
2024-02-17 20:43:41 +00:00
|
|
|
SUB %R2,%R0
|
2024-02-16 19:12:03 +00:00
|
|
|
MOV %R1,(%R0)
|
2024-02-17 20:43:41 +00:00
|
|
|
ADD %R2,%R0
|
|
|
|
MOV %R6,%R4
|
2024-02-16 21:55:42 +00:00
|
|
|
SIN %R4
|
|
|
|
POP %R1
|
|
|
|
FMUL %R4,%R1
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV %R6,%R4
|
2024-02-16 21:55:42 +00:00
|
|
|
COS %R4
|
|
|
|
FMUL %R4,%R3
|
|
|
|
FSUB %R1,%R3
|
|
|
|
MOV %R3,(%R0)
|
|
|
|
ADD %R5,%R0
|
|
|
|
|
2024-02-17 20:43:41 +00:00
|
|
|
DEC %R7
|
2024-02-16 21:55:42 +00:00
|
|
|
JMP,NZ $SPIN_LOOP
|
|
|
|
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
:RENDER
|
|
|
|
MOV $>DATA_START,%R0l
|
|
|
|
MOV $<DATA_START,%R0h
|
|
|
|
MOV $0x000D,%R7l
|
|
|
|
MOV $0x0000,%R7h
|
|
|
|
MOV $0x0004,%R5l
|
|
|
|
MOV $0x0000,%R5h
|
2024-02-16 19:12:03 +00:00
|
|
|
MOV $0xFFFC,%R4l
|
|
|
|
MOV $0x00FF,%R4h
|
|
|
|
MOV $0x0002,%R1l
|
|
|
|
MOV $0x0000,%R1h #Clear the frame
|
|
|
|
MOV %R1,(%R4)
|
2024-02-17 20:43:41 +00:00
|
|
|
MOV $0x3f80,%R6h
|
|
|
|
MOV $0x0000,%R6l
|
|
|
|
MOV $0xFFFC,%R4l
|
|
|
|
MOV $0x00FF,%R4h
|
|
|
|
|
2024-02-16 18:11:58 +00:00
|
|
|
:RENDER_LOOP
|
|
|
|
MOV $0xFFFF,%R1l
|
|
|
|
MOV $0xFFFF,%R1h
|
|
|
|
MOV %R1,(%R4)
|
|
|
|
#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
|
|
|
|
ADD %R5,%R0
|
2024-02-17 20:43:41 +00:00
|
|
|
FSUB %R6,%R1
|
|
|
|
FSUB %R6,%R2
|
2024-02-16 18:11:58 +00:00
|
|
|
|
2024-02-17 20:43:41 +00:00
|
|
|
FADD %R6,%R3
|
|
|
|
FADD %R6,%R3
|
|
|
|
FADD %R6,%R1
|
|
|
|
FADD %R6,%R2
|
2024-02-16 18:11:58 +00:00
|
|
|
FDIV %R3,%R1
|
|
|
|
FDIV %R3,%R2
|
|
|
|
MOV %R1,(%R4)
|
|
|
|
MOV %R2,(%R4)
|
|
|
|
|
|
|
|
MOV (%R0),%R1
|
|
|
|
ADD %R5,%R0
|
|
|
|
MOV (%R0),%R2
|
|
|
|
ADD %R5,%R0
|
|
|
|
MOV (%R0),%R3
|
|
|
|
ADD %R5,%R0
|
2024-02-17 20:43:41 +00:00
|
|
|
FSUB %R6,%R1
|
|
|
|
FSUB %R6,%R2
|
2024-02-16 18:11:58 +00:00
|
|
|
|
2024-02-17 20:43:41 +00:00
|
|
|
FADD %R6,%R3
|
|
|
|
FADD %R6,%R3
|
|
|
|
FADD %R6,%R1
|
|
|
|
FADD %R6,%R2
|
2024-02-16 18:11:58 +00:00
|
|
|
FDIV %R3,%R1
|
|
|
|
FDIV %R3,%R2
|
|
|
|
MOV %R1,(%R4)
|
|
|
|
MOV %R2,(%R4)
|
|
|
|
|
2024-02-17 20:43:41 +00:00
|
|
|
DEC %R7
|
2024-02-16 18:11:58 +00:00
|
|
|
JMP,NZ $RENDER_LOOP
|
2024-02-16 19:12:03 +00:00
|
|
|
MOV $0x0003,%R1l
|
|
|
|
MOV $0x0000,%R1h #Display the frame
|
|
|
|
MOV %R1,(%R4)
|
|
|
|
RET
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:DATA_START
|
|
|
|
#0,0,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#0,0,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,0,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#1,0,0
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,0,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#0,1,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#1,1,1
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#1,1,0
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#1,1,1
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#1,0,1
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#1,1,1
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#0,1,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,1,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#0,1,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,1,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#0,0,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,1,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#1,1,0
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,1,0
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#1,1,0
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#0,0,1
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
#1,0,1
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#1,0,0
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#1,1,0
|
|
|
|
DDW $0x3f800000
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#1,0,0
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
|
|
|
|
#1,0,1
|
|
|
|
DDW $0x3f800000
|
2024-02-16 21:55:42 +00:00
|
|
|
DDW $0xbf800000
|
2024-02-16 18:11:58 +00:00
|
|
|
DDW $0x3f800000
|