26.10.2013 Views

2 - Forth Interest Group

2 - Forth Interest Group

2 - Forth Interest Group

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

\ FCONTROL.SEQ<br />

\ F-PC<br />

Ken Merk Apr/95<br />

\<br />

\<br />

<strong>Forth</strong> Code to control parallel printer port.<br />

............................................<br />

DECIMAL<br />

\ Look for active LPTl port<br />

\ If no port found then abort<br />

CLS<br />

23 8 AT . ( Parallel printer port not found.)<br />

CLOSE QUIT<br />

$0040 $0008 @L CONSTANT #PORT \ Find port addr for printer card<br />

\ assign to constant #PORT<br />

1 CONSTANT FAN \ assign each device its<br />

2 CONSTANT DRILL \ binary weighting<br />

4 CONSTANT PUMP<br />

8 CONSTANT SPRINKLER<br />

16 CONSTANT HEATER<br />

32 CONSTANT LIGHT<br />

64 CONSTANT MOTOR<br />

128 CONSTANT VALVE<br />

code bset ( b #port -- ) \ will SET each bit in #port that<br />

POP dx \ matches every high bit in byte b.<br />

POP bx<br />

in ax, dx<br />

or al, bx<br />

out dx, a1<br />

next<br />

end-code<br />

code breset ( b #port -- ) \ will RESET each bit in #port that<br />

POP dx \ matches every high bit in byte b.<br />

POP bx<br />

not bx<br />

in ax, dx<br />

and al, bx<br />

out dx, a1<br />

next<br />

end-code<br />

code btoggle ( b #port -- ) \ w i l l TOGGLE each bit in #port that<br />

POP dx \ matches every high bit in byte b.<br />

POP bx<br />

in ax, dx<br />

xor al, bx<br />

out dx, a1<br />

next<br />

end-code (code continues on nextpage.)<br />

<strong>Forth</strong> Dimensions July 1995 August

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!