Answered step by step
Verified Expert Solution
Question
1 Approved Answer
the first 3 pics are thw cose: can you please help with the following questions: the first 3 are the codes, were suppose to get
the first 3 pics are thw cose:
can you please help with the following questions:
the first 3 are the codes, were suppose to get the answers form the code. the questions are on the last page.
: export symbols XDEF Entry, _Startup : export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as appl : Include derivative-specific definitions INCLUDE 'derivative.inc' : Equates Section ROMStart EQU $2000 : absolute address to place my code : Variable/Data Section ORG RAMStart ; loc $1000 (RAMEnd = S3FFF) : Insert here your data definitions here PROMPT dc.b SOA, SOD : CR LF dc.b "Type a character: YNM" do. b 0 using zero terminated strings YESSTRG de.b - YES - dc.b 0 NOSTRG dc.b . NO . dc.b 0 MAYBESTRG dc.b - MAYBE - dc.b 0 INCLUDE 'utilities, inc' INCLUDE 'LCD. inc' : Code Section ORG ROMStart : loc $2000 Entry: _Startup: remap the RAM &: EEPROM here. See EB386.pdf ifdef _HCS12_SERIALMON : set registers at $0000 CLR $11 : INITRG: $0 inset ran to end at $3FFF LDAB #$39 STAB $10 INITRM= $39 : Code Section ORG ROMStart ; loc $2000 Entry: _Startup: ; remap the RAM & EEPROM here. See EB386.pdf ifdef _HCS12_SERILMON ; set registers at $0000 CLR $11 INITRG= $0 : set ram to end at $3FFF LDAB #$39 STAB $10 | ; INITRM= $39 : set eeprom to end at SOFFF LDAA #$9 STAA $12 INITEE- $9 JSR PLL_init ; initialize PLL endif Insert your code here LDS #ROMStart ; load stack pointer JSR TermInit ; needed for Simulator only JSR led_enable ; enable PORTB for LED's LOOP LDD #PROMPT pass the adr of the string JSR printf ; print the string JSR getchar call getchar function -result is: character in B JSR ClearLeds clear LED's when starting over YCASE CMPB #'Y' ; is it a Y ? BNE NCASE jump ahead if not JSR YFCN ; else do corresponding function for Y NCASE CMPB 'N' is it a N ? BNE MCASE : jump ahead if not JSR NFCN; else do corresponding function for N MCASE CMPB # M' is it a M ? BNE NEXT jump ahead if not JSR MFCN ; else do corresponding function for M NEXT JMP LOOP ; loop for more input : Note: main program is an endless loop and subroutines follow : (Must press reset to quit.) : FUNCTIONS CALLED BY MAIN LOOP YFCN PSHD LDD YESSTRG ; pass the address of the string JSR printf ; print the string JSR getchar call getchar function -result is: character in B JSR ClearLeds clear LED's when starting over YCASE CMPB #'Y' ; is it a Y? BNE NCASE : jump ahead if not JSR YFCN ; else do corresponding function for Y NCASE CMPB #N' is it a N? BNE MCASE : jump ahead if not JSR NFCN ; else do corresponding function for N MCASE CMPB #M' is it a M? BNE NEXT : jump ahead if not JSR MFCN ; else do corresponding function form NEXT JMP LOOP ; loop for more input Note: main program is an endless loop and subroutines follow : (Must press reset to quit.) : FUNCTIONS CALLED BY MAIN LOOP YFCN PSHD LDD JSR BSET PULD RTS #YESSTRG printf PORTB. $01 ; pass the address of the string print the string : light LEDO NFCN PSHD LDD JSR BSET PULD RTS #NOSTRG printf PORTB. $02 : pass adr. of string : call printf : light LED1 MFCN PSHD LDD JSR BSET PULD RTS #MAYBESTRG printf PORTB. $04 ; pass adr. of string print the string ; light LED2 ClearLeds CLR PORTB clear all LED's * WW**** ** ************** Interrupt Vectors ORG Vreset DC.W Entry ; Reset Vector Deco Eneset 1. Using Parsing LoopASM CodeWarrior project, write the assembly code and machine code in tabular form: Assembly Code Machine Code 2. Find the address of all the subroutines in Parsing LoopASM: Subroutine Address 3. Use CodeWarrior, go to memory section and verify your machine code for a) machine code for question 1 b) addresses of question 2 4. Subroutine 1: (Hint: use a break-point at the start of the subroutine) a) What are the contents of stack when JSR YFCN is executed before cpu executes the first instruction of YFCN Stack Address Contents b) What is SP in part (a) c) What are the contents of stack and PC after RTS instruction in YFCN is executed : export symbols XDEF Entry, _Startup : export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as appl : Include derivative-specific definitions INCLUDE 'derivative.inc' : Equates Section ROMStart EQU $2000 : absolute address to place my code : Variable/Data Section ORG RAMStart ; loc $1000 (RAMEnd = S3FFF) : Insert here your data definitions here PROMPT dc.b SOA, SOD : CR LF dc.b "Type a character: YNM" do. b 0 using zero terminated strings YESSTRG de.b - YES - dc.b 0 NOSTRG dc.b . NO . dc.b 0 MAYBESTRG dc.b - MAYBE - dc.b 0 INCLUDE 'utilities, inc' INCLUDE 'LCD. inc' : Code Section ORG ROMStart : loc $2000 Entry: _Startup: remap the RAM &: EEPROM here. See EB386.pdf ifdef _HCS12_SERIALMON : set registers at $0000 CLR $11 : INITRG: $0 inset ran to end at $3FFF LDAB #$39 STAB $10 INITRM= $39 : Code Section ORG ROMStart ; loc $2000 Entry: _Startup: ; remap the RAM & EEPROM here. See EB386.pdf ifdef _HCS12_SERILMON ; set registers at $0000 CLR $11 INITRG= $0 : set ram to end at $3FFF LDAB #$39 STAB $10 | ; INITRM= $39 : set eeprom to end at SOFFF LDAA #$9 STAA $12 INITEE- $9 JSR PLL_init ; initialize PLL endif Insert your code here LDS #ROMStart ; load stack pointer JSR TermInit ; needed for Simulator only JSR led_enable ; enable PORTB for LED's LOOP LDD #PROMPT pass the adr of the string JSR printf ; print the string JSR getchar call getchar function -result is: character in B JSR ClearLeds clear LED's when starting over YCASE CMPB #'Y' ; is it a Y ? BNE NCASE jump ahead if not JSR YFCN ; else do corresponding function for Y NCASE CMPB 'N' is it a N ? BNE MCASE : jump ahead if not JSR NFCN; else do corresponding function for N MCASE CMPB # M' is it a M ? BNE NEXT jump ahead if not JSR MFCN ; else do corresponding function for M NEXT JMP LOOP ; loop for more input : Note: main program is an endless loop and subroutines follow : (Must press reset to quit.) : FUNCTIONS CALLED BY MAIN LOOP YFCN PSHD LDD YESSTRG ; pass the address of the string JSR printf ; print the string JSR getchar call getchar function -result is: character in B JSR ClearLeds clear LED's when starting over YCASE CMPB #'Y' ; is it a Y? BNE NCASE : jump ahead if not JSR YFCN ; else do corresponding function for Y NCASE CMPB #N' is it a N? BNE MCASE : jump ahead if not JSR NFCN ; else do corresponding function for N MCASE CMPB #M' is it a M? BNE NEXT : jump ahead if not JSR MFCN ; else do corresponding function form NEXT JMP LOOP ; loop for more input Note: main program is an endless loop and subroutines follow : (Must press reset to quit.) : FUNCTIONS CALLED BY MAIN LOOP YFCN PSHD LDD JSR BSET PULD RTS #YESSTRG printf PORTB. $01 ; pass the address of the string print the string : light LEDO NFCN PSHD LDD JSR BSET PULD RTS #NOSTRG printf PORTB. $02 : pass adr. of string : call printf : light LED1 MFCN PSHD LDD JSR BSET PULD RTS #MAYBESTRG printf PORTB. $04 ; pass adr. of string print the string ; light LED2 ClearLeds CLR PORTB clear all LED's * WW**** ** ************** Interrupt Vectors ORG Vreset DC.W Entry ; Reset Vector Deco Eneset 1. Using Parsing LoopASM CodeWarrior project, write the assembly code and machine code in tabular form: Assembly Code Machine Code 2. Find the address of all the subroutines in Parsing LoopASM: Subroutine Address 3. Use CodeWarrior, go to memory section and verify your machine code for a) machine code for question 1 b) addresses of question 2 4. Subroutine 1: (Hint: use a break-point at the start of the subroutine) a) What are the contents of stack when JSR YFCN is executed before cpu executes the first instruction of YFCN Stack Address Contents b) What is SP in part (a) c) What are the contents of stack and PC after RTS instruction in YFCN is executed Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started