Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I reference a C++ member in assembler?

Status
Not open for further replies.

tyrant

Programmer
Apr 24, 2000
2
0
0
US
I am trying to add the vector of an interrupt routine, where the interrupt routine itself is a C++ member function. How do I do this?<br><br>my assembler so far is:<br><br>push ds<br>xor ax, ax<br>mov ds, ax<br>mov si, 4*T2INT ; timer 2 interrupt is 19<br><br>Now this line is where I need to reference the C++ function called Timer::Interrupt<br><br>mov word ptr ds:[si}, offset Timer::Interrupt<br><br>But this doesn't work! no surprise there, but how do I reference the function? <br>Timer::Interupt looks like this....<br><br>void interrupt Timer::Interupt()<br>{<br>&nbsp;&nbsp;&nbsp;//decrement active software timers count<br>&nbsp;&nbsp;&nbsp;timerlist.tick();<br><br>&nbsp;&nbsp;&nbsp;//acknowledge timer interrupt<br>&nbsp;&nbsp;&nbsp;outportb(EOI, EOI_NONSPECIFIC);<br><br>&nbsp;&nbsp;&nbsp;//clear max count bit to start next cycle<br>&nbsp;&nbsp;&nbsp;unsigned short t2control;<br>&nbsp;&nbsp;&nbsp;t2control = inportb(T2CON);<br>&nbsp;&nbsp;&nbsp;t2control &= ~TIMER_MAXCOUNT;<br>&nbsp;&nbsp;&nbsp;outportb(T2CON, t2control);<br>}<br><br><br>I could write the ISR in assembly if anybody could tell me how I call timerlist.tick() from the assembly routine.<br><br>Any help would be greatly appreciated...<br>Thanks,<br>Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top