Advertisement
Bond697

isSourceFilename

Feb 15th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 5.00 KB | None | 0 0
  1. RAM_ARM9:0203A32C ; =============== S U B R O U T I N E =======================================
  2. RAM_ARM9:0203A32C
  3. RAM_ARM9:0203A32C
  4. RAM_ARM9:0203A32C ; bool __fastcall isSourceFilename(char *pCopyArray, char *pSrcNameArray)
  5. RAM_ARM9:0203A32C isSourceFilename                        ; CODE XREF: verifyBlockGroup+1Ap
  6. RAM_ARM9:0203A32C                                         ; getFreeSpaceExpHeap+1Cp ...
  7. RAM_ARM9:0203A32C MOVS    R3, #0                          ; int i = 0
  8. RAM_ARM9:0203A32E
  9. RAM_ARM9:0203A32E copy_sourcefile_local_array             ; CODE XREF: isSourceFilename+Ej
  10. RAM_ARM9:0203A32E LDRSB   R2, [R1,R3]                     ; load ascii byte
  11. RAM_ARM9:0203A330 CMP     R2, #0                          ; terminator?
  12. RAM_ARM9:0203A332 BEQ     store_terminator
  13. RAM_ARM9:0203A334 STRB    R2, [R0,R3]                     ; store non-terminator byte
  14. RAM_ARM9:0203A336 ADDS    R3, R3, #1                      ; ++i
  15. RAM_ARM9:0203A338 CMP     R3, #0x12                       ; max srcfile name byte count for memblk header
  16. RAM_ARM9:0203A33A BLT     copy_sourcefile_local_array
  17. RAM_ARM9:0203A33C
  18. RAM_ARM9:0203A33C store_terminator                        ; CODE XREF: isSourceFilename+6j
  19. RAM_ARM9:0203A33C MOVS    R2, #0
  20. RAM_ARM9:0203A33E STRB    R2, [R0,R3]                     ; store terminator
  21. RAM_ARM9:0203A340 CMP     R3, #0
  22. RAM_ARM9:0203A342 BNE     loc_203A348                     ; if r3 is 0, there is no source file name.  return false.
  23. RAM_ARM9:0203A344 MOVS    R0, R2
  24. RAM_ARM9:0203A346 BX      LR
  25. RAM_ARM9:0203A348 ; ---------------------------------------------------------------------------
  26. RAM_ARM9:0203A348
  27. RAM_ARM9:0203A348 loc_203A348                             ; CODE XREF: isSourceFilename+16j
  28. RAM_ARM9:0203A348 BLE     return_if_18bytes_are_filled    ; this happens if r3 = 0, thus there's no sourcefile
  29. RAM_ARM9:0203A34A
  30. RAM_ARM9:0203A34A is_valid_char                           ; CODE XREF: isSourceFilename+30j
  31. RAM_ARM9:0203A34A LDRB    R1, [R0,R2]
  32. RAM_ARM9:0203A34C CMP     R1, #0x20 ; ' '                 ; below 0x20 is formatting stuff
  33. RAM_ARM9:0203A34E BCC     false_if_invalid_char
  34. RAM_ARM9:0203A350 CMP     R1, #0x7E ; '~'                 ; above 7e is not a character
  35. RAM_ARM9:0203A352 BLS     inc_if_srcname_loop_lessthan_invalid_loop
  36. RAM_ARM9:0203A354
  37. RAM_ARM9:0203A354 false_if_invalid_char                   ; CODE XREF: isSourceFilename+22j
  38. RAM_ARM9:0203A354 MOVS    R0, #0                          ; if it's below 0x20 or above 7e, return false- inappropriate character
  39. RAM_ARM9:0203A356 BX      LR
  40. RAM_ARM9:0203A358 ; ---------------------------------------------------------------------------
  41. RAM_ARM9:0203A358
  42. RAM_ARM9:0203A358 inc_if_srcname_loop_lessthan_invalid_loop
  43. RAM_ARM9:0203A358                                         ; CODE XREF: isSourceFilename+26j
  44. RAM_ARM9:0203A358 ADDS    R2, R2, #1                      ; ++i
  45. RAM_ARM9:0203A35A CMP     R2, R3                          ; is the invalid char check done with the entire array
  46. RAM_ARM9:0203A35C BLT     is_valid_char
  47. RAM_ARM9:0203A35E
  48. RAM_ARM9:0203A35E return_if_18bytes_are_filled            ; CODE XREF: isSourceFilename:loc_203A348j
  49. RAM_ARM9:0203A35E CMP     R3, #0x12                       ; 18 bytes are the entirety of allocated header room for source file names.
  50. RAM_ARM9:0203A360 BGE     loc_203A37C                     ; return true if all 18 bytes are full
  51. RAM_ARM9:0203A362 MOVS    R2, #0                          ; i = 0
  52. RAM_ARM9:0203A364 CMP     R3, #0                          ; does the sourcefile array have length?
  53. RAM_ARM9:0203A366 BLE     loc_203A374                     ; if r3 is 0, there's no sourcefile name.
  54. RAM_ARM9:0203A368
  55. RAM_ARM9:0203A368 check_for_period                        ; CODE XREF: isSourceFilename+46j
  56. RAM_ARM9:0203A368 LDRB    R1, [R0,R2]
  57. RAM_ARM9:0203A36A CMP     R1, #0x2E ; '.'                 ; 2e is a period
  58. RAM_ARM9:0203A36C BEQ     loc_203A374
  59. RAM_ARM9:0203A36E ADDS    R2, R2, #1
  60. RAM_ARM9:0203A370 CMP     R2, R3
  61. RAM_ARM9:0203A372 BLT     check_for_period
  62. RAM_ARM9:0203A374
  63. RAM_ARM9:0203A374 loc_203A374                             ; CODE XREF: isSourceFilename+3Aj
  64. RAM_ARM9:0203A374                                         ; isSourceFilename+40j
  65. RAM_ARM9:0203A374 CMP     R2, R3                          ; if r2 = r3, then no period was found and it's not a sourcefile name "name.c"
  66. RAM_ARM9:0203A376 BNE     loc_203A37C
  67. RAM_ARM9:0203A378 MOVS    R0, #0                          ; return false if it's not a source file
  68. RAM_ARM9:0203A37A BX      LR
  69. RAM_ARM9:0203A37C ; ---------------------------------------------------------------------------
  70. RAM_ARM9:0203A37C
  71. RAM_ARM9:0203A37C loc_203A37C                             ; CODE XREF: isSourceFilename+34j
  72. RAM_ARM9:0203A37C                                         ; isSourceFilename+4Aj
  73. RAM_ARM9:0203A37C MOVS    R0, #1                          ; return true if it is a source file "name.c" or if the text takes up all 18 bytes of the char array
  74. RAM_ARM9:0203A37E BX      LR
  75. RAM_ARM9:0203A37E ; End of function isSourceFilename
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement