1
0
mirror of https://github.com/cc65/cc65.git synced 2024-05-31 22:41:32 +00:00

system vector interception fixes

git-svn-id: svn://svn.cc65.org/cc65/trunk@2339 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
izydorst 2003-08-15 23:17:11 +00:00
parent 247b3953bd
commit fa084ef304
2 changed files with 8 additions and 9 deletions

View File

@ -1607,7 +1607,7 @@ void example = {
<p>
It is possible to intercept and hook in the GEOS Kernal using vectors. Here is a little example:
<tscreen><verb>
void (&ast;oldVector)(void);
void_func oldVector;
void NewVectorHandler(void) &lcub;
// do something and at the end call the old vector routine

View File

@ -5,8 +5,7 @@
unsigned char x,y;
void (*oldMouseVector)();
void (*oldKeyVector)();
void_func oldMouseVector, oldKeyVector;
void foo1 (void) {
// do something on mouse press/release
@ -28,15 +27,15 @@ void foo2 (void) {
void hook_into_system(void) {
// hook into system vectors - preserve old value
oldMouseVector = (void (*)())mouseVector;
mouseVector = (int)foo1;
oldKeyVector = (void (*)())keyVector;
keyVector = (int)foo2;
oldMouseVector = mouseVector;
mouseVector = foo1;
oldKeyVector = keyVector;
keyVector = foo2;
}
void remove_hooks(void) {
mouseVector = (int)oldMouseVector;
keyVector = (int)oldKeyVector;
mouseVector = oldMouseVector;
keyVector = oldKeyVector;
}
int main(void) {