|
If anyone is at all interested, I have a completed porting the brickOS
headers to a set of Pascal units. At present, I have successfully written
Pascal versions of essentially all the C and C++ demo files - including
TrailerBot. I've also written a Pascal version of the LegWay source code.
Here are the details:
1. A Hitachi H8 Gnu Pascal cross-compiler built from source (without the run
time system - RTS) and installed in a cygwin environment. I can provide a
ZIP containing pre-built binaries if anyone is interested.
2. Pascal units and other source code (in lib\p):
stub.c types.pas irq.pas bitops.pas battery.pas conio.pas cstring.pas
dbutton.pas dkey.pas dmotor.pas dsound.pas h8.pas mm.pas programs.pas
registers.pas remote.pas romlcd.pas romsystem.pas semaphore.pas sound.pas
stdlib.pas time.pas timeout.pas tm.pas unistd.pas dlcd.pas lcd.pas
dsensor.pas lnp.pas
ObjBattery.pas ObjSound.pas Motor.pas MotorPair.pas Sensor.pas
TemperatureSensor.pas LightSensor.pas RotationSensor.pas TouchSensor.pas
Plus a simple makefile for building the libraries.
3. 2 libraries (libgpc.a & liboogpc.a) built from Pascal versions of the
brickOS headers. liboogpc.a contains the Pascal Objects that mirror the C++
classes defined in the C++ headers.
4. Tweaks to the brickOS (brickos-0.2.6.07.nmChg) makefiles.
In Makefile.Common:
PFLAGS=--extended-syntax --unit-path=$(BRICKOS_ROOT)lib/p
GPC=$(TOOLPREFIX)gpc
# how to compile pas source
%.o: %.pas
$(GPC) $(CFLAGS) $(PFLAGS) -c $< -o $@
# how to generate an assembly listing of pascal source
%.s: %.pas
$(GPC) $(CFLAGS) $(PFLAGS) -c $< -S
In Makefile.User:
LIBS=-loogpc -lgpc -lc -lmint -lfloat -lc++
5. Sample Pascal brickOS programs:
activesens.pas helloworld2.pas legway2.pas linetrack2.pas raceTrack.pas
rover2.pas sound2.pas tempsens.pas trailerbot2.pas
Here's a sample of what the source looks like:
program raceTrack;
uses
conio, unistd, Motor, MotorPair, Sensor, LightSensor;
const
m_min = 0;
m_max = 255;
var
m : TMotorPair;
l : TLightSensor;
speed : integer;
value, lightLevel, threshold : word;
begin
m.Create(mpA, mpC);
l.Create(spS2);
speed := (m_max + m_min) div 3;
m.TurnOff;
lightLevel := l.SampleDefault;
threshold := lightLevel + 5;
cputw(lightLevel);
sleep(2);
while true do begin
m.ForwardSpeed(speed);
while true do begin
value := l.Get;
cputw(value);
if value > threshold then
break;
end;
m.BrakeDuration(100);
m.LeftSpeed(m_max);
while true do begin
value := l.Get;
cputw(value);
if value < threshold then
break;
end;
m.BrakeDuration(100);
end;
m.Destroy;
l.Destroy;
end.
brickOS team members, is there any interest in adding Gnu Pascal support to
the official brickOS release?
LMKWYT,
John Hansen
http://members.aol.com/johnbinder/bricxcc.htm
|
|
Message has 2 Replies: | | Re: brickOS & GNU Pascal (update)
|
| (...) <snip> (...) Good work on this. Yes I believe we would like to add this support. We are crunched with trying to get what we want into this next release. We likely can add some of the Makefile mods in this release, maybe the Pascal Units as (...) (22 years ago, 2-Nov-02, to lugnet.robotics.rcx.legos)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|