-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fae7ab
commit 946b1fe
Showing
15 changed files
with
394 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,5 +96,5 @@ void keyb_poll(void) | |
} | ||
} | ||
|
||
cia1.pra = 0xff; | ||
cia1.pra = ciaa_pra_def; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "mouse.h" | ||
#include "sid.h" | ||
#include "cia.h" | ||
|
||
sbyte mouse_dx, mouse_dy; | ||
bool mouse_lb, mouse_rb; | ||
static char mouse_px, mouse_py; | ||
static char mouse_port; | ||
|
||
inline signed char dpos(char * old, char new) | ||
{ | ||
new = (new & 0x7f) >> 1; | ||
|
||
char diff = (new - *old) & 0x3f; | ||
|
||
if (diff >= 0x20) | ||
{ | ||
*old = new; | ||
return diff | 0xe0; | ||
} | ||
else if (diff) | ||
{ | ||
*old = new; | ||
return diff; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void mouse_poll(void) | ||
{ | ||
char b = ((volatile char *)0xdc00)[mouse_port]; | ||
mouse_rb = (b & 0x01) == 0; | ||
mouse_lb = (b & 0x10) == 0; | ||
|
||
char x = sid.potx, y = sid.poty; | ||
|
||
mouse_dx = dpos(&mouse_px, x); | ||
mouse_dy = dpos(&mouse_py, y); | ||
} | ||
|
||
void mouse_arm(char n) | ||
{ | ||
mouse_port = n; | ||
cia1.pra = ciaa_pra_def = n ? 0x7f : 0xbf; | ||
} | ||
|
||
void mouse_init(void) | ||
{ | ||
mouse_arm(1); | ||
mouse_poll(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef C64_MOUSE_H | ||
#define C64_MOUSE_H | ||
|
||
#include "types.h" | ||
|
||
extern sbyte mouse_dx, mouse_dy; | ||
extern bool mouse_lb, mouse_rb; | ||
|
||
|
||
void mouse_init(void); | ||
|
||
// arm the potentiometer input for the selected mouse input | ||
// needs ~4ms to stabilize | ||
|
||
void mouse_arm(char n); | ||
|
||
// poll mouse input for selected mouse, but the relative | ||
// movement into mouse_dx/dy and the button state into | ||
// mouse_lb/mouse_rb | ||
|
||
void mouse_poll(void); | ||
|
||
#pragma compile("mouse.c") | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
call ..\..\bin\oscar64 floodfill.c -n | ||
call ..\..\bin\oscar64 polygon.c -n | ||
call ..\..\bin\oscar64 func3d.c -n | ||
call ..\..\bin\oscar64 paint.c -n |
Oops, something went wrong.