How to resolve the algorithm System time step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm System time step by step in the XPL0 programming language
Table of Contents
Problem Statement
Output the system time (any units will do as long as they are noted) either by a system command or one built into the language. The system time can be used for debugging, network information, random number seeds, or something as simple as program performance.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm System time step by step in the XPL0 programming language
Source code in the xpl0 programming language
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);
]
You may also check:How to resolve the algorithm Rare numbers step by step in the D programming language
You may also check:How to resolve the algorithm Safe primes and unsafe primes step by step in the jq programming language
You may also check:How to resolve the algorithm File modification time step by step in the Fortran programming language
You may also check:How to resolve the algorithm Sockets step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Align columns step by step in the Beads programming language