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 Viking Hangover
                              3 ;;  Copyright (C) 2021 Ahmed Begga / Érika Moreno / Adriana Morejón (@ComputosGame)
                              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 ;;-------------------------------------------------------------------------------
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 2.
Hexadecimal [16-Bits]



                             18 .include "ai.h.s"
                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Viking Hangover
                              3 ;;  Copyright (C) 2021 Ahmed Begga / Érika Moreno / Adriana Morejón (@ComputosGame)
                              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 ;;  AI SYSTEM
                             22 ;;=======================
                             23 ;;=======================
                             24 
                             25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             26 ;;                      Const                            ;;
                             27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             28 
                             29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             30 ;;                      Public functions                 ;;
                             31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             32 
                             33 .globl sys_ai_update
                             34 .globl sys_ai_move_left
                             35 .globl sys_ai_move_right
                             36 .globl sys_ai_shot
                             37 .globl sys_ai_bottle
                             38 .globl sys_ai_explosion
                             39 
                             40 .globl ai_speed_left
                             41 .globl ai_speed_right
                             42 .globl ai_counter
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 3.
Hexadecimal [16-Bits]



                             19 .include "../man/entity.h.s"
                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Viking Hangover
                              3 ;;  Copyright (C) 2021 Ahmed Begga / Érika Moreno / Adriana Morejón (@ComputosGame)
                              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 ;;  ENTITY MANAGER
                             22 ;;=======================
                             23 ;;=======================
                             24 
                             25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             26 ;;                      Const                            ;;
                             27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                     001D    28 entity_size=29 
                     0028    29 entity_array_size=40
                     0488    30 entity_array_bytes_size=entity_size*entity_array_size
                             31  
                             32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             33 ;;                      Index                            ;;
                             34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                     0000    35 e_type=0
                     0001    36 e_x=1
                     0002    37 e_y=2
                     0003    38 e_vx=3
                     0004    39 e_vy=4
                     0005    40 e_w=5
                     0006    41 e_h=6
                     0007    42 e_ia2=7
                     0008    43 e_ia1=8
                     0009    44 e_coli2=9
                     000A    45 e_coli1=10
                     000B    46 e_phy2=11
                     000C    47 e_phy1=12
                     000D    48 e_sprite2=13
                     000E    49 e_sprite1=14
                     000F    50 e_prevPos2=15
                     0010    51 e_prevPos1=16
                     0011    52 e_score=17
                     0012    53 e_subType=18
                     0013    54 e_anime2=19
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 4.
Hexadecimal [16-Bits]



                     0014    55 e_anime1=20
                     0015    56 e_count_anime=21
                     0016    57 e_current_anime=22
                     0017    58 e_currentpos2=23
                     0018    59 e_currentpos1=24
                     0019    60 e_count_ia=25
                     001A    61 e_w2rmv=26
                     001B    62 e_h2rmv=27
                     001C    63 e_movement_ia=28
                             64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             65 ;;                      Types                            ;;
                             66 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                     0000    67 e_cmp_invalid=0x00
                     0001    68 e_cmp_render=0x01
                     0002    69 e_cmp_mov=0x02
                     0004    70 e_cmp_input=0x04
                     0008    71 e_cmp_ia=0x08
                     0010    72 e_cmp_colision=0x10
                     0020    73 e_cmp_colide=0x20
                     0040    74 e_cmp_anime=0x40
                     0080    75 e_cmp_dead=0x80
                     007F    76 e_cmp_default=0x7f
                             77 
                     0001    78 type_shot=0x01 
                     0002    79 type_bottle=0x02
                     0004    80 type_static=0x04
                             81 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             82 ;;                      Public functions                 ;;
                             83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             84 .globl man_entity_init
                             85 .globl man_entity_create
                             86 .globl man_entity_destroy
                             87 .globl man_entity_set4_destroy
                             88 .globl man_entity_destroy_dead
                             89 .globl man_entity_forall
                             90 .globl man_entity_forall_match
                             91 
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 5.
Hexadecimal [16-Bits]



                             20 .include "generator.h.s"
                              1 ;;-----------------------------LICENSE NOTICE------------------------------------
                              2 ;;  This file is part of Viking Hangover
                              3 ;;  Copyright (C) 2021 Ahmed Begga / Érika Moreno / Adriana Morejón (@ComputosGame)
                              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 ;;  GENERATOR SYSTEM
                             22 ;;=======================
                             23 ;;=======================
                             24 
                             25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             26 ;;                      Const                            ;;
                             27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             28 
                     000A    29 init_max2wait=10
                     000F    30 Minwait2gen=15
                     000A    31 min_nshots=10
                     0064    32 maxShots=100
                     0001    33 Subwait2gen=1
                     000F    34 Addn_shots=15
                     001E    35 ahmed = 30
                     0028    36 SpeedUp1=40
                     003C    37 SpeedUp2=60
                             38 
                             39 
                             40 
                             41 ;;---------------------
                             42 ;; PERSONAJE PRINCIPAL
                             43 ;;---------------------
                             44 .globl _spr_viking
                             45 
                             46 ;;--------------------------------
                             47 ;; PERSONAJE PRINCIPAL ANIMATION
                             48 ;;---------------------------------
                             49 .globl _spr_viking_animation
                             50 ;;-----------
                             51 ;; CHUPITOS
                             52 ;;-----------
                             53 .globl _spr_vaso_amarillo
                             54 .globl _spr_vaso_azul
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 6.
Hexadecimal [16-Bits]



                             55 .globl _spr_vaso_morado
                             56 .globl _spr_vaso_naranja
                             57 .globl _spr_vaso_rojo
                             58 .globl _spr_vaso_verde
                             59 
                             60 ;;-----------------------
                             61 ;;  CHUPITOS ANIMATIONS
                             62 ;;-----------------------
                             63 
                             64 .globl _spr_vaso_amarillo_animation
                             65 .globl _spr_vaso_azul_animation
                             66 .globl _spr_vaso_morado_animation
                             67 .globl _spr_vaso_naranja_animation
                             68 .globl _spr_vaso_rojo_animation
                             69 .globl _spr_vaso_verde_animation
                             70 
                             71 ;;-----------------
                             72 ;; BOTELLA AGUA
                             73 ;;-----------------
                             74 .globl _spr_botella
                             75 
                             76 ;;-------------------------
                             77 ;; BOTELLA AGUA ANIMATION
                             78 ;;--------------------------
                             79 .globl _spr_botella_animation
                             80 
                             81 ;;----------
                             82 ;; VIDA
                             83 ;;----------
                             84 .globl _spr_vida_0
                             85 .globl _spr_vida_1
                             86 .globl _spr_vida_2
                             87 .globl _spr_vida_3
                             88 
                             89 ;;-----------------
                             90 ;; GANAR BOTELLAS
                             91 ;;-----------------
                             92 .globl _spr_botella_winner_0
                             93 .globl _spr_botella_winner_1
                             94 .globl _spr_botella_winner_2
                             95 .globl _spr_botella_winner_3
                             96 .globl _spr_botella_winner_4
                             97 .globl _spr_botella_winner_5
                             98 
                             99 
                            100 ;;----------
                            101 ;; GRASS
                            102 ;;----------
                            103 .globl _spr_grass
                            104 .globl _spr_aranya
                            105 
                            106 ;;;;;;;;;;;;;;;;;;;;;;;;;;
                            107 ;;  GENERAL FUNCTIONS   ;;
                            108 ;;;;;;;;;;;;;;;;;;;;;;;;;;
                            109 .globl sys_generator_init_game
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 7.
Hexadecimal [16-Bits]



                            110 ;;.globl sys_generator_init_menu
                            111 .globl sys_generator_update
                            112 
                            113 .globl sys_generator_expShot
                            114 .globl sys_generator_expBottle
                            115 
                            116 
                            117 .globl initVida
                            118 .globl initBottle
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 8.
Hexadecimal [16-Bits]



                             21 
   6930                      22 ai_speed_left::
   6930 FF                   23     .db #-1
                             24 
   6931                      25 ai_speed_right::
   6931 01                   26     .db #1
                             27 
   6932                      28 ai_counter::
   6932 01                   29     .db #1
                             30 
                             31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             32 ;;Description:                                           ;;                                                          
                             33 ;;     updates vx and vy of any entity with flag move    ;;
                             34 ;;Required:                                              ;;
                             35 ;;     IX -> Position of the array entity                ;;  
                             36 ;; Return:                                               ;;                                                  
                             37 ;;     -                                                 ;;
                             38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   6933                      39 sys_ai_updateOne:
   6933 DD 66 08      [19]   40     ld h, e_ia1(ix)
   6936 DD 6E 07      [19]   41     ld l, e_ia2(ix)
   6939 01 3E 69      [10]   42     ld bc, #escape
   693C C5            [11]   43     push bc
                             44 
   693D E9            [ 4]   45     jp (hl)
                             46 
   693E                      47     escape:
                             48 
   693E C9            [10]   49 ret
                             50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             51 ;;Description:                                           ;;                                                          
                             52 ;;     updates vx and vy of any entity with flag move    ;;
                             53 ;;Required:                                              ;;
                             54 ;;     IX -> Position of the array entity                ;;  
                             55 ;; Return:                                               ;;                                                  
                             56 ;;     -                                                 ;;
                             57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   693F                      58 sys_ai_entity:
   693F DD 36 03 00   [19]   59     ld e_vx(ix), #0
   6943 CD 4F 69      [17]   60     call sys_ai_check
   6946 C9            [10]   61 ret
   6947                      62 sys_ai_shot::
   6947 CD 3F 69      [17]   63     call sys_ai_entity
   694A C9            [10]   64 ret
   694B                      65 sys_ai_bottle::
   694B CD 3F 69      [17]   66     call sys_ai_entity
   694E C9            [10]   67 ret
                             68 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             69 ;;Description:                                           ;;                                                          
                             70 ;;     updates vx and vy of any entity with flag move    ;;
                             71 ;;Required:                                              ;;
                             72 ;;     IX -> Position of the array entity                ;;  
                             73 ;; Return:                                               ;;                                                  
                             74 ;;     -                                                 ;;
                             75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 9.
Hexadecimal [16-Bits]



   694F                      76 sys_ai_check:
   694F DD 7E 19      [19]   77     ld a, e_count_ia(ix)
   6952 B7            [ 4]   78     or a
   6953 CA 5A 69      [10]   79     jp z, reset_ia_count
   6956 DD 35 19      [23]   80     dec e_count_ia(ix)
   6959 C9            [10]   81     ret 
   695A                      82 reset_ia_count:
                             83 
   695A 3A 32 69      [13]   84     ld a, (ai_counter)
   695D DD 77 19      [19]   85     ld e_count_ia(ix), a
                             86 
   6960 DD 7E 1C      [19]   87     ld a, e_movement_ia(ix)
   6963 B7            [ 4]   88     or a
   6964 CA 75 69      [10]   89     jp z, sys_ai_move_right
   6967 C3 6E 69      [10]   90     jp sys_ai_move_left
   696A C3 3F 69      [10]   91     jp sys_ai_entity
   696D C9            [10]   92 ret
                             93 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                             94 ;;Description:                                           ;;                                                          
                             95 ;;     Updates speed type (left) of the specific entity  ;;
                             96 ;;Required:                                              ;;
                             97 ;;     IX -> Position of the array entity                ;;  
                             98 ;; Return:                                               ;;                                                  
                             99 ;;     -                                                 ;;
                            100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   696E                     101 sys_ai_move_left::
   696E 3A 30 69      [13]  102     ld a, (ai_speed_left)
   6971 DD 77 03      [19]  103     ld e_vx(ix), a
   6974 C9            [10]  104 ret
                            105 
                            106 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                            107 ;;Description:                                           ;;                                                          
                            108 ;;     Updates speed type (right) of the specific entity ;;
                            109 ;;Required:                                              ;;
                            110 ;;     IX -> Position of the array entity                ;;  
                            111 ;; Return:                                               ;;                                                  
                            112 ;;     -                                                 ;;
                            113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   6975                     114 sys_ai_move_right:: 
   6975 3A 31 69      [13]  115     ld a, (ai_speed_right)
   6978 DD 77 03      [19]  116     ld e_vx(ix), a
   697B C9            [10]  117 ret
                            118 
                            119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                            120 ;;Description:                                           ;;                                                          
                            121 ;;     Destroy an entity after u colided with            ;;
                            122 ;;Required:                                              ;;
                            123 ;;     IX -> Position of the array entity                ;;  
                            124 ;; Return:                                               ;;                                                  
                            125 ;;     -                                                 ;;
                            126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   697C                     127 sys_ai_explosion:
   697C DD 7E 19      [19]  128     ld a, e_count_ia(ix)
   697F 3D            [ 4]  129     dec a
   6980 CA 87 69      [10]  130     jp z, sys_ai_destroy
ASxxxx Assembler V02.00 + NoICE + SDCC mods  (Zilog Z80 / Hitachi HD64180), page 10.
Hexadecimal [16-Bits]



   6983 DD 77 19      [19]  131     ld e_count_ia(ix), a
   6986 C9            [10]  132     ret
   6987                     133 sys_ai_destroy:
   6987 CD 03 74      [17]  134     call man_entity_set4_destroy
   698A C9            [10]  135 ret
                            136 
                            137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                            138 ;;Description:                                           ;;                                                          
                            139 ;;     updates all the entities woth the flag e_cmpia    ;;
                            140 ;;Required:                                              ;;
                            141 ;;     -                                                 ;;  
                            142 ;; Return:                                               ;;                                                  
                            143 ;;     -                                                 ;;
                            144 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   698B                     145 sys_ai_update::
   698B 21 33 69      [10]  146     ld hl, #sys_ai_updateOne
   698E 3E 08         [ 7]  147     ld a, #e_cmp_ia
   6990 CD 16 74      [17]  148     call man_entity_forall
   6993 C9            [10]  149 ret
