BREAKOUT, an example from Borland Pascal
In order for the original source code from Borland to work with
Virtual Pascal for OS/2, the following changes need to be made. Note,
that the source will still work with Borland Pascal after the changes
have been made.
* Add Use32 to all the Uses clause of all units
* Change BREAKOUT.PAS and WALLS.PAS
- In line 235 (BREAKOUT.PAS) or line 54 (WALLS.PAS), replace
sound(150);
Delay(300);
nosound;
by the following:
{$IFDEF OS2}
PlaySound(150,300);
{$ELSE}
sound(150);
Delay(300);
nosound;
{$ENDIF}
* Change SCREEN.PAS:
- The two function GetCursor and SetCursor are implemented with
16-bit assembler source, and need to be replaced by the equivalent
OS/2 API calls.
Insert the following code before the existing definition of
Cursor.GetCursor, around line 131:
{$IFDEF OS2}
function Cursor.GetCursor : Integer;
var
cX,cY: SmallWord;
begin
VioGetCurPos(cY,cX,0);
GetCursor := cY shl 8 + cX;
end;
procedure Cursor.SetCursor(NewCursor : Integer);
var
cX,cY: SmallWord;
begin
cX := Lo(NewCursor);
cY := Hi(NewCursor);
VioSetCurPos(cY,cX,0);
end;
{$ELSE}
Also, add
{$ENDIF}
after the old definition of Cursor.SetCursor.
* Change BREAKOUT.PAS:
- After the Uses clause, add the following:
{$IFDEF VPDEMO}
{$Dynamic VP11Demo.Lib}
{$ENDIF}
This means, that the program will use all units stored in the
Demo Licence DLL (vp11demo.dll) when the program is compiled with
the demonstration version of VP/2.