(*
This is a simple demonstration file for the Zeus assembler.
If you want more sustantial files they're available at www.desdes.com


Assembler options.

Before v2.10 Zeus supported some assembler options using the config tab.

After v2.10 onwards Zeus supports dynamic changes to the assembler options
using separate variables to control each option - this document describes
zeus from v2.10 onwards.

The variables currently provided are:

zoStrict
zoCheckORG
zoWarnOctal
zoWarnFlow
zoAllowFloatingLabels

To some extent these duplicate existing control options, but they also allow
option control in the command-line version of the assembler and allow different
options to be used in different regions of the source code.

The options that duplicate the check-boxes on the config tab work as you might
expect - the check box sets the initial state and you can alter them during the
assembly process in the source.


These option variables are used as follows:

zoStrict = true

This is an alias for the STRICT pseudo-op. After this statement all extended Z80
instructions, such as "ld ixl,0", will be flagged as errors.

zoStrict = false

This is an alias for the EXTENDED pseudo-op. After this line all extended z80
instructions will be permitted (this is the default behaviour of zeus.)


zoCheckORG = true

After this line any ORG statements will generate a warning if they move the
assembly position.

"Why on earth would I want that?" I hear you asking. Well, consider a source
that is being reverse-engineered. Say a replacement for a ROM. Often these will
need to have routines placed at the same addresses as the original ROM, so one
way to guarantee this is to litter the source with ORG statements. However, these
ORG statements would normally be redundant, because the code that's there has to
be the same size as the original code. A common problem faced by the authors of
such code is inavdertantly writing code that isn't the same length, but not
noticing this because the assembler just moves the assembly position when it sees
the ORG and overwrites the previous code. This option allows zeus to tell you that
the ORG moved the assembly pointer, ie, the code isn't correct. With this enabled
think of ORG statements as being asserts...

zoCheckORG = false

After this line ORG statements can move about without causing any warnings.
This is the default behaviour of Zeus.


zoWarnOctal = true

After this line any leading zero octal constants will generate a warning. This is the
default behaviour of zeus.

"What is a leading zero octal constant?" You might ask.
"An utterly bloody stupid idea" I would answer. If you don't know, consider yourself
mercifully unravaged by the idiocy of programmers.

zoWarnOctal = false

After this line any leading zero constants will be assumed to be octal by default,
allowing you to shoot yourself in the foot in true crayon-mongering style.


zoWarnFlow = true

After this line zeus will warn you if it detects source code that appears to execute
data, or align/ORG statements that appear to be in the middle of executable bytes.
This is the default behaviour of zeus.

zoWarnFlow = false

After this line zeus will not check if data might be being executed.


zoAllowFloatingLabels = true

A floating label is my term for a label that is alone on a line, ie, a label that isn't
followed by a mnemonic or pseudo-op.

After this statement zeus will treat any floating label as a valid, normal label.

"Why do you keep putting words in my mouth?" I hear you ask, but I'm going to assume
what you really meant to say was "Why wouldn't I want zeus to allow floating labels?
It's my decision how I format my bloody sources, keep your petty-minded ideas about
formatting to yourself" Well, yes, I'd agree that the assembler shouldn't force any
unneccessary formatting upon the user, but floating labels are dangerous. Consider:

Fred    ld a,1          ; A mindless routine
        ret             ;

Suicide or a            ; Should we?
        ret z           ; No, return

        ; Code to bang big lumps of plutonium together...


Now, that's all very well, but suppose the monkey mis-typed that "ret" as "rett"?


Fred    ld a,1          ; A mindless routine
        rett            ; Aargh! This is now a floating label

Suicide or a            ; Should we?
        ret z           ; No, return

If zeus allowed floating labels then that "rett" wouldn't generate an error, it
would simply declare the label "rett"... Then there would be no return statement
on Fred and calling it would then fall into Suicide and blooie! The world would
end, all die, oh the embarrassment.

Well, if you must have floating labels, either leave zeus checking for them and
add a ":" to the end of the ones you intend so it can spot accidents, or you can
tell zeus to allow them and don't come crying to me when you mistype something
and the assembler doesn't warn you about it...

zoAllowFloatingLabels = false

This is the default behaviour of zeus. Floating labels will be detected and
generate error reports. Unless they have a ":" on them, in which case zeus will
emit a sharp intake of breath, start expecting trouble, but grudgingly allow them.


There may well be other options, but I've forgotten to document them.

*)

// This code isn't very exciting, just thought there should be some...

// Show the states of the options

zeusprint 011    ; Looks like eleven, doesn't it? Well, nope, it's nine really :(

zeusprint zoStrict,zoCheckORG,zoWarnOctal,zoWarnFlow,zoAllowFloatingLabels

zoWarnOctal=false

zeusprint 011    ; Looks like eleven, doesn't it? Well, nope, it's nine really :(


zeusprint zoStrict,zoCheckORG,zoWarnOctal,zoWarnFlow,zoAllowFloatingLabels

zoAllowFloatingLabels = true    ; Allow the following label to float

Start

        jp Start

