Discussion:
QUICK, Pascal to C translation
(too old to reply)
Andrew Wan
2007-12-28 10:57:12 UTC
Permalink
Please can Pascal/C gurrus help me to confirm this:

l := port[$60];
l = inp( 0x60 );

keys[l mod 128] := l < 128;
keys[l & 127] = (l < 128);

mem[$0040:$001a] := mem[$0040: $001c]; {Pascal}
pokeb(0x40, 0x1a, peekb(0x40, 0x1c)); // C

port[$20] := $20;
outp( 0x20, 0x20 );

---

Yes you probably figured it out. It's a new keyboard handler.
Marco van de Voort
2007-12-28 12:18:39 UTC
Permalink
["Followup-To:" header set to comp.lang.pascal.borland.]
Post by Andrew Wan
l := port[$60];
l = inp( 0x60 );
Assuming it is a dos compiler: yes. inp is not standard C btw.
Post by Andrew Wan
keys[l mod 128] := l < 128;
keys[l & 127] = (l < 128);
Assuming keys isn't an array defined with a negative starting index.
Post by Andrew Wan
mem[$0040:$001a] := mem[$0040: $001c]; {Pascal}
pokeb(0x40, 0x1a, peekb(0x40, 0x1c)); // C
I do not know that statement in a C compiler, but it looks logical.
Post by Andrew Wan
port[$20] := $20;
outp( 0x20, 0x20 );
Also looks ok.

Of course the usual saveguards exist (e.g. direct port I/O is sometimes
problematic on NT class Windows versions like XP)

Loading...