About C / Z80 optimizations (SDCC)

Pagina 5/17
1 | 2 | 3 | 4 | | 6 | 7 | 8 | 9 | 10

Van PingPong

Prophet (3447)

afbeelding van PingPong

08-09-2019, 12:34

DarkSchneider wrote:

penalties for using unlicensed software for getting some extra cycles on some parts of the code for something that is merely a hobby, even if the probability is near zero, but not zero.

this is even true that there is a probability that SDCC development would stop.
Don't know if it is zero or more, but surely not zero ;-)

Van zPasi

Champion (471)

afbeelding van zPasi

08-09-2019, 12:38

ARTRAG wrote:

It is a long time since I did comparisons among compilers
This is an old simple test for circle compiled in HI-Tech C cross compiler

That would be more helpful as plain C source, without generated bytes and asm. So I could try it with both compilers, and with different versions of compilers, and try different optimisation levels.

Van Grauw

Ascended (8439)

afbeelding van Grauw

08-09-2019, 12:51

Just fixing the formatting of Artrag’s post:

ARTRAG wrote:

It is a long time since I did comparisons among compilers
This is an old simple test for circle compiled in HI-Tech C cross compiler

#include <stdio.h>
#include <sys.h>

#define  di() asm("di")
#define  ei() asm("ei")
	
void NameTableInit();

void vdpsetreg (unsigned char regno, unsigned char value)
{
	di();
    outp(0x99, value);
	outp(0x99, regno | 0x80);
	ei();
}

unsigned char vrampeek(unsigned int addr)
{
	di();
	outp(0x99, addr & 255);
	outp(0x99, (addr >> 8) & 0x3f);
	ei();
    return inp(0x98);
}

void vrampoke(unsigned int addr, unsigned char byte)
{
	di();
    outp(0x99, addr & 255);
	outp(0x99, 0x40 | ((addr >> 8) & 0x3f));
	ei();
	outp(0x98, byte);
}


/*
void setpixel(unsigned char x, unsigned char y)
{

	unsigned int  vddr = (x & 0xf8) + (y & 7) + (int)256 * (y>>3);
    unsigned char byte = vrampeek(vddr) | (128 >> (x & 7));
	vrampoke(vddr, byte );
}
*/

void sc2()
{
	unsigned char r;
	unsigned int counter;

	static unsigned char vdpregs[] = {0x02,0x60,0x06,0xFF, 0x03, 0x36, 0x07,0x04};

	
	for (r =0;r<sizeof(vdpregs);r++)
		vdpsetreg(r,vdpregs[r]);

    // vrampoke (0x1800,0);
	// for (counter=1;counter<256*3;counter++)
        // outp(0x98,counter & 255);
	di();
	NameTableInit();

    vrampoke (0x2000,0xF1);
	for (counter=1;counter<3*256*8;counter++)
        outp(0x98,0xF1);

    vrampoke (0x0000,0x00);
	for (counter=1;counter<3*256*8;counter++)
        outp(0x98,0x00);
}

void pset(unsigned char x, unsigned char y);

void plotpoints(unsigned int x, unsigned int y, unsigned int cx, unsigned int cy)
{
	pset((unsigned char)cx+x,(unsigned char)cy+y);
	pset((unsigned char)cx-x,(unsigned char)cy+y);
	pset((unsigned char)cx-x,(unsigned char)cy-y);
	pset((unsigned char)cx+x,(unsigned char)cy-y);

	pset((unsigned char)cx+y,(unsigned char)cy+x);
	pset((unsigned char)cx-y,(unsigned char)cy+x);
	pset((unsigned char)cx-y,(unsigned char)cy-x);
	pset((unsigned char)cx+y,(unsigned char)cy-x);

}


void circle(unsigned int cx, unsigned int cy, unsigned int radius)
{
	int x, y, d;
	x = 0; y = radius;
	d = 3 - 2*radius;
	while (x<y)
	{
		plotpoints(x, y, cx, cy);
    	if ( d<0 )
    		d = d + 4*x + 6;
      	else
      	{
			d = d + 4*(x-y) + 10;
			y--;
		}
    	x++;
	}
	if (x==y)
		plotpoints(x, y, cx, cy);
}


int exec_time;

void main(void)
{

	unsigned char px;

    
	sc2();

    *(int*)0xFC9E = 0;

	for (px=0;px<96;px+=2)
	{
		circle(127,95, px);
	}
	exec_time = (*(int*)0xFC9E);
	
	while(1) {}
}

This is the asm

HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   1


    1                           	global	small_model
    2                           	global	_vdpsetreg
    3                           	signat	_vdpsetreg,8248
    4   0000'                   	psect	text,class=CODE
    5                           	file	"CIRCLE.C"
    6                           	line	10
    7   0000'                   _vdpsetreg:
    8                           ;CIRCLE.C: 11: asm("di");
    9                           	line	11
   11   0000' F3                di ;#
   12                           ;CIRCLE.C: 12: (*(port unsigned char *)(0x99) = 
                                (value));
   13                           	line	12
   14   0001' 79                	ld	a,c
   15   0002' D3 99             	out	(099h),a
   16                           ;CIRCLE.C: 13: (*(port unsigned char *)(0x99) = 
                                (regno | 0x80));
   17                           	line	13
   18   0004' 7B                	ld	a,e
   19   0005' F6 80             	or	-128
   20   0007' D3 99             	out	(099h),a
   21                           ;CIRCLE.C: 14: asm("ei");
   22                           	line	14
   14   0009' FB                ei ;#
   15                           ;CIRCLE.C: 15: }
   16                           	line	15
   17   000A' C9                	ret	
   18                           	global	_vrampeek
   19                           	signat	_vrampeek,4153
   20                           	line	18
   21   000B'                   _vrampeek:
   22                           ;CIRCLE.C: 19: asm("di");
   23                           	line	19
   19   000B' F3                di ;#
   20                           ;CIRCLE.C: 20: (*(port unsigned char *)(0x99) = 
                                (addr & 255));
   21                           	line	20
   22   000C' 7B                	ld	a,e
   23   000D' D3 99             	out	(099h),a
   24                           ;CIRCLE.C: 21: (*(port unsigned char *)(0x99) = 
                                ((addr >> 8) & 0x3f));
   25                           	line	21
   26   000F' 7A                	ld	a,d
   27   0010' E6 3F             	and	03Fh
   28   0012' D3 99             	out	(099h),a
   29                           ;CIRCLE.C: 22: asm("ei");
   30                           	line	22
   22   0014' FB                ei ;#
   23                           ;CIRCLE.C: 23: return (*(port unsigned char *)(0
                                x98));
   24                           	line	23
   25   0015' DB 98             	in	a,(098h)
   26   0017' 6F                	ld	l,a
   27   0018' C9                	ret	
   28                           ;CIRCLE.C: 24: }


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   2


   29                           	line	24
   30                           	global	_vrampoke
   31                           	signat	_vrampoke,8248
   32                           	line	27
   33   0019'                   _vrampoke:
   34                           ;CIRCLE.C: 28: asm("di");
   35                           	line	28
   28   0019' F3                di ;#
   29                           ;CIRCLE.C: 29: (*(port unsigned char *)(0x99) = 
                                (addr & 255));
   30                           	line	29
   31   001A' 7B                	ld	a,e
   32   001B' D3 99             	out	(099h),a
   33                           ;CIRCLE.C: 30: (*(port unsigned char *)(0x99) = 
                                (0x40 | ((addr >> 8) & 0x3f)));
   34                           	line	30
   35   001D' 7A                	ld	a,d
   36   001E' E6 3F             	and	03Fh
   37   0020' F6 40             	or	040h
   38   0022' D3 99             	out	(099h),a
   39                           ;CIRCLE.C: 31: asm("ei");
   40                           	line	31
   31   0024' FB                ei ;#
   32                           ;CIRCLE.C: 32: (*(port unsigned char *)(0x98) = 
                                (byte));
   33                           	line	32
   34   0025' 79                	ld	a,c
   35   0026' D3 98             	out	(098h),a
   36                           ;CIRCLE.C: 33: }
   37                           	line	33
   38   0028' C9                	ret	
   39                           	global	_sc2
   40                           	signat	_sc2,24
   41   0000'                   	psect	data,class=DATA
   42   0000'                   F245:
   43   0000' 02                	defb	02h
   44   0001' 60                	defb	060h
   45   0002' 06                	defb	06h
   46   0003' FF                	defb	-1
   47   0004' 03                	defb	03h
   48   0005' 36                	defb	036h
   49   0006' 07                	defb	07h
   50   0007' 04                	defb	04h
   51                           	global	_NameTableInit
   52                           	signat	_NameTableInit,24
   53                           ;CIRCLE.C: 54: for (r =0;r<sizeof(vdpregs);r++)
   54   0029'                   	psect		text
   55                           	line	47
   56   0029'                   _sc2:
   57   0029' DD E5             	push	ix
   58   002B' DD 21 0000        	ld	ix,0
   59   002F' DD 39             	add	ix,sp
   60   0031' 3B                	dec	sp
   61                           ;CIRCLE.C: 48: unsigned char r;
   62                           	line	54


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   3


   63   0032' DD 36 FF 00       	ld	(ix+-1),0
   64                           	line	55
   65   0036'                   l8:
   66                           ;CIRCLE.C: 55: vdpsetreg(r,vdpregs[r]);
   67   0036' 21 0000'          	ld	hl,F245
   68   0039' DD 7E FF          	ld	a,(ix+-1)
   69   003C' 85                	add	a,l
   70   003D' 6F                	ld	l,a
   71   003E' 7C                	ld	a,h
   72   003F' CE 00             	adc	a,0
   73   0041' 67                	ld	h,a
   74   0042' 4E                	ld	c,(hl)
   75   0043' DD 5E FF          	ld	e,(ix+-1)
   76   0046' CD 0000'          	call	_vdpsetreg
   77                           ; _r loaded to e
   78                           	line	54
   79   0049' DD 5E FF          	ld	e,(ix+-1)
   80   004C' 1C                	inc	e
   81                           ;_r stored from e
   82   004D' DD 73 FF          	ld	(ix+-1),e
   83   0050' 7B                	ld	a,e
   84   0051' FE 08             	cp	08h
   85   0053' 38 E1             	jp	c,l8
   86                           ;CIRCLE.C: 60: asm("di");
   87                           	line	60
   60   0055' F3                di ;#
   61                           ;CIRCLE.C: 61: NameTableInit();
   62                           	line	61
   63   0056' CD 0000*          	call	_NameTableInit
   64                           ;CIRCLE.C: 63: vrampoke (0x2000,0xF1);
   65                           	line	63
   66   0059' 0E F1             	ld	c,-15
   67   005B' 11 2000           	ld	de,02000h
   68   005E' CD 0019'          	call	_vrampoke
   69                           ;CIRCLE.C: 64: for (counter=1;counter<3*256*8;co
                                unter++)
   70                           ; _counter allocated to bc
   71                           	line	64
   72   0061' 01 0001           	ld	bc,01h
   73                           	line	65
   74   0064'                   l11:
   75                           ;CIRCLE.C: 65: (*(port unsigned char *)(0x98) = 
                                (0xF1));
   76   0064' 3E F1             	ld	a,-15
   77   0066' D3 98             	out	(098h),a
   78                           	line	64
   79   0068' 03                	inc	bc
   80   0069' 11 1800           	ld	de,01800h
   81   006C' 69                	ld	l,c
   82   006D' 60                	ld	h,b
   83   006E' B7                	or	a
   84   006F' ED 52             	sbc	hl,de
   85   0071' 38 F1             	jp	c,l11
   86                           ;CIRCLE.C: 67: vrampoke (0x0000,0x00);
   87                           	line	67


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   4


   88   0073' 0E 00             	ld	c,0
   89   0075' 11 0000           	ld	de,0
   90   0078' CD 0019'          	call	_vrampoke
   91                           ;CIRCLE.C: 68: for (counter=1;counter<3*256*8;co
                                unter++)
   92                           	line	68
   93   007B' 01 0001           	ld	bc,01h
   94                           	line	69
   95   007E'                   l14:
   96                           ;CIRCLE.C: 69: (*(port unsigned char *)(0x98) = 
                                (0x00));
   97   007E' 3E 00             	ld	a,0
   98   0080' D3 98             	out	(098h),a
   99                           	line	68
  100   0082' 03                	inc	bc
  101   0083' 11 1800           	ld	de,01800h
  102   0086' 69                	ld	l,c
  103   0087' 60                	ld	h,b
  104   0088' B7                	or	a
  105   0089' ED 52             	sbc	hl,de
  106   008B' 38 F1             	jp	c,l14
  107                           ;CIRCLE.C: 70: }
  108                           	line	70
  109   008D' DD F9             	ld	sp,ix
  110   008F' DD E1             	pop	ix
  111   0091' C9                	ret	
  112                           	global	_plotpoints
  113                           	signat	_plotpoints,16440
  114                           	global	_pset
  115                           	signat	_pset,8248
  116                           ;CIRCLE.C: 72: void pset(unsigned char x, unsign
                                ed char y);
  117                           ;CIRCLE.C: 74: void plotpoints(unsigned int x, u
                                nsigned int y, unsigned int cx, unsigned int cy)
  118                           ;CIRCLE.C: 75: {
  119                           	line	75
  120   0092'                   _plotpoints:
  121   0092' DD E5             	push	ix
  122   0094' DD 21 0000        	ld	ix,0
  123   0098' DD 39             	add	ix,sp
  124   009A' C5                	push	bc
  125   009B' C5                	push	bc
  126   009C' FD E5             	push	iy
  127                           ;_y stored from bc
  128   009E' DD 71 FC          	ld	(ix+-4),c
  129   00A1' DD 70 FD          	ld	(ix+-3),b
  130                           ;_x stored from de
  131                           	line	76
  132   00A4' DD 73 FE          	ld	(ix+-2),e
  133   00A7' DD 72 FF          	ld	(ix+-1),d
  134                           ;CIRCLE.C: 76: pset((unsigned char)cx+x,(unsigne
                                d char)cy+y);
  135                           ; _cy loaded to iy
  136   00AA' DD 6E 06          	ld	l,(ix+6)
  137   00AD' DD 66 07          	ld	h,(ix+7)


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   5


  138   00B0' E5                	push	hl
  139   00B1' FD E1             	pop	iy
  140   00B3' 7D                	ld	a,l
  141   00B4' DD 86 FC          	add	a,(ix+-4)
  142   00B7' 4F                	ld	c,a
  143   00B8' DD 7E 04          	ld	a,(ix+4)
  144   00BB' DD 86 FE          	add	a,(ix+-2)
  145   00BE' 5F                	ld	e,a
  146   00BF' CD 0000*          	call	_pset
  147                           ;CIRCLE.C: 77: pset((unsigned char)cx-x,(unsigne
                                d char)cy+y);
  148                           	line	77
  149   00C2' FD E5             	push	iy
  150   00C4' E1                	pop	hl
  151   00C5' 7D                	ld	a,l
  152   00C6' DD 86 FC          	add	a,(ix+-4)
  153   00C9' 4F                	ld	c,a
  154   00CA' DD 7E 04          	ld	a,(ix+4)
  155   00CD' DD 96 FE          	sub	(ix+-2)
  156   00D0' 5F                	ld	e,a
  157   00D1' CD 0000*          	call	_pset
  158                           ;CIRCLE.C: 78: pset((unsigned char)cx-x,(unsigne
                                d char)cy-y);
  159                           	line	78
  160   00D4' FD E5             	push	iy
  161   00D6' E1                	pop	hl
  162   00D7' 7D                	ld	a,l
  163   00D8' DD 96 FC          	sub	(ix+-4)
  164   00DB' 4F                	ld	c,a
  165   00DC' DD 7E 04          	ld	a,(ix+4)
  166   00DF' DD 96 FE          	sub	(ix+-2)
  167   00E2' 5F                	ld	e,a
  168   00E3' CD 0000*          	call	_pset
  169                           ;CIRCLE.C: 79: pset((unsigned char)cx+x,(unsigne
                                d char)cy-y);
  170                           	line	79
  171   00E6' FD E5             	push	iy
  172   00E8' E1                	pop	hl
  173   00E9' 7D                	ld	a,l
  174   00EA' DD 96 FC          	sub	(ix+-4)
  175   00ED' 4F                	ld	c,a
  176   00EE' DD 7E 04          	ld	a,(ix+4)
  177   00F1' DD 86 FE          	add	a,(ix+-2)
  178   00F4' 5F                	ld	e,a
  179   00F5' CD 0000*          	call	_pset
  180                           ;CIRCLE.C: 81: pset((unsigned char)cx+y,(unsigne
                                d char)cy+x);
  181                           	line	81
  182   00F8' FD E5             	push	iy
  183   00FA' E1                	pop	hl
  184   00FB' 7D                	ld	a,l
  185   00FC' DD 86 FE          	add	a,(ix+-2)
  186   00FF' 4F                	ld	c,a
  187   0100' DD 7E 04          	ld	a,(ix+4)
  188   0103' DD 86 FC          	add	a,(ix+-4)


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   6


  189   0106' 5F                	ld	e,a
  190   0107' CD 0000*          	call	_pset
  191                           ;CIRCLE.C: 82: pset((unsigned char)cx-y,(unsigne
                                d char)cy+x);
  192                           	line	82
  193   010A' FD E5             	push	iy
  194   010C' E1                	pop	hl
  195   010D' 7D                	ld	a,l
  196   010E' DD 86 FE          	add	a,(ix+-2)
  197   0111' 4F                	ld	c,a
  198   0112' DD 7E 04          	ld	a,(ix+4)
  199   0115' DD 96 FC          	sub	(ix+-4)
  200   0118' 5F                	ld	e,a
  201   0119' CD 0000*          	call	_pset
  202                           ;CIRCLE.C: 83: pset((unsigned char)cx-y,(unsigne
                                d char)cy-x);
  203                           	line	83
  204   011C' FD E5             	push	iy
  205   011E' E1                	pop	hl
  206   011F' 7D                	ld	a,l
  207   0120' DD 96 FE          	sub	(ix+-2)
  208   0123' 4F                	ld	c,a
  209   0124' DD 7E 04          	ld	a,(ix+4)
  210   0127' DD 96 FC          	sub	(ix+-4)
  211   012A' 5F                	ld	e,a
  212   012B' CD 0000*          	call	_pset
  213                           ;CIRCLE.C: 84: pset((unsigned char)cx+y,(unsigne
                                d char)cy-x);
  214                           	line	84
  215   012E' FD E5             	push	iy
  216   0130' E1                	pop	hl
  217   0131' 7D                	ld	a,l
  218   0132' DD 96 FE          	sub	(ix+-2)
  219   0135' 4F                	ld	c,a
  220   0136' DD 7E 04          	ld	a,(ix+4)
  221   0139' DD 86 FC          	add	a,(ix+-4)
  222   013C' 5F                	ld	e,a
  223   013D' CD 0000*          	call	_pset
  224                           ;CIRCLE.C: 86: }
  225                           	line	86
  226   0140' FD E1             	pop	iy
  227   0142' DD F9             	ld	sp,ix
  228   0144' DD E1             	pop	ix
  229   0146' E1                	pop	hl
  230   0147' F1                	pop	af
  231   0148' F1                	pop	af
  232   0149' E9                	jp	(hl)
  233                           	global	_circle
  234                           	signat	_circle,12344
  235                           	global	wrelop
  236                           ;CIRCLE.C: 89: void circle(unsigned int cx, unsi
                                gned int cy, unsigned int radius)
  237                           ;CIRCLE.C: 90: {
  238                           	line	90
  239   014A'                   _circle:


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   7


  240   014A' DD E5             	push	ix
  241   014C' DD 21 0000        	ld	ix,0
  242   0150' DD 39             	add	ix,sp
  243   0152' C5                	push	bc
  244   0153' C5                	push	bc
  245   0154' C5                	push	bc
  246   0155' C5                	push	bc
  247   0156' FD E5             	push	iy
  248                           ;_cy stored from bc
  249                           	line	92
  250   0158' DD 71 FC          	ld	(ix+-4),c
  251   015B' DD 70 FD          	ld	(ix+-3),b
  252                           ;_cx stored from de
  253   015E' DD 73 FE          	ld	(ix+-2),e
  254   0161' DD 72 FF          	ld	(ix+-1),d
  255                           ;CIRCLE.C: 91: int x, y, d;
  256                           ; _x allocated to iy
  257   0164' FD 21 0000        	ld	iy,0
  258   0168' DD 6E 04          	ld	l,(ix+4)
  259   016B' DD 66 05          	ld	h,(ix+5)
  260   016E' DD 75 F8          	ld	(ix+-8),l
  261   0171' DD 74 F9          	ld	(ix+-7),h
  262                           ;CIRCLE.C: 93: d = 3 - 2*radius;
  263                           ; _d allocated to bc
  264                           	line	93
  265   0174' 29                	add	hl,hl
  266   0175' EB                	ex	de,hl
  267   0176' 21 0003           	ld	hl,03h
  268   0179' B7                	or	a
  269   017A' ED 52             	sbc	hl,de
  270   017C' E5                	push	hl
  271   017D' C1                	pop	bc
  272                           ;CIRCLE.C: 94: while (x<y)
  273                           	line	94
  274   017E' 18 5A             	jp	l19
  275   0180'                   l20:
  276                           ;CIRCLE.C: 95: {
  277                           	line	96
  278   0180' DD 6E FC          	ld	l,(ix+-4)
  279   0183' DD 66 FD          	ld	h,(ix+-3)
  280   0186' E5                	push	hl
  281   0187' DD 6E FE          	ld	l,(ix+-2)
  282   018A' DD 66 FF          	ld	h,(ix+-1)
  283   018D' E5                	push	hl
  284   018E' DD 4E F8          	ld	c,(ix+-8)
  285   0191' DD 46 F9          	ld	b,(ix+-7)
  286   0194' FD E5             	push	iy
  287   0196' D1                	pop	de
  288   0197' CD 0092'          	call	_plotpoints
  289                           ;CIRCLE.C: 97: if ( d<0 )
  290                           ; _d loaded to bc
  291                           	line	97
  292   019A' DD 4E FA          	ld	c,(ix+-6)
  293   019D' DD 46 FB          	ld	b,(ix+-5)
  294   01A0' CB 78             	bit	07h,b


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   8


  295   01A2' 28 10             	jp	z,l22
  296                           ;CIRCLE.C: 98: d = d + 4*x + 6;
  297                           	line	98
  298   01A4' 59                	ld	e,c
  299   01A5' 50                	ld	d,b
  300   01A6' FD E5             	push	iy
  301   01A8' E1                	pop	hl
  302   01A9' 29                	add	hl,hl
  303   01AA' 29                	add	hl,hl
  304   01AB' 19                	add	hl,de
  305   01AC' 11 0006           	ld	de,06h
  306   01AF' 19                	add	hl,de
  307   01B0' E5                	push	hl
  308   01B1' C1                	pop	bc
  309                           ;CIRCLE.C: 99: else
  310   01B2' 18 24             	jp	l23
  311                           	line	99
  312   01B4'                   l22:
  313                           ;CIRCLE.C: 100: {
  314                           	line	101
  315   01B4' DD 5E F8          	ld	e,(ix+-8)
  316   01B7' DD 56 F9          	ld	d,(ix+-7)
  317   01BA' FD E5             	push	iy
  318   01BC' E1                	pop	hl
  319   01BD' B7                	or	a
  320   01BE' ED 52             	sbc	hl,de
  321   01C0' 29                	add	hl,hl
  322   01C1' 29                	add	hl,hl
  323   01C2' 59                	ld	e,c
  324   01C3' 50                	ld	d,b
  325   01C4' 19                	add	hl,de
  326   01C5' 11 000A           	ld	de,0Ah
  327   01C8' 19                	add	hl,de
  328   01C9' E5                	push	hl
  329   01CA' C1                	pop	bc
  330                           ;CIRCLE.C: 102: y--;
  331                           	line	102
  332   01CB' DD 6E F8          	ld	l,(ix+-8)
  333   01CE' DD 66 F9          	ld	h,(ix+-7)
  334   01D1' 2B                	dec	hl
  335   01D2' DD 75 F8          	ld	(ix+-8),l
  336   01D5' DD 74 F9          	ld	(ix+-7),h
  337                           	line	103
  338   01D8'                   l23:
  339                           ;CIRCLE.C: 103: }
  340                           ;CIRCLE.C: 104: x++;
  341                           	line	104
  342   01D8' FD 23             	inc	iy
  343                           	line	105
  344   01DA'                   l19:
  345                           ;CIRCLE.C: 105: }
  346                           ;_d stored from bc
  347                           	line	104
  348   01DA' DD 71 FA          	ld	(ix+-6),c
  349   01DD' DD 70 FB          	ld	(ix+-5),b


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page   9


  350                           	line	94
  351   01E0' DD 5E F8          	ld	e,(ix+-8)
  352   01E3' DD 56 F9          	ld	d,(ix+-7)
  353   01E6' FD E5             	push	iy
  354   01E8' E1                	pop	hl
  355   01E9' CD 0000*          	call	wrelop
  356   01EC' FA 0180'          	jp	m,l20
  357                           ;CIRCLE.C: 106: if (x==y)
  358                           	line	106
  359   01EF' DD 4E F8          	ld	c,(ix+-8)
  360   01F2' DD 46 F9          	ld	b,(ix+-7)
  361   01F5' FD E5             	push	iy
  362   01F7' E1                	pop	hl
  363   01F8' B7                	or	a
  364   01F9' ED 42             	sbc	hl,bc
  365   01FB' 20 14             	jp	nz,l18
  366                           ;CIRCLE.C: 107: plotpoints(x, y, cx, cy);
  367                           	line	107
  368   01FD' DD 6E FC          	ld	l,(ix+-4)
  369   0200' DD 66 FD          	ld	h,(ix+-3)
  370   0203' E5                	push	hl
  371   0204' DD 6E FE          	ld	l,(ix+-2)
  372   0207' DD 66 FF          	ld	h,(ix+-1)
  373   020A' E5                	push	hl
  374   020B' FD E5             	push	iy
  375   020D' D1                	pop	de
  376   020E' CD 0092'          	call	_plotpoints
  377                           ;CIRCLE.C: 108: }
  378                           	line	108
  379   0211'                   l18:
  380   0211' FD E1             	pop	iy
  381   0213' DD F9             	ld	sp,ix
  382   0215' DD E1             	pop	ix
  383   0217' E1                	pop	hl
  384   0218' F1                	pop	af
  385   0219' E9                	jp	(hl)
  386                           	global	_main
  387                           	signat	_main,24
  388                           	global	_exec_time
  389                           ;CIRCLE.C: 111: int exec_time;
  390                           ;CIRCLE.C: 113: void main(void)
  391                           ;CIRCLE.C: 114: {
  392                           	line	114
  393   021A'                   _main:
  394   021A' DD E5             	push	ix
  395   021C' DD 21 0000        	ld	ix,0
  396   0220' DD 39             	add	ix,sp
  397   0222' 3B                	dec	sp
  398                           ;CIRCLE.C: 116: unsigned char px;
  399                           	line	119
  400   0223' CD 0029'          	call	_sc2
  401                           ;CIRCLE.C: 121: *(int*)0xFC9E = 0;
  402                           	line	121
  403   0226' 21 0000           	ld	hl,0
  404   0229' 22 FC9E           	ld	(-866),hl


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page  10


  405                           ;CIRCLE.C: 123: for (px=0;px<96;px+=2)
  406                           	line	123
  407   022C' DD 75 FF          	ld	(ix+-1),l
  408                           	line	124
  409   022F'                   l26:
  410                           ;CIRCLE.C: 124: {
  411                           ;CIRCLE.C: 125: circle(127,95, px);
  412                           	line	125
  413   022F' DD 6E FF          	ld	l,(ix+-1)
  414   0232' 26 00             	ld	h,0
  415   0234' E5                	push	hl
  416   0235' 01 005F           	ld	bc,05Fh
  417   0238' 11 007F           	ld	de,07Fh
  418   023B' CD 014A'          	call	_circle
  419                           ;CIRCLE.C: 126: }
  420                           ; _px loaded to c
  421                           	line	123
  422   023E' DD 4E FF          	ld	c,(ix+-1)
  423   0241' 0C                	inc	c
  424   0242' 0C                	inc	c
  425                           ;_px stored from c
  426   0243' DD 71 FF          	ld	(ix+-1),c
  427   0246' 79                	ld	a,c
  428   0247' FE 60             	cp	060h
  429   0249' 38 E4             	jp	c,l26
  430                           ;CIRCLE.C: 127: exec_time = (*(int*)0xFC9E);
  431                           	line	127
  432   024B' 2A FC9E           	ld	hl,(-866)
  433   024E' 22 0000'          	ld	(_exec_time),hl
  434                           ;CIRCLE.C: 129: while(1) {}
  435                           	line	129
  436   0251'                   l29:
  437   0251' 18 FE             	jp	l29
  438   0000'                   	psect	bss,class=DATA
  439   0000'                   _exec_time:
  440   0000'                   	defs	2
  441   0253'                   	psect		text


HI-TECH SOFTWARE Z80 Macro Assembler                  Thu Sep 23 22:43:16 2010

                                                                      Page  11



                      ---------- Symbol Table ----------

         (ABS) 0000#            CODE 0000             CODE 0000   
          CODE 0000             DATA 0000             DATA 0000   
          DATA 0000             DATA 0000             DATA 0000   
          DATA 0000             F245 0000'  _NameTableInit 0000*  
       _circle 014A'      _exec_time 0000'           _main 021A'  
   _plotpoints 0092'           _pset 0000*            _sc2 0029'  
    _vdpsetreg 0000'       _vrampeek 000B'       _vrampoke 0019'  
           bss 0000#            data 0008#             l11 0064'  
           l14 007E'             l18 0211'             l19 01DA'  
           l20 0180'             l22 01B4'             l23 01D8'  
           l26 022F'             l29 0251'              l8 0036'  
   small_model 0000*            text 0253#          wrelop 0000*  

9 jump optimizations

Van PingPong

Prophet (3447)

afbeelding van PingPong

08-09-2019, 12:49

[quote=zPasi wrote:
PingPong wrote:
Quote:

The reality: if the developer stops one should hope that another will carry on the development of the project itself-

Irrelevant. If the developers abandon a project, the sources will not immediately disappear. Even if they decide to remove the sources from Git, a number of users will still have them and eventually someone will upload them back or to somewhere else.

Instead relevant. you are stuck like a in commercial program unless you are able to build this on your machine. That's not guarateed at 100%.

Quote:

Usually when a software stops working due os major revision change, you just have to recompile the thing to get it working again. Sometimes also minor fixes are required. But you cannot do that without the sources.

not nearly true at 100%. It does depend on the thing that is stopping you.

Quote:

About SDCC, it's user base is large enough to guarantee that its development will not stop any time soon. But in the worst case, we still would have the sources.

Large enough? and what are interested in z80 target? For some of the other targets there are surely better alternatives.

Quote:

I think also that if one contact Hitech-C and ask to put publicly available the source they will acknoledge.
I doubt that.

Who are you to said this? The owner of the Microchip or Hitech-C ?
More probably they are not replying because we are not reaching them properly. (like old email or so)
If they do not want to release as opensource they surely reply their denial to you to have a reason to pursuit you ( even this sound simply ridiculus )

When Nintendo (that is iper protective on license) want to pursue you first they try to contact you to dissuade.
So i do not think Hitech C will waste time to keep silent and later issue a legal action to MSX people.

Van Grauw

Ascended (8439)

afbeelding van Grauw

08-09-2019, 12:51

So contact them then…

Van jltursan

Prophet (2177)

afbeelding van jltursan

08-09-2019, 13:08

Seems that the email legal.department@microchip.com is the only valid way to contact them about this matter.

Van PingPong

Prophet (3447)

afbeelding van PingPong

08-09-2019, 13:21

to see the difference one should also publish the SDCC asm code.
But see, the compiler uses a lot two 16 bit reg pair to pass parameter instead of stack. only when it run out it does push parameters. This results in faster and momre compact code in a lot of situations, because z80 is not so good at relative stack addressing as we know.

Van Grauw

Ascended (8439)

afbeelding van Grauw

08-09-2019, 13:34

At least this part is looking pretty good:

  262                           ;CIRCLE.C: 93: d = 3 - 2*radius;
  263                           ; _d allocated to bc
  264                           	line	93
  265   0174' 29                	add	hl,hl
  266   0175' EB                	ex	de,hl
  267   0176' 21 0003           	ld	hl,03h
  268   0179' B7                	or	a
  269   017A' ED 52             	sbc	hl,de

Using add hl,hl for multiplications by 2, usage of ex de,hl…

  270   017C' E5                	push	hl
  271   017D' C1                	pop	bc

But then this part which follows seems very obviously and trivially optimisable to ld l,c / ld b,h.

(Of course since it’s closed source and dead for decades there is no way to improve this.)

Van zPasi

Champion (471)

afbeelding van zPasi

08-09-2019, 13:52

PingPong, your quotes are a mess. I'll try to guess which text is yours...

PingPong wrote:

Instead relevant. you are stuck like a in commercial program unless you are able to build this on your machine. That's not guarateed at 100%

Of course I can build SDCC on my machine, so it is 100% quaranteed.

Quote:

Large enough? and what are interested in z80 target? For some of the other targets there are surely better alternatives.

Large enough. In addition to the MSX community, there are communities and developers targeting ZX Spectrum, Amstrad CPC, Coleco, old arcade boards, etc.

Quote:

Who are you to said this? The owner of the Microchip or Hitech-C ?

I can't doubt something without owning Microchip? Right.

So contact them and tell us what (if) they reply.

Don't preach unless you are a priest. Use Hi-tech c if you want, and let others use whatever we want.

Van PingPong

Prophet (3447)

afbeelding van PingPong

08-09-2019, 15:21

yeah, about the quotes you are absolutely right. Replying from a mobile device makes things even worse because of automatic corrections :-(

About the build, this is also true for me, i can build from sources, but speaking on actual situation. what does happen is, that when a project is abandoned difficulties arise.

About community size, well i thing almost two order of magnitute larger. This is the size that ensure statistically the possibility to keep a project going on.
As a prove of insuffient comunity i ask you a simple question: why, if the community is large enough there is no pratically a good evolution on SDCC compiler in terms of performances? SDCC is active for long enough but improvements are very small. that's the point. lack of interest and small community

About the use of what compiler one want to use i'm not killing anyone. To me as said multiple times what matter is the efficience ( or deficience in the case of SDCC ) of the code generated.

Let's compile artrag source with SDCC and do a comparison. Then see the difference. Stop.

Next, you are able to develop for msx with anything you want, that's your problem. To me, i live happy even if you manage to program your msx using a punching card reader.

Pagina 5/17
1 | 2 | 3 | 4 | | 6 | 7 | 8 | 9 | 10