[Oberon] Assembler Cast example.

Joerg joerg.straube at iaeth.ch
Sat Oct 3 18:51:20 CEST 2020


The looop is basically this code:
Loop:
    DEC   ECX
    FLD   DWORD [ESI][ECX*4]  ; in: REAL
    FISTP WORD [EDI][ECX*2]   ; out: INTEGER
    WAIT
Check:
    CMP   ECX, 0
    JG    Loop
the assembler code above corresponds (roughly) to Oberon-07 code
    REPEAT
        DEC(ecx);
        out[ecx] := FLOOR( in[ecx] )
    UNTIL ecx = 0;
with this declaration
    VAR
       ecx: INTEGER;
       in: ARRAY 2000 OF REAL;
       out: ARRAY 2000 OF INTEGER;

So, the loop terminates if the index stored in register ECX is 0

br
Jörg

> Am 03.10.2020 um 15:28 schrieb peter at easthope.ca:
> 
> The last section in this page is headed "Built-In assembler".
> https://web.archive.org/web/20190831185610/http://www.ethoberon.ethz.ch/faqlang.html
> 
> Question "6. How do I cast a large number of variables very fast?" 
> refers to procedure Cast.  My knowledge of assembler is almost zero.  
> How does Loop terminate?
> 
> Thx,                               ... L.
> 
> 
> -- 
> Tel: +1 604 670 0140            Bcc: peter at easthope. ca
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list