Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Image-noise/XPL0/image-noise.xpl0
Normal file
26
Task/Image-noise/XPL0/image-noise.xpl0
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
include c:\cxpl\codes; \intrinsic 'code' declarations
|
||||
int CpuReg, \address of CPU register array (from GetReg)
|
||||
FPS, \frames per second, the display's update rate
|
||||
Sec, \current second of time (from real-time clock)
|
||||
SecOld, \previous second of time
|
||||
X, Y;
|
||||
[SetVid($101); \set 640x480 graphics
|
||||
CpuReg:= GetReg; \get address of array to access CPU registers
|
||||
FPS:= 0;
|
||||
repeat CpuReg(0):= $0200; \get current time in seconds from BIOS
|
||||
SoftInt($1A); \software interrupt
|
||||
Sec:= CpuReg(3)>>8 & $FF; \register DH contains seconds
|
||||
if Sec = SecOld then \if same as before then
|
||||
FPS:= FPS+1 \ bump FPS counter
|
||||
else [SecOld:= Sec; \otherwise save old seconds and
|
||||
CrLf(6);
|
||||
IntOut(6, FPS); \ display FPS counter (once per second)
|
||||
Text(6, " FPS");
|
||||
FPS:= 0; \ reset FPS counter
|
||||
];
|
||||
for Y:= 0, 240-1 do \fill image with random black and white pixels
|
||||
for X:= 0, 320-1 do
|
||||
Point(X, Y, if Ran(2) then $F\white\ else 0\black\);
|
||||
until KeyHit;
|
||||
SetVid(3); \restore normal text mode
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue