edit: it's not a bug, it's a feature!
Reading back thru this thread...
The assembler does not attempt to model the M & X sizes at all. It just guesses depending on the value.
There are overrides ( !# \1 \2 \3 ) for the programmer to mark up each reference as needed.
-----------------------------------
Sorry for probably finding another bug...
edit: using version 1.3.4.1, 65816 mode
It seems like the assembler isn't sure what size to make an immediate value on an instruction. In the following code, the
LDA # is sometimes 1 byte & sometimes 2 bytes. See line 1206, 1218, 1238.
It seems like the size changed between passes at line 1238 & caused a E022: phase error.
Is the assembler applying part of the 6502 absolute vs zero-page address optimization here? For immediate values, it should depend only on the assembler's opinion of the M or X size values.
Another question: how does the assembler come up with the current values of the M or X size bits?
Code:
01199 FHdr "B/Scr",0 ; ( -- n )
01200 .L1: .byte .name1 ;name of word as a string
01201 .byte *-.L1+.opt1 ;flags & length of name (see ha_*)
01202 .word DictLink ;link to previous word in dictionary chain
01203 0835 DictLink .set *
01204 ; This constant leaves the number of blocks per editing screen. By convention,
01205 ; an editing screen is 1024 bytes organized as 16 lines of 64 chars each.
01206 000835 A9 02 BScr: lda #1024/SSize ; blocks to make one screen
01207 000837 4C 2C 07 jmp Push
01208
01209
01210 FHdr "+Origin",0 ; ( n -- adr )
01211 .L1: .byte .name1 ;name of word as a string
01212 .byte *-.L1+.opt1 ;flags & length of name (see ha_*)
01213 .word DictLink ;link to previous word in dictionary chain
01214 083E DictLink .set *
01215 ; Leave the memory address relative by n to the origin parameter area.
01216 ; n is the minimum address unit, either byte or word. This definition
01217 ; is used to access or modify the boot-up parameters at the origin area.
01218 00083E A9 00 04 POrig: lda #ORIG
01219 000841 4C B4 06 jmp PlusA
01220
01221
01222 FHdr "User",0 ;
01223 .L1: .byte .name1 ;name of word as a string
01224 .byte *-.L1+.opt1 ;flags & length of name (see ha_*)
01225 .word DictLink ;link to previous word in dictionary chain
01226 0848 DictLink .set *
01227 ; A defining word used in the form:
01228 ; n USER cccc
01229 ; which creates a user variable cccc. The parameter field of cccc contains n
01230 ; as a fixed offset relative to the user pointer register UP for this user
01231 ; variable. When cccc is later executed, it places the sum of its offset and
01232 ; the user area base address on the stack as the storage address of that
01233 ; particular variable.
01234 000848 20 39 0D User: jsr WordHeader
01235 Debug0:
01236 00084B 20 A1 0D JSR LdaComma
01237 Debug1:
01238 00084E A9 53 08 lda #DoUser
01239 Debug2: