• Re: much enhanced z-80 assembler now available

    From Jonathan Harston@21:1/5 to All on Thu Sep 7 20:25:28 2023
    Is there a way to use strings in expressions in ZMAC, so I can do
    the following more efficiently:

    VersDD equ 06
    VersMM equ 11
    VersYY equ 2000

    DEFB '0'+(VersDD / 10)
    DEFB '0'+(VersDD MOD 10)
    DEFB "-"
    if VersMM=1
    DEFB 'Jan'
    endif
    if VersMM=2
    DEFB 'Feb'
    endif
    if VersMM=3
    DEFB 'Mar'
    endif
    if VersMM=4
    DEFB 'Apr'
    endif
    etc....

    In my PDP11 assembler I'd do:
    VersDD: equ 06
    VersMM$: equ "Nov"
    VersYY: equ 2000
    DEFM '0'+(VersDD/10),'0'+(VersDD MOD 10)
    DEFM "-"+VersM$+"-"+STR$(VersYY)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From George Phillips@21:1/5 to Jonathan Harston on Mon Sep 11 10:06:40 2023
    On Thursday, September 7, 2023 at 8:25:30 PM UTC-7, Jonathan Harston wrote:
    Is there a way to use strings in expressions in ZMAC, so I can do
    the following more efficiently:

    Maybe it would be enough to just do the month as a macro?

    VersMM macro
    defm 'Mar'
    endm

    DEFM '0'+(VersDD/10),'0'+(VersDD MOD 10),'-'
    VersMM
    DEFM '-'

    Or use irp to do the month number to name lookup in a cleaner fashion:

    VersMM equ 7
    m1=0
    irp s1,<Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec>
    if VersMM == m1
    defm '&s1'
    endif
    m1++
    endm

    For the year you can stringify it doing something like this:

    VersYY equ 2000

    str macro sx
    defm '&sx'
    endm

    str %VersYY

    Though I guess the answer to your question is that zmac doesn't have string variables and you need to use macros to get the same kind of manipulation.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)