How to resolve the algorithm Show ASCII table step by step in the PL/M programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Show ASCII table step by step in the PL/M programming language
Table of Contents
Problem Statement
Show the ASCII character set from values 32 to 127 (decimal) in a table format.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Show ASCII table step by step in the PL/M programming language
Source code in the pl/m programming language
100H: /* SHOW AN ASCII TABLE FROM 32 TO 127 */
/* CP/M BDOS SYSTEM CALL */
BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END;
/* I/O ROUTINES */
PR$CHAR: PROCEDURE( C ); DECLARE C BYTE; CALL BDOS( 2, C ); END;
PR$STRING: PROCEDURE( S ); DECLARE S ADDRESS; CALL BDOS( 9, S ); END;
PR$BYTE: PROCEDURE( N );
DECLARE N BYTE;
DECLARE V BYTE;
V = N MOD 100;
CALL PR$CHAR( ' ' );
CALL PR$CHAR( '0' + ( N / 100 ) );
CALL PR$CHAR( '0' + ( V / 10 ) );
CALL PR$CHAR( '0' + ( V MOD 10 ) );
END PR$BYTE;
/* ASCII TABLE */
DECLARE ( A, C ) BYTE;
DO C = 32 TO 32 + 15;
DO A = C TO C + ( 16 * 5 ) BY 16;
CALL PR$BYTE( A );
CALL PR$STRING( .': $' );
IF A = 32 THEN CALL PR$STRING( .'SPC$' );
ELSE IF A = 127 THEN CALL PR$STRING( .'DEL$' );
ELSE DO;
CALL PR$CHAR( ' ' );
CALL PR$CHAR( A );
CALL PR$CHAR( ' ' );
END;
END;
CALL PR$STRING( .( 0DH, 0AH, '$' ) );
END;
EOF
You may also check:How to resolve the algorithm Integer sequence step by step in the PowerShell programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm 15 puzzle game step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Perfect totient numbers step by step in the APL programming language
You may also check:How to resolve the algorithm Angle difference between two bearings step by step in the Racket programming language