home .. forth .. colorforth mail list archive ..

RE: [colorforth] Machine Forth 'IF'


I see serious cons against relative branches, which is that it needs an ALU,
either a dedicated one either the main one. Is it a real problem?
I've thought of an indexed if in two instructions. The first computes an
address based on the TOS and the IP. It would do roughly MSB(TA)=MSB(IP)
LSB(A)=TOS*SC+LSB(IP) where A is the target address. Then we have a second
instruction which jumps to the address given by the TOS. It contradicts my
first assertion about relative branches, althought.

> -----Message d'origine-----
> De : Jeff Fox [mailto:fox@xxxxxxxxxxxxxxxxxxx]
> Envoyé : lun. 24 février 2003 20:23
> À : colorforth@xxxxxxxxxxxxxxxxxx
> Objet : Re: [colorforth] Machine Forth 'IF'
> 
> 
> Frank Kujawski wrote:
> > 
> > I would like to revisit this question on an index if.
> > The if uses the value on top of the data stack to compute its target
> > address.  Two questions come to mind,
> >         1) is the first address after command the '0' 
> address or '1'?
> 
> Forth uses a branch if the top of the parameter stack is zero.
> Code falls through if T is true and jumps to the ELSE or
> THEN portion (no ELSE in colorforth) when T=0.
> 
> Chuck named the opcode T0 or T=0 on P21.  The traditional
> Forth name was 0Branch.
> 
> >         2) should the address be relitive or absolute?
> 
> There are advantages to each. P21 and F21 use paged branches.
> That is upper bits come from the program counter, lower bits
> are in the instruction.  P21 has only 10-bit page branching
> opcodes.  The macro >R ; is used for branching to anywhere.
> 
> F21 has 10-bit and 14-bit paged branch instructions and
> a home-page bit in a control register.  When this bit is
> clear homepage is zero in DRAM (actual zero page) when
> the control bit is set homepage branch instructions
> use zero in SRAM (140000h) for the upper bits of the
> branch.  
> 
> C18 (also used as the core in 25x) uses absolute addressing
> in its 128 WORD address range.
> 
> On Pentium one could implement relative, or absolute.  For
> people who use Operating Systems that can load their program
> at any address absolute addressing creates a problem when
> systems are saved and then reloaded at a different address.
> Colorforth does not have this problem when it loads things
> at a known address and by compiling modules when needed
> absolute addressing works fine.
> 
> Instruction bandwidth issues, argument sizes, decoding,
> and the number of cycles involved are all very architectural
> dependent issues.
> 
> Best wishes,
> Jeff Fox
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
> Main web page - http://www.colorforth.com
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com