summaryrefslogtreecommitdiff
path: root/2522/CH7/EX7.7/exm7_7.sce
blob: ed4ec0ba4a1b9770516ea04f93e6a1bc3d2bfc14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//page no 229
//example no 7.7
// INCREMENT & DECREMENT.
clc;
disp('LXI H,2040H'); // loads HL register pair.
disp('H=20H     L=40H');
disp('MVI M,59H'); 
M=59;
M=hex2dec(['59']);
disp('2040H-->59H')
disp('INR M');
M=M+1; // increments the value at the memory location by 1.
m=dec2hex(M);
printf('\n Content of 2040H after increment= ');
disp(m);
disp('INX H'); //takes the program to the next memory location.
disp('H=20H     L=41H');
disp('MVI M,90H');
M=90;
M=hex2dec(['90']);
disp('2041H-->90H');
disp('DCR M');
M=M-1; //decrements the value at the memory location by 1.
m=dec2hex(M);
printf('\n Content of 2041H after decrement= ');
disp(m);