Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assemble error with macro - inline maths?? #87

Closed
richardturnnidge opened this issue Nov 6, 2024 · 5 comments
Closed

assemble error with macro - inline maths?? #87

richardturnnidge opened this issue Nov 6, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@richardturnnidge
Copy link

I am revisiting my Lunar Lander game, try to improve some of the motion.
Before making any changes to my previous master sources, I tested assembling on the latest ez80asm, but it failed.

In version 1.4, this assembles fine. But, with 1.9, it gives an error.
I haven't tested with any intermediate releases as I hadn't used any on my Mac.
As we have seen before, it may not be anything to do with this line at all!!

I am building a string of data to send to VDP with some macros.

eg.
MAKEBUFFEREDBITMAP 20, 320, 120, "resources/lunar_title.pbm", titleColour

(titleColour is an EQU)

Where the macro starts with:

macro MAKEBUFFEREDBITMAP bitmap_id, width, height, data, colourCode

; create buffer

.db 	23,0,$A0 							; write block
.dw 	64000 + bitmap_id 							
.db 	3	 								; 'create' command
.dw 	width *  height / 8 				; data size = length 320 x 64 / 8 bits as b/w

It gives assemble error of:

Pass 1...
Pass 2...
�[31mMacro [MAKEBUFFEREDBITMAP] in "macros.inc" line 307 - Unknown label, invalid number�[33m 'bitmap_id'
�[39m�[33m .dw 64000 + bitmap_id
�[39m�[31mInvoked from "lander_29.asm" line 1732 as
�[33m MAKEBUFFEREDBITMAP 20, 320, 120, "resources/lunar_title.pbm", titleColour

If I step through each line in the macro and remove any of the maths (+ *, /, etc) it no longer reports an error for that line.

So, is there an issue doing basic maths within a macro now??

@envenomator envenomator added the bug Something isn't working label Nov 6, 2024
@envenomator envenomator self-assigned this Nov 6, 2024
@envenomator
Copy link
Owner

Looks like a bug, probably due to changed token handling after 1.4.

envenomator added a commit that referenced this issue Nov 6, 2024
envenomator added a commit that referenced this issue Nov 6, 2024
@envenomator
Copy link
Owner

Please try to build from the latest master branch to see if this indeed fixes the issue

@envenomator
Copy link
Owner

envenomator commented Nov 6, 2024

Latest commit adds the possibility to have argument names that partly overlap, like 'arg', 'arg1' and 'argument', while still expanding them correctly in the macro.

@richardturnnidge
Copy link
Author

richardturnnidge commented Nov 6, 2024

Very quick build before bed, but I think that has done it!!! thank you. I will test further tomorrow.
I put an extra version comment in so I knew for sure which version I was running!!
My Sublime build script output as follows:

Build script for AgonLight2
File: lander_29.asm

ez80asm version 1.9, (C)2024 - Jeroen Venema
Mac build R. Turnnidge macro fix?
Exporting symbols
Assembling lander_29.asm
Listing to lander_29.lst
Pass 1...
Pass 2...
Done in 0.03 seconds

Assembly statistics

Label memory : 12286
Labels : 284

Macro memory : 8817
Macros : 39

Input buffers : 193207

Total memory : 214310

Sources parsed: 7
Binfiles read : 44

Output size : 128608
Created BIN v1.9 file: lander_29.bin

Making HEX file: lander_29.hex
Making emulator local copy: lander_29.bin
Hex file made

@envenomator
Copy link
Owner

Fixed in release v1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants