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

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
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
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 

Recently uploaded (20)

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
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
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 

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 :