home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol164 / reclib.mac < prev   
Encoding:
Text File  |  1984-04-29  |  7.6 KB  |  276 lines

  1.  
  2. ;    =======================================================
  3. ;    Supplement to REC containing its library subroutines.
  4. ;    Additional subroutines, far beyond the tolerance of the
  5. ;    ASCII alphabet, may be incorporated into REC by placing
  6. ;    them in this library collection.
  7. ;
  8. ;    The following operators and predicates are found in
  9. ;    this module:
  10. ;
  11. ;        X    call a subroutine with arguments and values
  12. ;
  13. ;    Additionally, this particular module contains the table
  14. ;    of operators for the graphics subroutines for the Solid
  15. ;    State Music VB1B board, or the Polymorphic VTI Video
  16. ;    Terminal Interface.  They can also be used with the
  17. ;    Vector Graphics dense graphic board.
  18. ;
  19. ;    Version prepared for the Summer School, 1980
  20. ;
  21. ;         RECLIB -- Copyright (C) 1980
  22. ;        Universidad Autonoma de Puebla
  23. ;             All Rights Reserved
  24. ;
  25. ;        [Harold V. McIntosh,  28 August 1980]
  26. ;
  27. ;    8 July 1983 - x changed, moved to FXT.MAC
  28. ;    =======================================================
  29.  
  30. ;    EXTERNAL references to subroutines lying in other REC
  31. ;    modules.
  32.  
  33.     ext    px,py,ucl,deld,noop
  34.     ext    miuc,mduc,aiuc,oiuc,xiuc,kiuc
  35.  
  36.     ext    narg
  37.     ext    onel,twol
  38.  
  39. ;    Equivalences to entry points in BIOS for both console
  40. ;    and disk subroutines permitting rapid access to these
  41. ;    subroutines and even, should such an occasion present
  42. ;    itself, the writing of a substitute for BDOS in REC.
  43.  
  44. bios    equ    0B000H
  45. warm    equ    bios+00H
  46. cold    equ    bios+03H
  47. dhom    equ    bios+18H
  48. sdsk    equ    bios+1BH
  49. strk    equ    bios+1EH
  50. ssec    equ    bios+21H
  51. sdma    equ    bios+24H
  52. dire    equ    bios+27H
  53. diwr    equ    bios+2AH
  54.  
  55. usos    equ    0B400H
  56. initi    equ    usos+00H
  57. const    equ    usos+03H
  58. conin    equ    usos+06H
  59. conou    equ    usos+09H
  60. listo    equ    usos+0CH
  61. punch    equ    usos+0FH
  62. readr    equ    usos+12H
  63.  
  64. ;    EXTERNAL references to one of the graphics subroutine
  65. ;    packages.  As long as they all use the same names for
  66. ;    their subroutines, any one of them can be substituted
  67. ;    for any other by the linking loader L80.
  68.  
  69.     ext    home,culi,cuex,cure,cuse
  70.     ext    xpl,xmi,ypl,ymi
  71.     ext    blak,whit,reve,cart,line
  72.     ext    ekspl,eksmi,wyepl,wyemi
  73.     ext    ee,ww,nn,ss,kk,ll,hh
  74.     ext    eas,wes,nor,sou
  75.     ext    doli,doex,xppl,xmmi,eksppl,eksmmi
  76.  
  77. ;    Pop the top three argumwents off the REC pushdown list
  78. ;    and place them in the 8080 register pairs.  Creating
  79. ;    them in the order (BC), (DE), (HL) will result in their
  80. ;    being placed in just the registers indicated.  This
  81. ;    subroutine would be suitable for a FORTRAN call with
  82. ;    three arguments.
  83.  
  84. thar:    call    gone
  85.     call    gone
  86.     call    gone
  87.     pop    b
  88.     pop    d
  89.     pop    h
  90.     ret
  91.  
  92. ;    Some REC auxiliaries would prefer to create arguments
  93. ;    in the order (HL), (DE), (BC).
  94.  
  95. raht:    call    gone
  96.     call    gone
  97.     call    gone
  98.     pop    h
  99.     pop    d
  100.     pop    b
  101.     ret
  102.  
  103. ;    Others want two arguments in the order (HL), (BC).
  104.  
  105. twrg:    call    gone
  106.     call    gone
  107.     pop    h
  108.     pop    b
  109.     ret
  110.  
  111. ;    Pop one argument off the REC pushdown list and place it
  112. ;    in (DE).
  113.  
  114. dear:    call    gone
  115.     pop    d
  116.     ret
  117.  
  118. ;    Pop one one-byte argument off the REC pushdown list and
  119. ;    place it in register C.  It can also be the low byte of
  120. ;    a multi-byte argument.
  121.  
  122. carg:    lhld    px
  123.     mov    c,m
  124.     jmp    ucl
  125.  
  126. ;    Pop one argument off the REC pushdown list and then
  127. ;    transfer it to the 8080 stack.  Because of its usage
  128. ;    of the 8080 instruction xthl, <call gone, ret> is not
  129. ;    equivalent to <jmp gone>.  By the very nature of this
  130. ;    subroutine it is supposed that it will only be used
  131. ;    for two-byte arguments, or for the lowest two if there
  132. ;    are more.
  133.  
  134. gone:    lhld    px    ;fetch pointer to top argument
  135.     mov    e,m    ;pick up low byte
  136.     inx    h    ;advance pointer
  137.     mov    d,m    ;bring in high byte
  138.     xchg        ;place the argument in (HL)
  139.     xthl        ;transfer it to the 8080 stack
  140.     push    h    ;but keep the return address
  141.     jmp    ucl    ;pop the top argument off the PDL
  142.  
  143. ;    Prepare the REC pushdown list to receive a one-byte
  144. ;    argument, such as might be returned in the accumulator
  145. ;    after a subroutine call.
  146.  
  147. onby:    lxi    b,01H
  148.     jmp    narg
  149.  
  150. ;    Deposit one byte on the REC pushdown list in the place
  151. ;    previously prepared, taking it from the accumulator.
  152.  
  153. ston:    lhld    px
  154.     mov    m,a
  155.     inx    h
  156.     shld    py
  157.     ret
  158.  
  159. ;    Call a subroutine with an argument in (DE).
  160.  
  161. goa::    lhld    px
  162.     call    twol
  163.     pop    d
  164.     ret
  165.  
  166. ;    (X) - A subroutine numbered k with n arguments may be
  167. ;    executed from REC by writing arg1, arg2, ..., argn,k,X.
  168. ;    It will then leave m results on the pushdown list,
  169. ;    supposing that provision for m and n have been made if
  170. ;    forming the library table.
  171.  
  172. libr::    call    deld    ;load top argument into (DE), pop it
  173.     mov    l,e    ;copy it into (HL)
  174.     mov    h,d    ;
  175.     dad    h    ;multiply it by two
  176.     dad    d    ;add it in to get three
  177.     dad    h    ;another factor two makes six
  178.     lxi    d,lib    ;place base address in (DE)
  179.     dad    d    ;add it to displacement
  180.     mov    e,m    ;put address at that location in (DE)
  181.     inx    h    ;...it is subroutine reporting values
  182.     mov    d,m    ;
  183.     push    d    ;keep for reference
  184.     inx    h    ;next address also goes into (DE)
  185.     mov    e,m    ;...it is execution subroutine
  186.     inx    h    ;
  187.     mov    d,m    ;
  188.     push    d    ;keep it too
  189.     inx    h    ;load the third address
  190.     mov    e,m    ;...it is argument loading subroutine
  191.     inx    h    ;
  192.     mov    d,m    ;
  193.     xchg        ;this one goes into (HL)
  194.     pchl        ;for immediate execution
  195.  
  196. ;    Library table.  Each entry, consisting of six bytes,
  197. ;    has the form  <dw  valu,subr,prep>  in which valu is a
  198. ;    subroutine which leaves none or more results on the
  199. ;    pushdown list, subr executes the subroutine, and prep
  200. ;    loads the 8080's registers from the pushdown list as
  201. ;    is necessary to transmit arguments to the subroutine.
  202. ;    Normally prep and valu will be found here in the RECLIB
  203. ;    module, while subr would have to be declared external
  204. ;    and be fetched by the linking loader.
  205.  
  206.     dw    noop,diwr,noop        ;write next on disk
  207.     dw    noop,dire,noop        ;read next from disk
  208.     dw    noop,sdma,dear        ;set DMA address
  209.     dw    noop,ssec,carg        ;set sector
  210.     dw    noop,strk,carg        ;set track
  211.     dw    noop,sdsk,carg        ;set disk unit
  212.  
  213.     dw    noop,dhom,noop        ;home read head
  214.     dw    ston,readr,onby        ;paper tape reader
  215.     dw    noop,punch,carg        ;paper tape punch
  216.     dw    noop,listo,carg        ;printer output
  217.     dw    noop,conou,carg        ;console output
  218.     dw    ston,conin,onby        ;console input
  219.     dw    ston,const,onby        ;console status
  220.     dw    noop,cold,noop        ;cold start
  221.     dw    noop,warm,noop        ;warm boot
  222.     dw    noop,initi,noop        ;general initialization
  223.  
  224. lib:    dw    noop,miuc,raht    ;move by increment until count
  225.     dw    noop,mduc,raht    ;move by decrement until count
  226.     dw    noop,aiuc,raht    ;and  by increment until count
  227.     dw    noop,oiuc,raht    ;or   by increment until count
  228.     dw    noop,xiuc,raht    ;xor  by increment until count
  229.     dw    noop,kiuc,twrg    ;complement by incr untl count
  230.  
  231.     dw    0,0,0
  232.     dw    0,0,0
  233.     dw    0,0,0
  234.     dw    0,0,0
  235.  
  236.     dw    noop,home,noop        ;home the cursor
  237.     dw    noop,culi,noop        ;light pixel at cursor
  238.     dw    noop,cuex,noop        ;extinguish cursor
  239.     dw    noop,cure,noop        ;reverse cursor
  240.     dw    ston,cuse,onby        ;sense cursor
  241.     dw    noop,xpl,noop        ;cursor right one pixel
  242.     dw    noop,xmi,noop        ;cursor left one pixel
  243.     dw    noop,ypl,noop        ;cursor up one pixel
  244.     dw    noop,ymi,noop        ;cursor down one pixel
  245.     dw    noop,blak,noop        ;make whole screen black
  246.  
  247.     dw    noop,whit,noop        ;make whole screen white
  248.     dw    noop,reve,noop        ;reverse whole screen
  249.     dw    noop,cart,dear        ;cursor to cart coord
  250.     dw    noop,line,dear        ;line given increments
  251.     dw    noop,ekspl,noop        ;rotate right one pixel
  252.     dw    noop,eksmi,noop        ;rotate left one pixel
  253.     dw    noop,wyepl,noop        ;rotate up one pixel
  254.     dw    noop,wyemi,noop        ;rotate down one pixel
  255.     dw    noop,ee,noop        ;LIFE cursor 2 pix right
  256.     dw    noop,ww,noop        ;LIFE cursor 2 pix left
  257.  
  258.     dw    noop,nn,noop        ;life cursor 2 pix up
  259.     dw    noop,ss,noop        ;life cursor 2 pix down
  260.     dw    noop,kk,noop        ;extinguish life cell
  261.     dw    noop,ll,noop        ;illuminate life cell
  262.     dw    noop,hh,noop        ;one cycle of LIFE
  263.     dw    noop,eas,noop        ;LIFE screen right
  264.     dw    noop,wes,noop        ;LIFE screen left
  265.     dw    noop,nor,noop        ;LIFE screen up
  266.     dw    noop,sou,noop        ;LIFE screen down
  267.     dw    noop,doli,noop        ;illuminate 2-pixel dot
  268.  
  269.     dw    noop,doex,noop        ;extinguish 2-pixel dot
  270.     dw    noop,xppl,noop        ;fast right 2 pix
  271.     dw    noop,xmmi,noop        ;fast left 2 pix
  272.     dw    noop,eksppl,noop    ;fast screen right
  273.     dw    noop,eksmmi,noop    ;fast screen left
  274.  
  275.     end
  276.