;;-----------------------------LICENSE NOTICE------------------------------------
;;  This file is part of The Last Fungus: An Amstrad CPC Game 
;;  Copyright (C) 2021 Miguel Perez Tarruella / Antonio Jose Fernandez Belliure / 
;;                     David Martinez Garcia / Ocacho Games (@OcachoGames)
;;
;;  This program is free software: you can redistribute it and/or modify
;;  it under the terms of the GNU Lesser General Public License as published by
;;  the Free Software Foundation, either version 3 of the License, or
;;  (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU Lesser General Public License for more details.
;;
;;  You should have received a copy of the GNU Lesser General Public License
;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;------------------------------------------------------------------------------

.include "cpctelera.h.s"

.area _DATA
.area _CODE

;;Cpctelera video functions
.globl cpct_disableFirmware_asm

;;Managers
.include "man/game.h.s"
.include "man/menu.h.s"

;;Includes 
.include "sys/render.h.s"
.include "sys/music.h.s"
.include "man/interruptions.h.s"

;;Globals
.include "global/global.h.s"

;;Macros
.include "macros/math.h.s"

_main::
	;;Initialize cpctelera render setting
	;call    cpct_disableFirmware_asm
	call set_int_handler

	;;Initialize render to set the mode and palette
	call sys_render_init

jump_reset_to_menu::
	call man_menu_init

menu_loop:
	call man_menu_update
	jr  z, menu_loop

	call sys_music_game_init

jump_reset_to_game::
	call man_game_init

game_loop:
	call man_game_update
	
	jr game_loop
	