home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / commercial-software / programming / AZTEC302.ZIP / G.ARC < prev    next >
Text File  |  1998-09-16  |  14KB  |  858 lines

  1. mode.c
  2. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  3.  
  4. extern int _maxx;
  5. extern int _xaspect, _yaspect;
  6. extern char _color;
  7. extern    int _plotf,_plottbl[];
  8.  
  9. mode (val)
  10. {
  11.     switch (val)  {
  12.     case 'l': case 'L': case 3:
  13.         scr_call (3);
  14.         break;
  15.     case 'm': case 'M': case 4:
  16.         _plotf = _plottbl[0];
  17.         _xaspect = 6;
  18.         _yaspect = 5;
  19.         _maxx = 319;
  20.         scr_call (4);
  21.         break;
  22.     case 'h': case 'H': case 6:
  23.         _plotf = _plottbl[1];
  24.         _xaspect = 4;
  25.         _yaspect = 1;
  26.         _maxx = 639;
  27.         scr_call (6);
  28.         break;
  29.     default:
  30.         if (val < 0 || val > 6)
  31.             return;
  32.         scr_call (val);
  33.         break;
  34.     }
  35. }
  36.  
  37. color (c)
  38. {
  39.     switch (c)  {
  40.     case 'w': case 'W': case 'y': case 'Y': case 3:
  41.         _color = 3;
  42.         break;
  43.     case 'm': case 'M': case 'r': case 'R': case 2:
  44.         _color = 2;
  45.         break;
  46.     case 'c': case 'C': case 'g': case 'G': case 1:
  47.         _color = 1;
  48.         break;
  49.     default:
  50.         _color = 0;
  51.         break;
  52.     }
  53. }
  54.  
  55. palette (c)
  56. {
  57.     if (c)  
  58.         scr_call (11 << 8,1<<8 | 1,0,0);
  59.     else
  60.         scr_call (11 << 8,1<<8 | 0,0,0);
  61. }
  62.  
  63. ground (c)
  64. {
  65.     scr_call (11 << 8, 0 << 8 | c,0,0);
  66. }
  67. address.asm
  68. ; Copyright (C) 1984 by Manx Software Systems, Inc.
  69. ; :ts=8
  70.     include lmacros.h
  71. dataseg segment para public 'data'
  72.  
  73.     public    $address
  74.  
  75. $address    equ    this word    ;/* vertical address table */     
  76.     dw    7920+8192
  77.     dw    7920
  78.     dw    7840+8192
  79.     dw    7840
  80.     dw    7760+8192
  81.     dw    7760
  82.     dw    7680+8192
  83.     dw    7680
  84.     dw    7600+8192
  85.     dw    7600
  86.     dw    7520+8192
  87.     dw    7520
  88.     dw    7440+8192
  89.     dw    7440
  90.     dw    7360+8192
  91.     dw    7360
  92.     dw    7280+8192
  93.     dw    7280
  94.     dw    7200+8192
  95.     dw    7200
  96.     dw    7120+8192
  97.     dw    7120
  98.     dw    7040+8192
  99.     dw    7040
  100.     dw    6960+8192
  101.     dw    6960
  102.     dw    6880+8192
  103.     dw    6880
  104.     dw    6800+8192
  105.     dw    6800
  106.     dw    6720+8192
  107.     dw    6720
  108.     dw    6640+8192
  109.     dw    6640
  110.     dw    6560+8192
  111.     dw    6560
  112.     dw    6480+8192
  113.     dw    6480
  114.     dw    6400+8192
  115.     dw    6400
  116.     dw    6320+8192
  117.     dw    6320
  118.     dw    6240+8192
  119.     dw    6240
  120.     dw    6160+8192
  121.     dw    6160
  122.     dw    6080+8192
  123.     dw    6080
  124.     dw    6000+8192
  125.     dw    6000
  126.     dw    5920+8192
  127.     dw    5920
  128.     dw    5840+8192
  129.     dw    5840
  130.     dw    5760+8192
  131.     dw    5760
  132.     dw    5680+8192
  133.     dw    5680
  134.     dw    5600+8192
  135.     dw    5600
  136.     dw    5520+8192
  137.     dw    5520
  138.     dw    5440+8192
  139.     dw    5440
  140.     dw    5360+8192
  141.     dw    5360
  142.     dw    5280+8192
  143.     dw    5280
  144.     dw    5200+8192
  145.     dw    5200
  146.     dw    5120+8192
  147.     dw    5120
  148.     dw    5040+8192
  149.     dw    5040
  150.     dw    4960+8192
  151.     dw    4960
  152.     dw    4880+8192
  153.     dw    4880
  154.     dw    4800+8192
  155.     dw    4800
  156.     dw    4720+8192
  157.     dw    4720
  158.     dw    4640+8192
  159.     dw    4640
  160.     dw    4560+8192
  161.     dw    4560
  162.     dw    4480+8192
  163.     dw    4480
  164.     dw    4400+8192
  165.     dw    4400
  166.     dw    4320+8192
  167.     dw    4320
  168.     dw    4240+8192
  169.     dw    4240
  170.     dw    4160+8192
  171.     dw    4160
  172.     dw    4080+8192
  173.     dw    4080
  174.     dw    4000+8192
  175.     dw    4000
  176.     dw    3920+8192
  177.     dw    3920
  178.     dw    3840+8192
  179.     dw    3840
  180.     dw    3760+8192
  181.     dw    3760
  182.     dw    3680+8192
  183.     dw    3680
  184.     dw    3600+8192
  185.     dw    3600
  186.     dw    3520+8192
  187.     dw    3520
  188.     dw    3440+8192
  189.     dw    3440
  190.     dw    3360+8192
  191.     dw    3360
  192.     dw    3280+8192
  193.     dw    3280
  194.     dw    3200+8192
  195.     dw    3200
  196.     dw    3120+8192
  197.     dw    3120
  198.     dw    3040+8192
  199.     dw    3040
  200.     dw    2960+8192
  201.     dw    2960
  202.     dw    2880+8192
  203.     dw    2880
  204.     dw    2800+8192
  205.     dw    2800
  206.     dw    2720+8192
  207.     dw    2720
  208.     dw    2640+8192
  209.     dw    2640
  210.     dw    2560+8192
  211.     dw    2560
  212.     dw    2480+8192
  213.     dw    2480
  214.     dw    2400+8192
  215.     dw    2400
  216.     dw    2320+8192
  217.     dw    2320
  218.     dw    2240+8192
  219.     dw    2240
  220.     dw    2160+8192
  221.     dw    2160
  222.     dw    2080+8192
  223.     dw    2080
  224.     dw    2000+8192
  225.     dw    2000
  226.     dw    1920+8192
  227.     dw    1920
  228.     dw    1840+8192
  229.     dw    1840
  230.     dw    1760+8192
  231.     dw    1760
  232.     dw    1680+8192
  233.     dw    1680
  234.     dw    1600+8192
  235.     dw    1600
  236.     dw    1520+8192
  237.     dw    1520
  238.     dw    1440+8192
  239.     dw    1440
  240.     dw    1360+8192
  241.     dw    1360
  242.     dw    1280+8192
  243.     dw    1280
  244.     dw    1200+8192
  245.     dw    1200
  246.     dw    1120+8192
  247.     dw    1120
  248.     dw    1040+8192
  249.     dw    1040
  250.     dw    960+8192
  251.     dw    960
  252.     dw    880+8192
  253.     dw    880
  254.     dw    800+8192
  255.     dw    800
  256.     dw    720+8192
  257.     dw    720
  258.     dw    640+8192
  259.     dw    640
  260.     dw    560+8192
  261.     dw    560
  262.     dw    480+8192
  263.     dw    480
  264.     dw    400+8192
  265.     dw    400
  266.     dw    320+8192
  267.     dw    320
  268.     dw    240+8192
  269.     dw    240
  270.     dw    160+8192
  271.     dw    160
  272.     dw    80+8192
  273.     dw    80
  274.     dw    0+8192
  275.     dw    0
  276.  
  277. dataseg ends
  278.  
  279. codeseg segment para public 'code'
  280.     assume cs:codeseg,ds:dataseg,es:dataseg,ss:dataseg
  281. codeseg    ends
  282.     end
  283. circ.asm
  284. ; Copyright (C) 1984 by Manx Software Systems, Inc.
  285. ; :ts=8
  286.     include lmacros.h
  287. dataseg segment para public 'data'
  288.  
  289. aldx    dw    0
  290. aldy    dw    0
  291.  
  292.     public _yaspect_,_xaspect_
  293. _yaspect_    dw    5
  294. _xaspect_    dw    6
  295.  
  296. scale    dw    1024
  297. scale2    dw    512
  298.  
  299.  
  300. aspect    dw    0    ;function computed aspect (scaled)
  301. invasp    dw    0    ;reciprocal of aspect (scaled too)
  302.  
  303. xorg    dw    0
  304. yorg    dw    0
  305. radius    dw    0
  306.  
  307. dataseg ends
  308.  
  309.     assume ds:dataseg,cs:codeseg
  310. ;--------------------------------------------------------
  311. ;procedure circle(x,y,radius)
  312. ;
  313. ;draws a circle at center (x,y) with aspect ratio
  314. ;yaspect/xaspect; radius in column units
  315. ;
  316. ;Dan Lee 7/1/1982 SourceWare
  317. ;Modified from DDJ May '83 for CI C-86 by Davin 6/22/1983 
  318. ;remodified for Aztec C86, 6/84
  319. ;
  320. ;--------------------------------------------------------
  321. ifdef LONGPTR
  322.     extrn    $inline:far,$pnt:far
  323. else
  324.     extrn    $inline:near,$pnt:near
  325. endif
  326.     procdef set_asp,<<x_asp,word>,<y_asp,word>> 
  327.         ;set_asp (x_aspect, y_aspect);
  328.     mov    ax, x_asp
  329.     mov    [_xaspect_],ax
  330.     mov    ax, y_asp
  331.     mov    [_yaspect_],ax
  332.     pret
  333.     pend    set_asp
  334.  
  335.     procdef    circle,<<_xorg,word>,<_yorg,word>,<irad,word>>
  336.  
  337.     mov    cx,_xorg
  338.     mov    [xorg],cx
  339.     mov    dx,_yorg
  340.     mov    [yorg],dx
  341.     mov    ax,irad
  342.     pop    bp
  343.     push    es
  344.     push    si
  345.     push    di            ;save register variables
  346.     or    ax,ax
  347.     jnz    okrad
  348.     jmp    single    
  349. okrad:    mov    [radius],ax
  350.     mov    ax,_yaspect_    ;get yaspect
  351.     mul    [scale]        ;ax=yaspect*scale
  352.     shl    ax,1
  353.     div    _xaspect_        ;ax=(yaspect*scale)/xaspect
  354.     inc    ax
  355.     shr    ax,1
  356.     mov    [aspect],ax    ;store aspect*scale
  357.     mov    ax,_xaspect_    ;get xaspect in ax
  358.     mul    [scale]        ;ax=xaspect*scale
  359.     shl    ax,1
  360.     div    _yaspect_        ;ax=(xaspect*scale)/yaspect
  361.     inc    ax
  362.     shr    ax,1
  363.     mov    [invasp],ax    ;store inv aspect*scale
  364. ;
  365. ; Plot 0 to 45 degrees.
  366. ; Increase y by one unit and
  367. ; decrease x by TAN units*inv aspect ratio.
  368. ;
  369.     mov    ax,[radius]    ;get radius for initial x
  370.     mul    [scale]        ;ax=radius*scale
  371.     xor    di,di        ;zero initial y value
  372.  
  373. nlp1:    push    ax        ;save lo word x*scale
  374.     push    dx        ;save hi word x*scale
  375.     add    ax,[scale2]
  376.     adc    dx,0
  377.     div    [scale]        
  378.     mov    [aldx],ax      ; aldx,aldy are old relative coord's
  379.     mov    [aldy],di
  380.     pop    dx
  381.     pop    ax
  382.  
  383. lp1:    push    ax        ;save lo word x*scale
  384.     push    dx        ;save hi word x*scale
  385.     add    ax,[scale2]
  386.     adc    dx,0
  387.     div    [scale]        
  388.     mov    bx,ax        ;bx=1st quad x
  389.     add    ax,[xorg]    ;add x origin
  390.  
  391.     push    bp
  392.     push    di      ;relative y-coord
  393.     push    bx        ;relative x-coord
  394.     mov    bp,sp
  395.     mov    bx,[yorg]    ;get y origin
  396.     sub    bx,di        ;and sub y to plot
  397.     call    near ptr pnt1
  398.     pop    cx         ;1st quad x val
  399.     pop    di
  400.     mov    [aldx],cx
  401.     mov    [aldy],di
  402.     pop    bp
  403.  
  404. ;cx = 1st quad x, di = 1st quad y
  405.     inc    di        ;get new y
  406.     mov    ax,di        ;ax=y
  407.     mul    [invasp]    ;ax=y*inv aspect*scale
  408.     div    cx        ;ax=TAN*inv aspect*scale
  409.     xor    dx,dx        ;zero remainder
  410.     mov    si,ax        ;si=TAN*inv aspect*scale
  411.     div    [invasp]    ;ax=TAN
  412.     cmp    ax,1        ;TAN=1?
  413.     pop    dx        ;dx=hi word x*scale
  414.     pop    ax        ;ax=lo word x*scale
  415.     jae    part2        ;yes, go to next sector
  416.     neg    si        ;to decrement x
  417.     add    ax,si        ;new x value
  418.     adc    dx,-1        ;hi word carry
  419.     jmp    short lp1    ;plot new point
  420. ;
  421. ; Plot 45 to 90 degrees.
  422. ; Decrease x by one unit and
  423. ; increase y by COT units*aspect ratio.
  424. ;
  425. part2:    mov    ax,di        ;get next y to plot
  426.     mul    [scale]        ;dx:ax=y*scale
  427.     mov    di,cx        ;di=last x value
  428.     dec    di        ;next x to plot
  429. lp2:    push    ax        ;save lo word y*scale
  430.     push    dx        ;save hi word y*scale
  431.     add    ax,[scale2]    ;'one-half'
  432.     adc    dx,0
  433.     div    [scale]        ;ax=y
  434.     mov    bx,ax       ;bx=1st quad y co-ord
  435.  
  436.     add    ax,[yorg]    ;add y origin
  437.     mov    cx,[xorg]    ;cx=x origin
  438.     add    cx,di        ;x to plot
  439.  
  440.     push    bp
  441.     push    bx
  442.     push    di
  443.     mov    bp,sp
  444.     mov    bx,ax
  445.     mov    ax,cx
  446.     call    near ptr pnt2
  447.     pop    di
  448.     pop    bx
  449.     mov    [aldx],di
  450.     mov    [aldy],bx
  451.     pop    bp
  452.  
  453.     or    di,di        ;90 degrees?
  454.     js    exit        ;yes, exit
  455.     dec    di        ;get new x
  456.     mov    ax,di        ;ax=x
  457.     imul    [aspect]    ;ax=x*aspect*scale
  458.     idiv    bx        ;ax=COT*aspect*scale
  459.     mov    si,ax        ;si=change in y
  460.     pop    dx        ;dx=hi word y*scale
  461.     pop    ax        ;ax=lo word y*scale
  462.     xor    bx,bx
  463.     or    si,si        ;for sign check
  464.     jns    skp        ;positive
  465.     mov    bx,-1        ;negative carry
  466. skp:    add    ax,si        ;ax=new x value
  467.     adc    dx,bx
  468.     jmp    short lp2    ;plot next point
  469.  
  470. exit:    add    sp,4        ;release parms
  471.     jmp alldone
  472.  
  473. pnt1    proc near
  474. ;bp points to rel x coord and bp+2 points to rel y coord
  475. ;abs coords of point are in ax,bx
  476.  
  477.     mov    si,[aldx]
  478.     add    si,[xorg]     ;si is old abs x
  479.     mov    di,[yorg]
  480.     mov    cx,[aldy]
  481.     sub    di,cx          ;di is old abs y
  482.  
  483.     call    near ptr $goinline ;write 1st quad point
  484.     sub    ax,word ptr [bp]        ;get 2nd quad x+origin
  485.     sub    ax,word ptr [bp]
  486.     sub    si,[aldx]
  487.     sub    si,[aldx]
  488.     call    near ptr $goinline        ;write 2nd quad point
  489.     add    bx,word ptr 2[bp]        ;get 3rd quad y+origin
  490.     add    bx,word ptr 2[bp]
  491.     add    di,[aldy]
  492.     add di,[aldy]
  493.     call    near ptr $goinline        ;write 3rd quad point
  494.     add    ax,word ptr [bp]        
  495.     add    ax,word ptr [bp] ;get 4th quad x+origin
  496.     add    si,[aldx]
  497.     add    si,[aldx]
  498.     call    near ptr $goinline        ;plot 4th quad point
  499.     ret
  500. pnt1    endp
  501.  
  502. pnt2    proc    near
  503.     mov    si,[aldx]
  504.     add    si,[xorg]
  505.     mov    di,[yorg]
  506.     add di,[aldy]
  507.  
  508.     call    near ptr $goinline ;write 1st quad point
  509.     sub    ax,word ptr [bp]        ;get 2nd quad x+origin
  510.     sub    ax,word ptr [bp]
  511.     sub    si,[aldx]
  512.     sub    si,[aldx]
  513.     call    near ptr $goinline        ;write 2nd quad point
  514.     sub    bx,word ptr 2[bp]        ;get 3rd quad y+origin
  515.     sub    bx,word ptr 2[bp]
  516.     sub    di,[aldy]
  517.     sub di,[aldy]
  518.     call    near ptr $goinline        ;write 3rd quad point
  519.     add    ax,word ptr [bp]        
  520.     add    ax,word ptr [bp] ;get 4th quad x+origin
  521.     add    si,[aldx]
  522.     add    si,[aldx]
  523.     call    near ptr $goinline        ;plot 4th quad point
  524.     ret
  525. pnt2    endp
  526.  
  527. single:
  528.     mov    si,cx
  529.     mov    di,dx
  530.     call    $pnt
  531. alldone:
  532.     pop    di
  533.     pop    si
  534.     pop    es
  535.     push    bp
  536.     pret    circle
  537.  
  538. $goinline    proc near
  539.     push    ax
  540.     push    bx
  541.     push    si
  542.     push    di
  543.     call    $inline            ;pops es,di,si
  544.     pop    di
  545.     pop    si
  546.     pop    bx
  547.     pop    ax
  548.     ret
  549. $goinline    endp
  550.  
  551.     pend    circle
  552.     finish
  553.     end
  554. lin.asm
  555. ; Copyright (C) 1984 by Manx Software Systems, Inc.
  556. ; :ts=8
  557.     include lmacros.h
  558. dataseg segment para public 'data'
  559.  
  560.     extrn _oldx_:word, _oldy_:word
  561.  
  562. deltax    dw    0
  563. deltay    dw    0
  564. yincr    dw    0
  565.      
  566. dataseg ends
  567.     assume ds:dataseg,cs:codeseg
  568. ifdef FARPROC
  569.     extrn    $pnt:far
  570. else
  571.     extrn    $pnt:near
  572. endif
  573.  
  574.     intrdef $inline
  575.     cmp    si,ax
  576.     jbe    noxchg
  577.     xchg    si,ax
  578.     xchg    di,bx
  579. noxchg:    
  580.     jne    novert
  581.     jmp    vertical
  582. novert:
  583.     sub    ax,si    
  584.     mov    [deltax],ax
  585.     sub    bx,di
  586.     jnz    nohoriz
  587.     jmp    horizontal
  588. nohoriz:
  589.     mov    cx,1
  590.     jns    notneg
  591.     neg    cx
  592.     neg    bx
  593. notneg:    mov    [yincr],cx
  594.     mov    [deltay],bx
  595.     cmp    ax,bx
  596.     jg    case2
  597.  
  598.     mov    dx,[deltax]
  599.     shl    dx,1
  600.     mov    bx,dx
  601.     mov    ax,[deltay]
  602.     shl    ax,1
  603.     sub    bx,ax
  604.     mov    ax,dx
  605.     sub    ax,[deltax]
  606.  
  607.     mov    cx,[deltay]
  608. lp1:    dec    cx
  609.     js    done
  610.     call    $pnt
  611.     add    di,[yincr]
  612.     cmp    ax,0
  613.     jl    incr1
  614.     inc    si
  615.     add    ax,bx
  616.     jmp    short lp1
  617. incr1:
  618.     add    ax,dx
  619.     jmp    short lp1
  620.  
  621. case2:
  622.  
  623.     mov    dx,[deltay]
  624.     shl    dx,1           ;dx <- 2 * deltay
  625.     mov    bx,dx
  626.     mov    ax,[deltax]
  627.     shl    ax,1           
  628.     sub    bx,ax         ;bx <- 2*deltay - 2 * deltax
  629.     mov    ax,dx
  630.     sub    ax,[deltax]         ;ax <- 2*deltay - deltax
  631.  
  632.     mov    cx,[deltax]
  633. lp2:    dec    cx
  634.     js    done
  635.     call    $pnt
  636.     inc    si
  637.     cmp    ax,0
  638.     jl    incr2
  639.     add    di,[yincr]
  640.     add    ax,bx
  641.     jmp    short lp2
  642. incr2:
  643.     add    ax,dx
  644.     jmp    short lp2
  645.  
  646. vertical:                  ;si = xval, di,bx = yvals
  647.     cmp    di,bx
  648.     jle    yorder
  649.     xchg    bx,di
  650. yorder:
  651.     sub    bx,di
  652. vplot:
  653.     call    $pnt
  654.     inc    di
  655.     dec    bx
  656.     jns    vplot
  657.     jmp    short done
  658.  
  659. horizontal:                ;ax=deltax, si,di = start point
  660.     call    $pnt
  661.     inc    si
  662.     dec    ax
  663.     jns    horizontal
  664.     ;jmp    short done
  665.  
  666. done: 
  667.     ret
  668.  
  669.     procdef    lineto,<<xdest,word>,<ydest,word>>
  670.  
  671.         ; lineto (dest_x, dest_y);
  672.     push    si
  673.     push    di
  674.     push    es
  675.     mov    si,[_oldx_]
  676.     mov    di,[_oldy_]
  677.     mov    ax,xdest
  678.     mov    bx,ydest
  679.     mov    [_oldx_],ax
  680.     mov    [_oldy_],bx
  681.     call     $inline            ;pops si,di,es before returning
  682.     pop es
  683.     pop di
  684.     pop si
  685.     pret
  686.     pend    lineto
  687.  
  688.     procdef    line,<<srcx,word>,<srcy,word>,<ddstx,word>,<ddsty,word>>
  689.         ; line (src_x, src_y, dest_x, dest_y);
  690.     push    si
  691.     push    di
  692.     push    es
  693.     mov    si,srcx
  694.     mov    di,srcy
  695.     mov    ax,ddstx
  696.     mov    bx,ddsty
  697.     mov    [_oldx_],ax
  698.     mov     [_oldy_],bx
  699.     call $inline
  700.     pop es
  701.     pop di
  702.     pop si
  703.     pret
  704.     pend    line
  705.     finish
  706.     end
  707.  
  708. point.asm
  709. ; Copyright (C) 1984 by Manx Software Systems, Inc.
  710. ; :ts=8
  711.     include lmacros.h
  712. dataseg segment para public 'data'
  713.  
  714.     extrn    $address:word
  715.     public _oldx_,_oldy_,_color_,_maxx_
  716.     _oldx_    dw 0
  717.     _oldy_    dw 0
  718.     _color_    db 1
  719.     _maxx_    dw 320
  720.     public    _plotf_, _plottbl_
  721.     public mid,ultra
  722.     public clrmsk,colmsk
  723.  
  724. clrmsk    db    00111111b,11001111b,11110011b,11111100b
  725.             ;/* clrmsk for point mode 0 */
  726.  
  727. onmask    db    10000000b,1000000b,100000b,10000b,1000b,100b,10b,1b
  728. offmask    db    01111111b,10111111b,11011111b,11101111b
  729.     db    11110111b,11111011b,11111101b,11111110b
  730.  
  731. colmsk    db    0,0,0,0    ;/* color_ masks */
  732.     db    1000000b,10000b,100b,1
  733.     db    10000000b,100000b,1000b,10b
  734.     db    11000000b,110000b,1100b,11b
  735.  
  736. _plottbl_    dw    offset mid    ;medium res
  737.     dw    offset ultra    ;high res
  738.  
  739. _plotf_    dw    offset ptquit
  740.  
  741. dataseg ends
  742.     assume ds:dataseg,cs:codeseg
  743.  
  744.     intrdef $pnt    ;saves only what it uses
  745.     cmp    si,[_maxx_]    ;si=x,di=y  does not set oldx & oldy
  746.     ja    quit
  747.     cmp    si,0
  748.     jb    quit
  749.     cmp    di,199
  750.     ja    quit
  751.     cmp    di,0
  752.     jnb    $pnt3
  753.     jmp    quit
  754. $pnt3:    
  755.     push    ax
  756.     push     bx    
  757.     mov    bl,[_color_]    ;entry #3 si=x,di=y  no clipping ! 
  758. $pnt4:
  759.     mov    bh,0
  760. ;entry #5 si=x,di=y,bx=color_   
  761. ;      
  762. $pnt5:    mov    ax,0b800h    ; set es to point to hires segment
  763.     mov    es,ax
  764.     push    di
  765.     shl    di,1        ;mult y*2 (addr table is 2 bytes wide)
  766.     jmp    [_plotf_]    ;jmp to ptquit, mid or ultra
  767.  
  768. mid:    push    si
  769.  
  770.     mov    di,$address[di]    ;get vert address from table
  771.  
  772.     mov    ax,si        ;save x in si
  773.  
  774.     and    si,3
  775.     shr    ax,1        ;divide by 4 (4 dots per byte)
  776.     shr    ax,1
  777.  
  778.     add    di,ax        ;get addr of byte on screen
  779.  
  780.     sal    bl,1        ; color_ table is 4 by 4 so mult color_ * 4
  781.     sal    bl,1
  782.     mov    bl,colmsk[si+bx]
  783.     mov    al,clrmsk[si]
  784.     and    es:[di],al
  785.     or    es:[di],bl
  786.     pop    si
  787. ptquit:    pop    di
  788.     pop    bx
  789.     pop    ax
  790. quit:    
  791.     ret
  792.  
  793. ultra:    mov    di,$address[di]
  794.     mov    ax,si
  795.     push    si
  796.     and    si,7
  797.     shr    ax,1
  798.     shr    ax,1
  799.     shr    ax,1
  800.     add    di,ax
  801.     or    bl,bl
  802.     jz    black
  803.     mov    al,onmask[si]
  804.     or    es:[di],al
  805.     pop    si
  806.     jmp short ptquit
  807. black:    mov    al,offmask[si]    
  808.     and    es:[di],al
  809.     pop    si
  810.     jmp short ptquit
  811.  
  812.  
  813.     procdef    point,<<xcoord,word>,<ycoord,word>>
  814.  
  815.     push    si
  816.     push    di
  817.     push    es
  818.     mov    si,4[bp]
  819.     mov    di,6[bp]
  820.  
  821.     mov    [_oldx_],si    ;si=x,di=y   sets oldx and oldy
  822.     mov    [_oldy_],di
  823.     call    $pnt
  824.  
  825.     pop    es
  826.     pop    di
  827.     pop    si
  828.     pret
  829.     pend    point
  830.     finish
  831.     end
  832.  
  833. scr_call.asm
  834. ; Copyright (C) 1984 by Manx Software Systems
  835. ; :ts=8
  836.     include lmacros.h
  837.     procdef scr_call,<<aax,word>,<bbx,word>,<ccx,word>,<ddx,word>>
  838.             ; scr_call (ax,bx,cx,dx)
  839.      push    si
  840.      push    di
  841.     mov     ax, aax
  842.     mov    bx, bbx
  843.     mov    cx, ccx
  844.     mov    dx, ddx
  845.     int     16
  846.      pop     di
  847.      pop    si
  848.     xor    ax,ax
  849.     pret
  850.     pend    scr_call
  851.     finish
  852.     end
  853. cmp(dp->d_name, name) == 0)
  854.             break;
  855.     dev = dp->d_dev;
  856.     mdmask = (flag&3) + 1;
  857.     if (mdmask&1) {
  858.         if ((chp->c_read = dev->d