100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

Lab 8 Carleton University SYSC 3006

Beoordeling
-
Verkocht
1
Pagina's
5
Cijfer
A+
Geüpload op
24-03-2023
Geschreven in
2022/2023

Fragment 1: B Main ExampleString ; start of packed string DCD #0x ; ‘S’=0x53 ‘Y’=0x59 ‘S’=0x53 ‘C’=0x43 DCD #0x DCD #0x ; 1st 00 is the null-terminator, 2nd 00 is just padding to fill the word Main ; R0 = address of the packed string LEA R0, [ ExampleString ] ; R1 = index of the character in the packed string ... test with several values MOV R1, #5 ; the following code puts the indexed character into the least significant byte of R0, ; and clears the remainder of R0 ; ---- start of block to copy into Fragment 2 ---- ; R2 = offset to word containing indexed character LSR R2, R1, #2 ; divide index by 4 ; R3 = word containing indexed character LDR R3, [ R0, R2 ] ; R1 = digit offset of indexed character in R3 (digit offset = 0, 1, 2 or 3) AND R1, R1, #3 ; need to shift character from current position to least significant byte ; need to shift 8 bits for each digit position ; R1 = number of digit shifts needed MOV R4, #3 SUB R1, R4, R1 BEQ DoneShiftLoop ; if 0 shifts needed, then done shifting ; shift character into least significant byte ShiftLoop

Meer zien Lees minder
Instelling
Vak









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Vak

Documentinformatie

Geüpload op
24 maart 2023
Aantal pagina's
5
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

Fragment 1:


B Main

ExampleString ; start of packed string

DCD #0x53595343 ; ‘S’=0x53 ‘Y’=0x59 ‘S’=0x53 ‘C’=0x43

DCD #0x20333030

DCD #0x36210000 ; 1st 00 is the null-terminator, 2nd 00 is just padding to fill the word

Main

; R0 = address of the packed string




m
er as
LEA R0, [ ExampleString ]




co
eH w
; R1 = index of the character in the packed string ... test with several values




o.
MOV R1, #5

rs e
; the following code puts the indexed character into the least significant byte of R0,
ou urc
; and clears the remainder of R0
o

; ---- start of block to copy into Fragment 2 ----
aC s


; R2 = offset to word containing indexed character
vi y re



LSR R2, R1, #2 ; divide index by 4

; R3 = word containing indexed character
ed d




LDR R3, [ R0, R2 ]
ar stu




; R1 = digit offset of indexed character in R3 (digit offset = 0, 1, 2 or 3)

AND R1, R1, #3
sh is




; need to shift character from current position to least significant byte
Th




; need to shift 8 bits for each digit position

; R1 = number of digit shifts needed

MOV R4, #3

SUB R1, R4, R1

BEQ DoneShiftLoop ; if 0 shifts needed, then done shifting

; shift character into least significant byte

ShiftLoop



This study source was downloaded by 100000850872992 from CourseHero.com on 03-24-2023 01:11:09 GMT -05:00
https://www.coursehero.com/file/14306242/lab8syscpdf/


https://www.coursehero.com/file/24395275/Lab-8pdf/

, LSR R3, R3, #8

SUB R1, R1, #1

BNE ShiftLoop

DoneShiftLoop

; R3 now has indexed character in least significant byte,

; but may have additional characters in higher bits

; R0 = indexed character with higher bits cleared

AND R0, R3, #0xFF

; ---- end of block to copy into Fragment 2 ----




m
er as
DCD #0xFFFFFFFF ; stop




co
=============================================




eH w
o.
Fragment 2:
rs e
ou urc
MOV R13, #0x800 ; initialize stack pointer

B Main
o

ExampleString ; start of packed string
aC s
vi y re


DCD #0x53595343 ; ‘S’=0x53 ‘Y’=0x59 ‘S’=0x53 ‘C’=0x43

DCD #0x20333030
ed d




DCD #0x36210000 ; 1st 00 is the null-terminator, 2nd 00 is just padding to fill the word
ar stu




; char CharAt ( &( PackedString[] ), uint charIndex )
sh is




; accepts R0 = address of PackedString[] (by reference),
Th




; R1 = charIndex (by value)

; returns R0 = PackedString[ charIndex ]


CharAt

PUSH {R1,R2,R3,R4,R14} ; save registers (SYSC 3006 Register Preservation convention)


; ---- start of block copied from Fragment 1 ----




This study source was downloaded by 100000850872992 from CourseHero.com on 03-24-2023 01:11:09 GMT -05:00
https://www.coursehero.com/file/14306242/lab8syscpdf/


https://www.coursehero.com/file/24395275/Lab-8pdf/

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ExamsConnoisseur Self
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
566
Lid sinds
2 jaar
Aantal volgers
343
Documenten
1497
Laatst verkocht
1 week geleden

4,3

67 beoordelingen

5
40
4
11
3
12
2
1
1
3

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen