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

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 

Recently uploaded (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

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 :