Author Topic: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !  (Read 32617 times)

0 Members and 1 Guest are viewing this topic.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #15 on: March 03, 2013, 02:31:59 pm »
*.*
Holy crap, that's awesome. I'll be sure to use it to make cool stuff.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #16 on: March 03, 2013, 03:31:15 pm »
Also, if you cant think of more things that you would like have added to the axiom, say it ;)
I think that with solid walls (or polygon filling as you say) would be enough but textures would be a great addition (but it will be harder to implement I guess).
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #17 on: March 03, 2013, 03:37:04 pm »
Yeah, maybe we'll (with ben_g) do that, but first we have to get the solid surfaces working :)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #18 on: March 03, 2013, 03:55:35 pm »
Holy
That
Looks
AWESOME!
:crazy:

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #19 on: March 04, 2013, 09:53:45 am »
methinks you should add some automagic stuffs, such as an automagic running the commands in sequence for display with specified input.

Edit: there is a small with the starting coordinate plane: the Z plane is parallel to your line of sight... It should be where Y currently is, X should be where Z currently is, and Y should be where X currently is
« Last Edit: March 04, 2013, 10:38:38 am by pimathbrainiac »
I am Bach.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #20 on: March 04, 2013, 03:25:36 pm »
Will filled polygons be grayscale or will it be checkerboards like in tr1p1ea's engine??

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #21 on: March 04, 2013, 03:30:50 pm »
We'll try with greyscales (most likely 3), and if it's too ugly, we'll go with checkerboards.

@pimathbrainiac for me the 3D coordinates always were :
Code: [Select]
^ Y
|
|
|         __--> Z
|  __--
|-------------------> X

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #22 on: March 04, 2013, 03:59:04 pm »
We'll try with greyscales (most likely 3), and if it's too ugly, we'll go with checkerboards.

@pimathbrainiac for me the 3D coordinates always were :
Code: [Select]
^ Y
|
|
|         __--> Z
|  __--
|-------------------> X
Yeah, that's what he meant. People usually do this:
Code: [Select]
          ^ Z
          |
          |
          |
          |
          |-------------------> Y
     __
X <--
But as long as the code works, that is not really a problem with good documentation :)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #23 on: March 04, 2013, 04:07:16 pm »
* pimathbrainiac was confuzzled when he first programmed...

Just wanted to make things less confusing for those who learned it the way Hayleia said.
I am Bach.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #24 on: April 21, 2013, 01:42:19 pm »
Bump!

2 things:

1: May I please have a look at the source for this? I want to see it.

2: When I use this code:

Code: [Select]
.A

#Axiom(AXJH3D)

ProjVertex(1,1,5)->A

While 1
ClrDraw
Pxl-On(A^256,A/256)
DispGraph
EndIf (getKey(15))


The program just exits when I run it. Will you please create a tutorial on the usage of the Axiom?

Edit: Wait a sec. This was due to my compile settings being bad. Disregard the second bit.
« Last Edit: April 21, 2013, 01:44:04 pm by pimathbrainiac »
I am Bach.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #25 on: April 21, 2013, 03:50:35 pm »
Well, I'm on a phone right now, so if you don't want to wait until tomorrow evening of my time (in 20 hours) ask ben_g.

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #26 on: April 21, 2013, 04:10:00 pm »
Can I just post the source code in this topic?
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #27 on: April 21, 2013, 04:22:07 pm »
Yeah, please do.

Also, I think I'll let this project like it is. I overestimated myself, I realized that I had just enough knowledges to make an axiom out of already existing code. So I'll gladly let my place to whoever thinks (s)he can bring the axiom further. Maybe I'll work on it again, but later.

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #28 on: April 21, 2013, 04:36:37 pm »
Ok then. Here's the source code:
Code: [Select]
;#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, 11h, 10h, 0Eh, 0Dh, 0Bh, 0Ah, 08h, 06h, 05h, 03h, 02h
 db 00h, 0FFh, 0FEh, 0FCh, 0FBh, 0F9h, 0F8h, 0F6h, 0F4h, 0F3h, 0F1h, 0F0h, 0EFh, 0EDh, 0ECh, 0EAh
 db 0E9h, 0E7h, 0E5h, 0E4h, 0E2h, 0E1h, 0E0h, 0DFh, 0DEh, 0DCh, 0DBh, 0DAh, 0D8h, 0D7h, 0D6h, 0D5h
 db 0D3h, 0D2h, 0D2h, 0D0h, 0CFh, 0CEh, 0CDh, 0CDh, 0CBh, 0CBh, 0CAh, 0C9h, 0C9h, 0C7h, 0C7h, 0C6h
 db 0C6h, 0C5h, 0C4h, 0C4h, 0C3h, 0C3h, 0C3h, 0C2h, 0C2h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h
 db 0C0h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C1h, 0C2h, 0C2h, 0C2h, 0C3h, 0C3h, 0C4h, 0C4h, 0C5h
 db 0C5h, 0C6h, 0C6h, 0C7h, 0C8h, 0C9h, 0C9h, 0CAh, 0CBh, 0CCh, 0CDh, 0CDh, 0CFh, 0CFh, 0D1h, 0D2h
 db 0D3h, 0D4h, 0D5h, 0D7h, 0D7h, 0D9h, 0DAh, 0DBh, 0DDh, 0DEh, 0E0h, 0E1h, 0E1h, 0E3h, 0E4h, 0E6h
 db 0E7h, 0E9h, 0EBh, 0ECh, 0EEh, 0EFh, 0F0h, 0F2h, 0F3h, 0F5h, 0F6h, 0F8h, 0FAh, 0FBh, 0FDh, 0FEh
 db 00h, 01h, 02h, 04h, 05h, 07h, 08h, 0Ah, 0Ch, 0Dh, 0Fh, 10h, 11h, 13h, 14h, 16h
 db 17h, 19h, 1Bh, 1Ch, 1Eh, 1Fh, 20h, 21h, 22h, 24h, 25h, 26h, 28h, 29h, 2Ah, 2Bh
 db 2Dh, 2Eh, 2Eh, 30h, 31h, 32h, 33h, 33h, 35h, 35h, 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
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: [Axiom] AxeJH3D, a(n almost) complete axiom for 3D development !
« Reply #29 on: April 21, 2013, 05:16:00 pm »
This makes me wonder how tr1plea is doing with his game
Keep trying.