roballoc.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* $Id$
  2. * MegaZeux
  3. *
  4. * Copyright (C) 1996 Greg Janson
  5. * Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. /* Declarations for ROBALLOC.CPP */
  22. #ifndef __ROBALLOC_H
  23. #define __ROBALLOC_H
  24. extern char robot_mem_type;//W_EMS or W_MEMORY for where robots are
  25. extern int robot_ems;//EMS handle for W_EMS
  26. extern unsigned char far *robot_mem;//Location in mem of global robot memory
  27. extern unsigned int robot_free_mem;//Amount of free mem in bytes
  28. extern char curr_rmem_status;//1 if global robot mem current
  29. //Call before accessing robot memory. May change EMS paging.
  30. void prepare_robot_mem(char global=0);
  31. //Init and exit
  32. int init_robot_mem(void);
  33. void exit_robot_mem(void);
  34. //Reallocate memory. Codes for type are below.
  35. char reallocate_robot_mem(char type,unsigned char id,unsigned int size);
  36. #define T_SCROLL 0
  37. #define T_ROBOT 1
  38. //Clear a robot entirely (struct and program)
  39. void clear_robot(unsigned char id);
  40. //Clears a scroll's struct and program.
  41. void clear_scroll(unsigned char id);
  42. //Clears a sensor's struct
  43. void clear_sensor(unsigned char id);
  44. //Rounds a number up to a multiple of 16. Intended for internal use but
  45. //available for external use in a pinch. Returns minimum 16.
  46. unsigned int _round16(unsigned int n);
  47. //Find, and mark if asked, the first available object of type noted.
  48. //Returns id or 0 if none available.
  49. unsigned char find_robot(char mark=1);
  50. unsigned char find_scroll(char mark=1);
  51. unsigned char find_sensor(char mark=1);
  52. //Copies one thing to another. Returns non-0 for not enough memory. Doesn't
  53. //copy .used variable.
  54. char copy_robot(unsigned char dest,unsigned char source);
  55. char copy_scroll(unsigned char dest,unsigned char source);
  56. //Cannot run out of memory-
  57. void copy_sensor(unsigned char dest,unsigned char source);
  58. #endif