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 Tomahawk Pixels 
                              3 ;;  Copyright (C) 2021 Laureano Cantó Berna, Alicia Aurecchia Vidal, Alejandro Gómez López
                              4 ;;
                              5 ;;  This program is free software: you can redistribute it and/or modify
                              6 ;;  it under the terms of the GNU Lesser General Public License as published by
                              7 ;;  the Free Software Foundation, either version 3 of the License, or
                              8 ;;  (at your option) any later version.
                              9 ;;
                             10 ;;  This program is distributed in the hope that it will be useful,
                             11 ;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
                             12 ;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                             13 ;;  GNU Lesser General Public License for more details.
                             14 ;;
                             15 ;;  You should have received a copy of the GNU Lesser General Public License
                             16 ;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
                             17 ;;-------------------------------------------------------------------------------
                             18 
                             19 
                             20 ;;=================================================================
                             21 ;;=================================================================
                             22 ;;      ENTITY MANAGER FUNCTIONS, DECLARATIONS AND GLOBALS
                             23 ;;=================================================================
                             24 ;;=================================================================
                             25 
                             26 
                             27 ;;-----------------------------------------------------------------
                             28 ;;  Entities
                             29 ;;  Declaration of entity structure
                             30 ;;
                             31 .globl vidas_rana
                             32 .globl nivel
                             33 
                     0012    34 max_entities = 18
                             35 
                             36 ;;entity positions
                     0000    37 e_cmps      = 0     ;; 1 byte , is a byte
                     0001    38 e_type      = 1
                     0002    39 e_x         = 2     ;; 1 byte , is a byte
                     0003    40 e_y         = 3     ;; 1 byte , is a byte
                     0004    41 e_w         = 4     ;; 1 byte , is a byte
                     0005    42 e_h         = 5     ;; 1 byte , is a byte
                     0006    43 e_vx        = 6     ;; 1 byte , is a byte
                     0007    44 e_vy        = 7     ;; 1 byte , is a byte           
                     0008    45 e_color     = 8     ;; 1 byte , is a byte        
                     0009    46 e_sprite    = 9     ;; 2 bytes, is a pointer
                     000B    47 e_prev_ptr  = 11    ;; 2 bytes, is a pointer
                     000D    48 e_col_func  = 13    ;; 2 bytes, is a pointer
                     000F    49 e_prev_spr  = 15    ;; 2 bytes, is a pointer
                     0011    50 e_prev_ptr2 = 17    ;; 2 bytes, is a pointer
                     0013    51 e_prev_spr2 = 19    ;; 2 bytes, is a pointer
                             52 
                     0015    53 sizeof_e    = 21    ;; entity size
                             54 
                             55 ;;-----------------------------------------------------------------
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 2.
Hexadecimal [16-Bits]



                             56 ;;  Entities
                             57 ;;  Declaration entity components
                             58 ;;
                             59 ;; BitField                              ;;--EJEMPLOS---------;;
                     00FF    60 e_cmps_default       = 0xFF              ;;1110 0000 --> 0xE0 ;;
                     0000    61 e_cmps_invalid       = 0x00              ;;1100 0000 --> 0xC0 ;;    
                     0080    62 e_cmps_alive         = 0x80              ;;8421 8421----------;;
                     0040    63 e_cmps_render        = 0x40
                     0020    64 e_cmps_physics       = 0x20
                     0010    65 e_cmps_collider      = 0x10
                     0008    66 e_cmps_collisionable = 0x08
                     0004    67 e_cmps_platform      = 0x04
                     0002    68 e_cmps_enemy         = 0x02
                     0001    69 e_cmps_platform_up   = 0x01
                             70 ;;-----------------------------------------------------------------
                             71 ;;  Entities
                             72 ;;  Declaration entity types
                             73 ;;
                             74 ;; BitField        
                     0080    75 e_type_frog         = 0x80
                     0040    76 e_type_mortal       = 0x40
                     0020    77 e_type_solid        = 0x20
                     0010    78 e_type_enemy_bee    = 0x10
                     0008    79 e_type_enemy_floor  = 0x08
                     0004    80 e_type_none         = 0x04
                     0000    81 e_type_invalid      = 0x00           
                             82 
                             83 
                             84 ;;-----------------------------------------------------------------
                             85 ;;  Entity MACROS
                             86 ;;  Macro definitions -- creation of entities
                             87 ;;
                             88 .macro DefineEntityAnnonimous _cmps, _type, _x, _y, _vx, _vy, _w, _h, _color, _ent_sprite, _prev_ptr, _col_func, _prev_spr, _prev_ptr2, _prev_spr2
                             89    .db _cmps
                             90    .db _type
                             91    .db _x
                             92    .db _y
                             93    .db _w
                             94    .db _h
                             95    .db _vx
                             96    .db _vy
                             97    .db _color
                             98    .dw _ent_sprite
                             99    .dw _prev_ptr
                            100    .dw _col_func
                            101    .dw _prev_spr
                            102    .dw _prev_ptr2
                            103    .dw _prev_spr2
                            104 .endm
                            105 
                            106 ;; example of use --> DefineEntity player, 0x40, 40, 80, 1, 1, 2, 8, 0xF0, 0xC000
                            107 .macro DefineEntity _name, _cmps, _type, _x, _y, _vx, _vy, _w, _h, _color,_ent_sprite, _prev_ptr, _col_func, _prev_spr, _prev_ptr2, _prev_spr2
                            108    _name::
                            109     DefineEntityAnnonimous _cmps, _type, _x, _y, _vx, _vy, _w, _h, _color, _ent_sprite, _prev_ptr, _col_func, _prev_spr, _prev_ptr2, _prev_spr2
                            110 .endm
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 3.
Hexadecimal [16-Bits]



                            111 
                            112 .macro DefineEntityArray _name, _N
                            113     _name::
                            114     .rept _N
                            115     DefineEntityAnnonimous 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAD, 0xDE, 0xAA
                            116     .endm 
                            117 .endm
                            118 
                            119 ;;-----------------------------------------------------------------
                            120 ;;  Global functions
                            121 ;;
                            122 .globl man_entity_init
                            123 .globl man_entity_create
                            124 .globl man_entity_destroy
                            125 .globl man_entity_forall
                            126 .globl man_entity_forall_matching
                            127 .globl man_entity_forall_matching_iy
                            128 .globl man_entity_forall_matching_type
                            129 .globl man_entity_get_from_idx
                            130 .globl man_entity_get_from_idy
                            131 .globl man_entity_set4destruction
                            132 .globl man_entity_update
                            133 .globl man_entity_jump_control
                            134 .globl man_entity_init_jump_control
                            135 .globl man_entity_get_frog_jump_A
                            136 .globl man_entity_set_frog_jump_A
