[futurebasic] Re: [FB] FB^3 assembler

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2000 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Fri, 7 Apr 2000 12:56:16 +1200
>Does anyone have a list of what PPC opcodes the assembler understands?
>I have some that are listed as valid in Apple's docs but the FB^3
>compiler doesn't recognize them.  Specifically, "li" load immediate
>isn't recognized.
>Add Immediate "addi" seems to function the same way and is
>recognized, so maybe I'll use that instead.
>I imagine there are a number of opcodes that aren't supported.  There
>isn't any way to extend the list, right?  I'm assuming the assembler
>is built into the compiler.

Opcodes consist of the original IBM engineer-designed ones, which are what
the processor itself uses, plus the so-called "extended" or "simplified"
opcodes These are translations evidently patched on by programmers who
found some of the original set embarassingly hard to work with.

FB^3 with a few exceptions only supports the original hard-to-use set. (One
exception is the extended form mr). Hardly anything is missing. Here is a
partial list of equivalents that I have found useful.

` addi r3,0,-1       ; li r3,-1 (load immeduate)

` bc 12,2,lLoop      ; beq  lLoop
` bc 4,2,lLoop       ; bne  lLoop
` bc 4,0,lLoop       ; bge  lLoop
` bc 4,4,lLoop       ; bge  cr1 lLoop
` bc 4,1,lLoop       ; ble  lLoop
` bc 4,2,lLoop       ; bne  lLoop
` bc 16,0,lLoop      ; bdnz lLoop
` bc 12,0,lLoop      ; blt  lLoop
` bc 12,1,lLoop      ; bgt  lLoop

` cmpi cr0,0,r5,8192 ; cmpwi r5,8192 (compare algebraic (i.e. signed)
` cmpl cr0,0,r4,r3   ; cmplw r4,r3  (compare logical (i.e.  unsigned))

` subf. r3,r4,r5     ; sub. r3,r5,r4   r3 = r5 - r4

'powers of 2
` add    r3,r3,r3     ; r3=r3*2
` rlwinm r3,r3,2,0,29 ; slwi r3,r3,2 (r3=r3*4)
` rlwinm r3,r3,3,0,28 ; slwi r3,r3,3 (r3=r3*8)
` rlwinm r3,r3,4,0,27 ; slwi r3,r3,4 (r3=r3*16)

` rlwinm  r5,r6,16,0,15  ; slwi rx,ry,16  r5 = r6<<16
` rlwinm  r5,r6,16,16,31 ; srwi rx,ry,16  r5 = r6>>16

Robert P.