SlideShare a Scribd company logo
1 of 9
Download to read offline
Implementation
This section is a comprehensive guide to all the programs that we coded on the processor
and can of great help for anyone who wishes to begin writing a complex routine on the
processor.
#Program 1 - Adding two Numbers
ASCII : ?@?@<
HEX :

Description :
This is a simple addition program, the assembly equivalent is as follows.
SCANF("%d", &STACK[SP])
PRINTF("%d", STACK[SP])
MOV A,STACK[SP]
SCANF("%d", &STACK[SP])
MOV B,STACK[SP]
ADD A, B
MOV STACK[SP],A
PRINTF("%d",STACK[SP])
HALT
Output :
#PROGRAM 2 : While Loop
ASCII : ᄿ%‫د‬䀕㵁㰇
HEX :

Description :
This is basically a while loop where is we ask the person to enter a number and decrement
the number at each instruction till it becomes zero.
Following is the assembly implementation.
scanf("%d",&STACK[SP])
MOV A,STACK[SP]
FLAG=A-ROM[++IP]
JE 6 BYTES
MOV STACK[SP],A
PRINTF("%d",STACK[SP])
--A
JMP -7 BYTES
HALT
OUTPUT :
#PROGRAM 3 : ARRAY CREATION
ASCII : ᄿ└⼀㠆䄿 &‫د‬䍀㵂㰇
HEX :

Description :
In this program the person is asked to enter the size of the array, followed by entering the
elements in the array, then those elements are displayed last first.
scanf("%d",&STACK[SP])
MOV A,STACK[SP]
MOV B,A
FLAG=A-ROM[++IP]
JE 6 BYTES
++SP
scanf("%d",&STACK[SP])
- -A
JUMP -7 BYTES
FLAG=B-ROM[++IP]
JE 6 BYTES
PRINTF("%d",STACK[SP])
- -SP
- -B
JMP -7BYTES
HALT
OUTPUT
#PROGRAM 4 : CIPHER ENCRYPTION, REPLACEMENT.
ASCII : ᄿ└⼀㠆䄿 ☓⼀ᄉԜ䈕㵃ᄊ%‫د‬㨸㵁㰇
HEX :

DESCRIPTION :
In this program the user enters the number of elements to be encrypted. Then those many
elements are to be entered, then the string is displayed after adding 5 to the values entered.
The logic of importance here is that after the stack pointer is decremented the number of
times equal to the number of values, the value just as one lower position is equal to the
number of values.
OUTPUT :
#PROGRAM 5 : LINEAR SEARCH
ASCII : ?% /8?A=8?& / CH
/
B= @<
HEX :

Description : In this program we simply as the use to enter a variable number of values and
then enter the value to be searched. The index of the value being searched is returned.
Output :
#PROGRAM 6 : On the fly decryption of code
ASCII : LB& MJ8B=L +C% /

"AC= 8LA% MT8A=D*4 =DFB +4 ! GHB*4 =?FB A

HEX :

DESCRIPTION :
This is one of the most important programs, in this program first the entire ROM gets
decrypted (which is originally encrypted using a plus 5 substitution cipher) and is then
executed on the fly.
Following is the assembly level description.
[DECODING STUB]
MOV A, fileLen
MOV B,A
--B
FLAG=B-ROM[++IP]
JL 7 BYTES
MOV A,ROM[B]
MOV STACK[SP],A
++SP
--B
JMP -8 BYTES
MOV A, fileLen
A=A-ROM[++IP]
JNE 23 BYTES
--SP
FLAG:A-[ROM++IP]
JE 9 BYTES
MOV B,STACK[SP]
B=B-ROM[++IP]
MOV STACK[SP],B
--A
--SP
JMP -16 BYTES
++SP
MOV A ,fileLen
--A
FLAG=A-[ROM++IP]
JL 7 BYTES
MOV B,STACK[SP]
MOV ROM[A],B
++SP
[ ACTUAL ENCRYPTED CODE]

OUTPUT : The OUTPUT is exactly the same as the encryption program we used earlier.
#PROGRAM 7 : On the fly code expansion
ASCII : ?% /?8?8A=

<L!% /|gcUda8g|c8Uda87A=ÉE??h<% /†Å8A=

HEX :

DESCRIPTION :
This program is a proof of concept program where in we dynamically enter the hex codes in
an index based dictionary which is used later to expand and execute the code. The stub is 60
bytes long. We in this program have expanded the earlier program we wrote for addition of
two numbers by 1:2 ratio. Following is the assembly level description :
[EXPANSION STUB]
scanf("%d",&STACK[SP])
MOV A,STACK[SP]
FLAG=A-ROM[++IP]
JE 8 BYTES
scanf("%d",&STACK[SP])
++SP
scanf("%d",&STACK[SP])
++SP
--A
JMP -9 BYTES
MOV B,ROM[++IP] //STUB LENGTH
A = fileLen
A=A-B
FLAG=A-ROM[++IP]
JE 14 BYTES
MOV C ,ROM[B]
MOV D,SP
MOV SP,C
MOV C,STACK[SP]
MOV SP,D
MOV STACK[SP],C
++SP
MOV D,SP
MOV C,ROM[B]
MOV SP,C
++SP
MOV C,STACK[SP]
MOV SP,D
MOV STACK[SP],C
++SP
++B
--A
JMP -21 BYTES
ROM=(char *)realloc(ROM,ROM[++IP]) //FILE EXPANDED
scanf("%d",&STACK[SP])
MOV A,STACK[SP]
scanf("%d",&STACK[SP])
MOV B,STACK[SP]
MOV SP,B
MOV C,ROM[++IP]
FLAG=A-ROM[++IP]
JE 8 BYTES
MOV B,STACK[SP]
MOV ROM[C],B
++C
++SP
--A
JMP -9 BYTES
[COMPRESSED FORM]

OUTPUT :

More Related Content

What's hot

Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic conceptsAbdul Khan
 
Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop AssemblerTuhin_Das
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Softwarel xf
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Srinivasan Venkataramanan
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly languagePradeep Kumar TS
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Bilal Amjad
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language ApekshaShinde6
 
Return oriented programming
Return oriented programmingReturn oriented programming
Return oriented programminghybr1s
 
Os Worthington
Os WorthingtonOs Worthington
Os Worthingtonoscon2007
 
Assembly level language
Assembly level languageAssembly level language
Assembly level languagePDFSHARE
 
Demystify eBPF JIT Compiler
Demystify eBPF JIT CompilerDemystify eBPF JIT Compiler
Demystify eBPF JIT CompilerNetronome
 
LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723Iftach Ian Amit
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly languageAhmed M. Abed
 

What's hot (20)

Assemblers
AssemblersAssemblers
Assemblers
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop Assembler
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
Assembler
AssemblerAssembler
Assembler
 
Comparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms SoftwareComparing Cpp And Erlang For Motorola Telecoms Software
Comparing Cpp And Erlang For Motorola Telecoms Software
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...Top five reasons why every DV engineer will love the latest systemverilog 201...
Top five reasons why every DV engineer will love the latest systemverilog 201...
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly language
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
 
Coal (1)
Coal (1)Coal (1)
Coal (1)
 
Return oriented programming
Return oriented programmingReturn oriented programming
Return oriented programming
 
Os Worthington
Os WorthingtonOs Worthington
Os Worthington
 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
 
Chapter 6 notes
Chapter 6 notesChapter 6 notes
Chapter 6 notes
 
Demystify eBPF JIT Compiler
Demystify eBPF JIT CompilerDemystify eBPF JIT Compiler
Demystify eBPF JIT Compiler
 
LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
 

Similar to Implementation - Sample Runs

Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language ProgrammingNiropam Das
 
Call Execute For Everyone
Call Execute For EveryoneCall Execute For Everyone
Call Execute For EveryoneDaniel Boisvert
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manualSami Said
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsnoahjamessss
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringscskvsmi44
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureNetronome
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
 
Cis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCIS321
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly LanguageAhmed M. Abed
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101Bellaj Badr
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Ikhwan_Fakrudin
 

Similar to Implementation - Sample Runs (20)

Alp 05
Alp 05Alp 05
Alp 05
 
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
 
Call Execute For Everyone
Call Execute For EveryoneCall Execute For Everyone
Call Execute For Everyone
 
Alp 05
Alp 05Alp 05
Alp 05
 
Alp 05
Alp 05Alp 05
Alp 05
 
Csd01
Csd01Csd01
Csd01
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manual
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-stringsDevry cis-170-c-i lab-5-of-7-arrays-and-strings
Devry cis-170-c-i lab-5-of-7-arrays-and-strings
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
eBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging InfrastructureeBPF Tooling and Debugging Infrastructure
eBPF Tooling and Debugging Infrastructure
 
First c program
First c programFirst c program
First c program
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Cis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and stringsCis 170 c ilab 5 of 7 arrays and strings
Cis 170 c ilab 5 of 7 arrays and strings
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

Implementation - Sample Runs

  • 1. Implementation This section is a comprehensive guide to all the programs that we coded on the processor and can of great help for anyone who wishes to begin writing a complex routine on the processor. #Program 1 - Adding two Numbers ASCII : ?@?@< HEX : Description : This is a simple addition program, the assembly equivalent is as follows. SCANF("%d", &STACK[SP]) PRINTF("%d", STACK[SP]) MOV A,STACK[SP] SCANF("%d", &STACK[SP]) MOV B,STACK[SP] ADD A, B MOV STACK[SP],A PRINTF("%d",STACK[SP]) HALT Output :
  • 2. #PROGRAM 2 : While Loop ASCII : ᄿ%‫د‬䀕㵁㰇 HEX : Description : This is basically a while loop where is we ask the person to enter a number and decrement the number at each instruction till it becomes zero. Following is the assembly implementation. scanf("%d",&STACK[SP]) MOV A,STACK[SP] FLAG=A-ROM[++IP] JE 6 BYTES MOV STACK[SP],A PRINTF("%d",STACK[SP]) --A JMP -7 BYTES HALT OUTPUT :
  • 3. #PROGRAM 3 : ARRAY CREATION ASCII : ᄿ└⼀㠆䄿 &‫د‬䍀㵂㰇 HEX : Description : In this program the person is asked to enter the size of the array, followed by entering the elements in the array, then those elements are displayed last first. scanf("%d",&STACK[SP]) MOV A,STACK[SP] MOV B,A FLAG=A-ROM[++IP] JE 6 BYTES ++SP scanf("%d",&STACK[SP]) - -A JUMP -7 BYTES FLAG=B-ROM[++IP] JE 6 BYTES PRINTF("%d",STACK[SP]) - -SP - -B JMP -7BYTES HALT OUTPUT
  • 4. #PROGRAM 4 : CIPHER ENCRYPTION, REPLACEMENT. ASCII : ᄿ└⼀㠆䄿 ☓⼀ᄉԜ䈕㵃ᄊ%‫د‬㨸㵁㰇 HEX : DESCRIPTION : In this program the user enters the number of elements to be encrypted. Then those many elements are to be entered, then the string is displayed after adding 5 to the values entered. The logic of importance here is that after the stack pointer is decremented the number of times equal to the number of values, the value just as one lower position is equal to the number of values. OUTPUT :
  • 5. #PROGRAM 5 : LINEAR SEARCH ASCII : ?% /8?A=8?& / CH / B= @< HEX : Description : In this program we simply as the use to enter a variable number of values and then enter the value to be searched. The index of the value being searched is returned. Output :
  • 6. #PROGRAM 6 : On the fly decryption of code ASCII : LB& MJ8B=L +C% / "AC= 8LA% MT8A=D*4 =DFB +4 ! GHB*4 =?FB A HEX : DESCRIPTION : This is one of the most important programs, in this program first the entire ROM gets decrypted (which is originally encrypted using a plus 5 substitution cipher) and is then executed on the fly. Following is the assembly level description. [DECODING STUB] MOV A, fileLen MOV B,A --B FLAG=B-ROM[++IP] JL 7 BYTES MOV A,ROM[B] MOV STACK[SP],A ++SP --B JMP -8 BYTES MOV A, fileLen A=A-ROM[++IP] JNE 23 BYTES --SP FLAG:A-[ROM++IP] JE 9 BYTES MOV B,STACK[SP] B=B-ROM[++IP] MOV STACK[SP],B --A --SP JMP -16 BYTES
  • 7. ++SP MOV A ,fileLen --A FLAG=A-[ROM++IP] JL 7 BYTES MOV B,STACK[SP] MOV ROM[A],B ++SP [ ACTUAL ENCRYPTED CODE] OUTPUT : The OUTPUT is exactly the same as the encryption program we used earlier.
  • 8. #PROGRAM 7 : On the fly code expansion ASCII : ?% /?8?8A= <L!% /|gcUda8g|c8Uda87A=ÉE??h<% /†Å8A= HEX : DESCRIPTION : This program is a proof of concept program where in we dynamically enter the hex codes in an index based dictionary which is used later to expand and execute the code. The stub is 60 bytes long. We in this program have expanded the earlier program we wrote for addition of two numbers by 1:2 ratio. Following is the assembly level description : [EXPANSION STUB] scanf("%d",&STACK[SP]) MOV A,STACK[SP] FLAG=A-ROM[++IP] JE 8 BYTES scanf("%d",&STACK[SP]) ++SP scanf("%d",&STACK[SP]) ++SP --A JMP -9 BYTES MOV B,ROM[++IP] //STUB LENGTH A = fileLen A=A-B FLAG=A-ROM[++IP] JE 14 BYTES MOV C ,ROM[B] MOV D,SP MOV SP,C MOV C,STACK[SP] MOV SP,D MOV STACK[SP],C
  • 9. ++SP MOV D,SP MOV C,ROM[B] MOV SP,C ++SP MOV C,STACK[SP] MOV SP,D MOV STACK[SP],C ++SP ++B --A JMP -21 BYTES ROM=(char *)realloc(ROM,ROM[++IP]) //FILE EXPANDED scanf("%d",&STACK[SP]) MOV A,STACK[SP] scanf("%d",&STACK[SP]) MOV B,STACK[SP] MOV SP,B MOV C,ROM[++IP] FLAG=A-ROM[++IP] JE 8 BYTES MOV B,STACK[SP] MOV ROM[C],B ++C ++SP --A JMP -9 BYTES [COMPRESSED FORM] OUTPUT :