Giter Club home page Giter Club logo

asmsx's Introduction

\o/ YEAH \o/

asmsx's People

Contributors

duhow avatar fubukimaru avatar jamque avatar locomj avatar oboroc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asmsx's Issues

Unterminated string on includes

If an include has a space after the quotes, it returns an "Unterminated string" error.

For example:
.INCLUDE "LIB/TEST.GEN"_

Where _ is a whitespace, it returns this error. Otherwise it works properly.

Check grammar/text preprocess.

MEGAROM and ORG directive Just Won't Splice

Title origin: link

Exemple code

;Uncomment next line and...BOOM!
;USE38 = 1; to use 38h as interruption hook
;Comment next line if you uncomment line before.
USE38 = 0; to use 0FD9Fh as interruption hook

	ZILOG
	BIOS
	MEGAROM	KonamiSCC
	START		THEGAME
	db		"The Game is not The Game"

IF	USE38 == 1
	ORG	38h
	db	0C3h
	dw	TIMER_RUTINE
ENDIF
	
THEGAME:
	ei
	halt
	di
	SEARCH
	ld	SP,PILA
	SELECT 1 AT 06000h
	SELECT 2 AT 08000h
	SELECT 3 AT 0A000h
	call	TIMER_INI
	
	xor 	A
	ld	(BGCOLOR),A
	ei
	
LOOP_THEGAME:
	halt
	ld	A,(BGCOLOR)
	inc	A
	and	0Fh
	ld	(BGCOLOR),A
	call	COLORBR
	jr	LOOP_THEGAME
	

SUBPAGE 1 AT 06000h
	db 	1
COLORBR:
	out	(099h),A
	ld	A,87h
	out	(099h),A
	ret
	
SUBPAGE 2 AT 08000h
	db	2

TIMER_INI:
	ld	HL,0FD9Fh
	ld	BC,TIMER_RUTINE
	ld	(HL),0C3h
	inc	HL
	ld	(HL),C
	inc	HL
	ld	(HL),B
	ret

TIMER_RUTINE:
	push	AF
	push	BC
	push	DE
	push	HL
	push	IX
	push	IY
	
	in	A,(99h) ; acknowledge?
			;NO BIOS. This "in" RESET EI.
	nop	; thing to do here

	pop	IY
	pop	IX
	pop	HL
	pop	DE
	pop	BC
	pop	AF

	ld	A,1
	call	COLORBR
	
IF	USE38 == 1
	ei
	reti
ELSE
	ret
ENDIF

SUBPAGE 3 AT 0A000h
	db	3
	nop	; thing to do here
	
BUILDPAGES = 4
REPT 59
SUBPAGE BUILDPAGES AT 0A000h
	db	BUILDPAGES
BUILDPAGES = BUILDPAGES + 1
ENDR

	PAGE	3	; RAM
PILA0:
	ds	256
PILA:	byte

BGCOLOR:	byte

And with MEGAROM directive you can't use PAGE 0, PAGE 1 or PAGE 2.
If you use it asmsx says:

code/data without subpage

PAGE 3 yes. No problem.

Errors in one line

Errors should be printed in one line so that it is easier to IDEs to get the error and point to the incorrect lines and know which error you have.

For example in vim if we use the error format
set errorformat=%f\\,\ line\ %l:\ %m
m at the moment will only get "Error #" where # is the number of the error.

This can be addressed easily on error_message() function.

Use memory buffers instead of temporary disk files to pass input to flex scanners and bison parser

I don't think it's a good idea to write a file just so we can pass it to flex scanners or bison parser.

Here is a bit from flex documentation:

Three routines are available for setting up input buffers for scanning in-memory strings instead of files. All of them create a new input buffer for scanning the string, and return a corresponding YY_BUFFER_STATE handle (which you should delete with yy_delete_buffer() when done with it). They also switch to the new buffer using yy_switch_to_buffer(), so the next call to yylex() will start scanning the string.

yy_scan_string(const char *str) - scans a NUL-terminated string.
yy_scan_bytes(const char *bytes, int len) - scans len bytes (including possibly NUL's) starting at location bytes.

Note that both of these functions create and scan a copy of the string or bytes. (This may be desirable, since yylex() modifies the contents of the buffer it is scanning.) You can avoid the copy by using:

yy_scan_buffer(char *base, yy_size_t size) which scans in place the buffer starting at base, consisting of size bytes, the last two bytes of which must be YY_END_OF_BUFFER_CHAR (ASCII NUL). These last two bytes are not scanned; thus, scanning consists of base[0] through base[size-2], inclusive. If you fail to set up base in this manner (i.e., forget the final two YY_END_OF_BUFFER_CHAR bytes), then yy_scan_buffer() returns a nil pointer instead of creating a new input buffer. The type yy_size_t is an integral type to which you can cast an integer expression reflecting the size of the buffer.

Add ARMv6h cross-compilation

Probably asMSX will be included in the very beautiful MSXVR which is based on a Raspberry Pi board. Therefore we need to have a release cross-compilation for this architecture.

Symbol file with Emulicious format (CDB)

Emulicious (https://emulicious.net) is a highly accurate emulator used in debugging for the sega master system, among other systems like MSX. Look to see if it's possible to generate symbol data for it from the sym file generated by asmsx.

I use the last version of asmsx on Windows 10.

Thanks.

REPT Macro with SUBPAGE does not work together

This code to create a group of pages in blank...

PAGE=1
REPT 63
SUBPAGE PAGE AT 06000h
PAGE = PAGE + 1
ENDR

Makes error in SUBPAGE stament : Parsing error: syntax error

You can not use ASMSX Variables in MACROS

Code style

Folks, I'd like to get an agreement on the code formatting style and formalize it in an .editorconfig file in the project.

Tabs or spaces for formatting?

Tabs are neat, but if people use different settings in their editors, end results may look not so great.

Spaces are a bit annoying, but they guarantee source looks the same for everyone.

In vim and many other editors, it is easy to highlight tabs so they are clearly visible vs spaces.

For tabs, do we set tab to be equal to 2, 4 or 8 spaces?

If we decide to use tabs, how should we set our editors?

Do we use Microsoft or K&R brackets?

Lots of examples in this wikipedia article.
K&R brackets:

function max(int a, int b) {
    int r;
    if (a > b) {
        r = a;
        printf("%d > %d\n", a, b);
    } else if (a < b) {
        r = b;
        printf("%d < %d\n", a, b);
    } else if (a == b) {
        r = a;
        printf("%d == %d\n", a, b);
    }
    return r;
}

Microsoft brackets:

function max(int a, int b)
{
    int r;
    if (a > b)
    {
        r = a;
        printf("%d > %d\n", a, b);
    }
    else if (a < b)
    {
        r = b;
        printf("%d < %d\n", a, b);
    }
    else if (a == b)
    {
        r = a;
        printf("%d == %d\n", a, b);
    }
    return r;
}

Do we want to use basic C89 types only or are we ok with C99 <stdint.h> types: int8_t, int16_t, int32_t, int64_t and uint8_t, uint16_t, uint32_t, uint64_t.

There is probably more stuff like this, but the above questions are a good start for a coding style document. We can always expand it later.

[theNestruo] .rom directive not suitable for 48kB ROM

From: Libertium/asmsx-license-gpl#3


What steps will reproduce the problem?

  • Assemble the next source:
    .page 1
    .rom
    .size 48
    .start INIT
    .db "PAGE 1"
    INIT:
    ret

    .page 2
    .db "PAGE 2"

    .page 0
    .db "PAGE 0"
    ; EOF

What is the expected output?

  • Page 0 has no cartridge header
  • Page 1 has cartridge header ("AB" + INIT + padding up to 16 bytes)

What do you see instead?

  • Page 0 has no cartridge header, but bytes 3 and 4 are overwritten by INIT
  • Page 1 has cartridge header ("AB" + padding), but misses INIT

What version of the product are you using?

  • asMSX v0.16 WIP / v0.17 WiP.
    On what operating system?
  • Windows 7 Starter.

Please provide any additional information below.

  • Possible solution: .start directive should write INIT value where the .rom
    wrote the header, instead of 3rd/4th bytes of output file
    Bonus points:
  • As .rom directive is already locating the header at page 1, should it ensure
    there is no cartridge header at page 0? (is a ROM with cartridge header in page
    0 legal?)
  • Allow .rom directive to be preceeded by code, so the code can be in natural
    order: .page 0 / .page 1 / .rom / .page 2

Workaround:

  • (note that, as there is no .rom directive, output file extension is .z80
    instead of .rom):
    .size 48

    .page 0
    .db $00, $00 ; (ensure no ROM header in page 0)
    .db "PAGE 0"

    .page 1
    ROM_HEADER: ; (manual ROM header)
    .db "AB" ; ID ("AB")
    .dw INIT ; INIT
    .org ROM_HEADER +$10 ; STATEMENT, DEVICE, TEXT, Reserved
    .db "PAGE 1"
    INIT:
    ret

    .page 2
    .db "PAGE 2"
    ; EOF

Local label semantics

Experimenting with asMSX, I found a case where it behaved in a different way than I expected. For example, it seems that asMSX compiles this code fine:

label1:
    jp @@local

label2:
@@local:
    jp @@local

label3:
@@local:
    jp @@local

However, according to the documentation, I think the first jp @@local should fail, right? as the documentation states that "Local label name is only valid up to next global label." So, I thought that from inside of label, you would have had to write label2.@@local. Is this intended behavior? (it's fine either way, just want to make sure I mimic it correctly in MDL haha)

Add warning for unused parameters in macro

When we have a code that contains a parameter that is not defined in the macro header, we can raise a warning to help the user to fix it. This could be useful to detect typos.

Example:

MC: MACRO #a, #b, #c
    ld    a, #a
    ld    b, #b
    ld    c, #c
    ld    d, #d
ENDM


> Warning: Parameter #d in macro MC used but undefined.

cas file for g-monkey.asm is different between asMSX 0.12g, 0.16.1 and 0.18

You can load g-monkey.cas with bload"cas:",r command. It doesn't have a basic loader, so cload"",r and run"cas:" won't work. I assume this is due to game competing in 2048 bytes category.

There is a release version g-monkey.cas on msxdev 08 contest page. This version was compiled with asMSX 0.12g.

I also built g-monkey.asm using asMSX.exe 0.16.1 from original GPL release and with current 0.18 version.

All three load up and work fine, but all three have different content:

**012g.hex**
0000010: d0d0 672d 6d6f 6e6b 1fa6 deba cc13 7d74  ..g-monk......}t
**0161.HEX**
0000010: d0d0 2020 2020 2020 1fa6 deba cc13 7d74  ..      ......}t
**0180.HEX**
0000010: d0d0 2843 2020 2020 1fa6 deba cc13 7d74  ..(C    ......}t

Here is how generar_cassette() works in both 0.16.1 and 0.18:

  1. write 8-byte CAS fMSX header: 1f a6 de ba cc 13 7d 74;
  2. write d0 10 times;
  3. write file name, 6 bytes, padded with space if name is shorter then 6 letters;
  4. write 8-byte header again (see 1);
  5. write 2-byte memory address of rom first byte, lower address byte first;
  6. write 2-byte memory address of rom last byte, lower address byte first;
  7. write 2-byte memory address of opcode to jump to, lower address byte first;
  8. dump rom image, it should match "rom end" - "rom start".

It looks like step 3 (cassette file name) works fine in asMSX 0.12g, but not in 0.16.1 or newer.

Ask author if we can add Zone game

I stumbled upon a nice msxdev 2008 game called Zone. Source code for asMSX 0.12g is included in archive. Author's name is José Javier Franco Benítez. @Fubukimaru, I hope you might find him on karoshi forum and ask if he could let us add this game to asMSX repository as example.

I had to change A123h hex numbers to 0xA123, since asMSX 0.16 and up don't recognize A123h, it only understands 0xA123 or 0A123h (leading zero if first hex digit is alpha for h suffix notation). Once this change is done, it compiles to bin file and is identical to the one submitted to contest.

INCLUDE inside an IF (ignore IF)

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

Cross compile for MacOS

@Fubukimaru, you are using Linux and MinGW to cross-compile to Windows.

Can you also cross-compile for MacOS? I can help setting up the toolchain if you want. It is a combination of osxcross and MacOS SDK.

Rework how local labels work

In the case of the macro, you cannot use any label inside because the name will be duplicated. For instance, something stupid like:

LOCO: MACRO #a, #b
    jpnz .nothing
    ld  a, #a
    ld  a, #b
.nothing:
    xor a
ENDMACRO

It will complain .nothing already exists when using the macro twice. I assume that this is not the desired way of working in case we have a loop inside the macro.

My proposal would be to modify how the local labels work. I have seen in some assemblers that they refer to local labels using the previous global, for example: A global named MAN and then a local defined as .GLER. Internally the local label would be MAN.GLER.

This way we would be able to repeat local label names. I have to get more information about other assemblers to check how they behave.

Unreachable code error

I receive this error:

Assembling labels, calls and jumps
line 65: unreachable address

Unreachable code should be a warning message, not an error one.
Because we could be using self modified code, or just accesing the code using JP [HL].
Being an error message the legit code can't be compiled.

[theNestruo] "Add NOPs random" bug

From: Libertium/asmsx-license-gpl#2


What steps will reproduce the problem?

  1. Add/Modify code.
  2. Add/Modify labels.

What is the expected output? What do you see instead?
Compile without errors.
Syntax errors, unidentified labels, unexpected errors.

What version of the product are you using? On what operating system?
asmsx012e. Windows XP SP3.

Please provide any additional information below.
I think this is a very old bug commented in this thread
http://karoshi.auic.es/index.php?PHPSESSID=431a55f2ec0476ce4469934d2b2dd3e1&topi
c=472.0
It is nonsense that occurs with some frequency. It is not important but very
annoying.

MegarROM Konami SCC big than 512k

When you use
.MEGAROM Konamiscc
you can define
.SUBPAGE 64 at NNNN

64 must give an error : megaROM mapper subpage out of range
Max number page defined must be 63

[theNestruo] MSX system variables not include .bios directive

From: Libertium/asmsx-license-gpl#4


What steps will reproduce the problem?

  1. Use .bios directive
  2. Try to reference MSX system variables by name (e.g.: CGTABL ($0004), CLIKSW
    ($f3db), FORCLR ($f3e9), HIMEM ($fc4a), ...)

What is the expected output? What do you see instead?
Expected: Symbols are defined, the source compiles.
Actual results: Symbols are not defined, the source doesn't compile.

What version of the product are you using? On what operating system?
asMSX v0.16 WIP / v0.17 WiP, Windows 7 Starter.

Please provide any additional information below.
Although workaround this problem is trivial (just declare the vars needed using
equ), it would be nice to have those symbols defined with the .bios directive,
as they are part of the BIOS, or are used by the BIOS calls.

I don't know if var names are standard, or if the names are official. Anyway,
here are some listings:


Suggested patch:
Append these to the current msx_bios() code (located at dura.y#1017):
(...)
/* MSX System Variables located in Main ROM /
registrar_simbolo("CGTABL", 0x0004, 0);
registrar_simbolo("VDP_DR", 0x0006, 0);
registrar_simbolo("VDP_DW", 0x0007, 0);
registrar_simbolo("MSXID1", 0x002b, 0); /
not standard name /
registrar_simbolo("MSXID2", 0x002c, 0); /
not standard name /
registrar_simbolo("MSXID3", 0x002d, 0); /
not standard name /
/
MSX System Variables located in RAM */
registrar_simbolo("RDPRIM", 0xf380, 0);
registrar_simbolo("WRPRIM", 0xf385, 0);
registrar_simbolo("CLPRIM", 0xf38c, 0);
registrar_simbolo("LINL40", 0xf3ae, 0);
registrar_simbolo("LINL32", 0xf3af, 0);
registrar_simbolo("LINLEN", 0xf3b0, 0);
registrar_simbolo("CRTCNT", 0xf3b1, 0);
registrar_simbolo("CLMLST", 0xf3b2, 0);
registrar_simbolo("TXTNAM", 0xf3b3, 0);
registrar_simbolo("TXTCOL", 0xf3b5, 0);
registrar_simbolo("TXTCGP", 0xf3b7, 0);
registrar_simbolo("TXTATR", 0xf3b9, 0);
registrar_simbolo("TXTPAT", 0xf3bb, 0);
registrar_simbolo("T32NAM", 0xf3bd, 0);
registrar_simbolo("T32COL", 0xf3bf, 0);
registrar_simbolo("T32CGP", 0xf3c1, 0);
registrar_simbolo("T32ATR", 0xf3c3, 0);
registrar_simbolo("T32PAT", 0xf3c5, 0);
registrar_simbolo("GRPNAM", 0xf3c7, 0);
registrar_simbolo("GRPCOL", 0xf3c9, 0);
registrar_simbolo("GRPCGP", 0xf3cb, 0);
registrar_simbolo("GRPATR", 0xf3cd, 0);
registrar_simbolo("GRPPAT", 0xf3cf, 0);
registrar_simbolo("MLTNAM", 0xf3d1, 0);
registrar_simbolo("MLTCOL", 0xf3d3, 0);
registrar_simbolo("MLTCGP", 0xf3d5, 0);
registrar_simbolo("MLTATR", 0xf3d7, 0);
registrar_simbolo("MLTPAT", 0xf3d9, 0);
registrar_simbolo("CLIKSW", 0xf3db, 0);
registrar_simbolo("CSRY", 0xf3dc, 0);
registrar_simbolo("CSRX", 0xf3dd, 0);
registrar_simbolo("CNSDFG", 0xf3de, 0);
registrar_simbolo("RG0SAV", 0xf3df, 0);
registrar_simbolo("RG1SAV", 0xf3e0, 0);
registrar_simbolo("RG2SAV", 0xf3e1, 0);
registrar_simbolo("RG3SAV", 0xf3e2, 0);
registrar_simbolo("RG4SAV", 0xf3e3, 0);
registrar_simbolo("RG5SAV", 0xf3e4, 0);
registrar_simbolo("RG6SAV", 0xf3e5, 0);
registrar_simbolo("RG7SAV", 0xf3e6, 0);
registrar_simbolo("STATFL", 0xf3e7, 0);
registrar_simbolo("TRGFLG", 0xf3e8, 0);
registrar_simbolo("FORCLR", 0xf3e9, 0);
registrar_simbolo("BAKCLR", 0xf3ea, 0);
registrar_simbolo("BDRCLR", 0xf3eb, 0);
registrar_simbolo("MAXUPD", 0xf3ec, 0);
registrar_simbolo("MINUPD", 0xf3ef, 0);
registrar_simbolo("ATRBYT", 0xf3f2, 0);
registrar_simbolo("QUEUES", 0xf3f3, 0);
registrar_simbolo("FRCNEW", 0xf3f5, 0);
registrar_simbolo("SCNCNT", 0xf3f6, 0);
registrar_simbolo("REPCNT", 0xf3f7, 0);
registrar_simbolo("PUTPNT", 0xf3f8, 0);
registrar_simbolo("GETPNT", 0xf3fa, 0);
registrar_simbolo("CS120", 0xf3fc, 0);
registrar_simbolo("CS240", 0xf401, 0);
registrar_simbolo("LOW", 0xf406, 0);
registrar_simbolo("HIGH", 0xf408, 0);
registrar_simbolo("HEADER", 0xf40a, 0);
registrar_simbolo("ASPCT1", 0xf40b, 0);
registrar_simbolo("ASPCT2", 0xf40d, 0);
registrar_simbolo("ENDPRG", 0xf40f, 0);
registrar_simbolo("ERRFLG", 0xf414, 0);
registrar_simbolo("LPTPOS", 0xf415, 0);
registrar_simbolo("PRTFLG", 0xf416, 0);
registrar_simbolo("NTMSXP", 0xf417, 0);
registrar_simbolo("RAWPRT", 0xf418, 0);
registrar_simbolo("VLZADR", 0xf419, 0);
registrar_simbolo("VLZDAT", 0xf41b, 0);
registrar_simbolo("CURLIN", 0xf41c, 0);
registrar_simbolo("EXBRSA", 0xfaf8, 0);
registrar_simbolo("PRSCNT", 0xfb35, 0);
registrar_simbolo("SAVSP", 0xfb36, 0);
registrar_simbolo("VOICEN", 0xfb38, 0);
registrar_simbolo("SAVVOL", 0xfb39, 0);
registrar_simbolo("MCLLEN", 0xfb3b, 0);
registrar_simbolo("MCLPTR", 0xfb3c, 0);
registrar_simbolo("QUEUEN", 0xfb3e, 0);
registrar_simbolo("MUSICF", 0xfb3f, 0);
registrar_simbolo("PLYCNT", 0xfb40, 0);
registrar_simbolo("VCBA", 0xfb41, 0);
registrar_simbolo("VCBB", 0xfb66, 0);
registrar_simbolo("VCBC", 0xfb8b, 0);
registrar_simbolo("ENSTOP", 0xfbb0, 0);
registrar_simbolo("BASROM", 0xfbb1, 0);
registrar_simbolo("LINTTB", 0xfbb2, 0);
registrar_simbolo("FSTPOS", 0xfbca, 0);
registrar_simbolo("CODSAV", 0xfbcc, 0);
registrar_simbolo("FNKSWI", 0xfbcd, 0);
registrar_simbolo("FNKFLG", 0xfbce, 0);
registrar_simbolo("ONGSBF", 0xfbd8, 0);
registrar_simbolo("CLIKFL", 0xfbd9, 0);
registrar_simbolo("OLDKEY", 0xfbda, 0);
registrar_simbolo("NEWKEY", 0xfbe5, 0);
registrar_simbolo("KEYBUF", 0xfbf0, 0);
registrar_simbolo("BUFEND", 0xfc18, 0);
registrar_simbolo("LINWRK", 0xfc18, 0);
registrar_simbolo("PATWRK", 0xfc40, 0);
registrar_simbolo("BOTTOM", 0xfc48, 0);
registrar_simbolo("HIMEM ", 0xfc4a, 0);
registrar_simbolo("TRPTBL", 0xfc4c, 0);
registrar_simbolo("RTYCNT", 0xfc9a, 0);
registrar_simbolo("INTFLG", 0xfc9b, 0);
registrar_simbolo("PADY", 0xfc9c, 0);
registrar_simbolo("PADX", 0xfc9d, 0);
registrar_simbolo("JIFFY", 0xfc9e, 0);
registrar_simbolo("INTVAL", 0xfca0, 0);
registrar_simbolo("INTCNT", 0xfca2, 0);
registrar_simbolo("LOWLIM", 0xfca4, 0);
registrar_simbolo("WINWID", 0xfca5, 0);
registrar_simbolo("GRPHED", 0xfca6, 0);
registrar_simbolo("ESCCNT", 0xfca7, 0);
registrar_simbolo("INSFLG", 0xfca8, 0);
registrar_simbolo("CSRSW", 0xfca9, 0);
registrar_simbolo("CSTYLE", 0xfcaa, 0);
registrar_simbolo("CAPST", 0xfcab, 0);
registrar_simbolo("KANAST", 0xfcac, 0);
registrar_simbolo("KANAMD", 0xfcad, 0);
registrar_simbolo("FLBMEM", 0xfcae, 0);
registrar_simbolo("SCRMOD", 0xfcaf, 0);
registrar_simbolo("OLDSCR", 0xfcb0, 0);
registrar_simbolo("CASPRV", 0xfcb1, 0);
registrar_simbolo("BRDATR", 0xfcb2, 0);
registrar_simbolo("GXPOS", 0xfcb3, 0);
registrar_simbolo("GYPOS", 0xfcb5, 0);
registrar_simbolo("GRPACX", 0xfcb7, 0);
registrar_simbolo("GRPACY", 0xfcb9, 0);
registrar_simbolo("DRWFLG", 0xfcbb, 0);
registrar_simbolo("DRWSCL", 0xfcbc, 0);
registrar_simbolo("DRWANG", 0xfcbd, 0);
registrar_simbolo("RUNBNF", 0xfcbe, 0);
registrar_simbolo("SAVENT", 0xfcbf, 0);
registrar_simbolo("EXPTBL", 0xfcc1, 0);
registrar_simbolo("SLTTBL", 0xfcc5, 0);
registrar_simbolo("SLTATR", 0xfcc9, 0);
registrar_simbolo("SLTWRK", 0xfd09, 0);
registrar_simbolo("PROCNM", 0xfd89, 0);
registrar_simbolo("DEVICE", 0xfd99, 0);
}

Add a test to validate new asMSX builds

asMSX code is really tangled. To untangle it, we need to do a lot of changes. Any of those changes may break asMSX. To detect breaking changes, we need to make sure that given the same input, new build of asMSX produces the same output, unless there is a very good reason why it produces a different output, such as a bug fix (like issue #16) or a feature enhancement (like issue #15).

A proposed solution is in pull request #20.

Memory overflow instead Undefined identifier error message

When define memory space with .DS and use some equ definitions, but you make spelling mistakes like this:

aaa equ 20
	.ds 3*aa

asmsx says

CODE.ASM, line 3: memory overflow

I would expect to read

CODE.ASM, line 3: undefined identifier

Typo in pong.asm

In pong.asm, you should either remove f8h line or do ld a,f8h instead of ld a,0

; -Ball
        ld      hl,SPRTBL+32
        ld      bc,4
        ld      a,0
f8h

mine.asm example builds different on Windows and on Linux

I built all examples in code directory on both Windows (asMSX built with MinGW GCC 5.3.0 32-bit) and Linux (Windows 10 Linux subsystem and Ubuntu 16.10 in Hyper-V VM). mine.asm assembles to different ROM file between Windows and Linux.

It's not likely to be 32-bit vs 64-bit issue, because on Linux, both 32-bit and 64-bit builds of asMSX produced the same binary.

I ran the following commands:

xxd mine-lin.bin mine-lin.hex
xxd mine-win.bin mine-win.hex
vimdiff mine-lin.hex mine-win.hex

It gave me this result:

mine-bug-vimdiff

mine-bin-lin-win.zip

Make code modular by making functions "pure"

This is something I am doing right now with tape output functions, and would like to extend to the entire code base of asMSX. A pure function is a function that operates only on it's explicit input, and it's results are also returned explicitly. No I/O or any global state reading/writting is permitted. Using global constants is fine.

Doing this allows for a very modular composition of the code and for a near 100% unit test coverage.

A good explanation of pure functions and programming in functional-like style in C/C++ is in John Carmack's seminal article on Gamasutra: http://www.gamasutra.com/view/news/169296/Indepth_Functional_programming_in_C.php

Directive .FILENAME does not work

When you use the .FILENAME directive it should generate the output files with the new assigned name, instead of the default, but only use it for the .sym file.

.MSXDOS
.BIOS
.FILENAME "SCREEN1"

TERM0  EQU	$00	//Program terminate

	LD	A,1
	.CALLBIOS CHGMOD

	.CALLDOS TERM0 
asMSX.exe this_name_is_too_long_to_be_used_as_a_file_name_in_MSXDOS.asm

When compiling assembling, you get the following files:

SCREEN1.sym
this_name_is_too_long_to_be_used_as_a_file_name_in_MSXDOS.com

It is very important that this works. A kitten dies every time this directive is executed!! 🤪

Labels cannot have a "-"

We cannot use a label like: LABEL-1.
This happens nMSXTiles prints a - on the labels.

Try adding it for broader compatibility

sometimes "undefined identifier"

Tested with v.1.0.0-3-ga2f37e0
Demo code
File: TEST.ASM

	ZILOG
	nop
	;ld	A,(RUNEVENTS_EVENTSDONE)
;------------------------------------
; RAM
;------------------------------------
	PAGE	3
___RAM___:
PILA0:
	ds	256
PILA:	byte

	INCLUDE "RAM/RUNEVENTS.RAM"

File: RUNEVENTS.RAM

;RUNEVENTS Variables en RAM

RUNEVENTS_MAX_EVENTSDONE	equ	EVENTS_TOTAL
RUNEVENTS_EVENTSDONE:		ds	2 * RUNEVENTS_MAX_EVENTSDONE
RUNEVENTS_EVENTSDONE_END:

Beware EVENTS_TOTAL not defined, but...
Output:

Parsing file TEST.ASM
Using standard Zilog syntax
Expanding system macros
Assembling source file TEST.ASM
Assembling labels, calls and jumps
Binary file TEST.z80 saved
Symbol file TEST.sym saved
Completed in 0.03 seconds

TEST.SYM
No symbols from INCLUDE file

; Symbol table from TEST.ASM
; generated by asMSX v.1.0.0-3-ga2f37e0

; global and local labels
C000h ___RAM___
C000h PILA0
C100h PILA

uncommend line 3 from TEST.ASM
EVENTS_TOTAL stills not defined, but there is an error about RUNEVENTS_EVENTSDONE
Output:

Parsing file TEST.ASM
Using standard Zilog syntax
Expanding system macros
Assembling source file TEST.ASM
Assembling labels, calls and jumps
TEST.ASM, line 3: undefined identifier

asmsx variables are unsigned short int type

CODE:

VALUE = 60000
PRINT VALUE
VALUE = VALUE + 10000
PRINT VALUE

OUTPUT in txt file:

60000
4464

LOL!
It looks like asmsx variables are unsigned short int type, 16 bits.
Could be unsigned int type? 32 bits ? OR maybe this will collided with some features to use them with assembly opcodes?

wav file generation is broken

To reproduce, compile g-monkey.asm. You'll get g-monkey.wav. This file won't load in openMSX.

It doesn't seem to be a recent regression, since asmsx compiled from 0.16.1 source also produces broken wav file.

Interestingly enough, binary file asmsx.exe that was included in initial GPL release does produce a working wav file.

NOP bug on .INCBIN

When using .INCBIN we may find that asMSX claims that the binary to be included is not found.

This is related to #4.

When I get the test code for this, I'll fix it :).

No problems

This Issue is for celebrate that I have been used asmsx in the last 24 hours and there is no more Issues to report.
Please keep this Issue Open until a new Issue comes to this repository.
there are no accidents

Conditional assembly does not evade tag definitions

Take this code

USE_SCREEN=5
  ZILOG
  BIOS
  ROM
  START    GAME
  
GAME:
  
IF USE_SCREEN == 4
  call SCREEN4RENDER
ENDIF

IF USE_SCREEN == 5
  call SCREEN5RENDER
ENDIF

SCREEN5RENDER:
  ret

and asmsx says in reference to call SCREEN4RENDER

TEST.ASM, line 10: undefined identifier

Shouldn't it ignore the tags inside the IF before looking to see if that CALL SCREEN4RENDER exists?

Use tags as equ values

The tags are fixed values, and the EQU too, then:
I think that, can use tags (pointers) as a value in EQUs, should be useful to precalculate other offsets ans sizes.
For example:
DATA: DW 1,2,3,4...etc
DATASIZE: db (DATASIZE - DATA)/2
LD HL,DATASIZE
LD A,(HL)
SLA A ; A*=2

Should be...

DATA: DW 1,2,3,4,...etc
DATAEND:
SIZE equ (DATAEND-DATA)/2 ;Random precompile operation using tags
ld A,SIZE*2 ; A random precompile operation using EQU

Review grammars

Most of the grammar, at least in preprocessors, has a lot of treatment by character. This is a bit inefficient and less expressive. We may want to consider reviewing them so that they're more clear.

Forbid using directives as variables

In order to avoid pitfals like this #53, we can add a new warning or error that is returned when reserved keywords are used in the code as, for example, variables.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.