Assembler Optimizer

Page 58/58
51 | 52 | 53 | 54 | 55 | 56 | 57 |

By Pencioner

Scribe (1609)

Pencioner's picture

28-01-2023, 16:05

I think if that dialect gonna be added, then it could improve perfomance of C code a lot

By rolandve

Champion (372)

rolandve's picture

28-01-2023, 16:19

santiontanon wrote:

Oh, not sure! Which assembler dialect does the ASCII C compiler generate assembler in? Do you have an example? I can definitively take a look Smile

Not sure what qualifies as a good example. I just copied and paste a part from the ascii C msxbios.mac file. I can certainly send a lot more.

[code]
;
;	Call a SUB-ROM routine from C program
;
CALSUB@::
	push	de		; save pointer to REGS structure
	push	hl		; set routine address to IX
	pop	ix
	ld	iy,0		; save SP in IY
	add	iy,sp
	ex	de,hl
	di
	ld	sp,hl		; Copy to registers
	pop	af
	pop	bc
	pop	de
	pop	hl
	ei
	ld	sp,iy		; restore true stack pointer
	push	iy
	call	_CALSUB
	pop	iy
	pop	ix		; restore pointer to REGS structure
	di
	ld	sp,ix		; copy from registers
	inc	sp
	inc	sp
	inc	sp
	inc	sp
	inc	sp
	inc	sp
	inc	sp
	inc	sp
	push	hl
	push	de
	push	bc
	push	af
	ei
	ld	sp,iy		; restore true stack
	pop	af		; discard stack
	ret

[/code]

By santiontanon

Paragon (1831)

santiontanon's picture

30-01-2023, 01:08

That looks fairly standard z80 notation, so, MDL should be able to work on that with some adjustments (I see some "@" and "::" symbols, that I'll have to check for what is their semantics). I'd be happy to try to add support for this. Is there any example code that uses ascii C that I could try to compile myself to do some tests that you would recommend?

By aoineko

Paragon (1135)

aoineko's picture

30-01-2023, 02:03

If it is like with SDCC, the "::" symbol marks a label as global (accessible from another source file).

By aoineko

Paragon (1135)

aoineko's picture

30-01-2023, 02:03

If it is like with SDCC, the "::" symbol marks a label as global (accessible from another source file).

By rolandve

Champion (372)

rolandve's picture

31-01-2023, 12:35

For complete information:
This document describes the M80 assembler used by Ascii C
and
Here you can find how to embed assembly in MSX C
Last link also explains about the label.

By santiontanon

Paragon (1831)

santiontanon's picture

31-01-2023, 16:07

Oh! If it's Macro-80, then MDL already supports that. So, it should be already applicable. Just make sure to specify "-dialect macro80" when calling MDL to optimize these assembler files.

By rolandve

Champion (372)

rolandve's picture

01-02-2023, 11:47

Nice!

By pizzapower

Master (172)

pizzapower's picture

05-03-2023, 22:37

Hello Santiontanon.

MDL doesn't support sjasm's : operator yet, right?

Like in

ld bc, 23:63h

which translates to:

ld bc, 5987 ; 23*256+0x63

By santiontanon

Paragon (1831)

santiontanon's picture

06-03-2023, 00:57

Oh, interesting! I thought I had support for the ":" operator. But it seems that sjasm has two different semantics for ":", one when applied to symbols (to get their page), which is implemented, and this one when applied to two integers! I'll add to the to-do list, it's not yet supported!

Page 58/58
51 | 52 | 53 | 54 | 55 | 56 | 57 |