Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  herhaling ARM assembler instructies  geindexeerde.

Similar presentations


Presentation on theme: "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  herhaling ARM assembler instructies  geindexeerde."— Presentation transcript:

1 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  herhaling ARM assembler instructies  geindexeerde adressering  conditionele instructies en de flags  subroutines, gebruik van de stack  gebruik van het bordje: LEDs en LCD  oefening

2 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 2 LDR R0, =value MOV R0, R1 LDR R0, [ R1 ] STR R0, [ R1 ] ADD R0, R1, R2 ADD R0, R1, #15 B label BL label

3 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 3 LDR R0, =value R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

4 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 4 MOV R0, R1 R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

5 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 5 LDR R0, [ R1 ] R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

6 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 6 STR R0, [ R1 ] R0 R1FFFF FFFB R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

7 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 7 ADD R3, R1, R2 R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen +

8 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 8 B = branch R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

9 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 9 BL = branch and link R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R15 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

10 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 10 Variaties op LDR R0, [R1]: LDR R0, [ R1 ], #12 LDR R0, [ R1, #12 ] LDR R0, [ R1, #12 ] !

11 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 11 LDR R0, [ R1 ] R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R14 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen

12 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 12 Addressing mode: Post-indexed Example: STR r0, [r1], #12 To auto-’increment’ the base register to location 0x1f4 instead use: – STR r0, [r1], #-12 r1 0x200 Original Base Register Memory 0x5 0x200 r0 0x5 Source Register for STR Offset 12 0x20c r1 0x20c Updated Base Register

13 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 13 LDR R0, [ R1 ], #4 R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R14 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

14 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 14 Addressing mode: Pre-indexed Example: STR r0, [r1,#12] To store to location 0x1f4 instead use: STR r0, [r1,#-12] To auto-increment base pointer to 0x20c use: STR r0, [r1, #12]! If r2 contains 3, access 0x20c by multiplying this by 4: –STR r0, [r1, r2, LSL #2] r1 0x200 Base Register Memory 0x5 0x200 r0 0x5 Source Register for STR Offset 12 0x20c

15 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 15 LDR R0, [ R1, #4 ] R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R14 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

16 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 16 LDR R0, [ R1, #4 ] ! R0 R1000 0004 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 = SP R14 = LR R14 = PC registers 0000 0000 0001 0000 0002 0000 0003 0000 0004 0000 0005 0000 0006 0000 0007 0000 0008 0000 0009 ……. FFFF FFFB FFFF FFFC FFFF FFFD FFFF FFFE FFFF geheugen + 0000 0008

17 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 17  Alle instructies kunnen conditioneel zijn  Load en store kunnen ook per half-word of byte  Bij add / sub kan opt

18 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 18  LCD aansturen  een scrollende text laten zien

19 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 19 LCD file hello.zip uitpakken naar lege directory (geen spaties in de pathname…) run ‘as is’ geeft “Hello world” op het display

20 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 20 main LCD library delay library Chip startup code

21 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 21 LCD Library Subroutines: LCD_INIT eenmalig aanroepen LCD_CLEAR maakt het display leeg, cursor naar eerste positie LCD_PUTCHAR print het char in R0, schuift nar volgende positie

22 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 22 Text vastleggen hello:.asciz “Hello!”.align ldr r1, =hello

23 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 23.global main tekst:.asciz "Hello world!".align main: @ save registers stmfdsp!, { lr } @ gebruik de LCD blLCD_INIT blLCD_CLEAR ldrr1, =tekst loop: ldrbr0,[ r1 ] addr1, r1, #1 cmpr0, #0 beqklaar blLCD_PUTCHAR bloop klaar: @ return ldmfdsp!, { pc }

24 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 24 blLCD_INIT blLCD_CLEAR ldrr1, =tekst loop: ldrbr0,[ r1 ] addr1, r1, #1 cmpr0, #0 beqklaar blLCD_PUTCHAR bloop klaar:

25 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 25 Doen Test “Hello world” Laat een andere text zien Maak een subroutine die een asciz string (R0 = pointer) laat zien op het LCD display (test deze subroutine) Laat een scrollende text zien op het LCD display

26 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 26 Scroll een text ‘over’ het display, bv: Hello brave new ello brave new w llo brave new wo lo brave new wor o brave new worl brave new world brave new world. En dan weer overnieuw.

27 Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 27 Opdrachten: 1. Maak zelf het ‘loop’ optel programma af en test het op het bordje. 2. maak een programma dat 2 getallen vermenigvuldigt (door herhaald optellen). Het is wellicht handig eerst in C te schrijven hoe je dit zou doen.


Download ppt "Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  herhaling ARM assembler instructies  geindexeerde."

Similar presentations


Ads by Google