Help with ASM code (executing external program)

Par AxelStone

Prophet (3199)

Portrait de AxelStone

01-03-2016, 14:47

Hi everybody, I need help of ASM coders. I'd like to use Animecha (a powerful animation editor) in my app. Animecha provides 2 players: in Basic and DOS (DPLAY).

In order to use DOS version with C/Pascal, I've found ASM sources of DPLAY. DPLAY ends with RET command, so returns to DOS. The idea should be modify it in order to execute external program so the game flow can continue after animation. The routine should end in something like:

exec GAME.com (I don't know the sintaxis)

DPLAY sources can be found here. Any help should be greatly apreciated.

Thanks :)

!login ou Inscrivez-vous pour poster

Par NYYRIKKI

Enlighted (6093)

Portrait de NYYRIKKI

01-03-2016, 15:54

Ever heard of .BAT-files? It is DOS integrated feature for handling loading exactly like you described.

Par AxelStone

Prophet (3199)

Portrait de AxelStone

01-03-2016, 18:49

Yeah I love bat files, was my first try but you lose flow control. This is you cannot decide in realtime jump from game to certain intro, they should be executed in the fixed order defined in the bat.

Par NYYRIKKI

Enlighted (6093)

Portrait de NYYRIKKI

01-03-2016, 19:30

In DOS2 you can do this with BAT-file without breaking the flow control by using variables, but indeed this is not very good way to go... I've seen even people using keyboard buffer for loading next part, but... don't.

Practically I think that it is enough to put parameters to #80, load the program to #100 and call it from same address. DOS actually does quite some more tricks, but I would not worry too much about those... They are probably not needed anyway. If you want to take a closer look, what DOS does, COMMAND2.COM 2.41 sources are available here. I would say most important part is that you select such an address for your own program that the external program does not write it over.

Par NYYRIKKI

Enlighted (6093)

Portrait de NYYRIKKI

01-03-2016, 19:40

Ah, I noticed that DPLAY takes filename as a parameter... In this you need to create unopened FCB for the parameter file to #5C before you call the program...

Par NYYRIKKI

Enlighted (6093)

Portrait de NYYRIKKI

01-03-2016, 20:20

I imagine the routine could look something like:


	; Program to be excuted from safe location:

	LD DE,#100	;DOS program load address
	LD C,#1A	;SET DATA TRANSFER ADDRESS
	CALL 5
 
	LD DE,LOADFCB	;FCB
 
	LD C,#F 	;Open
        PUSH DE
	CALL 5
	POP DE
 
	LD HL,1
	LD (LOADFCB+#E),HL
 
	LD HL,#4000
	LD C,#27	;Read max 16K
        PUSH DE
	CALL 5
	POP DE
 
	LD C,#10        ;Close
	CALL 5

	LD HL,PARAMFCB
	LD DE,#5C
	LD BC,#10
	LDIR

	CALL #100	; Execute "DPLAY PARAMS_1.TXT"

	RET

PARAMFCB:
	DB 0,"PARAMS_1TXT",0

LOADFCB:
	DB 0,"DPLAY   COM",0

Par AxelStone

Prophet (3199)

Portrait de AxelStone

01-03-2016, 23:14

Thanks NYYRIKKI, I've located Exit function of code. I think that easiest way is to insert ASM code to call external function, I've generated this ASM in MSX-C. However I've a trouble with attached DPLAY sources: none of MSX editors can handle them. What ASM editor do you use?

Thanks.

Par Manuel

Ascended (19682)

Portrait de Manuel

01-03-2016, 23:19

It's plain ascii text, you can use any editor...

Par AxelStone

Prophet (3199)

Portrait de AxelStone

02-03-2016, 14:13

I thought that, but I get a lot of ^J inside the source oO

Par AxelStone

Prophet (3199)

Portrait de AxelStone

02-03-2016, 22:16

Let's change the question: someone can compile DPLAY.ASM and confirm me with compiler to use? I've tried with M80 compiler under OpenMSX but I get Fatal Error, I think that it's caused by strange caracters shown when I try to edit.

Par arnold_m

Master (173)

Portrait de arnold_m

05-03-2016, 22:26

The sources have unix-style line endings (only LF=^J). For use on MSX you'll want to changes the line endings to CRLF=^M^J. Emacs will do do this for you if you click the colon in the status bar, but there are other ways to do it.