CaseInsensitivity

ToBe routines.

Needed for case insensitivity (french summary here: http://orgams.wikidot.com/v2boiteaidees#toc11).
Entering label with at least one uppercase letter must update the case for all other occurences (if case does have changed obviously). This is required for Maxam compatibility.
But we don't want this to occur if an entered line is invalid.
Currently, the parser set labels on the fly, but can only validate a line once fully consummed. In other words, we may add/update an encountered label but discover afterward that the whole line isn't valid.
A solution is to introduce an intermediate proxy, buffering new label and labels changes.

The following routines can use a &80 buffer at a fixed address (To be defined).

proxy_init

Called just before a line is parsed.

Adresse : TBD

In : N/A
Out : N/A

proxy_get_label_id

Adresse : TBD

Same interface than aap_get_label_id

proxy_get_new_id

Adresse : TBD

Same interface than aap_get_new_id

proxy_new_label

Adresse : TBD

Same interface than aap_get_new_id

proxy_set_label

Adresse : TBD

Same interface than aap_set_label

proxy_validate

Adresse : TBD

Called after a valid line is finished parsed.
All labels changes must be commited there.

In : N/A
Out : N/A

Existing routines

aap_labels_init

Internally called once at Orgams's initialization. Mustn't be called.

Adresse : #AAP+3
In : N/A
Out : N/A

aap_get_label_id

Adresse : #AAP+6

Return label's id if label exists.

In : HL= label (nt string)
Out : Carry if label already exists. Then :
DE= Id
Z if case matches.
NZ if case doesn't match.
NC otherwise

aap_get_new_id

Adresse : #AAP+9

Return fresh unused id.
NB:

  • This routine will always return the same id until aap_new_label is called with this id.
  • Labels id aren't recycled yet. Thus, you may assume that subsequent ids (+1, +2, …) are also unused.

In : N/A
Out : Carry if OK, DE contains Id.
NC otherwise (no more free Id).

aap_new_label

Adresse : #AAP+C

Append a new label to symbol table.

In : BC= Id (must be set via aap_get_new_id)
HL= label (nt string)
Out : C if ok.
NC otherwise (symbol table full).

aap_set_label

Adresse : #AAP+&C

Change existing label.
NB: this is only intended for case change.

In : DE= Id.
HL= label (nt string)
Out : Carry if ok.
NC otherwise (e.g. cannot change length of a label for now).

A sensitive case for case settling

When it comes to labels code style, everyone's got its own fanatic preferences.
But aggreing to a convention could be leveraged by orgams, in at least two ways:

  • Listing/accessing main routines of a program
  • Warning incorrect indirections. E.g. ld hl,(DOTS_PER_FRAME) wouldn't make sense, since it's not a memory address.

Suggestion:

DOTS_PER_FRAME = 17000  ; constant

tableSin0 = &a000       ; memory address of table or ...
currentLevel byte 0     ; ... variable

Compute3D               ; For routines entry point
; Maybe we should distinguish local helpers routines
; from main ones (which must be 'exported' for use in other sources)

.onde_pnt ld hl,onde    ; local labels
.loop_y                 ;

Unrelated but related, Orgams would show current position in status line, so we don't have to scroll to unveil which routine we are in.

scratchy.o/Compute3D.loop_x
Sauf mention contraire, le contenu de cette page est protégé par la licence Creative Commons Attribution-ShareAlike 3.0 License