mirror of
https://codeberg.org/hkzlab/TK2048.git
synced 2025-12-25 21:52:17 +11:00
Add a module list with defines
This commit is contained in:
parent
969fe9deab
commit
58f7436c45
6 changed files with 58 additions and 49 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include "game_hgr_graphics.h"
|
||||
#include "monitor_subroutines.h"
|
||||
#include "sound.h"
|
||||
#include "module_list.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
|
|
@ -44,7 +45,7 @@ void main(void) {
|
|||
|
||||
// By default, once we return from this, return to the DLOG module and give the master no command to execute
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
shared_page->next_module_idx = 3; // Go to the DLOG module
|
||||
shared_page->next_module_idx = MODULE_DLOG; // Go to the DLOG module
|
||||
|
||||
dlog_data *dld = (dlog_data *)(shared_page->module_data);
|
||||
dlog_data *gad = (dlog_data *)(shared_page->module_data);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "game_data.h"
|
||||
#include "input.h"
|
||||
#include "sound.h"
|
||||
#include "module_list.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
|
|
@ -54,7 +55,7 @@ void main(void) {
|
|||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
}
|
||||
|
||||
shared_page->next_module_idx = 4; // Go to the GAME module
|
||||
shared_page->next_module_idx = MODULE_GAME; // Go to the GAME module
|
||||
gad->mode = GAME_MODE_NORMAL; // Set the proper start mode for the game
|
||||
|
||||
while(!read_any_key() && (wait_counter != WAIT_COUNTER_END)) {
|
||||
|
|
@ -63,7 +64,7 @@ void main(void) {
|
|||
}
|
||||
|
||||
if (wait_counter == WAIT_COUNTER_END) {
|
||||
shared_page->next_module_idx = 5; // Actually go to the DEMO module
|
||||
shared_page->next_module_idx = MODULE_DEMO; // Actually go to the DEMO module
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "game_hgr_graphics.h"
|
||||
#include "monitor_subroutines.h"
|
||||
#include "sound.h"
|
||||
#include "module_list.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
|
|
@ -43,7 +44,7 @@ void main(void) {
|
|||
|
||||
// By default, once we return from this, return to the DLOG module and give the master no command to execute
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
shared_page->next_module_idx = 3; // Go to the DLOG module
|
||||
shared_page->next_module_idx = MODULE_DLOG; // Go to the DLOG module
|
||||
|
||||
dlog_data *dld = (dlog_data *)(shared_page->module_data);
|
||||
dlog_data *gad = (dlog_data *)(shared_page->module_data);
|
||||
|
|
@ -112,7 +113,7 @@ void main(void) {
|
|||
case K_CTRL_L:
|
||||
snd_mod_button();
|
||||
sync_display1_buffer();
|
||||
shared_page->next_module_idx = 4;
|
||||
shared_page->next_module_idx = MODULE_GAME;
|
||||
gad->mode = GAME_MODE_LOAD;
|
||||
return;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1,39 +1,41 @@
|
|||
#include <stubs.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <calypsi/intrinsics6502.h>
|
||||
|
||||
#include "monitor_subroutines.h"
|
||||
#include "utility.h"
|
||||
#include "mem_map.h"
|
||||
#include "shared_page.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
#pragma require __data_initialization_needed
|
||||
|
||||
static shared_page_data *shared_page = (shared_page_data*)SHARED_PAGE;
|
||||
|
||||
void main(void) {
|
||||
uint8_t wait_count = 0x40;
|
||||
|
||||
// Initialize the register for LFSR
|
||||
lfsr_init(0xF00D);
|
||||
|
||||
// Clear the memory used to pass parameters to the next module
|
||||
memset((void*)(shared_page->module_data), 0, MODULE_DATA_SIZE);
|
||||
|
||||
// TODO: Detect expansion hardware, and choose what to load according to that
|
||||
|
||||
// Delay a bit
|
||||
while(wait_count--) WAIT(0xFF);
|
||||
|
||||
// Clear the display memory
|
||||
memset((void*)DISPLAY_PAGE_2, 0, DISPLAY_PAGE_SIZE);
|
||||
memset((void*)DISPLAY_PAGE_1, 0, DISPLAY_PAGE_SIZE);
|
||||
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
shared_page->next_module_idx = 3; // DLOG module is next!
|
||||
|
||||
return;
|
||||
}
|
||||
#include <stubs.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <calypsi/intrinsics6502.h>
|
||||
|
||||
#include "monitor_subroutines.h"
|
||||
#include "utility.h"
|
||||
#include "mem_map.h"
|
||||
#include "shared_page.h"
|
||||
|
||||
#include "module_list.h"
|
||||
|
||||
// External initialization requirements
|
||||
#pragma require __preserve_zp
|
||||
#pragma require __data_initialization_needed
|
||||
|
||||
static shared_page_data *shared_page = (shared_page_data*)SHARED_PAGE;
|
||||
|
||||
void main(void) {
|
||||
uint8_t wait_count = 0x40;
|
||||
|
||||
// Initialize the register for LFSR
|
||||
lfsr_init(0xF00D);
|
||||
|
||||
// Clear the memory used to pass parameters to the next module
|
||||
memset((void*)(shared_page->module_data), 0, MODULE_DATA_SIZE);
|
||||
|
||||
// TODO: Detect expansion hardware, and choose what to load according to that
|
||||
|
||||
// Delay a bit
|
||||
while(wait_count--) WAIT(0xFF);
|
||||
|
||||
// Clear the display memory
|
||||
memset((void*)DISPLAY_PAGE_2, 0, DISPLAY_PAGE_SIZE);
|
||||
memset((void*)DISPLAY_PAGE_1, 0, DISPLAY_PAGE_SIZE);
|
||||
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
shared_page->next_module_idx = MODULE_DLOG; // DLOG module is next!
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,17 +123,14 @@ __task int main(void) {
|
|||
uint8_t cur_file = 0;
|
||||
uint8_t keep_going = 1;
|
||||
|
||||
__disable_interrupts();
|
||||
__disable_interrupts(); // Keep the interrupts disabled in the master module
|
||||
|
||||
init();
|
||||
init_floppy_data(&cur_trk, &cur_file);
|
||||
|
||||
__enable_interrupts();
|
||||
|
||||
|
||||
do {
|
||||
if((cur_file != shared_page->next_module_idx) || (shared_page->master_command == MASTER_COMMAND_SAVE)) {
|
||||
__disable_interrupts();
|
||||
dii_power_on(DEFAULT_DRIVE_CONTROLLER_OFFSET, 0);
|
||||
|
||||
// Check if we need to load another module
|
||||
|
|
@ -151,7 +148,6 @@ __task int main(void) {
|
|||
}
|
||||
|
||||
dii_power_off(DEFAULT_DRIVE_CONTROLLER_OFFSET);
|
||||
__enable_interrupts();
|
||||
}
|
||||
|
||||
shared_page->master_command = MASTER_COMMAND_NONE;
|
||||
|
|
|
|||
8
src/module_list.h
Normal file
8
src/module_list.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _MODULE_LIST_HEADER_
|
||||
#define _MODULE_LIST_HEADER_
|
||||
|
||||
#define MODULE_DLOG 3
|
||||
#define MODULE_GAME 4
|
||||
#define MODULE_DEMO 5
|
||||
|
||||
#endif /* _MODULE_LIST_HEADER_ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue