TUT3 Microprocessors

김선우·2022년 9월 12일
0

Microprocessors

목록 보기
5/7
  1. Show Two different ways to clear all the bits in register r12 to zero.
    (You may not use any registers other than r12)

MOV r12, #0
SUB r12, r12, r12
AND r12, r12, #0
EOR r12, r12, r12

잠깐만! 여기서 EOR 명령어에 대해서 이해하고 넘어가자.
EOR 은 exclusive or 이다.

따라서, A EOR A =0이다.
3. What is another way of writing the following
line of code?
MOV PC, LR

PC 는 R15이고,
LR 은 R14이다. 따라서, 답은
MOV r15, r14

4.Use an assembler directive to assign register r6 to the name bouncer.
RN directives 를 이용해서 r6을 bouncer로 naming 한다.
정답은,
bouncer RN 6

5.Create a mask (bit pattern) in memory using the DCD directive and the SHL and OR operators for the following cases. ->DCD는 4bytes 따라서, 1 word
a) The upper two bytes of the word are 0xFFEE and the least
significant bit is set.
1111 1111 1110 1110 0000 0000 0000 0001

Hexadecimal 로 바꾸어 보자.
0xFFEE0001

Answer:
MaskA DCD (0xFFEE:SHL:16):OR:1

b)Bits 17 and 16 are set, and the least significant byte of the word is 0x8F.

Bits 17 and 16 are set의 의미는,
17번 째 bit와 16번째 bit 가 1 로 지정되었다는 소리이다.
0000 0000 0000 0011 이 MSB 이고,
0x 8F가 LSB이므로,
모두 다 hexadecimal로 바꾸면
0x 0003008F가 나와야 한다.
Answer:
MaskB DCD (3:SHL:16):OR:0x8F

  1. What instruction puts the ASCII representation of the character ‘R’ in register r11?

다음을 하기 위해서는, assembly language의 ASCII 코드를 참고해야한다.

Answer:
MOV r11, #’R’
or
MOV r11, #0x52
; same but less easily understood

  1. Give the directive to reserve a block of zeroed memory, holding 40 words and labeled coeffs.


위의 syntax를 그대로 사용해서 block of zeroed memory가 40words를 holding하도록 하면 된다.
Answer:
coeffs SPACE 160 ; 40 words is 160 bytes!

1words가 4bytes 이므로, 40 words는 160 bytes.

profile
배고파...

0개의 댓글