⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 choices.txt

📁 很少见的源码公开的msc51和z80的c编译器。
💻 TXT
字号:
Some of the implementation choices----------------------------------gbz80:Load from direct space:  Alternatives:  1.  Via HL	ld hl,#dir	ld x,(hl)	inc hl	ld y,(hl)  2.  Via a  	ld a,(dir)	ld x,a	ld a,(dir+1)	ld x,a  1 is bad when x or y involve HL (1b)  					8	16	32     1 = 12 + n*(8+8) - 8  		20	36	68     1b = n*(12+12+8)			32	64	128     2 = n*(16+4)			20	40	80  So choose 2.  Hmm.  (2) is too hard to support in the current model.On stack word push   1.	 lda  hl,x(sp)	 ld   a,(hl+)	 ld   h,(hl)	 ld   l,a	 push hl   2.	 lda  hl,x(sp)	 ld   e,(hl)	 inc  hl	 ld   d,(hl)   1 = d + 8 + 8 + 4   2 = d + 8 + 8 + 8Structure member get:   Normally fetch pair   Then add pair and constant with result in hl   ld	l,c	; 4   ld	h,b	; 4   inc  hl ..	; 6	= 8 + 6nor   ld	l,c	; 4   ld	h,b	; 4   ld	a,#0x06	; 7   add	a,c	; 4   ld	l,a	; 4   ld	a,#0x00 ; 7   adc	a,b	; 4   ld	h,a	; 4	= 38alt: (only when result=hl and left, rigth = pair, const)   ld	   hl,#const	; 10   add	   hl,pair	; 11	= 21So (1) is best for n <= 2, (2) is just bad, (3) is good n > 2How about:    pair = pair + constant:1:    ld	a,#0x08	; 7    add	a,c	; 4    ld	c,a	; 4    ld	a,#0x00	; 7    adc	a,b	; 4    ld	b,a	; 4	= 302:	ld	hl,#const	; 10	add	hl,pair		; 11	ld	c,l		; 4	ld	b,h		; 4	= 29One cycle.  If I cache HL later it will throw away the advantage.  Choose 1.PlusIncr on pairs:1:	 inc	pair		; 6 	= 6n2:	ld	a,#0x04		; 7	add	a,c		; 4	ld	c,a		; 4	ld	a,#0x00		; 7	adc	a,b		; 4	ld	b,a		; 4 	= 30So n <= 5 (1) is better.Frame pointer:It's nice to use HL as the temp register, but what if I used it as theframe pointer instead of ix?Instead of:	ld	e,5(ix)		; 19	ld	d,6(ix)		; 19	= 38	ld	hl,#5		; 10	add	hl,sp		; 11	ld	e,(hl)		; 7	inc	hl		; 6	ld	d,(hl)		; 7	= 41Things get better when you access the same set over, as you get ridof the setup.  But they get worse when both ops are on the stack/indirect space.  Easiest this way for now.  iy may benifit...	 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -