_compressed_format_data_var.s 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. | Copyright (C) 2002-2003 Sebastian Reichelt.
  2. | Copyright (C) 2003 Kevin Kofler.
  3. | See License.txt for licensing conditions.
  4. .xdef __handle_data_var_AND___compressed_format_data_var,__compressed_format_data_var_relocate,__compressed_format_data_var_cleanup_almost_end,__data_var_name_start,__ld_insert_compressed_data_refs,__ld_insert_data_var_name
  5. | This file requires cleanup code.
  6. .xdef __ref_all___complex_main
  7. | This file requires the jump table in %a5.
  8. .xdef __ref_all___optimize_rom_calls
  9. | SymFindPtr seems to require the in-use bit.
  10. .xdef __ref_all___set_file_in_use_bit
  11. .section _st95
  12. __compressed_format_data_var:
  13. | Save registers that may be destroyed.
  14. movem.l %d3-%d5,-(%sp)
  15. | Push flags for SymFindPtr.
  16. clr.l -(%sp)
  17. | Push pointer to terminating 0 byte of variable name.
  18. pea.l __ld_data_var_name_end(%pc)
  19. | Call SymFindPtr.
  20. move.l (%a5,0x283*4),%a0 /* SymFindPtr */
  21. jsr (%a0)
  22. | Test the result and put it into %d5.
  23. move.l %a0,%d5
  24. beq __compressed_format_data_var_not_found
  25. | Put the handle into %d4 and on the stack.
  26. move.w 12(%a0),%d4
  27. move.w %d4,(%sp)
  28. | Call HeapDeref on the file handle.
  29. move.l (%a5,0x96*4),%a0 /* HeapDeref */
  30. jsr (%a0)
  31. | Compare the size of the variable with the actual
  32. | data size. Add 1 for the tag byte and 5 for the
  33. | extension.
  34. cmp.w #__ld_data_size+5+1,(%a0)
  35. bne __compressed_format_data_var_corrupt
  36. | Code is inserted here to:
  37. | * put the address to use into %d3
  38. | * if the file is copied, clear %d4
  39. .section _st99
  40. | Relocate the program.
  41. __compressed_format_data_var_relocate:
  42. lea.l __ld_insert_compressed_data_refs(%pc),%a0
  43. lea.l __ld_compressed_data_refs_ref-4(%pc),%a1
  44. moveq.l #0,%d1
  45. clr.w %d2
  46. __compressed_format_data_refs_loop_1:
  47. bsr __decode_compressed_offset
  48. bcs.s __compressed_format_data_refs_done_1
  49. add.l %d3,0(%a1,%d1.l)
  50. bra.s __compressed_format_data_refs_loop_1
  51. __compressed_format_data_refs_done_1:
  52. .section _st1061
  53. __compressed_format_data_var_cleanup:
  54. | Unrelocate the program.
  55. lea.l __ld_insert_compressed_data_refs(%pc),%a0
  56. lea.l __ld_compressed_data_refs_ref-4(%pc),%a1
  57. moveq.l #0,%d1
  58. clr.w %d2
  59. __compressed_format_data_refs_loop_2:
  60. bsr __decode_compressed_offset
  61. bcs.s __compressed_format_data_refs_done_2
  62. sub.l %d3,0(%a1,%d1.l)
  63. bra.s __compressed_format_data_refs_loop_2
  64. __compressed_format_data_refs_done_2:
  65. .section _st1065
  66. __compressed_format_data_var_cleanup_almost_end:
  67. | Clean up the stack and registers.
  68. movem.l (%sp)+,%d1-%d5
  69. __compressed_format_data_var_cleanup_end:
  70. .section _st10000, "d"
  71. __ld_insert_compressed_data_refs:
  72. | See _compressed_format_relocs.s for the format of the data reloc table.
  73. .section _st10001, "d"
  74. __data_var_name_start:
  75. .byte 0
  76. __ld_insert_data_var_name: