Source code of Windows XP (NT5)
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.

143 lines
3.6 KiB

  1. ;
  2. ;
  3. ; Serial driver for COM1 to be used by Sim16 layer.
  4. ;
  5. ;
  6. CharDev EQU 8000h
  7. StatusError EQU 8000h
  8. StatusBusy EQU 0200h
  9. StatusDone EQU 0100h
  10. ErrorGenF EQU 12
  11. ;
  12. ; PIC Addresses
  13. ;
  14. PIC EQU 20h
  15. PIC_IntEnable EQU 21h
  16. EOI EQU 20h
  17. ;
  18. ; UART Port Addresses
  19. ;
  20. SERIALPORT EQU 3F8h ; default serial port to be used, change this
  21. ; to 2F8h if you want to use COM2.
  22. RxBuf EQU 0F8h ; base address
  23. Baud1 EQU RxBuf+1 ; baud divisor high byte
  24. IER EQU RxBuf+1 ; int. enable register
  25. IIR EQU RxBuf+2 ; int. identification register
  26. LCR EQU RxBuf+3 ;
  27. MCR EQU RxBuf+4 ;
  28. LSR EQU RxBuf+5 ;
  29. MSR EQU RxBuf+6 ;
  30. ; UART Interrupt Identification Register Equates
  31. IntPending EQU 00000001b ; interrupt is pending
  32. ; UART Line Control Register Equates
  33. DLAB EQU 10000000b ; divisor latch access bit
  34. SetBrk EQU 01000000b ; send break control bit
  35. StkParity EQU 00100000b ; stick parity control bit
  36. EvenParity EQU 00010000b ; even parity bit
  37. GenParity EQU 00001000b ; generate parity bit
  38. XStopBit EQU 00000100b ; extra stop bit
  39. WordLen8 EQU 00000011b ; word len = 8
  40. WordLen7 EQU 00000010b ; word len = 7
  41. WordLen6 EQU 00000001b ; word len = 6
  42. ; UART Line Status Register Equates
  43. TransShReg EQU 01000000b ; tranmit shift register empty
  44. TransHReg EQU 00100000b ; transmit holding register empty
  45. BrkRcv EQU 00010000b ; break received
  46. FrameErr EQU 00001000b ; framing error
  47. ParityErr EQU 00000100b ; parity error
  48. OverRunErr EQU 00000010b ; overrun error
  49. RcvData EQU 00000001b ; received data ready
  50. RcvError EQU BrkRcv+FrameErr+ParityErr+OverRunErr
  51. ; UART Modem Control Register Equates
  52. OUT1 EQU 00000100b ;
  53. OUT2 EQU 00001000b ; allow 8250 ints in
  54. SetRTS EQU 00000010b ; set RTS
  55. SetDTR EQU 00000001b ; set DTR
  56. ; UART Modem Status Register Equates
  57. CD EQU 10000000b ; carrier detect
  58. RI EQU 01000000b ; ring indicator
  59. DSR EQU 00100000b ; data set ready
  60. CTS EQU 00010000b ; CTS
  61. CDC EQU 00001000b ; carrier dectect change
  62. RIC EQU 00000100b ; ring indicator change
  63. DSRC EQU 00000010b ; DSR change
  64. CTSC EQU 00000001b ; CTS change
  65. ; UART Interrupt Enable Register Equates
  66. RxInt EQU 00000001b ; receive interrupt
  67. TxInt EQU 00000010b ; transmit interrupt
  68. LSInt EQU 00000100b ; line status interrupt
  69. MSInt EQU 00001000b ; modem status interrupt
  70. AllInt EQU RxInt+LSInt+MSInt
  71. CR EQU 0dh
  72. LF EQU 0ah
  73. EOM EQU '$'
  74. INT21 = 21h
  75. DISPLAY_FUNCTION = 9h
  76. DOS_OPEN = 3Dh
  77. DOS_CLOSE = 3Eh
  78. DOS_DONE = 0100h
  79. DOS_SUCCESS = 0h
  80. DOS_ERROR = 8000h
  81. DOS_GENFAIL = 0Ch
  82. EXPR_TYPE_SEG equ 0001b ; address type segment:offset
  83. OPEN_FLAG = 40h
  84. InitLCR EQU 03h ; initial LCR settings
  85. InitMCR EQU OUT2+SetRTS+SetDTR ; initial MCR settings
  86. BaudRate EQU 12 ; set it to 9600 BPS
  87. SOH EQU 1 ; start of header
  88. EOT EQU 4 ; end of transmission
  89. ToWOW32 EQU 1
  90. GETMEM EQU 2
  91. SETMEM EQU 3
  92. WAKEUP EQU 4
  93. RESP EQU 5
  94. ACK EQU 6
  95. NAK EQU 7
  96. PSZ EQU 8
  97. MAXCOUNT EQU 10
  98. Packet1 STRUC
  99. Start DB ?
  100. Command DB ?
  101. Len DW ?
  102. ToWOW32_OFF DW ?
  103. ToWOW32_SEL DW ?
  104. Packet1 ENDS
  105. Packet2 STRUC
  106. DD ?
  107. MEM_OFF DW ?
  108. MEM_SEL DW ?
  109. MEM_LENGTH DW ?
  110. DataM DB ?
  111. Packet2 ENDS
  112. junk1 STRUC
  113. _off DW ?
  114. _sel DW ?
  115. junk1 ENDS