home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / m / mod2app / Source < prev   
Text File  |  1995-06-27  |  1KB  |  76 lines

  1. ; Mod2App source code
  2. ; by M.Bloch, 1995
  3.  
  4. #type &FF8
  5. #base &8000
  6. #name Mod2App
  7.  
  8. SWI OS_GetEnv
  9. RSB R1,R1,#&8000
  10. STR R1,ram_limit
  11. MOV R1,R0
  12. ADR R0,keyword_definition
  13. ADR R2,output_buffer
  14. MOV R3,#64
  15. SWI OS_ReadArgs
  16. LDR R7,[R2,#4]
  17. TEQ R7,#0
  18. BEQ syntax
  19. LDR R8,[R2,#8]
  20. TEQ R8,#0
  21. MOVEQ R8,R7
  22.  
  23. MOV R0,#23
  24. MOV R1,R7
  25. SWI OS_File
  26. STR R4,length_of_module
  27. ADD R4,R4,#&400
  28. LDR R3,ram_limit
  29. CMP R3,R4
  30. BGE not_enough_memory
  31.  
  32. MOV R0,#16
  33. MOV R1,R7
  34. ADR R2,load_module_here
  35. MOV R3,#0
  36. SWI OS_File
  37.  
  38. MOV R0,#10
  39. MOV R1,R8
  40. MOV R2,#&FF8
  41. ADR R4,start_of_app_shell
  42. LDR R5,length_of_module
  43. ADD R5,R5,R4
  44. SWI OS_File
  45.  
  46. SWI OS_Exit
  47.  
  48. .syntax
  49. SWI OS_WriteS
  50. DCB "Syntax: Mod2App <input file> [output file]",0
  51. ALIGN
  52. SWI OS_NewLine
  53. SWI OS_Exit
  54. .not_enough_memory
  55. SWI OS_WriteS
  56. DCB "Not enough memory available to load module",0
  57. ALIGN
  58. SWI OS_NewLine
  59. SWI OS_Exit
  60. .keyword_definition
  61. DCB "prog,infile,outfile",0
  62. .ram_limit
  63. DCD 0
  64. .output_buffer
  65. DBB 64,0
  66.  
  67. .start_of_app_shell
  68. MOV R0,#11
  69. ADR R1,load_module_here
  70. LDR R2,length_of_module
  71. SWI OS_Module
  72. SWI OS_Exit
  73. .length_of_module
  74. DCD 0
  75. .load_module_here
  76.