Acorn Arcade forums: Programming: OS_ChangeEnvironment 0
|
OS_ChangeEnvironment 0 |
|
Phlamethrower (20:09 21/1/2004) ajps (00:14 22/1/2004) Phlamethrower (00:17 22/1/2004) Phlamethrower (00:21 22/1/2004)
|
|
Jeffrey Lee |
Message #50040, posted by Phlamethrower at 20:09, 21/1/2004 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
For some reason, using OS_ChangeEnvironment 0 to increase the amount of memory for the current program doesn't want to work. E.g.:
DIM code 256 FOR pass=4 TO 6 STEP 2 O%=code P%=&8000 [ OPT pass MOV R0,#0 MOV R1,#&100000 ; ~1MB SWI "OS_ChangeEnvironment" MOV R4,#&8100 MOV R5,#&100000 .loop MOV R0,R4 ADR R1,buf MOV R2,#12 SWI "OS_ConvertHex8" SWI "OS_Write0" SWI "OS_NewLine" STR R5,[R4],#&100 ; Go up in big steps so user doesn't get bored CMP R4,R5 BLT loop SWI "OS_Exit" .buf EQUD 0 : EQUD 0 : EQUD 0 ] NEXT pass SYS "OS_File",10,"memtest",&FF8,,code,O%
When the program produced by the above piece of BASIC is run, it should allocate itself about 1MB of RAM, and then write some data into it. As it does this it prints the address of the location it's about to write to, so you can tell where it's up to. However whenever it goes above the wimpslot level the program was started with, it crashes with an abort on data transfer. Does anyone have any idea what's going on?
I've checked OS_GetEnv, and that confirms that the RAM limit gets changed by the SWI. Increase the wimpslot 'next' bar to over 1MB and it works fine, but anything below that and it fails.
[Edited by Phlamethrower at 20:10, 21/1/2004] |
|
[ Log in to reply ] |
|
Antony Sidwell |
Message #50047, posted by ajps at 00:14, 22/1/2004, in reply to message #50040 |
Member
Posts: 48
|
I'll give you the classic response to such a question, in that I won't answer it. I don't know exactly what OS_ChangeEnvironment is supposed to do, but the PRMs are too vague for my liking and Wimp_SlotSize should do the job for you (i.e. change your program's Wimpslot). If you actually need to use OS_ChangeEnvironment rather than just extend your task's memory then I'll offer you a big shrug and advise you to post to csa.p if you don't get a straight answer here. There are some real experts over there. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #50049, posted by Phlamethrower at 00:17, 22/1/2004, in reply to message #50047 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
I'll give you the classic response to such a question, in that I won't answer it. I don't know exactly what OS_ChangeEnvironment is supposed to do, but the PRMs are too vague for my liking and Wimp_SlotSize should do the job for you (i.e. change your program's Wimpslot). I did try Wimp_SlotSize, but it didn't want to work either. I'll have another go though
If you actually need to use OS_ChangeEnvironment rather than just extend your task's memory then I'll offer you a big shrug and advise you to post to csa.p if you don't get a straight answer here. There are some real experts over there. OK, thanks for the help (and confirmation that I'm not doing anything obviously stupid) |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #50052, posted by Phlamethrower at 00:21, 22/1/2004, in reply to message #50049 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
As if by magic, Wimp_SlotSize is now working. Yay!
[edit]
Ah, on my original attempt I'd been trying to send Wimp_SlotSize the size wanted in R1, when it should have been R0. Foolish!
[Edited by Phlamethrower at 00:32, 22/1/2004] |
|
[ Log in to reply ] |
|
|
Acorn Arcade forums: Programming: OS_ChangeEnvironment 0 |