home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume30 / qdos_utils / part01 / more.asm < prev    next >
Encoding:
Assembly Source File  |  1992-07-06  |  4.8 KB  |  199 lines

  1. *! -errors ram1_more_list -nolink
  2. *
  3. *        Copyleft 1990-1992 Erik Slagter (v882022@si.hhs.nl) 
  4. *        THis source may be distributed and modified freely if this message
  5. *        stays intact.
  6. *
  7. *        more - version 2
  8. *
  9. *        assemble with GST macro assembler. Does not need to be linked.
  10. *        Applies some macros that may not be in your library:
  11. *        - qdos
  12. *        - call
  13. *
  14. *        These macros are very easy to implement though.
  15. *
  16. *        usage: ex more,inputfile[,outputdevice]
  17. *    
  18. *        include  win1_asm_include_macro_inc
  19. *        include  win1_asm_include_equ_h
  20. *
  21.          offset   0
  22. *
  23. buffer   ds.w     1
  24.          ds.b     8192
  25. filelen  ds.l     1
  26. offset   ds.l     1
  27. proffs   ds.l     1
  28. block    ds.w     4
  29. stack    ds.b     256
  30. len      ds.w     1
  31.          data     len
  32. *
  33.          section  code
  34. *
  35.          bra.s    main
  36.          dc.w     $4afb,$4afb,$4afb
  37.          string$  {'More'}
  38. name     string$  {' More '}
  39. guard    string$  {'scr_498x224a6x30'}
  40. con      string$  {'con_486x212a8x41'}
  41. bar      string$  {'scr_10x212a493x41'}
  42. *
  43. main     add.l    a4,a6
  44.          moveq    #err.bp,d0
  45.          cmp.w    #1,(a7)+
  46.          bne      rjob
  47. *
  48.          move.l   (a7)+,a3          input channel
  49.          tst.w    (a7)+
  50.          bne      rjob
  51. *
  52.          move.w   #6,block+0(a6)
  53.          clr.w    block+2(a6)
  54.          clr.w    block+4(a6)
  55.          clr.w    block+6(a6)
  56. *
  57.          clr.l    filelen(a6)
  58.          clr.l    offset(a6)
  59.          moveq    #endless,d3
  60.          sub.w    #64,a7
  61.          move.l   a3,a0
  62.          move.l   a7,a1
  63.          moveq    #64,d2
  64.          qdos     fs.headr
  65.          tst.l    d0
  66.          bmi.s    nohead
  67.          move.l   (a7),d1
  68.          divu     #210,d1
  69.          ext.l    d1
  70.          move.l   d1,filelen(a6)
  71. nohead   add.w    #64,a7
  72. *
  73.          lea      guard,a0
  74.          moveq    #myself,d1
  75.          moveq    #new,d3
  76.          qdos     io.open
  77.          tst.l    d0
  78.          bmi      rjob
  79.          moveq    #endless,d3
  80.          moveq    #7,d1
  81.          moveq    #1,d2
  82.          qdos     sd.bordr
  83.          moveq    #7,d1
  84.          qdos     sd.setpa
  85.          qdos     sd.setst
  86.          moveq    #0,d1
  87.          qdos     sd.setin
  88.          moveq    #86,d1
  89.          qdos     sd.setpa
  90.          qdos     sd.setst
  91.          qdos     sd.clear
  92.          moveq    #37,d1
  93.          qdos     sd.tab
  94.          moveq    #7,d1
  95.          qdos     sd.setst
  96.          lea      name,a1
  97.          call     ut.mtext
  98. *
  99.          lea      con,a0
  100.          moveq    #myself,d1
  101.          moveq    #new,d3
  102.          qdos     io.open           console
  103.          tst.l    d0
  104.          bmi      rjob
  105.          move.l   a0,a4
  106.          moveq    #4,d1
  107.          moveq    #1,d2             border
  108.          moveq    #endless,d3
  109.          qdos     sd.bordr
  110.          moveq    #7,d1
  111.          qdos     sd.setin          ink
  112.          moveq    #0,d1
  113.          qdos     sd.setpa
  114.          qdos     sd.setst
  115. *
  116.          lea      bar,a0
  117.          moveq    #myself,d1
  118.          moveq    #new,d3
  119.          qdos     io.open           scroll bar
  120.          tst.l    d0
  121.          bmi      rjob
  122.          move.l   a0,a5
  123.          qdos     sd.clear
  124.          moveq    #4,d1
  125.          moveq    #1,d2             border
  126.          moveq    #endless,d3
  127.          qdos     sd.bordr
  128. *
  129. nobar    bsr.s    read
  130. nwrite   bsr.s    write
  131.          tst.b    d5
  132.          bne.s    end_
  133.          bsr.s    read
  134.          bsr.s    more
  135.          bra.s    nwrite
  136. end_     move.l   offset(a6),proffs(a6)
  137.          bsr.s    more
  138. no       moveq    #0,d0
  139. rjob     moveq    #-1,d1
  140.          qdos     mt.frjob
  141.          bra      rjob
  142. *
  143. read     move.l   a3,a0             input channel
  144.          moveq    #0,d7             index
  145.          moveq    #0,d6             line
  146.          moveq    #80,d2
  147. rloop    lea      buffer(a6,d7.w),a1
  148.          qdos     io.fline
  149.          tst.w    d1
  150.          seq      d5
  151.          beq.s    rend
  152.          add.w    d1,d7
  153.          addq.w   #1,d6
  154.          cmp.w    #21,d6
  155.          bmi      rloop
  156. rend     ext.l    d7
  157.          move.l   offset(a6),proffs(a6)
  158.          add.l    d7,offset(a6)
  159.          rts
  160. *
  161. write    move.l   a4,a0             output channel
  162.          qdos     sd.clear
  163.          lea      buffer(a6),a1
  164.          move.w   d7,d2
  165.          qdos     io.sstrg
  166.          tst.l    d0
  167.          bmi      rjob
  168.          rts
  169. *
  170. more     move.l   a5,a0             scrollbar
  171.          move.l   filelen(a6),d0
  172.          beq.s    noflen
  173.          move.l   proffs(a6),d4
  174.          beq.s    noflen
  175.          divu     d0,d4
  176.          beq.s    noflen
  177.          lea      block(a6),a1
  178.          move.w   d4,2(a1)
  179.          moveq    #7,d1
  180.          qdos     sd.fill
  181. *
  182. noflen   move.l   a4,a0
  183.          moveq    #79,d1
  184.          moveq    #20,d2
  185.          qdos     sd.pos
  186.          qdos     sd.cure
  187.          qdos     io.fbyte
  188.          move.b   d1,d4
  189.          qdos     sd.curs
  190.          cmp.b    #'n',d4
  191.          beq      no
  192.          cmp.b    #'q',d4
  193.          beq      no
  194.          rts
  195. *
  196.          end
  197.  
  198.