[comp.sys.acorn] ErrorV Problems

gunnar@hotb.radig.de (Gunnar Zoetl) (04/05/91)

I have a  little problem  with the following  code fragment. It adds a
little routine  to  the  error-vector, that   sets the system variable
Sys$ReturnCode to 42 if an error has occurred. If I use it from within
the basic environment with *-commands, all works well, but it does not
work within the supervisor mode. I suppose that  the cli  does not use
the OS_GenerateError system call, or is there a fault in the code?

Here is the relevant part:

.add
   STMFD R13!,{R0-R2,R14}
   ADR   R1,rout
   MOV   R0,#01
   MOV   R2,#00
   SWI   "XOS_AddToVector"
   LDMFD R13!,{R0-R2,PC}

.del
   STMFD R13!,{R0-R2,R14}
   ADR   R1,rout
   MOV   R0,#01
   MOV   R2,#00
   SWI   "XOS_Release"
   LDMFD R13!,{R0-R2,PC}

.rout
   STMFD R13!,{R0-R4,R14}
   ADR   R0,name
   ADR   R1,value
   MOV   R2,#4
   MOV   R3,#0
   MOV   R4,#1
   SWI   "OS_SetVarVal"
   LDMFD R13!,{R0-R4,PC}^

.name
   EQUS  "Sys$ReturnCode"
   EQUB  0
   ALIGN

.value
   EQUD  42

Any help appreciated.

Gunnar

Julian.Wright@comp.vuw.ac.nz (John Julian Wright) (04/07/91)

In article <1991Apr4.215956.735@hotb.radig.de>, gunnar@hotb.radig.de
(Gunnar Zoetl) writes:
|> 
|> I have a  little problem  with the following  code fragment...
|>                                             ...If I use it from
|> within
|> the basic environment with *-commands, all works well, but it does
|> not
|> work within the supervisor mode. I suppose that  the cli  does not
|> use
|> the OS_GenerateError system call, or is there a fault in the code?
|> 
|> Here is the relevant part:
|> 
|> .add
|>    STMFD R13!,{R0-R2,R14}
            ^^^

You are allocating yourself some stack, I hope...

This sounds very similar to a problem I encountered when writing an
absolute code application (ok a Demo)... in that contrary to what you might
expect, absolute applications which are *Run from the supervisor do *not*
have R13 set up for them automatically. The application has to specifically
find out how big the application space is and assign R13 as appropriate.

If you CALL the code from BASIC, however, R13 will have been set up with a
suitable value already.

    Cheers, Julian.
-- 
;`````````````````````````````````````````````````````````````````````````````;
; I would if I could but I can't so I won't but I might if I find I can later ;
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;
jwright@comp.vuw.ac.nz                                julian@sideways.gen.ac.nz