Thread View: comp.lang.pascal.borland
2 messages
2 total messages
Started by Andrew Wan
Fri, 28 Dec 2007 10:57
QUICK, Pascal to C translation
Author: Andrew Wan
Date: Fri, 28 Dec 2007 10:57
Date: Fri, 28 Dec 2007 10:57
17 lines
1630 bytes
1630 bytes
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.
Re: QUICK, Pascal to C translation
Author: Marco van de Voort
Date: Fri, 28 Dec 2007 12:18
Date: Fri, 28 Dec 2007 12:18
26 lines
1799 bytes
1799 bytes
["Followup-To:" header set to comp.lang.pascal.borland.]
On 2007-12-28, Andrew Wan <andwan0@googlemail.com> wrote:
> Please can Pascal/C gurrus help me to confirm this:
>
> l := port[$60];
> l = inp( 0x60 );
Assuming it is a dos compiler: yes. inp is not standard C btw.
> keys[l mod 128] := l < 128;
> keys[l & 127] = (l < 128);
Assuming keys isn't an array defined with a negative starting index.
> 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.
> 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)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads