home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / asmlib.lbr / TASM.AZM / TASM.ASM
Encoding:
Assembly Source File  |  1991-06-25  |  5.1 KB  |  274 lines

  1. ;----------------------------------------------------------------
  2. ; This is a test of the asmlib library.
  3. ;
  4. ;        Written    R.C.H.    15/8/83
  5. ;----------------------------------------------------------------
  6. ;
  7.     extrn    prolog,quit,dispatch,atodin,version
  8.     extrn    phacc,crlf,pdde,phde,cursor,clear
  9.     extrn    pdacc,pstr,inline,xyinline,xypstring,pmenu
  10.     extrn    nolzb,lzb,blzb,clzb,delay
  11.     extrn    cst,cie,formin
  12. ;
  13.     maclib    z80
  14. ;
  15.     call    prolog
  16.     call    lzb
  17.     call    clear
  18. ;
  19.     call    xyinline
  20.     db    10,10,'   ASMLIB Test Program$'
  21.     call    xyinline
  22.     db    10,12,'ASMLIB  Version Number $'
  23.     call    version
  24.     mov    a,h
  25.     call    pdacc
  26.     call    xyinline
  27.     db    10,13,'ASMLIB Revision Number $'
  28.     mov    a,l
  29.     call    phacc
  30. ; Do a 5 second delay then continue
  31.     lxi    d,5000
  32.     call    delay
  33. ;
  34.     call    clear
  35.     call    crlf
  36.     call    xyinline
  37.     db    0,4,'This is a test of the ASMLIB library and its functions$'
  38.     call    crlf
  39.     mvi    a,'-'
  40.     mvi    b,54            ; underline exactly
  41.     call    pstr
  42.     call    inline
  43.     db    0dh,0ah,0ah,0ah,'Testing Leading Zero Blanking Modes$'
  44. ;
  45. ; Test the leading zero blanking, done with 4 displays on the dame set of lines
  46. ;
  47.     mvi    a,10
  48.     sta    y            ; Always use line 10 to start
  49.     xra    a
  50.     sta    x            ; Use this for x value too
  51. ;
  52. ; Do without leading zero blanking
  53.     call    set$xy
  54.     call    inline
  55.     db    'NO LZB$'
  56.     call    send$args
  57. ;
  58.     call    lzb
  59.     call    set$xy            ; new cursor positioning
  60.     call    inline
  61.     db    'LZB$'
  62.     call    send$args
  63. ; Blank filled LZB
  64.     call    set$xy
  65.     call    inline
  66.     db    'BLZB$'
  67.     call    blzb
  68.     call    send$args
  69. ; Character filled LZB
  70.     call    set$xy
  71.     call    inline
  72.     db    'CLZB (*)$'
  73.     mvi    a,'*'
  74.     call    clzb
  75.     call    send$args
  76. ; Now do next part of the test. Delay for 10 seconds then jump ask 
  77. ; for a key press.
  78.     lxi    d,continue
  79.     call    xypstring
  80.     call    cie
  81.     cpi    01bh
  82.     jz    quit
  83. ;
  84.     call    clear
  85.     call    inline
  86.     db    0dh,0ah,'Accumulator printing as hex and decimal$'
  87.     call    crlf
  88.     mvi    b,39
  89.     mvi    a,'-'
  90.     call    pstr
  91. ;
  92.     lxi    d,1409h
  93.     call    cursor            ; set up cursor
  94.     call    inline
  95.     db    'Decimal   Hex$'
  96.     call    nolzb
  97.     xra    a
  98. ;
  99. acc$loop:
  100.     push    psw            ; save value
  101. ; Set cursor to display line
  102.     mvi    a,11
  103.     sta    y
  104.     mvi    a,10
  105.     sta    x
  106.     call    set$xy
  107.     pop    psw
  108.     push    psw
  109.     call    pdacc            ; print as decimal
  110.     call    set$xy            ; bump col by 10 and set
  111.     pop    psw
  112.     push    psw
  113.     call    phacc
  114.     lxi    d,10            ; do a little wait
  115.     call    delay
  116.     pop    psw
  117.     inr    a
  118.     jnz    acc$loop
  119. ; Do we want to end ?
  120.     lxi    d,continue
  121.     call    xypstring
  122.     call    cie
  123.     cpi    01bh
  124.     jz    quit
  125. ;
  126. ; Do the menu display function and return
  127.     call    clear
  128.     lxi    d,menu1
  129.     call    pmenu
  130. ;
  131.     lxi    d,continue
  132.     call    xypstring
  133.     call    cie            ; wait for a key
  134.     cpi    01bh            ; escape ?
  135.     jz    quit
  136. ; If not escape then do the formatted input test
  137.     call    clear
  138.     lxi    d,menu2
  139.     call    formin            ; read the data
  140. ;
  141.     lxi    d,continue        ; wait for a key press
  142.     call    xypstring        ; print it
  143.     call    cie            ; wait for it
  144.     call    clear            ; clear screen
  145. ; Now display all the analogue channels 0..31
  146. ;
  147.     call    inline
  148.     db    0dh,0ah,'Analogue channel reading',0dh,0ah,'$'
  149.     mvi    a,'-'
  150.     mvi    b,24
  151.     call    pstr
  152. ;
  153. atod$again:
  154.     mvi    b,32            ; loop counter
  155.     call    xyinline
  156.     db    1,10,'0  > $'
  157.     lxi    d,00            ; start at channel 0
  158. ;
  159. atodloop:
  160.     call    cst            ; get status
  161.     ora    a
  162.     jrnz    back1
  163. ;
  164.     call    atodin            ; get analogue channel # in DE
  165.     mov    a,h            ; test out of time return value
  166.     cpi    0ffh
  167.     jrz    atod$error
  168.     mov    a,l            ; only 8 bits
  169.     call    phacc            ; display it
  170. ; See if next line needed
  171.     mov    a,e            ; check channel number
  172.     cpi    15            ; end of line ?
  173.     jrnz    noteol
  174.     call    xyinline
  175.     db    1,11,'16 > $'
  176.     jr    nxtatod
  177. noteol:
  178.     mvi    a,' '
  179.     call    dispatch
  180. nxtatod:
  181.     inx    d
  182.     djnz    atodloop
  183.     jr    atod$again        ; do again
  184. ;
  185. back1:
  186.     call    cie
  187.     call    xyinline
  188.     db    1,23,'Press a key to quit $'
  189. ;
  190.     call    cie
  191.     jmp     quit
  192. ;
  193. atod$error:
  194.     call    inline
  195.     db    'A to D card non-functional$'
  196.     jmp    back1
  197. ;
  198. send$args:
  199.     call    set$pos            ; Set the cursor and bump line #
  200.     lxi    d,1 
  201.     call    pdde
  202.     call    set$pos
  203.     lxi    d,10
  204.     call    pdde
  205.     call    set$pos
  206.     lxi    d,0100 
  207.     call    pdde
  208.     call    set$pos
  209.     lxi    d,01000
  210.     call    pdde
  211.     call    set$pos
  212.     lxi    d,10000
  213.     call    pdde
  214.     ret
  215. ;
  216. set$xy:    ; Set the cursor to the X and Y saved values and bump the X value by 10
  217. ;
  218.     mvi    a,10
  219.     sta    y        ; always start at line 10
  220.     mov    e,a
  221.     lda    x
  222.     adi    10
  223.     sta    x
  224.     mov    d,a
  225.     jmp    cursor            ; set up screen
  226. ;
  227. set$pos    ; Set the X and Y values then bump the Y value by 1
  228.     lda    x
  229.     mov    d,a
  230.     lda    y
  231.     inr    a
  232.     sta    y
  233.     mov    e,a
  234.     jmp    cursor
  235. ;
  236. x    db    00
  237. y    db    00
  238. ;
  239. ;
  240. continue:
  241.     db    1,23,'Press a key to continue $'
  242. ;
  243. menu1:
  244.     db    11,1,'This screen was printed by the PMENU function.$'
  245.     db    4,3,'All the strings on it have been put in a table with$'
  246.     db    4,5,'preceeding cursor addresses for PMENU to use$'
  247.     db    4,7,'This makes printing to odd addresses quite easy and the$'
  248.     db    4,9,'code overhead is very small. Why not try it !$'
  249.     db    0ffh
  250. ;
  251. ; The below menu is used for the formin function
  252. ;
  253. menu2:
  254.     db    1,1,'Name     $'
  255.     dw    data$name
  256.     db    1,3,'Age      $'
  257.     dw    data$age
  258.     db    1,5,'Weight   $'
  259.     dw    data$weight
  260.     db    16,5,'Kgs$'
  261.     db    00,00            ; No console buffer for this one
  262.     db    0ffh
  263. ;
  264. data$name:
  265.     db    20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  266. data$age:
  267.     db    2,0,0,0
  268. data$weight:
  269.     db    4,0,0,0,0,0
  270. ;
  271.     end
  272.  
  273.  
  274.