enter_ghost_space_2.s 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. .xdef __enter_ghost_space
  2. .section _st10502
  3. bsr.w .L__ghost_space_0
  4. .L__ghost_space_0:
  5. move.l (%sp)+,%d0
  6. cmpi.l #0x40000,%d0
  7. bcc .L__ghost_space_2
  8. movea.l 0xC8,%a0
  9. cmpi.l #1000,(%a0,-4)
  10. bcs .L__ghost_space_2
  11. movem.l %a2-%a6/%d3-%d7,-(%sp)
  12. lea (%sp,-20),%sp
  13. move.l #0x3E000,%a3
  14. move.l %a0,%d0
  15. andi.l #0xE00000,%d0
  16. addi.l #0x20000,%d0
  17. move.l %d0,(%sp,12)
  18. move.l %d0,(%sp,16)
  19. trap #0xC
  20. move.w #0x2700,%sr
  21. move.l #0xF,%d3
  22. pea .L__ghost_space_1(%pc)
  23. bset.b #2,(%sp,1)
  24. clr.w -(%sp)
  25. move.l 0xAC,%a0
  26. jmp (%a0)
  27. .L__ghost_space_1:
  28. lea (%sp,20),%sp
  29. movem.l (%sp)+,%a2-%a6/%d3-%d7
  30. | The following code was compiled from:
  31. |
  32. | /* If we are on AMS 2, we have to set the "last executed program" to somewhere
  33. | in the last 4 KB of RAM, or else APD may crash under certain circumstances.
  34. | The code below looks for the "last executed program" variable. That variable
  35. | is cleared during initialization, immediately after the stack fence is set up.
  36. | So we look for the value of the stack fence (0xDEADDEAD) in the initialization
  37. | code and add 8 to get the wanted short pointer, which must then be
  38. | sign-extended to an actual pointer. (The sign extension is implicit in the
  39. | generated code, as it should be.) */
  40. | if (!(AMS_1xx||*(short*)0x32==('R'<<8)+'O')) {
  41. | /* rb and q are factored out in order to get more efficient code. */
  42. | char *rb=ROM_base;
  43. | char *p=rb+0x12000;
  44. | char *q=rb+0x18000;
  45. |
  46. | while (p<q && *(unsigned long*)p!=0xDEADDEAD) p+=2;
  47. | p+=2[(short *)p]?8:12;
  48. | *(void **)(long)*(short *)p=(void*)0x3f000;
  49. | }
  50. move.l 0xC8,%d0
  51. move.l %d0,%a0
  52. cmp.l #999,-4(%a0)
  53. jbls .L1
  54. cmp.w #0x524F,0x32
  55. jbeq .L1
  56. and.l #0xE00000,%d0
  57. move.l %d0,%a0
  58. add.l #0x12000,%a0
  59. add.l #0x18000,%d0
  60. jbra .L3
  61. .even
  62. .L7:
  63. addq.l #2,%a0
  64. .L3:
  65. cmp.l %a0,%d0
  66. jbls .L4
  67. cmp.l #0xDEADDEAD,(%a0)
  68. jbne .L7
  69. .L4:
  70. tst.w 4(%a0)
  71. bne.s 0f
  72. addq.l #4,%a0
  73. 0:
  74. move.w 8(%a0),%a0
  75. move.l #0x3F000,(%a0)
  76. .L1:
  77. | End compiled code.
  78. .L__ghost_space_2:
  79. move.l (%sp)+,%d0
  80. bset.l #18,%d0
  81. movea.l %d0,%a0
  82. jmp (%a0)