|
From: Francis Glassborow on 28 Dec 2007 07:15 Andrew Wan wrote: > I found this excellent High Speed Timer (in Pascal). I compiled it > (using Turbo Pascal 7 and it runs fine): > > http://www.sorucevap.com/bilisimteknolojisi/programcilik/pascal/ders.asp?207995 > and same High Speed Timer here too: > http://groups.google.com/group/comp.lang.pascal/browse_thread/thread/92e9398f16c10ba4/e67ff3cf587648ef?lnk=st&q=inline(%24CD)+inline(%241C)+inline(%249C)&rnum=1&hl=en#e67ff3cf587648ef > > I converted it to C (using p2c), compiled it using Borland C++ 4.5 and > it runs. But it crashes when it gets to setvect(...) in TimerOn. > > Does anyone know how IRQ programming works in C? If you know IRQ timer/ > clock please contact me. I need urgent help in understanding why it's > not working. Assuming that what you want is a high resolution timer to time C or C++ code fragments, google 'high resolution timer in C' and start reading. Note that the solutions are necessarily platform specific.
From: Francis Glassborow on 28 Dec 2007 07:15 Andrew Wan wrote: > I found this excellent High Speed Timer (in Pascal). I compiled it > (using Turbo Pascal 7 and it runs fine): > > http://www.sorucevap.com/bilisimteknolojisi/programcilik/pascal/ders.asp?207995 > and same High Speed Timer here too: > http://groups.google.com/group/comp.lang.pascal/browse_thread/thread/92e9398f16c10ba4/e67ff3cf587648ef?lnk=st&q=inline(%24CD)+inline(%241C)+inline(%249C)&rnum=1&hl=en#e67ff3cf587648ef > > I converted it to C (using p2c), compiled it using Borland C++ 4.5 and > it runs. But it crashes when it gets to setvect(...) in TimerOn. > > Does anyone know how IRQ programming works in C? If you know IRQ timer/ > clock please contact me. I need urgent help in understanding why it's > not working. > > Below is my translated C code: What you presented was code that was riddled with warnings from p2c. IOWs the code was way beyond what it can handle correctly. And a quick glance at the code shows such things as inline assembler code. When you say it compiled with Borland C++ 4.5 was that without any diagnostics? If not, have you taken time to look at them and think how to resolve them (yes, warnings are not issued just for fun) I suspect that you know very little about either turbo pascal or C. However, for the sake of argument, let us suppose I am wrong, why do you want to translate from Pascal to C a program that is extremely platform specific? Why not just use the pascal? You might even find that Borland tools will allow you to mix the two languages.
|
Pages: 1 Prev: Printing from MASM (and other droll questions) Next: DMA |