jorgicor / uz80as

Micro Z80 Assembler
MIT License
18 stars 5 forks source link

Unable to include # directives inside #DEFINE construct #3

Open b1ackmai1er opened 1 year ago

b1ackmai1er commented 1 year ago

The following code works on tasm but not on uz80as

DRV_ORG     .EQU    $
DRV_SIZ     .EQU    0
DEBUG_ON    .EQU    FALSE
;
#DEFINE LOAD_DRV(driver) \
#DEFCONT DRV_ORG .SET $ \
#DEFCONT #INCLUDE "driver.asm" \
#DEFCONT DRV_SIZ .SET ($-DRV_ORG) \
#DEFCONT .ECHO "driver occupies " \
#DEFCONT .ECHO DRV_SIZ \
#DEFCONT .ECHO " bytes. " \
#DEFCONT #IFDEF driver \
#DEFCONT .ECHO "Debugging on.\n" \
#DEFCONT DEBUG_ON .SET TRUE \
#DEFCONT #ELSE \
#DEFCONT DEBUG_ON .SET FALSE \
#DEFCONT .ECHO "\n" \
#DEFCONT #ENDIF 
;
LOAD_DRV(dsrtc)

https://github.com/wwarthen/RomWBW/pull/308/commits/323cfec9314010bc11782a295d5a2cc28aca9549 https://github.com/wwarthen/RomWBW/pull/308#issuecomment-1336677413

Could uz80as be brought in line with TASM?

Thanks

jorgicor commented 1 year ago

Hello, sorry, I didn't notice this message.

There are 2 things in that code:

  1. The preprocessor does not behave like the TASM preprocessor. I will start working on that.
  2. The .SET directive. This is not implemented in uz80as. I didn't want to implement it because of its problems. The same TASM manual says that it should be avoided. Implementing it, is like 10 lines of code, but then it can be very problematic because it will change label values between passes etc.

I don't have much time these days for programming so I cannot promise anything. (1) will take me time, but I have already done some tests with TASM and I think that I know how it works, so I can implement it in uz80as to have the same behavior. When (1) is done, I will study 2.

Thanks.

b1ackmai1er commented 1 year ago

Hi Jorge, thank you. Yes free time was something i remember having a long time ago. :)

Thankyou.

On Tue, 9 May 2023, 8:50 pm Jorge Giner, @.***> wrote:

Hello, sorry, I didn't notice this message.

There are 2 things in that code:

  1. The preprocessor does not behave like the TASM preprocessor. I will start working on that.
  2. The .SET directive. This is not implemented in uz80as. I didn't want to implement it because of its problems. The same TASM manual says that it should be avoided. Implementing it, is like 10 lines of code, but then it can be very problematic because it will change label values between passes etc.

I don't have much time these days for programming so I cannot promise anything. (1) will take me time, but I have already done some tests with TASM and I think that I know how it works, so I can implement it in uz80as to have the same behavior. When (1) is done, I will study 2.

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/jorgicor/uz80as/issues/3#issuecomment-1540060679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJM7HV4X2LIEAGZOMM3TJBTXFI4PZANCNFSM6AAAAAAUAT4AFE . You are receiving this because you authored the thread.Message ID: @.***>