?login_element?

Subversion Repositories NedoOS

Rev

Rev 147 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ; ports description and include file
  2. ;for NeoGS software projects, v0.3
  3. ;
  4. ; bits degisnation:
  5. ; B_* - bit position (0,1,2,3,4,5,6,7),
  6. ; M_* - bit mask (1,2,4,8,#10,#20,#40,#80)
  7. ; C_* - constants to be used
  8. ;
  9. ; part of NeoGS project
  10. ;
  11. ; (c) 2008 NedoPC
  12.  
  13. ;ZX-side ports
  14.  
  15. GSCOM=0xBB ;write-only, command for NGS
  16.  
  17. GSSTAT=0xBB ;read-only, command and data bits
  18.                 ; (positions given immediately below)
  19.  
  20. B_CBIT=0 ;Command   position
  21. M_CBIT=1 ;       BIT        and mask
  22.  
  23. B_DBIT=7   ;Data   position
  24. M_DBIT=0x80 ;    BIT        and mask
  25.  
  26.  
  27. GSDAT=0xB3 ; read-write, data transfer register for NGS
  28.  
  29. GSCTR=0x33 ; write-only, control register for NGS:
  30.                 ;constants available given immediately below
  31.  
  32. C_GRST=0x80 ; reset constant to be written into GSCTR
  33. C_GNMI=0x40 ; NMI constant to be written into GSCTR
  34. C_GLED=0x20 ; LED toggle constant
  35.  
  36.  
  37. ;GS-side ports
  38.  
  39. MPAG=0x00 ; write-only, Memory PAGe port
  40.                 ;(big pages at 8000-FFFF or small at 8000-BFFF)
  41. MPAGEX=0x10 ; write-only, Memory PAGe EXtended
  42.                 ;(only small pages at C000-FFFF)
  43.  
  44. ZXCMD=0x01 ; read-only, ZX CoMmanD port: here is the byte
  45.                 ;written by ZX into GSCOM
  46.  
  47. ZXDATRD=0x02 ; read-only, ZX DATa ReaD: a byte written by ZX
  48.                 ;into GSDAT appears here;
  49.                 ; upon reading this port, data bit is cleared
  50.  
  51. ZXDATWR=0x03 ; write-only, ZX DATa WRite: a byte written here
  52.                 ;is available for ZX in GSDAT;
  53.                 ; upon writing here, data bit is set
  54.  
  55. ZXSTAT=0x04 ; read-only, read ZX STATus:
  56.                 ;command and data bits.
  57.                ;positions are defined by *_CBIT and *_DBIT above
  58.  
  59. CLRCBIT=0x05 ; read-write, upon either reading or writing
  60.                 ;this port, the Command BIT is CLeaRed
  61.  
  62. VOL1=0x06 ; write-only, volumes for sound channels 1-8
  63. VOL2=0x07
  64. VOL3=0x08
  65. VOL4=0x09
  66. VOL5=0x16
  67. VOL6=0x17
  68. VOL7=0x18
  69. VOL8=0x19
  70.  
  71. ; following two ports are useless and very odd. They have been
  72. ;made just because they were on the original GS and for that
  73. ; strange case when somebody too crazy have used them.
  74. ;Nevertheless, DO NOT USE THEM! They can disappear or even
  75. ;radically change functionality in future firmware releases.
  76. DAMNPORT1=0x0A ; writing or reading this port sets data bit
  77.                   ;to the inverse of bit 0 into MPAG port
  78. DAMNPORT2=0x0B ; the same as DAMNPORT1, but instead command
  79.            ;bit involved, which is made equal to 5th bit of VOL4
  80.  
  81. LEDCTR=0x01 ; write-only, controls on-board LED.
  82.                 ;D0=0 - LED is on, D0=1 - LED is off
  83.                 ; reset state is LED on.
  84.  
  85. GSCFG0=0x0F ; read-write, GS ConFiG port 0:
  86.                 ;acts as memory cell, reads previously written
  87.                 ;value. Bits and fields follow:
  88.  
  89. B_NOROM=0 ; =0 - there is ROM everywhere except 4000-7FFF,
  90.               ; =1 - the RAM is all around
  91. M_NOROM=1
  92.  
  93. B_RAMRO=1 ; =1 - ram absolute addresses 0000-7FFF
  94.                ;(zeroth big page) are write-protected
  95. M_RAMRO=2
  96.  
  97. B_8CHANS=2 ; =1 - 8 channels mode
  98. M_8CHANS=4
  99.  
  100. B_EXPAG=3 ; =1 - extended paging: both MPAG and MPAGEX are
  101.                ;used to switch two memory windows
  102. M_EXPAG=8
  103.  
  104. B_CKSEL0=4   ;these bits should be set according to the
  105.                  ;C_**MHZ constants below
  106. M_CKSEL0=0x10
  107. B_CKSEL1=5
  108. M_CKSEL1=0x20
  109.  
  110. C_10MHZ=0x30
  111. C_12MHZ=0x10
  112. C_20MHZ=0x20
  113. C_24MHZ=0x00
  114.  
  115. B_PAN4CH=6  ; =1 - 4 channels, panning
  116. ;(every channel is on left and right with two volumes)
  117. M_PAN4CH=0x40
  118.  
  119. B_SETNCLR=7
  120. M_SETNCLR=0x80
  121.  
  122.  
  123. SCTRL=0x11 ;Serial ConTRoL: read-write,
  124.                 ;read: current state of below bits,
  125.                 ;write - see GS_info
  126.  
  127. B_SDNCS=0
  128. M_SDNCS=1
  129.  
  130. B_MCNCS=1
  131. M_MCNCS=2
  132.  
  133. B_MPXRS=2
  134. M_MPXRS=4
  135.  
  136. B_MCSPD0=3
  137. M_MCSPD0=8
  138.  
  139. B_MDHLF=4
  140. M_MDHLF=0x10
  141.  
  142. B_MCSPD1=5
  143. M_MCSPD1=0x20
  144.  
  145.  
  146. SSTAT=0x12 ;Serial STATus:
  147.               ;read-only, reads state of below bits
  148.  
  149. B_MDDRQ=0
  150. M_MDDRQ=1
  151.  
  152. B_SDDET=1
  153. M_SDDET=2
  154.  
  155. B_SDWP=2
  156. M_SDWP=4
  157.  
  158. B_MCRDY=3
  159. M_MCRDY=8
  160.  
  161.  
  162. SD_SEND=0x13 ;SD card SEND, write-only,
  163.           ;when written, byte transfer starts with written byte
  164. SD_READ=0x13 ;SD card READ, read-only,
  165.           ;reads byte received in previous byte transfer
  166. SD_RSTR=0x14 ;SD card Read and STaRt, read-only, reads
  167. ;previously received byte and starts new byte transfer with #FF
  168.  
  169. MD_SEND=0x14 ;Mp3 Data SEND, write-only,
  170.           ;sends byte to the mp3 data interface
  171.  
  172. MC_SEND=0x15 ;Mp3 Control SEND, write-only,
  173.           ;sends byte to the mp3 control interface
  174. MC_READ=0x15 ;Mp3 Control READ, read-only,
  175. ;reads byte that was received during previous sending of byte
  176.  
  177. DMA_MOD=0x1B
  178. DMA_HAD=0x1C
  179. DMA_MAD=0x1D
  180. DMA_LAD=0x1E
  181. DMA_CST=0x1F
  182.  
  183. ;Послать код команды в регистр команд
  184.         MACRO SC cmd
  185.         LD A,cmd
  186.         OUT (GSCOM),A
  187.         ENDM
  188.  
  189. ;Ожидание сброса Command bit
  190.         MACRO WC
  191.         ;LOCAL
  192. ;WCLP    
  193.         IN A,(GSCOM)
  194.         RRCA
  195.         JR C,$-3;WCLP
  196.         ;ENDL
  197.         ENDM
  198.  
  199. ;Послать данные в регистр данных
  200.         MACRO SD data
  201.         LD A,data
  202.         OUT (GSDAT),A
  203.         ENDM
  204.  
  205. ;Ожидание сброса Data bit
  206. ;по сути,ожидание,пока GS не примет посланные ему данные
  207.         MACRO WD
  208.         ;LOCAL
  209. ;WDLP    
  210.         IN A,(GSCOM)
  211.         RLCA
  212.         JR C,$-3;WDLP
  213.         ;ENDL
  214.         ENDM
  215.  
  216. ;Принять данные из регистра данных
  217.         MACRO GD
  218.         IN A,(GSDAT)
  219.         ENDM
  220.  
  221. ;Ожидание установки Data bit
  222. ;по сути,ожидание очередных данных от GS
  223.         MACRO WN
  224.         ;LOCAL
  225. ;WNLP
  226.         IN A,(GSCOM)
  227.         RLCA
  228.         JR NC,$-3;WNLP
  229.         ;ENDL
  230.         ENDM  
  231.