riscos: Clean up SWI calls SDL-1.2
authorCameron Cawley <ccawley2011@gmail.com>
Fri, 26 Apr 2019 17:41:20 +0100
branchSDL-1.2
changeset 12778c47cdc60c1b3
parent 12777 75aa8b37873d
child 12779 8f5a01f3a9bd
riscos: Clean up SWI calls
src/joystick/riscos/SDL_sysjoystick.c
src/video/riscos/SDL_riscosFullScreenVideo.c
src/video/riscos/SDL_riscosevents.c
src/video/riscos/SDL_riscosmouse.c
src/video/riscos/SDL_riscostask.c
     1.1 --- a/src/joystick/riscos/SDL_sysjoystick.c	Fri Aug 17 23:36:17 2018 +0100
     1.2 +++ b/src/joystick/riscos/SDL_sysjoystick.c	Fri Apr 26 17:41:20 2019 +0100
     1.3 @@ -39,7 +39,9 @@
     1.4  
     1.5  #include "kernel.h"
     1.6  
     1.7 -#define JOYSTICK_READ 0x43F40
     1.8 +#ifndef Joystick_Read
     1.9 +#define Joystick_Read 0x43F40
    1.10 +#endif
    1.11  
    1.12  struct joystick_hwdata 
    1.13  {
    1.14 @@ -58,7 +60,7 @@
    1.15  
    1.16  	 /* Try to read joystick 0 */
    1.17  	regs.r[0] = 0;
    1.18 -	if (_kernel_swi(JOYSTICK_READ, &regs, &regs) == NULL)
    1.19 +	if (_kernel_swi(Joystick_Read, &regs, &regs) == NULL)
    1.20  	{
    1.21  		/* Switch works so assume we've got a joystick */
    1.22  		return 1;
    1.23 @@ -116,7 +118,7 @@
    1.24  	_kernel_swi_regs regs;
    1.25  	regs.r[0] = joystick->index;
    1.26  
    1.27 -	if (_kernel_swi(JOYSTICK_READ, &regs, &regs) == NULL)
    1.28 +	if (_kernel_swi(Joystick_Read, &regs, &regs) == NULL)
    1.29  	{
    1.30  		int newstate = regs.r[0];
    1.31  		int oldstate = joystick->hwdata->joystate;
     2.1 --- a/src/video/riscos/SDL_riscosFullScreenVideo.c	Fri Aug 17 23:36:17 2018 +0100
     2.2 +++ b/src/video/riscos/SDL_riscosFullScreenVideo.c	Fri Apr 26 17:41:20 2019 +0100
     2.3 @@ -359,16 +359,13 @@
     2.4  
     2.5  static int FULLSCREEN_FlipHWSurface(_THIS, SDL_Surface *surface)
     2.6  {
     2.7 -   _kernel_swi_regs regs;
     2.8 -   regs.r[0] = 19;
     2.9 -
    2.10     FULLSCREEN_SetDisplayBank(this->hidden->current_bank);
    2.11     this->hidden->current_bank ^= 1;
    2.12     FULLSCREEN_SetWriteBank(this->hidden->current_bank);
    2.13     surface->pixels = this->hidden->bank[this->hidden->current_bank];
    2.14  
    2.15     /* Wait for Vsync */
    2.16 -   _kernel_swi(OS_Byte, &regs, &regs);
    2.17 +   _kernel_osbyte(19, 0, 0);
    2.18  
    2.19  	return(0);
    2.20  }
    2.21 @@ -618,41 +615,25 @@
    2.22  
    2.23  void FULLSCREEN_SetWriteBank(int bank)
    2.24  {
    2.25 -   _kernel_swi_regs regs;
    2.26 -   regs.r[0] = 112;
    2.27 -   regs.r[1] = bank+1;
    2.28 -   _kernel_swi(OS_Byte, &regs, &regs);
    2.29 +	_kernel_osbyte(112, bank+1, 0);
    2.30  }
    2.31  
    2.32  void FULLSCREEN_SetDisplayBank(int bank)
    2.33  {
    2.34 -   _kernel_swi_regs regs;
    2.35 -   regs.r[0] = 113;
    2.36 -   regs.r[1] = bank+1;
    2.37 -   _kernel_swi(OS_Byte, &regs, &regs);
    2.38 +	_kernel_osbyte(113, bank+1, 0);
    2.39  }
    2.40  
    2.41  
    2.42  /** Disable special escape key processing */
    2.43  static void FULLSCREEN_DisableEscape()
    2.44  {
    2.45 -   _kernel_swi_regs regs;
    2.46 -   regs.r[0] = 229;
    2.47 -   regs.r[1] = 1;
    2.48 -   regs.r[2] = 0;
    2.49 -   _kernel_swi(OS_Byte, &regs, &regs);
    2.50 -  
    2.51 +	_kernel_osbyte(229, 1, 0);
    2.52  }
    2.53  
    2.54  /** Enable special escape key processing */
    2.55  static void FULLSCREEN_EnableEscape()
    2.56  {
    2.57 -   _kernel_swi_regs regs;
    2.58 -   regs.r[0] = 229;
    2.59 -   regs.r[1] = 0;
    2.60 -   regs.r[2] = 0;
    2.61 -   _kernel_swi(OS_Byte, &regs, &regs);
    2.62 -  
    2.63 +	_kernel_osbyte(229, 0, 0);
    2.64  }
    2.65  
    2.66  /** Store caption in case this is called before we create a window */
     3.1 --- a/src/video/riscos/SDL_riscosevents.c	Fri Aug 17 23:36:17 2018 +0100
     3.2 +++ b/src/video/riscos/SDL_riscosevents.c	Fri Apr 26 17:41:20 2019 +0100
     3.3 @@ -329,9 +329,7 @@
     3.4                        block[3] = last_y & 0xFF;
     3.5                        block[4] = (last_y >> 8) & 0xFF;
     3.6                         
     3.7 -                      regs.r[0] = 21; /* OSWORD pointer stuff code */
     3.8 -                      regs.r[1] = (int)block;
     3.9 -                      _kernel_swi(OS_Word, &regs, &regs);
    3.10 +                      _kernel_osword(21, (int *)block);
    3.11                 	   }
    3.12                  }
    3.13               } else
     4.1 --- a/src/video/riscos/SDL_riscosmouse.c	Fri Aug 17 23:36:17 2018 +0100
     4.2 +++ b/src/video/riscos/SDL_riscosmouse.c	Fri Apr 26 17:41:20 2019 +0100
     4.3 @@ -242,9 +242,7 @@
     4.4  	block[3] = osY & 0xFF;
     4.5  	block[4] = (osY >> 8) & 0xFF;
     4.6  
     4.7 -	regs.r[0] = 21;
     4.8 -	regs.r[1] = (int)block;
     4.9 -	_kernel_swi(OS_Word, &regs, &regs);
    4.10 +	_kernel_osword(21, (int *)block);
    4.11  	SDL_PrivateMouseMotion(0, 0, x, y);
    4.12  }
    4.13  
    4.14 @@ -296,9 +294,7 @@
    4.15  
    4.16        }
    4.17  
    4.18 -      regs.r[0] = 21; /* OS word code */
    4.19 -      regs.r[1] = (int)block;
    4.20 -      _kernel_swi(OS_Word, &regs, &regs);
    4.21 +      _kernel_osword(21, (int *)block);
    4.22     }
    4.23  
    4.24     return mode;
    4.25 @@ -317,7 +313,7 @@
    4.26        regs.r[0] = (int)wimp_cursor_palette[colour][0];
    4.27        regs.r[1] = 25;
    4.28        /* Read settings with OS_ReadPalette */
    4.29 -      if (_kernel_swi(0x2f, &regs, &regs) == NULL)
    4.30 +      if (_kernel_swi(OS_ReadPalette, &regs, &regs) == NULL)
    4.31        {
    4.32          wimp_cursor_palette[colour][2] = (unsigned char)((regs.r[2] >> 8) & 0xFF);
    4.33          wimp_cursor_palette[colour][3] = (unsigned char)((regs.r[2] >> 16) & 0xFF);
     5.1 --- a/src/video/riscos/SDL_riscostask.c	Fri Aug 17 23:36:17 2018 +0100
     5.2 +++ b/src/video/riscos/SDL_riscostask.c	Fri Apr 26 17:41:20 2019 +0100
     5.3 @@ -330,9 +330,7 @@
     5.4      stored_mode = -1;
     5.5  
     5.6      /* Flush keyboard buffer to dump the keystrokes we've already polled */
     5.7 -    regs.r[0] = 21;
     5.8 -    regs.r[1] = 0; /* Keyboard buffer number */
     5.9 -    _kernel_swi(OS_Byte, &regs, &regs);
    5.10 +    _kernel_osbyte(21, 0, 0);
    5.11  
    5.12      mouseInWindow = 0;
    5.13