asMSX icon indicating copy to clipboard operation
asMSX copied to clipboard

INCLUDE inside an IF (ignore IF)

Open jamque opened this issue 5 years ago • 3 comments

If you put an INCLUDE inside an IF, and condition is false, asmsx include the file likewise Example:

USE_SCREEN = 2 IF USE_SCREEN == 2 ;.INCLUDE "LIB/FORSCREEN2.GEN" ENDIF IF USE_SCREEN == 4 .INCLUDE "LIB/FORSCREEN4.GEN" ENDIF

In output Including file LIB/FORSCREEN2.GEN Including file LIB/FORSCREEN4.GEN

jamque avatar Nov 01 '20 13:11 jamque

This behaviour was never cover. However it is interesting.

The includes are treated in the first preprocessor, where there is no support for IF statements (The IF statements are controlled in the assember part). If we want to support this we would have to copy the IF statement syntax to preprocessor 1.

Fubukimaru avatar Nov 01 '20 15:11 Fubukimaru

To include this we need to implement bison code as IF uses the calculations made for value in dura.y.

Fubukimaru avatar Jan 10 '21 22:01 Fubukimaru

index

Same code as the test included in #110.

VARIABLE=2	
	.ZILOG
	.ROM
	.START INIT
INIT:
	nop
; Si el if da falso, crea la etiqueta igual, pero en direccion erronea.
; DIR1 y DIR2 van a la misma direccion
; Si if da cierto, funciona
; Se puede ver en el fichero .sym de salida
if VARIABLE == 3
DIR1:	ds	8
endif
DIR2:	ds	8
	ret

Fubukimaru avatar Apr 14 '22 09:04 Fubukimaru

It works. Fixed with: https://github.com/Fubukimaru/asMSX/issues/90

The only issue is that the executable will say "I'm including this file". But we don't care.

Fubukimaru avatar Nov 04 '23 15:11 Fubukimaru

Rebota rebota y en tu culo explota

Fubukimaru avatar Nov 04 '23 15:11 Fubukimaru