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



                              1 ;; MIT License
                              2 ;; 
                              3 ;; Copyright (c) 2021 capAI / Aitana Devis  Ávila (@AitanaDevis) / Carlos Peñarrubia Morcillo  (@carlospm12) / Pablo Ruiz Ponce (@pabloruizp)
                              4 ;; 
                              5 ;; Permission is hereby granted, free of charge, to any person obtaining a copy
                              6 ;; of this software and associated documentation files (the "Software"), to deal
                              7 ;; in the Software without restriction, including without limitation the rights
                              8 ;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
                              9 ;; copies of the Software, and to permit persons to whom the Software is
                             10 ;; furnished to do so, subject to the following conditions:
                             11 ;; 
                             12 ;; The above copyright notice and this permission notice shall be included in all
                             13 ;; copies or substantial portions of the Software.
                             14 ;; 
                             15 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
                             16 ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                             17 ;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
                             18 ;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                             19 ;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
                             20 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
                             21 ;; SOFTWARE.
                             22 
                             23 ;;/////////////////////
                             24 ;; CONSTANS AND GLOBALS
                             25 ;;/////////////////////
                             26 
                             27 .globl cpct_memcpy_asm
                             28 
                     00AA    29 NIVEL_SUELO = #170
                     0010    30 P_H_INITIAL = #16
                     0000    31 nullptr = #0x00
                     FFFFFFFF    32 GRAVITY = #-1
                             33 
                             34 
                             35 ;;/////////////////////
                             36 ;; PLAYER DEFINITION
                             37 ;;/////////////////////
                             38 
                             39 ;;; MACRO FOR DEFINING A PLAYER 
                             40 
                             41 .macro DefinePlayer _NAME, P_X, P_Y, P_W, P_H, P_JUMP, P_PREV, P_VY, P_JUMP_COUNTER, P_STATE, P_SPR, P_ANIM, P_ANIM_STATE, P_ANIM_COUNTER, P_PREV_POINTER1, P_PREV_POINTER2
                             42 _NAME::
                             43     .db P_X
                             44     .db P_Y
                             45     .db P_W
                             46     .db P_H
                             47     .db P_JUMP ;;if its jumping
                             48     .dw P_PREV
                             49     .db P_VY
                             50     .db P_JUMP_COUNTER ;;if its jumping
                             51     .db P_STATE ;;0 if standing, 1 if crouched (agachado)
                             52     .dw P_SPR ;;puntero al sprite
                             53     .dw P_ANIM ;;puntero a la animación 
                             54     .db P_ANIM_STATE
                             55     .db P_ANIM_COUNTER
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 2.
Hexadecimal [16-Bits]



                             56     .dw P_PREV_POINTER1
                             57     .dw P_PREV_POINTER2
                             58 .endm
                             59 
                     000A    60 defaultFrames == 10 ;;animation duration frames
                             61 
                             62 .globl _player
                     0004    63 BASE_WIDTH_PLAYER = 4
                             64 
                     0000    65 P_X = 0 
                     0001    66 P_Y = 1 
                     0002    67 P_W = 2 
                     0003    68 P_H = 3 
                     0004    69 P_JUMP = 4       ;; VARIABLE PARA COMPROBAR SI ESTA EN EL AIRE
                     0005    70 P_PREV = 5      ;;(2) check if still alive
                     0007    71 P_VY = 7
                     0008    72 P_JUMP_COUNTER = 8
                     0009    73 P_STATE = 9        ;; 0 si está de pie, 1 si está agachado
                     000A    74 P_SPR = 10 ;;(2)
                     000C    75 P_ANIM = 12 ;;(2)
                     000E    76 P_ANIM_STATE = 14
                     000F    77 P_ANIM_COUNTER = 15
                     0010    78 P_PREV_POINTER1 = 16
                     0012    79 P_PREV_POINTER2 = 18
                             80 
                     0014    81 SIZE_PLAYER = 20
                             82 
                             83 ;;/////////////////////
                             84 ;; ENTITY DEFINITION
                             85 ;;/////////////////////
                             86 .macro DefineEntity E_TIPO, E_COMPONENTE, E_X, E_Y, E_OFFSET_L, E_OFFSET_H, E_W, E_H, E_PREV, E_SPR, E_AI_COUNTER 
                             87     .db E_TIPO
                             88     .db E_COMPONENTE
                             89     .db E_X
                             90     .db E_Y
                             91     .db E_OFFSET_L
                             92     .db E_OFFSET_H
                             93     .db E_W 
                             94     .db E_H
                             95     .dw E_PREV 
                             96     .dw E_SPR
                             97     .db E_AI_COUNTER
                             98 .endm
                             99 
                     0000   100 E_TIPO = 0
                     0001   101 E_COMPONENTE = 1
                            102 ;; COMPONENTE 1 (IA)
                            103 ;; COMPONENTE 2 (NO-RENDER)
                     0002   104 E_X = 2
                     0003   105 E_Y = 3
                     0004   106 E_OFFSET_L = 4           ;; (2)
                     0005   107 E_OFFSET_H = 5
                     0006   108 E_W = 6
                     0007   109 E_H = 7
                     0008   110 E_PREV = 8            ;; (2) indicates whether there's AI or not
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 3.
Hexadecimal [16-Bits]



                     000A   111 E_SPR_L = 10        ;;sprite pointer (2)
                     000B   112 E_SPR_H = 11
                     000C   113 E_AI_COUNTER = 12
                            114 
                            115 
                     000D   116 SIZE_ENTITY = 13 
                            117 
                            118 
                            119 ;; POR ULTIMO HAY QUE AÑADIR UN ENTERO QUE FUNCIONE COMO MASCARA PARA DETECTAR COLISIONES
                            120 ;; ESTE ATRIBUTO NOS INDICA CONTRA QUE TIPOS COLISIONO
                            121 
                            122 
                     0000   123 E_TYPE_INVALID = #0x00
                     0001   124 E_TYPE_DEAD = #0x01
                     0002   125 E_TYPE_DEFAULT = #0x02
                            126 
                     0001   127 E_CMP_RENDER = #0x01      ;; ENTIDAD SIN MOVIMIENTO
                     0002   128 E_CMP_MOVABLE = #0x02     ;; ENTIDAD QUE SE MUEVE POR PANTALLA
                     0020   129 E_CMP_COLLIDER = #0x20     ;; DEFINE SI EN ESTA ENTIDAD HAY QUE COMPROBAR COLISIONES
                     007F   130 E_CMP_DEFAULT = #0x7F
                            131 
                            132 ;;/////////////////////
                            133 ;;      MAPAS
                            134 ;;/////////////////////
                     009C   135 SIZE_MAPA_1 = #SIZE_ENTITY*12 
                            136 .globl _mapa1
                            137 
                     0179   138 SIZE_MAPA_2 = #SIZE_ENTITY*29
                            139 .globl _mapa2
                            140 
                     0111   141 SIZE_MAPA_3 = #SIZE_ENTITY*21  
                            142 .globl _mapa3
                            143 
                     0145   144 SIZE_MAPA_4 = #SIZE_ENTITY*25  
                            145 .globl _mapa4
                            146 
                     01AD   147 SIZE_MAPA_5 = #SIZE_ENTITY*33  
                            148 .globl _mapa5
                            149 
                     01C7   150 SIZE_MAPA_6 = #SIZE_ENTITY*35
                            151 .globl _mapa6
                            152 
                     01A0   153 SIZE_MAPA_7 = #SIZE_ENTITY*32
                            154 .globl _mapa7
                            155 
                     01AD   156 SIZE_MAPA_8 = #SIZE_ENTITY*33
                            157 .globl _mapa8
                            158 
                     01D4   159 SIZE_MAPA_9 = #SIZE_ENTITY*36 
                            160 .globl _mapa9
                            161 
                     0009   162 MAX_NIVEL = #9 
