[Coco] questions about constants

Wayne Campbell asa.rand at yahoo.com
Sun Sep 13 17:37:02 EDT 2009


That makes sense. I have been looking at the sample program in both the OS9  Level 1 Programming Manual, Section 3, OS-9 Interactive Debugger, Chapter 4, Using Debug, Sample Program (page 159), and comparing it with the same sample program in the OS-9 Level 2 Development System Manual, Interactive Debugger, Chapter 4, Using Debug, page 4-1.

The first thing I noticed is that there are a few minor differences between the listings, most notably being the use of csect/endsect and psect/endsect in the rma version, and the use of org in the asm version. Because it seems they used a mixture of data from the asm version and the rma version in the Level 2 manual, I am assuming that the authors didn't believe that the differences would change the program significantly. From it, I have, I believe, learned the difference between Basic09 1.0.0 for Level 1 and Basic09 1.0.1 for Level 2. I believe that the only difference is that 1.0.0 was compiled with asm, and 1.0.1 was compiled with rma. I could be mistaken.

My primary question now is, would the order of the header file (which the ttl line is 'Basic09 System definitions'), be the same in the compiled program as it is in the header? Is asm or rma able to read different parts of the header at different points in the compile, or is it all read in sequentially at the beginning of the compile?

If it is read sequentially at the beginning, then I need to understand why the order of the rmb's at the beginning of the decompile are in a different order from the header file.




________________________________
From: Lothan <lothan at newsguy.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Sunday, September 13, 2009 9:04:40 AM
Subject: Re: [Coco] questions about constants

The fixed constants are actually allocated exactly where they are defined, so you need to define them in an area that can't contain any code. Any other rules about where you define fixed constants is generally up to you, although it's somewhat common to either defined fixed constants immediately after the rts in the subroutine in which they are used or near the bottom of the file. Putting them close to where they are used is a little more convenient.

Notice the OS-9 module header information is basically defined as a set of fixed constants in the asm assembler at the top of the file.

M$ID fdb $87CD
M$Size fdb $B61D
M$Name fdb Name
M$Type fcb $11
M$Revs fcb $81
M$Parity fcb $83
M$Exec fdb Start
M$Mem fdb $1125
Name fcs "myname'"

Start pshs y
...
bsr There
clra
clrb
OS9 F$Exit

Text fcs "Text can go here"

There pshs x
...
rts

--------------------------------------------------
From: "Wayne Campbell" <asa.rand at yahoo.com>
Sent: Saturday, September 12, 2009 11:26 PM
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Subject: Re: [Coco] questions about constants

> OK. I'm consolidating my reply to both Art and Lothan.
> 
> I understand about them being pseudo op codes. I understand that the actual labels are:
> 
> fcb = form one byte
> fdb = form double byte
> fcc = form character string
> fcs = form character string with hi-bit set on last byte
> 
> In respect to the data being put after the last rts instruction, that makes sense. In Basic09, I put my DATA statements after the last RETURN statement. In the I-Code, the DSAT and VDT occur after the last instruction statement. So, when I de-compile with disasm, all the rmb's and fcb's at the top are actually data contained at the bottom of the module. Is that correct?
> 
> I know that source files can be divided into parts, like .h for a header file, .a for the assembly source, .r for a linker file. Is there a particular order a header file is parsed in? I know that org sets the numerical origin of the rmb's that follow, but sometimes I see the org value change. In addition, the rmb's and fcb's at the beginning of the disasm output don't correspond directly to the header file. Does that mean the assembler parsed different parts in a different order?
> 
> Wayne
> 
> 
> 
> 
> ________________________________
> From: Arthur Flexser <flexser at fiu.edu>
> To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
> Sent: Saturday, September 12, 2009 6:37:54 PM
> Subject: Re: [Coco] questions about constants
> 
> These are not opcodes, which may explain why you had trouble finding
> them--they wouldn't appear in a table of opcodes.  They are
> "pseudo-ops"--assembler commands that don't themselves assemble into any
> bytes, but instead tell the assembler to do something.  So, if you simply
> want the byte $20, say, to be included in the assembler output at some
> location you've given the label "HERE" to, you'd put
> 
> HERE      FCB  $20
> 
> Or, to do this with the double byte $1234, you'd use
> 
> HERE     FDB   $1234
> 
> I've don't recollect hearing of FCS--it may be a pseudo-op that only some
> assemblers recognize.   FCC is the thing that is generally used for strings:
> 
> HERE    FCC /Put this string here./
> 
> Probably some assemblers only allow a single data character after FCC and
> demand that FCS be used when multiple characters are desired.
> 
> Generally, you'd these someplace that does not contain executable
> instructions, like after an RTS, to include data values that you want your
> program to have access to.
> 
> Art
> 
> 
> ________________________________
> From: Lothan <lothan at newsguy.com>
> To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
> Sent: Saturday, September 12, 2009 6:44:17 PM
> Subject: Re: [Coco] questions about constants
> 
> Actually, not quite. With OS-9 assemblers
> 
> fcs /Basic09/
> -or-
> fcs "Basic09"
> 
> is equivalent to:
> 
> fcc 'B'
> fcc 'a'
> fcc 's'
> fcc 'i'
> fcc 'c'
> fcc '0'
> fcb '9' + 0x80
> 
> or equivalently
> 
> fcc "Basic0"
> fcb '9' + 0x80
> 
> The differentiation is the fcb is for a single byte, fcc is for character
> data, and fcs is for strings in which the last character has the high-bit
> set. There is no fci, fcr, fcd with the assemblers that came with OS-9 or
> the Development System.
> 
> The delimiters don't really matter quite so much with fcc/fcs so you can use
> /, ', ", and perhaps a few others depending on your needs, but the delimiter
> at the start of the string must be the delimiter used to end the string.
> 
> --------------------------------------------------
> From: "Wayne Campbell" <asa.rand at yahoo.com>
> Sent: Saturday, September 12, 2009 7:41 PM
> To: <coco at maltedmedia.com>
> Subject: [Coco] questions about constants
> 
>> 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
>> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 
> 
> 
> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 

--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco



      



More information about the Coco mailing list