Skip to content

Commit

Permalink
Adapt XBIOS asm routine for Coldfire
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Nov 7, 2009
1 parent 42f2275 commit 07f983e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/video/ataricommon/SDL_xbiosinterrupt.S
Expand Up @@ -53,7 +53,12 @@ _SDL_AtariXbios_Install:
clrl oldmousevector
movel sp@(8),d0
beqs no_new_mouse_vector
#if defined(__mcoldfire__)
movel a0@(16),d1
movel d1,oldmousevector
#else
movel a0@(16),oldmousevector
#endif
movel d0,a0@(16)
no_new_mouse_vector:

Expand All @@ -62,7 +67,12 @@ no_new_mouse_vector:
clrl oldjoystickvector
movel sp@(12),d0
beqs no_new_joystick_vector
#if defined(__mcoldfire__)
movel a0@(24),d1
movel d1,oldjoystickvector
#else
movel a0@(24),oldjoystickvector
#endif
movel d0,a0@(24)
no_new_joystick_vector:

Expand Down Expand Up @@ -109,22 +119,43 @@ no_restore_joystick:
.ascii "LSDL"
.comm oldmousevector,4*1
_SDL_AtariXbios_MouseVector:
#if defined(__mcoldfire__)
lea sp@(-8),sp
moveml d0-d1,sp@
#else
movel d0,sp@-
#endif

/* Mouse buttons */
moveb (a0),d0
#if defined(__mcoldfire__)
andl #3,d0
#else
andw #3,d0
#endif
movew d0,_SDL_AtariXbios_mouseb

/* X movement */
moveb a0@(1),d0
extw d0
#if defined(__mcoldfire__)
movew _SDL_AtariXbios_mousex,d1
addl d1,d0
movew d0,_SDL_AtariXbios_mousex
#else
addw d0,_SDL_AtariXbios_mousex
#endif

/* Y movement */
moveb a0@(2),d0
extw d0
#if defined(__mcoldfire__)
movew _SDL_AtariXbios_mousey,d1
addl d1,d0
movew d0,_SDL_AtariXbios_mousey
#else
addw d0,_SDL_AtariXbios_mousey
#endif

/* Lock mouse position ? */
tstw _SDL_AtariXbios_mouselock
Expand All @@ -134,7 +165,12 @@ _SDL_AtariXbios_MouseVector:
no_mouse_lock:

/* Jump through old vector */
#if defined(__mcoldfire__)
moveml sp@,d0-d1
lea sp@(8),sp
#else
movel sp@+,d0
#endif

movel oldmousevector,sp@-
rts
Expand All @@ -158,7 +194,11 @@ _SDL_AtariXbios_JoystickVector:

/* New joystick state */
moveb a0@(2),d0
#if defined(__mcoldfire__)
andl #0x8f,d0
#else
andw #0x8f,d0
#endif
movew d0,_SDL_AtariXbios_joystick

/* Jump through old vector */
Expand Down

0 comments on commit 07f983e

Please sign in to comment.