Subversion Repositories NedoOS

Rev

Rev 126 | Rev 539 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

  1. /*
  2.  
  3.   SjASMPlus Z80 Cross Compiler
  4.  
  5.   Copyright (c) 2004-2006 Aprisobal
  6.  
  7.   This software is provided 'as-is', without any express or implied warranty.
  8.   In no event will the authors be held liable for any damages arising from the
  9.   use of this software.
  10.  
  11.   Permission is granted to anyone to use this software for any purpose,
  12.   including commercial applications, and to alter it and redistribute it freely,
  13.   subject to the following restrictions:
  14.  
  15.   1. The origin of this software must not be misrepresented; you must not claim
  16.          that you wrote the original software. If you use this software in a product,
  17.          an acknowledgment in the product documentation would be appreciated but is
  18.          not required.
  19.  
  20.   2. Altered source versions must be plainly marked as such, and must not be
  21.          misrepresented as being the original software.
  22.  
  23.   3. This notice may not be removed or altered from any source distribution.
  24.  
  25. */
  26.  
  27. // devices.h
  28.  
  29. bool IsZXSpectrumDevice(char *name);
  30. int SetDevice(char *id);
  31. char* GetDeviceName();
  32.  
  33. class CDevicePage {
  34. public:
  35.         CDevicePage(byte* memory, int32_t size, int number);
  36.         int32_t Size;
  37.         int Number;
  38.         byte* RAM;
  39. private:
  40. };
  41.  
  42. class CDeviceSlot {
  43. public:
  44.         enum ESlotOptions { O_NONE, O_ERROR, O_WARNING, O_NEXT };
  45.  
  46.         CDeviceSlot(int32_t adr, int32_t size);
  47.         ~CDeviceSlot();
  48.         int32_t Address;
  49.         int32_t Size;
  50.         CDevicePage* Page;
  51.         ESlotOptions Option;
  52. private:
  53. };
  54.  
  55. class CDevice {
  56. public:
  57.         // reset will reinitialize checks, "no emit" will do wrap-only (no machine byte emitted)
  58.         // "emit" will also report error/warning upon boundary, as the machine byte emit is expected
  59.         enum ECheckPageLevel{ CHECK_RESET, CHECK_NO_EMIT, CHECK_EMIT };
  60.  
  61.         CDevice(const char* name, CDevice* parent);
  62.         ~CDevice();
  63.         void AddSlot(int32_t adr, int32_t size);
  64.         void AddPage(byte* memory, int32_t size);
  65.         CDevicePage* GetPage(int);
  66.         CDeviceSlot* GetSlot(int);
  67.         void CheckPage(const ECheckPageLevel level);
  68.         bool SetSlot(int slotNumber);           // sets "current/active" slot
  69.         CDeviceSlot* GetCurrentSlot();          // returns "current/active" slot
  70.         int32_t GetMemoryOffset(int page, int32_t offset) const;
  71.         char* ID;
  72.         CDevice* Next;
  73.         int SlotsCount;
  74.         int PagesCount;
  75.         byte* Memory;
  76. private:
  77.         int CurrentSlot;
  78.         CDeviceSlot* Slots[256];
  79.         CDevicePage* Pages[256];
  80.  
  81.         // variables for CheckPage logic
  82.         int previousSlotI;                              // previous machine code write happened into this slot
  83.         CDeviceSlot::ESlotOptions previousSlotOpt;      // its option was
  84.         bool limitExceeded;                             // true if limit exceeded was already reported
  85. };
  86.  
  87. const unsigned char ZXSysVars[] = {
  88.         0x0D, 0x03, 0x20, 0x0D, 0xFF, 0x00, 0x1E, 0xF7,
  89.         0x0D, 0x23, 0x02, 0x00, 0x00, 0x00, 0x16, 0x07,
  90.         0x01, 0x00, 0x06, 0x00, 0x0B, 0x00, 0x01, 0x00,
  91.         0x01, 0x00, 0x06, 0x00, 0x3E, 0x3F, 0x01, 0xFD,
  92.         0xDF, 0x1E, 0x7F, 0x57, 0xE6, 0x07, 0x6F, 0xAA,
  93.         0x0F, 0x0F, 0x0F, 0xCB, 0xE5, 0xC3, 0x99, 0x38,
  94.         0x21, 0x00, 0xC0, 0xE5, 0x18, 0xE6, 0x00, 0x3C,
  95.         0x40, 0x00, 0xFF, 0xCC, 0x01, 0xFC, 0x5F, 0x00,
  96.         0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x02,
  97.         0x38, 0x00, 0x00, 0xD8, 0x5D, 0x00, 0x00, 0x26,
  98.         0x5D, 0x26, 0x5D, 0x3B, 0x5D, 0xD8, 0x5D, 0x3A,
  99.         0x5D, 0xD9, 0x5D, 0xD9, 0x5D, 0xD7, 0x5D, 0x00,
  100.         0x00, 0xDB, 0x5D, 0xDB, 0x5D, 0xDB, 0x5D, 0x2D,
  101.         0x92, 0x5C, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00,
  102.         0x00, 0x00, 0x00, 0x00, 0x4A, 0x17, 0x00, 0x00,
  103.         0xBB, 0x00, 0x00, 0x58, 0xFF, 0x00, 0x00, 0x00,
  104.         0x00, 0x00, 0x21, 0x17, 0x00, 0x40, 0xE0, 0x50,
  105.         0x21, 0x18, 0x21, 0x17, 0x01, 0x38, 0x00, 0x38,
  106.         0x00, 0x00, 0xAF, 0xD3, 0xF7, 0xDB, 0xF7, 0xFE,
  107.         0x1E, 0x28, 0x03, 0xFE, 0x1F, 0xC0, 0xCF, 0x31,
  108.         0x3E, 0x01, 0x32, 0xEF, 0x5C, 0xC9, 0x00, 0x00,
  109.         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  110.         0x00, 0x00, 0xFF, 0x5F, 0xFF, 0xFF, 0xF4, 0x09,
  111.         0xA8, 0x10, 0x4B, 0xF4, 0x09, 0xC4, 0x15, 0x53,
  112.         0x81, 0x0F, 0xC9, 0x15, 0x52, 0x34, 0x5B, 0x2F,
  113.         0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x22,
  114.         0x31, 0x35, 0x36, 0x31, 0x36, 0x22, 0x03, 0xDB,
  115.         0x5C, 0x3D, 0x5D, 0xA2, 0x00, 0x62, 0x6F, 0x6F,
  116.         0x74, 0x20, 0x20, 0x20, 0x20, 0x42, 0x9D, 0x00,
  117.         0x9D, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
  118.         0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00,
  119.         0x00, 0x00, 0x08, 0xFF, 0xFF, 0xFF, 0x80, 0x00,
  120.         0x00, 0xFF, 0xFA, 0x5C, 0xFA, 0x5C, 0x09, 0x00,
  121.         0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
  122.         0x00, 0x3C, 0x5D, 0xFC, 0x5F, 0xFF, 0x3C, 0xAA,
  123.         0x00, 0x00, 0x01, 0x02, 0xF8, 0x5F, 0x00, 0x00,
  124.         0xF7, 0x22, 0x62
  125. };
  126.  
  127. const unsigned char BASin48Vars[] = {
  128.         0xff,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x23,0x05,0x00,0x00,
  129.         0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x0b,0x00,0x01,0x00,0x01,0x00,
  130.         0x06,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  131.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  132.         0x00,0x00,0x00,0x3c,0x40,0x00,0xff,0xc0,0x01,0x54,0xff,0x00,0x00,
  133.         0x00,0x00,0x00,0xff,0xfe,0xff,0x01,0x38,0x00,0x00,0xcb,0x5c,0x00,
  134.         0x00,0xb6,0x5c,0xb6,0x5c,0xcb,0x5c,0xdb,0x5c,0xca,0x5c,0xcc,0x5c,
  135.         0xd4,0x5c,0xda,0x5c,0xcf,0x00,0xdc,0x5c,0xdc,0x5c,0xdc,0x5c,0x2d,
  136.         0x92,0x5c,0x10,0x02,0x00,0x00,0xfe,0xff,0x01,0x00,0x00,0x00,0xb6,
  137.         0x1a,0x00,0x00,0xe5,0x00,0x00,0x58,0xff,0x00,0x00,0x21,0x00,0x5b,
  138.         0x21,0x17,0x00,0x40,0xe0,0x50,0x21,0x18,0x21,0x17,0x01,0x38,0x00,
  139.         0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  140.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  141.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x57,0xff,0xff,0xff,
  142.         0xf4,0x09,0xa8,0x10,0x4b,0xf4,0x09,0xc4,0x15,0x53,0x81,0x0f,0xc4,
  143.         0x15,0x52,0xf4,0x09,0xc4,0x15,0x50,0x80,0x80,0xf9,0xc0,0x33,0x32,
  144.         0x37,0x36,0x38,0x00,0x0e,0x00,0x00,0x00,0x80,0x00,0x0d,0x80,0x00,
  145.         0x00,0x00,0x80,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  146.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  147.         0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  148. };
  149.  
  150. const unsigned char BASin48SP[] = {
  151.         0xb1,0x33,0xe0,0x5c,0xc2,0x02,0x4d,0x00,0xdc,0x5c,0x00,0x80,0x2b,
  152.         0x2d,0x54,0x00,0x2b,0x2d,0x2b,0x2d,0x65,0x33,0x00,0x00,0xed,0x10,
  153.         0x0d,0x00,0x09,0x00,0x85,0x1c,0x10,0x1c,0x52,0x1b,0x76,0x1b,0x03,
  154.         0x13,0x00,0x3e,0x00,0x3c,0x42,0x42,0x7e,0x42,0x42,0x00,0x00,0x7c,
  155.         0x42,0x7c,0x42,0x42,0x7c,0x00,0x00,0x3c,0x42,0x40,0x40,0x42,0x3c,
  156.         0x00,0x00,0x78,0x44,0x42,0x42,0x44,0x78,0x00,0x00,0x7e,0x40,0x7c,
  157.         0x40,0x40,0x7e,0x00,0x00,0x7e,0x40,0x7c,0x40,0x40,0x40,0x00,0x00,
  158.         0x3c,0x42,0x40,0x4e,0x42,0x3c,0x00,0x00,0x42,0x42,0x7e,0x42,0x42,
  159.         0x42,0x00,0x00,0x3e,0x08,0x08,0x08,0x08,0x3e,0x00,0x00,0x02,0x02,
  160.         0x02,0x42,0x42,0x3c,0x00,0x00,0x44,0x48,0x70,0x48,0x44,0x42,0x00,
  161.         0x00,0x40,0x40,0x40,0x40,0x40,0x7e,0x00,0x00,0x42,0x66,0x5a,0x42,
  162.         0x42,0x42,0x00,0x00,0x42,0x62,0x52,0x4a,0x46,0x42,0x00,0x00,0x3c,
  163.         0x42,0x42,0x42,0x42,0x3c,0x00,0x00,0x7c,0x42,0x42,0x7c,0x40,0x40,
  164.         0x00,0x00,0x3c,0x42,0x42,0x52,0x4a,0x3c,0x00,0x00,0x7c,0x42,0x42,
  165.         0x7c,0x44,0x42,0x00,0x00,0x3c,0x40,0x3c,0x02,0x42,0x3c,0x00,0x00,
  166.         0xfe,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x42,0x42,0x42,0x42,0x42,
  167.         0x3c,0x00,0x00
  168. };
  169.  
  170.