View Single Post
Old 14 September 2014, 15:37   #32
AnimaInCorpore
Registered User
 
Join Date: Nov 2012
Location: Willich/Germany
Posts: 165
Ok, here a short description why the source code is universal. It can be assembled and run on the X68000 and with only a few lines changed with additional TRAP and LINEF handlers the same source runs on a Atari ST as well (without any graphics emulation).

Addresses for interrupt vectors and X68000 memory mapped adresses are defined as follows (Pac-Mania):

Code:
	move.l  L_0000007C,OLD_7C_HANDLER.l
	move.l  #NULL_NMI_HANDLER,L_0000007C
	move.l  L_000000AC,OLD_AC_HANDLER.l
	move.l  #NULL_IRQ_HANDLER,L_000000AC
	move.l  L_000000B0,OLD_B0_HANDLER.l
	move.l  #NULL_IRQ_HANDLER,L_000000B0
	move.l  L_000000B4,OLD_B4_HANDLER.l
	move.l  #NULL_IRQ_HANDLER,L_000000B4
	move.l  L_000000B8,OLD_PROGRAM_ERROR_HANDLER.l
	move.l  #PROGRAM_ERROR_HANDLER,L_000000B8
The example above shows the interrupt vectors initialisation. The X68000 source has simply the label definitions like this: "L_0000007C = 0x0000007c" where the Atari source has the label pointing to a long word within the BSS area.

The VBL handling would look like this:
Code:
vbl:
	[Your code]

	move.l	L_00000118,-(sp)
	beq.s	_vbl_no_vdisp_handler

	rts

_vbl_no_vdisp_handler:
	addq.l	#4,sp

	rte
Here the handling of memory mapped registers: the X68000 target has the label defined as being described above where the Atari source defines a buffer within the BSS area:
Code:
	move.w  L_00E80000+0x2A.l,OLD_CRTC_PLANE_ACCESS_MODE_REGISTER.l
	move.w  #0x0,L_00E80000+0x2A.l
	move.w  L_00E82000+0x500.l,OLD_VIDEO_CONTROLLER_PRIORITY_REGISTER.l
	move.w  #0x12E4,L_00E82000+0x500.l
	move.w  L_00E82000+0x600.l,OLD_VIDEO_CONTROLLER_SPECIAL_PRIORITY_REGISTER.l
	move.w  #0x0,L_00E82000+0x600.l
	move.w  L_00EB0000+0x808.l,OLD_BG_CONTROL_REGISTER.l
	move.w  #0x212,L_00EB0000+0x808.l
Code:
L_00E80000:   | CRTC
	ds.b    0x2000
L_00E82000:   | VIDEO CONTROLLER
	ds.b    0x2000
L_00EB0000:   | SPRITE REGISTERS
	ds.b    0x8000
All you now need to do is to read the X68000 registers from the BSS area and emulate it.
AnimaInCorpore is offline  
 
Page generated in 0.04174 seconds with 11 queries