home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / tek / svc68k.s < prev    next >
Encoding:
Text File  |  1990-12-26  |  25.9 KB  |  1,087 lines

  1. /***********************************************************
  2. Copyright 1987 by Tektronix, Beaverton, Oregon,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its
  8. documentation for any purpose and without fee is hereby granted,
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in
  11. supporting documentation, and that the names of Tektronix or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.
  14.  
  15. TEKTRONIX DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. /*    Copyright(c) 1987  Tektronix, Inc.    */
  25. !
  26. ! svc.s --  This file contains the assembly language routines to
  27. !    implement display support on 431x machines.  Includes
  28. !    color, cursor, viewport control.
  29. !
  30. !    $Header: svc68k.s,v 1.1 89/09/30 18:53:03 keith Exp $";
  31. !
  32.  
  33. #include "svc.h"
  34. #include <errno.h>
  35.  
  36.     .data
  37.     .globl    _errno
  38.     .text
  39. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  40. ! SetCursorColor -- Set cursor RGB values
  41. !
  42. ! when called:
  43. !    4(sp):    ptr to six shorts for foreground red, green, blue
  44. !            followed by background red, green, blue
  45. !
  46. ! upon return:
  47. !    d0:    ==0 : successful
  48. !        <0  : error, error condition code in _errno
  49. !
  50. ! possible errors:
  51. !        null pointer
  52. !        display primitive failed
  53. !
  54.     .globl    _SetCursorColor
  55. _SetCursorColor:
  56.     movem.l    a0,-(sp)
  57.     move.l    8(sp),a0        !get pointer
  58.     move.l    a0,d0
  59.     beq.s    1$            !error if null
  60.     move.l    #setCursorColor,d0    !put function number in d0
  61.     trap    #DisplayTrapNumber
  62.     bcs.s    2$            !exit if error
  63.     clr.l    d0
  64.     movem.l    (sp)+,a0
  65.     rts
  66.  
  67. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  68.     bra.s    3$
  69. 2$:    move.l    d0,_errno        !load error (primitive failed)
  70. 3$:    move.l    #-1,d0
  71.     movem.l    (sp)+,a0
  72.     rts
  73. #ifdef not_needed
  74. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  75. ! GetCursorColor -- get current cursor RGB values
  76. !
  77. ! when called:
  78. !    4(sp):    pointer to six shorts for foreground red, green, blue,
  79. !            followed by background red, green, blue
  80. !
  81. ! upon return:
  82. !    d0:    ==0 : successful
  83. !        <0  : error, error condition code in _errno
  84. !
  85. ! possible errors:
  86. !        pointer was null
  87. !        display primitive failed
  88. !
  89.     .globl    _GetCursorColor
  90. _GetCursorColor:
  91.     movem.l    a0,-(sp)
  92.     move.l    8(sp),a0        !get pointer
  93.     move.l    a0,d0
  94.     beq.s    1$
  95.     move.l    #getCursorColor,d0    !put function number in d0
  96.     trap    #DisplayTrapNumber
  97.     bcs.s    2$            !exit if error
  98.     clr.l    d0
  99.     movem.l    (sp)+,a0
  100.     rts
  101.  
  102. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  103.     bra.s    3$
  104. 2$:    move.l    d0,_errno        !load error (primitive failed)
  105. 3$:    move.l    #-1,d0
  106.     movem.l    (sp)+,a0
  107.     rts
  108. #endif not_needed
  109. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  110. ! SetColorMap -- Set color map entries
  111. !
  112. ! when called:
  113. !    4(sp):    longword which gives size of color map array
  114. !    8(sp):    ptr to an array of color map entries
  115. !
  116. ! upon return:
  117. !    d0:    ==0 : successful
  118. !        <0  : error, error condition code in _errno
  119. !
  120. ! possible errors:
  121. !        null pointer
  122. !        display primitive failed
  123. !
  124.     .globl    _SetColorMap
  125. _SetColorMap:
  126.     movem.l    d1/a0,-(sp)
  127.     move.l    12(sp),d1        !get count
  128.     move.l    16(sp),a0        !get array pointer
  129.     move.l    a0,d0
  130.     beq.s    1$            !error if null
  131.     move.l    #setColorMap,d0        !put function number in d0
  132.     trap    #DisplayTrapNumber
  133.     bcs.s    2$            !exit if error
  134.     clr.l    d0
  135.     movem.l    (sp)+,d1/a0
  136.     rts
  137.  
  138. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  139.     bra.s    3$
  140. 2$:    move.l    d0,_errno        !load error (primitive failed)
  141. 3$:    move.l    #-1,d0
  142.     movem.l    (sp)+,d1/a0
  143.     rts
  144. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  145. ! GetColorMap -- get color map entries
  146. !
  147. ! when called:
  148. !    4(sp):    pointer to long to hold size of color map array
  149. !    8(sp):    pointer to array to hold color map
  150. !
  151. ! upon return:
  152. !    d0:    ==0 : successful
  153. !        <0  : error, error condition code in _errno
  154. !
  155. ! possible errors:
  156. !        null pointer
  157. !        display primitive failed
  158. !
  159.     .globl    _GetColorMap
  160. _GetColorMap:
  161.     movem.l    a0/a1,-(sp)        
  162.     move.l    12(sp),a1        !get size pointer
  163.     move.l    a1,d0
  164.     beq.s    1$            !error if arg = null pointer
  165.     move.l    16(sp),a0        !get color map pointer
  166.     move.l    a0,d0
  167.     beq.s    1$            !error if arg = null pointer
  168.     move.l    #getColorMap,d0        !put function number in d0
  169.     trap    #DisplayTrapNumber
  170.     bcs.s    2$            !exit if error
  171.     move.l    d0,(a1)            !put size in pointer
  172.     clr.l    d0
  173.     movem.l    (sp)+,a0/a1        !restore A0
  174.     rts
  175.  
  176. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  177.     bra.s    3$
  178. 2$:    move.l    d0,_errno        !load error (primitive failed)
  179. 3$:    move.l    #-1,d0
  180.     movem.l    (sp)+,a0/a1        !restore A0
  181.     rts
  182. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  183. ! SetGrayMap -- Set grayscale map entries
  184. !
  185. ! when called:
  186. !    4(sp):    longword which gives size of grayscale map array
  187. !    8(sp):    ptr to an array of grayscale map entries
  188. !
  189. ! upon return:
  190. !    d0:    ==0 : successful
  191. !        <0  : error, error condition code in _errno
  192. !
  193. ! possible errors:
  194. !        null pointer
  195. !        display primitive failed
  196. !
  197.     .globl    _SetGrayMap
  198. _SetGrayMap:
  199.     movem.l    d1/a0,-(sp)
  200.     move.l    12(sp),d1        !get count
  201.     move.l    16(sp),a0        !get array pointer
  202.     move.l    a0,d0
  203.     beq.s    1$            !error if null
  204.     move.l    #setGrayMap,d0        !put function number in d0
  205.     trap    #DisplayTrapNumber
  206.     bcs.s    2$            !exit if error
  207.     clr.l    d0
  208.     movem.l    (sp)+,d1/a0
  209.     rts
  210.  
  211. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  212.     bra.s    3$
  213. 2$:    move.l    d0,_errno        !load error (primitive failed)
  214. 3$:    move.l    #-1,d0
  215.     movem.l    (sp)+,d1/d2
  216.     rts
  217. #ifdef not_needed
  218. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  219. ! GetGrayMap -- get grayscale map entries
  220. !
  221. ! when called:
  222. !    4(sp):    pointer to long to hold size of grayscale map array
  223. !    8(sp):    pointer to array to hold grayscale map
  224. !
  225. ! upon return:
  226. !    d0:    ==0 : successful
  227. !        <0  : error, error condition code in _errno
  228. !
  229. ! possible errors:
  230. !        null pointer
  231. !        display primitive failed
  232. !
  233.     .globl    _GetGrayMap
  234. _GetGrayMap:
  235.     movem.l    a0/a1,-(sp)        
  236.     move.l    12(sp),a1        !get size pointer
  237.     move.l    a1,d0
  238.     beq.s    1$            !error if arg = null pointer
  239.     move.l    16(sp),a0        !get grayscale map pointer
  240.     move.l    a0,d0
  241.     beq.s    1$            !error if arg = null pointer
  242.     move.l    #getGrayMap,d0        !put function number in d0
  243.     trap    #DisplayTrapNumber
  244.     bcs.s    2$            !exit if error
  245.     move.l    d0,(a1)            !put size in pointer
  246.     clr.l    d0
  247.     movem.l    (sp)+,a0/a1        !restore A0
  248.     rts
  249.  
  250. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  251.     bra.s    3$
  252. 2$:    move.l    d0,_errno        !load error (primitive failed)
  253. 3$:    move.l    #-1,d0
  254.     movem.l    (sp)+,a0/a1        !restore A0
  255.     rts
  256. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  257. ! GetColorEntry -- get current value of a single color map entry
  258. !
  259. ! when called:
  260. !    4(sp):    pointer to a colormap entry whose index is set.
  261. !            Red, green, blue values of entry are set by routine.
  262. !
  263. ! upon return:
  264. !    d0:    ==0 : successful
  265. !        <0  : error, error condition code in _errno
  266. !
  267. ! possible errors:
  268. !        color entry pointer was null
  269. !        display primitive failed
  270. !
  271.     .globl    _GetColorEntry
  272. _GetColorEntry:
  273.     movem.l    d1/a0,-(sp)
  274.     move.l    12(sp),a0        !get pointer
  275.     move.l    a0,d0
  276.     beq.s    1$            !error if arg = null pointer
  277.     move.s    (a0),d1
  278.     move.l    #getColorEntry,d0    !put function number in d0
  279.     trap    #DisplayTrapNumber
  280.     bcs.s    2$            !exit if error
  281.     clr.l    d0
  282.     movem.l    (sp)+,d1/a0
  283.     rts
  284.  
  285. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  286.     bra.s    3$
  287. 2$:    move.l    d0,_errno        !load error (primitive failed)
  288. 3$:    move.l    #-1,d0
  289.     movem.l    (sp)+,d1/a0
  290.     rts
  291. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  292. ! GetGrayEntry -- get current value of a single grayscale map entry
  293. !
  294. ! when called:
  295. !    4(sp):    pointer to a grayscalemap entry whose index is set.
  296. !            Red, green, blue values of entry are set by routine.
  297. !
  298. ! upon return:
  299. !    d0:    ==0 : successful
  300. !        <0  : error, error condition code in _errno
  301. !
  302. ! possible errors:
  303. !        grayscale entry pointer was null
  304. !        display primitive failed
  305. !
  306.     .globl    _GetGrayEntry
  307. _GetGrayEntry:
  308.     movem.l    d1/a0,-(sp)
  309.     move.l    12(sp),a0        !get pointer
  310.     move.l    a0,d0
  311.     beq.s    1$            !error if arg = null pointer
  312.     move.s    (a0),d1
  313.     move.l    #getGrayEntry,d0    !put function number in d0
  314.     trap    #DisplayTrapNumber
  315.     bcs.s    2$            !exit if error
  316.     clr.l    d0
  317.     movem.l    (sp)+,d1/a0
  318.     rts
  319.  
  320. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  321.     bra.s    3$
  322. 2$:    move.l    d0,_errno        !load error (primitive failed)
  323. 3$:    move.l    #-1,d0
  324.     movem.l    (sp)+,d1/a0
  325.     rts
  326. #endif not_needed
  327. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  328. ! LockDisplay -- control access to display registers
  329. !
  330. ! when called:
  331. !    none
  332. !
  333. ! upon return:
  334. !    d0:    ==0 : successful
  335. !
  336. ! possible errors:
  337. !        none
  338. !
  339.     .globl    _LockDisplay
  340. _LockDisplay:
  341.     move.l    #lockDisplay,d0        !put function number in d0
  342.     trap    #DisplayTrapNumber
  343.     clr.l    d0            !indicate no error
  344.     rts
  345. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  346. ! UnlockDisplay -- allow other processes access to display registers
  347. !
  348. ! when called:
  349. !    none
  350. !
  351. ! upon return:
  352. !    d0:    ==0 : successful
  353. !
  354. ! possible errors:
  355. !        none
  356. !
  357.     .globl    _UnlockDisplay
  358. _UnlockDisplay:
  359.     move.l    #unlockDisplay,d0    !put function number in d0
  360.     trap    #DisplayTrapNumber
  361.     clr.l    d0            !indicate no error
  362.     rts
  363. #ifdef not_needed
  364. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  365. ! LockMap -- control access to color or grayscale map
  366. !
  367. ! when called:
  368. !    none
  369. !
  370. ! upon return:
  371. !    d0:    ==0 : successful
  372. !
  373. ! possible errors:
  374. !        none
  375. !
  376.     .globl    _LockMap
  377. _LockMap:
  378.     move.l    #lockMap,d0        !put function number in d0
  379.     trap    #DisplayTrapNumber
  380.     clr.l    d0            !indicate no error
  381.     rts
  382. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  383. ! UnlockMap -- allow other processes access to color or grayscale map
  384. !
  385. ! when called:
  386. !    none
  387. !
  388. ! upon return:
  389. !    d0:    ==0 : successful
  390. !
  391. ! possible errors:
  392. !        none
  393. !
  394.     .globl    _UnlockMap
  395. _UnlockMap:
  396.     move.l    #unlockMap,d0    !put function number in d0
  397.     trap    #DisplayTrapNumber
  398.     clr.l    d0            !indicate no error
  399.     rts
  400. #endif not_needed
  401. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  402. ! SetCursorSourceAndMask -- set cursor forms and offset
  403. !
  404. ! when called:
  405. !    4(sp):    ptr to a cursor form structure.
  406. !
  407. ! upon return:
  408. !    d0:    ==0 : successful
  409. !        <0  : error, error condition code in _errno
  410. !
  411. ! possible errors:
  412. !        null pointer
  413. !        display primitive failed
  414. !
  415.     .globl    _SetCursorSourceAndMask
  416. _SetCursorSourceAndMask:
  417.     movem.l    a0,-(sp)
  418.     move.l    8(sp),a0        !get pointer
  419.     move.l    a0,d0
  420.     beq.s    1$            !error if null
  421.     move.l    #setCursorSourceAndMask,d0    !put function number in d0
  422.     trap    #DisplayTrapNumber
  423.     bcs.s    2$            !exit if error
  424.     clr.l    d0
  425.     movem.l    (sp)+,a0
  426.     rts
  427.  
  428. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  429.     bra.s    3$
  430. 2$:    move.l    d0,_errno        !load error (primitive failed)
  431. 3$:    move.l    #-1,d0
  432.     movem.l    (sp)+,a0
  433.     rts
  434. #ifdef not_needed
  435. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  436. ! GetCursorSourceAndMask -- get current forms and offset
  437. !
  438. ! when called:
  439. !    4(sp):    pointer to a cursor form structure! both pointers within
  440. !            the structure must be non-null
  441. !
  442. ! upon return:
  443. !    d0:    ==0 : successful
  444. !        <0  : error, error condition code in _errno
  445. !
  446. ! possible errors:
  447. !        pointer was null
  448. !
  449.     .globl    _GetCursorSourceAndMask
  450. _GetCursorSourceAndMask:
  451.     movem.l    a0,-(sp)
  452.     move.l    8(sp),a0        !get pointer
  453.     move.l    a0,d0
  454.     beq.s    1$            !error if arg = null pointer
  455.     move.l    4(a0),d0        ! check for null pointers in struct
  456.     beq.s    1$
  457.     move.l    8(a0),d0
  458.     beq.s    1$
  459.     move.l    #getCursorSourceAndMask,d0    !put function number in d0
  460.     trap    #DisplayTrapNumber
  461.     bcs.s    2$            !shouldn't happen
  462.     clr.l    d0
  463.     movem.l    (sp)+,a0
  464.     rts
  465.  
  466. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  467.     bra.s    3$
  468. 2$:    move.l    d0,_errno        !load error (primitive failed)
  469. 3$:    move.l    #-1,d0
  470.     movem.l    (sp)+,a0
  471.     rts
  472. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  473. ! SetCrosshairCursor -- Set crosshair cursor values
  474. !
  475. ! when called:
  476. !    4(sp):    ptr to crosshair cursor structure
  477. !
  478. ! upon return:
  479. !    d0:    ==0 : successful
  480. !        <0  : error, error condition code in _errno
  481. !
  482. ! possible errors:
  483. !        null pointer
  484. !        display primitive failed
  485. !
  486.     .globl    _SetCrosshairCursor
  487. _SetCrosshairCursor:
  488.     movem.l    a0,-(sp)
  489.     move.l    8(sp),a0        !get pointer
  490.     move.l    a0,d0
  491.     beq.s    1$            !error if null
  492.     move.l    #setCrosshairCursor,d0    !put function number in d0
  493.     trap    #DisplayTrapNumber
  494.     bcs.s    2$            !exit if error
  495.     clr.l    d0
  496.     movem.l    (sp)+,a0
  497.     rts
  498.  
  499. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  500.     bra.s    3$
  501. 2$:    move.l    d0,_errno        !load error (primitive failed)
  502. 3$:    move.l    #-1,d0
  503.     movem.l    (sp)+,a0
  504.     rts
  505. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  506. ! GetCrosshairCursor -- get current crosshair cursor values
  507. !
  508. ! when called:
  509. !    4(sp):    pointer to crosshair cursor structure
  510. !
  511. ! upon return:
  512. !    d0:    ==0 : successful
  513. !        <0  : error, error condition code in _errno
  514. !
  515. ! possible errors:
  516. !        pointer was null
  517. !
  518.     .globl    _GetCrosshairCursor
  519. _GetCrosshairCursor:
  520.     movem.l    a0,-(sp)
  521.     move.l    8(sp),a0        !get pointer
  522.     move.l    a0,d0
  523.     beq.s    1$            !error if arg = null pointer
  524.     move.l    #getCrosshairCursor,d0    !put function number in d0
  525.     trap    #DisplayTrapNumber
  526.     bcs.s    2$            !shouldn't happen
  527.     clr.l    d0
  528.     movem.l    (sp)+,a0
  529.     rts
  530.  
  531. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  532.     bra.s    3$
  533. 2$:    move.l    d0,_errno        !load error (primitive failed)
  534. 3$:    move.l    #-1,d0
  535.     movem.l    (sp)+,a0
  536.     rts
  537. #endif not_needed
  538. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  539. ! SetCursorMode -- set which cursor is displayed
  540. !
  541. ! when called:
  542. !    4(sp):    cursor mode to set
  543. !
  544. ! upon return:
  545. !    d0:    ==0 : successful
  546. !        <0  : error, error condition code in _errno
  547. !
  548. ! possible errors:
  549. !        display primitive failed
  550. !
  551.     .globl    _SetCursorMode
  552. _SetCursorMode:
  553.     movem.l    d1,-(sp)
  554.     move.l    8(sp),d1        !get mode
  555.     move.l    #setCursorMode,d0    !put function number in d0
  556.     trap    #DisplayTrapNumber
  557.     bcs.s    1$            !exit if error
  558.     clr.l    d0
  559.     movem.l    (sp)+,d1
  560.     rts
  561.  
  562. 1$:    move.l    d0,_errno        !load error (primitive failed)
  563.     move.l    #-1,d0
  564.     movem.l    (sp)+,d1
  565.     rts
  566. #ifdef not_needed
  567. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  568. ! GetCursorMode -- get current cursor type
  569. !
  570. ! when called:
  571. !    no arguments
  572. !
  573. ! upon return:
  574. !    d0:    >0 : contains mode
  575. !
  576. ! possible errors:
  577. !        none
  578. !
  579.     .globl    _GetCursorMode
  580. _GetCursorMode:
  581.     move.l    #getCursorMode,d0    !put function number in d0
  582.     trap    #DisplayTrapNumber
  583.     rts
  584. #endif not_needed
  585. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  586. ! SetCursorPoint -- Display cursor at x,y.
  587. !    If CursorTrack is True, this is the same as SetMPosition.
  588. !
  589. ! when called:
  590. !    4(sp):    ptr to long consisting of x in ms word, y in ls word.
  591. !        (should use "struct POINT !" from graphics.h)
  592. !        Both x and y must valid screen numbers
  593. !
  594. ! upon return:
  595. !    d0:    ==0 : successful
  596. !        <0  : error, error condition code in _errno
  597. !
  598. ! possible errors:
  599. !        argument pointer was null
  600. !        graphics not initialized
  601. !        x or y outside range of screen
  602. !        display primitive failed
  603. !
  604.     .globl    _SetCursorPoint
  605. _SetCursorPoint:
  606.     movem.l    d1/a0,-(sp)
  607.     move.l    12(sp),a0        !get argument pointer
  608.     move.l    a0,d0            !is pointer valid
  609.     beq.s    1$            ! --no, null pointer, error
  610.     move.l    (a0),d1
  611.     move.l    #setCursorPoint,d0    !put function number in d0
  612.     trap    #DisplayTrapNumber
  613.     clr.l    d0
  614.     movem.l    (sp)+,d1/a0
  615.     rts
  616.  
  617. 1$:    move.l    #EINVAL,_errno        !load error (setCursorPoint failed)
  618. 3$:    move.l    #-1,d0
  619.     movem.l    (sp)+,d1/a0
  620.     rts
  621. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  622. ! SetCursorBounds -- change the current viewport
  623. !
  624. ! when called:
  625. !    4(sp):    pointer to two shorts which describe upper left bound
  626. !    8(sp):    pointer to two shorts which describe lower right bound
  627. !    (should use vsCursor * or struct POINT *).
  628. ! upon return:
  629. !    d0:    ==0 : successful
  630. !        <0  : error, error condition code in _errno
  631. !
  632. ! possible errors:
  633. !        null pointer
  634. !        display primitive failed
  635. !
  636.     .globl    _SetCursorBounds
  637. _SetCursorBounds:
  638.     movem.l    d1/d2/a0,-(sp)
  639.     move.l    16(sp),a0        !get ul pointer
  640.     move.l    a0,d0            ! and check if null
  641.     beq.s    2$
  642.     move.l    (a0),d1            !load ul x
  643.     move.l    20(sp),a0        !get lr pointer
  644.     move.l    a0,d0            ! and check if null
  645.     beq.s    2$
  646.     move.l    (a0),d2            !load lr x
  647.     move.l    #setMouseBounds,d0    !put function number in d0
  648.     trap    #DisplayTrapNumber
  649.     bcs.s    1$            !exit if error
  650.     clr.l    d0
  651.     movem.l    (sp)+,d1/d2/a0
  652.     rts
  653.  
  654. 1$:    move.l    d0,_errno        !load error (primitive failed)
  655.     bra.s    3$
  656. 2$:    move.l    #EINVAL,_errno
  657. 3$:    move.l    #-1,d0
  658.     movem.l    (sp)+,d1/d2/a0
  659.     rts
  660. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  661. ! SetCursorSpeed -- set amount cursor moves for every mouse movement
  662. !
  663. ! when called:
  664. !    4(sp):    ptr to three shorts (threshold, multiplier, divisor)
  665. !
  666. ! upon return:
  667. !    d0:    ==0 : successful
  668. !        <0  : error, error condition code in _errno
  669. !
  670. ! possible errors:
  671. !        argument pointer was null
  672. !        display primitive failed
  673. !
  674.     .globl    _SetCursorSpeed
  675. _SetCursorSpeed:
  676.     movem.l    a0,-(sp)
  677.     move.l    8(sp),a0        !get argument pointer
  678.     move.l    a0,d0            !is pointer valid
  679.     beq.s    1$            ! --no, null pointer, error
  680.  
  681.     move.l    #setCursorSpeed,d0    !put function number in d0
  682.     trap    #DisplayTrapNumber
  683.     bcs.s    2$            !exit if error
  684.     clr.l    d0
  685.     movem.l    (sp)+,a0
  686.     rts
  687.  
  688. 1$:    move.l    #EINVAL,_errno        !load error (null pointer)
  689.     bra.s    3$
  690. 2$:    move.l    d0,_errno        !load error (setCursorPoint failed)
  691. 3$:    move.l    #-1,d0
  692.     movem.l    (sp)+,a0
  693.     rts
  694. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  695. ! CursorEnable -- turn the cursor on and start tracking the mouse
  696. !
  697. ! when called:
  698. !    none
  699. !
  700. ! upon return:
  701. !    d0:    ==0 : successful
  702. !
  703. ! possible errors:
  704. !        primitive failure
  705. !
  706.     .globl    _CursorEnable
  707. _CursorEnable:
  708.     move.l    #cursorOn,d0        !turn on cursor
  709.     trap    #DisplayTrapNumber
  710.     move.l    #cursorLink,d0        !track cursor with mouse
  711.     trap    #DisplayTrapNumber
  712.     clr.l    d0            !indicate no error
  713.     rts
  714. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  715. ! CursorDisable -- turn the cursor off and stop tracking the mouse
  716. !
  717. ! when called:
  718. !    none
  719. !
  720. ! upon return:
  721. !    d0:    ==0 : successful
  722. !
  723. ! possible errors:
  724. !        primitive failure
  725. !
  726.     .globl    _CursorDisable
  727. _CursorDisable:
  728.     move.l    #cursorOff,d0        !turn off cursor
  729.     trap    #DisplayTrapNumber
  730.     move.l    #cursorUnlink,d0    !don't track cursor with mouse
  731.     trap    #DisplayTrapNumber
  732.     clr.l    d0            !indicate no error
  733.     rts
  734. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  735. ! MousePanOn
  736. !
  737. ! when called:
  738. !    none
  739. !
  740. ! upon return:
  741. !    d0:    == 0 : sucessful
  742. !
  743. ! possible errors:
  744. !        display primitive failed
  745. !
  746.     .globl    _MousePanOn
  747. _MousePanOn:
  748.     move.l    #cursorPanOn,d0    !put function number in d0
  749.     trap    #DisplayTrapNumber
  750.     clr.l    d0
  751.     rts
  752. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  753. ! DisplayOn --  make the display visible
  754. !
  755. ! when called:
  756. !    none
  757. !
  758. ! upon return:
  759. !    d0:    ==0 : successful
  760. !
  761. ! possible errors:
  762. !        none
  763. !
  764.     .globl    _DisplayOn
  765. _DisplayOn:
  766.     move.l    #displayOn,d0    !put function number in d0
  767.     trap    #DisplayTrapNumber
  768.     clr.l    d0
  769.     rts
  770. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  771. ! DisplayOff --  blank the display
  772. !
  773. ! when called:
  774. !    none
  775. !
  776. ! upon return:
  777. !    d0:    ==0 : successful
  778. !
  779. ! possible errors:
  780. !        none
  781. !
  782.     .globl    _DisplayOff
  783. _DisplayOff:
  784.     move.l    #displayOff,d0    !put function number in d0
  785.     trap    #DisplayTrapNumber
  786.     clr.l    d0
  787.     rts
  788. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  789. ! InvertVideo -- set pixel value of 1 to be white, 0 to black
  790. !
  791. ! when called:
  792. !    none
  793. !
  794. ! upon return:
  795. !    d0:    ==0 : successful
  796. !
  797. ! possible errors:
  798. !        none
  799. !
  800.     .globl    _InvertVideo
  801. _InvertVideo:
  802.     move.l    #whiteOnBlack,d0    !put function number in d0
  803.     trap    #DisplayTrapNumber
  804.     clr.l    d0
  805.     rts
  806. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  807. ! TimeoutOn --  enables automatic screen blanking (screen saver)
  808. !
  809. ! when called:
  810. !    none
  811. !
  812. ! upon return:
  813. !    d0:    ==0 : successful
  814. !
  815. ! possible errors:
  816. !        none
  817. !
  818.     .globl    _TimeoutOn
  819. _TimeoutOn:
  820.     move.l    #timeoutOn,d0    !put function number in d0
  821.     trap    #DisplayTrapNumber
  822.     clr.l    d0
  823.     rts
  824. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  825. ! TimeoutOff --  disables automatic screen blanking (screen saver)
  826. !
  827. ! when called:
  828. !    none
  829. !
  830. ! upon return:
  831. !    d0:    ==0 : successful
  832. !
  833. ! possible errors:
  834. !        none
  835. !
  836.     .globl    _TimeoutOff
  837. _TimeoutOff:
  838.     move.l    #timeoutOff,d0    !put function number in d0
  839.     trap    #DisplayTrapNumber
  840.     clr.l    d0
  841.     rts
  842. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  843. ! GetViewport -- change the current viewport
  844. !
  845. ! when called:
  846. !    4(sp):    pointer to long which can hold x in ms word, y in ls.
  847. !    (should use vsCursor * or struct POINT *).
  848. ! upon return:
  849. !    d0:    ==0 : successful
  850. !        <0  : error, error condition code in _errno
  851. !
  852. ! possible errors:
  853. !        null pointer
  854. !        display primitive failed
  855. !
  856.     .globl    _GetViewport
  857. _GetViewport:
  858.     movem.l    d1/a0,-(sp)
  859.     move.l    12(sp),a0        !get arg pointer
  860.     move.l    a0,d0            ! and check if null
  861.     beq.s    2$
  862.     move.l    #getViewport,d0        !put function number in d0
  863.     trap    #DisplayTrapNumber
  864.     bcs.s    1$            !exit if error
  865.     move.l    d0,(a0)            !retrieve x, y pair
  866.     clr.l    d0            !clear return code
  867.     movem.l    (sp)+,d1/a0
  868.     rts
  869.  
  870. 1$:    move.l    d0,_errno        !load error (primitive failed)
  871.     bra.s    3$
  872. 2$:    move.l    #EINVAL,_errno
  873. 3$:    move.l    #-1,d0
  874.     movem.l    (sp)+,d1/a0
  875.     rts
  876.  
  877. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  878. ! SetViewport -- change the current viewport
  879. !
  880. ! when called:
  881. !    4(sp):    pointer to long consisting of x in ms word, y in ls.
  882. !    (should use vsCursor * or struct POINT *).
  883. ! upon return:
  884. !    d0:    ==0 : successful
  885. !        <0  : error, error condition code in _errno
  886. !
  887. ! possible errors:
  888. !        null pointer
  889. !        display primitive failed
  890. !
  891.     .globl    _SetViewport
  892. _SetViewport:
  893.     movem.l    d1/a0,-(sp)
  894.     move.l    12(sp),a0        !get arg pointer
  895.     move.l    a0,d0            ! and check if null
  896.     beq.s    2$
  897.     move.l    (a0),d1            !load x, y pair
  898.     move.l    #setViewport,d0        !put function number in d0
  899.     trap    #DisplayTrapNumber
  900.     bcs.s    1$            !exit if error
  901.     clr.l    d0            !clear return code
  902.     movem.l    (sp)+,d1/a0
  903.     rts
  904.  
  905. 1$:    move.l    d0,_errno        !load error (primitive failed)
  906.     bra.s    3$
  907. 2$:    move.l    #EINVAL,_errno
  908. 3$:    move.l    #-1,d0
  909.     movem.l    (sp)+,d1/a0
  910.     rts
  911. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  912. ! JoyPanOn --  enable joydisk panning
  913. !
  914. ! when called:
  915. !    none
  916. !
  917. ! upon return:
  918. !    d0:    ==0 : successful
  919. !
  920. ! possible errors:
  921. !        none
  922. !
  923.     .globl    _JoyPanOn
  924. _JoyPanOn:
  925.     move.l    #joyPanOn,d0    !put function number in d0
  926.     trap    #DisplayTrapNumber
  927.     clr.l    d0
  928.     rts
  929. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  930. ! JoyPanOff --  disable joydisk panning
  931. !
  932. ! when called:
  933. !    none
  934. !
  935. ! upon return:
  936. !    d0:    ==0 : successful
  937. !
  938. ! possible errors:
  939. !        none
  940. !
  941.     .globl    _JoyPanOff
  942. _JoyPanOff:
  943.     move.l    #joyPanOff,d0    !put function number in d0
  944.     trap    #DisplayTrapNumber
  945.     clr.l    d0
  946.     rts
  947.  
  948. !------------------------------------------------------------------------------!
  949. !
  950. ! ProtectDestination -- tell the OS that the user will be drawing or reading
  951. !    directly on the screen in the defined "destination" rectangle.
  952. !    There are only two simultaneously protected rectangles:
  953. !    the "source" rectangle and the "destination" rectangle.
  954. !    It should therefore get the cursor out of the way.
  955. !
  956. ! when called: ProtectDestination (Xmin, Ymin, Xmax, Ymax)
  957. !    2 longs for x,y upper left corner.
  958. !    2 longs for x,y lower right corner.
  959. !
  960. ! upon return:
  961. !    d0:    ==0 : successful
  962. !
  963. ! possible errors:
  964. !    None.
  965. !
  966.     .base    0
  967. RegD1:   .zerol 1
  968. return_addr: .zerol 1
  969. Xmin:    .zerol 1
  970. Ymin:    .zerol 1
  971. Xmax:    .zerol 1
  972. Ymax:    .zerol 1
  973.  
  974.     .text
  975.     .globl    _ProtectDestination
  976. _ProtectDestination:
  977.     movem.l    d2,-(sp) ! protect registers (D0/D1/A0/A1 c assumes are crashed)
  978.  
  979.     move.l    Xmin(sp),d1        ! fetch Xmin
  980.     Swap    d1            ! put into XY form.
  981.     move.l    Ymin(sp),d2        !
  982.     move.w    d2,d1            ! now I have XYmin.
  983.  
  984.     move.l    Xmax(sp),d2        ! fetch Xmax
  985.     Swap    d2            ! put into XY form.
  986.     move.l    Ymax(sp),d0        !
  987.     move.w    d0,d2            ! now I have XYmax.
  988.  
  989.     move.l    #setDest,d0        !put function number in d0, d1, d2
  990.     trap    #DisplayTrapNumber
  991.     bcs.s    07$            !exit if error
  992.  
  993. 02$:    clr.l    d0            !indicate no error
  994. 99$:    movem.l    (sp)+,d2        !restore
  995.     rts
  996.  
  997. !
  998. !---- this should not be reached ----
  999. !
  1000. 07$:    move.l    d0,_errno        !load error (primitive failed)
  1001.     move.l    #-1,d0            !
  1002.     Bra.s    99$
  1003. !------------------------------------------------------------------------------!
  1004. !
  1005. ! ProtectSource -- tell the OS that the user will be drawing or reading
  1006. !    directly on the screen in the defined "source" rectangle.
  1007. !    There are only two simultaneously protected rectangles:
  1008. !    the "source" rectangle and the "destination" rectangle.
  1009. !    It should therefore get the cursor out of the way.
  1010. !
  1011. ! when called: ProtectSource (Xmin, Ymin, Xmax, Ymax)
  1012. !    2 longs for x,y upper left corner.
  1013. !    2 longs for x,y lower right corner.
  1014. !
  1015. ! upon return:
  1016. !    d0:    ==0 : successful
  1017. !
  1018. ! possible errors:
  1019. !    None.
  1020. !
  1021.     .base    0
  1022. RegD1:   .zerol 1
  1023. return_addr: .zerol 1
  1024. Xmin:    .zerol 1
  1025. Ymin:    .zerol 1
  1026. Xmax:    .zerol 1
  1027. Ymax:    .zerol 1
  1028.  
  1029.     .text
  1030.     .globl    _ProtectSource
  1031. _ProtectSource:
  1032.     movem.l    d2,-(sp) ! protect registers (D0/D1/A0/A1 c assumes are crashed)
  1033.  
  1034.     move.l    Xmin(sp),d1        ! fetch Xmin
  1035.     Swap    d1            ! put into XY form.
  1036.     move.l    Ymin(sp),d2        !
  1037.     move.w    d2,d1            ! now I have XYmin.
  1038.  
  1039.     move.l    Xmax(sp),d2        ! fetch Xmax
  1040.     Swap    d2            ! put into XY form.
  1041.     move.l    Ymax(sp),d0        !
  1042.     move.w    d0,d2            ! now I have XYmax.
  1043.  
  1044.     move.l    #setSource,d0        !put function number in d0, d1, d2
  1045.     trap    #DisplayTrapNumber
  1046.     bcs.s    07$            !exit if error
  1047.  
  1048. 02$:    clr.l    d0            !indicate no error
  1049. 99$:    movem.l    (sp)+,d2        !restore
  1050.     rts
  1051.  
  1052. !
  1053. !---- this should not be reached ----
  1054. !
  1055. 07$:    move.l    d0,_errno        !load error (primitive failed)
  1056.     move.l    #-1,d0            !
  1057.     Bra.s    99$
  1058.  
  1059. !------------------------------------------------------------------------------!
  1060. !
  1061. ! ProtectCursorCompleted -- tell the OS that the cursor may be replaced in
  1062. !    either the "source" rectangle protected by the ProtectSource()
  1063. !    routine or the "destination" rectangle protected by the
  1064. !    ProtectDestination() routine.
  1065. !
  1066. ! when called:
  1067. !    none
  1068. !
  1069. ! upon return:
  1070. !    d0:    ==0 : successful
  1071. !
  1072. ! possible errors:
  1073. !        none
  1074. !
  1075.     .text
  1076.     .globl    _ProtectCursorCompleted
  1077. _ProtectCursorCompleted:
  1078.     move.l    #updateComplete,d0    !put function number in d0
  1079.     trap    #DisplayTrapNumber
  1080.     clr.l    d0            !indicate no error
  1081.     rts
  1082.  
  1083.  
  1084.