home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / ASM / ASMLIB40.ZIP / ASM4DEMO.ZIP / TEXTDEMO.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-10-28  |  2.6 KB  |  191 lines

  1. ; TEXTDEMO.ASM - Demonstration program for ASMLIB
  2. ;  Programmer: Doug Herr
  3. ;  date: 6/10/1992
  4.  
  5.  
  6. include    asm.inc
  7.  
  8. public    textdemo
  9. extrn    wframe:proc, getkey:proc, wfill:proc
  10. extrn    wsave:proc, wsize:proc, allocdos:proc
  11. extrn    wrestore:proc, tprint:proc
  12. extrn    hscroll:proc, vscroll:proc
  13. extrn    ansicolor:proc
  14. extrn    crtinfo:proc
  15. extrn    tcopy:proc, usetpage:proc
  16.  
  17. .data
  18. wseg        dw ?
  19. r0        dw 0
  20. c0        dw 0
  21. r1        dw 0
  22. c1        dw 0
  23. frame_type    db 0
  24. frame_color    db 8Fh
  25. last_col    dw 79
  26. last_row    dw 24
  27. move_box    db ' Use ,,, to move box ',0
  28. scroll_box    db ' Use ,,, to scroll box ',0
  29.  
  30. .code
  31. textdemo    proc
  32.     call    crtinfo
  33.     dec    al
  34.     mov    byte ptr last_row,al
  35.     dec    ch
  36.     mov    byte ptr last_col,ch
  37.  
  38.     mov    frame_type,0
  39.     or    frame_color,80h
  40.     mov    r0,5
  41.     mov    c0,5
  42.     mov    r1,20
  43.     mov    c1,50
  44.     mov    bx,0001h    ; copy page 0 to page 1
  45.     call    tcopy
  46.     call    usetpage
  47. td01:    lea    bx,r0
  48.     call    wsize
  49.     xor    dx,dx
  50.     push    bx
  51.     call    allocdos
  52.     mov    ax,bx
  53.     pop    bx
  54.     mov    wseg,ax        ; save segment address
  55.     mov    es,ax
  56.     xor    di,di        ; ES:[DI] points to buffer
  57.     call    wsave
  58.     mov    al,'≡'
  59.     mov    ah,7
  60.     call    wfill
  61.     mov    ax,word ptr frame_type
  62.     call    wframe
  63.     lea    si,move_box
  64.     mov    dh,byte ptr r0
  65.     inc    dh
  66.     mov    dl,byte ptr c0
  67.     inc    dl
  68.     mov    ah,14
  69.     call    tprint
  70.     mov    bx,0100h
  71.     call    tcopy
  72.     call    getkey
  73.     shr    ah,1
  74.     jnc    td02
  75.     jmp    extended
  76. td02:    cmp    al,27
  77.     je    td99
  78.     cmp    al,13
  79.     jne    td01
  80.  
  81. ; ENTER was pressed
  82.     xor    bl,bl
  83.     call    usetpage
  84.     and    frame_color,0Fh
  85.     mov    frame_type,0FFh
  86.  
  87.     lea    bx,r0
  88.     mov    es,wseg
  89.     xor    di,di
  90.     call    wrestore
  91.     mov    ah,49h
  92.     int    21h
  93.     mov    ax,word ptr frame_type
  94.     call    wframe
  95.     lea    si,scroll_box
  96.     mov    ah,14
  97.     mov    dh,byte ptr r0
  98.     inc    dh
  99.     mov    dl,byte ptr c0
  100.     inc    dl
  101.     call    tprint
  102. td11:    call    getkey
  103.     cmp    ax,13
  104.     je    td99
  105.     shr    ah,1
  106.     jc    td110
  107.     jmp    td11
  108.  
  109. td99:    ret
  110.  
  111. textdemo    endp
  112.  
  113. td110:    cmp    al,72
  114.     je    up2
  115.     cmp    al,80
  116.     je    down2
  117.     sub    al,76
  118.     cmp    al,1
  119.     je    td12
  120.     cmp    al,0FFH
  121.     jne    td11
  122. td12:    cbw
  123.     mov    cx,ax
  124.     neg    cx
  125.     call    ansicolor
  126.     lea    bx,r0
  127.     call    hscroll
  128.     jmp    td11
  129. up2:    mov    cx,1
  130.     jmp    short scroll_updown
  131. down2:    mov    cx,-1
  132. scroll_updown:
  133.     call    ansicolor
  134.     lea    bx,r0
  135.     call    vscroll
  136.     jmp    td11
  137.  
  138. extended:
  139.     lea    bx,r0
  140.     mov    es,wseg
  141.     xor    di,di
  142.     call    wrestore
  143.     push    ax
  144.     mov    ah,49h
  145.     int    21h
  146.     pop    ax
  147.     cmp    al,72
  148.     je    up
  149.     cmp    al,80
  150.     je    down
  151.     cmp    al,75
  152.     je    left
  153.     cmp    al,77
  154.     je    right
  155. e9:    jmp    td01
  156.  
  157. up:    dec    r0
  158.     js    no_up
  159.     dec    r1
  160.     jmp    e9
  161. no_up:    inc    r0
  162.     jmp    e9
  163.  
  164. down:    inc    r1
  165.     mov    ax,r1
  166.     cmp    ax,last_row
  167.     ja    no_down
  168.     inc    r0
  169.     jmp    e9
  170. no_down:dec    r1
  171.     jmp    e9
  172.  
  173. left:    dec    c0
  174.     js    no_left
  175.     dec    c1
  176.     jmp    e9
  177. no_left:inc    c0
  178.     jmp    e9
  179.  
  180. right:    inc    c1
  181.     mov    ax,c1
  182.     cmp    ax,last_col
  183.     ja    no_right
  184.     inc    c0
  185.     jmp    e9
  186. no_right:
  187.     dec    c1
  188.     jmp    e9
  189.  
  190.     end
  191.