SlideShare uma empresa Scribd logo
1 de 9
ECE 3724/CS 3124 Test #2 – Summer 2005- Reese
You may NOT use a calculator. You may use only the provided reference materials. If a binary result is
required, give the value in HEX. Assume all variables are in the first 128 locations of bank 0 (access
bank) unless stated otherwise.
Part I: (82 pts)
a. (6 pts) Write a PIC18 assembly code fragment to implement the following.

         signed int i, k;
         i = k << 1;
b. (8 pts) Write a PIC18 assembly code fragment to implement the following. The code of the if{} body
    has been left intentionally blank; I am only interested in the comparison test. For the if{} body
    code, just use a couple of dummy instructions so I can see the start/begin of the if{} body.

       int i, k;
       if (i == k) {
       ..operation 1...
       ..operation 2....
       }
c. (6 pts) Write a PIC18 assembly code fragment to implement the following:

         signed char j, k;
         while ( k >= j) { operation 1...
         operation 2...
         }
d. ( 8 pts) Implement the doshift subroutine in PIC18 assembly language. Assume the value of ptr has
     been passed in the FSR0 register by the calling subroutine. Do not forget that this is a
     subroutine!!!!!!

// shift function
doshift (unsigned int *ptr){
*ptr = (*ptr) >> 1;
}

                                        loop_top:
                                        movf ___,w
                                        _____ ___,w
                                        b____ L1
                                        b____ loop_body ;if true, loop body
                                        bra loop_exit ;exit
                                        L1
                                        b____ loop_exit ;if false, exit
                                        loop_body:
                                        ...code for operation 1...
                                        ...code for operation 2....
                                        loop_exit
                                        ....rest of code....
e. (9 pts) Implement the main() code below in PIC assembly. You MUST pass the parameters for
    the a_sub() function using the CBLOCK locations for the function a_sub(). You CANNOT just use
    FSR0 for passing the ptr value to a_sub().

     a_sub (char c, long *ptr){
     // some code ...... //
     }
     main() {
     char p;
     long k;
     // some code that initializes
     // p, k ....., don’t worry about this
     //now, call a_sub() function
     a_sub( p, &k);
     }
f. (8 pts) Write a PIC18 assembly code fragment to implement the following. The code of the if{} body
     has been left intentionally blank; I am only interested in the comparison test. For the if{} body
     code, just use a couple of dummy instructions so I can see the start/begin of the if{} body.

       int i, k;
       if ((i == 0) && (k != 0) ) {
       ..operation 1...
       ..operation 2....
       }

CBLOCK 0x060 // parm. block for main
                                          // define p, k space here, fill in blanks
                                          p: ____, k: ______
                                          ENDC

CBLOCK 0x040 // parm. block for a_sub
                                          c: 1, ptr: 2
                                          ENDC
g. (6 pts) Write a PIC18 assembly code fragment to implement the following:

       long p, q;
       p = p - q;
h. (15 pts)

After the execution of ALL of the C code below, fill in the memory location values. Assume
little-endian order for multi-byte values.
Location Contents (MUST BE GIVEN IN HEX!!!!)
0x0150 ___________
0x0151 ___________
0x0152 ___________
0x0153 ___________
0x0154 ___________
0x0155 ___________
0x0156 ___________
0x0157 ___________
0x0158 ___________
0x0159 ___________
0x015A ___________

CBLOCK 0x0150
r:2, t:4, s:1, ptra:2, ptrb:2
ENDC
C code:
unsigned int r;
signed long t; // this is SIGNED!!!!!!!
signed char s; // this is SIGNED!!!!!!!
signed char *ptra;
unsigned int *ptrb;
r = 256; // specified in decimal!! (3 pts)
t = -2; // specified in decimal!! ( 3 pts)
s = -49; // specified in decimal!!!! (3 pts)
ptra = &s; (3 pts)
ptrb = &r;
ptrb++; (3 pts)
i. (16 pts)

For each of the following problems, give the FINAL contents of changed registers or memory locations.
Give me the actual ADDRESSES for a changed memory location (e.g. Location 0x0100 = 0x??).
Assume these memory/register contents at the BEGINNING of EACH problem!!!
Memory:                                  FSR1, 0x0100
0x0100 0x45                              movff PLUSW1, 0x0100
0x0101 0xFF              l. (4 pts)
0x0102 0xBA
0x0103 0x3C                              lfsr FSR1, 0x0103
0x0104 0x64
                                         movff POSTDEC1,0x100
j. (4 pts)
                         m. (4 pts) (careful on this one!!!!!)
               lfsr
                                       lfsr FSR1, 0x0103
               FSR
                                       movff FSR1H,0x100
               1,
               0x0      FSR1 = ____________
               101      Location ________ = _________
               mo
               vff      W register = 0x03
               PR
               EIN      FSR1 = ____________
               C1,      Location ________ = _________
               0x0
                        FSR1 = ____________
               100      Location ________ = _________
k. (4 pts)
                        FSR1 = ____________
               lfsr     Location ________ = _________
Part II: (18 pts) Answer 6 out of the next 8 questions. Cross out the 2 questions that you do not
want graded. Each question is worth 3 pts.
    1. Fill in memory location below, and either a CALL or RCALL instruction (use mnemonic,
         not machine code) such that a value of 0x0104 is pushed as the return address on the
         stack

Mem location instruction
__________ __________
   2. Write an 8-bit addition such that afterwards, both the V and the N flags are set.

____________ + ______________ afterwards, V=1,N=1
   3. Given an N-bit number, what number range can I represent using 2’s complement
       encoding?
4. In the code below, what is the value of i when the loop is exited? Give the value in either
    hex or decimal.

signed char i;
i = 0x80;
while (i <= -32) {
i = i >> 1;
}
5. Give the machine code for the ‘bnn 0x200’ instruction below given the locations shown:

            location
            0x0200 decf 0x02,f
            0x0202 ???
            0x0204 ???
            0x0206 ???
            0x0208 bnn 0x200
6. On the PIC18, can I nest subroutine calls as deep as I want? (i.e. subroutine A calls
    subroutine B calls Subroutine C calles Subroutine D ....etc). If NO, then why? Be
    detailed.
7. Why is the width of the FSR0, FSR1, FSR2 registers different from the width of
    registers like the WREG and general purpose registers in the data memory?
8. Why can’t subroutine calls just be implemented with GOTO statements? What is the
    special feature of CALL/RETURN instructions that is absolutely essential to
    implementing subroutines?

Mais conteúdo relacionado

Mais procurados

C for Java programmers (part 3)
C for Java programmers (part 3)C for Java programmers (part 3)
C for Java programmers (part 3)Dmitry Zinoviev
 
C for Java programmers (part 2)
C for Java programmers (part 2)C for Java programmers (part 2)
C for Java programmers (part 2)Dmitry Zinoviev
 
C for Java programmers (part 1)
C for Java programmers (part 1)C for Java programmers (part 1)
C for Java programmers (part 1)Dmitry Zinoviev
 
Types of pointer in C
Types of pointer in CTypes of pointer in C
Types of pointer in Crgnikate
 
Advanced C programming
Advanced C programmingAdvanced C programming
Advanced C programmingClaus Wu
 
Exercicios Resolvidos Série MIPS Embarcados
Exercicios Resolvidos Série MIPS EmbarcadosExercicios Resolvidos Série MIPS Embarcados
Exercicios Resolvidos Série MIPS EmbarcadosElaine Cecília Gatto
 
detailed information about Pointers in c language
detailed information about Pointers in c languagedetailed information about Pointers in c language
detailed information about Pointers in c languagegourav kottawar
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)Saifur Rahman
 
Paradigmas de Linguagens de Programacao - Aula #5
Paradigmas de Linguagens de Programacao - Aula #5Paradigmas de Linguagens de Programacao - Aula #5
Paradigmas de Linguagens de Programacao - Aula #5Ismar Silveira
 
เขียนโปรแกรมใช้คำสั่ง Printf scanf
เขียนโปรแกรมใช้คำสั่ง  Printf scanfเขียนโปรแกรมใช้คำสั่ง  Printf scanf
เขียนโปรแกรมใช้คำสั่ง Printf scanfธงชัย พาศรี
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppteShikshak
 

Mais procurados (18)

C for Java programmers (part 3)
C for Java programmers (part 3)C for Java programmers (part 3)
C for Java programmers (part 3)
 
C for Java programmers (part 2)
C for Java programmers (part 2)C for Java programmers (part 2)
C for Java programmers (part 2)
 
C for Java programmers (part 1)
C for Java programmers (part 1)C for Java programmers (part 1)
C for Java programmers (part 1)
 
C tutorial
C tutorialC tutorial
C tutorial
 
Cbasic
CbasicCbasic
Cbasic
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Basics of c
Basics of cBasics of c
Basics of c
 
Types of pointer in C
Types of pointer in CTypes of pointer in C
Types of pointer in C
 
Advanced C programming
Advanced C programmingAdvanced C programming
Advanced C programming
 
Exercicios Resolvidos Série MIPS Embarcados
Exercicios Resolvidos Série MIPS EmbarcadosExercicios Resolvidos Série MIPS Embarcados
Exercicios Resolvidos Série MIPS Embarcados
 
detailed information about Pointers in c language
detailed information about Pointers in c languagedetailed information about Pointers in c language
detailed information about Pointers in c language
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
C
CC
C
 
Csdfsadf
CsdfsadfCsdfsadf
Csdfsadf
 
Paradigmas de Linguagens de Programacao - Aula #5
Paradigmas de Linguagens de Programacao - Aula #5Paradigmas de Linguagens de Programacao - Aula #5
Paradigmas de Linguagens de Programacao - Aula #5
 
เขียนโปรแกรมใช้คำสั่ง Printf scanf
เขียนโปรแกรมใช้คำสั่ง  Printf scanfเขียนโปรแกรมใช้คำสั่ง  Printf scanf
เขียนโปรแกรมใช้คำสั่ง Printf scanf
 
Cbasic
CbasicCbasic
Cbasic
 
Lecturer23 pointersin c.ppt
Lecturer23 pointersin c.pptLecturer23 pointersin c.ppt
Lecturer23 pointersin c.ppt
 

Destaque

Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013
Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013
Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013Kyle Hillman
 
Coup De Beast : Chapter 1.2
Coup De Beast : Chapter 1.2Coup De Beast : Chapter 1.2
Coup De Beast : Chapter 1.2iOinkyDoink
 
Coup De Beast - Prologue
Coup De Beast - PrologueCoup De Beast - Prologue
Coup De Beast - PrologueiOinkyDoink
 
Coup De Beast : Chapter 1.1
Coup De Beast : Chapter 1.1Coup De Beast : Chapter 1.1
Coup De Beast : Chapter 1.1iOinkyDoink
 
Presentation For Wiki
Presentation For WikiPresentation For Wiki
Presentation For Wikicarissime
 
MPITechCon Presentation on Future Trends of Meetings
MPITechCon Presentation on Future Trends of MeetingsMPITechCon Presentation on Future Trends of Meetings
MPITechCon Presentation on Future Trends of MeetingsKyle Hillman
 
The Artist at Heart : Chapter 2.1
The Artist at Heart : Chapter 2.1The Artist at Heart : Chapter 2.1
The Artist at Heart : Chapter 2.1iOinkyDoink
 
Synistema e le reti sociali
Synistema e le reti socialiSynistema e le reti sociali
Synistema e le reti socialiEmilioRebora
 
The Artist at Heart : Chapter 1
The Artist at Heart : Chapter 1The Artist at Heart : Chapter 1
The Artist at Heart : Chapter 1iOinkyDoink
 
Project – Embedded
Project – EmbeddedProject – Embedded
Project – Embeddedaryutomo
 
Coup De Beast : Prologue 2
Coup De Beast : Prologue 2Coup De Beast : Prologue 2
Coup De Beast : Prologue 2iOinkyDoink
 
Presentation For Wiki2
Presentation For Wiki2Presentation For Wiki2
Presentation For Wiki2carissime
 
La electricidad en_la_vida_cotidiana
La electricidad en_la_vida_cotidianaLa electricidad en_la_vida_cotidiana
La electricidad en_la_vida_cotidianaAlfonso Pérez
 
【清新出品】中国风系列2~梅为水墨香染成.ppt
【清新出品】中国风系列2~梅为水墨香染成.ppt【清新出品】中国风系列2~梅为水墨香染成.ppt
【清新出品】中国风系列2~梅为水墨香染成.pptjohn cheung
 

Destaque (16)

Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013
Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013
Scott Stratten&rsquo;s Untalk 2013 at MPITechCon Feb 19, 2013
 
Coup De Beast : Chapter 1.2
Coup De Beast : Chapter 1.2Coup De Beast : Chapter 1.2
Coup De Beast : Chapter 1.2
 
Coup De Beast - Prologue
Coup De Beast - PrologueCoup De Beast - Prologue
Coup De Beast - Prologue
 
Coup De Beast : Chapter 1.1
Coup De Beast : Chapter 1.1Coup De Beast : Chapter 1.1
Coup De Beast : Chapter 1.1
 
Presentation For Wiki
Presentation For WikiPresentation For Wiki
Presentation For Wiki
 
MPITechCon Presentation on Future Trends of Meetings
MPITechCon Presentation on Future Trends of MeetingsMPITechCon Presentation on Future Trends of Meetings
MPITechCon Presentation on Future Trends of Meetings
 
The Artist at Heart : Chapter 2.1
The Artist at Heart : Chapter 2.1The Artist at Heart : Chapter 2.1
The Artist at Heart : Chapter 2.1
 
1
11
1
 
Turtle And The Hare
Turtle And The HareTurtle And The Hare
Turtle And The Hare
 
Synistema e le reti sociali
Synistema e le reti socialiSynistema e le reti sociali
Synistema e le reti sociali
 
The Artist at Heart : Chapter 1
The Artist at Heart : Chapter 1The Artist at Heart : Chapter 1
The Artist at Heart : Chapter 1
 
Project – Embedded
Project – EmbeddedProject – Embedded
Project – Embedded
 
Coup De Beast : Prologue 2
Coup De Beast : Prologue 2Coup De Beast : Prologue 2
Coup De Beast : Prologue 2
 
Presentation For Wiki2
Presentation For Wiki2Presentation For Wiki2
Presentation For Wiki2
 
La electricidad en_la_vida_cotidiana
La electricidad en_la_vida_cotidianaLa electricidad en_la_vida_cotidiana
La electricidad en_la_vida_cotidiana
 
【清新出品】中国风系列2~梅为水墨香染成.ppt
【清新出品】中国风系列2~梅为水墨香染成.ppt【清新出品】中国风系列2~梅为水墨香染成.ppt
【清新出品】中国风系列2~梅为水墨香染成.ppt
 

Semelhante a 1

Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5PRADEEP
 
Semtex.c [CVE-2013-2094] - A Linux Privelege Escalation
Semtex.c [CVE-2013-2094] - A Linux Privelege EscalationSemtex.c [CVE-2013-2094] - A Linux Privelege Escalation
Semtex.c [CVE-2013-2094] - A Linux Privelege EscalationKernel TLV
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)MahiboobAliMulla
 
NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016Mikhail Sosonkin
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
Lesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersLesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersPVS-Studio
 
Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comamaranthbeg8
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.combellflower148
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.combellflower169
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.combellflower126
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2PVS-Studio
 
Programming basic computer
Programming basic computerProgramming basic computer
Programming basic computerMartial Kouadio
 
N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)Selomon birhane
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory OverflowsAnkur Tyagi
 

Semelhante a 1 (20)

Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
Semtex.c [CVE-2013-2094] - A Linux Privelege Escalation
Semtex.c [CVE-2013-2094] - A Linux Privelege EscalationSemtex.c [CVE-2013-2094] - A Linux Privelege Escalation
Semtex.c [CVE-2013-2094] - A Linux Privelege Escalation
 
runtimestack
runtimestackruntimestack
runtimestack
 
B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)B sc e 5.2 mp unit 2 soft ware(alp)
B sc e 5.2 mp unit 2 soft ware(alp)
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
 
Lesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersLesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbers
 
Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.com
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.com
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.com
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.com
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
 
Programming basic computer
Programming basic computerProgramming basic computer
Programming basic computer
 
N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)
 
Exploiting Memory Overflows
Exploiting Memory OverflowsExploiting Memory Overflows
Exploiting Memory Overflows
 

Último

Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Último (20)

Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

1

  • 1. ECE 3724/CS 3124 Test #2 – Summer 2005- Reese You may NOT use a calculator. You may use only the provided reference materials. If a binary result is required, give the value in HEX. Assume all variables are in the first 128 locations of bank 0 (access bank) unless stated otherwise. Part I: (82 pts) a. (6 pts) Write a PIC18 assembly code fragment to implement the following. signed int i, k; i = k << 1; b. (8 pts) Write a PIC18 assembly code fragment to implement the following. The code of the if{} body has been left intentionally blank; I am only interested in the comparison test. For the if{} body code, just use a couple of dummy instructions so I can see the start/begin of the if{} body. int i, k; if (i == k) { ..operation 1... ..operation 2.... }
  • 2. c. (6 pts) Write a PIC18 assembly code fragment to implement the following: signed char j, k; while ( k >= j) { operation 1... operation 2... } d. ( 8 pts) Implement the doshift subroutine in PIC18 assembly language. Assume the value of ptr has been passed in the FSR0 register by the calling subroutine. Do not forget that this is a subroutine!!!!!! // shift function doshift (unsigned int *ptr){ *ptr = (*ptr) >> 1; } loop_top: movf ___,w _____ ___,w b____ L1 b____ loop_body ;if true, loop body bra loop_exit ;exit L1 b____ loop_exit ;if false, exit loop_body: ...code for operation 1... ...code for operation 2.... loop_exit ....rest of code....
  • 3. e. (9 pts) Implement the main() code below in PIC assembly. You MUST pass the parameters for the a_sub() function using the CBLOCK locations for the function a_sub(). You CANNOT just use FSR0 for passing the ptr value to a_sub(). a_sub (char c, long *ptr){ // some code ...... // } main() { char p; long k; // some code that initializes // p, k ....., don’t worry about this //now, call a_sub() function a_sub( p, &k); } f. (8 pts) Write a PIC18 assembly code fragment to implement the following. The code of the if{} body has been left intentionally blank; I am only interested in the comparison test. For the if{} body code, just use a couple of dummy instructions so I can see the start/begin of the if{} body. int i, k; if ((i == 0) && (k != 0) ) { ..operation 1... ..operation 2.... } CBLOCK 0x060 // parm. block for main // define p, k space here, fill in blanks p: ____, k: ______ ENDC CBLOCK 0x040 // parm. block for a_sub c: 1, ptr: 2 ENDC
  • 4. g. (6 pts) Write a PIC18 assembly code fragment to implement the following: long p, q; p = p - q;
  • 5. h. (15 pts) After the execution of ALL of the C code below, fill in the memory location values. Assume little-endian order for multi-byte values. Location Contents (MUST BE GIVEN IN HEX!!!!) 0x0150 ___________ 0x0151 ___________ 0x0152 ___________ 0x0153 ___________ 0x0154 ___________ 0x0155 ___________ 0x0156 ___________ 0x0157 ___________ 0x0158 ___________ 0x0159 ___________ 0x015A ___________ CBLOCK 0x0150 r:2, t:4, s:1, ptra:2, ptrb:2 ENDC C code: unsigned int r; signed long t; // this is SIGNED!!!!!!! signed char s; // this is SIGNED!!!!!!! signed char *ptra; unsigned int *ptrb; r = 256; // specified in decimal!! (3 pts) t = -2; // specified in decimal!! ( 3 pts) s = -49; // specified in decimal!!!! (3 pts) ptra = &s; (3 pts) ptrb = &r; ptrb++; (3 pts)
  • 6. i. (16 pts) For each of the following problems, give the FINAL contents of changed registers or memory locations. Give me the actual ADDRESSES for a changed memory location (e.g. Location 0x0100 = 0x??). Assume these memory/register contents at the BEGINNING of EACH problem!!! Memory: FSR1, 0x0100 0x0100 0x45 movff PLUSW1, 0x0100 0x0101 0xFF l. (4 pts) 0x0102 0xBA 0x0103 0x3C lfsr FSR1, 0x0103 0x0104 0x64 movff POSTDEC1,0x100 j. (4 pts) m. (4 pts) (careful on this one!!!!!) lfsr lfsr FSR1, 0x0103 FSR movff FSR1H,0x100 1, 0x0 FSR1 = ____________ 101 Location ________ = _________ mo vff W register = 0x03 PR EIN FSR1 = ____________ C1, Location ________ = _________ 0x0 FSR1 = ____________ 100 Location ________ = _________ k. (4 pts) FSR1 = ____________ lfsr Location ________ = _________
  • 7. Part II: (18 pts) Answer 6 out of the next 8 questions. Cross out the 2 questions that you do not want graded. Each question is worth 3 pts. 1. Fill in memory location below, and either a CALL or RCALL instruction (use mnemonic, not machine code) such that a value of 0x0104 is pushed as the return address on the stack Mem location instruction __________ __________ 2. Write an 8-bit addition such that afterwards, both the V and the N flags are set. ____________ + ______________ afterwards, V=1,N=1 3. Given an N-bit number, what number range can I represent using 2’s complement encoding?
  • 8. 4. In the code below, what is the value of i when the loop is exited? Give the value in either hex or decimal. signed char i; i = 0x80; while (i <= -32) { i = i >> 1; } 5. Give the machine code for the ‘bnn 0x200’ instruction below given the locations shown: location 0x0200 decf 0x02,f 0x0202 ??? 0x0204 ??? 0x0206 ??? 0x0208 bnn 0x200 6. On the PIC18, can I nest subroutine calls as deep as I want? (i.e. subroutine A calls subroutine B calls Subroutine C calles Subroutine D ....etc). If NO, then why? Be detailed.
  • 9. 7. Why is the width of the FSR0, FSR1, FSR2 registers different from the width of registers like the WREG and general purpose registers in the data memory? 8. Why can’t subroutine calls just be implemented with GOTO statements? What is the special feature of CALL/RETURN instructions that is absolutely essential to implementing subroutines?