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

Possible bug asmsx-darwin when including external files #138

Open
z80Robot opened this issue Jan 20, 2025 · 8 comments
Open

Possible bug asmsx-darwin when including external files #138

z80Robot opened this issue Jan 20, 2025 · 8 comments
Assignees
Labels

Comments

@z80Robot
Copy link

z80Robot commented Jan 20, 2025

Hello,

Binary path: /usr/local/asmsx-darwin
macOS 15.2 (24C101)
asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]

When using incbin / include:

asmsx-darwin -vv ~/Desktop/rom32k/output.rom ~/Desktop/rom32k/rom.asm
 
Registering symbol: asMSX Team equ 0 - on pass 1
Registering symbol: ASMSX equ 0 - on pass 1
Parsing file ~/Desktop/rom32k/rom.asm
~/Desktop/rom32k/rom.asm, **line 30: Include file not found**

My code

line 30:
line 31:    include "LIB/setup_ram.asm"
line 32:    include "LIB/setup_vram.asm"
line 33:    include "LIB/upload_data_vram.asm"
line 34:    include "LIB/symbols.asm"  

However, files exist:

cd ~/Desktop/rom32k/LIB
 
ls
setup_ram.asm       symbols.asm
setup_vram.asm      upload_data_vram.asm

Also, someone has tested my code in Win version and had no issues.

@duhow
Copy link
Collaborator

duhow commented Jan 21, 2025

It sounds like the file contains a hidden character (CR?) .
Would you please share the affected file (if private, only the affected part if it is still reproducible) or dump with hex view to confirm?

@jamque
Copy link
Collaborator

jamque commented Jan 21, 2025

I tested a example code that @z80Robot shared with me and it assembles correctly using asmsx.exe windows version.
File used for test: includetest.zip

@z80Robot
Copy link
Author

Yes, someone else also tested and had no issues assembling with windows version. If I assemble with no links to external files then it works as expected.

@duhow duhow removed the question label Jan 21, 2025
@Fubukimaru
Copy link
Owner

Linux version, using asmsx rom.asm works:

-------------------------------------------------------------------------------
 asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]
-------------------------------------------------------------------------------

Parsing file rom.asm
Including file setup_ram.asm
Expanding Macros
DONE Expanding Macros
Expanding REPT
Assembling source file rom.asm
Assembling labels, calls and jumps
Binary file rom.rom saved
Symbol file rom.sym saved
Completed in 0.01 seconds

On the other hand, @z80Robot, you're using the following command:
asmsx-darwin -vv ~/Desktop/rom32k/output.rom ~/Desktop/rom32k/rom.asm

You might be missing the -o for the output. Do you get the same error if you just do:

asmsx-darwin ~/Desktop/rom32k/rom.asm

or (even better) in the same folder:

asmsx-darwin rom.asm

Just to discard possibilities.

@Fubukimaru Fubukimaru self-assigned this Jan 25, 2025
@z80Robot z80Robot changed the title Possible bug asmsx-darmin when including external files Possible bug asmsx-darwin when including external files Jan 25, 2025
@z80Robot
Copy link
Author

z80Robot commented Jan 25, 2025

It does not work using -o for the output.
Also, it does not work if the external file is in a folder:

lib/setup_ram.asm

Parsing file rom.asm
rom.asm, line 21: Include file not found

It works this way if external file is in the same folder:

asmsx-darwin rom.asm

Parsing file rom.asm
Including file setup_ram.asm
Expanding Macros
DONE Expanding Macros
Expanding REPT
Assembling source file rom.asm
Assembling labels, calls and jumps
Binary file rom.rom saved
Symbol file rom.sym saved
Completed in 0.01 seconds

@Fubukimaru
Copy link
Owner

What about using -o and building from another path?

@z80Robot
Copy link
Author

line 22: .INCLUDE "setup_ram.asm"

Using

~ % asmsx-darwin -o ~/Desktop/includetest/rom.asm

or

~ % asmsx-darwin -o ~/Desktop/rom.rom ~/Desktop/includetest/rom.asm

or

~ % asmsx-darwin -o ~/Desktop/includetest/rom.rom ~/Desktop/includetest/rom.asm

result

~/Desktop/includetest/rom.asm, line 22: Include file not found

It works only when building from the same folder and including the external files together, as far as I have tested. Please let me know if you want me to do more test.

Thank you for taking care about this.

@z80Robot
Copy link
Author

Some more test and conclusions:

Test 01:

In the code:

Line 22: 	.INCLUDE "setup_ram.asm"
Line 23: MAP_0:	.INCBIN "Screen_00000" SKIP 32 SIZE 32

Terminal:

z80robot@mac ~ % asmsx-darwin -vv -o /Users/z80robot/Desktop/includetest/rom.rom /Users/z80robot/Desktop/includetest/rom.asm 
-------------------------------------------------------------------------------
 asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]
-------------------------------------------------------------------------------

Redefining output name (Overrides .FILENAME): /Users/z80robot/Desktop/includetest/rom.rom
Registering symbol: asMSX Team equ 0 - on pass 1
Registering symbol: ASMSX equ 0 - on pass 1
Using custom output path: /Users/z80robot/Desktop/includetest/rom.rom
Parsing file /Users/z80robot/Desktop/includetest/rom.asm
/Users/z80robot/Desktop/includetest/rom.asm, line 22: Include file not found
z80robot@mac ~ %

or from ~/Desktop/

z80robot@mac Desktop % asmsx-darwin -o /Users/z80robot/Desktop/includetest/rom.rom /Users/z80robot/Desktop/includetest/rom.asm 
-------------------------------------------------------------------------------
 asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]
-------------------------------------------------------------------------------

Redefining output name (Overrides .FILENAME): /Users/z80robot/Desktop/includetest/rom.rom
Using custom output path: /Users/z80robot/Desktop/includetest/rom.rom
Parsing file /Users/z80robot/Desktop/includetest/rom.asm
/Users/z80robot/Desktop/includetest/rom.asm, line 23: Include file not found
z80robot@mac Desktop % 

File ~tmppre.0 is created at /Desktop/

Test 02:

Just swapping include and incbin order in the code.

Line 22: MAP_0:	.INCBIN "Screen_00000" SKIP 32 SIZE 32
Line 23: 	.INCLUDE "setup_ram.asm"

Terminal:

z80robot@mac ~ % asmsx-darwin -vv -o /Users/z80robot/Desktop/includetest/rom.rom /Users/z80robot/Desktop/includetest/rom.asm
-------------------------------------------------------------------------------
 asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]
-------------------------------------------------------------------------------

Redefining output name (Overrides .FILENAME): /Users/z80robot/Desktop/includetest/rom.rom
Registering symbol: asMSX Team equ 0 - on pass 1
Registering symbol: ASMSX equ 0 - on pass 1
Using custom output path: /Users/z80robot/Desktop/includetest/rom.rom
Parsing file /Users/z80robot/Desktop/includetest/rom.asm
/Users/z80robot/Desktop/includetest/rom.asm, line 23: Include file not found
z80robot@mac ~ % 

TEST 03:

Subfolders work when

Path: includetest/Bin/Screen_00000

Code:

Line 22: MAP_0:	.INCBIN "Bin/Screen_00000"	;768 bytes
Line 23: 	.INCLUDE "setup_ram.asm"

At rom.sym:

403Fh MAP_0		
433Fh INIT_RAM	; $0300 = 768 bytes

Terminal:

z80robot@mac includetest % asmsx-darwin -o rom.rom rom.asm              
-------------------------------------------------------------------------------
 asMSX v1.1.1 MSX cross-assembler. asMSX Team. [2024-11-17]
-------------------------------------------------------------------------------

Redefining output name (Overrides .FILENAME): rom.rom
Using custom output path: rom.rom
Parsing file rom.asm
Including file setup_ram.asm
Expanding Macros
DONE Expanding Macros
Expanding REPT
Assembling source file rom.asm
Including binary file Bin/Screen_00000
Assembling labels, calls and jumps
Binary file rom.rom.rom saved
Symbol file rom.rom.sym saved
Completed in 0.01 seconds
z80robot@mac includetest % 

Conclusion:

1.- Only works when asmsx-darwin is executed at main.asm path
2.- Subfolders can be used when 1.-

Until someone can test and verify, or this can be fixed, I suggest to add a line in 1.5. chapter at the user manual.
Thank you again for your time to check this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants