C compiler??

Página 4/4
1 | 2 | 3 |

Por Sonic_aka_T

Enlighted (4130)

Imagen del Sonic_aka_T

30-03-2005, 01:13

Could this little gem have been written in C? I once found it by debugging a game whose author I'll do the courtesey of leaving anonymous. It's one of the biggest software houses out there, whose games we all love Wink

CheckCE:
	PUSH	AF
	PUSH	BC
	DI
	LD	A,$02
	LD	C,$99
	OUT	(C),A
	LD	A,$8F
	OUT	(C),A
	LD	BC,($F421)
	NOP
	IN	A,(C)
	PUSH	AF
	PUSH	HL
	POP	HL
	XOR	A
	LD	C,$99
	OUT	(C),A
	LD	A,$8F
	OUT	(C),A
	POP	AF
	EI
	AND	$01
	JR	NZ,-$24	; DI
	POP	BC
	POP	AF
	RET

Por AuroraMSX

Paragon (1901)

Imagen del AuroraMSX

30-03-2005, 10:22

Some remarks about HiTech-C:
HiTech-C's assembler can do macros but the syntax for the definition is somewhat unusual, e.g.:
macro pop2, rp1, rp2
pop rp1
pop rp2
endm

Hm, I think I tried that and failed. I'll retry some day, and then I'll know whom to jump at Wink

To get limited support for subdirectories during compilation use cc.com, your program must still be in one subdirectory, but the standard header files and libraries can be in another.
/me prefers gcc -E + htc + cpmemu on Linux Smile
The only drawback of cross-development with this combination is that the cpmemu crashes on occasion Sad and f**ks up the console.

I'm still dreaming of writing an optimiser that will improve constructs like:
ld (ix-2),l
ld (ix-1),h
ld l,(ix-2)
ld h,(ix-1)

It surely must be possible to write an optimizer in e.g python, perl or lex/yacc and embed it in the compilation process...

Por AuroraMSX

Paragon (1901)

Imagen del AuroraMSX

30-03-2005, 10:36

Could this little gem have been written in C?
There are some constructs indicating that it's a piece of compiled code, indeed. But I would not be able to tell whether the original code was in C, Pascal, Modula or even Java Wink

Give-aways:

	LD	A,$02
	LD	C,$99
	OUT	(C),A

get var, get var, out ...

	PUSH	HL
	POP	HL

This is the most obvious hint Smile

Página 4/4
1 | 2 | 3 |