recitation_week_8 - In the lecture I will discuss how to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
In the lecture I will discuss how to write the basic main loop for an embedded controller. Based on the TV.asm given in the lecture downloadable from the slides, write a process_input function that responds to `m’, `h’, `q’ (ascii code 109, 104, 112, respectively). The TV is initially not in the ``menu state.’’ When the user presses `m’ while the TV is not in the menu state, the TV should show as very simple menu, and enters the menu state (recall your own TV for reference): “`h' to print hello, `q' to quit.” In the menu state, if the user presses `h’, print out “Hello!” In the menu state, if the user presses `q’, print out “quit.” and quits the menu state. If not in the menu state, the TV does not respond to `h’ and `q’. The following is my code: .data menuLevel: .word 0 msg_tvworking: .asciiz "tv is working\n" msg_menu: .asciiz "`h' to print hello, `q' to quit.\n" msg_hello: .asciiz "hello!\n" msg_quit: .asciiz "quit.\n" .text .globl main main: addi $s0, $0, 300 #s0: used in couting 10ms mainloop: # 1. read keyboard input, and process it
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

recitation_week_8 - In the lecture I will discuss how to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online