home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / misc / serial.asm < prev    next >
Assembly Source File  |  1990-04-17  |  8KB  |  275 lines

  1.     Page    58,132
  2.     Title    SERIAL.ASM    Serial Port Controller
  3. ;******************************************************************************
  4. ;
  5. ;   Name:    SERIAL.ASM    Serial Port Controller
  6. ;
  7. ;   Group:    Emulator
  8. ;
  9. ;   Revision:    1.00
  10. ;
  11. ;   Date:    January 30, 1988
  12. ;
  13. ;   Author:    Randy W. Spurlock
  14. ;
  15. ;******************************************************************************
  16. ;
  17. ;  Module Functional Description:
  18. ;
  19. ;        This module contains all the code for the Apple
  20. ;    serial port controller.
  21. ;
  22. ;******************************************************************************
  23. ;
  24. ;  Changes:
  25. ;
  26. ;    DATE     REVISION                DESCRIPTION
  27. ;  --------   --------    -------------------------------------------------------
  28. ;   1/30/88    1.00    Original
  29. ;
  30. ;******************************************************************************
  31.     Page
  32. ;
  33. ;  Public Declarations
  34. ;
  35.     Public    Serial_ID        ; Serial port ID string
  36.     Public    Serial_Init        ; Serial port initialize routine
  37.     Public    Serial_Ctrl        ; Serial port control routine
  38.     Public    Serial_Rd        ; Serial port read routine
  39.     Public    Serial_Wrt        ; Serial port write routine
  40.     Public    Serial_Mem_Rd        ; Serial port memory read routine
  41.     Public    Serial_Mem_Wrt        ; Serial port memory write routine
  42.     Public    Serial_Exp_Rd        ; Serial port expansion read routine
  43.     Public    Serial_Exp_Wrt        ; Serial port expansion write routine
  44.     Public    Serial_Data        ; Serial port data segment pointers
  45. ;
  46. ;  External Declarations
  47. ;
  48.     Extrn    Slot_Address:Near    ; Get expansion slot address   (DEVICE)
  49.     Extrn    Error:Near        ; Apple emulator error routine    (APPLE)
  50.     Extrn    Exit:Near        ; Apple emulator exit routine    (APPLE)
  51. ;
  52. ;  LOCAL Equates
  53. ;
  54. ;        Equ        h        ;
  55. ;
  56. ;  Define any include files needed
  57. ;
  58.     Include     Macros.inc    ; Include the macro definitions
  59.     Include     Equates.inc    ; Include the equate definitions
  60.     Include     Strucs.inc    ; Include the structure definitions
  61.     .286c                ; Include 80286 instructions
  62.     Page
  63. ;
  64. ;  Define the emulator code segment
  65. ;
  66. Emulate Segment Word Public 'EMULATE'   ; Emulator code segment
  67.     Assume    cs:Emulate, ds:Nothing, es:Nothing
  68.     Subttl    Serial_Init    Serial Port Initialization
  69.     Page    +
  70. ;******************************************************************************
  71. ;
  72. ;    Serial_Init(RAM_Space, Slot_Number)
  73. ;
  74. ;
  75. ;        Return to the caller
  76. ;
  77. ;    Registers on Entry:
  78. ;
  79. ;        AX    - Slot number (0 - 7)
  80. ;        DS    - 65C02 RAM space
  81. ;
  82. ;    Registers on Exit:
  83. ;
  84. ;        AX-DX - Destroyed
  85. ;        SI-DI - Destroyed
  86. ;
  87. ;******************************************************************************
  88.         Even            ; Force procedure to even address
  89. Serial_Init    Proc    Near        ; Serial port initialization procedure
  90.  
  91.     ret                ; Return to the caller
  92. Serial_Init    Endp            ; End of the Serial_Init procedure
  93.     Subttl    Serial_Ctrl    Serial Port Control
  94.     Page    +
  95. ;******************************************************************************
  96. ;
  97. ;    Serial_Ctrl(RAM_Space, Slot_Number)
  98. ;
  99. ;
  100. ;        Return to the caller
  101. ;
  102. ;    Registers on Entry:
  103. ;
  104. ;        AX    - Slot number (0 - 7)
  105. ;        DS    - 65C02 RAM space
  106. ;
  107. ;    Registers on Exit:
  108. ;
  109. ;        AX-DX - Destroyed
  110. ;        SI-DI - Destroyed
  111. ;
  112. ;******************************************************************************
  113.         Even            ; Force procedure to even address
  114. Serial_Ctrl    Proc    Near        ; Serial port control procedure
  115.  
  116.     ret                ; Return to the caller
  117. Serial_Ctrl    Endp            ; End of the Serial_Ctrl procedure
  118.     Subttl    Serial_Rd    Serial Port Read
  119.     Page    +
  120. ;******************************************************************************
  121. ;
  122. ;    Serial_Rd(Effective_Address, Slot_Index)
  123. ;
  124. ;
  125. ;        Return to the caller
  126. ;
  127. ;    Registers on Entry:
  128. ;
  129. ;        BP    - Slot index (Slot number * 2)
  130. ;        DS:DI - 65C02 Effective address
  131. ;
  132. ;    Registers on Exit:
  133. ;
  134. ;        None
  135. ;
  136. ;******************************************************************************
  137.         Even            ; Force procedure to even address
  138. Serial_Rd    Proc    Near        ; Serial port read procedure
  139.  
  140.     ret                ; Return to the caller
  141. Serial_Rd    Endp            ; End of the Serial_Rd procedure
  142.     Subttl    Serial_Wrt    Serial Port Write
  143.     Page    +
  144. ;******************************************************************************
  145. ;
  146. ;    Serial_Wrt(Effective_Address, Slot_Index)
  147. ;
  148. ;
  149. ;        Return to the caller
  150. ;
  151. ;    Registers on Entry:
  152. ;
  153. ;        BP    - Slot index (Slot number * 2)
  154. ;        DS:DI - 65C02 Effective address
  155. ;
  156. ;    Registers on Exit:
  157. ;
  158. ;        None
  159. ;
  160. ;******************************************************************************
  161.         Even            ; Force procedure to even address
  162. Serial_Wrt    Proc    Near        ; Serial port write procedure
  163.  
  164.     ret                ; Return to the caller
  165. Serial_Wrt    Endp            ; End of the Serial_Wrt procedure
  166.     Subttl    Serial_Mem_Rd    Serial Port Memory Read
  167.     Page    +
  168. ;******************************************************************************
  169. ;
  170. ;    Serial_Mem_Rd(Effective_Address)
  171. ;
  172. ;
  173. ;        Return to the caller
  174. ;
  175. ;    Registers on Entry:
  176. ;
  177. ;        DS:DI - 65C02 Effective address
  178. ;
  179. ;    Registers on Exit:
  180. ;
  181. ;        None
  182. ;
  183. ;******************************************************************************
  184.         Even            ; Force procedure to even address
  185. Serial_Mem_Rd    Proc    Near        ; Serial port memory read procedure
  186.  
  187.     ret                ; Return to the caller
  188. Serial_Mem_Rd    Endp            ; End of the Serial_Mem_Rd procedure
  189.     Subttl    Serial_Mem_Wrt    Serial Port Memory Write
  190.     Page    +
  191. ;******************************************************************************
  192. ;
  193. ;    Serial_Port_Wrt(Effective_Address)
  194. ;
  195. ;
  196. ;        Return to the caller
  197. ;
  198. ;    Registers on Entry:
  199. ;
  200. ;        AL    - Memory value
  201. ;        DS:DI - 65C02 Effective address
  202. ;
  203. ;    Registers on Exit:
  204. ;
  205. ;        None
  206. ;
  207. ;******************************************************************************
  208.         Even            ; Force procedure to even address
  209. Serial_Mem_Wrt    Proc    Near        ; Serial port memory write procedure
  210.  
  211.     ret                ; Return to the caller
  212. Serial_Mem_Wrt    Endp            ; End of the Serial_Mem_Wrt procedure
  213.     Subttl    Serial_Exp_Rd    Serial Port Expansion Read
  214.     Page    +
  215. ;******************************************************************************
  216. ;
  217. ;    Serial_Exp_Rd(Effective_Address)
  218. ;
  219. ;        Read the memory location value (Byte)
  220. ;        Return to the caller
  221. ;
  222. ;    Registers on Entry:
  223. ;
  224. ;        DS:DI - 65C02 Effective address
  225. ;
  226. ;    Registers on Exit:
  227. ;
  228. ;        AL    - Memory value
  229. ;
  230. ;******************************************************************************
  231.         Even            ; Force procedure to even address
  232. Serial_Exp_Rd    Proc    Near        ; Serial port expansion read procedure
  233.     mov    al,ds:[di]        ; Read the memory location
  234.     ret                ; Return to the caller
  235. Serial_Exp_Rd    Endp            ; End of the Serial_Exp_Rd procedure
  236.     Subttl    Serial_Exp_Wrt    Serial Port Expansion Write
  237.     Page    +
  238. ;******************************************************************************
  239. ;
  240. ;    Serial_Exp_Wrt(Effective_Address)
  241. ;
  242. ;        Return to the caller (Area is NOT writable)
  243. ;
  244. ;    Registers on Entry:
  245. ;
  246. ;        AL    - Memory value
  247. ;        DS:DI - 65C02 Effective address
  248. ;
  249. ;    Registers on Exit:
  250. ;
  251. ;        None
  252. ;
  253. ;******************************************************************************
  254.         Even            ; Force procedure to even address
  255. Serial_Exp_Wrt    Proc    Near        ; Serial port expansion write procedure
  256.     ret                ; Return to the caller
  257. Serial_Exp_Wrt    Endp            ; End of the Serial_Exp_Wrt procedure
  258.     Page
  259. ;******************************************************************************
  260. ;
  261. ;    Define the serial port data structures
  262. ;
  263. ;******************************************************************************
  264. Serial_Data    Equ    This Word    ; Define the serial port data pointers
  265.         Slot_Data    <>    ; Pointers to serial port data areas
  266. Serial_ID    Equ    This Byte    ; Serial port ID string
  267.         Db    "Serial Port",0
  268. ;******************************************************************************
  269. ;
  270. ;    Define the end of the Emulator Code Segment
  271. ;
  272. ;******************************************************************************
  273. Emulate Ends
  274.     End                ; End of the Serial module
  275.