home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
emulator
/
applem
/
loadram.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-02-27
|
1KB
|
50 lines
/* Load file into RAM V0.9 */
parse source mycall .
if mycall=FUNCTION then trace l
call open(file,arg(1))
call readch(file,2)
if RESULT="ffff"x then do /* Recognize special file */
from=c2d(reverse(readch(file,2)))
len=c2d(reverse(readch(file,2)))-from+1
end
else do /* Suppose basic file */
from=2049
len=c2d(RESULT)
end
/*
if ~show('l','rexxsupport.library') then
call addlib('rexxsupport.library',0,-30)
call forbid
*/
do for 10 until RESULT~=0
call findprocess("applem000")
end
if RESULT=0 then exit 1
call findseg(RESULT)
call export(d2c(c2d(import(d2c(RESULT+150,4),4))+from,4),readch(file,len))
exit 0
FINDPROCESS: /* Based on c't 89/3 p. 142 */
ExecBase=c2d(import('00000004'x,4))
TaskWait=c2d(import(d2c(ExecBase+420,4),4))
do while TaskWait~=0
if c2d(import(d2c(TaskWait+8,4),1))=13 &,
c2d(import(d2c(TaskWait+140,4),4))~=0 then do
CLI=c2d(import(d2c(TaskWait+172,4),4))
CommandName=c2d(import(d2c(CLI*4+16,4),4))
CommandName=import(d2c(CommandName*4+1,4))
if abbrev(reverse(CommandName),reverse(arg(1))) then leave
end
TaskWait=c2d(import(d2c(TaskWait,4),4))
end
return TaskWait
FINDSEG: /* Based on Xoper hunks */
seglist=import(d2c(arg(1)+172,4),4)
seglist=c2d(seglist)*4+60
do 2
seglist=import(d2c(seglist,4),4)
seglist=c2d(seglist)*4
end
return seglist