RosettaCodeData/Task/System-time/XPL0/system-time.xpl0

22 lines
785 B
Plaintext

include c:\cxpl\codes; \include intrinsic 'code' declarations
proc NumOut(N); \Output a 2-digit number, including leading zero
int N;
[if N <= 9 then ChOut(0, ^0);
IntOut(0, N);
]; \NumOut
int Reg;
[Reg:= GetReg; \get address of array with copy of CPU registers
Reg(0):= $2C00; \call DOS function 2C (hex)
SoftInt($21); \DOS calls are interrupt 21 (hex)
NumOut(Reg(2) >> 8); \the high byte of register CX contains the hours
ChOut(0, ^:);
NumOut(Reg(2) & $00FF); \the low byte of CX contains the minutes
ChOut(0, ^:);
NumOut(Reg(3) >> 8); \the high byte of DX contains the seconds
ChOut(0, ^.);
NumOut(Reg(3) & $00FF); \the low byte of DX contains hundreths
CrLf(0);
]