home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / code / asm_sepi.sit < prev    next >
Encoding:
Text File  |  1988-05-14  |  3.6 KB  |  124 lines

  1. 11-May-88 21:24:45-MDT,3765;000000000000
  2. Return-Path: <u-lchoqu%sunset@cs.utah.edu>
  3. Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Wed, 11 May 88 21:24:39 MDT
  4. Received: by cs.utah.edu (5.54/utah-2.0-cs)
  5.     id AA03679; Wed, 11 May 88 21:25:13 MDT
  6. Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
  7.     id AA29277; Wed, 11 May 88 21:25:11 MDT
  8. Date: Wed, 11 May 88 21:25:11 MDT
  9. From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
  10. Message-Id: <8805120325.AA29277@sunset.utah.edu>
  11. To: rthum@simtel20.arpa
  12. Subject: Qplot.asm
  13.  
  14. High Speed Plotting Routines
  15. ----------------------------
  16.  
  17. Below you will find a slick piece of 68000 code (Lisa assembler,
  18. but translation to MDS6800 is a piece of cake) -- these routines will
  19. blast black or white dots on your Macintosh screen *very* quickly.
  20.  
  21. The procedures qplotblack and qplotwhite are called like so, from
  22. Rascal:
  23.   QPlotWhite(x,y);
  24.   QPlotBlack(x,y);
  25.  
  26. The x and y are in global coordinates.  You must make sure not
  27. to draw on a non-sceen position -- it is possible to plot right
  28. into other parts of memory with these routines.
  29.  
  30.  
  31. --------------------------------------------------------------------------
  32.  
  33. Happy Holidays from the Reed Academic Software Development Laboratory!
  34.  
  35.   Richard Crandall
  36.   Marianne Colgrove
  37.   Josh Doenias
  38.   Scott Gillespie
  39.   Michael McGreevy
  40.   Greg Stein (in absentia)
  41.   Ann Muir Thomas
  42.    and :-)
  43.  
  44.   "That's what he *does*. That's *all* he does." (Sgt. Kyle Reese, Tech Com).
  45.  
  46. {decvax, ucbvax, pur-ee, uw-beaver, masscomp, cbosg, aat,
  47.  mit-ems, psu-cs, uoregon, orstcs, ihnp4, uf-cgrl, ssc-vax}!tektronix
  48.                                 \
  49.                                          +--!reed!maclab
  50. {teneron, ogcvax, muddcs, cadic, oresoft, grpwre,             /
  51.        harvard, psu-cs, omen, isonvax, nsc-pdc}-------------+
  52.  
  53. ------------------------------------------------------------------------------
  54. ;
  55. ; High-speed plotting
  56. ;
  57. ; Written by Greg Stein
  58. ;   84.09.27.gjs
  59. ;   85.12.10.spg --- Made compatible with all mac configurations.
  60. ;
  61. ; Procedure QPlotWhite(x,y : integer);
  62. ; Procedure QPlotBlack(x,y : Integer);
  63. ;
  64.  
  65.  
  66. ScreenBase   .EQU   $824         ; top of screen screen address
  67. ScreenRow    .EQU   $106         ; screen rowbytes
  68.  
  69.  
  70.           .PROC QPlotWhite
  71.  
  72.           move.l    (sp)+,a1     ; save return address
  73.           move.w    (sp)+,d0     ; y value
  74.           move.w    (sp)+,d1     ; x value
  75.  
  76.           ext.l     d0               ; clear upper bits
  77.           muls      ScreenRow,d0 ; multiply y by 64 to find line base
  78.  
  79.           move.w    d1,d2
  80.           and.w     #$07,d2        ; obtain bit number
  81.           move.b    WhiteTable(d2),d2   ; get mask bits
  82.  
  83.           move.l    ScreenBase,a0  ; get screen base
  84.  
  85.           lsr.w     #$3,d1   ; divide x by 8 to obtain byte offset
  86.           add.w     d1,a0   ; add x byte offset to line base
  87.  
  88.           and.b     d2,0(a0,d0)
  89.  
  90.           jmp       (a1)   ; done, return
  91.  
  92. WhiteTable:
  93.           .byte    $7f, $bf, $df, $ef, $f7, $fb, $fd, $fe
  94.  
  95.  
  96.  
  97.           .PROC QPlotBlack
  98.  
  99.           move.l    (sp)+,a1   ; save return address
  100.           move.w    (sp)+,d0   ; y value
  101.           move.w    (sp)+,d1   ; x value
  102.  
  103.           ext.l     d0   ; clear upper bits
  104.           muls      screenRow,d0 ; multiply y by 64 to find line base
  105.  
  106.           move.w    d1,d2
  107.           and.w     #$07,d2        ; obtain bit number
  108.           move.b    BlackTable(d2),d2   ; get mask bits
  109.  
  110.           move.l    ScreenBase,a0  ; get screen base
  111.  
  112.           lsr.w     #$3,d1   ; divide x by 8 to obtain byte offset
  113.           add.w     d1,a0   ; add x byte offset to line base
  114.  
  115.           or.b      d2,0(a0,d0)
  116.  
  117.           jmp       (a1)   ; done, return
  118.  
  119. BlackTable:
  120.           .byte    $80, $40, $20, $10, $08, $04, $02, $01
  121.  
  122.  
  123.           .end
  124.