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

View File

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