diff --git a/00. 8085 8086 Interfacing Experiments.pdf b/00. 8085 8086 Interfacing Experiments.pdf new file mode 100644 index 0000000..e0349e5 Binary files /dev/null and b/00. 8085 8086 Interfacing Experiments.pdf differ diff --git a/00. Experiment List.pdf b/00. Experiment List.pdf new file mode 100644 index 0000000..e3468ac Binary files /dev/null and b/00. Experiment List.pdf differ diff --git a/01. 8051/01. Introduction/Prog1.LST b/01. 8051/01. Introduction/Prog1.LST new file mode 100644 index 0000000..ca5a4cd --- /dev/null +++ b/01. 8051/01. Introduction/Prog1.LST @@ -0,0 +1,29 @@ +A51 MACRO ASSEMBLER PROG1 01/16/2013 09:01:56 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Prog1.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Prog1.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 E544 1 mov a, 44h +0002 F540 2 mov 40h, a +0004 F541 3 mov 41h, a +0006 F542 4 mov 42h, a +0008 F543 5 mov 43h, a + 6 end + A51 MACRO ASSEMBLER PROG1 01/16/2013 09:01:56 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/01. Introduction/Prog1.asm b/01. 8051/01. Introduction/Prog1.asm new file mode 100644 index 0000000..c53b8a5 --- /dev/null +++ b/01. 8051/01. Introduction/Prog1.asm @@ -0,0 +1,7 @@ +; 44h to 40h - 43h direct addressing +mov a, 44h +mov 40h, a +mov 41h, a +mov 42h, a +mov 43h, a +end diff --git a/01. 8051/01. Introduction/Prog2.LST b/01. 8051/01. Introduction/Prog2.LST new file mode 100644 index 0000000..55ce81b --- /dev/null +++ b/01. 8051/01. Introduction/Prog2.LST @@ -0,0 +1,33 @@ +A51 MACRO ASSEMBLER PROG2 01/16/2013 09:10:52 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Prog2.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Prog2.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 8544F0 1 mov b, 44h +0003 7840 2 mov r0, #40h +0005 7903 3 mov r1, #3 +0007 4 loop: +0007 A6F0 5 mov @r0, b +0009 08 6 inc r0 +000A D9FB 7 djnz r1, loop + 8 end + A51 MACRO ASSEMBLER PROG2 01/16/2013 09:10:52 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +LOOP . . . . . . . C ADDR 0007H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/01. Introduction/Prog2.asm b/01. 8051/01. Introduction/Prog2.asm new file mode 100644 index 0000000..72371d6 --- /dev/null +++ b/01. 8051/01. Introduction/Prog2.asm @@ -0,0 +1,8 @@ +mov b, 44h +mov r0, #40h +mov r1, #4 +loop: +mov @r0, b +inc r0 +djnz r1, loop +end diff --git a/01. 8051/01. Introduction/Prog3.LST b/01. 8051/01. Introduction/Prog3.LST new file mode 100644 index 0000000..b68ffc6 --- /dev/null +++ b/01. 8051/01. Introduction/Prog3.LST @@ -0,0 +1,37 @@ +A51 MACRO ASSEMBLER PROG3 01/18/2013 18:07:56 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Prog3.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Prog3.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 900300 2 mov dptr, #300h +0003 7400 3 mov a, #0 +0005 93 4 movc a, @a+dptr +0006 F8 5 mov r0, a +0007 7401 6 mov a, #1 +0009 93 7 movc a, @a+dptr +000A F9 8 mov r1, a +000B 7402 9 mov a, #2 +000D 93 10 movc a, @a+dptr +000E FA 11 mov r2, a +0300 12 org 300h +0300 4E4954 13 db "NIT" + 14 end + A51 MACRO ASSEMBLER PROG3 01/18/2013 18:07:56 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/01. Introduction/Prog3.asm b/01. 8051/01. Introduction/Prog3.asm new file mode 100644 index 0000000..d1ae1c8 --- /dev/null +++ b/01. 8051/01. Introduction/Prog3.asm @@ -0,0 +1,14 @@ +org 0h +mov dptr, #300h +mov a, #0 +movc a, @a+dptr +mov r0, a +mov a, #1 +movc a, @a+dptr +mov r1, a +mov a, #2 +movc a, @a+dptr +mov r2, a +org 300h +db "NIT" +end diff --git a/01. 8051/01. Introduction/Prog4.LST b/01. 8051/01. Introduction/Prog4.LST new file mode 100644 index 0000000..774fb84 --- /dev/null +++ b/01. 8051/01. Introduction/Prog4.LST @@ -0,0 +1,44 @@ +A51 MACRO ASSEMBLER PROG4 01/18/2013 18:15:05 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Prog4.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Prog4.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 900200 2 mov dptr, #200h +0003 7800 3 mov r0, #0 +0005 7940 4 mov r1, #40h +0007 5 loop: +0007 E8 6 mov a, r0 +0008 93 7 movc a, @a+dptr +0009 6005 8 jz p_end +000B F7 9 mov @r1, a +000C 08 10 inc r0 +000D 09 11 inc r1 +000E 80F7 12 sjmp loop +0010 13 p_end: +0200 14 org 200h +0200 53756268 15 db "Subhajit Sahu", 0 +0204 616A6974 +0208 20536168 +020C 7500 + 16 end + A51 MACRO ASSEMBLER PROG4 01/18/2013 18:15:05 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +LOOP . . . . . . . C ADDR 0007H A +P_END. . . . . . . C ADDR 0010H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/01. Introduction/Prog4.asm b/01. 8051/01. Introduction/Prog4.asm new file mode 100644 index 0000000..6005f66 --- /dev/null +++ b/01. 8051/01. Introduction/Prog4.asm @@ -0,0 +1,16 @@ +org 0h +mov dptr, #200h +mov r0, #0 +mov r1, #40h +loop: +mov a, r0 +movc a, @a+dptr +jz p_end +mov @r1, a +inc r0 +inc r1 +sjmp loop +p_end: +org 200h +db "Subhajit Sahu", 0 +end diff --git a/01. 8051/01. Introduction/Prog5.asm b/01. 8051/01. Introduction/Prog5.asm new file mode 100644 index 0000000..a9b8bfc --- /dev/null +++ b/01. 8051/01. Introduction/Prog5.asm @@ -0,0 +1,14 @@ +; Multiplication using repeated addition +mov r0, #4 +mov r1, #2 +mov a, #0 +mov r4, #0 + +loop: +add a, r0 +jnc no_carry +inc r4 +no_carry: +djnz loop +mov r3, a +end diff --git a/01. 8051/02. Data Transfer/Act1.LST b/01. 8051/02. Data Transfer/Act1.LST new file mode 100644 index 0000000..c0cfd28 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act1.LST @@ -0,0 +1,38 @@ +A51 MACRO ASSEMBLER ACT1 01/23/2013 08:36:03 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act1.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act1.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7840 2 mov r0, #40h +0002 7960 3 mov r1, #60h +0004 7B05 4 mov r3, #5 +0006 5 loop: +0006 E6 6 mov a, @r0 +0007 87F0 7 mov b, @r1 +0009 A6F0 8 mov @r0, b +000B F7 9 mov @r1, a +000C 08 10 inc r0 +000D 09 11 inc r1 +000E DBF6 12 djnz r3, loop + 13 end + A51 MACRO ASSEMBLER ACT1 01/23/2013 08:36:03 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +LOOP . . . . . . . C ADDR 0006H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/02. Data Transfer/Act1.asm b/01. 8051/02. Data Transfer/Act1.asm new file mode 100644 index 0000000..84fb596 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act1.asm @@ -0,0 +1,13 @@ +org 0h +mov r0, #40h +mov r1, #60h +mov r3, #5 +loop: +mov a, @r0 +mov b, @r1 +mov @r0, b +mov @r1, a +inc r0 +inc r1 +djnz r3, loop +end diff --git a/01. 8051/02. Data Transfer/Act2.LST b/01. 8051/02. Data Transfer/Act2.LST new file mode 100644 index 0000000..19c3e76 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act2.LST @@ -0,0 +1,41 @@ +A51 MACRO ASSEMBLER ACT2 01/23/2013 09:18:43 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act2.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act2.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7840 2 mov r0, #40h +0002 7B05 3 mov r3, #5 +0004 86F0 4 mov b, @r0 +0006 5 loop: +0006 E5F0 6 mov a, b +0008 96 7 subb a, @r0 +0009 5002 8 jnc is_smaller +000B 86F0 9 mov b, @r0 +000D 10 is_smaller: +000D 08 11 inc r0 +000E DBF6 12 djnz r3, loop +0010 85F0A0 13 mov p2, b + 14 end + A51 MACRO ASSEMBLER ACT2 01/23/2013 09:18:43 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +IS_SMALLER . . . . C ADDR 000DH A +LOOP . . . . . . . C ADDR 0006H A +P2 . . . . . . . . D ADDR 00A0H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/02. Data Transfer/Act2.asm b/01. 8051/02. Data Transfer/Act2.asm new file mode 100644 index 0000000..550fa89 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act2.asm @@ -0,0 +1,14 @@ +org 0h +mov r0, #40h +mov r3, #5 +mov b, @r0 +loop: +mov a, b +subb a, @r0 +jnc is_smaller +mov b, @r0 +is_smaller: +inc r0 +djnz r3, loop +mov p2, b +end diff --git a/01. 8051/02. Data Transfer/Act3.LST b/01. 8051/02. Data Transfer/Act3.LST new file mode 100644 index 0000000..ad998b5 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act3.LST @@ -0,0 +1,57 @@ +A51 MACRO ASSEMBLER ACT3 01/23/2013 10:04:44 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act3.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act3.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7840 2 mov r0, #40h +0002 7A04 3 mov r2, #4 +0004 4 loop1: +0004 86F0 5 mov b, @r0 +0006 E8 6 mov a, r0 +0007 FC 7 mov r4, a +0008 EA 8 mov a, r2 +0009 FB 9 mov r3, a +000A E8 10 mov a, r0 +000B F9 11 mov r1, a +000C 09 12 inc r1 +000D 13 loop2: +000D E5F0 14 mov a, b +000F 97 15 subb a, @r1 +0010 4004 16 jc is_greater +0012 87F0 17 mov b, @r1 +0014 E9 18 mov a, r1 +0015 FC 19 mov r4, a +0016 20 is_greater: +0016 09 21 inc r1 +0017 DBF4 22 djnz r3, loop2 +0019 EC 23 mov a, r4 +001A F9 24 mov r1, a +001B E6 25 mov a, @r0 +001C F7 26 mov @r1, a +001D A6F0 27 mov @r0, b +001F 08 28 inc r0 +0020 DAE2 29 djnz r2, loop1 + 30 end + A51 MACRO ASSEMBLER ACT3 01/23/2013 10:04:44 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +IS_GREATER . . . . C ADDR 0016H A +LOOP1. . . . . . . C ADDR 0004H A +LOOP2. . . . . . . C ADDR 000DH A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/02. Data Transfer/Act3.asm b/01. 8051/02. Data Transfer/Act3.asm new file mode 100644 index 0000000..c899291 --- /dev/null +++ b/01. 8051/02. Data Transfer/Act3.asm @@ -0,0 +1,30 @@ +org 0h +mov r0, #40h +mov r2, #4 +loop1: +mov b, @r0 +mov a, r0 +mov r4, a +mov a, r2 +mov r3, a +mov a, r0 +mov r1, a +inc r1 +loop2: +mov a, b +subb a, @r1 +jc is_greater +mov b, @r1 +mov a, r1 +mov r4, a +is_greater: +inc r1 +djnz r3, loop2 +mov a, r4 +mov r1, a +mov a, @r0 +mov @r1, a +mov @r0, b +inc r0 +djnz r2, loop1 +end diff --git a/01. 8051/02. Data Transfer/Questions.pdf b/01. 8051/02. Data Transfer/Questions.pdf new file mode 100644 index 0000000..4ac32e6 Binary files /dev/null and b/01. 8051/02. Data Transfer/Questions.pdf differ diff --git a/01. 8051/03. Arithmetic Operations/Act1.LST b/01. 8051/03. Arithmetic Operations/Act1.LST new file mode 100644 index 0000000..2b3937a --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act1.LST @@ -0,0 +1,39 @@ +A51 MACRO ASSEMBLER ACT1 01/30/2013 09:29:47 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act1.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act1.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7840 2 mov r0, #40h +0002 790A 3 mov r1, #10 +0004 7A00 4 mov r2, #0 +0006 7B00 5 mov r3, #0 +0008 6 loop: +0008 EA 7 mov a, r2 +0009 26 8 add a, @r0 +000A FA 9 mov r2, a +000B EB 10 mov a, r3 +000C 3400 11 addc a, #0 +000E FB 12 mov r3, a +000F 08 13 inc r0 +0010 D9F6 14 djnz r1, loop + 15 end + A51 MACRO ASSEMBLER ACT1 01/30/2013 09:29:47 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +LOOP . . . . . . . C ADDR 0008H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/03. Arithmetic Operations/Act1.asm b/01. 8051/03. Arithmetic Operations/Act1.asm new file mode 100644 index 0000000..8ab80ac --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act1.asm @@ -0,0 +1,15 @@ +org 0h +mov r0, #40h +mov r1, #10 +mov r2, #0 +mov r3, #0 +loop: +mov a, r2 +add a, @r0 +mov r2, a +mov a, r3 +addc a, #0 +mov r3, a +inc r0 +djnz r1, loop +end diff --git a/01. 8051/03. Arithmetic Operations/Act2.LST b/01. 8051/03. Arithmetic Operations/Act2.LST new file mode 100644 index 0000000..387193d --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act2.LST @@ -0,0 +1,40 @@ +A51 MACRO ASSEMBLER ACT2 01/30/2013 09:42:29 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act2.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act2.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7860 2 mov r0, #60h +0002 790A 3 mov r1, #10 +0004 7A00 4 mov r2, #0 +0006 7B00 5 mov r3, #0 +0008 6 loop: +0008 EA 7 mov a, r2 +0009 26 8 add a, @r0 +000A D4 9 da a +000B FA 10 mov r2, a +000C EB 11 mov a, r3 +000D 3400 12 addc a, #0 +000F FB 13 mov r3, a +0010 08 14 inc r0 +0011 D9F5 15 djnz r1, loop + 16 end + A51 MACRO ASSEMBLER ACT2 01/30/2013 09:42:29 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +LOOP . . . . . . . C ADDR 0008H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/03. Arithmetic Operations/Act2.asm b/01. 8051/03. Arithmetic Operations/Act2.asm new file mode 100644 index 0000000..20fb56c --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act2.asm @@ -0,0 +1,16 @@ +org 0h +mov r0, #60h +mov r1, #10 +mov r2, #0 +mov r3, #0 +loop: +mov a, r2 +add a, @r0 +da a +mov r2, a +mov a, r3 +addc a, #0 +mov r3, a +inc r0 +djnz r1, loop +end diff --git a/01. 8051/03. Arithmetic Operations/Act3.LST b/01. 8051/03. Arithmetic Operations/Act3.LST new file mode 100644 index 0000000..d12c024 --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act3.LST @@ -0,0 +1,53 @@ +A51 MACRO ASSEMBLER ACT3 01/30/2013 10:04:17 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act3.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act3.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7A40 2 mov r2, #40h +0002 7858 3 mov r0, #58h +0004 7970 4 mov r1, #70h +0006 7B05 5 mov r3, #5 +0008 75F000 6 mov b, #0 +000B 7 loop: +000B E6 8 mov a, @r0 +000C 25F0 9 add a, b +000E 27 10 add a, @r1 +000F D4 11 da a +0010 FC 12 mov r4, a +0011 7400 13 mov a, #0 +0013 3400 14 addc a, #0 +0015 F5F0 15 mov b, a +0017 E8 16 mov a, r0 +0018 FD 17 mov r5, a +0019 EA 18 mov a, r2 +001A F8 19 mov r0, a +001B EC 20 mov a, r4 +001C F6 21 mov @r0, a +001D ED 22 mov a, r5 +001E F8 23 mov r0, a +001F 08 24 inc r0 +0020 09 25 inc r1 +0021 0A 26 inc r2 +0022 DBE7 27 djnz r3, loop + 28 end + A51 MACRO ASSEMBLER ACT3 01/30/2013 10:04:17 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +LOOP . . . . . . . C ADDR 000BH A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/03. Arithmetic Operations/Act3.asm b/01. 8051/03. Arithmetic Operations/Act3.asm new file mode 100644 index 0000000..50e0d6b --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act3.asm @@ -0,0 +1,28 @@ +org 0h +mov r2, #40h +mov r0, #58h +mov r1, #70h +mov r3, #5 +mov b, #0 +loop: +mov a, @r0 +add a, b +add a, @r1 +da a +mov r4, a +mov a, #0 +addc a, #0 +mov b, a +mov a, r0 +mov r5, a +mov a, r2 +mov r0, a +mov a, r4 +mov @r0, a +mov a, r5 +mov r0, a +inc r0 +inc r1 +inc r2 +djnz r3, loop +end diff --git a/01. 8051/03. Arithmetic Operations/Act4.LST b/01. 8051/03. Arithmetic Operations/Act4.LST new file mode 100644 index 0000000..99a3900 --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act4.LST @@ -0,0 +1,64 @@ +A51 MACRO ASSEMBLER ACT4 01/30/2013 10:39:45 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act4.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act4.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 E540 2 mov a, 40h +0002 8542F0 3 mov b, 42h +0005 A4 4 mul ab +0006 F544 5 mov 44h, a +0008 85F045 6 mov 45h, b + 7 +000B E541 8 mov a, 41h +000D 8542F0 9 mov b, 42h +0010 A4 10 mul ab +0011 2545 11 add a, 45h +0013 F545 12 mov 45h, a +0015 E5F0 13 mov a, b +0017 3400 14 addc a, #0 +0019 F546 15 mov 46h, a + 16 +001B E540 17 mov a, 40h +001D 8543F0 18 mov b, 43h +0020 A4 19 mul ab +0021 2545 20 add a, 45h +0023 F545 21 mov 45h, a +0025 E5F0 22 mov a, b +0027 3400 23 addc a, #0 +0029 2546 24 add a, 46h +002B F546 25 mov 46h, a +002D 7400 26 mov a, #0 +002F 3400 27 addc a, #0 +0031 F547 28 mov 47h, a + 29 +0033 E541 30 mov a, 41h +0035 8543F0 31 mov b, 43h +0038 A4 32 mul ab +0039 2546 33 add a, 46h +003B F546 34 mov 46h, a +003D E5F0 35 mov a, b +003F 3400 36 addc a, #0 +0041 2547 37 add a, 47h +0043 F547 38 mov 47h, a + 39 + 40 end + A51 MACRO ASSEMBLER ACT4 01/30/2013 10:39:45 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/03. Arithmetic Operations/Act4.asm b/01. 8051/03. Arithmetic Operations/Act4.asm new file mode 100644 index 0000000..7c211fa --- /dev/null +++ b/01. 8051/03. Arithmetic Operations/Act4.asm @@ -0,0 +1,40 @@ +org 0h +mov a, 40h +mov b, 42h +mul ab +mov 44h, a +mov 45h, b + +mov a, 41h +mov b, 42h +mul ab +add a, 45h +mov 45h, a +mov a, b +addc a, #0 +mov 46h, a + +mov a, 40h +mov b, 43h +mul ab +add a, 45h +mov 45h, a +mov a, b +addc a, #0 +add a, 46h +mov 46h, a +mov a, #0 +addc a, #0 +mov 47h, a + +mov a, 41h +mov b, 43h +mul ab +add a, 46h +mov 46h, a +mov a, b +addc a, #0 +add a, 47h +mov 47h, a + +end diff --git a/01. 8051/03. Arithmetic Operations/Questions.pdf b/01. 8051/03. Arithmetic Operations/Questions.pdf new file mode 100644 index 0000000..787c5da Binary files /dev/null and b/01. 8051/03. Arithmetic Operations/Questions.pdf differ diff --git a/01. 8051/04. Simulating IO ports/Act1.LST b/01. 8051/04. Simulating IO ports/Act1.LST new file mode 100644 index 0000000..2c4d4a8 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act1.LST @@ -0,0 +1,45 @@ +A51 MACRO ASSEMBLER ACT1 02/06/2013 09:19:41 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act1.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act1.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7455 2 mov a, #55h +0002 3 loop: +0002 F580 4 mov p0, a +0004 F590 5 mov p1, a +0006 F5A0 6 mov p2, a +0008 F4 7 cpl a +0009 110D 8 acall delay +000B 80F5 9 sjmp loop +000D 10 delay: +000D 75F0FF 11 mov b, #0FFh +0010 12 dloop: +0010 D5F0FD 13 djnz b, dloop +0013 22 14 ret + 15 end + A51 MACRO ASSEMBLER ACT1 02/06/2013 09:19:41 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +DELAY. . . . . . . C ADDR 000DH A +DLOOP. . . . . . . C ADDR 0010H A +LOOP . . . . . . . C ADDR 0002H A +P0 . . . . . . . . D ADDR 0080H A +P1 . . . . . . . . D ADDR 0090H A +P2 . . . . . . . . D ADDR 00A0H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/04. Simulating IO ports/Act1.asm b/01. 8051/04. Simulating IO ports/Act1.asm new file mode 100644 index 0000000..d8bcb79 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act1.asm @@ -0,0 +1,16 @@ +org 0h +mov a, #0FFh +mov p1, a +mov a, p1 +mov b, #100 +div ab +add a, #'0' +mov 40h, a +mov a, b +mov b, #10 +div ab +add a, #'0' +mov 41h, a +add b, #'0' +mov 42h, b +end diff --git a/01. 8051/04. Simulating IO ports/Act2.LST b/01. 8051/04. Simulating IO ports/Act2.LST new file mode 100644 index 0000000..833630c --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act2.LST @@ -0,0 +1,39 @@ +A51 MACRO ASSEMBLER ACT2 02/06/2013 08:59:44 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act2.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act2.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 74FF 2 mov a, #0FFh +0002 F590 3 mov p1, a +0004 4 loop: +0004 E590 5 mov a, p1 +0006 F580 6 mov p0, a +0008 F5A0 7 mov p2, a +000A F8 8 mov r0, a +000B F9 9 mov r1, a +000C FA 10 mov r2, a +000D 80F5 11 sjmp loop + 12 end + A51 MACRO ASSEMBLER ACT2 02/06/2013 08:59:44 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +LOOP . . . . . . . C ADDR 0004H A +P0 . . . . . . . . D ADDR 0080H A +P1 . . . . . . . . D ADDR 0090H A +P2 . . . . . . . . D ADDR 00A0H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/04. Simulating IO ports/Act2.asm b/01. 8051/04. Simulating IO ports/Act2.asm new file mode 100644 index 0000000..3ddefe3 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act2.asm @@ -0,0 +1,12 @@ +org 0h +mov a, #0FFh +mov p1, a +loop: +mov a, p1 +mov p0, a +mov p2, a +mov r0, a +mov r1, a +mov r2, a +sjmp loop +end diff --git a/01. 8051/04. Simulating IO ports/Act3.LST b/01. 8051/04. Simulating IO ports/Act3.LST new file mode 100644 index 0000000..317d867 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act3.LST @@ -0,0 +1,31 @@ +A51 MACRO ASSEMBLER ACT3 02/06/2013 09:04:24 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act3.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act3.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7400 2 mov a, #0 +0002 2492 3 add a, #92h +0004 2423 4 add a, #23h +0006 2466 5 add a, #66h +0008 2487 6 add a, #87h +000A 24F5 7 add a, #0F5h + 8 end + A51 MACRO ASSEMBLER ACT3 02/06/2013 09:04:24 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/04. Simulating IO ports/Act3.asm b/01. 8051/04. Simulating IO ports/Act3.asm new file mode 100644 index 0000000..b800f83 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act3.asm @@ -0,0 +1,26 @@ +org 0h +mov dptr, #150h +mov r0, #40h +mov r1, #58h +mov r2, #0 +mov r3, #12 +copy_loop: +mov a, r2 +movc a, @a+dptr +mov @r0, a +inc r0 +inc r2 +djnz r3, copy_loop +mov r0, #40h +mov r3, #12 +mov a, #0 +add_loop: +add a, @r0 +inc r0 +djnz r3, add_loop +mov b, #12 +div ab +mov @r1, a +org 150h +db 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9 +end diff --git a/01. 8051/04. Simulating IO ports/Act4.LST b/01. 8051/04. Simulating IO ports/Act4.LST new file mode 100644 index 0000000..051625e --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act4.LST @@ -0,0 +1,35 @@ +A51 MACRO ASSEMBLER ACT4 02/06/2013 10:02:34 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act4.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act4.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7800 2 mov r0, #0 +0002 7901 3 mov r1, #1 +0004 7A02 4 mov r2, #2 +0006 7B03 5 mov r3, #3 +0008 7C04 6 mov r4, #4 +000A C000 7 push 00h +000C C001 8 push 01h +000E C002 9 push 02h +0010 C003 10 push 03h +0012 C004 11 push 04h + 12 end + A51 MACRO ASSEMBLER ACT4 02/06/2013 10:02:34 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/04. Simulating IO ports/Act4.asm b/01. 8051/04. Simulating IO ports/Act4.asm new file mode 100644 index 0000000..82846c0 --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act4.asm @@ -0,0 +1,12 @@ +org 0h +mov r0, #0 +mov r1, #1 +mov r2, #2 +mov r3, #3 +mov r4, #4 +push 00h +push 01h +push 02h +push 03h +push 04h +end diff --git a/01. 8051/04. Simulating IO ports/Act5.LST b/01. 8051/04. Simulating IO ports/Act5.LST new file mode 100644 index 0000000..a30d38f --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act5.LST @@ -0,0 +1,38 @@ +A51 MACRO ASSEMBLER ACT5 02/06/2013 09:37:59 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act5.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act5.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 75810D 2 mov sp, #0Dh +0003 750D01 3 mov 0Dh, #01 +0006 750C02 4 mov 0Ch, #02 +0009 750B03 5 mov 0Bh, #03 +000C 750A04 6 mov 0Ah, #04 +000F 750905 7 mov 09h, #05 +0012 750806 8 mov 08h, #06 +0015 D000 9 pop 0h +0017 D001 10 pop 1h +0019 D002 11 pop 2h +001B D003 12 pop 3h +001D D004 13 pop 4h + 14 end + A51 MACRO ASSEMBLER ACT5 02/06/2013 09:37:59 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +SP . . . . . . . . D ADDR 0081H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/04. Simulating IO ports/Act5.asm b/01. 8051/04. Simulating IO ports/Act5.asm new file mode 100644 index 0000000..6e1be4f --- /dev/null +++ b/01. 8051/04. Simulating IO ports/Act5.asm @@ -0,0 +1,14 @@ +org 0h +mov sp, #0Dh +mov 0Dh, #01 +mov 0Ch, #02 +mov 0Bh, #03 +mov 0Ah, #04 +mov 09h, #05 +mov 08h, #06 +pop 0h +pop 1h +pop 2h +pop 3h +pop 4h +end diff --git a/01. 8051/04. Simulating IO ports/Questions.pdf b/01. 8051/04. Simulating IO ports/Questions.pdf new file mode 100644 index 0000000..ce0d60b Binary files /dev/null and b/01. 8051/04. Simulating IO ports/Questions.pdf differ diff --git a/01. 8051/05. Arithmetic Operations 2/Act1.LST b/01. 8051/05. Arithmetic Operations 2/Act1.LST new file mode 100644 index 0000000..6d5cf6e --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act1.LST @@ -0,0 +1,45 @@ +A51 MACRO ASSEMBLER ACT1 02/13/2013 08:45:06 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act1.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act1.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 7455 2 mov a, #55h +0002 3 loop: +0002 F580 4 mov p0, a +0004 F590 5 mov p1, a +0006 F5A0 6 mov p2, a +0008 F4 7 cpl a +0009 110D 8 acall delay +000B 80F5 9 sjmp loop +000D 10 delay: +000D 75F0FF 11 mov b, #0FFh +0010 12 dloop: +0010 D5F0FD 13 djnz b, dloop +0013 22 14 ret + 15 end + A51 MACRO ASSEMBLER ACT1 02/13/2013 08:45:06 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +DELAY. . . . . . . C ADDR 000DH A +DLOOP. . . . . . . C ADDR 0010H A +LOOP . . . . . . . C ADDR 0002H A +P0 . . . . . . . . D ADDR 0080H A +P1 . . . . . . . . D ADDR 0090H A +P2 . . . . . . . . D ADDR 00A0H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/05. Arithmetic Operations 2/Act1.asm b/01. 8051/05. Arithmetic Operations 2/Act1.asm new file mode 100644 index 0000000..7a77c30 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act1.asm @@ -0,0 +1,17 @@ +org 0h +mov a, #0FFh +mov p1, a +mov a, p1 +mov b, #100 +div ab +add a, #30h +mov 40h, a +mov a, b +mov b, #10 +div ab +add a, #30h +mov 41h, a +mov a, b +add a, #30h +mov 42h, a +end diff --git a/01. 8051/05. Arithmetic Operations 2/Act2.LST b/01. 8051/05. Arithmetic Operations 2/Act2.LST new file mode 100644 index 0000000..88d922a --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act2.LST @@ -0,0 +1,53 @@ +A51 MACRO ASSEMBLER ACT2 02/13/2013 09:26:46 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act2.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act2.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 900150 2 mov dptr, #150h +0003 7850 3 mov r0, #50h +0005 7900 4 mov r1, #0 +0007 7A04 5 mov r2, #4 +0009 6 loop: +0009 E9 7 mov a, r1 +000A 93 8 movc a, @a+dptr +000B 75F064 9 mov b, #100 +000E 84 10 div ab +000F 2430 11 add a, #30h +0011 F6 12 mov @r0, a +0012 08 13 inc r0 +0013 E5F0 14 mov a, b +0015 75F00A 15 mov b, #10 +0018 84 16 div ab +0019 2430 17 add a, #30h +001B F6 18 mov @r0, a +001C 08 19 inc r0 +001D E5F0 20 mov a, b +001F 2430 21 add a, #30h +0021 F6 22 mov @r0, a +0022 08 23 inc r0 +0023 09 24 inc r1 +0024 DAE3 25 djnz r2, loop +0150 26 org 150h +0150 102040FF 27 db 10h, 20h, 40h, 0FFh + 28 end + A51 MACRO ASSEMBLER ACT2 02/13/2013 09:26:46 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +B. . . . . . . . . D ADDR 00F0H A +LOOP . . . . . . . C ADDR 0009H A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/05. Arithmetic Operations 2/Act2.asm b/01. 8051/05. Arithmetic Operations 2/Act2.asm new file mode 100644 index 0000000..4ba6550 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act2.asm @@ -0,0 +1,28 @@ +org 0h +mov dptr, #150h +mov r0, #50h +mov r1, #0 +mov r2, #4 +loop: +mov a, r1 +movc a, @a+dptr +mov b, #100 +div ab +add a, #30h +mov @r0, a +inc r0 +mov a, b +mov b, #10 +div ab +add a, #30h +mov @r0, a +inc r0 +mov a, b +add a, #30h +mov @r0, a +inc r0 +inc r1 +djnz r2, loop +org 150h +db 10h, 20h, 40h, 0FFh +end diff --git a/01. 8051/05. Arithmetic Operations 2/Act3.LST b/01. 8051/05. Arithmetic Operations 2/Act3.LST new file mode 100644 index 0000000..11277df --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act3.LST @@ -0,0 +1,54 @@ +A51 MACRO ASSEMBLER ACT3 02/13/2013 09:42:26 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act3.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act3.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 900150 2 mov dptr, #150h +0003 7840 3 mov r0, #40h +0005 7958 4 mov r1, #58h +0007 7A00 5 mov r2, #0 +0009 7B0C 6 mov r3, #12 +000B 7 copy_loop: +000B EA 8 mov a, r2 +000C 93 9 movc a, @a+dptr +000D F6 10 mov @r0, a +000E 08 11 inc r0 +000F 0A 12 inc r2 +0010 DBF9 13 djnz r3, copy_loop +0012 7840 14 mov r0, #40h +0014 7B0C 15 mov r3, #12 +0016 7400 16 mov a, #0 +0018 17 add_loop: +0018 26 18 add a, @r0 +0019 08 19 inc r0 +001A DBFC 20 djnz r3, add_loop +001C 75F00C 21 mov b, #12 +001F 84 22 div ab +0020 F7 23 mov @r1, a +0150 24 org 150h +0150 07070707 25 db 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9 +0154 07070909 +0158 09090909 + 26 end + A51 MACRO ASSEMBLER ACT3 02/13/2013 09:42:26 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +ADD_LOOP . . . . . C ADDR 0018H A +B. . . . . . . . . D ADDR 00F0H A +COPY_LOOP. . . . . C ADDR 000BH A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/05. Arithmetic Operations 2/Act3.asm b/01. 8051/05. Arithmetic Operations 2/Act3.asm new file mode 100644 index 0000000..b800f83 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act3.asm @@ -0,0 +1,26 @@ +org 0h +mov dptr, #150h +mov r0, #40h +mov r1, #58h +mov r2, #0 +mov r3, #12 +copy_loop: +mov a, r2 +movc a, @a+dptr +mov @r0, a +inc r0 +inc r2 +djnz r3, copy_loop +mov r0, #40h +mov r3, #12 +mov a, #0 +add_loop: +add a, @r0 +inc r0 +djnz r3, add_loop +mov b, #12 +div ab +mov @r1, a +org 150h +db 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9 +end diff --git a/01. 8051/05. Arithmetic Operations 2/Act4.LST b/01. 8051/05. Arithmetic Operations 2/Act4.LST new file mode 100644 index 0000000..5e23a68 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act4.LST @@ -0,0 +1,55 @@ +A51 MACRO ASSEMBLER ACT4 02/13/2013 09:58:23 PAGE 1 + + +MACRO ASSEMBLER A51 V8.02b +OBJECT MODULE PLACED IN Act4.OBJ +ASSEMBLER INVOKED BY: C:\Program_Files\Keil\C51\BIN\A51.EXE Act4.asm SET(SMALL) DEBUG EP + +LOC OBJ LINE SOURCE + +0000 1 org 0h +0000 900150 2 mov dptr, #150h +0003 7840 3 mov r0, #40h +0005 7958 4 mov r1, #58h +0007 7A00 5 mov r2, #0 +0009 7B07 6 mov r3, #7 +000B 7 copy_loop: +000B EA 8 mov a, r2 +000C 93 9 movc a, @a+dptr +000D 9430 10 subb a, #30h +000F F6 11 mov @r0, a +0010 08 12 inc r0 +0011 0A 13 inc r2 +0012 DBF7 14 djnz r3, copy_loop +0014 7840 15 mov r0, #40h +0016 7B07 16 mov r3, #7 +0018 7400 17 mov a, #0 +001A 18 add_loop: +001A 26 19 add a, @r0 +001B 08 20 inc r0 +001C DBFC 21 djnz r3, add_loop +001E 75F007 22 mov b, #7 +0021 84 23 div ab +0022 2430 24 add a, #30h +0024 F7 25 mov @r1, a +0150 26 org 150h +0150 31323334 27 db '1','2','3','4','5','6','7' +0154 353637 + 28 end + A51 MACRO ASSEMBLER ACT4 02/13/2013 09:58:23 PAGE 2 + +SYMBOL TABLE LISTING +------ ----- ------- + + +N A M E T Y P E V A L U E ATTRIBUTES + +ADD_LOOP . . . . . C ADDR 001AH A +B. . . . . . . . . D ADDR 00F0H A +COPY_LOOP. . . . . C ADDR 000BH A + + +REGISTER BANK(S) USED: 0 + + +ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S) diff --git a/01. 8051/05. Arithmetic Operations 2/Act4.asm b/01. 8051/05. Arithmetic Operations 2/Act4.asm new file mode 100644 index 0000000..9e3dc89 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act4.asm @@ -0,0 +1,28 @@ +org 0h +mov dptr, #150h +mov r0, #40h +mov r1, #58h +mov r2, #0 +mov r3, #7 +copy_loop: +mov a, r2 +movc a, @a+dptr +subb a, #30h +mov @r0, a +inc r0 +inc r2 +djnz r3, copy_loop +mov r0, #40h +mov r3, #7 +mov a, #0 +add_loop: +add a, @r0 +inc r0 +djnz r3, add_loop +mov b, #7 +div ab +add a, #30h +mov @r1, a +org 150h +db '1','2','3','4','5','6','7' +end diff --git a/01. 8051/05. Arithmetic Operations 2/Act5.asm b/01. 8051/05. Arithmetic Operations 2/Act5.asm new file mode 100644 index 0000000..6e1be4f --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/Act5.asm @@ -0,0 +1,14 @@ +org 0h +mov sp, #0Dh +mov 0Dh, #01 +mov 0Ch, #02 +mov 0Bh, #03 +mov 0Ah, #04 +mov 09h, #05 +mov 08h, #06 +pop 0h +pop 1h +pop 2h +pop 3h +pop 4h +end diff --git a/01. 8051/05. Arithmetic Operations 2/P1.asm b/01. 8051/05. Arithmetic Operations 2/P1.asm new file mode 100644 index 0000000..7a77c30 --- /dev/null +++ b/01. 8051/05. Arithmetic Operations 2/P1.asm @@ -0,0 +1,17 @@ +org 0h +mov a, #0FFh +mov p1, a +mov a, p1 +mov b, #100 +div ab +add a, #30h +mov 40h, a +mov a, b +mov b, #10 +div ab +add a, #30h +mov 41h, a +mov a, b +add a, #30h +mov 42h, a +end diff --git a/01. 8051/05. Arithmetic Operations 2/Questions.pdf b/01. 8051/05. Arithmetic Operations 2/Questions.pdf new file mode 100644 index 0000000..33f22c7 Binary files /dev/null and b/01. 8051/05. Arithmetic Operations 2/Questions.pdf differ diff --git a/02. 8085/00. Opcodes.asm b/02. 8085/00. Opcodes.asm new file mode 100644 index 0000000..513e72e --- /dev/null +++ b/02. 8085/00. Opcodes.asm @@ -0,0 +1,98 @@ +;----------------------- +; 8085 Opcodes +;----------------------- + +*I - Immediate +*X - 16 bit Register pair + +;Movement +;-------- +MOV r/M, r/M ; mov r/M, r/M +MVI r/M, i ; mov r/M, i +LDA addr ; mov a, [addr] +LDAX B/D ; mov a, [BC/DE] +STA addr ; mov [addr], a +STAX B/D ; mov [BC/DE], a +LHLD addr ; mov HL, [addr] +LXI rp, i ; mov rp, i +PUSH rp ; push rp +POP rp ; pop rp + + +;Arithmetic +;---------- +ADD r/M ; add a, r/M +ADI i ; add a, i +ADC r/M ; adc a, r/M +ACI i ; adc a, i +DAD rp ; add HL, rp +DAA ; daa +INR r/M ; inc r/M +INX rp ; inc rp +DCR r/M ; dec r/M +DCX rp ; inc rp + + +;Bitwise +;------- +ANA r/M ; and a, r/M +ANI i ; and a, i +ORA r/M ; or a, r/M +ORI i ; or a, i +CMA ; not a +RAL ; rcl a, 1 +RAR ; rcr a, 1 +RLC ; rol a, 1 +RRC ; ror a, 1 + + +;Flag Control +;------------ +CMC ; not CF +DI ; cli +EI ; sti +NOP ; nop +HLT ; hlt +RIM ; mov a, IF + + +;Branching +;--------- +CMP r/M ; cmp a, r/M +JMP addr ; jmp addr +JZ addr ; jz addr +JNZ addr ; jnz addr +JC addr ; jc addr +JNC addr ; jnc addr +JP addr ; jns addr +JM addr ; js addr +PCHL ; jmp [HL] +JPE addr ; jnp addr +JPO addr ; jp addr +CALL addr ; call addr +CZ addr ; callz addr +CNZ addr ; callnz addr +CC addr ; callc addr +CNC addr ; callnc addr +CP addr ; callns addr +CM addr ; calls addr +CPE addr ; callnp addr +CPO addr ; callp addr +RET ; ret +RZ ; retz +RNZ ; retnz +RC ; retc +RNC ; retnc +RP ; retns +RM ; rets +RPE ; retnp +RPO ; retp +PUSH PSW ; push psw +POP PSW ; pop psw + + +;I/O +;--- +IN addr ; in a, addr +OUT addr ; out addr, a + diff --git a/02. 8085/00. Opcodes.pdf b/02. 8085/00. Opcodes.pdf new file mode 100644 index 0000000..1eaf734 Binary files /dev/null and b/02. 8085/00. Opcodes.pdf differ diff --git a/02. 8085/01. 16-bit BCD Addition.asm b/02. 8085/01. 16-bit BCD Addition.asm new file mode 100644 index 0000000..3ef3bc2 --- /dev/null +++ b/02. 8085/01. 16-bit BCD Addition.asm @@ -0,0 +1,49 @@ +; Q 1> Addition of two BCD numbers of 16 bit width + SU 4300h + [4300h] = 99h ; A = 999 in BCD + [4301h] = 09h ; + [4302h] = 01h ; B = 1 in BCD + [4303h] = 00h ; + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + inx h + mov c, M + inx h + mov a, b + add M + mov b, a + mov a, c + aci 0 + inx h + add M + mov c, a + mov a, b + daa + mov b, a + mov a, c + aci 0 + daa + mov c, a + inx h + mov M, b + inx h + mov M, c + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4304h + [4304h] -> 00h ; ans = 1000h (1000 in BCD) + [4305h] -> 10h ; + . + + + + + \ No newline at end of file diff --git a/02. 8085/01. 16-bit BCD Addition.pdf b/02. 8085/01. 16-bit BCD Addition.pdf new file mode 100644 index 0000000..6ee43df Binary files /dev/null and b/02. 8085/01. 16-bit BCD Addition.pdf differ diff --git a/02. 8085/02. 32-bit Addition.asm b/02. 8085/02. 32-bit Addition.asm new file mode 100644 index 0000000..7765b22 --- /dev/null +++ b/02. 8085/02. 32-bit Addition.asm @@ -0,0 +1,75 @@ +; Q 2> Add two 32 bit signed numbers + SU 4300h + [4300h] = 4Eh ; A = 12345678 + [4301h] = 61h ; + [4302h] = 0BCh ; + [4303h] = 00h ; + [4304h] = 0D2h ; B = -5678 + [4305h] = 0E9h ; + [4306h] = 0FFh ; + [4307h] = 0FFh ; + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + inx h + mov c, M + inx h + mov d, M + inx h + mov e, M + inx h + mov a, b + add M + mov b, a + mov a, c + aci 0 + mov c, a + mov a, d + aci 0 + mov d, a + mov a, e + aci 0 + mov e, a + inx h + mov a, c + add M + mov c, a + mov a, d + aci 0 + mov d, a + mov a, e + aci 0 + mov e, a + inx h + mov a, d + add M + mov d, a + mov a, e + aci 0 + inx h + add M + mov e, a + inx h + mov M, b + inx h + mov M, c + inx h + mov M, d + inx h + mov M, e + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4308h + [4308h] -> 20h ; ans = 12340000 + [4309h] -> 4Bh ; + [430Ah] -> 0BCh ; + [430Bh] -> 00h ; + . + diff --git a/02. 8085/02. 32-bit Addition.pdf b/02. 8085/02. 32-bit Addition.pdf new file mode 100644 index 0000000..621221b Binary files /dev/null and b/02. 8085/02. 32-bit Addition.pdf differ diff --git a/02. 8085/03. Swap, Sign, Array Addition.asm b/02. 8085/03. Swap, Sign, Array Addition.asm new file mode 100644 index 0000000..206132b --- /dev/null +++ b/02. 8085/03. Swap, Sign, Array Addition.asm @@ -0,0 +1,95 @@ +; Q 3> +; a> Exchange the content of two memory locations + SU 4300h + [4300h] = 01h ; A = 1 + [4301h] = 02h ; B = 2 + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + inx h + mov c, M + mov M, b + dcx h + mov M, c + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4300h + [4300h] -> 02h ; A = 2 + [4301h] -> 01h ; B = 1 + . + + + + +; b> Add a set of 8bit numbers stored in an array + SU 4300h + [4300h] = 03h ; A.length = 3 + [4301h] = 01h ; A[0] = 0 + [4302h] = 02h ; A[1] = 1 + [4303h] = 03h ; A[2] = 2 + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + mvi a, 0 + inx h + sum_loop: + add M + inx h + dcr b + jnz sum_loop + mov M, a + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4304h + [4304h] -> 03h ; Sum = 3 + . + + + + +; c> Given an integer, determine if the number is +ve or -ve + SU 4300h + [4300h] = 0FDh ; A = -3 + . + + A + ORG 4200h + lxi h, 4300h + mov a, M + ori 0 + jz is_zero + jp is_pos + mvi a, 0FFh + jmp finish + is_zero: + mvi a, 00h + jmp finish + is_pos: + mvi a, 01h + finish: + inx h + mov M, a + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4301h + [4301h] -> 0FFh ; sgn(A) = -1 + . + diff --git a/02. 8085/03. Swap, Sign, Array Addition.pdf b/02. 8085/03. Swap, Sign, Array Addition.pdf new file mode 100644 index 0000000..5989cd5 Binary files /dev/null and b/02. 8085/03. Swap, Sign, Array Addition.pdf differ diff --git a/02. 8085/04. 8-bit Multiplication.asm b/02. 8085/04. 8-bit Multiplication.asm new file mode 100644 index 0000000..2740fe3 --- /dev/null +++ b/02. 8085/04. 8-bit Multiplication.asm @@ -0,0 +1,75 @@ +; Q 4> +; a> Multiply two 8bit numbers using repetitive addition + SU 4300h + [4300h] = 02h ; A = 2 + [4301h] = 04h ; B = 4 + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + inx h + mov c, M + inx h + mvi a, 0 + add_loop: + add c + dcr b + jnz add_loop + mov M, a + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4302h + [4302h] -> 08h ; A * B = 8 + . + + + + +; b> Multiply two 8bit numbers using shift and add + SU 4300h + [4300h] = 02h ; A = 2 + [4301h] = 04h ; B = 4 + . + + A + ORG 4200h + lxi h, 4300h + mov b, M + inx h + mov c, M + inx h + mvi d, 0 + add_loop: + mov a, c + ani 1 + jz dont_add + mov a, d + add b + mov d, a + dont_add: + mov a, b + adi 0 + ral + mov b, a + mov a, c + rar + ori 0 + mov c, a + jnz add_loop + mov M, d + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4302h + [4302h] -> 08h ; A * B = 8 + . + diff --git a/02. 8085/04. 8-bit Multiplication.pdf b/02. 8085/04. 8-bit Multiplication.pdf new file mode 100644 index 0000000..8406239 Binary files /dev/null and b/02. 8085/04. 8-bit Multiplication.pdf differ diff --git a/02. 8085/05. Split and Copy.asm b/02. 8085/05. Split and Copy.asm new file mode 100644 index 0000000..078fd80 --- /dev/null +++ b/02. 8085/05. Split and Copy.asm @@ -0,0 +1,185 @@ +; Q 5> +; a> Split a given array of 8bit numbers into two different +; arrays containing odd and even numbers + SU 4300h + [4300h] = 10h ; addr. of Odd Array + [4301h] = 43h ; + [4302h] = 20h ; addr. of Even Array + [4303h] = 43h ; + [4304h] = 05h ; A.length = 5 + [4305h] = 01h ; A[0] = 1 + [4306h] = 02h ; A[1] = 2 + [4307h] = 03h ; A[2] = 3 + [4308h] = 04h ; A[3] = 4 + [4309h] = 05h ; A[4] = 5 + . + + A + ORG 4200h + lda 4304h + mov b, a + push b + lhld 4300h + push h + pop b + lhld 4302h + push h + pop d + lxi h, 4305h + main_loop: + mov a, M + ani 1 + jz is_even + mov a, M + stax b + inx b + jmp is_common + is_even: + mov a, M + stax d + inx d + is_common: + inx h + lda 4304h + dcr a + sta 4304h + jnz main_loop + pop b + mov a, b + sta 4304h + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4310h + [4310h] -> 01h ; Odd[0] = 1 + [4311h] -> 03h ; Odd[1] = 3 + [4312h] -> 05h ; Odd[2] = 5 + SU 4320h + [4320h] -> 02h ; Even[0] = 2 + [4321h] -> 04h ; Even[1] = 4 + . + + + + +; b> Split a given array of 8bit numbers into two different +; arrays containing odd and even elements + SU 4300h + [4300h] = 10h ; addr. of Odd Array + [4301h] = 43h ; + [4302h] = 20h ; addr. of Even Array + [4303h] = 43h ; + [4304h] = 05h ; A.length = 5 + [4305h] = 02h ; A[0] = 2 + [4306h] = 04h ; A[1] = 4 + [4307h] = 06h ; A[2] = 6 + [4308h] = 08h ; A[3] = 8 + [4309h] = 0Ah ; A[4] = 10 + . + + A + ORG 4200h + lda 4304h + mov b, a + push b + lhld 4300h + push h + pop b + lhld 4302h + push h + pop d + lxi h, 4305h + main_loop: + mov a, M + stax b + inx b + inx h + lda 4304h + dcr a + sta 4304h + jz main_end + mov a, M + stax d + inx d + inx h + lda 4304h + dcr a + sta 4304h + jnz main_loop + main_end: + pop b + mov a, b + sta 4304h + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4310h + [4310h] -> 02h ; Odd[0] = 2 + [4311h] -> 06h ; Odd[1] = 6 + [4312h] -> 0Ah ; Odd[2] = 10 + SU 4320h + [4320h] -> 04h ; Even[0] = 4 + [4321h] -> 08h ; Even[1] = 8 + . + + + + +; c> Move the content of a block of memory to another +; memory location using stack pointer + SU 4300h + [4300h] = 10h ; addr. of Dest Block + [4301h] = 43h ; + [4302h] = 05h ; Src.length = 5 + [4303h] = 02h ; Src[0] = 1 + [4304h] = 04h ; Src[1] = 2 + [4305h] = 06h ; Src[2] = 3 + [4306h] = 08h ; Src[3] = 4 + [4307h] = 0Ah ; Src[4] = 5 + . + + A + ORG 4200h + lhld 4300h + lda 4302h + add l + mov l, a + mov a, h + aci 0 + mov h, a + sphl + lxi h, 4302h + mov c, M + mov a, c + add l + mov l, a + mov a, h + aci 0 + mov h, a + move_loop: + mov b, M + dcx h + push b + inx sp + dcr c + jnz move_loop + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4310h + [4310h] -> 01h ; Dest[0] = 1 + [4311h] -> 02h ; Dest[1] = 2 + [4312h] -> 03h ; Dest[2] = 3 + [4313h] -> 04h ; Dest[0] = 4 + [4314h] -> 05h ; Dest[1] = 5 + . + diff --git a/02. 8085/05. Split and Copy.pdf b/02. 8085/05. Split and Copy.pdf new file mode 100644 index 0000000..1b0c695 Binary files /dev/null and b/02. 8085/05. Split and Copy.pdf differ diff --git a/02. 8085/06. Sorting.asm b/02. 8085/06. Sorting.asm new file mode 100644 index 0000000..591879f --- /dev/null +++ b/02. 8085/06. Sorting.asm @@ -0,0 +1,70 @@ +; Q 6> Arrange a set of given numbers in ascending order +; using bubble sort algorithm + + SU 4300h + [4300h] = 05h ; A.length = 5 + [4301h] = 01h ; A[0] = 5 + [4302h] = 02h ; A[1] = 3 + [4303h] = 03h ; A[2] = 1 + [4304h] = 04h ; A[3] = 4 + [4305h] = 05h ; A[4] = 2 + . + + A + ORG 4200h + lxi h, 4300h + mov c, M + inx h + dcr c + mvi d, 0 + loop_pri: + mov a, d + cmp c + jp loop_pri_end + jz loop_pri_end + mov e, c + loop_sec: + mov a, e + cmp d + jm loop_sec_end + jz loop_sec_end + push h + mov a, l + add e + mov l, a + mov a, h + aci 0 + mov h, a + mov a, M + dcx h + mov b, M + cmp b + jp dont_swap + jz dont_swap + mov M, a + inx h + mov M, b + dont_swap: + pop h + dcr e + jmp loop_sec + loop_sec_end: + inr d + jmp loop_pri + loop_pri_end: + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4300h + [4300h] -> 05h ; A.length = 5 + [4301h] -> 01h ; A[0] = 1 + [4302h] -> 03h ; A[1] = 2 + [4303h] -> 05h ; A[2] = 3 + [4304h] -> 02h ; A[3] = 4 + [4305h] -> 04h ; A[4] = 5 + . + + diff --git a/02. 8085/06. Sorting.pdf b/02. 8085/06. Sorting.pdf new file mode 100644 index 0000000..547aff5 Binary files /dev/null and b/02. 8085/06. Sorting.pdf differ diff --git a/02. 8085/07. 8-bit Division.asm b/02. 8085/07. 8-bit Division.asm new file mode 100644 index 0000000..e5d1587 --- /dev/null +++ b/02. 8085/07. 8-bit Division.asm @@ -0,0 +1,57 @@ +; Q 7> Divide a 16bit number by an 8bit number + + SU 4300h + [4300h] = 10h ; A = 16 + [4301h] = 00h ; + [4302h] = 03h ; B = 3 + . + + A + ORG 4200h + // [4300h] = a0 + // [4301h] = a1 + // [4302h] = b + // [4303h] = q0 + // [4304h] = q1 + // [4304h] = r + // [4305h] = qk0 + // [4306h] = qk1 + de = ak; + + short a = 13, b = 4; + short c, ak, q, qk, r; + + c = b; qk = 1; + while(c <= a) + { + c <<= 1; + qk <<= 1; + } + + ak = a; q = 0; + do + { + c >>= 1; + qk >>= 1; + if(c <= ak) + { + ak -= c; + q |= qk; + } + }while(qk > 1); + r = ak; + + printf("%d / %d = %d rem %d\n", a, b, q, r); + hlt + . + + G 4200h + INT ; (try '.' here) + + SU 4303h + [4303h] -> 05h ; Quotient = 5 + [4304h] -> 00h ; + [4305h] -> 01h ; Remainder = 1 + . + + diff --git a/03. 8086/01. Addition.asm b/03. 8086/01. Addition.asm new file mode 100644 index 0000000..c921b2f --- /dev/null +++ b/03. 8086/01. Addition.asm @@ -0,0 +1,89 @@ +; Q 1> +; a> Addition of 2 16bit BCD numbers with carry + SW 2000h + [2000h] = 0999h ; A = 999 in BCD + [2002h] = 0001h ; B = 1 in BCD + [2004h] = (ans) ; C = (A + B) in BCD + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + add bx, ax + mov al, bl + daa + adc bh, 00h + mov bl, al + mov al, bh + daa + mov bh, al + mov [2004h], bx + hlt + . + + GO 1000h + INT ; (try '.' here) + + SW 2004h ; ans = 1000h + . ; => 1000 in BCD + + + +; b> Addition of 2 32bit numbers + SW 2000h + [2000h] = 4B20h ; A = 12340000 + [2002h] = 00BCh ; + [2004h] = 162Eh ; B = 5678 + [2006h] = 0000h ; + [2008h] = (ans) ; C = (A + B) + [200Ah] = (ans) ; + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + add ax, [2004h] + adc bx, [2006h] + mov [2008h], ax + mov [200Ah], bx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2008h ; ans = 614Eh + SW 200Ah ; ans = 00BCh + . ; => 12345678 + + + +; c> Addition of 2 signed 32bit numbers + SW 2000h + [2000h] = 614Eh ; A = 12345678 + [2002h] = 00BCh ; + [2004h] = 0E9D2h ; B = -5678 + [2006h] = 0FFFFh ; + [2008h] = (ans) ; C = (A + B) + [200Ah] = (ans) ; + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + add ax, [2004h] + adc bx, [2006h] + mov [2008h], ax + mov [200Ah], bx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2008h ; ans = 4B20h + SW 200Ah ; ans = 00BCh + . ; => 12340000 diff --git a/03. 8086/01. Addition.pdf b/03. 8086/01. Addition.pdf new file mode 100644 index 0000000..ecd5c2b Binary files /dev/null and b/03. 8086/01. Addition.pdf differ diff --git a/03. 8086/02. Subtraction and Multiplication.asm b/03. 8086/02. Subtraction and Multiplication.asm new file mode 100644 index 0000000..72868af --- /dev/null +++ b/03. 8086/02. Subtraction and Multiplication.asm @@ -0,0 +1,116 @@ +; Q 2> +; a> Subtraction of 2 32bit BCD numbers + SW 2000h + [2000h] = 614Eh ; A = 12345678 + [2002h] = 00BCh ; + [2004h] = 162Eh ; B = 5678 + [2006h] = 0000h ; + [2008h] = (ans) ; C = (A - B) + [200Ah] = (ans) ; + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + sub ax, [2004h] + sbb bx, [2006h] + mov [2008h], ax + mov [200Ah], bx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2008h ; ans = 4B20h + SW 200Ah ; ans = 00BCh + . ; => 12340000 + + + +; b> Multiplication of 2 16bit numbers + SW 2000h + [2000h] = 03E8h ; A = 1000 + [2002h] = 000Ah ; B = 10 + [2004h] = (ans) ; C = (A * B) + [2006h] = (ans) ; + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + mul bx + mov [2004h], ax + mov [2006h], dx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2004h ; ans = 2710h + SW 2006h ; ans = 0000h + . ; => 10000 + + + +; c> Addition of 8bit signed and unsigned numbers using a loop +; with the array starting at some specified memory location + SB 2002h ; Unsigned Array A[] + [2002h] = 05h ; A.length = 5 + [2003h] = 00h ; + [2004h] = 0Ah ; A[0] = 10 + [2005h] = 0Ah ; A[1] = 10 + [2006h] = 0Ah ; A[2] = 10 + [2007h] = 0Ah ; A[3] = 10 + [2008h] = 0Ch ; A[4] = 12 + [2009h] = (ans) ; C = sum(A) + . + SB 200Ah ; Signed Array B[] + [200Ah] = 004h ; B.length = 4 + [200Bh] = 000h ; + [200Ch] = 00Ah ; A[0] = 10 + [200Dh] = 0F7h ; A[1] = -9 + [200Eh] = 00Ah ; A[2] = 10 + [200Fh] = 0F7h ; A[3] = -9 + [2010h] = (ans) ; C = sum(A) + . + + A + 1000h + mov al, 00h + mov si, [2000h] + mov cx, [si] + add si, 0002h + loop_label: ; Note the address here + add al, [si] + inc si + dec cx + jnz loop_label ; Use that address here + mov [si], al + hlt + . + + ; Case-1 Unsigned Numbers + SW 2000h + [2000h] = 2002h ; Pointer to Unsigned Array A[] + . + GO 1000h + INT ;(try '.' here) + + SB 2009h ; ans = 34h + . ; => 52 + + ; Case-2 Signed Numbers + SW 2000h + [2000h] = 200Ah ; Pointer to Signed Array B[] + . + GO 1000h + INT ;(try '.' here) + + SB 2010h ; ans = 02h + . ; => 2 + + \ No newline at end of file diff --git a/03. 8086/02. Subtraction and Multiplication.pdf b/03. 8086/02. Subtraction and Multiplication.pdf new file mode 100644 index 0000000..2533dc5 Binary files /dev/null and b/03. 8086/02. Subtraction and Multiplication.pdf differ diff --git a/03. 8086/03. Multiplication.asm b/03. 8086/03. Multiplication.asm new file mode 100644 index 0000000..1b4a9ce --- /dev/null +++ b/03. 8086/03. Multiplication.asm @@ -0,0 +1,82 @@ +; Q 3> +; a> Multiplication of 2 32bit numbers + SW 2000h + [2000h] = 0A120h ; A = 500000 + [2002h] = 00007h ; + [2004h] = 04240h ; B = 1000000 + [2006h] = 0000Fh ; + [2008h] = (ans) ; C = (A * B) + [200Ah] = (ans) ; + [200Ch] = (ans) ; + [200Eh] = (ans) ; + . + + A + 1000h + mov ax, 0000h + mov [2008h], ax + mov [200Ah], ax + mov [200Ch], ax + mov [200Eh], ax + mov ax, [2000h] + mov bx, [2004h] + mul bx + mov [2008h], ax + mov [200Ah], dx + mov ax, [2000h] + mov bx, [2006h] + mul bx + add [200Ah], ax + adc [200Ch], dx + adc w.[200Eh], 0000h + mov ax, [2002h] + mov bx, [2004h] + mul bx + add [200Ah], ax + adc [200Ch], dx + adc w.[200Eh], 0000h + mov ax, [2002h] + mov bx, [2006h] + mul bx + add [200Ch], ax + adc [200Eh], dx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2008h ; ans = 8800h + SW 200Ah ; ans = 6A52h + SW 200Ch ; ans = 0074h + SW 200Eh ; ans = 0000h + . ; => 500000000000 + + + +; b> Multiplication of 2 signed 16bit numbers + SW 2000h + [2000h] = 003E8h ; A = 1000 + [2002h] = 0FFF6h ; B = -10 + [2004h] = (ans) ; C = (A * B) + [2006h] = (ans) ; + . + + A + 1000h + mov ax, [2000h] + mov bx, [2002h] + imul bx + mov [2004h], ax + mov [2006h], dx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2004h ; ans = 0D8F0h + SW 2006h ; ans = 0FFFFh + . ; => -10000 + + \ No newline at end of file diff --git a/03. 8086/03. Multiplication.pdf b/03. 8086/03. Multiplication.pdf new file mode 100644 index 0000000..089bca8 Binary files /dev/null and b/03. 8086/03. Multiplication.pdf differ diff --git a/03. 8086/04. Split and Copy.asm b/03. 8086/04. Split and Copy.asm new file mode 100644 index 0000000..87cd53f --- /dev/null +++ b/03. 8086/04. Split and Copy.asm @@ -0,0 +1,113 @@ +; Q 4> +; a> To store the elements of a given array in 2 separate arrays +; comprising of even and odd elements + SW 2000h + [2000h] = 2006h ; Address of source array A[] + [2002h] = 2014h ; Address to even array E[] + [2004h] = 2024h ; Address to odd array O[] + [2006h] = 0006h ; A.length = 6 + [2008h] = 0001h ; A[0] = 1 + [200Ah] = 0002h ; A[1] = 2 + [200Ch] = 0003h ; A[2] = 3 + [200Eh] = 0004h ; A[3] = 4 + [2010h] = 0005h ; A[4] = 5 + [2012h] = 0006h ; A[5] = 6 + . + + A + 1000h + mov bx, [2000h] + mov si, [2002h] + mov di, [2004h] + mov ax, [bx] + push ax + mov bp, sp + add bx, 0002h + add si, 0002h + add di, 0002h + mov cx, 0000h + mov dx, 0000h + loop_label: + mov ax, [bx] + test ax, 0001h + jnz odd_num + mov [si], ax + add si, 0002h + inc cx + jmp loop_comm + odd_num: + mov [di], ax + add di, 0002h + inc dx + loop_comm: + add bx, 0002h + dec [bp] + jnz loop_label + pop ax + mov [2014h], cx + mov [2024h], dx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2014h ; ans = 0003h => E.length = 3 + SW 2016h ; ans = 0002h => E[0] = 2 + SW 2018h ; ans = 0004h => E[1] = 4 + SW 201Ah ; ans = 0006h => E[2] = 6 + SW 2024h ; ans = 0003h => O.length = 3 + SW 2026h ; ans = 0001h => O[0] = 1 + SW 2028h ; ans = 0003h => O[1] = 3 + SW 202Ah ; ans = 0005h => O[2] = 5 + . + + + +; b> To move the contents from a block in a memory location to a +; different memory location using stack + SW 2000h + [2000h] = 2006h ; Source Block Address SRC + [2002h] = 2010h ; Destination Block Address DST + [2004h] = 000Ah ; Transfer Size SZ = 10 + [2006h] = 0001h ; 00h, 01h + [2008h] = 0002h ; 00h, 02h + [200Ah] = 0003h ; 00h, 03h + [200Ch] = 0004h ; 00h, 04h + [200Eh] = 0005h ; 00h, 05h + . + + A + 1000h + mov si, [2000h] + mov di, [2002h] + mov cx, [2004h] + add di, cx + dec di + mov ax, 0000h + loop_label1: + mov al, [si] + push ax + inc si + dec cx + jnz loop_label1 + mov cx, [2004h] + loop_label2: + pop ax + mov [di], al + dec di + dec cx + jnz loop_label2 + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2010h ; ans = 0001h + SW 2012h ; ans = 0002h + SW 2014h ; ans = 0003h + SW 2016h ; ans = 0004h + SW 2018h ; ans = 0005h + + \ No newline at end of file diff --git a/03. 8086/04. Split and Copy.pdf b/03. 8086/04. Split and Copy.pdf new file mode 100644 index 0000000..cb69c92 Binary files /dev/null and b/03. 8086/04. Split and Copy.pdf differ diff --git a/03. 8086/05. Sorting and Bit scan.asm b/03. 8086/05. Sorting and Bit scan.asm new file mode 100644 index 0000000..04c3ed7 --- /dev/null +++ b/03. 8086/05. Sorting and Bit scan.asm @@ -0,0 +1,167 @@ +; Q 5> +; a> Arrange a set of given numbers in ascending order using bubble +; sort algorithm + SW 2000h ; Signed Array A[] + [2000h] = 00006h ; A.length = 6 + [2002h] = 0FFFFh ; A[0] = -1 + [2004h] = 00003h ; A[1] = 3 + [2006h] = 0FFFDh ; A[2] = -3 + [2008h] = 0FFFEh ; A[3] = -2 + [200Ah] = 00002h ; A[4] = 2 + [200Ch] = 00001h ; A[5] = 1 + . + + A + 1000h + mov bx, 2000h + mov cx, [bx] + dec cx + add bx, 2 + mov si, 0 + loop_pri: + cmp si, cx + jae loop_pri_end + mov di, cx + loop_sec: + cmp di, si + jbe loop_sec_end + shl di, 1 + mov ax, [bx + di] + cmp ax, [bx + di - 2] + jge dont_swap + xchg ax, [bx + di - 2] + mov [bx + di], ax + dont_swap: + shr di, 1 + dec di + jmp loop_sec + loop_sec_end: + inc si + jmp loop_pri + loop_pri_end: + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2002h ; ans = 0FFFDh => A[0] = -3 + SW 2004h ; ans = 0FFFEh => A[1] = -2 + SW 2006h ; ans = 0FFFFh => A[2] = -1 + SW 2008h ; ans = 00001h => A[3] = 1 + SW 200Ah ; ans = 00002h => A[4] = 2 + SW 200Ch ; ans = 00003h => A[5] = 3 + . + + + +; b> Arrange a set of given numbers in ascending order using stack + SW 2000h ; Signed Array A[] + [2000h] = 00006h ; A.length = 6 + [2002h] = 0FFFFh ; A[0] = -1 + [2004h] = 00003h ; A[1] = 3 + [2006h] = 0FFFDh ; A[2] = -3 + [2008h] = 0FFFEh ; A[3] = -2 + [200Ah] = 00002h ; A[4] = 2 + [200Ch] = 00001h ; A[5] = 1 + . + + A + 1000h + mov bx, 2000h + mov cx, [bx] + dec cx + add bx, 2 + mov si, 0 + loop_pri: + cmp si, cx + jae loop_pri_end + mov di, cx + loop_sec: + cmp di, si + jbe loop_sec_end + shl di, 1 + mov ax, [bx + di] + cmp ax, [bx + di - 2] + jle dont_swap + xchg ax, [bx + di - 2] + mov [bx + di], ax + dont_swap: + shr di, 1 + dec di + jmp loop_sec + loop_sec_end: + inc si + jmp loop_pri + loop_pri_end: + mov si, 0 + loop_ter_1: + shl si, 1 + push [bx + si] + shr si, 1 + inc si + cmp si, cx + jle loop_ter_1 + mov si, 0 + loop_ter_2: + shl si, 1 + pop [bx + si] + shr si, 1 + inc si + cmp si, cx + jle loop_ter_2 + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2002h ; ans = 0FFFDh => A[0] = -3 + SW 2004h ; ans = 0FFFEh => A[1] = -2 + SW 2006h ; ans = 0FFFFh => A[2] = -1 + SW 2008h ; ans = 00001h => A[3] = 1 + SW 200Ah ; ans = 00002h => A[4] = 2 + SW 200Ch ; ans = 00003h => A[5] = 3 + . + + + +; c> Determine the bit positions containing '1' in a 16bit number + SW 2000h + [2000h] = 1249h ; 16bit number => 0001001001001001b + [2002h] = 2004h ; Address to Bit Position Array B[] + . + + A + 1000h + mov ax, [2000h] + mov di, [2002h] + mov cx, 0000h + mov dx, 0000h + add di, 0002h + loop_label: + test ax, 0001h + jz bit_is_0 + mov [di], dx + add di, 0002h + inc cx + bit_is_0: + inc dx + shr ax, 1 + jnz loop_label + mov di, [2002h] + mov [di], cx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2004h ; ans = 0005h => B.length = 5 + SW 2006h ; ans = 0000h => b0 + SW 2008h ; ans = 0003h => b3 + SW 200Ah ; ans = 0006h => b6 + SW 200Ch ; ans = 0009h => b9 + SW 200Eh ; ans = 000Ch => b12 + . + \ No newline at end of file diff --git a/03. 8086/05. Sorting and Bit scan.pdf b/03. 8086/05. Sorting and Bit scan.pdf new file mode 100644 index 0000000..123ff3f Binary files /dev/null and b/03. 8086/05. Sorting and Bit scan.pdf differ diff --git a/03. 8086/06. Factors of Number.asm b/03. 8086/06. Factors of Number.asm new file mode 100644 index 0000000..ca25717 --- /dev/null +++ b/03. 8086/06. Factors of Number.asm @@ -0,0 +1,44 @@ +; Q 6> Given a 16bit number determine all its factors from +; 0 to 9 + SW 2000h + [2000h] = 00D2h ; A = 210 + [2002h] = 2004h ; Address to Factors Array F[] + . + + A + 1000h + mov cx, 0000h + mov bx, 0001h + mov di, [2002h] + add di, 0002h + loop_label: + mov dx, 0000h + mov ax, [2000h] + div bx + or dx, dx + jnz not_factor + inc cx + mov [di], bx + add di, 0002h + not_factor: + inc bx + cmp bx, 0009h + jbe loop_label + mov di, [2002h] + mov [di], cx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2004h ; ans = 0006h => F.length = 6 + SW 2006h ; ans = 0001h => 1 + SW 2008h ; ans = 0002h => 2 + SW 200Ah ; ans = 0003h => 3 + SW 200Ch ; ans = 0005h => 5 + SW 200Eh ; ans = 0006h => 6 + SW 2010h ; ans = 0007h => 7 + . + + diff --git a/03. 8086/06. Factors of Number.pdf b/03. 8086/06. Factors of Number.pdf new file mode 100644 index 0000000..aeb30b4 Binary files /dev/null and b/03. 8086/06. Factors of Number.pdf differ diff --git a/03. 8086/07. 32-bit Multiplication.asm b/03. 8086/07. 32-bit Multiplication.asm new file mode 100644 index 0000000..d974143 --- /dev/null +++ b/03. 8086/07. 32-bit Multiplication.asm @@ -0,0 +1,59 @@ +; Q 7> Multiplication of 2 32bit signed numbers + SW 2000h + [2000h] = 05EE0h ; A = -500000 + [2002h] = 0FFF8h ; + [2004h] = 04240h ; B = 1000000 + [2006h] = 0000Fh ; + [2008h] = (ans) ; C = (A * B) + [200Ah] = (ans) ; + [200Ch] = (ans) ; + [200Eh] = (ans) ; + . + + A + 1000h + mov ax, 0000h + mov ax, [2000h] + mov bx, [2004h] + imul bx + mov [2008h], ax + mov [200Ah], dx + mov cl, 08h + sar dx, cl + mov dl, dh + mov [200Ch], dx + mov [200Eh], dx + mov ax, [2000h] + mov bx, [2006h] + imul bx + add [200Ah], ax + adc [200Ch], dx + sar dx, cl + mov dl, dh + adc [200Eh], dx + mov ax, [2002h] + mov bx, [2004h] + imul bx + add [200Ah], ax + adc [200Ch], dx + sar dx, cl + mov dl, dh + adc [200Eh], dx + mov ax, [2002h] + mov bx, [2006h] + imul bx + add [200Ch], ax + adc [200Eh], dx + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2008h ; ans = 07800h + SW 200Ah ; ans = 095ADh + SW 200Ch ; ans = 0FF8Bh + SW 200Eh ; ans = 0FFFFh + . ; => -500000000000 + + diff --git a/03. 8086/07. 32-bit Multiplication.pdf b/03. 8086/07. 32-bit Multiplication.pdf new file mode 100644 index 0000000..35bc7f2 Binary files /dev/null and b/03. 8086/07. 32-bit Multiplication.pdf differ diff --git a/03. 8086/09. Signed and Unsigned Range.asm b/03. 8086/09. Signed and Unsigned Range.asm new file mode 100644 index 0000000..02a6aff --- /dev/null +++ b/03. 8086/09. Signed and Unsigned Range.asm @@ -0,0 +1,53 @@ +; Q 9> +; a> Determine the range of signed numbers the uP can handle + SW 2000h + [2000h] = (ans) ; Minimum signed number + [2002h] = (ans) ; Maximum signed number + . + + A + 1000h + mov cl, 04h + mov ax, 0008h + loop_min: + or ax, ax + js num_min + shl ax, cl + jmp loop_min + num_min: + mov [2000h], ax + not ax + mov [2002h], ax + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2000h ; ans = 8000h => -32768 + SW 2002h ; ans = 7FFFh => 32767 + . + + + +; b> Determine the range of unsigned numbers the uP can handle + SW 2000h + [2000h] = (ans) ; Minimum unsigned number + [2002h] = (ans) ; Maximum unsigned number + . + + A + 1000h + mov ax, 0000h + mov [2000h], ax + not ax + mov [2002h], ax + hlt + . + + GO 1000h + INT ;(try '.' here) + + SW 2000h ; ans = 00000h => 0 + SW 2002h ; ans = 0FFFFh => 65535 + . \ No newline at end of file diff --git a/03. 8086/09. Signed and Unsigned Range.pdf b/03. 8086/09. Signed and Unsigned Range.pdf new file mode 100644 index 0000000..8923b25 Binary files /dev/null and b/03. 8086/09. Signed and Unsigned Range.pdf differ diff --git a/04. Interfacing/01. Square Wave.asm b/04. Interfacing/01. Square Wave.asm new file mode 100644 index 0000000..14744b1 --- /dev/null +++ b/04. Interfacing/01. Square Wave.asm @@ -0,0 +1,9 @@ +mvi a, 80h +out 0Fh +mvi a, 0FFh +loop: +out 0Ch +out 0Dh +out 0Eh +cma +jmp loop diff --git a/05. Project/Traffic Control.asm b/05. Project/Traffic Control.asm new file mode 100644 index 0000000..233f287 --- /dev/null +++ b/05. Project/Traffic Control.asm @@ -0,0 +1,52 @@ +; Traffic Controller +;------------------- +; +; PortA = Left Traffic Light +; PortB = Top Traffic Light +; PortC = Bottom Traffic Light +; b0 = Red Light +; b1 = Yellow Light +; b2 = Green Light + +; Data +SW 2000h +RedClr = 001b +YellowClr = 010b +GreenClr = 100b + +; Initialization +A +1000h + mov al, 80h + out 26h, al + case1: + mov al, +display_light: + push ax + mov cl, ah + and cl, 11b + mov al, 1 + shl al, cl + out 20h, al + shr ah, 1 + shr ah, 1 + mov cl, ah + and cl, 11b + mov al, 1 + shl al, cl + out 22h, al + shr ah, 1 + shr ah, 1 + mov cl, ah + and cl, + +get_colour: + push cl + mov cl, al + and cl, 11b + mov ah, 1 + shl ah, cl + pop cl + ret + + diff --git a/05. Project/Traffic Control.pdf b/05. Project/Traffic Control.pdf new file mode 100644 index 0000000..af9d688 Binary files /dev/null and b/05. Project/Traffic Control.pdf differ diff --git a/LICENSE b/LICENSE index 7f6078a..1402d25 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 nitrece +Copyright (c) 2012-20 Subhajit Sahu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9db919b..ac90138 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# microprocessor-laboratory -A microprocessor is a computer processor that is implemented on a single integrated circuit of MOSFET construction. +A microprocessor is a computer processor that is implemented on a single +integrated circuit of MOSFET construction. + +**Course**: Microprocessor Laboratory, [Monsoon 2012]
+**Taught by**: Prof. Sarat Kumar Patra + +[Monsoon 2012]: https://github.com/nitrece/semester-5 diff --git "a/References/80C51 family programmer\342\200\231s guide and instruction set.pdf" "b/References/80C51 family programmer\342\200\231s guide and instruction set.pdf" new file mode 100644 index 0000000..617e89e Binary files /dev/null and "b/References/80C51 family programmer\342\200\231s guide and instruction set.pdf" differ diff --git a/References/Micro 86-88 LCD User Manual.pdf b/References/Micro 86-88 LCD User Manual.pdf new file mode 100644 index 0000000..439f99a Binary files /dev/null and b/References/Micro 86-88 LCD User Manual.pdf differ diff --git a/References/Micropower-i LCD Technical Reference.pdf b/References/Micropower-i LCD Technical Reference.pdf new file mode 100644 index 0000000..dbde764 Binary files /dev/null and b/References/Micropower-i LCD Technical Reference.pdf differ diff --git a/References/Micropower-i Technical Reference.pdf b/References/Micropower-i Technical Reference.pdf new file mode 100644 index 0000000..fbbde37 Binary files /dev/null and b/References/Micropower-i Technical Reference.pdf differ diff --git a/References/Micropower-i User Manual.pdf b/References/Micropower-i User Manual.pdf new file mode 100644 index 0000000..90dede1 Binary files /dev/null and b/References/Micropower-i User Manual.pdf differ