Of course, the pointer to the function anycodings_turbo-pascal (VariableLess) should not have the type anycodings_turbo-pascal pointer but the type TM圜ompare if you anycodings_turbo-pascal do it like this. This would even be anycodings_turbo-pascal more efficient. Or you could even replace all anycodings_turbo-pascal occurrences of Less(x,y,z) in your anycodings_turbo-pascal program by z(x,y). If your compiler supports function anycodings_turbo-pascal pointers (type TM圜ompare = function anycodings_turbo-pascal. TM圜ompare = function(var a, b) : boolean įunction Less (var a, b Relation : TM圜ompare) : boolean
FREE PASCAL ASM DB CODE
The code is equal to the following anycodings_turbo-pascal Delphi or FreePascal code: type
FREE PASCAL ASM DB PLUS
Using the assembly code given, you can anycodings_turbo-pascal call any function or procedure with any anycodings_turbo-pascal parameters (in your case: VariableLess) anycodings_turbo-pascal indirectly by writing a helper function anycodings_turbo-pascal (in your case: Less) that has the same anycodings_turbo-pascal arguments as the function to be called anycodings_turbo-pascal plus an additional argument that points anycodings_turbo-pascal to the actual function. With this knowledge the assembly code anycodings_turbo-pascal can be analyzed: And it must not return anycodings_turbo-pascal using ret but simply continue code anycodings_turbo-pascal execution at the instruction after the anycodings_turbo-pascal inline code. The inline machine anycodings_turbo-pascal language code must pop the arguments anycodings_turbo-pascal from the stack. This means that SS:SP anycodings_turbo-pascal points to the arguments, not to the anycodings_turbo-pascal return address. In an inline function, the raw bytes anycodings_turbo-pascal given simply replace the call anycodings_turbo-pascal instruction. The function returns using anycodings_turbo-pascal retf n, which means that the function anycodings_turbo-pascal called removes all parameters from the anycodings_turbo-pascal stack.
Then a (far) call is anycodings_turbo-pascal executed.
The first one is pushed first anycodings_turbo-pascal (so SS:SP points to the last function anycodings_turbo-pascal argument). I just compiled some inline function on anycodings_turbo-pascal Turbo Pascal 5 for MS-DOS to check how anycodings_turbo-pascal Turbo Pascal generates code:įor non-inline function calls, Turbo anycodings_turbo-pascal Pascal pushes all function arguments to anycodings_turbo-pascal the stack. What should I do to get this to anycodings_turbo-pascal work on a modern 64-bit machine? I realise anycodings_turbo-pascal the code is 16-bit. However, the compiler doesn't like the push anycodings_turbo-pascal statement. The code is supposed to call an external anycodings_turbo-pascal function įunction Less (var a, b Relation : POINTER) : boolean assembler While converting old Turbo Pascal units to anycodings_turbo-pascal modern Object Pascal, I ran into the anycodings_turbo-pascal following: function Less (var a, b Relation : POINTER) : boolean