Ok then. Here's the source code:
;#SECTION "MAIN", CODE
.nolist
#include "ti83plus.inc"
.list
sub_Axiom2 equ 3F61h
AX equ OP1
AY equ AX + 1
AZ equ AY + 1
BX equ AZ + 1
BY equ BX + 1
BZ equ BY + 1
CX equ BZ + 1
CY equ CX + 1
CZ equ CY + 1
dw 0C0DEh
; CalcRotMatrix
; Calculates the rotation
; matrix relative to 3 angles
dw CalcRotMatrixEnd + 34
db 00111111b
db 0BBh, 0Ah ; randInt(
db 1
db 3
; HL = Z angle
; Stack : Y angle, X angle ,ret
rorg 0
ld c, l
pop hl
pop de
ld a, e
pop de
ld b, e
push hl
; jh_CalcRotationMatrix:
di
ld d, c
ld c, b
ld b, a
; b, c, d
; ax = (sin(- b + c + d) + sin(b -
; c + d) + sin(b + c - d) + sin(- b
; - c - d) + 2*(cos(c - d) +
; cos(c + d)))/4
ld a, c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld l, a
rla
sbc a, a
ld h, a
; cos(c - d)
exx
ld a, c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(c + d)
add hl, bc
add hl, hl
exx
ld a, c
sub b
add a, d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(- b + c + d)
add hl, bc
exx
ld a, b
sub c
add a, d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b - c + d)
add hl, bc
exx
ld a, b
add a, c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b + c - d)
add hl, bc
exx
xor a
sub b
sub c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(- b - c - d)
add hl, bc
ld a, l
rr h
rra
rr h
rra
ld (AX), a
; ay = (sin(- b + d) + sin(b +
; d))/2
exx
ld a, d
sub b
db 7Fh
rorg $ - 1
call _GetSin
exx
ld l, a
rla
sbc a, a
ld h, a
; sin(- b + d)
exx
ld a, b
add a, d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b + d)
add hl, bc
ld a, l
rr h
rra
ld (AY), a
; az = (cos(b - c - d) + cos(b -
; c + d + $80) + cos(b + c - d) +
; cos(b + c + d + $80) +
; 2*(sin(- c + d) + sin(- c -
; d)))/4
exx
ld a, d
sub c
db 7Fh
rorg $ - 1
call _GetSin
exx
ld l, a
rla
sbc a, a
ld h, a
; sin(- c + d)
exx
xor a
sub c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(- c - d)
add hl, bc
add hl, hl
exx
ld a, b
sub c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; (cos(b - c - d)
add hl, bc
exx
ld a, 80h
add a, b
sub c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b - c + d + $80)
add hl, bc
exx
ld a, b
add a, c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + c - d)
add hl, bc
exx
ld a, 80h
add a, b
add a, c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + c + d + $80)
add hl, bc
ld a, l
rr h
rra
rr h
rra
ld (AZ), a
; bx = (cos(b - c - d) + cos(b -
; c + d) + cos(b + c - d + $80) +
; cos(b + c + d + $80) +
; 2*(sin(c - d) + sin(- c -
; d)))/4
exx
ld a, c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld l, a
rla
sbc a, a
ld h, a
; sin(c - d)
exx
xor a
sub c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(- c - d)
add hl, bc
add hl, hl
exx
ld a, b
sub c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b - c - d)
add hl, bc
exx
ld a, b
sub c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b - c + d)
add hl, bc
exx
ld a, 80h
add a, b
add a, c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + c - d + $80)
add hl, bc
exx
ld a, 80h
add a, b
add a, c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + c + d + $80)
add hl, bc
ld a, l
rr h
rra
rr h
rra
ld (BX), a
; by = (cos(b - d) + cos(b +
; d))/2
exx
ld a, b
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld l, a
rla
sbc a, a
ld h, a
; cos(b - d)
exx
ld a, b
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + d)
add hl, bc
ld a, l
rr h
rra
ld (BY), a
; bz = (sin(b - c - d) + sin(b - c
; + d) + sin(b + c - d) + sin(b + c
; + d) + 2*(cos(c - d) + cos(c
; + d + $80)))/4
exx
ld a, c
sub d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld l, a
rla
sbc a, a
ld h, a
; cos(c - d)
exx
ld a, 80h
add a, c
add a, d
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(c + d + $80)
add hl, bc
add hl, hl
exx
ld a, b
sub c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b - c - d)
add hl, bc
exx
ld a, b
sub c
add a, d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b - c + d)
add hl, bc
exx
ld a, b
add a, c
sub d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b + c - d)
add hl, bc
exx
ld a, b
add a, c
add a, d
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b + c + d)
add hl, bc
ld a, l
rr h
rra
rr h
rra
ld (BZ), a
; cx = (sin(- b + c) + sin(b +
; c))/2
exx
ld a, c
sub b
db 7Fh
rorg $ - 1
call _GetSin
exx
ld l, a
rla
sbc a, a
ld h, a
; sin(- b + c)
exx
ld a, b
add a, c
db 7Fh
rorg $ - 1
call _GetSin
exx
ld c, a
rla
sbc a, a
ld b, a
; sin(b + c)
add hl, bc
ld a, l
rr h
rra
ld (CX), a
; cy = sin(- b)
exx
xor a
sub b
db 7Fh
rorg $ - 1
call _GetSin
exx
ld (CY), a
; cz = (cos(b - c) + cos(b +
; c))/2
exx
ld a, b
sub c
db 7Fh
rorg $ - 1
call _GetCos
exx
ld l, a
rla
sbc a, a
ld h, a
; cos(b - c)
exx
ld a, b
add a, c
db 7Fh
rorg $ - 1
call _GetCos
exx
ld c, a
rla
sbc a, a
ld b, a
; cos(b + c)
add hl, bc
ld a, l
rr h
rra
ld (CZ), a
ei
ret
_GetSin:
sub 40h
_GetCos:
db 7Fh
rorg $ - 1
ld hl, sub_Axiom2
add a, l
ld l, a
ld a, 0
adc a, h
ld h, a
ld a, (hl)
ret
CalcRotMatrixEnd:
; CoSineTable
dw CoSineTableEnd
db 00111111b
db 0, 0 ; not callable
db 00010000b
db 0
rorg 0
db 40h, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Eh, 3Eh, 3Eh, 3Dh, 3Dh, 3Ch, 3Ch, 3Bh
db 3Bh, 3Ah, 3Ah, 39h, 38h, 37h, 37h, 36h, 35h, 34h, 33h, 33h, 31h, 31h, 2Fh, 2Eh
db 2Dh, 2Ch, 2Bh, 29h, 29h, 27h, 26h, 25h, 23h, 22h, 20h, 1Fh, 1Fh, 1Dh, 1Ch, 1Ah
db 19h, 17h, 15h, 14h, 12h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 36h, 37h, 37h, 39h, 39h, 3Ah
db 3Ah, 3Bh, 3Ch, 3Ch, 3Dh, 3Dh, 3Dh, 3Eh, 3Eh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh, 3Fh
CoSineTableEnd:
;
; RotVertex
; Rotate the given vertex
; with the matrix calculated
; with a previous call to
; CalcRotMatrix
dw RotVertexEnd + 32
db 00111111b
db 0BBh, 1Fh ; randNorm(
db 1
db 4
; HL = output area
; Stack : X, Y, Z coordinate,ret
rorg 0
pop af
pop de
pop bc
push af
ex (sp), hl
pop af
ex (sp), hl
push af
; jh_RotateVertex:
db 7Fh
rorg $ - 1
ld (x3d), hl
db 7Fh
rorg $ - 1
ld (y3d), bc
db 7Fh
rorg $ - 1
ld (z3d), de
ld a, (AX)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (y3d)
ld a, (AY)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (z3d)
ld a, (AZ)
db 7Fh
rorg $ - 1
call _iMulAbyHL
pop de
pop bc
add hl, de
adc a, b
pop de
pop bc
add hl, de
adc a, b
db 7Fh
rorg $ - 1
call _iDivAHLby64
db 7Fh
rorg $ - 1
ld (nx3d + 1), hl
db 7Fh
rorg $ - 1
ld hl, (x3d)
ld a, (BX)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (y3d)
ld a, (BY)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (z3d)
ld a, (BZ)
db 7Fh
rorg $ - 1
call _iMulAbyHL
pop de
pop bc
add hl, de
adc a, b
pop de
pop bc
add hl, de
adc a, b
db 7Fh
rorg $ - 1
call _iDivAHLby64
db 7Fh
rorg $ - 1
ld (ny3d + 1), hl
db 7Fh
rorg $ - 1
ld hl, (x3d)
ld a, (CX)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (y3d)
ld a, (CY)
db 7Fh
rorg $ - 1
call _iMulAbyHL
push af
push hl
db 7Fh
rorg $ - 1
ld hl, (z3d)
ld a, (CZ)
db 7Fh
rorg $ - 1
call _iMulAbyHL
pop de
pop bc
add hl, de
adc a, b
pop de
pop bc
add hl, de
adc a, b
db 7Fh
rorg $ - 1
call _iDivAHLby64
ex de, hl
nx3d:
ld hl, 0
ny3d:
ld bc, 0
;
ex de, hl
ex (sp), hl
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (hl), c
inc hl
ld (hl), b
inc hl
pop de
ld (hl), e
inc hl
ld (hl), d
ret
_iMulAbyHL:
ld de, 0
ld b, d
ld c, e
ex de, hl
cp 80h
jr c, noNegA
neg
inc b
noNegA:
bit 7, d
jr z, noNegDE
or a
sbc hl, de
ex de, hl
ld h, c
ld l, c
dec b
noNegDE:
add a, a
jr nc, $ + 4
ld h, d
ld l, e
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
db 7Fh
rorg $ - 1
call mulOP
rr b
ret nc
ld b, a
ld d, c
ld e, c
xor a
ex de, hl
sbc hl, de
sbc a, b
ret
_iDivAHLby64:
ld b, l
add hl, hl
adc a, a
add hl, hl
adc a, a
ld l, h
ld h, a
rla
ret nc
bit 0, b
ret z
inc hl
ret
mulOP:
add hl, hl
rla
jr nc, $ + 4
add hl, de
adc a, c
ret
x3d:
dw 0
y3d:
dw 0
z3d:
dw 0
RotVertexEnd:
; ProjectVertex
; Converts the 3D
; coordinates into 2D ones
dw ProjectVertexEnd + 26
db 00111111b
db 0BBh, 0Bh ; randBin(
db 1
db 3
; HL = Z coordinate
; Stack : X,Y coordinate,ret
rorg 0
pop af
push hl
pop de
pop bc
pop hl
push af
; jh_ProjectVertex:
ld a, d
or e
ret z
bit 7, d
ret nz
push bc
push de
ld a, h
rla
sbc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
ld b, a
ld d, h
ld e, l
add hl, hl
adc a, a
add hl, de
adc a, b
pop de
push de
db 7Fh
rorg $ - 1
call _iDivAHLbyDE
ld de, 96 / 2
add hl, de
adc a, 0
pop de
pop bc
push af
push hl
ld h, b
ld l, c
push de
ld a, h
rla
sbc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
add hl, hl
adc a, a
ld b, a
ld d, h
ld e, l
add hl, hl
adc a, a
add hl, de
adc a, b
pop de
db 7Fh
rorg $ - 1
call _iDivAHLbyDE
ld de, 64 / 2
add hl, de
adc a, 0
ld b, a
ex de, hl
pop hl
pop af
ld h, e
ret
_iDivAHLbyDE:
ld b, h
ld c, l
ld hl, 0
cp 80h
push af
jr c, noNegABC
sbc hl, bc
ld b, h
ld c, l
ld h, 0
ld l, a
ld a, h
sbc a, l
ld l, h
noNegABC:
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
db 7Fh
rorg $ - 1
call divOP
ld h, b
ld l, c
ld e, a
pop af
ld a, e
ret c
xor a
ld h, a
ld l, a
sbc hl, bc
sbc a, e
ret
divOP:
; SLL C
db 0CBh, 31h
rl b
rla
adc hl, hl
sbc hl, de
jr nc, $ + 4
add hl, de
dec c
ret
ProjectVertexEnd:
dw 00h
;
dw 03BEh
db 9
db "CalcMtrx("
dw 03E8h
db 9
db "RotVertx("
dw 03C0h
db 10
db "ProjVertx("
.end
.end