ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 1.
Hexadecimal [16-Bits]



                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Cosmic Gatlin: An Amstrad CPC Game 
                              3 ;;  Authors: 
                              4 ;;      Javier Botella Martínez (@javierbotella)
                              5 ;;      Francesc Martinez Torregrosa (@mellamofrancesc)
                              6 ;;
                              7 ;;  This program is free software: you can redistribute it and/or modify
                              8 ;;  it under the terms of the GNU Lesser General Public License as published by
                              9 ;;  the Free Software Foundation, either version 3 of the License, or
                             10 ;;  (at your option) any later version.
                             11 ;;
                             12 ;;  This program is distributed in the hope that it will be useful,
                             13 ;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
                             14 ;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                             15 ;;  GNU Lesser General Public License for more details.
                             16 ;;
                             17 ;;  You should have received a copy of the GNU Lesser General Public License
                             18 ;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
                             19 ;;------------------------------------------------------------------------------
                             20 
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 2.
Hexadecimal [16-Bits]



                             21 .include "physics.h.s"
                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Cosmic Gatlin: An Amstrad CPC Game 
                              3 ;;  Authors: 
                              4 ;;      Javier Botella Martínez (@javierbotella)
                              5 ;;      Francesc Martinez Torregrosa (@mellamofrancesc)
                              6 ;;
                              7 ;;  This program is free software: you can redistribute it and/or modify
                              8 ;;  it under the terms of the GNU Lesser General Public License as published by
                              9 ;;  the Free Software Foundation, either version 3 of the License, or
                             10 ;;  (at your option) any later version.
                             11 ;;
                             12 ;;  This program is distributed in the hope that it will be useful,
                             13 ;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
                             14 ;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                             15 ;;  GNU Lesser General Public License for more details.
                             16 ;;
                             17 ;;  You should have received a copy of the GNU Lesser General Public License
                             18 ;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
                             19 ;;------------------------------------------------------------------------------
                             20 
                             21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             22 ;;  CONSTANTS
                             23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             24 
                     0048    25 MaxX=72
                     008C    26 MaxY=140
                             27 
                             28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             29 ;;  PUBLIC FUNCTIONS
                             30 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             31 
                             32 .globl sysPhysicsUpdate
                             33 .globl sysPhysicsUpdateOne
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 3.
Hexadecimal [16-Bits]



                             22 .include "../man/entity.h.s"
                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Cosmic Gatlin: An Amstrad CPC Game 
                              3 ;;  Authors: 
                              4 ;;      Javier Botella Martínez (@javierbotella)
                              5 ;;      Francesc Martinez Torregrosa (@mellamofrancesc)
                              6 ;;
                              7 ;;  This program is free software: you can redistribute it and/or modify
                              8 ;;  it under the terms of the GNU Lesser General Public License as published by
                              9 ;;  the Free Software Foundation, either version 3 of the License, or
                             10 ;;  (at your option) any later version.
                             11 ;;
                             12 ;;  This program is distributed in the hope that it will be useful,
                             13 ;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
                             14 ;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                             15 ;;  GNU Lesser General Public License for more details.
                             16 ;;
                             17 ;;  You should have received a copy of the GNU Lesser General Public License
                             18 ;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
                             19 ;;------------------------------------------------------------------------------
                             20 
                             21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             22 ;;  CONSTANTS
                             23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             24 
                             25     ;; ENTITY INFO
                     001C    26 EntitySize=28 
                     0028    27 EntityArraySize=40
                     0460    28 EntityArrayBytesSize=EntitySize*EntityArraySize
                             29 
                     0028    30 Fila1=40
                     0050    31 Fila2=Fila1+40
                     0078    32 Fila3=Fila2+40
                             33 
                     000D    34 Offset=12+1
                             35 
                     001B    36 EFila1=Fila1-Offset
                     0043    37 EFila2=Fila2-Offset
                     006B    38 EFila3=Fila3-Offset
                             39 
                             40     ;; INDEX FOR IX/IY
                     0000    41 indType=0
                     0001    42 indX=1
                     0002    43 indY=2
                     0003    44 indVx=3
                     0004    45 indVy=4
                     0005    46 indWidth=5
                     0006    47 indHeight=6
                     0007    48 indAI2=7
                     0008    49 indAI1=8
                     0009    50 indColision2=9
                     000A    51 indColision1=10
                     000B    52 indPhysics2=11
                     000C    53 indPhysics1=12
                     000D    54 indSprite2=13
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 4.
Hexadecimal [16-Bits]



                     000E    55 indSprite1=14
                     000F    56 indPrevPos2=15
                     0010    57 indPrevPos1=16
                     0011    58 indScore=17
                     0012    59 indSubType=18
                     0013    60 indAnim2=19
                     0014    61 indAnim1=20
                     0015    62 indAnimCounter=21
                     0016    63 indAnimActual=22
                     0017    64 indActualPos2=23
                     0018    65 indActualPos1=24
                     0019    66 indAICounter=25
                     001A    67 indDelWitdh=26
                     001B    68 indDelHeight=27
                             69 
                             70     ;; ENTITY TYPES
                     0000    71 ETypeInvalid=0x00
                     0001    72 ETypeRenderable=0x01
                     0002    73 ETypeMovable=0x02
                     0004    74 ETypeInput=0x04
                     0008    75 ETypeAI=0x08
                     0010    76 ETypeColisionable=0x10
                     0020    77 ETypeColider=0x20
                     0040    78 ETypeAnimated=0x40
                     0080    79 ETypeDead=0x80
                     007F    80 ETypeDefault=0x7f
                             81 
                     0001    82 AITypeEnemy=0x01
                     0002    83 AITypePU=0x02
                     0004    84 AITypeBullet=0x04
                     0008    85 AITypeInmortal=0x08
                             86 
                     0010    87 RenderTypeStatic=0x10
                             88 
                             89 
                             90 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             91 ;;  PUBLIC FUNCTIONS
                             92 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             93 
                             94 .globl manEntityInit
                             95 .globl manEntityCreate
                             96 .globl manEntityDestroy
                             97 .globl manEntityMarkToDestroy
                             98 .globl manEntityDestroyDead
                             99 .globl manEntityForAll
                            100 .globl manEntityForAllMatching
                            101 .globl getFreeSpace
                            102 .globl getNextFreeEntity
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 5.
Hexadecimal [16-Bits]



                             23 
                             24 
                             25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             26 ;; sysPhysicsUpdateOne
                             27 ;; Requisitos:
                             28 ;;    ix -> Posicion inicial de memoria de la entidad
                             29 ;; Return:
                             30 ;;    -
                             31 ;; Descripcion:
                             32 ;;    Modifica las entidades que son movibles segun su vx y vy
   7645                      33 sysPhysicsUpdateOne::
                             34 
                             35         ;; Mover x
                             36 
   7645 DD 7E 01      [19]   37     ld a, indX(ix)
   7648 DD 46 03      [19]   38     ld b, indVx(ix)
   764B 80            [ 4]   39     add a, b
                             40 
   764C F5            [11]   41     push af
   764D 3E 48         [ 7]   42     ld a, #MaxX
   764F D1            [10]   43     pop de  
   7650 BA            [ 4]   44     cp d
                             45 
   7651 DA 68 76      [10]   46     jp c, destroy       ;; Si sale por la der, se marca para destruir
                             47 
   7654 DD 72 01      [19]   48     ld indX(ix), d
                             49 
                             50         ;; Mover y
                             51 
   7657 DD 7E 02      [19]   52     ld a, indY(ix)
   765A DD 46 04      [19]   53     ld b, indVy(ix)
   765D 80            [ 4]   54     add a, b
                             55 
   765E 0E 8C         [ 7]   56     ld c, #MaxY
                             57 
                             58     ;; a = y + vy
                             59 
                             60     ;;  Por arriba
                             61     
   7660 3D            [ 4]   62     dec a
   7661 B9            [ 4]   63     cp c
                             64     
   7662 D0            [11]   65     ret nc
                             66  
   7663 3C            [ 4]   67     inc a
   7664 DD 77 02      [19]   68     ld indY(ix), a
                             69 
   7667 C9            [10]   70     ret
                             71 
   7668                      72 destroy:
                             73 
   7668 DD 66 0C      [19]   74     ld h, indPhysics1(ix)
   766B DD 6E 0B      [19]   75     ld l, indPhysics2(ix)
                             76     
   766E 01 73 76      [10]   77     ld bc, #salirPhysics
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 6.
Hexadecimal [16-Bits]



   7671 C5            [11]   78     push bc
                             79 
   7672 E9            [ 4]   80     jp (hl)
                             81 
   7673                      82     salirPhysics:
                             83 
   7673 C9            [10]   84 ret
                             85 
                             86 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             87 ;; sysPhysicsUpdate
                             88 ;; Requisitos:
                             89 ;;    -
                             90 ;; Return:
                             91 ;;    -
                             92 ;; Descripcion:
                             93 ;;    Inversion de control para la modificacion de posicion de todas las entidades.
   7674                      94 sysPhysicsUpdate::
                             95 
   7674 21 45 76      [10]   96     ld hl, #sysPhysicsUpdateOne
   7677 3E 02         [ 7]   97     ld a, #ETypeMovable
   7679 CD 2F 71      [17]   98     call manEntityForAll
                             99 
   767C C9            [10]  100 ret
