home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / pg / pgxos / x-view.src < prev    next >
Text File  |  2006-10-19  |  5KB  |  280 lines

  1. ;********************************
  2. ;*  X-VIEW.200 by Paul Globman  *
  3. ;*                [72227,1661]  *
  4. ;*      Copyright (c) 1989      *
  5. ;********************************
  6. ;
  7. ALTBUF:    EQU 63572
  8. BEEP:    EQU 20293
  9. BOTTOM:    EQU 4F96H
  10. COMPAR:    EQU 6E11H
  11. FILES:    EQU A144H    ;XOS code
  12. FILL:    EQU 5DC2H
  13. FILTYP:    EQU A1D5H    ;XOS code
  14. GET_B:    EQU A186H    ;XOS code
  15. HOOK04:    EQU F50DH    ;keyscan
  16. HOOK28:    EQU F53DH
  17. HOOK32:    EQU F545H    ;TXT F8 HOOK
  18. LINE:    EQU A18FH    ;XOS code
  19. MAKUPR:    EQU 6D22H
  20. MENU:    EQU 40961    ;XOS code
  21. MOVE:    EQU 41BAH
  22. PRINT:    EQU 11CCH
  23. TEXT:    EQU 731BH    ;TEXT program
  24. VF2:    EQU FFF0H
  25. WRAP:    EQU F20CH
  26. ;
  27.      org altbuf
  28.     entry
  29. vtinst:    lhld hook04    ;chr chk hook04
  30.     shld Fkey8+1    ;save for later
  31.     shld done+1
  32.     lxi h,vt    ;vt check
  33.     shld hook04    ;now at hook04
  34. ;
  35.     lhld hook32    ;txt menu hook
  36.     shld Fkey8+7    ;save it
  37.     lxi H,Fkey8    ;menu fkey
  38.     shld hook32    ;at our command
  39.     shld hook28
  40. ;
  41.     call filtyp    ;get attr byte
  42.     cpi 192
  43.     cnz BEEP    ;.DO files only
  44.     jnz Fkey8
  45. ;
  46.     inx h
  47.     xchg
  48.     lhli        ;ADR OF FILE IN
  49.     jmp TEXT    ;HL -  ENTR TXT
  50. ;======================================
  51. ;Menu hook (F8 keypress to exit V_TEXT)
  52. ;
  53. Fkey8:    LXI H,0        ;Restore GETKEY
  54.     SHLD hook04
  55.     LXI H,0        ;Restore F8
  56.     SHLD hook32
  57.     JMP menu    ;return to MENU
  58. ;======================================
  59. ;RST 7 hook from GETKEY
  60. ;
  61. VT:    push psw
  62.     push b
  63.     push d
  64.     push h        ;save registers
  65. ;
  66.     DESP 26        ;LOOK AT SP 26
  67.     LHLI        ; BYTES BACK
  68.     LXI D,29609
  69.     RST 3        ;CMP TO 29609
  70.     JNZ bye
  71. ;
  72.     lhld ef06h    ;save cursor
  73.     shld e1+1    ;location
  74. ;
  75.     lda fd0dh    ;
  76.     ani 00001111y    ;test for GRPH
  77.     cpi 00001100y    ; plus CODE
  78.     jz vtog        ;toggle mode
  79. ;
  80.     cpi 00000011y    ;test for SHIFT
  81.     jnz bye        ; plus CTRL
  82. ;
  83.     lda wrap    ;toggle word-
  84.     xri 1        ; wrap
  85.     sta wrap
  86.     jmp ex1
  87. ;======================================
  88. vtog:    call 4f59h    ;label line off
  89.     call draw    ;split the lcd
  90.     mvi a,4        ;set bank #2
  91.     call files    ;display files
  92.     call eeolcd    ;erase to end
  93. ;
  94.     lxi h,vfile    ;fill filename
  95.     mvi b,6        ;storage area
  96.     mvi a,32    ;with blanks
  97.     call fill
  98. ;
  99.     call bottom    ;ask for file-
  100.     lxi h,vmsg    ;name on bottom
  101.     call print    ;line
  102.     call 4f6dh
  103.     call 54f6h    ;get vfile name
  104.     rst 2
  105.     ana a        ;test filename
  106.     jz exit        ;go to EXIT:
  107.     mvi a,7        ;if name not
  108.     cmp b        ;proper
  109.     jc exit
  110. ;
  111.     dcr b        ;move filename
  112.     lxi d,vfile    ;and make it
  113.     push d        ;upper case
  114.     xchg
  115.     call move
  116.     pop d
  117.     call makupr
  118.     call lookup    ;go to work!!
  119. ;
  120. exit:    MVI A,1        ;check <ENTER>
  121.     CMP B
  122.     jnz ex1
  123. ptr:    lxi h,0        ;previous view?
  124.     mov a,h
  125.     cmp l
  126.     CNZ REPLAY
  127. ex1:    call 8056h    ;restore lcd
  128. e1:    lxi h,0        ;restore cursor
  129.     call 4f9bh
  130.     call 13f3h
  131. ;
  132. bye:    pop h
  133.     pop d
  134.     pop b
  135.     pop psw        ;restore reg's
  136. done:    jmp 0        ;jmp to hook
  137. ;======================================
  138. lookup:    lxi h,f2b5h-11    ;first slot
  139. loop:    lxi d,11
  140.     dad d
  141. loop1:    mvi b,4        ;bank #2
  142.     call get_b    ;get byte
  143.     cpi ffh        ;end of dir
  144.     jz beep        ;beep and ret
  145. ;
  146.     cpi 192        ;DO file
  147.     jnz loop
  148. ;
  149.     inx h        ;get file adrs
  150.     call get_b
  151.     sta ptr+1
  152.     inx h
  153.     call get_b    ;ptr holds file
  154.     sta ptr+2    ;location
  155. ;
  156.     mvi b,6        ;get filename
  157.     inx h        ;from bank 2
  158.     lxi d,vf2    ;directory and
  159. name:    push d        ;compare it
  160.     push b        ;with filename
  161.     mvi b,4        ;entered by
  162.     call get_b    ;user.
  163.     pop b
  164.     pop d
  165.     stax d
  166.     inx h
  167.     inx d
  168.     dcr b
  169.     jnz name
  170.     inx h
  171.     inx h
  172. ;
  173.     push h
  174.     mvi c,6
  175.     lxi h,vfile
  176.     lxi d,vf2
  177.     call compar
  178.     pop h
  179.     jnz loop1    ;no.  try again
  180. replay:    push h        ;fix stack for
  181.     push h        ;loop to begin:
  182. ;======================================
  183. begin:    pop h        ;correct stack
  184.     pop h
  185. beg1:    call draw    ;position curs
  186.     call eeolcd    ;cls lower lcd
  187.     call bottom    ;position curs
  188.     lhld ptr+1    ;pntr to file
  189.     mvi b,4        ;set bank 2
  190. p_loop:    call get_b    ;get file data
  191.     cpi 26
  192. pp1:    cz beep
  193.     jz 12f7h    ;eof
  194.     push h
  195.     call p_chr    ;print to lcd
  196.     pop h
  197.     inx h        ;next byte
  198.     jmp p_loop    ;do it again
  199. ;======================================
  200. p_chr:    cpi 32
  201.     jnc ok        ;printable chr
  202.     cpi 9
  203.     jz ok        ;tabs ok
  204.     cpi 10
  205.     jz ok        ;line feeds ok
  206.     cpi 13
  207.     jz ok        ; <cr>'s ok
  208.     push psw
  209.     mvi a,'^'    ;display ctrl
  210.     rst 4        ;chrs as "^"
  211.     pop psw        ;plus chr
  212.     adi 64
  213. ok:    cpi 13
  214.     cnz 5a05h    ;rst 4 (print)
  215.     cz lf1        ;jmp if <CR>
  216. ;
  217.     lhld ef06h    ;end of lcd?
  218.     lxi d,2810h    ;if yes then
  219.     rst 3        ;jump to print
  220.     cz lf        ;and scroll
  221. ;
  222. g_chr:    call 8b03h    ;get user input
  223.     rz
  224.     cpi 27        ;ESC to abort
  225.     jz ex
  226.     cpi 32        ;spacebar to
  227.     rnz        ;pause
  228. g1:    call 12f7h
  229.     cpi 30
  230.     jz begin    ;UP ARROW
  231.     cpi 31
  232.     jz marker    ;DOWN ARROW
  233.     cpi 32
  234.     jnz g1        ;loop if not
  235.     ret        ;spacebar
  236. ;======================================
  237. marker:    pop h        ;fix stack for
  238.     pop h        ;loop back
  239.     dcx h
  240. m1:    dcx h        ;look for prev
  241.     call get_b    ;<CR> and set
  242.     cpi 13        ;marker there
  243.     jnz m1
  244.     shld ptr+1
  245.     jmp beg1
  246. ;-----------------------
  247. ex:    pop h        ;fix stack for
  248.     pop h        ;exit
  249.     jmp pp1
  250. ;-----------------------
  251. lf:    pop b
  252.     pop d
  253.     pop h
  254.     inx h        ;get next byte
  255.     push h
  256.     push d
  257.     push b
  258.     mvi b,4
  259.     call get_b
  260.     rst 4        ;print it
  261. lf1:    lxi h,010Ah    ;make scroll
  262.     call 4f9bh    ;position line
  263. ;
  264.     call 4f72h    ;delete line
  265.     jmp bottom    ;position for
  266.             ;new line
  267. ;======================================
  268. draw:    lxi h,0109h    ;point to top
  269.     call 4f9bh    ; of bottom
  270.     mvi b,40    ;draw bar
  271.     jmp line
  272. ;-----------------------
  273. eeolcd:    mvi a,'J'    ;Erase to End
  274.     jmp 4f8fh    ;Of LCD
  275. ;-----------------------
  276. vmsg:    db 'X-View:',0        ;data
  277. vfile:    db 0,0,0,0,0,0,0    ;stored
  278. ;-----------------------
  279.     end
  280.