TP6 code -> assembler

TP6 code -> assembler

Author

Message

Mikko Kankaanp?#1 / 6

TP6 code -> assembler

-- Does anyone if there is a program, that can convert Turbo Pascal 6.0 code into assembler. I made a water engine completely with pascal code and it's s-l-o-w. I can't program in assembler, so information about program that can convert my code, would help me a lot.

Mikko Kankaanp??

Wed, 18 Jun 1902 08:00:00 GMT

Remco Vieto#2 / 6

TP6 code -> assembler

Quote:

> -- Does anyone if there is a program, that can convert Turbo Pascal 6.0 > code into assembler. I made a water engine completely with pascal code and > it's s-l-o-w. I can't program in assembler, so information about program > that > can convert my code, would help me a lot.

> Mikko Kankaanp??

You have a program that converts TP into assembler: it is called a compiler :)

Seriously, I doubt that it would help you much: what makes assembler fast is all the shortcuts you can use at that level (inline codes and that kind of things). What would be more usefull as a first try is to see where your program spends its time, using a profiler (BP7 has one, standalone), I don't know about TP6. Then try and optimise the slowest parts by hand (in pascal). If that doesn't speed up things enough, try and use your de{*filter*} to look at the machine code generated and convert some bits of that into assembler (inline) code (never done that yet myself).

A few hints about pascal optimisations: - avoid divisions as much as possible, especially within a loop - this goes even more with trigonometric functions and exp/log, you can use lookup tables for sin/cos, depending on the precision required. Also using 2 or 3 tables + addition/multiplication, you can get high precision for sin/cos with a gain in speed (e.g.: use one table for 1 degree precision, one for 0.01 degree precision (_if needed_!), and use the proper formulas to add the two together). - get as much of the calculations outside loops (use extra local vars if you have to). Moving half the calculation outside the loop should almost double the speed (except for loop overhead). - Write/Writeln is slow. Use with care: prepare large blocks in memory for fast dumping with blockwrite (e.g.). See if you cannot minimise output. - Use math coprocessor with Single/Double/Extended, and _not_ with Real type: Real must be converted for each calculation using the CPU, S/D/E are the native math processor types. When no math coprocessor available, the inverse holds.

Hope this helps,

Remco -- R.J. Vi?tor | AFE Chemistry

| University of Glasgow The views expressed in this | Glasgow G12 8QQ message represent only the | UK personal views of the author |

Wed, 18 Jun 1902 08:00:00 GMT

Osmo Ronkan#3 / 6

TP6 code -> assembler

Quote:

>-- Does anyone if there is a program, that can convert Turbo Pascal 6.0 >code into assembler. I made a water engine completely with pascal code and >it's s-l-o-w. I can't program in assembler, so information about program >that >can convert my code, would help me a lot.

TP is a compiler so it compiles the Pascal code into machine code. There is no simple way to produce assembler code but what would you do with anyway if you know nothing about assembler.

Before thinking about converting to assembler you might try to optimize the algorithms that you use. If you start to code in ASM, isolate the most used code, like the inmost loop or so and focus on it.

Is the code long? Could you post/mail the critical parts.

Osmo

P.S. Kyll? assembleria kannattaa opetella, se on ihan hauskaa.

Wed, 18 Jun 1902 08:00:00 GMT

mako#4 / 6

TP6 code -> assembler

Another good idea is to use some profiling tool (i.e. TPROF which comes with BP ). This will give you an idea of what parts of program (which loops in particular) pay to be optimised or perhaps replaced with another strategy (algorithm).

Quote:

> >-- Does anyone if there is a program, that can convert Turbo Pascal 6.0 > >code into assembler. I made a water engine completely with pascal code and > >it's s-l-o-w. I can't program in assembler, so information about program > >that > >can convert my code, would help me a lot.

> TP is a compiler so it compiles the Pascal code into machine code. There > is no simple way to produce assembler code but what would you do with > anyway if you know nothing about assembler.

> Before thinking about converting to assembler you might try to optimize > the algorithms that you use. If you start to code in ASM, isolate the > most used code, like the inmost loop or so and focus on it.