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



                              1 .globl entity_create
                              2 .globl entity_copy
                              3 .globl entity_doForAll
                              4 .globl entity_doForAll_matching
                              5 .globl entity_doForAll_pairs_matching
                              6 .globl entity_update
                              7 .globl entity_vector
                              8 .globl entity_set4destruction
                              9 .globl entity_set4creation
                             10 .globl entity_register
                             11 .globl num_entities
                             12 .globl getEntity2
                             13 
                             14 
                             15 ; Constantes
                     0000    16 e_tipo            = 0
                     0001    17 e_cmps            = 1
                     0002    18 e_x               = 2
                     0003    19 e_y               = 3
                     0004    20 e_vx              = 4
                     0005    21 e_vy              = 5
                     0006    22 e_w               = 6
                     0007    23 e_h               = 7
                     0008    24 e_spriteL         = 8
                     0009    25 e_spriteH         = 9
                     000A    26 e_iaL             = 10
                     000B    27 e_iaH             = 11
                     000C    28 e_animL           = 12
                     000D    29 e_animH           = 13
                     000E    30 e_anim_st         = 14
                     000F    31 e_animCounter     = 15
                     0010    32 e_collidesAgainst = 16
                     0011    33 e_last_dir        = 17
                     0012    34 e_last_dirY       = 18
                     0013    35 e_player_shot     = 19
                     0014    36 e_actualizaMove   = 20
                     0015    37 e_contMove        = 21
                     0016    38 e_aim_X           = 22
                     0017    39 e_aim_Y           = 23
                     0018    40 e_hp              = 24
                     0019    41 e_perteneceL      = 25
                     001A    42 e_perteneceH      = 26
                     001B    43 e_tablaAnimL      = 27
                     001C    44 e_tablaAnimH      = 28
                     001D    45 e_anim_especial   = 29
                     001E    46 e_invencibilidad  = 30
                     001F    47 e_atacando        = 31
                             48 
                             49 
                             50 ;; Tipos
                     0000    51 e_type_invalid  = 0x00 
                     0001    52 e_type_player   = 0x01
                     0002    53 e_type_zombie   = 0x02  ;; realmente no es para el zombie, es para todos los enemigos
                     0004    54 e_type_shot     = 0x04
                     0008    55 e_type_arcoiris = 0x08
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 2.
Hexadecimal [16-Bits]



                     0010    56 e_type_vida     = 0x10
                     0080    57 e_type_dead     = 0x80
                     007F    58 e_type_default  = 0x7F
                             59 
                             60 ;; Components
                     0001    61 e_cmp_render   = 0x01
                     0002    62 e_cmp_movable  = 0x02
                     0004    63 e_cmp_input    = 0x04
                     0008    64 e_cmp_ia       = 0x08
                     0010    65 e_cmp_animated = 0x10
                     0020    66 e_cmp_collider = 0x20
                     0040    67 e_cmp_vidaextra = 0x40
                             68 
                     0010    69 k_max_num_entities = 16
                     0020    70 k_size_entity      = 32
                             71 
                             72 
                             73 
                             74 ;; Define an entity 
                             75 .macro DefineEntity _name, _tipo, _cmps, _x, _y, _vx, _vy, _w, _h, _sprite, _ia, _anim, _anim_st,_animCounter, _collides, _lastdir, _lastdirY , _playerShot, _actualizaMove, _contMove, _aimX, _aimY, _hp, _pertenece, _tablaAnim, _animEspecial, _invencible, _atacando
                             76    _name:
                             77       .db _tipo      ;; (Invalid 00, Player 01, Enemigo 02, Dead 80, Default 7F)
                             78       .db _cmps      ;; ()
                             79       .db _x,  _y    ;; x, y
                             80       .db _vx, _vy   ;; Vx, Vy
                             81       .db _w, _h     ;; Width, Height
                             82       .dw _sprite    ;; sprite (puntero al sprite)
                             83       .dw _ia        ;; IA     (puntero a funcion)
                             84       .dw _anim      ;; puntero a la animacion
                             85       .db _anim_st
                             86       .db _animCounter  ;; contador de animacion
                             87       .db _collides  ;; Collides Against
                             88       .db _lastdir, _lastdirY   ;; Ultima direccion a la que apunta la entidad (solo para ver hacia donde dispara el player)
                             89       .db _playerShot ;; 1 si la entidad ya ha disparado, 0 si no
                             90       .db _actualizaMove
                             91       .db _contMove
                             92       .db _aimX, _aimY
                             93       .db _hp
                             94       .dw _pertenece
                             95       .dw _tablaAnim    ;; puntero a la tabla que le corresponde de animaciones
                             96       .db _animEspecial ;; indica si es normal (0) o especial (1)
                             97       .db _invencible
                             98       .db _atacando
                             99 .endm
                            100 
                            101 ;; Define an entity with default values
                            102 .macro DefineEntityDefault _name, _suf
                            103                         ;;  Tipo  cmps  x     y      vx   vy   width height  sprite   ia     anim  status counter  collides  last_dir last_dir  player_shot actualizaMove contMove aimX, aimY    HP   pertenece tablaAnim especial invencibile atacando
                            104    DefineEntity _name'_suf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0000, 0x0000, 0x00, 0x00,    0x00,    0x00,    0x00,       0x00,       0x00,       0x00,     0x00, 0x00,  0x00,  0x0000,  0x0000,   0x00,        0xDE,     0xAD;;
                            105 .endm
                            106 
                            107 ;; Define N default entities (changing the names)
                            108 .macro DefineNEntities _name, _n
                            109    _c = 0
                            110    .rept _n
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 3.
Hexadecimal [16-Bits]



                            111       DefineEntityDefault _name, \_c
                            112       _c = _c + 1 
                            113    .endm
                            114 .endm
