[Coco] questions about constants

Wayne Campbell asa.rand at yahoo.com
Sun Sep 13 16:14:18 EDT 2009


James,

I knew there was something different about Basic09 REAL variables and OS-9 C floats/doubles.

In Basic09, a real value is defined:

Byte 1: Exponent
Bytes 2-5: Mantissa, with Byte 5, Bit 0 being the sign bit

which is almost the exact opposite of the OS-9 C float:

Bit 7 of Byte 1 being sign bit, and Bytes 1-3: Mantissa
Byte 4: Exponent

I have never understood why that difference exists, but being prior to the IEEE standard would be as good an explanation as any.

I believe I understand the compiler directives and pseudo op codes better now. In order to make sure I am looking at things correctly, the following is true?

org 0 sets the current . value to 0

A.LABEL1 rmb 1 this A memory address is relative 0 to org
A.LABEL2 rmb 1 this A memory address is relative 1 to org

A.LABEL3 rmb 2 this A memory address is relative 2 or org
A.LABEL4 rmb 1 this A memory address is relative 4 to org

I know that equ is a system equate. What I'm not sure of, is what it is equating.

For example, say the above is true, and the following line comes next in the list:

A.LABEL5 equ 

does this mean that A.LABEL5 is being set to a value of 5, or the address of 5 relative to org?

Wayne



________________________________
From: "jdaggett at gate.net" <jdaggett at gate.net>
To: Wayne Campbell <asa.rand at yahoo.com>; CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Saturday, September 12, 2009 8:16:24 PM
Subject: Re: [Coco] questions about constants



Wayne

FCB, FCC, FCS are assembler directives and not opcodes. What they do is tell the 
assembler at that place in memory to reserve a single byte, a double byte or multiple 
bytes. This used to hold a spot for data, screen prompts or table entries. 

Memory for all processors are in binary form. Integers are represented as a binary 
number. They can be 8 bit, 16 bit or even 32 bit form. The more bits used for integer the 
larger teh integer value you can have. 8 bit integers are limited 0 tp 255 if unsigned and -
127 to 128 if signed. 

Real numbers are stored as floating point binary numbers per the IEEE standard. Well 
the Coco is not IEEE standard as the DEC Basic was written before the IEEE standard 
was formed. To store a IEEE binary floating point number you need to 4 bytes for single 
precision, 8 bytes for double presicion. In single presicion you have a 23 bit mantissa, 
one sign bit and an 8 bit weighted exponent. For double presicion you have an 11 bit 
weighted exponent, one sign bit and 62 bit mantissa. 

These require any program to reserve appropriate amount of memory for each number 
used. You can use FCBs to reserve the bytes needed. In the case you only want to 
declare the space and not assign a value,  you can use the asembler directive RMB to 
reserve space. If you wish to reserve 4 bytes you can do this.

FPACCA    RMB     4

This will reseve 4 bytes for floating point accumaltor A. 

Assembler directives are a way to tell the assembler that all the code is not machine 
code. Some maybe data, a macro so that you do not have to type the same code over 
and over again. 

hope this helps

james

On 12 Sep 2009 at 16:41, Wayne Campbell wrote:

> I have looked at a dozen tutorials on assembly language programming. None of them address the op codes fcb, fcc or fcs, so I'm asking the assembly gurus on this list to help explain this to me.
> 
> What are the differences between fcb, fcc and fcs?
> Is there a fci or fcr(/f/d) (for integer and real(/float/double) values)?
> 
> I know that:
> 
>   fcb = form constant byte   = any constant numeric byte value?
>   fcc = form constant char   = any constant character that is displayable?
>   fcs = form constant string = any constant string?
> 
> Are the following equivalent, so far as the assembler is concerned?
> 
> A. form constant byte:
> 
>   fcb   $20  
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $20 
>   fcb   $42 B
>   fcb   $41 A
>   fcb   $53 S
>   fcb   $49 I
>   fcb   $43 C
>   fcb   $30 0
>   fcb   $39 9
>   fcb   $0A  
> 
> B. form constant string:
> 
>   fcs   /            BASIC09/
>   fcb   $0A
> 
> C. would using form constant char be equivalent?
> 
>   fcc   ' '  
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   ' ' 
>   fcc   'B'
>   fcc   'A'
>   fcc   'S'
>   fcc   'I'
>   fcc   'C'
>   fcc   '0'
>   fcc   '9'
>   fcb   $0A
> 
> Wayne
> 
> 
> 
>      
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco


      



More information about the Coco mailing list