Skip to content

Commit

Permalink
Fixing mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed May 26, 2024
1 parent b627eac commit 10652b2
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 26 deletions.
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.o
*.sym
*.map
dump.bin
2 changes: 1 addition & 1 deletion src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,6 @@ void wait_joystick_release(uint8_t joy_id) {

do {
read_joystick(joy_id, &joystat1, &joystat2, &joyconn);
sound_fill_buffers();
//sound_fill_buffers();
} while(joystat1 != 0xFF || joystat2 != 0xFF);
}
7 changes: 4 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "game.h"
#include "menu.h"
#include "mouse.h"
#include "sound.h"

unsigned char keycode;

Expand All @@ -34,13 +35,13 @@ void main() {
init_screen();
load_tiles();

// // enable mouse
init_mouse();

// load sound engine
init_sound();
start_bgmusic();

// enable mouse
init_mouse();

while(1) {
while(gamestate == GAME_MENU) {
clear_screen();
Expand Down
11 changes: 5 additions & 6 deletions src/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void game_menu() {
print_choice();

while(1) {
// sample keyboard to make adjustments to the game settings
asm("jsr $FFE4");
asm("sta %v", keycode);

Expand Down Expand Up @@ -116,8 +115,8 @@ void game_menu() {
return;
}

asm("jsr $FF6B");
asm("sta %v", mouse_buttons);
// asm("jsr $FF6B");
// asm("sta %v", mouse_buttons);

// update sound buffer
sound_fill_buffers();
Expand Down Expand Up @@ -145,13 +144,13 @@ void print_choice() {
// print board size
switch(boardsize) {
case 6:
memcpy(buf, "6 x 6 ", 7);
memcpy(buf, "6 x 6 ", 8);
break;
case 8:
memcpy(buf, "8 x 8 ", 7);
memcpy(buf, "8 x 8 ", 8);
break;
case 10:
memcpy(buf, "10 x 10", 7);
memcpy(buf, "10 x 10", 8);
break;
}
write_string(buf, 9, 1);
Expand Down
1 change: 1 addition & 0 deletions src/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "video.h"
#include "game.h"
#include "mouse.h"
#include "sound.h"

/**
* @brief Show game menu
Expand Down
2 changes: 1 addition & 1 deletion src/mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
#ifndef _MOUSE_H
#define _MOUSE_H

void init_mouse();
void __fastcall__ init_mouse();

#endif // _MOUSE_H
1 change: 1 addition & 0 deletions src/mouse.s
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

.export _init_mouse

.code
.proc _init_mouse: near
sec
jsr X16::Kernal::SCREEN_MODE
Expand Down
28 changes: 14 additions & 14 deletions src/othello.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ MEMORY {
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __ONCE_RUN__ - __STACKSIZE__;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro, optional = yes;
LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
ZSMKITLIB: load = MAIN, type = ro;
ZSMKITBANK: load = HIRAM, type = bss, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro, optional = yes;
LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
ZSMKITLIB: load = MAIN, type = ro;
ZSMKITBANK: load = HIRAM, type = bss, define = yes;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = rw, optional = yes; # uninitialized, but reserves output space
ONCE: load = MAIN, type = ro, define = yes;
BSS: load = BSS, type = bss, define = yes;
}
FEATURES {
CONDES: type = constructor,
Expand Down
2 changes: 1 addition & 1 deletion src/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# This BASH file is made for MINGW64 BASH
#
../../emulator-win/x16emu.exe -prg OTHELLO.PRG -run
../../emulator-win/x16emu.exe -c02 -prg OTHELLO.PRG -run -debug

0 comments on commit 10652b2

Please sign in to comment.