$30
Laboratory – Microprocessor Based Systems
Laboratory Assignment 4: Resident programs design.
Polybius Square (checkerboard)
This is an invented device around 150 years b.C., within Greeks civilization and made famous by the historian Polybius. This device is based on an easy algorithm changing every alphabet letter by its position coordinates on a checkerboard. This is a particular case of mono-alphabet transposition.
The checkerboard was originally used for fire signalling (like a primitive telegraph) instead of a secret writing method. In the prisons of Tsarist Russia, a similar checkerboard but with six numbers to contain the Cyrillic alphabet was used to communicate, by knocking on the walls.
From a cryptography point of view, Polybius checkerboard has three very interesting characteristics:
- First, it is useful for transforming alphabet characters into numbers. So then arithmetic transformation can be applied to.
- Second, it reduces from 36 to 6 characters (originally from 25 to 5) making easier a message transmission.
-
Finally, it links two digits for every character. This way both digits can be independently manipulated through transposition techniques.
Operating principle
Let’s set a checkerboard with the following alphabet:
1
2
3
4
5
6
1
A
B
C
D
E
F
2
G
H
I
J
K
L
3
M
N
O
P
Q
R
4
S
T
U
V
W
X
5
Y
Z
0
1
2
3
6
4
5
6
7
8
9
For instance, Polybius word would be: 34 33 26 51 12 23 43 41
Microprocessor Based Systems Lab. 2022 Pg. 1
Program 1: p4a.asm
To design a resident program for installing a vector in the INT 57h, supplying services in AH=10H to show on the screen a string codification from a Polybius code, and in AH=11 to show on the screen the decoding string to a Polybius code. The string will be in DS:DX and they will finish with $.
To develop a .COM program, including the following:
• To implement a service routine to the 57h interrupt, offering previous specified services.
• To show installation driver state, group number (Polybius version) and the instructions for using, if it is executed without parameters.
• To install a driver (if it’s not installed yet), if /l parameter is used.
• To uninstall a driver (if it’s already installed), if /D parameter is used.
Program 2: p4b.asm
To make a program to show on the screen the used Polybius matrix and check the previous resident program operating through the coding/decoding of a predefined message.
Periodic interrupt (1Ch)
Counter program (PC), with some temporized electronic, asks to the microprocessor for an interrupt 18.2 times per second. This way, a programmer may use such interruption when he needs to make a periodic task. This interrupt is the 08-hardware interruption attention routine, which not only oversees control and maintenance tasks but also makes a call to 1Ch-software interrupt.
By default, there is only IRET instruction inside the attention routine. The programmer may performance periodic tasks without more modifications, just by reinstalling this interruption vector.
Program 3 p4c.asm (+ p4a.asm modified)
To make a program which collects a string typed on the keyboard and shows on the screen every character converted into Polybius code. To do so, the program will be using the interruption defined on the previous exercise with a ratio of, approximately, one character per second. You must use 1Ch interrupt for the temporization. It’s highly recommended that you use p4a.com program for including the service interruption routine (SIR) of 1Ch.
Besides, it must ask for enabling and disabling interruptions of driver installation. To do so, there must be applied a selective TIMER inhibition/disinhibition, modifying bit 0 from mask register (MRI), of master interrupt controller, instead of CLI/STI. As a guide, you can use IN for register reading with a binary mask to change the LSB and OUT for writing a result.
Whenever ‘decod’ is received, the program must decode the following strings unless it is received ‘cod’ or ‘quit’. Whenever ‘cod’ is received, the program must code the following strings unless it is received decod or quit. The program will finish by the time ‘quit’ is received.