home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / misc / hardware.asm < prev    next >
Assembly Source File  |  1990-03-30  |  12KB  |  401 lines

  1.     Page    58,132
  2.     Title    HARDWARE.ASM    Hardware Page Access Routines
  3. ;******************************************************************************
  4. ;
  5. ;   Name:    HARDWARE.ASM    Hardware Page Access Routines
  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 hardware
  20. ;    page access routines.
  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    Hardware_Read        ; Hardware page read routine
  36.     Public    Hardware_Write        ; Hardware page write routine
  37.     Public    Utility_Strobe        ; Apple utility strobe routine
  38.     Public    Output_0_Off        ; Annunciator output 0 off routine
  39.     Public    Output_0_On        ; Annunciator output 0 on routine
  40.     Public    Output_1_Off        ; Annunciator output 1 off routine
  41.     Public    Output_1_On        ; Annunciator output 1 on routine
  42.     Public    Output_2_Off        ; Annunciator output 2 off routine
  43.     Public    Output_2_On        ; Annunciator output 2 on routine
  44.     Public    Output_3_Off        ; Annunciator output 3 off routine
  45.     Public    Output_3_On        ; Annunciator output 3 on routine
  46.     Public    Do_Nothing        ; Do nothing routine
  47. ;
  48. ;  External Declarations
  49. ;
  50.     Extrn    Slot_Read:Word        ; Expansion slot read table     (DATA)
  51.     Extrn    Slot_Write:Word     ; Expansion slot write table     (DATA)
  52.     Extrn    IO_Read_Table:Word    ; I/O read table         (DATA)
  53.     Extrn    IO_Write_Table:Word    ; I/O write table         (DATA)
  54.     Extrn    Current_Slot:Byte    ; Current active slot number     (DATA)
  55. ;
  56. ;  LOCAL Equates
  57. ;
  58. CARD_MASK    Equ    07h        ; Card slot mask value
  59. ;
  60. ;  Define any include files needed
  61. ;
  62.     Include     Macros.inc    ; Include the macro definitions
  63.     Include     Equates.inc    ; Include the equate definitions
  64.     .286c                ; Include 80286 instructions
  65.     Page
  66. ;
  67. ;  Define the emulator code segment
  68. ;
  69. Emulate Segment Word Public 'EMULATE'   ; Emulator code segment
  70.     Assume    cs:Emulate, ds:Nothing, es:Nothing
  71.     Subttl    Hardware_Read    Hardware Page Read
  72.     Page    +
  73. ;******************************************************************************
  74. ;
  75. ;    Hardware_Read(Effective_Address)
  76. ;
  77. ;        If this is a card slot I/O access
  78. ;            Isolate the card slot number
  79. ;            Update the current active slot number
  80. ;            Jump to correct routine to process
  81. ;        Else this is NOT card slot I/O
  82. ;            Isolate the memory location address
  83. ;            Jump to correct routine to process
  84. ;        Endif
  85. ;        Return to the caller (Never executed)
  86. ;
  87. ;    Registers on Entry:
  88. ;
  89. ;        DS:DI - 65C02 Effective address
  90. ;
  91. ;    Registers on Exit:
  92. ;
  93. ;        BP    - Destroyed
  94. ;
  95. ;******************************************************************************
  96.         Even            ; Force procedure to even address
  97. Hardware_Read    Proc    Near        ; Hardware page read procedure
  98.     mov    ax,di            ; Get the effective address
  99.     or    al,al            ; Check for card slot I/O
  100.     js    Card_Read        ; Jump if this is card slot I/O
  101.     xor    ah,ah            ; Convert address to full word
  102.     shl    ax,1            ; Convert address to table index
  103.     mov    bp,ax            ; Setup to jump to correct routine
  104.     jmp    cs:[bp + IO_Read_Table] ; Jump to correct routine to process
  105. Card_Read:
  106.     shr    al,4            ; Right justify the card slot value
  107.     and    al,CARD_MASK        ; Mask off all but card slot value
  108.     mov    cs:[Current_Slot],al    ; Update the current active slot
  109.     xor    ah,ah            ; Convert slot number to full word
  110.     shl    ax,1            ; Convert slot number to table index
  111.     mov    bp,ax            ; Setup to jump to correct routine
  112.     jmp    cs:[bp + Slot_Read]    ; Jump to correct routine to process
  113.     ret                ; Return to the caller (Never Executed)
  114. Hardware_Read    Endp            ; End of the Hardware_Read procedure
  115.     Subttl    Hardware_Write    Hardware Page Write
  116.     Page    +
  117. ;******************************************************************************
  118. ;
  119. ;    Hardware_Write(Effective_Address, Value)
  120. ;
  121. ;        Save the required registers
  122. ;        If this is a card slot I/O access
  123. ;            Isolate the card slot number
  124. ;            Update the current active slot number
  125. ;            Restore the required registers
  126. ;            Jump to correct routine to process
  127. ;        Else this is NOT card slot I/O
  128. ;            Isolate the memory location address
  129. ;            Restore the required registers
  130. ;            Jump to correct routine to process
  131. ;        Endif
  132. ;        Return to the caller (Never executed)
  133. ;
  134. ;    Registers on Entry:
  135. ;
  136. ;        AL    - Memory value
  137. ;        DS:DI - 65C02 Effective address
  138. ;
  139. ;    Registers on Exit:
  140. ;
  141. ;        BP    - Destroyed
  142. ;
  143. ;******************************************************************************
  144.         Even            ; Force procedure to even address
  145. Hardware_Write    Proc    Near        ; Hardware page write procedure
  146.     Save    ax            ; Save the required registers
  147.     mov    ax,di            ; Get the effective address
  148.     or    al,al            ; Check for card slot I/O
  149.     js    Card_Write        ; Jump if this is card slot I/O
  150.     xor    ah,ah            ; Convert address to full word
  151.     shl    ax,1            ; Convert address to table index
  152.     mov    bp,ax            ; Setup to jump to correct routine
  153.     Restore ax            ; Restore the required registers
  154.     jmp    cs:[bp + IO_Write_Table]; Jump to correct routine to process
  155. Card_Write:
  156.     shr    al,4            ; Right justify the card slot value
  157.     and    al,CARD_MASK        ; Mask off all but card slot value
  158.     mov    cs:[Current_Slot],al    ; Update the current active slot
  159.     xor    ah,ah            ; Convert slot number to full word
  160.     shl    ax,1            ; Convert slot number to table index
  161.     mov    bp,ax            ; Setup to jump to correct routine
  162.     Restore ax            ; Restore the required registers
  163.     jmp    cs:[bp + Slot_Write]    ; Jump to correct routine to process
  164.     ret                ; Return to the caller (Never Executed)
  165. Hardware_Write    Endp            ; End of the Hardware_Write procedure
  166.     Subttl    Utility_Strobe    Apple Utility Strobe Routine
  167.     Page    +
  168. ;******************************************************************************
  169. ;
  170. ;    Utility_Strobe()
  171. ;
  172. ;
  173. ;        Return to the caller
  174. ;
  175. ;    Registers on Entry:
  176. ;
  177. ;        None
  178. ;
  179. ;    Registers on Exit:
  180. ;
  181. ;        None
  182. ;
  183. ;******************************************************************************
  184.         Even            ; Force procedure to even address
  185. Utility_Strobe    Proc    Near        ; Utility strobe procedure
  186.  
  187.     ret                ; Return to the caller
  188. Utility_Strobe    Endp            ; End of the Utility_Strobe procedure
  189.     Subttl    Output_0_Off    Annunciator Output 0 Off Routine
  190.     Page    +
  191. ;******************************************************************************
  192. ;
  193. ;    Output_0_Off()
  194. ;
  195. ;
  196. ;        Return to the caller
  197. ;
  198. ;    Registers on Entry:
  199. ;
  200. ;        None
  201. ;
  202. ;    Registers on Exit:
  203. ;
  204. ;        None
  205. ;
  206. ;******************************************************************************
  207.         Even            ; Force procedure to even address
  208. Output_0_Off    Proc    Near        ; Annunciator output 0 off procedure
  209.  
  210.     ret                ; Return to the caller
  211. Output_0_Off    Endp            ; End of the Output_0_Off procedure
  212.     Subttl    Output_0_On    Annunciator Output 0 On Routine
  213.     Page    +
  214. ;******************************************************************************
  215. ;
  216. ;    Output_0_On()
  217. ;
  218. ;
  219. ;        Return to the caller
  220. ;
  221. ;    Registers on Entry:
  222. ;
  223. ;        None
  224. ;
  225. ;    Registers on Exit:
  226. ;
  227. ;        None
  228. ;
  229. ;******************************************************************************
  230.         Even            ; Force procedure to even address
  231. Output_0_On    Proc    Near        ; Annunciator output 0 on procedure
  232.  
  233.     ret                ; Return to the caller
  234. Output_0_On    Endp            ; End of the Output_0_On procedure
  235.     Subttl    Output_1_Off    Annunciator Output 1 Off Routine
  236.     Page    +
  237. ;******************************************************************************
  238. ;
  239. ;    Output_1_Off()
  240. ;
  241. ;
  242. ;        Return to the caller
  243. ;
  244. ;    Registers on Entry:
  245. ;
  246. ;        None
  247. ;
  248. ;    Registers on Exit:
  249. ;
  250. ;        None
  251. ;
  252. ;******************************************************************************
  253.         Even            ; Force procedure to even address
  254. Output_1_Off    Proc    Near        ; Annunciator output 1 off procedure
  255.  
  256.     ret                ; Return to the caller
  257. Output_1_Off    Endp            ; End of the Output_1_Off procedure
  258.     Subttl    Output_1_On    Annunciator Output 1 On Routine
  259.     Page    +
  260. ;******************************************************************************
  261. ;
  262. ;    Output_1_On()
  263. ;
  264. ;
  265. ;        Return to the caller
  266. ;
  267. ;    Registers on Entry:
  268. ;
  269. ;        None
  270. ;
  271. ;    Registers on Exit:
  272. ;
  273. ;        None
  274. ;
  275. ;******************************************************************************
  276.         Even            ; Force procedure to even address
  277. Output_1_On    Proc    Near        ; Annunciator output 1 on procedure
  278.  
  279.     ret                ; Return to the caller
  280. Output_1_On    Endp            ; End of the Output_1_On procedure
  281.     Subttl    Output_2_Off    Annunciator Output 2 Off Routine
  282.     Page    +
  283. ;******************************************************************************
  284. ;
  285. ;    Output_2_Off()
  286. ;
  287. ;
  288. ;        Return to the caller
  289. ;
  290. ;    Registers on Entry:
  291. ;
  292. ;        None
  293. ;
  294. ;    Registers on Exit:
  295. ;
  296. ;        None
  297. ;
  298. ;******************************************************************************
  299.         Even            ; Force procedure to even address
  300. Output_2_Off    Proc    Near        ; Annunciator output 2 off procedure
  301.  
  302.     ret                ; Return to the caller
  303. Output_2_Off    Endp            ; End of the Output_2_Off procedure
  304.     Subttl    Output_2_On    Annunciator Output 2 On Routine
  305.     Page    +
  306. ;******************************************************************************
  307. ;
  308. ;    Output_2_On()
  309. ;
  310. ;
  311. ;        Return to the caller
  312. ;
  313. ;    Registers on Entry:
  314. ;
  315. ;        None
  316. ;
  317. ;    Registers on Exit:
  318. ;
  319. ;        None
  320. ;
  321. ;******************************************************************************
  322.         Even            ; Force procedure to even address
  323. Output_2_On    Proc    Near        ; Annunciator output 2 on procedure
  324.  
  325.     ret                ; Return to the caller
  326. Output_2_On    Endp            ; End of the Output_2_On procedure
  327.     Subttl    Output_3_Off    Annunciator Output 3 Off Routine
  328.     Page    +
  329. ;******************************************************************************
  330. ;
  331. ;    Output_3_Off()
  332. ;
  333. ;
  334. ;        Return to the caller
  335. ;
  336. ;    Registers on Entry:
  337. ;
  338. ;        None
  339. ;
  340. ;    Registers on Exit:
  341. ;
  342. ;        None
  343. ;
  344. ;******************************************************************************
  345.         Even            ; Force procedure to even address
  346. Output_3_Off    Proc    Near        ; Annunciator output 3 off procedure
  347.  
  348.     ret                ; Return to the caller
  349. Output_3_Off    Endp            ; End of the Output_3_Off procedure
  350.     Subttl    Output_3_On    Annunciator Output 3 On Routine
  351.     Page    +
  352. ;******************************************************************************
  353. ;
  354. ;    Output_3_On()
  355. ;
  356. ;
  357. ;        Return to the caller
  358. ;
  359. ;    Registers on Entry:
  360. ;
  361. ;        None
  362. ;
  363. ;    Registers on Exit:
  364. ;
  365. ;        None
  366. ;
  367. ;******************************************************************************
  368.         Even            ; Force procedure to even address
  369. Output_3_On    Proc    Near        ; Annunciator output 3 on procedure
  370.  
  371.     ret                ; Return to the caller
  372. Output_3_On    Endp            ; End of the Output_3_On procedure
  373.     Subttl    Do_Nothing    Do nothing Routine
  374.     Page    +
  375. ;******************************************************************************
  376. ;
  377. ;    Do_Nothing()
  378. ;
  379. ;        Return to the caller
  380. ;
  381. ;    Registers on Entry:
  382. ;
  383. ;        None
  384. ;
  385. ;    Registers on Exit:
  386. ;
  387. ;        None
  388. ;
  389. ;******************************************************************************
  390.         Even            ; Force procedure to even address
  391. Do_Nothing    Proc    Near        ; Do nothing procedure
  392.     ret                ; Return to the caller
  393. Do_Nothing    Endp            ; End of the Do_Nothing procedure
  394. ;******************************************************************************
  395. ;
  396. ;    Define the end of the Emulator Code Segment
  397. ;
  398. ;******************************************************************************
  399. Emulate Ends
  400.     End                ; End of the Hardware module
  401.