### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook (preview only)

### Author Topic: [CLOSED] TP/BP compatibility  (Read 2107 times)

#### julkas

• Sr. Member
• Posts: 348
• KISS principle / Lazarus 2.0.0 / FPC 3.0.4
##### Re: TP/BP compatibility
« Reply #45 on: August 24, 2019, 02:59:13 pm »
My approach with pointer arithmetic works (see above), but slow (DOSBOX).

procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
mov rax, a
mov rdx, b
mul rdx
mov [clo], rax
mov [chi], rdx
end;
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;

#### julkas

• Sr. Member
• Posts: 348
• KISS principle / Lazarus 2.0.0 / FPC 3.0.4
##### Re: TP/BP compatibility
« Reply #46 on: August 24, 2019, 04:00:34 pm »
Graffiti -
Code: Pascal  [Select]
1. program mgtest;
2.
3. {\$ifdef FPC}{\$mode tp}{\$endif}
4. {\$ifdef VER70}{\$X+}{\$F+}{\$endif}
5.
6. uses crt, ug_fonts, ug, ug_types, graph;
7. var
8. gui: UG_GUI;
9. grmode, grdriver :integer;
10. x,y : integer;
11.
12. procedure pset(x: UG_S16; y: UG_S16; c: UG_COLOR);
13. begin
14.   PutPixel(x, y, c);
15. end;
16.
17. begin
18.   grdriver := DETECT;
19. {\$ifdef FPC}
20.   initgraph(grdriver, grmode, ' ');
21. {\$endif}
22. {\$ifdef VER70}
23.   initgraph(grdriver, grmode, 'C:\TP7\BGI');
24. {\$endif}
25.
26.   UG_Init(gui, pset, getmaxx, getmaxy);
27.   UG_SetBackcolor(black);
28.   UG_SetForecolor(blue);
29.
30.   UG_FontSelect(@FONT_8X14);
31.   UG_PutString(100, 100, 'Hello, Pascal!');
32.
33.   UG_FontSelect(@FONT_16X26);
34.   UG_PutString(140, 140, 'Hello, Pascal!');
35. (*
36.   UG_DrawCircle(250, 400, 100, white);
37.   UG_FillCircle(250, 400, 80, white);
38. *)
39.   UG_ConsoleSetArea(getmaxx div 2, getmaxy div 2, getmaxx, getmaxy);
40.   UG_ConsoleSetForecolor(blue);
41.   UG_ConsoleSetBackcolor(white);
42.   UG_ConsolePutString('High Voltage' + #10);
43.   UG_ConsolePutString('Rebooting...' + #10);
45.
47.   CloseGraph;
48. end.
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
mov rax, a
mov rdx, b
mul rdx
mov [clo], rax
mov [chi], rdx
end;
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;

#### julkas

• Sr. Member
• Posts: 348
• KISS principle / Lazarus 2.0.0 / FPC 3.0.4
##### Re: TP/BP compatibility
« Reply #47 on: August 24, 2019, 06:00:26 pm »
Also, big performance drop -
Code: Pascal  [Select]
1. type
2.   TProc = procedure (...);
3. procedure call(p: TProc);
4.
It's graffiti, I know.
« Last Edit: August 24, 2019, 06:14:32 pm by julkas »
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
mov rax, a
mov rdx, b
mul rdx
mov [clo], rax
mov [chi], rdx
end;
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;

#### PascalDragon

• Hero Member
• Posts: 562
• Compiler Developer
##### Re: TP/BP compatibility
« Reply #48 on: August 25, 2019, 12:48:53 pm »
I use Lazarus/FPC as primary IDE.
TP/BP is still alive (whether you like it or not) ...  see - System Requirements http://www.on-time.com/rtkernel-dos.htm

Probably old. But one reference on the internet means that a product/project is alive? Well, then probably nothing is dead. Even if it is just graffiti on the walls of Pompeii
Well, according to the date at the bottom left the website at least still appears to be updated... *shrugs*

#### julkas

• Sr. Member
• Posts: 348
• KISS principle / Lazarus 2.0.0 / FPC 3.0.4
##### Re: TP/BP compatibility
« Reply #49 on: August 27, 2019, 05:23:11 pm »
How disassemble TP/BP compiled units?
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
mov rax, a
mov rdx, b
mul rdx
mov [clo], rax
mov [chi], rdx
end;
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;

#### marcov

• Global Moderator
• Hero Member
• Posts: 7354
##### Re: TP/BP compatibility
« Reply #50 on: September 01, 2019, 03:52:47 pm »
How disassemble TP/BP compiled units?

This question belongs  in a TP/BP forum. This forum is about FPC.

Short answer: while there are some expensive reverse engineering tools, generally the consensus is that you can't