Advertisement
Lillo_Barilotto22

Call Saints in ASE

Dec 5th, 2023
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 2.12 KB | None | 0 0
  1.                 IF      :LNOT::DEF:NO_CRP
  2.                 AREA    |.ARM.__at_0x02FC|, CODE, READONLY
  3. CRP_Key         DCD     0xFFFFFFFF
  4.                 ENDIF
  5.  
  6.                
  7.                 AREA    WriteData, DATA, READWRITE, align=2
  8. Calories_tot            SPACE 28
  9.  
  10.                 AREA    |.text|, CODE, READONLY, align=3
  11.  
  12.  
  13. ; Reset Handler
  14.  
  15. Reset_Handler   PROC
  16.                 EXPORT  Reset_Handler             [WEAK]                                            
  17.                 LDR     R0, =Reset_Handler
  18.  
  19.                 ; your code here       
  20. count_dd    RN 1
  21. tmp_cal     RN 2
  22. tmp_day     RN 3
  23.  
  24. day_food    RN 4
  25. day_sport   RN 5
  26.  
  27. day_tot     RN 6
  28. cal_addr    RN 7
  29.  
  30. tmp_cal_sports RN 8
  31. day_less    RN 11
  32.                
  33.                 LDRB day_food,  Num_days
  34.                 LDRB day_sport, Num_days_sport
  35.                 LDR day_tot,    =Calories_tot
  36.                
  37.                 MOV count_dd, #0
  38.                 LDR cal_addr,   =Calories_food
  39. loop_food      
  40.                 LDR tmp_day, [cal_addr, #4]!
  41.                 LDR tmp_cal, [cal_addr, #4]!
  42.                
  43.                 ADD tmp_day, tmp_day, #-1
  44.                 STR tmp_cal, [day_tot, tmp_day, LSL #2]
  45.                
  46.                
  47.                 ADD count_dd, count_dd, #1
  48.                 CMP count_dd, day_food
  49.                 BNE loop_food
  50.                
  51.                
  52.                 MOV count_dd, #0
  53.                 LDR cal_addr,   =Calories_sport
  54. loop_sport     
  55.                 LDR tmp_day, [cal_addr, #4]!
  56.                 LDR tmp_cal_sports, [cal_addr, #4]!
  57.                
  58.                 ADD tmp_day, tmp_day, #-1
  59.                
  60.                 LDR tmp_cal, [day_tot, tmp_day, LSL #2]
  61.                 SUB tmp_cal, tmp_cal, tmp_cal_sports
  62.                 STR tmp_cal, [day_tot, tmp_day, LSL #2]
  63.  
  64.                 ADD count_dd, count_dd, #1
  65.                 CMP count_dd, day_sport
  66.                 BNE loop_sport
  67.                
  68.                
  69.                 MOV count_dd, #0
  70.                 MOV day_less, #0
  71. loop_total     
  72.                 LDR tmp_cal, [day_tot, count_dd, LSL #2]
  73.                 CMP tmp_cal, #500
  74.                 ADDLT day_less, day_less, #1
  75.  
  76.                 ADD count_dd, count_dd, #1
  77.                 CMP count_dd, #7
  78.                 BNE loop_total
  79.    
  80.                 BX      R0
  81.                 ENDP
  82.                
  83.                 LTORG
  84.                    
  85. Days            DCB 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
  86.  
  87. Calories_food   DCD 0x06, 1300, 0x03, 1700, 0x02, 1200, 0x04, 1900
  88.                 DCD 0x05, 1110, 0x01, 1670, 0x07, 1000
  89.  
  90. Calories_sport  DCD 0x02, 500, 0x05, 800, 0x06, 400
  91.  
  92. Num_days        DCB 7
  93. Num_days_sport  DCB 3
  94.  
  95.  
  96.  
  97. ; Dummy Exception Handlers (infinite loops which can be modified)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement