Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* DO NOT MODIFY THIS --------------------------------------------*/
  2. .text
  3.  
  4. .global AssemblyProgram
  5.  
  6. AssemblyProgram:
  7. lea      -40(%a7),%a7 /*Backing up data and address registers */
  8. movem.l %d2-%d7/%a2-%a5,(%a7)
  9. /*----------------------------------------------------------------*/
  10.  
  11. /******************************************************************/
  12. /* General Information ********************************************/
  13. /* File Name: Lab1a.s *********************************************/
  14. /* Names of Students: _________________ and ____________________ **/
  15. /* Date: _________________                                       **/
  16. /* General Description:                                          **/
  17. /*                                                               **/
  18. /******************************************************************/
  19.  
  20. /*Write your program here******************************************/
  21.  
  22. movea.l #0x43000000, %A2 /* pointers */
  23. movea.l #0x43100000, %A3
  24.  
  25. /*counter*/
  26. loop:
  27.     move.l (%A2),%D2
  28.     cmpi.l #0x0D, %D2
  29.     beq exit
  30.  
  31.     /*convert*/
  32.     cmp.l #0x30, %D2
  33.     blt error /* < 30*/
  34.     cmp.l #0x39, %D2
  35.     ble digits
  36.  
  37.     cmp.l #0x41, %D2
  38.     blt error /* < 41*/
  39.     cmp.l #0x46, %D2
  40.     ble capitals
  41.  
  42.     cmp.l #0x61, %D2
  43.     blt error /* < 61*/
  44.     cmp.l #0x66, %D2
  45.     ble lowers
  46.  
  47.     bra error
  48.  
  49. capitals:
  50.     move.l (%A2), %D3
  51.     sub.l #0x37, %D3
  52.     move.l %D3, (%A3)
  53.     bra loop_once
  54. lowers:
  55.     move.l (%A2), %D3
  56.     sub.l #0x57, %D3
  57.     move.l %D3, (%A3)
  58.     bra loop_once
  59. digits:
  60.     move.l (%A2), %D3
  61.     sub.l #0x30, %D3
  62.     move.l %D3, (%A3)
  63.     bra loop_once
  64. error:
  65.     move.l #0xFFFFFFFF, (%A3)
  66.     bra loop_once
  67.  
  68. loop_once:
  69.     adda.l #4, %A2
  70.     adda.l #4, %A3
  71.     bra loop
  72.  
  73. exit:
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. /*End of program **************************************************/
  94.  
  95. /* DO NOT MODIFY THIS --------------------------------------------*/
  96. movem.l (%a7),%d2-%d7/%a2-%a5 /*Restore data and address registers */
  97. lea      40(%a7),%a7
  98. rts
  99. /*----------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement