home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFA.ZIP / SEDCODE.SEQ < prev    next >
Encoding:
Text File  |  1987-12-31  |  2.9 KB  |  96 lines

  1. \ SEDCODE.SEQ   The Assembly code needed for SED        by Tom Zimmer
  2.  
  3. only forth also hidden definitions also
  4.  
  5. code tb:        ( W -- tsegb W )
  6.                 pop ax
  7.                 mov dx, tsegb
  8.                 2push
  9.                 end-code
  10.  
  11. code tl:        ( W -- lseg  W )
  12.                 pop ax
  13.                 mov dx, lseg
  14.                 2push
  15.                 end-code
  16.  
  17. code ?exit      ( f1 -- )  \ exit from definition on boolean f1.
  18.                 pop ax
  19.                 or ax, ax
  20.         0<> if
  21.                 mov ip, 0 [rp]
  22.                 inc rp
  23.                 inc rp
  24.         then
  25.                 next
  26.                 end-code
  27.  
  28. code getdiskfree        \ return free space from disk
  29.                 ( dv --- avail.clusters bytes/sec secs/cluster )
  30.                 mov ah, # 54
  31.                 pop dx
  32.                 int 33
  33.                 push bx
  34.                 push cx
  35.                 1push
  36.                 end-code
  37.  
  38. code >lineptr   ( n1 --- a1 )
  39.                 pop ax
  40.                 shl ax, # 1
  41.                 1push
  42.                 end-code
  43.  
  44. code tl:@       ( a1 -- n1 )
  45.                 pop bx          mov ds, lseg
  46.                 mov ax, 0 [bx]
  47.                 mov bx, cs      mov ds, bx
  48.                 1push           end-code
  49.  
  50. code tl:!       ( n adr -- )
  51.                 pop bx          mov ds, lseg
  52.                 pop ax          mov 0 [bx], ax
  53.                 mov bx, cs      mov ds, bx
  54.                 NEXT            END-CODE
  55.  
  56. code #linedata  ( n1 --- a1 n2 )        \ n1 = line, a1,n2 = addr & len
  57.                 pop bx                  \ get line number
  58.                 shl bx, # 1             \ convert to word offset
  59.                 mov ds, lseg            \ set DS to Linelist segment
  60.                 mov ax, 0 [bx]          \ get line address
  61.                 push ax                 \ push it
  62.                 mov dx, ax              \ save to subtract later
  63.                 mov ax, 2 [bx]          \ get next list address
  64.                 sub ax, dx              \ subtract to get line length
  65.                 mov bx, cs
  66.                 mov ds, bx              \ restore DS
  67.                 1push           end-code
  68.  
  69. code clipline ( a1 n1 --- a2 n3 )
  70.                 mov bx, ' screenchar >body      \ get the value of screenchar
  71.                 pop cx
  72.                 pop dx
  73.                 mov ax, # 39
  74.         begin
  75.                 cmp bx, # 77
  76.         > while
  77.                 sub bx, ax
  78.                 sub cx, ax
  79.                 add dx, ax
  80.         repeat
  81.                 push dx
  82.                 push cx
  83.                 next
  84.                 end-code
  85.  
  86.  
  87. code qmod       ( n1 n1 -- Remainder )          \ a quick modulus operator
  88.                 pop bx          mov dx, # 0
  89.                 pop ax
  90.                 div bx          push dx
  91.                 next
  92.                 end-code
  93.  
  94. only forth also definitions
  95.  
  96.