Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tim Paterson's trans.asm #3

Closed
tkchia opened this issue Jun 6, 2021 · 7 comments
Closed

Tim Paterson's trans.asm #3

tkchia opened this issue Jun 6, 2021 · 7 comments

Comments

@tkchia
Copy link
Contributor

tkchia commented Jun 6, 2021

Hello @ibara,

Cool program, thanks!

Out of curiosity, how does 8088ify compare with Tim Paterson's Z80-to-8086 translator trans.asm?

I see that Microsoft open-sourced the trans.asm code as part of their MS-DOS 1.x source release, though they did not really publicize this fact. I have managed to "port" trans.asm to assemble with nasm.

Thank you!

@ibara
Copy link
Owner

ibara commented Jun 6, 2021

Hello --

Other than 8088ify being able to be built for any platform that has access to a C compiler and a minimal libc, I'm not sure.
I only learned about trans.asm maybe an hour or two ago. I haven't tried it yet.

With mine, I followed the Intel EXACT translations and only the EXACT translations. The reading I've been doing suggests that APPROX would be fine most of the time but I can't confirm the validity of that. If trans.asm follows APPROX, it will generate slightly more compact code.

It is also possible that trans.asm targets the small memory model whereas I target the tiny memory model. I'd like to eventually move to at least having an option for the small memory model, since it will take care of those programs that just barely fit into CP/M (and therefore may just barely not fit into MS-DOS tiny model). DRI's XLT86 does some version of small memory model from what their documentation suggests.

@ibara
Copy link
Owner

ibara commented Jun 7, 2021

Hello again --

I tried using your ported version of trans.asm but when I try to use it, it replaces the input file with a blank file of the same name. So I must have the invocation incorrect. Is it trans.asm <inputfile>? Or is there something more I need to do?

@tkchia
Copy link
Contributor Author

tkchia commented Jun 7, 2021

Hello @ibara,

Thanks! I have not tested trans.asm very much --- I should probably do that more! --- but it seems that it needs the input to be in a file that has an extension other than .asm. The output file will have the same name stem but extension .asm. E.g. if you say

trans.asm foo.z80

then it will use foo.z80 as the input, and foo.asm as the output.

Thank you!

@ibara
Copy link
Owner

ibara commented Jun 8, 2021

Hello --

I tried trans.com but it does not appear to work correctly (on DOSBox, at least).

For this Z80 assembly:

; Hello world for Zilog Z80 running CP/M
	ORG	100H
BDOS	EQU	0005H
START:	LD	HL,MSG
LOOP:	LD	C,02H
	LD	E,(HL)
	PUSH	HL
	CALL	BDOS
	POP	HL
	INC	HL
	LD	A,E
	CP	0AH
	JP	NZ,LOOP
	RET
MSG:	DB	'Hello, world from Assembler!',0DH,0AH
	END

You get this output from trans.com:

	; Hello world for Zilog Z80 running CP/M
	ORG	100HCBDOS	0005H
START:	MOV	BX,MSGCLOOP:	LD	C,02H
	MOV	DL,[BX]C	PUSH	HL
	JA	L0000
	CALL	POP
L0000:		HL
	LAHF
	INC	BXC
	SAHF	A,E
	CMP	0AHC,JP	NZ,LOOP
RET
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	AH

	
	DOS
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	P
	
	
	OOP
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	POP	HL
	INC	HL
	LD	A,E
	CP	0AH
	JP	NZ,LOOP
	RET
MSG:	DB	'Hello, world from Assembler!',0DH,0AH
	END

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	�HELLO   ASM
	
	 	,
*** Opcode Error 
MSG:	DB	'Hello, world from Assembler!',0DH,0AH
END
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	AH

	
	DOS
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	P
	
	
	OOP
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	POP	HL
	INC	HL
	LD	A,E
	CP	0AH
	JP	NZ,LOOP
	RET
MSG:	DB	'Hello, world from Assembler!',0DH,0AH
	END

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	�HELLO   ASM
	
	 	,
*** Opcode Error 
                          ��������������������������������������������������������������������������

@tkchia
Copy link
Contributor Author

tkchia commented Jun 8, 2021

Hello @ibara,

Perhaps try changing the line endings from LF to CRLF?

I am getting the following output, under both MS-DOS 2.11 and FreeDOS 1.3-rc4:

	; Hello world for Zilog Z80 running CP/M
	ORG	100H
BDOS:	EQU	0005H
START:	MOV	BX,MSG
LOOP:	MOV	CL,02H
	MOV	DL,[BX]
	PUSH	BX
	CALL	BDOS
	POP	BX
	LAHF
	INC	BX
	SAHF
	MOV	AL,DL
	CMP	AL,0AH
	JNZ	LOOP
	RET
MSG:	DB	'Hello, world from Assembler!',0DH,0AH
	END	,
*** Opcode Error 
���������������������������������������������������������������������������������

(It does seem that TRANS.ASM is using EXACT translations, or something close to them.)

Thank you!

@tkchia
Copy link
Contributor Author

tkchia commented Jun 9, 2021

Hello @ibara,

In any case, thanks very much for your earlier reply!

@tkchia tkchia closed this as completed Jun 9, 2021
@ibara
Copy link
Owner

ibara commented Jun 9, 2021

Hello --

Sorry for the delayed reply. I haven't gotten around to changing the LF to CRLF but I trust you that it works!
I wonder how trans.asm handles the Z80 extensions. That would be good to know. But I can do that myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants