Add some mouse support based on code from a2bejwld which should get VBL working on the //c
This commit is contained in:
parent
774052ddb5
commit
5cc8cf2b0c
|
@ -7,6 +7,9 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9DF837AE1F22FB4300FFFEF2 /* a2e.stdmou.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = a2e.stdmou.s; sourceTree = "<group>"; };
|
||||
9DF837AF1F22FB7500FFFEF2 /* mouseWrapper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mouseWrapper.c; sourceTree = "<group>"; };
|
||||
9DF837B01F22FB7500FFFEF2 /* mouseWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mouseWrapper.h; sourceTree = "<group>"; };
|
||||
9DFD77C91F1F9C2500639A48 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = "<group>"; };
|
||||
9DFD77CA1F1F9C2500639A48 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
9DFD77CC1F1F9C2500639A48 /* AppleCommander.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; name = AppleCommander.jar; path = make/AppleCommander.jar; sourceTree = "<group>"; };
|
||||
|
@ -26,6 +29,16 @@
|
|||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9DF837B11F22FB7B00FFFEF2 /* mouse */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9DF837AE1F22FB4300FFFEF2 /* a2e.stdmou.s */,
|
||||
9DF837AF1F22FB7500FFFEF2 /* mouseWrapper.c */,
|
||||
9DF837B01F22FB7500FFFEF2 /* mouseWrapper.h */,
|
||||
);
|
||||
name = mouse;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9DFD77C21F1F9C2500639A48 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -36,13 +49,14 @@
|
|||
9DFD77C81F1F9C2500639A48 /* colourgo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9DFD77D91F1FA47900639A48 /* main.c */,
|
||||
9DFD77C91F1F9C2500639A48 /* game.s */,
|
||||
9DFD77DB1F1FA4A400639A48 /* game.h */,
|
||||
9DFD77D91F1FA47900639A48 /* main.c */,
|
||||
9DFD77DC1F1FB69600639A48 /* vbl.s */,
|
||||
9DFD77DD1F1FB69600639A48 /* vbl.h */,
|
||||
9DFD77DE1F1FB69600639A48 /* machine.c */,
|
||||
9DFD77DF1F1FB69600639A48 /* machine.h */,
|
||||
9DF837B11F22FB7B00FFFEF2 /* mouse */,
|
||||
9DFD77CA1F1F9C2500639A48 /* Makefile */,
|
||||
9DFD77CB1F1F9C2500639A48 /* make */,
|
||||
);
|
||||
|
@ -237,6 +251,7 @@
|
|||
9DFD77D81F1F9C2500639A48 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
|
|
@ -0,0 +1,427 @@
|
|||
;
|
||||
; File generated by co65 v 2.13.3 using model `cc65-module'
|
||||
;
|
||||
.fopt compiler,"co65 v 2.13.3"
|
||||
.case on
|
||||
.debuginfo off
|
||||
.export _a2e_stdmou_mou
|
||||
|
||||
;
|
||||
; CODE SEGMENT
|
||||
;
|
||||
.segment "CODE"
|
||||
_a2e_stdmou_mou:
|
||||
.byte $6D
|
||||
.byte $6F
|
||||
.byte $75
|
||||
.byte $02
|
||||
.word _a2e_stdmou_mou+41
|
||||
.word _a2e_stdmou_mou+170
|
||||
.word _a2e_stdmou_mou+286
|
||||
.word _a2e_stdmou_mou+295
|
||||
.word _a2e_stdmou_mou+180
|
||||
.word _a2e_stdmou_mou+238
|
||||
.word _a2e_stdmou_mou+253
|
||||
.word _a2e_stdmou_mou+299
|
||||
.word _a2e_stdmou_mou+305
|
||||
.word _a2e_stdmou_mou+309
|
||||
.word _a2e_stdmou_mou+322
|
||||
.word _a2e_stdmou_mou+327
|
||||
.byte $40
|
||||
.byte $4C
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $4C
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $4C
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $4C
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $A9
|
||||
.byte $00
|
||||
.byte $85
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $A9
|
||||
.byte $C0
|
||||
.byte $85
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $E6
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $A5
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $C9
|
||||
.byte $C8
|
||||
.byte $90
|
||||
.byte $05
|
||||
.byte $A9
|
||||
.byte $04
|
||||
.byte $A2
|
||||
.byte $00
|
||||
.byte $60
|
||||
.byte $A2
|
||||
.byte $03
|
||||
.byte $BC
|
||||
.word _a2e_stdmou_mou+421
|
||||
.byte $BD
|
||||
.word _a2e_stdmou_mou+425
|
||||
.byte $D1
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $D0
|
||||
.byte $E7
|
||||
.byte $CA
|
||||
.byte $10
|
||||
.byte $F3
|
||||
.byte $A5
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $8D
|
||||
.word DATA+2
|
||||
.byte $8D
|
||||
.word DATA+7
|
||||
.byte $8D
|
||||
.word DATA+12
|
||||
.byte $78
|
||||
.byte $29
|
||||
.byte $0F
|
||||
.byte $8D
|
||||
.word BSS+13
|
||||
.byte $0A
|
||||
.byte $0A
|
||||
.byte $0A
|
||||
.byte $0A
|
||||
.byte $8D
|
||||
.word DATA+9
|
||||
.byte $2C
|
||||
.byte $82
|
||||
.byte $C0
|
||||
.byte $A2
|
||||
.byte $19
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $2C
|
||||
.byte $80
|
||||
.byte $C0
|
||||
.byte $A9
|
||||
.byte $01
|
||||
.byte $A2
|
||||
.byte $12
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $A9
|
||||
.byte <(_a2e_stdmou_mou+173)
|
||||
.byte $A2
|
||||
.byte >(_a2e_stdmou_mou+429)
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+180
|
||||
.byte $AE
|
||||
.word BSS+13
|
||||
.byte $A9
|
||||
.byte $8B
|
||||
.byte $9D
|
||||
.byte $78
|
||||
.byte $04
|
||||
.byte $A9
|
||||
.byte $00
|
||||
.byte $9D
|
||||
.byte $78
|
||||
.byte $05
|
||||
.byte $A9
|
||||
.byte $5F
|
||||
.byte $9D
|
||||
.byte $F8
|
||||
.byte $04
|
||||
.byte $A9
|
||||
.byte $00
|
||||
.byte $9D
|
||||
.byte $F8
|
||||
.byte $05
|
||||
.byte $A2
|
||||
.byte $16
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+372
|
||||
.byte $A9
|
||||
.byte $09
|
||||
.byte $A2
|
||||
.byte $12
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $58
|
||||
.byte $A9
|
||||
.byte $00
|
||||
.byte $A2
|
||||
.byte $00
|
||||
.byte $60
|
||||
.byte $78
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+29
|
||||
.byte $A9
|
||||
.byte $00
|
||||
.byte $A2
|
||||
.byte $12
|
||||
.byte $D0
|
||||
.byte $ED
|
||||
.byte $85
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $86
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $A2
|
||||
.byte $00
|
||||
.byte $A0
|
||||
.byte $00
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+195
|
||||
.byte $A2
|
||||
.byte $01
|
||||
.byte $A0
|
||||
.byte $02
|
||||
.byte $78
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $99
|
||||
.word BSS+0
|
||||
.byte $8D
|
||||
.byte $78
|
||||
.byte $04
|
||||
.byte $C8
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $99
|
||||
.word BSS+0
|
||||
.byte $8D
|
||||
.byte $78
|
||||
.byte $05
|
||||
.byte $C8
|
||||
.byte $C8
|
||||
.byte $C8
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $99
|
||||
.word BSS+0
|
||||
.byte $8D
|
||||
.byte $F8
|
||||
.byte $04
|
||||
.byte $C8
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $99
|
||||
.word BSS+0
|
||||
.byte $8D
|
||||
.byte $F8
|
||||
.byte $05
|
||||
.byte $8A
|
||||
.byte $A2
|
||||
.byte $17
|
||||
.byte $D0
|
||||
.byte $B3
|
||||
.byte $85
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $86
|
||||
.byte <(ZEROPAGE+9)
|
||||
.byte $A0
|
||||
.byte $07
|
||||
.byte $B9
|
||||
.word BSS+0
|
||||
.byte $91
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $88
|
||||
.byte $10
|
||||
.byte $F8
|
||||
.byte $60
|
||||
.byte $AC
|
||||
.word BSS+13
|
||||
.byte $78
|
||||
.byte $99
|
||||
.byte $F8
|
||||
.byte $04
|
||||
.byte $8A
|
||||
.byte $99
|
||||
.byte $F8
|
||||
.byte $05
|
||||
.byte $98
|
||||
.byte $AA
|
||||
.byte $A0
|
||||
.byte $00
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+0)
|
||||
.byte $C8
|
||||
.byte $9D
|
||||
.byte $78
|
||||
.byte $04
|
||||
.byte $B1
|
||||
.byte <(ZEROPAGE+0)
|
||||
.byte $9D
|
||||
.byte $78
|
||||
.byte $05
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+372
|
||||
.byte $A2
|
||||
.byte $16
|
||||
.byte $D0
|
||||
.byte $83
|
||||
.byte $CE
|
||||
.word BSS+14
|
||||
.byte $78
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+29
|
||||
.byte $58
|
||||
.byte $60
|
||||
.byte $EE
|
||||
.word BSS+14
|
||||
.byte $60
|
||||
.byte $AD
|
||||
.word BSS+12
|
||||
.byte $A2
|
||||
.byte $00
|
||||
.byte $60
|
||||
.byte $A0
|
||||
.byte $03
|
||||
.byte $D0
|
||||
.byte $02
|
||||
.byte $A0
|
||||
.byte $04
|
||||
.byte $78
|
||||
.byte $B9
|
||||
.word BSS+8
|
||||
.byte $91
|
||||
.byte <(ZEROPAGE+8)
|
||||
.byte $88
|
||||
.byte $10
|
||||
.byte $F8
|
||||
.byte $58
|
||||
.byte $60
|
||||
.byte $A9
|
||||
.byte $05
|
||||
.byte $A2
|
||||
.byte $00
|
||||
.byte $60
|
||||
.byte $AD
|
||||
.word BSS+13
|
||||
.byte $F0
|
||||
.byte $08
|
||||
.byte $A2
|
||||
.byte $13
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $90
|
||||
.byte $02
|
||||
.byte $18
|
||||
.byte $60
|
||||
.byte $A2
|
||||
.byte $14
|
||||
.byte $20
|
||||
.word DATA+0
|
||||
.byte $AC
|
||||
.word BSS+13
|
||||
.byte $B9
|
||||
.byte $78
|
||||
.byte $07
|
||||
.byte $AA
|
||||
.byte $0A
|
||||
.byte $29
|
||||
.byte $20
|
||||
.byte $F0
|
||||
.byte $02
|
||||
.byte $A9
|
||||
.byte $01
|
||||
.byte $90
|
||||
.byte $02
|
||||
.byte $09
|
||||
.byte $10
|
||||
.byte $8D
|
||||
.word BSS+12
|
||||
.byte $8A
|
||||
.byte $29
|
||||
.byte $20
|
||||
.byte $F0
|
||||
.byte $27
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+29
|
||||
.byte $AC
|
||||
.word BSS+13
|
||||
.byte $B9
|
||||
.byte $78
|
||||
.byte $04
|
||||
.byte $BE
|
||||
.byte $78
|
||||
.byte $05
|
||||
.byte $8D
|
||||
.word BSS+8
|
||||
.byte $8E
|
||||
.word BSS+9
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+35
|
||||
.byte $AC
|
||||
.word BSS+13
|
||||
.byte $B9
|
||||
.byte $F8
|
||||
.byte $04
|
||||
.byte $BE
|
||||
.byte $F8
|
||||
.byte $05
|
||||
.byte $8D
|
||||
.word BSS+10
|
||||
.byte $8E
|
||||
.word BSS+11
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+38
|
||||
.byte $AD
|
||||
.word BSS+14
|
||||
.byte $F0
|
||||
.byte $03
|
||||
.byte $20
|
||||
.word _a2e_stdmou_mou+32
|
||||
.byte $38
|
||||
.byte $60
|
||||
.byte $05
|
||||
.byte $07
|
||||
.byte $0B
|
||||
.byte $0C
|
||||
.byte $38
|
||||
.byte $18
|
||||
.byte $01
|
||||
.byte $20
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $00
|
||||
.byte $17
|
||||
.byte $01
|
||||
.byte $BF
|
||||
.byte $00
|
||||
|
||||
;
|
||||
; DATA SEGMENT
|
||||
;
|
||||
.segment "DATA"
|
||||
DATA:
|
||||
.byte $BC
|
||||
.byte $00
|
||||
.byte $FF
|
||||
.byte $8C
|
||||
.word DATA+11
|
||||
.byte $A2
|
||||
.byte $FF
|
||||
.byte $A0
|
||||
.byte $FF
|
||||
.byte $4C
|
||||
.byte $FF
|
||||
.byte $FF
|
||||
|
||||
;
|
||||
; BSS SEGMENT
|
||||
;
|
||||
.segment "BSS"
|
||||
BSS:
|
||||
.res 15
|
||||
|
||||
;
|
||||
; ZEROPAGE SEGMENT
|
||||
;
|
||||
.import __ZP_START__ ; Linker generated symbol
|
||||
ZEROPAGE = __ZP_START__
|
||||
|
||||
.end
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "mouseWrapper.h"
|
||||
#include "vbl.h"
|
||||
|
||||
|
||||
|
@ -87,6 +88,7 @@ void initMachine(void)
|
|||
gVblWait = vblWaitNon2c;
|
||||
|
||||
if (machineIs2c()) {
|
||||
initMouse();
|
||||
gVblWait = vblWait2c;
|
||||
} else if (machineIs2GS()) {
|
||||
vblInit2gs();
|
||||
|
@ -100,4 +102,7 @@ void uninitMachine(void)
|
|||
if (machineIs2GS()) {
|
||||
setGSSpeed(gOldSpeed);
|
||||
}
|
||||
if (machineIs2c()) {
|
||||
shutdownMouse();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void splashScreen(void)
|
|||
"\n" // 20
|
||||
"THE SOLID FLOOR IS THE END OF THE LEVEL." // 21
|
||||
"\n" // 22
|
||||
" PRESS ANY KEY TO BEGIN" // 23
|
||||
" PRESS ANY KEY TO BEGIN" // 23
|
||||
);
|
||||
cgetc();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
//
|
||||
// mouseWrapper.c
|
||||
// a2bejwld
|
||||
//
|
||||
// Created by Jeremy Rand on 2016-08-17.
|
||||
// Copyright © 2016 Jeremy Rand. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <mouse.h>
|
||||
|
||||
#include "mouseWrapper.h"
|
||||
#include "game.h"
|
||||
#include "vbl.h"
|
||||
|
||||
|
||||
// Extern to mouse driver
|
||||
|
||||
extern char a2e_stdmou_mou;
|
||||
|
||||
|
||||
// Globals
|
||||
|
||||
static bool gMouseInstalled = false;
|
||||
|
||||
static struct mouse_callbacks gMouseDrvCallbacks;
|
||||
|
||||
|
||||
bool initMouse(void)
|
||||
{
|
||||
if (!gMouseInstalled) {
|
||||
gMouseDrvCallbacks.hide = mouse_def_callbacks.hide;
|
||||
// This callback is here for the //c VBL which is only detectable
|
||||
// through the mouse interrupt. By registering this as our "show"
|
||||
// function, we can ensure that we get called on our VBL interrupt
|
||||
// and can unblock our VBL wait function.
|
||||
gMouseDrvCallbacks.show = vblIRQCallback;
|
||||
gMouseDrvCallbacks.movex = mouse_def_callbacks.movex;
|
||||
gMouseDrvCallbacks.movey = mouse_def_callbacks.movey;
|
||||
|
||||
if (mouse_install(&gMouseDrvCallbacks, &a2e_stdmou_mou) == 0) {
|
||||
gMouseInstalled = true;
|
||||
|
||||
// This is required to ensure that the show callback is called
|
||||
// by the interrupt handler. This whole thing is a bit of a
|
||||
// hack to get the default mouse interrupt handler to do what
|
||||
// we want on the //c to detect the VBL but it works for now.
|
||||
mouse_show();
|
||||
}
|
||||
}
|
||||
|
||||
return gMouseInstalled;
|
||||
}
|
||||
|
||||
|
||||
void shutdownMouse(void)
|
||||
{
|
||||
if (gMouseInstalled) {
|
||||
mouse_uninstall();
|
||||
gMouseInstalled = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// mouseWrapper.h
|
||||
// a2bejwld
|
||||
//
|
||||
// Created by Jeremy Rand on 2016-08-17.
|
||||
// Copyright © 2016 Jeremy Rand. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __a2bejwld__mouseWrapper__
|
||||
#define __a2bejwld__mouseWrapper__
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
// API
|
||||
|
||||
extern bool initMouse(void);
|
||||
extern void shutdownMouse(void);
|
||||
|
||||
|
||||
#endif /* defined(__a2bejwld__mouseWrapper__) */
|
Loading…
Reference in New Issue