diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2522/CH7 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2522/CH7')
23 files changed, 257 insertions, 0 deletions
diff --git a/2522/CH7/EX7.1/exm7_1.sce b/2522/CH7/EX7.1/exm7_1.sce new file mode 100755 index 000000000..85f1c9c16 --- /dev/null +++ b/2522/CH7/EX7.1/exm7_1.sce @@ -0,0 +1,12 @@ +//page no 216
+//example no 7.1
+//STEPS TO ADD 10 BYTES OF DATA.
+clc;
+disp('The micriprocessor needs :');
+disp('a counter to count 10 data bytes');
+disp('an index or a memory pointer to locate where data bytes are stored');
+disp('to transfer data from a memory location to the microprocessor');
+disp('to perform addition');
+disp('registers for temporary storage of partial answers');
+disp('a flag to indicate the completion of the task');
+disp('to store or output the result');
diff --git a/2522/CH7/EX7.1/exm7_1_output.jpg b/2522/CH7/EX7.1/exm7_1_output.jpg Binary files differnew file mode 100755 index 000000000..974ab1003 --- /dev/null +++ b/2522/CH7/EX7.1/exm7_1_output.jpg diff --git a/2522/CH7/EX7.10/exm7_10.sce b/2522/CH7/EX7.10/exm7_10.sce new file mode 100755 index 000000000..0820ba668 --- /dev/null +++ b/2522/CH7/EX7.10/exm7_10.sce @@ -0,0 +1,29 @@ +//page no 235
+// example no 7.10
+// RIGHT ROTATION (RRC & RAR) OF BITS.
+clc;
+// initially
+printf('Accumulator= 81H \n');
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 0 0 0 0 0 1 =81H \n \n');
+printf('CY= 0 \n \n');
+printf('RRC \n \n');
+printf('CY= 1 \n \n');
+// carry flag is set because D0 bit was 1.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 1 0 0 0 0 0 0 =C0H \n \n'); // after the executuion of RRC.
+// RRC instruction places D0 bit in CY flag as well as in D7 bit.
+
+
+
+// initially
+printf('Accumulator= 81H \n');
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 0 0 0 0 0 1 =81H \n \n');
+printf('CY= 0 \n \n');
+printf('RAR \n \n');
+printf('CY= 1 \n \n');
+// carry flag is set because D0 bit was 1.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 0 1 0 0 0 0 0 0 =40H \n \n'); // after the executuion of RAR.
+// RAR instruction places D0 bit in CY flag & CY flags bit is send to D7 bit.
diff --git a/2522/CH7/EX7.10/exm7_10_output.jpg b/2522/CH7/EX7.10/exm7_10_output.jpg Binary files differnew file mode 100755 index 000000000..144d3d6bd --- /dev/null +++ b/2522/CH7/EX7.10/exm7_10_output.jpg diff --git a/2522/CH7/EX7.11/exm7_11.sce b/2522/CH7/EX7.11/exm7_11.sce new file mode 100755 index 000000000..6e00e460f --- /dev/null +++ b/2522/CH7/EX7.11/exm7_11.sce @@ -0,0 +1,23 @@ +//page no 241
+//example no 7.11
+// COMPARISION OF DATA.
+clc;
+disp('MVI A,64H'); //loads accumulator with 64H.
+disp('A-->64H');
+disp('LXI H,2050H'); // loads HL register pair.
+disp('H=20H L=50H');
+disp('M-->9AH'); //assumed in the solution.
+disp('CMP M');
+//this command compares the contents of A with M by subtracting M from A.
+A=hex2dec(['64']);
+//register M has 9AH. Finding 2's compliment of 9AH.
+M=hex2dec(['9A']);
+a=dec2bin(A);
+m=dec2bin(M);
+t=isequalbitwise(a,m); //compares the two datas bitwise.
+if(A==M) // Jump condition
+ printf('\n Result after comparision is= ');
+ printf('OUT1');
+else
+ printf('\n Result after comparision is= ');
+ disp(t); //this shows the false condition of the bitwise comparision.
diff --git a/2522/CH7/EX7.11/exm7_11_output.jpg b/2522/CH7/EX7.11/exm7_11_output.jpg Binary files differnew file mode 100755 index 000000000..178c3c509 --- /dev/null +++ b/2522/CH7/EX7.11/exm7_11_output.jpg diff --git a/2522/CH7/EX7.2/exm7_2.sce b/2522/CH7/EX7.2/exm7_2.sce new file mode 100755 index 000000000..7bf636aa0 --- /dev/null +++ b/2522/CH7/EX7.2/exm7_2.sce @@ -0,0 +1,15 @@ +//page no 219
+//example no 7.2
+//LOADING 16-BIT NUMBER.
+//working of LXI instruction.
+clc;
+disp('LXI H,2050H'); // loads HL register pair.
+disp('L=50H'); // 50H in L register.
+disp('H=20H'); //20H in H register pair.
+disp('LXI instruction takes 3 bytes of memory and 10 clock periods.')
+//working of MVI instruction.
+disp('MVI H,20H');
+disp('H=20H'); // load 20H in register H.
+disp('MVI L,50H'); // load 50H in register L.
+disp('L=50H');
+disp('2 MVI instructions take 4 bytes of memory and 14 clock periods.')
diff --git a/2522/CH7/EX7.2/exm7_2_output.jpg b/2522/CH7/EX7.2/exm7_2_output.jpg Binary files differnew file mode 100755 index 000000000..2e37cc0c8 --- /dev/null +++ b/2522/CH7/EX7.2/exm7_2_output.jpg diff --git a/2522/CH7/EX7.3/exm7_3.sce b/2522/CH7/EX7.3/exm7_3.sce new file mode 100755 index 000000000..0c622fdcd --- /dev/null +++ b/2522/CH7/EX7.3/exm7_3.sce @@ -0,0 +1,32 @@ +//page no 220
+//example no 7.3
+// TRANSFER OF DATA BYTES TO ACCUMULATOR.
+// Memory location 2050H has the data F7H.
+clc;
+
+// using MOV instruction.
+//indirect addressing mode.
+disp('LXI H,2050H');
+printf('H=20H L=50H \n \n'); // the 16-bit address of the data is loaded in HL register pair.
+M=hex2dec(['F7']); // M is the memory location pointer of address 2050H.
+printf('MOV A,M \n');
+A=dec2hex(M);
+printf('A= ');
+disp(A); // the contents of the HL register pair are used as memory pointer to the location 2050H.
+
+// using LDAX instruction.
+// indirect addressing mode.
+disp('LXI B,2050H');
+printf('B=20H C=50H \n \n'); // the 16-bit address of the data is loaded in BC register pair.
+M=hex2dec(['F7']); // M is the memory location pointer of address 2050H.
+printf('LDAX B \n');
+A=dec2hex(M);
+printf('A= ');
+disp(A); // the contents of the BC register pair are used as memory pointer to the location 2050H.
+
+// using LDA instruction.
+// direct addressing mode.
+printf('\n LDA 2050H \n'); //directly sends the data of memory location 2050H to accumulator.
+printf('A= ');
+disp(A);
+
diff --git a/2522/CH7/EX7.3/exm7_3_output.jpg b/2522/CH7/EX7.3/exm7_3_output.jpg Binary files differnew file mode 100755 index 000000000..8676a2c49 --- /dev/null +++ b/2522/CH7/EX7.3/exm7_3_output.jpg diff --git a/2522/CH7/EX7.4/exm7_4.sce b/2522/CH7/EX7.4/exm7_4.sce new file mode 100755 index 000000000..8de6ed61f --- /dev/null +++ b/2522/CH7/EX7.4/exm7_4.sce @@ -0,0 +1,33 @@ +//page no 222
+//example no 7.4
+// USE OF ADDRESSING MODES.
+clc;
+//register B contains 32H
+B=32;
+
+//using indirect addressing modes
+printf('B= %d \n',B);
+disp(' 1) LXI H,8000H'); // loads HL register pair.
+disp('H=80H L=00H');
+disp('MOV M,B'); // contents of register B are moved in memory location pointed by HL register pair.
+M=B;
+printf('\n 8000H --> %d \n \n',M);
+
+disp('LXI D,8000H'); //loads the memory location 8000H in DE register pair.
+disp('D=80H E=00H');
+disp('MOV A,B');
+A=B;
+printf('A= %d \n',A);
+disp('STAX D'); //stores the value of accumulator in the memory location pointer by DE register pair.
+printf('\n 8000H --> %d \n \n',A);
+
+//using direct addressing mode.
+disp('2) A= F2H');
+disp('STA 8000H'); //this instruction stores the value of accumulator in the memory location 8000H.
+disp('8000H --> F2H');
+
+//using indirect addressing mode.
+disp('3) LXI H,8000H'); // loads HL register pair.
+disp('H=80H L=00H');
+disp('MVI M,F2H'); //moving the data in the memory.
+disp('8000H --> F2H');
diff --git a/2522/CH7/EX7.4/exm7_4_output1.jpg b/2522/CH7/EX7.4/exm7_4_output1.jpg Binary files differnew file mode 100755 index 000000000..8aea52faa --- /dev/null +++ b/2522/CH7/EX7.4/exm7_4_output1.jpg diff --git a/2522/CH7/EX7.4/exm7_4_output2.jpg b/2522/CH7/EX7.4/exm7_4_output2.jpg Binary files differnew file mode 100755 index 000000000..a74a894f8 --- /dev/null +++ b/2522/CH7/EX7.4/exm7_4_output2.jpg diff --git a/2522/CH7/EX7.5/exm7_5.sce b/2522/CH7/EX7.5/exm7_5.sce new file mode 100755 index 000000000..d5b8b41b3 --- /dev/null +++ b/2522/CH7/EX7.5/exm7_5.sce @@ -0,0 +1,20 @@ +//page no 224
+//example no 7.5
+// INCREMENT A NUMBER.
+clc;
+disp('LXI B,2050H'); //loads the data 2050H in BC register pair.
+disp('B=20H C=50H');
+B=20;
+C=50;
+disp('INX B');
+C=C+1;
+printf('B= %d C= %d \n',B,C);
+disp('The contents of BC register pair will be 2051H');
+disp('INR B');
+B=B+1;
+printf('B= %d \n',B);
+disp('INR C');
+C=50;
+C=C+1;
+printf('C= %d \n',C);
+disp('The contents of BC register pair will be 2151H');
diff --git a/2522/CH7/EX7.5/exm7_5_output.jpg b/2522/CH7/EX7.5/exm7_5_output.jpg Binary files differnew file mode 100755 index 000000000..ed3d60c1e --- /dev/null +++ b/2522/CH7/EX7.5/exm7_5_output.jpg diff --git a/2522/CH7/EX7.6/exm7_6.sce b/2522/CH7/EX7.6/exm7_6.sce new file mode 100755 index 000000000..636d57ab3 --- /dev/null +++ b/2522/CH7/EX7.6/exm7_6.sce @@ -0,0 +1,24 @@ +//page no 228
+//example no 7.6
+// ARITHEMETIC OPERATIONS.
+clc;
+disp('A-->30H');
+disp('2040H-->68H');
+disp('2041H-->7FH');
+disp('LXI H,2040H'); // loads HL register pair.
+disp('H=20H L=40H M=68H');
+disp('ADD M');
+A=hex2dec(['30']);
+M=hex2dec(['68']);
+S=A+M; // adds the contents of A and data at memory location 2040H.
+s=dec2hex(S);
+printf('\n Content of A after addition with 2040H= ');
+disp(s);
+disp('INX H'); // takes the program to the next memory location.
+disp('H=20H L=41H M=7FH');
+disp('SUB M');
+M=hex2dec(['7F']);
+D=S-M; // subtracts the contents of A from the data at memory location 2041H.
+d=dec2hex(D);
+printf('\n Content of A after subtraction with 2041H= ');
+disp(d);
diff --git a/2522/CH7/EX7.6/exm7_6_output.jpg b/2522/CH7/EX7.6/exm7_6_output.jpg Binary files differnew file mode 100755 index 000000000..390fe6e11 --- /dev/null +++ b/2522/CH7/EX7.6/exm7_6_output.jpg diff --git a/2522/CH7/EX7.7/exm7_7.sce b/2522/CH7/EX7.7/exm7_7.sce new file mode 100755 index 000000000..ed4ec0ba4 --- /dev/null +++ b/2522/CH7/EX7.7/exm7_7.sce @@ -0,0 +1,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);
diff --git a/2522/CH7/EX7.7/exm7_7_output.jpg b/2522/CH7/EX7.7/exm7_7_output.jpg Binary files differnew file mode 100755 index 000000000..c3b3ae561 --- /dev/null +++ b/2522/CH7/EX7.7/exm7_7_output.jpg diff --git a/2522/CH7/EX7.8/exm7_8.sce b/2522/CH7/EX7.8/exm7_8.sce new file mode 100755 index 000000000..c541e68ab --- /dev/null +++ b/2522/CH7/EX7.8/exm7_8.sce @@ -0,0 +1,22 @@ +//page no 233
+// example no 7.8
+// LEFT ROTATION (RLC) OF BITS.
+clc;
+// initially
+printf('Accumulator= AAH \n');
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 1 0 1 0 1 0 =AAH \n \n');
+printf('CY= 0 \n \n');
+printf('RLC \n \n');
+printf('CY= 1 \n \n');
+// carry flag is set because D7 bit was 1.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 0 1 0 1 0 1 0 1 =55H \n \n'); // after the executuion of first RLC.
+// RLC instruction places D7 bit in CY flag as well as in D0 bit.
+printf('RLC \n \n');
+printf('CY= 0 \n \n');
+// carry flag is reset because D7 bit was 0.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 1 0 1 0 1 0 =AAH \n \n'); // after the executuion of second RLC.
+// RLC instruction places D7 bit in CY flag as well as in D0 bit.
+
diff --git a/2522/CH7/EX7.8/exm7_8_output.jpg b/2522/CH7/EX7.8/exm7_8_output.jpg Binary files differnew file mode 100755 index 000000000..69e9eb5e5 --- /dev/null +++ b/2522/CH7/EX7.8/exm7_8_output.jpg diff --git a/2522/CH7/EX7.9/exm7_9.sce b/2522/CH7/EX7.9/exm7_9.sce new file mode 100755 index 000000000..a67e89f30 --- /dev/null +++ b/2522/CH7/EX7.9/exm7_9.sce @@ -0,0 +1,21 @@ +//page no 234
+// example no 7.9
+// LEFT ROTATION (RAL) OF BITS.
+clc;
+// initially
+printf('Accumulator= AAH \n');
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 1 0 1 0 1 0 =AAH \n \n');
+printf('CY= 0 \n \n');
+printf('RAL \n \n');
+printf('CY= 1 \n \n');
+// carry flag is set because D7 bit was 1.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 0 1 0 1 0 1 0 0 =54H \n \n'); // after the executuion of first RAL.
+// RAL instruction places D7 bit in CY flag & CY flags bit is send to D0 bit.
+printf('RAL \n \n');
+printf('CY= 0 \n \n');
+// carry flag is reset because D7 bit was 0.
+printf('D7 D6 D5 D4 D3 D2 D1 D0 \n');
+printf(' 1 0 1 0 1 0 0 1 =A9H \n \n'); // after the executuion of second RAL.
+// RAL instruction places D7 bit in CY flag & CY flags bit is send to D0 bit.
diff --git a/2522/CH7/EX7.9/exm7_9_output.jpg b/2522/CH7/EX7.9/exm7_9_output.jpg Binary files differnew file mode 100755 index 000000000..0f26bb266 --- /dev/null +++ b/2522/CH7/EX7.9/exm7_9_output.jpg |