registers.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. RAM_PIC = 0x0000 # Screen Picture, 64 x 64 = 4096 bytes
  2. RAM_CHR = 0x1000 # Screen Characters, 256 x 16 = 4096 bytes
  3. RAM_PAL = 0x2000 # Screen Character Palette, 256 x 8 = 2048 bytes
  4. IDENT = 0x2800
  5. REV = 0x2801
  6. FRAME = 0x2802
  7. VBLANK = 0x2803
  8. SCROLL_X = 0x2804
  9. SCROLL_Y = 0x2806
  10. JK_MODE = 0x2808
  11. J1_RESET = 0x2809
  12. SPR_DISABLE = 0x280a
  13. SPR_PAGE = 0x280b
  14. IOMODE = 0x280c
  15. BG_COLOR = 0x280e
  16. SAMPLE_L = 0x2810
  17. SAMPLE_R = 0x2812
  18. SCREENSHOT_Y = 0x281e
  19. PALETTE16A = 0x2840 # 16-color palette RAM A, 32 bytes
  20. PALETTE16B = 0x2860 # 16-color palette RAM B, 32 bytes
  21. PALETTE4A = 0x2880 # 4-color palette RAM A, 8 bytes
  22. PALETTE4B = 0x2888 # 4-color palette RAM A, 8 bytes
  23. COMM = 0x2890 # Communication buffer
  24. COLLISION = 0x2900 # Collision detection RAM, 256 bytes
  25. VOICES = 0x2a00 # Voice controls
  26. J1_CODE = 0x2b00 # J1 coprocessor microcode RAM
  27. SCREENSHOT = 0x2c00 # screenshot line RAM
  28. RAM_SPR = 0x3000 # Sprite Control, 512 x 4 = 2048 bytes
  29. RAM_SPRPAL = 0x3800 # Sprite Palettes, 4 x 256 = 2048 bytes
  30. RAM_SPRIMG = 0x4000 # Sprite Image, 64 x 256 = 16384 bytes
  31. def RGB(r, g, b):
  32. """ Return the 16-bit hardware encoding of color (R,G,B).
  33. :param R: red value 0-255
  34. :param G: green value 0-255
  35. :param B: blue value 0-255
  36. :rtype: int
  37. """
  38. return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3)
  39. TRANSPARENT = (1 << 15)