home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
microcrn
/
issue_40.arc
/
SCANNER.ARC
/
TESTSCAN.MOD
< prev
Wrap
Text File
|
1988-01-11
|
2KB
|
49 lines
(* Code from Pascal column of Micro Cornucopia Issue #39 *)
MODULE TestScan;
(* First run pixel capture software, all it does is scan and display.
My results with this show that:
1. In order to get reasonable resolution, the sensor will have to
be apertured.
2. The scanned image WILL need image processing.
3. The possibility to have lots of fun is good.
*)
FROM ScrnStuff IMPORT Screen, ClrScr, GraphMode, TextMode, Scan,
PixAddress, Buffer, SetBit, SetClock;
FROM Terminal IMPORT KeyPressed;
FROM Config IMPORT Xsize, Ysize;
CONST
TickSize = 1536; (* real time clock chip divisor, this value gave
reasonable results. Subject to change. *)
VAR
S [0b000h:0] : Screen; (* use appropriate constants for your adapter *)
I, J, K, L : CARDINAL;
B : Buffer;
A : POINTER TO CHAR;
BP : CARDINAL; (* not used except as throwaway parameter *)
ch : CHAR;
BEGIN
ClrScr(S); (* clear the screen *)
GraphMode; (* put it in graphics mode *)
SetClock(TickSize);
FOR J := 0 TO Ysize-1 DO (* for now, just try for same resolution as screen *)
Scan(B); (* capture a line od data *)
FOR K := 0 TO Xsize-1 BY 8 DO (* Xsize is bits, do a byte at a time *)
A := PixAddress(K,J,BP); (* calculate byte address *)
ch := 0c; (* clear assembly variable *)
FOR L := 0 TO 7 DO (* then do each bit in the byte *)
IF B[K+L] < 7C THEN (* this inverts image, & monochrome mode *)
ch := SetBit(ch,7-L);
END;
END;
A^ := ch; (* actual screen byte update here *)
END;
END;
WHILE NOT(KeyPressed()) DO END; (* admire the picture for a bit *)
ClrScr(S); (* then do orderly exit *)
TextMode; (* should also SlowClock *)
END TestScan.