[Oberon] Load/Store instruction and Status register

Chris Burrows chris at cfbsoftware.com
Fri May 11 16:08:19 CEST 2018

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Srinivas Nayak
> Sent: Friday, 11 May 2018 11:04 PM
> To: ETH Oberon and related systems
> Subject: [Oberon] Load/Store instruction and Status register
> To my understanding, here our interest is to do the NIL check for the
> pointer/address being dereferenced.
> Here pointer/address is given by x.r + x.a.
> We need to check if this is 0 or not.
> So here, will the status register(N,Z,C,V) gets set by i. x.r + x.a
> address calculation operation or ii. for the received value in x.r?

So far x.r only contains the computed address. If it is zero then Z will be
set and the trap will be executed.

> If I understood this correctly, it means status register(N,Z,C,V)
> gets set for the received value in x.r.
> That means we didn't check the address to be 0, but rather we checked
> if the value received is 0.

You need another load instruction to receive the value that is stored at
that address. E.g. if p is a local pointer variable the assignment statement

  p.i := 0

will generate the following code:

  LDW   r0,  sp, 4
  BL,EQ r12 trap #4, pos: 123
  MOV   r1,  r0, 0
  STW   r1,  r0, 0

> 2. In Put3(BLR, EQ, ORS.Pos()*100H + 4*10H + MT) instruction, we
> embedded source code position and trap number(4) in to the branch
> instruction itself.
> Where and When this instruction will be decomposed to get position
> information and trap number?

It is decomposed and displayed to the user in System.Trap

Chris Burrows
CFB Software

More information about the Oberon mailing list