Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.7KB

  1. ( ----- 600 )
  2. 601 MC6850 driver 606 Zilog SIO driver
  3. 615 SPI relay 619 Xcomp unit
  4. ( ----- 601 )
  5. ( MC6850 Driver. Load range B601-B603. Requires:
  6. 6850_CTL for control register
  7. 6850_IO for data register.
  8. CTL numbers used: 0x16 = no interrupt, 8bit words, 1 stop bit
  9. 64x divide. 0x56 = RTS high )
  10. : _rts 0x16 ( RTS low ) [ 6850_CTL LITN ] PC! ;
  11. : _rts^ 0x56 ( RTS high ) [ 6850_CTL LITN ] PC! ;
  12. : 6850<? ( -- c? f )
  13. [ 6850_CTL LITN ] PC@ 1 AND ( is rcv buff full ? )
  14. NOT IF ( RTS low, then wait 1ms and try again )
  15. _rts 10 TICKS ( 1ms ) _rts^
  16. [ 6850_CTL LITN ] PC@ 1 AND ( is rcv buff full ? )
  17. NOT IF 0 EXIT THEN
  18. THEN [ 6850_IO LITN ] PC@ ( c ) 1 ( f ) ;
  19. ( ----- 602 )
  20. CODE 6850>
  21. HL POP, chkPS,
  22. BEGIN,
  23. 6850_CTL INAi, 0x02 ANDi, ( are we transmitting? )
  24. JRZ, ( yes, loop ) AGAIN,
  25. A L LDrr, 6850_IO OUTiA,
  26. ;CODE
  27. ( ----- 603 )
  28. : (key?) 6850<? ;
  29. : (emit) 6850> ;
  30. : 6850$ 0x56 ( RTS high ) [ 6850_CTL LITN ] PC! ;
  31. ( ----- 605 )
  32. ( Zilog SIO driver. Load range B605-607. Requires:
  33. SIOA_CTL for ch A control register
  34. SIOA_DATA for ch A data register
  35. SIOB_CTL for ch B control register
  36. SIOB_DATA for ch B data register )
  37. : _<? ( io ctl -- c? f )
  38. DUP ( io ctl ctl ) PC@ 1 AND ( is rcv buff full ? )
  39. NOT IF ( io ctl )
  40. 0x05 ( PTR5 ) OVER PC! 0b01101000 OVER PC! ( RTS low )
  41. 10 TICKS ( 1ms )
  42. 0x05 ( PTR5 ) OVER PC! 0b01101010 OVER PC! ( RTS high )
  43. PC@ 1 AND ( is rcv buff full ? )
  44. NOT IF DROP 0 ( f ) EXIT THEN
  45. ELSE DROP THEN ( io ) PC@ ( c ) 1 ( f ) ;
  46. : SIOA<? [ SIOA_DATA LITN SIOA_CTL LITN ] _<? ;
  47. ( ----- 606 )
  48. CODE SIOA>
  49. HL POP, chkPS,
  50. BEGIN,
  51. SIOA_CTL INAi, 0x04 ANDi, ( are we transmitting? )
  52. JRZ, ( yes, loop ) AGAIN,
  53. A L LDrr, SIOA_DATA OUTiA,
  54. ;CODE
  55. CREATE _ ( init data ) 0x18 C, ( CMD3 )
  56. 0x24 C, ( CMD2/PTR4 ) 0b11000100 C, ( WR4/64x/1stop/nopar )
  57. 0x03 C, ( PTR3 ) 0b11000001 C, ( WR3/RXen/8char )
  58. 0x05 C, ( PTR5 ) 0b01101010 C, ( WR5/TXen/8char/RTS )
  59. 0x21 C, ( CMD2/PTR1 ) 0 C, ( WR1/Rx no INT )
  60. : SIOA$ 9 0 DO _ I + C@ [ SIOA_CTL LITN ] PC! LOOP ;
  61. ( ----- 607 )
  62. : SIOB<? [ SIOB_DATA LITN SIOB_CTL LITN ] _<? ;
  63. CODE SIOB>
  64. HL POP, chkPS,
  65. BEGIN,
  66. SIOB_CTL INAi, 0x04 ANDi, ( are we transmitting? )
  67. JRZ, ( yes, loop ) AGAIN,
  68. A L LDrr, SIOB_DATA OUTiA,
  69. ;CODE
  70. : SIOB$ 9 0 DO _ I + C@ [ SIOB_CTL LITN ] PC! LOOP ;
  71. ( ----- 619 )
  72. ( RC2014 classic with MC6850 )
  73. 0xff00 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR
  74. RS_ADDR 0x80 - CONSTANT SYSVARS
  75. 0x8000 CONSTANT HERESTART
  76. 0x80 CONSTANT 6850_CTL 0x81 CONSTANT 6850_IO
  77. 4 CONSTANT SPI_DATA 5 CONSTANT SPI_CTL 1 CONSTANT SDC_DEVID
  78. 5 LOAD ( z80 assembler )
  79. 262 LOAD ( xcomp ) 282 LOAD ( boot.z80.decl )
  80. 270 LOAD ( xcomp overrides ) 283 335 LOADR ( boot.z80 )
  81. 353 LOAD ( xcomp core low ) 601 603 LOADR ( MC6850 )
  82. 419 LOAD ( SPI relay ) 423 436 LOADR ( SD Card )
  83. 400 LOAD ( AT28 )
  84. 390 LOAD ( xcomp core high )
  85. (entry) _
  86. PC ORG @ 8 + ! ( Update LATEST )
  87. ," 6850$ BLK$ " EOT,
  88. ( ----- 620 )
  89. ( RC2014 classic with SIO )
  90. 0xff00 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR
  91. RS_ADDR 0x80 - CONSTANT SYSVARS
  92. 0x8000 CONSTANT HERESTART
  93. 0x80 CONSTANT SIOA_CTL 0x81 CONSTANT SIOA_DATA
  94. 0x82 CONSTANT SIOB_CTL 0x83 CONSTANT SIOB_DATA
  95. 4 CONSTANT SPI_DATA 5 CONSTANT SPI_CTL 1 CONSTANT SDC_DEVID
  96. 5 LOAD ( z80 assembler )
  97. 262 LOAD ( xcomp ) 282 LOAD ( boot.z80.decl )
  98. 270 LOAD ( xcomp overrides ) 283 335 LOADR ( boot.z80 )
  99. 353 LOAD ( xcomp core low ) 605 607 LOADR ( SIO )
  100. 419 LOAD ( SPI relay ) 423 436 LOADR ( SD Card )
  101. 400 LOAD ( AT28 ) : (key?) SIOA<? ; : (emit) SIOA> ;
  102. 390 LOAD ( xcomp core high )
  103. (entry) _ PC ORG @ 8 + ! ( Update LATEST )
  104. ," SIOA$ BLK$ " EOT,