3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ld hl,(LABMAN_FIRST_LABEL)
9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14 ;; IY: text input buffer
16 ;; IY: text input buffer after the label
17 ;; HL: points to label data area
21 ;; HL: points after the last label
23 ;; AF is dead, other registers are preserved
27 ld hl,(LABMAN_FIRST_LABEL)
33 ld iy,0 ; patched above
45 ; check failed, skip label
51 .skip_label_data_area:
62 ; if ok, carry is set (non-id char)
63 ; inverse it for correct return result
66 jr .skip_label_data_area
74 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76 ;; this is called by the driver to define a new label
79 ;; IY: text input buffer
81 ;; IY: text input buffer after the label
85 ld (LABMAN_NEW_LABEL_FLAG),a
87 jr c,LABMAN_FIND_LABEL_create_new_label
88 ; existing label: check if it is a forward reference
94 ld a,BZ80ASM.EXPR_ERR_DUPLICATE_LABEL
95 jp BZ80ASM.PARSE_EXPR_ERROR_A
97 ; reset "forward" flag
109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
112 ;; see full documentation in "bz80asm.zas"
115 ;; IY: text input buffer
117 ;; IY: text input buffer after the label
119 ;; CARRY FLAG: set if label wasn't found
120 ;; expression parser will bomb out in this case
124 ld (LABMAN_NEW_LABEL_FLAG),a
127 jr c,.create_new_label
128 ; old label, return value
135 @LABMAN_FIND_LABEL_create_new_label:
145 ld a,EXPR_ERR_NO_LOCAL_LABELS_YET
146 jp BZ80ASM.PARSE_EXPR_ERROR_A
149 push hl ; we'll use this later to print a name
150 ; HL points to the memory where our new label should be put
151 ; copy label name there
172 ; set "forward reference" flag
174 @LABMAN_NEW_LABEL_FLAG equ $01
175 ; put zero to mark new label area end
179 ; now print new label
197 ; reset carry (just to be sure)
201 msg_newlabel: defx "NEWLABEL:<"
204 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
205 ;; check if A is an alpha char
206 ;; carry set: not an alpha char
222 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
223 ;; check if A is a decimal digit
224 ;; carry set: not a digit char
233 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
234 ;; check if A is a valid identifier char (including digits)
235 ;; carry set: not an id char