[Coco] questions about constants
jdaggett at gate.net
jdaggett at gate.net
Sat Sep 12 23:16:24 EDT 2009
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