mikeakohn / naken_asm

Assembler for MSP430, dsPIC, ARM, MIPS, 65xx, 68000, 8051/8052, Atmel AVR8, and others.
http://www.mikekohn.net/micro/naken_asm.php
GNU General Public License v3.0
295 stars 50 forks source link

macros cause parser error #25

Closed clarkeaa closed 7 years ago

clarkeaa commented 7 years ago

offending code:

   .z80                                                                                                                                               

   .macro BLAH                                                                                                                                        
   ld a, 0xff                                                                                                                                         
   .endm                                                                                                                                              

   ld a, 0xff                                                                                                                                         
   ld (0xce00), a                                                                                                                                    
loop:                                                                                                                                                 
   jp loop 

build command: naken_asm -b red.asm -o red.bin

output:


 Athors: Michael Kohn
         Joe Davisson
    CPU: MSP430, MSP430X, 6502, 65816, 6809, 68HC08, 68000, 8051,
         ARM, AVR8, dsPIC, Emotion Engine, MIPS, PIC32, Propeller,
         STM8, THUMB, TMS1000, TMS1100, TMS9900, Z80
    Web: http://www.mikekohn.net/
  Email: mike@mikekohn.net
Version: January 22, 2017

 Input file: red.asm
Output file: red.bin

Pass 1...
Internal error: macro longer than 1024 bytes on line 960
** Errors... bailing out

Program Info:
Include Paths: .
               /usr/local/share/naken_asm/include
 Instructions: 0
   Code Bytes: 0
   Data Bytes: 0
  Low Address: fffffffe (-2)
 High Address: 0000 (0)

*** Failed ***

I saw this problem with b3aaff8095a560dedffa03cfb294c08cc6c05274. Removing the macro block fixes compilation. I expected this code to work. I've attempted to paste in your example macros and they also cause the same problem.

mikeakohn commented 7 years ago

Thank you for letting me know about this. The issue comes up if .endm is indented or there is any extra spaces after .endm. The code was unintentionally written to look for .endm on a line by itself.

I never noticed it because I typically never indent lines that start with a dot. I'm going to make some more changes in the macro code later since that's the wrong error message for a missing .endm, but for now this should take care of your issue. Please let me know if anything else comes up.