Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ASSIGNMENT 10
- .global hasAOne
- hasAOne:
- cpse r24, r1
- ldi r24, 1
- sbrs r24, 0
- ldi r24, 0
- ret
- .global byteToAscii
- byteToAscii:
- ldi r22, 48
- add r24, r22
- ret
- .global int8ToInt
- int8ToInt:
- ldi r25, 127 //pushing the byte all the way to max possible value
- sub r25, r24 //subtracting input from the max value
- sbc r25, r25 //now subtracting will back fill with zeros (essentially unduing the lbi r25, 127) but replacing with 0's
- ret
- .global addInt8ToInt
- addInt8ToInt:
- call int8ToInt
- add r24, r22 //
- adc r25,r23 //signed value
- ret
- .global add4Int8
- add4Int8:
- call int8ToInt
- mov r00,r22
- mov r22,r24
- mov r23,r25
- mov r24,r00
- call addInt8ToInt
- mov r00,r20
- mov r22,r24
- mov r23,r25
- mov r24,r00
- call addInt8ToInt
- mov r00,r18
- mov r22,r24
- mov r23,r25
- mov r24,r00
- call addInt8ToInt
- ret
- .global average
- average:
- add r24, r22
- ror r24
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement