Final review Lesson 7 macros and intro to subroutines

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

How to start a macro?

.macro

2
New cards

How to end a macro?

.endm

3
New cards

where are macros in code?

above .data section

4
New cards

How to name macros?

.macro thisISMyMacroName

5
New cards

How to pass registewrs and varibles to macros?

.macro thisISMyMacroName src_reg1, canBeAnything, src_reg2

6
New cards

How to acces the varible you passed into the macro?

EX: CMP \src_reg1,

\canBeAnything

7
New cards

why use macros?

Increase reusability

No need to use branching

Updating registers

Having modular codes

8
New cards

How to call a subroutine?

BL subroutineName

translation:

LR=PC+4

PC=label

9
New cards

How to exit a subroutine?

BX LR

translation:

PC=LR

10
New cards

What are registers r0-r3 used for?

arguments and return value, these are where you want your final answers when exiting a subroutine. also the registers you want to use when passing in information to a subroutine.

11
New cards

What are registers r4-r11 used for?

General purpose registers, you can use for anything in a subroutine but its proper etiquette to push and pop these when exiting a subroutine.

12
New cards

what is register r12 used for?

(IP) intra procedure call register

13
New cards

what is register r13 used for?

(SP) Stack pointer

14
New cards

what is register r14 used for?

(LR) link register, like bread crumbs leaving a trail in your code to go back to

15
New cards

what is register r15 used for?

(PC) program counter

16
New cards

How many bits can each r0-r3 register hold when passing in arguments?

each 32-bits, combined 128-bits