PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/user/games/xmame/xmame-0.106/mess/systems/pdp1.c

https://bitbucket.org/thelearninglabs/uclinux-distro-tll-public
C | 512 lines | 320 code | 67 blank | 125 comment | 1 complexity | 0042919aa0750c3aec0e1d4f82358f56 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-3.0, Unlicense, GPL-2.0, GPL-3.0, CC-BY-SA-3.0, AGPL-1.0, ISC, MIT, 0BSD, LGPL-2.0
  1. /*
  2. Driver for a PDP1 emulator.
  3. Digital Equipment Corporation
  4. Brian Silverman (original Java Source)
  5. Vadim Gerasimov (original Java Source)
  6. Chris Salomon (MESS driver)
  7. Raphael Nabet (MESS driver)
  8. Initially, this was a conversion of a JAVA emulator
  9. (although code has been edited extensively ever since).
  10. I have tried contacting the author, but heard as yet nothing of him,
  11. so I don't know if it all right with him, but after all -> he did
  12. release the source, so hopefully everything will be fine (no his
  13. name is not Marat).
  14. Note: naturally I have no PDP1, I have never seen one, nor have I any
  15. programs for it.
  16. The first supported program was:
  17. SPACEWAR!
  18. The first Videogame EVER!
  19. When I saw the java emulator, running that game I was quite intrigued to
  20. include a driver for MESS.
  21. I think the historical value of SPACEWAR! is enormous.
  22. Two other programs are supported: Munching squares and LISP.
  23. Added Debugging and Disassembler...
  24. Also:
  25. ftp://minnie.cs.adfa.oz.au/pub/PDP-11/Sims/Supnik_2.3/software/lispswre.tar.gz
  26. Is a packet which includes the original LISP as source and
  27. binary form plus a makro assembler for PDP1 programs.
  28. For more documentation look at the source for the driver,
  29. and the cpu/pdp1/pdp1.c file (information about the whereabouts of information
  30. and the java source).
  31. */
  32. #include <math.h>
  33. #include "driver.h"
  34. #include "cpu/pdp1/pdp1.h"
  35. #include "includes/pdp1.h"
  36. #include "vidhrdw/crt.h"
  37. /*
  38. *
  39. * The loading storing OS... is not emulated (I haven't a clue where to
  40. * get programs for the machine)
  41. *
  42. */
  43. /* every memory handler is the same for now */
  44. /* note: MEMORY HANDLERS used everywhere, since we don't need bytes, we
  45. * need 18 bit words, the handler functions return integers, so it should
  46. * be all right to use them.
  47. * This gives sometimes IO warnings!
  48. */
  49. #ifdef SUPPORT_ODD_WORD_SIZES
  50. #define pdp1_read_mem MRA32_RAM
  51. #define pdp1_write_mem MWA32_RAM
  52. #endif
  53. static ADDRESS_MAP_START(pdp1_map, ADDRESS_SPACE_PROGRAM, 32)
  54. #if 0
  55. AM_RANGE(0x0000, 0xffff) AM_READWRITE(pdp1_read_mem, pdp1_write_mem)
  56. #else
  57. AM_RANGE(0x00000, 0x3ffff) AM_READWRITE(pdp1_read_mem, pdp1_write_mem)
  58. #endif
  59. ADDRESS_MAP_END
  60. INPUT_PORTS_START( pdp1 )
  61. PORT_START /* 0: spacewar controllers */
  62. PORT_BIT( ROTATE_LEFT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 1") PORT_CODE(KEYCODE_A) PORT_CODE(JOYCODE_1_LEFT)
  63. PORT_BIT( ROTATE_RIGHT_PLAYER1, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 1") PORT_CODE(KEYCODE_S) PORT_CODE(JOYCODE_1_RIGHT)
  64. PORT_BIT( THRUST_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 1") PORT_CODE(KEYCODE_D) PORT_CODE(JOYCODE_1_BUTTON1)
  65. PORT_BIT( FIRE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 1") PORT_CODE(KEYCODE_F) PORT_CODE(JOYCODE_1_BUTTON2)
  66. PORT_BIT( ROTATE_LEFT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("Spin Left Player 2") PORT_CODE(KEYCODE_LEFT) PORT_CODE(JOYCODE_2_LEFT ) PORT_PLAYER(2)
  67. PORT_BIT( ROTATE_RIGHT_PLAYER2, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("Spin Right Player 2") PORT_CODE(KEYCODE_RIGHT) PORT_CODE(JOYCODE_2_RIGHT ) PORT_PLAYER(2)
  68. PORT_BIT( THRUST_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Thrust Player 2") PORT_CODE(KEYCODE_UP) PORT_CODE(JOYCODE_2_BUTTON1 ) PORT_PLAYER(2)
  69. PORT_BIT( FIRE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Fire Player 2") PORT_CODE(KEYCODE_DOWN) PORT_CODE(JOYCODE_2_BUTTON2 ) PORT_PLAYER(2)
  70. PORT_BIT( HSPACE_PLAYER1, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 1") PORT_CODE(KEYCODE_Z) PORT_CODE(JOYCODE_1_BUTTON3)
  71. PORT_BIT( HSPACE_PLAYER2, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Hyperspace Player 2") PORT_CODE(KEYCODE_SLASH) PORT_CODE(JOYCODE_2_BUTTON3 ) PORT_PLAYER(2)
  72. PORT_START /* 1: various pdp1 operator control panel switches */
  73. PORT_BIT(pdp1_control, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_LCONTROL)
  74. PORT_BIT(pdp1_extend, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("extend") PORT_CODE(KEYCODE_TILDE)
  75. PORT_BIT(pdp1_start_nobrk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break disabled)") PORT_CODE(KEYCODE_U)
  76. PORT_BIT(pdp1_start_brk, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("start (sequence break enabled)") PORT_CODE(KEYCODE_I)
  77. PORT_BIT(pdp1_stop, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("stop") PORT_CODE(KEYCODE_O)
  78. PORT_BIT(pdp1_continue, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("continue") PORT_CODE(KEYCODE_P)
  79. PORT_BIT(pdp1_examine, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("examine") PORT_CODE(KEYCODE_OPENBRACE)
  80. PORT_BIT(pdp1_deposit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("deposit") PORT_CODE(KEYCODE_CLOSEBRACE)
  81. PORT_BIT(pdp1_read_in, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("read in") PORT_CODE(KEYCODE_ENTER)
  82. PORT_BIT(pdp1_reader, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("reader")
  83. PORT_BIT(pdp1_tape_feed, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("tape feed")
  84. PORT_BIT(pdp1_single_step, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single step") PORT_CODE(KEYCODE_STOP)
  85. PORT_BIT(pdp1_single_inst, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("single inst") PORT_CODE(KEYCODE_SLASH)
  86. PORT_START /* 2: operator control panel sense switches */
  87. PORT_DIPNAME( 040, 000, "Sense Switch 1") PORT_CODE(KEYCODE_1_PAD)
  88. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  89. PORT_DIPSETTING( 040, DEF_STR( On ) )
  90. PORT_DIPNAME( 020, 000, "Sense Switch 2") PORT_CODE(KEYCODE_2_PAD)
  91. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  92. PORT_DIPSETTING( 020, DEF_STR( On ) )
  93. PORT_DIPNAME( 010, 000, "Sense Switch 3") PORT_CODE(KEYCODE_3_PAD)
  94. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  95. PORT_DIPSETTING( 010, DEF_STR( On ) )
  96. PORT_DIPNAME( 004, 000, "Sense Switch 4") PORT_CODE(KEYCODE_4_PAD)
  97. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  98. PORT_DIPSETTING( 004, DEF_STR( On ) )
  99. PORT_DIPNAME( 002, 002, "Sense Switch 5") PORT_CODE(KEYCODE_5_PAD)
  100. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  101. PORT_DIPSETTING( 002, DEF_STR( On ) )
  102. PORT_DIPNAME( 001, 000, "Sense Switch 6") PORT_CODE(KEYCODE_6_PAD)
  103. PORT_DIPSETTING( 000, DEF_STR( Off ) )
  104. PORT_DIPSETTING( 001, DEF_STR( On ) )
  105. PORT_START /* 3: operator control panel test address switches */
  106. PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 3") PORT_CODE(KEYCODE_1)
  107. PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 4") PORT_CODE(KEYCODE_2)
  108. PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 5") PORT_CODE(KEYCODE_3)
  109. PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Extension Test Address Switch 6") PORT_CODE(KEYCODE_4)
  110. PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 7") PORT_CODE(KEYCODE_5)
  111. PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 8") PORT_CODE(KEYCODE_6)
  112. PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 9") PORT_CODE(KEYCODE_7)
  113. PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 10") PORT_CODE(KEYCODE_8)
  114. PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 11") PORT_CODE(KEYCODE_9)
  115. PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 12") PORT_CODE(KEYCODE_0)
  116. PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 13") PORT_CODE(KEYCODE_MINUS)
  117. PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 14") PORT_CODE(KEYCODE_EQUALS)
  118. PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 15") PORT_CODE(KEYCODE_Q)
  119. PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 16") PORT_CODE(KEYCODE_W)
  120. PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 17") PORT_CODE(KEYCODE_E)
  121. PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Address Switch 18") PORT_CODE(KEYCODE_R)
  122. PORT_START /* 4: operator control panel test word switches MSB */
  123. PORT_BIT( 0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 1") PORT_CODE(KEYCODE_A)
  124. PORT_BIT( 0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 2") PORT_CODE(KEYCODE_S)
  125. PORT_START /* 5: operator control panel test word switches LSB */
  126. PORT_BIT( 0100000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 3") PORT_CODE(KEYCODE_D)
  127. PORT_BIT( 0040000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 4") PORT_CODE(KEYCODE_F)
  128. PORT_BIT( 0020000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 5") PORT_CODE(KEYCODE_G)
  129. PORT_BIT( 0010000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 6") PORT_CODE(KEYCODE_H)
  130. PORT_BIT( 0004000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 7") PORT_CODE(KEYCODE_J)
  131. PORT_BIT( 0002000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 8") PORT_CODE(KEYCODE_K)
  132. PORT_BIT( 0001000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 9") PORT_CODE(KEYCODE_L)
  133. PORT_BIT( 0000400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 10") PORT_CODE(KEYCODE_COLON)
  134. PORT_BIT( 0000200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 11") PORT_CODE(KEYCODE_QUOTE)
  135. PORT_BIT( 0000100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 12") PORT_CODE(KEYCODE_BACKSLASH)
  136. PORT_BIT( 0000040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 13") PORT_CODE(KEYCODE_Z)
  137. PORT_BIT( 0000020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 14") PORT_CODE(KEYCODE_X)
  138. PORT_BIT( 0000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 15") PORT_CODE(KEYCODE_C)
  139. PORT_BIT( 0000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 16") PORT_CODE(KEYCODE_V)
  140. PORT_BIT( 0000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 17") PORT_CODE(KEYCODE_B)
  141. PORT_BIT( 0000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Test Word Switch 18") PORT_CODE(KEYCODE_N)
  142. /*
  143. Note that I can see 2 additional keys whose purpose is unknown to me.
  144. The caps look like "MAR REL" for the leftmost one and "MAR SET" for
  145. rightmost one: maybe they were used to set the margin (I don't have the
  146. manual for the typewriter).
  147. */
  148. PORT_START /* 6: typewriter codes 00-17 */
  149. PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(Space)") PORT_CODE(KEYCODE_SPACE)
  150. PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 \"") PORT_CODE(KEYCODE_1)
  151. PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 '") PORT_CODE(KEYCODE_2)
  152. PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 ~") PORT_CODE(KEYCODE_3)
  153. PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 (implies)") PORT_CODE(KEYCODE_4)
  154. PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 (or)") PORT_CODE(KEYCODE_5)
  155. PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 (and)") PORT_CODE(KEYCODE_6)
  156. PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 <") PORT_CODE(KEYCODE_7)
  157. PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 >") PORT_CODE(KEYCODE_8)
  158. PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (up arrow)") PORT_CODE(KEYCODE_9)
  159. PORT_START /* 7: typewriter codes 20-37 */
  160. PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 (right arrow)") PORT_CODE(KEYCODE_0)
  161. PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH)
  162. PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S)
  163. PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T)
  164. PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
  165. PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
  166. PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W)
  167. PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X)
  168. PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
  169. PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
  170. PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", =") PORT_CODE(KEYCODE_COMMA)
  171. PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Tab Key") PORT_CODE(KEYCODE_TAB)
  172. PORT_START /* 8: typewriter codes 40-57 */
  173. PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing middle dot) _") PORT_CODE(KEYCODE_QUOTE)
  174. PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J)
  175. PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K)
  176. PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
  177. PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
  178. PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
  179. PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
  180. PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
  181. PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q)
  182. PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
  183. PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- +") PORT_CODE(KEYCODE_COLON)
  184. PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(") ]") PORT_CODE(KEYCODE_EQUALS)
  185. PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("(non-spacing overstrike) |") PORT_CODE(KEYCODE_OPENBRACE)
  186. PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("( [") PORT_CODE(KEYCODE_MINUS)
  187. PORT_START /* 9: typewriter codes 60-77 */
  188. PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
  189. PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
  190. PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
  191. PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
  192. PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E)
  193. PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
  194. PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
  195. PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H)
  196. PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I)
  197. PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lower Case") PORT_CODE(KEYCODE_LSHIFT)
  198. PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". (multiply)") PORT_CODE(KEYCODE_STOP)
  199. PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_RSHIFT)
  200. /* hack to support my macintosh which does not differentiate the Right Shift key */
  201. PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Upper case") PORT_CODE(KEYCODE_CAPSLOCK)
  202. PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE)
  203. PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER)
  204. PORT_START /* 10: pseudo-input port with config */
  205. PORT_BIT( 0x0003, 0x0002, IPT_DIPSWITCH_NAME) PORT_NAME("RAM size")
  206. PORT_DIPSETTING( 0x0000, "4kw" )
  207. PORT_DIPSETTING( 0x0001, "32kw")
  208. PORT_DIPSETTING( 0x0002, "64kw")
  209. PORT_BIT( 0x0004, 0x0000, IPT_DIPSWITCH_NAME) PORT_NAME("Hardware multiply")
  210. PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
  211. PORT_DIPSETTING( 0x0004, DEF_STR( On ) )
  212. PORT_BIT( 0x0008, 0x0000, IPT_DIPSWITCH_NAME) PORT_NAME("Hardware divide")
  213. PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
  214. PORT_DIPSETTING( 0x0008, DEF_STR( On ) )
  215. PORT_BIT( 0x0010, 0x0000, IPT_DIPSWITCH_NAME) PORT_NAME("Type 20 sequence break system")
  216. PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
  217. PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
  218. PORT_DIPNAME( 0x0020, 0x0000, "Type 32 light pen") PORT_CODE(KEYCODE_ENTER_PAD)
  219. PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
  220. PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
  221. PORT_START /* 11: pseudo-input port with lightpen status */
  222. PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select larger light pen tip") PORT_CODE(KEYCODE_PLUS_PAD)
  223. PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("select smaller light pen tip") PORT_CODE(KEYCODE_MINUS_PAD)
  224. PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("light pen down")
  225. PORT_START /* 12: lightpen - X AXIS */
  226. PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_MINMAX(0,0) PORT_PLAYER(1) PORT_RESET
  227. PORT_START /* 13: lightpen - Y AXIS */
  228. PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_MINMAX(0,0) PORT_PLAYER(1) PORT_RESET
  229. INPUT_PORTS_END
  230. static gfx_layout fontlayout =
  231. {
  232. 6, 8, /* 6*8 characters */
  233. pdp1_charnum, /* 96+4 characters */
  234. 1, /* 1 bit per pixel */
  235. { 0 },
  236. { 0, 1, 2, 3, 4, 5, 6, 7 }, /* straightforward layout */
  237. { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  238. 8*8 /* every char takes 8 consecutive bytes */
  239. };
  240. static gfx_decode gfxdecodeinfo[] =
  241. {
  242. { REGION_GFX1, 0, &fontlayout, 0, 3 },
  243. { -1 } /* end of array */
  244. };
  245. /*
  246. The static palette only includes the pens for the control panel and
  247. the typewriter, as the CRT palette is generated dynamically.
  248. The CRT palette defines various levels of intensity between white and
  249. black. Grey levels follow an exponential law, so that decrementing the
  250. color index periodically will simulate the remanence of a cathode ray tube.
  251. */
  252. static const UINT8 palette[] =
  253. {
  254. 0xFF,0xFF,0xFF, /* white */
  255. 0x00,0xFF,0x00, /* green */
  256. 0x00,0x40,0x00, /* dark green */
  257. 0xFF,0x00,0x00, /* red */
  258. 0x80,0x80,0x80 /* light gray */
  259. };
  260. static const UINT16 colortable[] =
  261. {
  262. pen_panel_bg, pen_panel_caption,
  263. pen_typewriter_bg, pen_black,
  264. pen_typewriter_bg, pen_red
  265. };
  266. /* Initialise the palette */
  267. static void palette_init_pdp1(unsigned short *sys_colortable, const unsigned char *dummy)
  268. {
  269. /* rgb components for the two color emissions */
  270. const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076;
  271. /* half period in seconds for the two color emissions */
  272. const double half_period_1 = .05, half_period_2 = .20;
  273. /* refresh period in seconds */
  274. const double update_period = 1./refresh_rate;
  275. double decay_1, decay_2;
  276. double cur_level_1, cur_level_2;
  277. int i;
  278. int r, g, b;
  279. /* initialize CRT palette */
  280. /* compute the decay factor per refresh frame */
  281. decay_1 = pow(.5, update_period / half_period_1);
  282. decay_2 = pow(.5, update_period / half_period_2);
  283. cur_level_1 = cur_level_2 = 255.; /* start with maximum level */
  284. for (i=pen_crt_max_intensity; i>0; i--)
  285. {
  286. /* compute the current color */
  287. r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5);
  288. g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5);
  289. b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5);
  290. /* write color in palette */
  291. palette_set_color(i, r, g, b);
  292. /* apply decay for next iteration */
  293. cur_level_1 *= decay_1;
  294. cur_level_2 *= decay_2;
  295. }
  296. palette_set_color(0, 0, 0, 0);
  297. /* load static palette */
  298. palette_set_colors(pen_crt_num_levels, palette, sizeof(palette) / sizeof(palette[0]) / 3);
  299. memcpy(sys_colortable, colortable, sizeof(colortable));
  300. }
  301. pdp1_reset_param_t pdp1_reset_param =
  302. {
  303. { /* external iot handlers. NULL means that the iot is unimplemented, unless there are
  304. parentheses around the iot name, in which case the iot is internal to the cpu core. */
  305. /* I put a ? when the source is the handbook, since a) I have used the maintainance manual
  306. as the primary source (as it goes more into details) b) the handbook and the maintainance
  307. manual occasionnally contradict each other. */
  308. /* dia, dba, dcc, dra are documented in MIT PDP-1 COMPUTER MODIFICATION
  309. BULLETIN no. 2 (drumInstrWriteup.bin/drumInstrWriteup.txt), and are
  310. similar to IOT documented in Parallel Drum Type 23 Instruction Manual. */
  311. /* (iot) rpa rpb tyo tyi ppa ppb dpy */
  312. NULL, iot_rpa, iot_rpb, iot_tyo, iot_tyi, iot_ppa, iot_ppb, iot_dpy,
  313. /* spacewar */
  314. NULL, iot_011, NULL, NULL, NULL, NULL, NULL, NULL,
  315. /* lag glf?/jsp? gpl?/gpr?/gcf? */
  316. NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  317. /* rrb rcb? rcc? cks mcs mes mel */
  318. iot_rrb, NULL, NULL, iot_cks, NULL, NULL, NULL, NULL,
  319. /* cad? rac? rbc? pac lpr/lfb/lsp swc/sci/sdf?/shr? scv? */
  320. NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  321. /* (dsc) (asc) (isb) (cac) (lsm) (esm) (cbs) */
  322. NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  323. /* icv? dia dba dcc dra mri|rlc? mrf/inr?/ccr? */
  324. NULL, iot_dia, iot_dba, iot_dcc, iot_dra, NULL, NULL, NULL,
  325. /* mcb|dur? mwc|mtf? mrc|sfc?... msm|cgo? (eem/lem) mic muf */
  326. NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  327. },
  328. pdp1_tape_read_binary,
  329. pdp1_io_sc_callback,
  330. 0, /* extend mode support defined in input ports and pdp1_init_machine */
  331. 0, /* hardware multiply/divide support defined in input ports and pdp1_init_machine */
  332. 0 /* type 20 sequence break system support defined in input ports and pdp1_init_machine */
  333. };
  334. static MACHINE_DRIVER_START(pdp1)
  335. /* basic machine hardware */
  336. /* PDP1 CPU @ 200 kHz (no master clock, but the instruction and memory rate is 200 kHz) */
  337. MDRV_CPU_ADD(PDP1, 1000000/*the CPU core uses microsecond counts*/)
  338. MDRV_CPU_CONFIG(pdp1_reset_param)
  339. MDRV_CPU_PROGRAM_MAP(pdp1_map, 0)
  340. MDRV_CPU_VBLANK_INT(pdp1_interrupt, 1) /* dummy interrupt: handles input */
  341. MDRV_FRAMES_PER_SECOND(refresh_rate)
  342. MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
  343. MDRV_MACHINE_START( pdp1 )
  344. /* video hardware (includes the control panel and typewriter output) */
  345. MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
  346. MDRV_SCREEN_SIZE(virtual_width, virtual_height)
  347. MDRV_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1)
  348. MDRV_GFXDECODE(gfxdecodeinfo)
  349. MDRV_PALETTE_LENGTH(pen_crt_num_levels + (sizeof(palette) / sizeof(palette[0]) / 3))
  350. MDRV_COLORTABLE_LENGTH(sizeof(colortable) / sizeof(colortable[0]))
  351. MDRV_PALETTE_INIT(pdp1)
  352. MDRV_VIDEO_START(pdp1)
  353. MDRV_VIDEO_EOF(crt)
  354. MDRV_VIDEO_UPDATE(pdp1)
  355. MACHINE_DRIVER_END
  356. /*
  357. pdp1 can address up to 65336 18 bit words when extended (4096 otherwise).
  358. */
  359. ROM_START(pdp1)
  360. ROM_REGION(pdp1_fontdata_size, REGION_GFX1, 0)
  361. /* space filled with our font */
  362. ROM_END
  363. static void pdp1_punchtape_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
  364. {
  365. /* punchtape */
  366. switch(state)
  367. {
  368. /* --- the following bits of info are returned as 64-bit signed integers --- */
  369. case DEVINFO_INT_TYPE: info->i = IO_PUNCHTAPE; break;
  370. case DEVINFO_INT_COUNT: info->i = 2; break;
  371. /* --- the following bits of info are returned as pointers to data or functions --- */
  372. case DEVINFO_PTR_INIT: info->init = device_init_pdp1_tape; break;
  373. case DEVINFO_PTR_LOAD: info->load = device_load_pdp1_tape; break;
  374. case DEVINFO_PTR_UNLOAD: info->unload = device_unload_pdp1_tape; break;
  375. case DEVINFO_PTR_GET_DISPOSITIONS: info->getdispositions = pdp1_get_open_mode; break;
  376. /* --- the following bits of info are returned as NULL-terminated strings --- */
  377. case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "tap,rim"); break;
  378. }
  379. }
  380. static void pdp1_printer_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
  381. {
  382. /* printer */
  383. switch(state)
  384. {
  385. /* --- the following bits of info are returned as 64-bit signed integers --- */
  386. case DEVINFO_INT_TYPE: info->i = IO_PRINTER; break;
  387. case DEVINFO_INT_READABLE: info->i = 0; break;
  388. case DEVINFO_INT_WRITEABLE: info->i = 1; break;
  389. case DEVINFO_INT_CREATABLE: info->i = 1; break;
  390. case DEVINFO_INT_COUNT: info->i = 1; break;
  391. /* --- the following bits of info are returned as pointers to data or functions --- */
  392. case DEVINFO_PTR_LOAD: info->load = device_load_pdp1_typewriter; break;
  393. case DEVINFO_PTR_UNLOAD: info->unload = device_unload_pdp1_typewriter; break;
  394. /* --- the following bits of info are returned as NULL-terminated strings --- */
  395. case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "typ"); break;
  396. }
  397. }
  398. static void pdp1_cylinder_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
  399. {
  400. /* cylinder */
  401. switch(state)
  402. {
  403. /* --- the following bits of info are returned as 64-bit signed integers --- */
  404. case DEVINFO_INT_TYPE: info->i = IO_CYLINDER; break;
  405. case DEVINFO_INT_READABLE: info->i = 1; break;
  406. case DEVINFO_INT_WRITEABLE: info->i = 1; break;
  407. case DEVINFO_INT_CREATABLE: info->i = 0; break;
  408. case DEVINFO_INT_COUNT: info->i = 1; break;
  409. /* --- the following bits of info are returned as pointers to data or functions --- */
  410. case DEVINFO_PTR_LOAD: info->load = device_load_pdp1_drum; break;
  411. case DEVINFO_PTR_UNLOAD: info->unload = device_unload_pdp1_drum; break;
  412. /* --- the following bits of info are returned as NULL-terminated strings --- */
  413. case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "drm"); break;
  414. }
  415. }
  416. SYSTEM_CONFIG_START(pdp1)
  417. /*CONFIG_RAM_DEFAULT(4 * 1024)
  418. CONFIG_RAM(32 * 1024)
  419. CONFIG_RAM(64 * 1024)*/
  420. CONFIG_DEVICE(pdp1_punchtape_getinfo)
  421. CONFIG_DEVICE(pdp1_printer_getinfo)
  422. CONFIG_DEVICE(pdp1_cylinder_getinfo)
  423. SYSTEM_CONFIG_END
  424. /***************************************************************************
  425. Game driver(s)
  426. ***************************************************************************/
  427. /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */
  428. COMP( 1961, pdp1, 0, 0, pdp1, pdp1, 0, pdp1, "Digital Equipment Corporation", "PDP-1" , 0)