View Single Post
Old 06 September 2019, 20:55   #3
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 829
@jotd

Look here https://github.com/shaunlebron/pacma...isasm/bart.asm

In ancient times I also thought about perfect pacman port. And I thought about converter from Z80 --> mc68000. Of course I did nothing - just disasm some block of code and I stuck with z80 code.

Lets focus on simple z80 routine. (Code taken from bart.asm)

Code:
; ( rst 8 - Fill (HL)...(HL+B) with Accumulator )
[0x8] 8       0x77    LD (HL), A                  ;  Load location (HL) with Accumulator
[0x9] 9       0x23    INC HL                      ;  Increment register pair HL
[0xa] 10      0x10    DJNZ N          fc          ;  Decrement B and jump relative 0xfc (-4) if B!=0
[0xc] 12      0xc9    RET                         ;  Return
The converter should convert it in following way (assumption D0 = reg A, D1 - B, A3 - HL )
Code:
label08:	move.b	D0,(a3)		;label08:	0x77	->	ld	(hl),a
		addq.w	#1,a3		;		0x23	->	inc	hl
		dbf	d1,label08	;		0x10	0xfc	->	djnz	label08
		rts			;		0xc9	->	ret
Am I right or it just my imagination about perfect world ?

Of course its only idea. So first question which comes to my mind is about best usage of 68k registers for z80 register (mapping). How it usually done ?


edit: changed addq.b --> addq.w. Thanks to hitchhikr.

Last edited by Asman; 06 September 2019 at 23:03.
Asman is offline  
 
Page generated in 0.05703 seconds with 12 queries