home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / commercial-software / programming / AZTEC302.ZIP / S.ARC < prev    next >
Text File  |  1998-09-16  |  6KB  |  328 lines

  1. scr_cdel.c
  2. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  3. /*
  4.  *    delete the char. at the cursor and put blank at end of line
  5.  */
  6.  
  7. #define max_width 80
  8.  
  9. extern int _attrib;
  10.  
  11. scr_cdelete()
  12. {
  13.     register unsigned ch, x;
  14.     int lin, col;
  15.  
  16.     scr_loc(&lin, &col);
  17.     for (x = col ; x < max_width-1 ; ++x) {
  18.         scr_curs(lin, x+1);
  19.         ch = scr_call(0x0800,0,0,0);    /* read out current char */
  20.         scr_curs(lin, x);
  21.         scr_call(0x0900 | (ch&255), ch>>8, 1, 0); /* and shift over */
  22.     }
  23.     scr_curs(lin, max_width-1);
  24.     scr_call(0x920, _attrib, 1, 0);    /* put a blank at end of line */
  25.     scr_curs(lin, col);
  26.     return(0);
  27. }
  28. scr_cins.c
  29. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  30. /*
  31.  *    insert a space at the cursor and delete the char. at end of line
  32.  */
  33.  
  34. #define max_width 80
  35. extern int _attrib;
  36.  
  37. scr_cinsert()
  38. {
  39.     register unsigned ch, z;
  40.     int lin, col;
  41.  
  42.     scr_loc(&lin, &col);
  43.     for (z = max_width - 1 ; z > col ; --z) {
  44.         scr_curs(lin, z-1);
  45.         ch = scr_call(0x0800,0,0,0);    /* read out current char */
  46.         scr_curs(lin, z);
  47.         scr_call(0x0900 | (ch&255), ch>>8, 1, 0); /* and move it right */
  48.     }
  49.     scr_curs(lin, col);
  50.     scr_call(0x920,_attrib,1,0);
  51.     return(0);
  52. }
  53. scr_clear.c
  54. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  55. /*
  56.  *    Clears the screen and homes the cursor
  57.  */
  58.  
  59. #define max_width  80
  60. #define max_y  25
  61.  
  62. extern int _attrib;
  63.  
  64. scr_clear()
  65. {
  66.     scr_home();
  67.     scr_call(0x920,_attrib,(max_width * max_y),0);
  68.     return(0);
  69. }
  70. scr_curs.c
  71. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  72. /*
  73.  *     Moves cursor to line lin, position pos
  74.  */
  75.  
  76. #define max_width 80
  77.  
  78. scr_curs(lin, col)
  79. register int lin, col;
  80. {
  81.     if (col >= max_width)
  82.         col = max_width - 1;
  83.     if (lin >= 25)
  84.         lin = 24;
  85.     scr_call(0x200, 0, 0, (lin << 8) | col);
  86.     return(0);
  87. }
  88. scr_echo.c
  89. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  90. /*
  91.  *    if flg is zero disable echoing of characters
  92.  */
  93.  
  94. extern int _echo;
  95.  
  96. scr_echo(flg)
  97. int flg;
  98. {
  99.     _echo = flg;
  100.     return(0);
  101. }
  102. scr_eol.c
  103. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  104. /*
  105.  *        Clear to the end of line
  106.  */
  107.  
  108. extern int _attrib;
  109.  
  110. scr_eol()
  111. {
  112.     int lin, col;
  113.  
  114.     scr_loc(&lin, &col);
  115.     scr_call(0x920, _attrib, 80-col, 0);
  116.     return(0);
  117. }
  118. scr_eos.c
  119. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  120. /*
  121.  *        clear to end of screen
  122.  */
  123.  
  124. extern int _attrib;
  125.  
  126. scr_eos()
  127. {
  128.     int lin, col;
  129.  
  130.     scr_loc(&lin, &col);
  131.     scr_call(0x920, _attrib, (80-col)+((25-lin)*80), 0);
  132.     return(0);
  133. }
  134. scr_home.c
  135. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  136. /*
  137.  *    Homes the cursor (0, 0)
  138.  */
  139.  
  140. scr_home()
  141. {
  142.     scr_curs(0, 0);
  143.     return(0);
  144. }
  145. scr_inve.c
  146. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  147. /*
  148.  *     if flg is zero turn on inverse
  149.  */
  150.  
  151. extern int _attrib;
  152.  
  153. scr_invers(flg)
  154. int flg;
  155. {
  156.     _attrib = flg ? 0x70 : 0x07;
  157.     return(0);
  158. }
  159. scr_ldel.c
  160. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  161. /*
  162.  *     Deletes  line at lin, blank lines at bottom
  163.  */
  164.  
  165. extern int _attrib;
  166.  
  167. scr_ldelete()
  168. {
  169.     int lin, col;
  170.  
  171.     scr_loc(&lin, &col);
  172.     scr_call(0x600 | 1, _attrib<<8, lin<<8, (24<<8) | 79);
  173.     scr_curs(lin, 0);
  174.     return(0);
  175. }
  176. scr_lins.c
  177. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  178. /*
  179.  *    Inserts blank lines at lin, pushing rest down
  180.  */
  181.  
  182. extern int _attrib;
  183.  
  184. scr_linsert()
  185. {
  186.     int lin, col;
  187.  
  188.     scr_loc(&lin, &col);
  189.     scr_call(0x700 | 1, _attrib<<8, lin<<8, (24<<8) | 79);
  190.     scr_curs(lin, 0);
  191.     return(0);
  192. }
  193. scr_putc.c
  194. /* Copyright (C) 1984 by Manx Software Systems, Inc. */
  195. /*
  196.  *    display the character at the cursor
  197.  */
  198.  
  199. int _attrib = 0x07;
  200.  
  201. scr_putc(c)
  202. register int c;
  203. {
  204.     c &= 255;
  205.     if (c >= 0x20)
  206.         scr_call(0x0900 | c, _attrib,1,0);
  207.     scr_call(0x0e00 | c, _attrib);
  208.     return c;
  209. }
  210. scr_getc.asm
  211. ; Copyright (C) 1985 by Manx Software Systems
  212. ; :ts=8
  213.     include lmacros.h
  214. dataseg    segment    word public 'data'
  215.     public    _echo_
  216. _echo_    db    0,0
  217. dataseg    ends
  218.     assume    ds:dataseg
  219. ifdef FARPROC
  220.     extrn    scr_putc_:far
  221. else
  222.     extrn    scr_putc_:near
  223. endif
  224. ;
  225. ;    scr_getc() - issue int 16 to get keyboard value
  226. ;            returns normal ASCII chars as their value (0-127)
  227. ;            special chars are in the range 128 - 255
  228. ;            cntl-break is returned as -2
  229. ;
  230.     procdef    scr_getc
  231.     mov    ah,0
  232.     int     16h
  233.     call    mapchar
  234.     cmp    _echo_,0
  235.     jz    no_echo
  236.     cmp    ax,128
  237.     jae    no_echo
  238.     push    ax
  239.     call    scr_putc_
  240.     pop    ax
  241. no_echo:
  242.     pret
  243.     pend    scr_getc
  244. ;
  245. ;    scr_poll() - polls keyboard for a character
  246. ;            returns -1 for no character
  247. ;            otherwise returns the character as above
  248. ;    Note: this doesn't remove the char from the buffer
  249. ;
  250.     procdef    scr_poll
  251.     mov    ah,1
  252.     int     16h
  253.     jnz    mapit
  254.     mov    ax,-1
  255.     pret
  256. mapit:
  257.     call    mapchar
  258.     pret
  259.     pend    scr_poll
  260. ;
  261. mapchar    proc    near
  262.     test    al,al
  263.     jz    special
  264.     sub    ah,ah
  265.     ret
  266. special:
  267.     xchg    al,ah
  268.     test    al,al
  269.     jz    ctl_brk
  270.     cmp    al,3
  271.     jne    not_nul
  272.     sub    ax,ax
  273.     ret
  274. not_nul:
  275.     or    al,80H
  276.     ret
  277. ctl_brk:
  278.     mov    ax,-2
  279.     ret
  280. mapchar    endp
  281. ;
  282.     finish
  283.     end
  284. scr_loc.asm
  285. ;    Copyright (C) 1984 by Manx Software Systems
  286. ;    :ts=8
  287. ;
  288. ;    scr_loc(lin, col)  - place the location of the cursor in line and column
  289. ;
  290.     include lmacros.h
  291. ;
  292.     procdef scr_loc,<<lin,ptr>,<col,ptr>>
  293. ;
  294.     pushds
  295.     mov    ah,3
  296.     mov    bh,0
  297.     int    10h          ; find the location of cursor
  298.     ldptr    bx,lin,ds    ; move address of line into bx
  299.     mov    0[bx],dh    ; move cursor location into memory
  300.     mov    byte ptr 1[bx],0
  301.     ldptr    bx,col,ds    ; move addres of col. into bx
  302.     mov    0[bx],dl    ; move cursor location into memory
  303.     mov    byte ptr 1[bx],0
  304.     popds
  305.     pret
  306.     pend    scr_loc
  307.     finish
  308.     end
  309. scr_call.asm
  310. ; Copyright (C) 1984 by Manx Software Systems
  311. ; :ts=8
  312.     include lmacros.h
  313. ;
  314. ;    scr_call(ax,bx,cx,dx) - issue int 10 with ax,... set to args
  315. ;
  316. ;
  317.     procdef    scr_call,<<aax,word>,<bbx,word>,<ccx,word>,<ddx,word>>
  318.     mov    ax,aax
  319.     mov    bx,bbx
  320.     mov    cx,ccx
  321.     mov    dx,ddx
  322.     int     10h
  323.     pret
  324.     pend    scr_call
  325.     finish
  326.     end
  327. t *endmarker = &first, *restart = &first;
  328. static