[z88dk-dev] Old z80asm expression syntax is gone

Bridge to the z88dk-developers mailing list
Post Reply
pscust
Well known member
Posts: 194
Joined: Thu Jun 23, 2011 3:34 pm

[z88dk-dev] Old z80asm expression syntax is gone

Post by pscust »

I have removed all the #ifdef that still allowed the old expression syntax
of z80asm to be interpreted, with all those funny little names that I could
never remember (why was a colon XOR???).

R.I.P.

At the same time I have added support to binary constants prefixed with '%'
so that z80asm can now accept all forms below below.

There is one catch: the '%' is also the modulus operator. It is interpreted
as a prefix if it is immediately followed by zeros and ones, or as modulus
otherwise.

defb 123 % 100 ; 123 mod 100 = 23, note the space between % and 100
defb 123 %+100 ; the same
defb 123 %(100) ; the same
defb 123 %100 ; syntax error, 123 and 4 without an operator

Example:

defb %00000000 ;; defb 00h
defb %00111100 ;; defb 3Ch
defb %01000010 ;; defb 42h
defb %01000010 ;; defb 42h
defb %01111110 ;; defb 7Eh
defb %01000010 ;; defb 42h
defb %01000010 ;; defb 42h
defb %00000000 ;; defb 00h

defb %"--------" ;; defb 00h
defb %"--####--" ;; defb 3Ch
defb %"-#----#-" ;; defb 42h
defb %"-#----#-" ;; defb 42h
defb %"-######-" ;; defb 7Eh
defb %"-#----#-" ;; defb 42h
defb %"-#----#-" ;; defb 42h
defb %"--------" ;; defb 00h

defb @00000000 ;; defb 00h
defb @00111100 ;; defb 3Ch
defb @01000010 ;; defb 42h
defb @01000010 ;; defb 42h
defb @01111110 ;; defb 7Eh
defb @01000010 ;; defb 42h
defb @01000010 ;; defb 42h
defb @00000000 ;; defb 00h

defb @"--------" ;; defb 00h
defb @"--####--" ;; defb 3Ch
defb @"-#----#-" ;; defb 42h
defb @"-#----#-" ;; defb 42h
defb @"-######-" ;; defb 7Eh
defb @"-#----#-" ;; defb 42h
defb @"-#----#-" ;; defb 42h
defb @"--------" ;; defb 00h
Post Reply