|
|
1.1 root 1: .unixorder
2: ////////
3: /
4: / Memory mapped video driver assembler assist.
5: /
6: ////////
7: /
8: / State driven code
9: /
10: / Input: DS:SI - input string
11: / ES:DI - current screen location
12: / SS:BP - terminal information
13: / CX - input count
14: / BP - references terminal information
15: / AH - character attributes
16: / AL - character
17: / BH - (usually) kept zeroed for efficiency
18: / DH - current row
19: / DL - current column
20: /
21: ////////
22:
23: .set NCOL, 80 / number of columns
24: .set NCB, 2 / number of horizontal bytes per char
25: .set SCB, 1 / log2(NCB)
26: .set NCR, 1 / number of horizontal lines per char
27: .set NHB, 160 / number of horizontal bytes per line
28: .set NRB, 160 / number of bytes per character row(NCR*NHB)
29:
30: ATTR .define %ah /* attribute byte */
31: ZERO .define %bh /* (almost) always zero */
32: ROW .define %dh /* currently active vertical position */
33: COL .define %dl /* currently active horizontal position */
34: POS .define %edi /* currently active display address */
35:
36: .set INTENSE, 0x08 / high intensity attribute bit
37: .set BLINK, 0x80 / blinking attribute bit
38: .set REVERSE, 0x70 / reverse video
39:
40: .set SEG_386_UD, 0x10 / 32 bit user data segment descriptor
41: .set SEG_ROM, 0x40 / ROM descriptor @ F0000
42: .set SEG_VIDEOa, 0x48 / 0x48: video descriptor @ B0000
43: .set SEG_VIDEOb, 0x50 / 0x50: video descriptor @ B8000
44:
45: ////////
46: /
47: / Magic constants from <sys/io.h>
48: /
49: ////////
50:
51: .set IO_SEG, 0
52: .set IO_IOC, 4
53: .set IO_BASE, 12
54:
55: .set IOSYS, 0
56: .set IOUSR, 1
57:
58: ////////
59: /
60: / Data
61: /
62: ////////
63:
64: .set MM_FUNC, 0 / current state
65: .set MM_PORT, 4 / adapter base i/o port
66: .set MM_BASE, 8 / adapter base memory address
67: .set MM_OFFSET, 12 / offset within segment
68: .set MM_ROW, 16 / screen row
69: .set MM_COL, 20 / screen column
70: .set MM_POS, 24 / screen position
71: .set MM_ATTR, 28 / attributes
72: .set MM_N1, 32 / numeric argument 1
73: .set MM_N2, 36 / numeric argument 2
74: .set MM_BROW, 40 / base row
75: .set MM_EROW, 44 / end row
76: .set MM_LROW, 48 / legal row limit
77: .set MM_SROW, 52 / saved cursor row
78: .set MM_SCOL, 56 / saved cursor column
79: .set MM_IBROW, 60 / initial base row
80: .set MM_IEROW, 64 / initial end row
81: .set MM_INVIS, 68 / cursor invisible mask
82: .set MM_SLOW, 72 / slow [no flicker] video update
83: .set MM_WRAP, 76 / wrap to start of next line
84:
85: .set MM_VISIBLE, 80 // set if screen is being displayed
86: .set MM_ESC, 84 // escape char. state
87:
88: .set MM_MSEG, 88 // heap space copy
89: .set MM_MOFF, 92 //
90: .set MM_VSEG, 96 // video memory
91: .set MM_VOFF, 100
92: .set MM_LOCKED, 104 // keyboard locked state
93: .set MM_SIZE, 108 //
94:
95: .globl VIDSLOW / Patchable kernel variable.
96: .globl vtmminit
97:
98: .data
99: VIDSLOW:.long 0
100:
101: LXXX: .long 10 / constant (imull)
102:
103: .text
104:
105: ////////
106: /
107: / mmgo( iop, vp, index )
108: / IO *iop;
109: / VTDATA *vp;
110: / int index;
111: /
112: ////////
113:
114: .set FRAME,32 / ra, bx, si, di, ds, es, fs, bp
115:
116: .globl vtmmgo
117:
118: vtmmgo:
119: push %ebx
120: push %esi
121: push %edi
122: push %ds
123: push %es
124: push %fs
125: push %ebp
126: movl %esp,%ebp
127:
128: push %ds / copy ds to fs
129: pop %fs
130:
131: cld
132: mov FRAME+0(%ebp),%ebx / iop
133: mov IO_BASE(%ebx),%esi / iop->io_base
134: mov IO_IOC(%ebx),%ecx / iop->io_ioc
135:
136: cmpl $IOSYS,IO_SEG(%ebx) / user address space
137: je loc1
138: mov $SEG_386_UD,%eax
139: movw %ax,%ds
140: loc1:
141: mov FRAME+4(%ebp),%ebp / vtp
142: mov $0, %edx / assume not visible
143: cmpb $0, %fs:MM_VISIBLE(%ebp) / if this is the case, then
144: je loc2 / don't mess with the video hw
145:
146: mov %fs:MM_PORT(%ebp),%edx / turn video off if color board
147: cmp $0x3B4,%edx
148: je loc2
149: cmpb $0,%fs:MM_SLOW(%ebp) / check for slow [flicker-free]
150: je loc3
151:
152: mov $0x3DA,%edx
153: loc4: inb (%dx) / wait for vertical retrace
154: testb $8,%al
155: je loc4
156: loc3:
157: mov $0x3D8,%edx / disable video
158: movb $0x25,%al
159: outb (%dx)
160: loc2:
161: movb %fs:MM_ROW(%ebp),ROW
162: movb %fs:MM_COL(%ebp),COL
163: movw %fs:MM_BASE(%ebp),%es
164: mov %fs:MM_POS(%ebp),POS
165: sub %ebx,%ebx
166: movb %fs:MM_ATTR(%ebp),ATTR
167:
168: ijmp %fs:MM_FUNC(%ebp)
169:
170: exit: pop %ebx
171: mov %ebx,%fs:MM_FUNC(%ebp)
172: movb ATTR,%fs:MM_ATTR(%ebp)
173: movb ROW,%fs:MM_ROW(%ebp) / save row,column
174: movb COL,%fs:MM_COL(%ebp)
175: mov POS,%fs:MM_POS(%ebp) / save position
176:
177: / ensure that only the screen associated with the keyboard
178: / will actually get the cursor updated.
179: / physical index of screen to which the
180: .globl vtactive / keyboard is currently attached
181: mov %esp, %ebx
182: mov vtactive, %edx
183: cmp FRAME+8(%ebx), %edx / "index" - 3rd arg.
184: jne exit0
185:
186: mov %fs:MM_PORT(%ebp),%edx / update cursor location
187: mov POS,%ebx
188: add %fs:MM_OFFSET(%ebp),%ebx / adjust to screen
189: or %fs:MM_INVIS(%ebp),%ebx
190: shr $1,%ebx
191:
192: movb $14,%al
193: outb (%dx)
194: inc %edx
195: movb %bh,%al
196: outb (%dx)
197: dec %edx
198: movb $15,%al
199: outb (%dx)
200: inc %edx
201: movb %bl,%al
202: outb (%dx)
203: exit0:
204: mov %fs:MM_PORT(%ebp),%edx / turn video on
205: cmp $0, %fs:MM_VISIBLE(%ebp) / iff screen is visible
206: je exit1
207:
208: add $4,%edx
209: movb $0x29,%al
210: outb (%dx)
211: mov $600,%fs:vtmmvcnt / 600 seconds before video disabled
212: exit1:
213: mov FRAME(%esp),%ebx / iop
214: mov %ecx,%eax
215: xchg %ecx, %fs:IO_IOC(%ebx)
216: sub %fs:IO_IOC(%ebx),%ecx
217: add %ecx,%fs:IO_BASE(%ebx)
218: / ra, bx, si, di, ds, es, fs, bp
219: pop %ebp
220: pop %fs
221: pop %es
222: pop %ds
223: pop %edi
224: pop %esi
225: pop %ebx
226: ret
227:
228:
229: ////////
230: /
231: / mminit - initialize screen
232: /
233: ////////
234: vtmminit:
235: movw %fs:MM_BASE(%ebp), %es
236: movb $0x63,%fs:MM_ESC(%ebp) / schedule keyboard initialization
237:
238: mov %fs:MM_BASE(%ebp), %edx
239: mov %dx, %es
240: movw %fs:MM_BASE(%ebp), %dx
241:
242: cmp $0, %fs:MM_VISIBLE(%ebp)
243: jne mminit0
244:
245: / DEBUG
246: / mov %fs:MM_PORT(%ebp),%edx / turn video off
247: / add $4,%edx
248: / movb $0x21,%al
249: / outb (%dx)
250: / DEBUG
251:
252: mov %fs:MM_PORT(%ebp),%edx / zero display offset
253: movb $12,%al
254: outb (%dx)
255: inc %edx
256: subb %al,%al
257: outb (%dx)
258: dec %edx
259: movb $13,%al
260: outb (%dx)
261: inc %edx
262: subb %al,%al
263: outb (%dx)
264:
265: mov %fs:MM_PORT(%ebp),%edx / reset border to black
266: add $5,%edx
267: subb %al,%al
268: outb (%dx)
269:
270: inc %edx / reset TECMAR XMSR register
271: outb (%dx)
272: mminit0:
273: movl $0,%fs:MM_INVIS(%ebp)
274: movb $0x07,ATTR
275: movb ATTR,%fs:MM_ATTR(%ebp)
276: movb $1,%fs:MM_WRAP(%ebp)
277: movb %fs:MM_IBROW(%ebp),ROW
278: movb ROW,%fs:MM_BROW(%ebp)
279: movb %fs:MM_IEROW(%ebp),%bl
280: movb %bl,%fs:MM_EROW(%ebp)
281: sub %ebx,%ebx
282: movb $2,%fs:MM_N1(%ebp)
283: jmp mm_ed
284:
285: ////////
286: /
287: / mmspec - schedule special keyboard function
288: /
289: ////////
290:
291: mmspec: movb %al,%fs:MM_ESC(%ebp)
292: jmp eval
293:
294: ////////
295: /
296: / mmbell - schedule beep
297: /
298: ////////
299:
300: mmbell: movb $-1,%fs:vtmmbeeps
301: jmp eval
302:
303: ////////
304: /
305: / mm_cnl - cursor next line
306: /
307: / Moves the active position to the next display line.
308: / Scrolls the active display if necessary.
309: /
310: ////////
311:
312: mm_cnl:
313: incb ROW
314: cmpb %fs:MM_EROW(%ebp),ROW
315: jna repos
316: movb %fs:MM_EROW(%ebp),ROW
317:
318: / jmp scrollup
319:
320: ////////
321: /
322: / scrollup - scroll display upwards
323: /
324: ////////
325:
326: scrollup:
327: push %ds
328: push %esi
329: push %ecx
330:
331: movw %fs:MM_BASE(%ebp),%ds
332: movb %fs:MM_BROW(%ebp),%bl
333: mov %cs:rowtab(,%ebx,4),%edi
334: mov %cs:rowtab+4(,%ebx,4),%esi
335:
336: movb ROW,%bl
337: mov %cs:rowtab(,%ebx,4),%ecx
338:
339: push %ecx
340: sub %edi,%ecx
341: shr $1,%ecx
342: cld
343:
344: add %fs:MM_OFFSET(%ebp), %esi / adjust for screen
345: add %fs:MM_OFFSET(%ebp), %edi
346:
347: rep
348: movsw
349: movb $0x20,%al
350: mov $NCOL,%ecx
351:
352: pop %edi
353: add %fs:MM_OFFSET(%ebp), %edi
354: rep
355: stosw
356:
357: sub %fs:MM_OFFSET(%ebp), %edi
358: pop %ecx
359: pop %esi
360: pop %ds
361: movb COL,%bl / reposition to ROW and COL
362: mov %cs:coltab(,%ebx,4),POS
363: movb ROW,%bl
364: add %cs:rowtab(,%ebx,4),POS
365: call exit
366:
367: jmp eval
368:
369: ////////
370: /
371: / repos - reposition cursor
372: /
373: ////////
374:
375: repos: movb COL,%bl / reposition to ROW and COL
376: mov %cs:coltab(,%ebx,4),POS
377: movb ROW,%bl
378: add %cs:rowtab(,%ebx,4),POS
379: jmp eval
380:
381: ////////
382: /
383: / Ewait - wait for next input char to evaluate
384: /
385: / eval - evaluate input character
386: /
387: ////////
388:
389: ewait:
390: call exit
391: eval:
392: jcxz ewait
393:
394: dec %ecx / evaluate next char
395: lodsb
396: movb %al,%bl
397: shlb $1,%bl
398: jc mmputc
399: ijmp %cs:asctab(,%ebx,2)
400:
401: ////////
402: /
403: / mmputc - put character in al on screen
404: /
405: ////////
406:
407: mmputc:
408: add %fs:MM_OFFSET(%ebp), POS / adjust for screen
409: stosw / Update display memory.
410: sub %fs:MM_OFFSET(%ebp), POS / adjust for screen
411:
412: incb COL
413: cmpb $NCOL,COL / Past end of line?
414: jge loc6
415: jcxz ewait / Not past, evaluate next character.
416: dec %ecx
417: lodsb
418: movb %al,%bl
419: shlb $1,%bl
420: jc mmputc
421: ijmp %cs:asctab(,%ebx,2)
422:
423: loc6: cmpb $0,%fs:MM_WRAP(%ebp) / Yes past, Wrap around?
424: jne loc7
425: sub $2,%edi / No wrap, adjust back to end of line.
426: decb COL
427: jcxz ewait / Not past, evaluate next character.
428: dec %ecx
429: lodsb
430: movb %al,%bl
431: shlb $1,%bl
432: jc mmputc
433: ijmp %cs:asctab(,%ebx,2)
434:
435: loc7: subb COL,COL / Wrap to next line.
436: incb ROW
437: cmpb %fs:MM_EROW(%ebp),ROW / Past scrolling region?
438: jg loc8
439: jcxz ewait / Not past, evaluate next character.
440: dec %ecx
441: lodsb
442: movb %al,%bl
443: shlb $1,%bl
444: jc mmputc
445: ijmp %cs:asctab(,%ebx,2)
446:
447: loc8: movb %fs:MM_EROW(%ebp),ROW / Yes past, scroll up 1 line.
448: jmp scrollup
449:
450:
451: ////////
452: /
453: / mm_cr - carriage return
454: /
455: / Moves the active position to first position of current display line.
456: /
457: ////////
458:
459: mm_cr: subb COL,COL
460: movb ROW,%bl
461: mov %cs:rowtab(,%ebx,4),POS
462: jcxz ewait
463: dec %ecx
464: lodsb
465: movb %al,%bl
466: shlb $1,%bl
467: jc mmputc
468: ijmp %cs:asctab(,%ebx,2)
469:
470: ////////
471: /
472: / mm_cub - cursor backwards
473: /
474: ////////
475:
476: mm_cub: sub $2,POS
477: decb COL
478: jge loc9
479: movb $NCOL-1,COL
480: decb ROW
481: cmpb %fs:MM_BROW(%ebp),ROW
482: jge loc9
483: subb COL,COL
484: movb %fs:MM_BROW(%ebp),ROW
485: movb ROW,%bl
486: mov %cs:rowtab(,%ebx,4),POS
487: loc9: jcxz loc9a
488: jmp loc9b
489: loc9a: jmp ewait
490: loc9b: dec %ecx
491: lodsb
492: movb %al,%bl
493: shlb $1,%bl
494: jc mmputc
495: ijmp %cs:asctab(,%ebx,2)
496:
497: ////////
498: /
499: / Esc state - entered when last char was ESC - transient state.
500: /
501: ////////
502:
503: loc10: call exit
504: mm_esc: jcxz loc10
505: dec %ecx
506: lodsb
507: / movb ZERO,%fs:MM_N1(%ebp)
508: / movb ZERO,%fs:MM_N2(%ebp)
509: movb $0, %fs:MM_N1(%ebp)
510: movb $0, %fs:MM_N2(%ebp)
511: movb %al,%bl
512: shlb $1,%bl
513: jc mmputc
514: ijmp %cs:esctab(,%ebx,2)
515:
516: ////////
517: /
518: / Csi_n1 state - entered when last two chars were ESC [
519: /
520: / Action: Evaluates numeric chars as numeric parameter 1.
521: /
522: ////////
523:
524: loc11: call exit
525: csi_n1: jcxz loc11
526: dec %ecx
527: lodsb
528: cmpb $0x3b,%al
529: je csi_n2
530: movb %al,%bl
531: subb $0x30,%bl
532: cmpb $9,%bl
533: ja csival
534:
535: movb %fs:MM_N1(%ebp),%al
536: shlb $2,%al
537: addb %fs:MM_N1(%ebp),%al
538: shlb $1,%al
539: / n1 * 10
540:
541: addb %bl,%al / n1 * 10 + digit
542: movb %al,%fs:MM_N1(%ebp) / n1 = (n1 * 10) + digit
543: jmp csi_n1
544:
545: ////////
546: /
547: / Csi_n2 state - entered after input sequence ESC [ n ;
548: /
549: ////////
550:
551: loc12: call exit
552: csi_n2: jcxz loc12
553: dec %ecx
554: lodsb
555: movb %al,%bl
556: subb $0x30,%bl
557: cmpb $9,%bl
558: ja csival
559:
560: movb %fs:MM_N2(%ebp),%al
561: shlb $2,%al
562: addb %fs:MM_N2(%ebp),%al
563: shlb $1,%al
564: / n1 * 10
565:
566: addb %bl,%al / n2 * 10 + digit
567: movb %al,%fs:MM_N2(%ebp) / n2 = (n2 * 10) + digit
568: jmp csi_n2
569:
570: csival: movb %al,%bl
571: shlb $1,%bl
572: jc mmputc
573: ijmp %cs:csitab(,%ebx,2)
574:
575: ////////
576: /
577: / Csi_gt state - entered after input sequence ESC [ >
578: /
579: ////////
580:
581: loc13: call exit
582: csi_gt: jcxz loc13
583: dec %ecx
584: lodsb
585: movb %al,%bl
586: subb $0x30,%bl
587: cmpb $9,%bl
588: ja loc14
589: mov %fs:MM_N1(%ebp),%eax / n1 * 2
590: imull %cs:LXXX,%eax / n1 * 10
591: add %ebx,%eax / n1 * 10 + digit
592: movb %al,%fs:MM_N1(%ebp) / n1 = (n1 * 10) + digit
593: jmp csi_gt
594:
595: loc14: cmpb $0x68,%al
596: je mm_cgh
597: cmpb $0x6c,%al
598: je mm_cgl
599: jmp eval
600:
601: ////////
602: /
603: / Csi_q state - entered after input sequence ESC [ ?
604: /
605: ////////
606:
607: loc15: call exit
608: csi_q: jcxz loc15
609: dec %ecx
610: lodsb
611: movb %al,%bl
612: subb $0x30,%bl
613: cmpb $9,%bl
614: ja loc16
615: mov %fs:MM_N1(%ebp),%eax
616: imull %cs:LXXX,%eax
617: add %ebx,%eax / n1 * 10 + digit
618: movb %al,%fs:MM_N1(%ebp) / n1 = (n1 * 10) + digit
619: jmp csi_q
620:
621: loc16: cmpb $0x68,%al
622: je mm_cqh
623: cmpb $0x6c,%al
624: je mm_cql
625: jmp eval
626:
627: ////////
628: /
629: / mm_cbt - cursor backward tabulation
630: /
631: / Moves the active position horizontally in the backward direction
632: / to the preceding in a series of predetermined positions.
633: /
634: ////////
635:
636: mm_cbt: orb $7,COL / calculate next tab stop
637: incb COL
638: subb $16,COL / step back two tab positions
639: jg loc17
640: subb COL,COL / can't step past column 0
641: loc17: jmp repos / reposition cursor
642:
643: ////////
644: /
645: / mm_cgh - process 'ESC [ > N1 h' escape sequence
646: /
647: / Recognized sequences: ESC [ > 13 h -- Set CRT saver enabled.
648: /
649: ////////
650:
651: mm_cgh: cmpb $13,%fs:MM_N1(%ebp)
652: jne loc18
653: movl $1,%fs:vtmmcrtsav
654: loc18: jmp eval
655:
656: ////////
657: /
658: / mm_cgl - process 'ESC [ > N1 l' escape sequence
659: /
660: / Recognized sequences: ESC [ > 13 l -- Reset CRT saver.
661: /
662: ////////
663:
664: mm_cgl: cmpb $13,%fs:MM_N1(%ebp)
665: jne loc19
666: movl $0,%fs:vtmmcrtsav
667: loc19: jmp eval
668:
669: ////////
670: /
671: / mm_cha - cursor horizontal absolute
672: /
673: / Advances the active position forward or backward along the active line
674: / to the character position specified by the parameter.
675: / A parameter value of zero or one moves the active position to the
676: / first character position of the active line.
677: / A parameter value of N moves the active position to character position
678: / N of the active line.
679: /
680: ////////
681:
682: mm_cha: movb %fs:MM_N1(%ebp),COL
683: decb COL
684: jge loc20
685: subb COL,COL
686: loc20: cmpb $NCOL,COL
687: jb loc21
688: movb $NCOL-1,COL
689: loc21: jmp repos / reposition cursor
690:
691:
692: ////////
693: /
694: / mm_cht - cursor horizontal tabulation
695: /
696: / Advances the active position horizontally to the next or following
697: / in a series of predetermined positions.
698: /
699: ////////
700:
701: mm_cht: push %ecx
702: sub %ecx,%ecx
703: movb COL,%cl
704: orb $7,%cl
705: incb %cl
706: subb COL,%cl
707: addb %cl,COL
708: movb $0x20,%al
709:
710: add %fs:MM_OFFSET(%ebp), POS / adjust for screen
711: rep
712: stosw
713: sub %fs:MM_OFFSET(%ebp), POS / adjust for screen
714:
715: pop %ecx
716: cmpb $NCOL,COL
717: jb loc22
718: subb $NCOL,COL
719: incb ROW
720: cmpb %fs:MM_EROW(%ebp),ROW
721: jna loc22
722: movb %fs:MM_EROW(%ebp),ROW
723: jmp scrollup
724: loc22: jmp eval
725:
726: ////////
727: /
728: / mm_cpl - cursor preceding line
729: /
730: / Moves the active position to the first position of the preceding
731: / display line.
732: /
733: ////////
734:
735: mm_cpl: subb COL,COL
736: decb ROW
737: cmpb %fs:MM_BROW(%ebp),ROW
738: jnb loc23
739: movb %fs:MM_BROW(%ebp),ROW
740: jmp scrolldown
741: loc23: jmp repos / reposition cursor
742:
743: ////////
744: /
745: / mm_cqh - process 'ESC [ ? N1 h' escape sequence
746: /
747: / Recognized sequences: ESC [ ? 4 h -- Set smooth scroll.
748: / ESC [ ? 7 h -- Set wraparound.
749: /
750: ////////
751:
752: mm_cqh: cmpb $4,%fs:MM_N1(%ebp) / Smooth scroll.
753: jne loc24
754: movb $1,%fs:MM_SLOW(%ebp)
755: loc24: cmpb $7,%fs:MM_N1(%ebp) / Wraparound.
756: jne loc25
757: movb $1,%fs:MM_WRAP(%ebp)
758: loc25: jmp eval
759:
760: ////////
761: /
762: / mm_cql - process 'ESC [ ? N1 l' escape sequence
763: /
764: / Recognized sequences: ESC [ ? 4 l -- Set jump scroll.
765: / ESC [ ? 7 l -- Reset wraparound.
766: /
767: ////////
768:
769: mm_cql: cmpb $4,%fs:MM_N1(%ebp) / Jump scroll.
770: jne loc26
771: movb $0,%fs:MM_SLOW(%ebp)
772: loc26: cmpb $7,%fs:MM_N1(%ebp) / No wraparound.
773: jne loc27
774: movb $0,%fs:MM_WRAP(%ebp)
775: loc27: jmp eval
776:
777: ////////
778: /
779: / mm_cud - cursor down
780: /
781: / Moves the active position downward without altering the
782: / horizontal position.
783: /
784: ////////
785:
786: mm_cud: incb ROW
787: cmpb %fs:MM_EROW(%ebp),ROW
788: jna loc28
789: movb %fs:MM_EROW(%ebp),ROW
790: loc28: jmp repos / reposition cursor
791:
792: ////////
793: /
794: / mm_cuf - cursor forward
795: /
796: / Moves the active position in the forward direction.
797: /
798: ////////
799:
800: mm_cuf: incb COL
801: cmpb $NCOL,COL
802: jb loc29
803: subb $NCOL,COL
804: incb ROW
805: cmpb %fs:MM_EROW(%ebp),ROW
806: jna loc29
807: movb %fs:MM_EROW(%ebp),ROW
808: movb $NCOL-1,COL
809: loc29: jmp repos
810:
811: ////////
812: /
813: / mm_cup - cursor position
814: /
815: / Moves the active position to the position specified by two parameters.
816: / The first parameter (mm_n1) specifies the vertical position (MM_ROW(%ebp)).
817: / The second parameter (mm_n2) specifies the horizontal position (MM_COL(%ebp)).
818: / A parameter value of 0 or 1 for the first or second parameter
819: / moves the active position to the first line or column in the
820: / display respectively.
821: /
822: ////////
823:
824: mm_cup: movb %fs:MM_N1(%ebp),ROW
825: decb ROW
826: jg loc30
827: subb ROW,ROW
828: loc30: addb %fs:MM_BROW(%ebp),ROW
829: cmpb %fs:MM_EROW(%ebp),ROW
830: jb loc31
831: movb %fs:MM_EROW(%ebp),ROW
832: loc31: movb %fs:MM_N2(%ebp),COL
833: decb COL
834: jg loc32
835: subb COL,COL
836: loc32: cmpb $NCOL,COL
837: jb loc33
838: movb $NCOL-1,COL
839: loc33: jmp repos / reposition cursor
840:
841: ////////
842: /
843: / mm_cuu - cursor up
844: /
845: / Moves the active position upward without altering the horizontal
846: / position.
847: /
848: ////////
849:
850: mm_cuu: decb ROW
851: cmpb %fs:MM_BROW(%ebp),ROW
852: jge loc34
853: movb %fs:MM_BROW(%ebp),ROW
854: loc34: jmp repos / reposition cursor
855:
856: ////////
857: /
858: / mm_dl - delete line
859: /
860: / Removes the contents of the active line.
861: / The contents of all following lines are shifted in a block
862: / toward the active line.
863: /
864: ////////
865:
866: mm_dl: push %ds
867: push %esi
868: push %ecx
869: movw %fs:MM_BASE(%ebp),%ds
870: movb ROW,%bl
871: mov %cs:rowtab(,%ebx,4),%edi
872: mov %cs:rowtab+4(,%ebx,4),%esi
873: movb %fs:MM_EROW(%ebp),%bl
874: mov %cs:rowtab(,%ebx,4),%ecx
875: sub %edi,%ecx
876: jle loc35
877: shr $1,%ecx
878:
879: add %fs:MM_OFFSET(%ebp), %esi / adjust for screen
880: add %fs:MM_OFFSET(%ebp), %edi
881: rep
882: movsw
883: sub %fs:MM_OFFSET(%ebp), %esi
884:
885: mov %cs:rowtab(,%ebx,4),%edi
886: mov $NCOL,%ecx
887: movb $0x20,%al
888:
889: add %fs:MM_OFFSET(%ebp), %edi
890: rep
891: stosw
892: sub %fs:MM_OFFSET(%ebp), %edi
893:
894: subb COL,COL
895: movb ROW,%bl
896: mov %cs:rowtab(,%ebx,4),%edi
897: loc35: pop %ecx
898: pop %esi
899: pop %ds
900: call exit
901: jmp eval
902:
903: ////////
904: /
905: / mm_dmi - disable manual input
906: /
907: / Set flag preventing keyboard input, and causing cursor to vanish.
908: /
909: ////////
910:
911: mm_dmi:
912: movl $1,%fs:islock
913: jmp eval
914:
915: ////////
916: /
917: / mm_ea - erase in area
918: /
919: / Erase some or all of the characters in the currently active area
920: / according to the parameter:
921: / 0 - erase from active position to end inclusive (default)
922: / 1 - erase from start to active position inclusive
923: / 2 - erase all of active area
924: /
925: ////////
926:
927: mm_ea: movb %fs:MM_N1(%ebp),%al
928: cmpb $0,%al
929: jne loc36
930: movb %fs:MM_EROW(%ebp),%bl
931: jmp mm_e0
932: loc36: cmpb $1,%al
933: jne loc37
934: movb %fs:MM_BROW(%ebp),%bl
935: jmp mm_e1
936: loc37: subb COL,COL
937: movb %fs:MM_BROW(%ebp),ROW
938: movb ROW,%bl
939: mov %cs:rowtab(,%ebx,4),POS
940: movb %fs:MM_EROW(%ebp),%bl
941: subb ROW,%bl
942: jmp mm_e2
943:
944:
945: ////////
946: /
947: / mm_ed - erase in display
948: /
949: / Erase some or all of the characters in the display according to the
950: / parameter
951: / 0 - erase from active position to end inclusive (default)
952: / 1 - erase from start to active position inclusive
953: / 2 - erase all of display
954: /
955: ////////
956:
957: mm_ed: movb %fs:MM_N1(%ebp),%al
958: cmpb $0,%al
959: jne loc38
960: movb %fs:MM_LROW(%ebp),%bl
961: jmp mm_e0
962: loc38: cmpb $1,%al
963: jne loc39
964: subb %bl,%bl
965: jmp mm_e1
966: loc39: subb COL,COL
967: movb %fs:MM_BROW(%ebp),ROW
968: sub POS,POS
969: movb %fs:MM_LROW(%ebp),%bl
970: jmp mm_e2
971:
972: ////////
973: /
974: / mm_el - erase in line
975: /
976: / Erase some or all of the characters in the line according to the
977: / parameter:
978: / 0 - erase from active position to end inclusive (default)
979: / 1 - erase from start to active position inclusive
980: / 2 - erase entire line
981: /
982: ////////
983:
984: mm_el: movb %fs:MM_N1(%ebp),%al
985: movb ROW,%bl
986: cmpb $0,%al
987: je mm_e0
988: cmpb $1,%al
989: je mm_e1
990: mov %cs:rowtab(,%ebx,4),POS
991: subb COL,COL
992: subb %bl,%bl
993: / jmp mm_e2
994:
995: mm_e2: push %ecx
996: movb $0x20,%al
997:
998: loc40: mov $NCOL,%ecx
999: add %fs:MM_OFFSET(%ebp), POS
1000: rep
1001: stosw
1002: sub %fs:MM_OFFSET(%ebp), POS
1003:
1004: decb %bl
1005: jge loc40
1006: pop %ecx
1007: jmp repos
1008:
1009: mm_e1: push %ecx
1010: mov POS,%ecx
1011: mov %cs:rowtab(,%ebx,4),POS
1012: sub POS,%ecx
1013: jl loc41
1014: movb $0x20,%al
1015: shr $1,%ecx
1016:
1017: add %fs:MM_OFFSET(%ebp), POS
1018: rep
1019: stosw
1020: sub %fs:MM_OFFSET(%ebp), POS
1021:
1022: loc41: pop %ecx
1023: jmp repos
1024:
1025: mm_e0: push %ecx
1026: mov %cs:rowtab+4(,%ebx,4),%ecx
1027: sub POS,%ecx
1028: jl loc42
1029: movb $0x20,%al
1030: shr $1,%ecx
1031:
1032: add %fs:MM_OFFSET(%ebp), POS
1033: rep
1034: stosw
1035: sub %fs:MM_OFFSET(%ebp), POS
1036:
1037: loc42: pop %ecx
1038: jmp repos
1039:
1040: ////////
1041: /
1042: / mm_emi - enable manual input
1043: /
1044: / Clear flag preventing keyboard input.
1045: /
1046: ////////
1047:
1048: mm_emi:
1049: movl $0,%fs:islock
1050: jmp eval
1051:
1052: ////////
1053: /
1054: / mm_il - insert line
1055: /
1056: / Insert a erased line at the active line by shifting the contents
1057: / of the active line and all following lines away from the active line.
1058: / The contents of the last line in the scrolling region are removed.
1059: /
1060: ////////
1061:
1062: scrolldown:
1063: mm_il: push %ds
1064: push %esi
1065: push %ecx
1066: movw %fs:MM_BASE(%ebp),%ds
1067: movb %fs:MM_EROW(%ebp),%bl
1068: mov %cs:rowtab(,%ebx,4),%esi
1069: mov %esi,%ecx
1070: sub $2,%esi
1071: mov %cs:rowtab+4(,%ebx,4),%edi
1072: sub $2,%edi
1073: movb ROW,%bl
1074: sub %cs:rowtab(,%ebx,4),%ecx
1075: jle loc43
1076: shr $1,%ecx
1077: std
1078:
1079: add %fs:MM_OFFSET(%ebp), %esi
1080: add %fs:MM_OFFSET(%ebp), %edi
1081: rep
1082: movsw
1083: sub %fs:MM_OFFSET(%ebp), %esi
1084:
1085: mov %cs:rowtab(,%ebx,4),%edi
1086: mov $NCOL,%ecx
1087: movb $0x20,%al
1088: cld
1089:
1090: add %fs:MM_OFFSET(%ebp), %edi
1091: rep
1092: stosw
1093: sub %fs:MM_OFFSET(%ebp), %edi
1094:
1095: subb COL,COL
1096: movb ROW,%bl
1097: mov %cs:rowtab(,%ebx,4),%edi
1098: loc43: pop %ecx
1099: pop %esi
1100: pop %ds
1101: call exit
1102: jmp eval
1103:
1104: ////////
1105: /
1106: / mm_hpa - horizontal position absolute
1107: /
1108: / Moves the active position within the active line to the position
1109: / specified by the parameter. A parameter value of zero or one
1110: / moves the active position to the first position of the active line.
1111: /
1112: ////////
1113:
1114: mm_hpa: movb %fs:MM_N1(%ebp),COL
1115: decb COL
1116: jg loc44
1117: subb COL,COL
1118: loc44: cmpb $NCOL,COL
1119: jb loc45
1120: movb $NCOL-1,COL
1121: loc45: jmp repos / reposition cursor
1122:
1123: ////////
1124: /
1125: / mm_hpr - horizontal position relative
1126: /
1127: / Moves the active position forward the number of positions specified
1128: / by the parameter. A parameter value of zero or one indicates a
1129: / single-position move.
1130: /
1131: ////////
1132:
1133: mm_hpr: movb %fs:MM_N1(%ebp),%al
1134: orb %al,%al
1135: jne loc46
1136: incb %al
1137: loc46: addb %al,COL
1138: cmpb $NCOL,COL
1139: jb loc47
1140: movb $NCOL-1,COL
1141: loc47: jmp repos / reposition cursor
1142:
1143: ////////
1144: /
1145: / mm_hvp - horizontal and vertical position
1146: /
1147: / Moves the active position to the position specified by two parameters.
1148: / The first parameter specifies the vertical position (MM_ROW(%ebp)).
1149: / The second parameter specifies the horizontal position (MM_COL(%ebp)).
1150: / A parameter value of zero or one moves the active position to the
1151: / first line or column in the display.
1152: /
1153: ////////
1154:
1155: mm_hvp: movb %fs:MM_N1(%ebp),ROW
1156: decb ROW
1157: jg loc48
1158: subb ROW,ROW
1159: loc48: cmpb %fs:MM_LROW(%ebp),ROW
1160: jna loc49
1161: movb %fs:MM_LROW(%ebp),ROW
1162: loc49: movb %fs:MM_N2(%ebp),COL
1163: decb COL
1164: jg loc50
1165: subb COL,COL
1166: loc50: cmpb $NCOL,COL
1167: jb loc51
1168: movb $NCOL-1,COL
1169: loc51: jmp repos / reposition cursor
1170:
1171: ////////
1172: /
1173: / mm_ind - index
1174: /
1175: / Causes the active position to move downward one line without changing
1176: / the horizontal position. Scrolling occurs if below scrolling region.
1177: /
1178: ////////
1179:
1180: mm_ind: incb ROW
1181: cmpb %fs:MM_EROW(%ebp),ROW
1182: jg loc52
1183: jmp repos
1184: loc52: movb %fs:MM_EROW(%ebp),ROW
1185: jmp scrollup
1186:
1187: ////////
1188: /
1189: / mm_new - save cursor position
1190: /
1191: ////////
1192:
1193: mm_new: movb COL,%fs:MM_SCOL(%ebp)
1194: movb ROW,%fs:MM_SROW(%ebp)
1195: jmp eval
1196:
1197: ////////
1198: /
1199: / mm_old - restore old cursor position
1200: /
1201: ////////
1202:
1203: mm_old: movb %fs:MM_SCOL(%ebp),COL
1204: movb %fs:MM_SROW(%ebp),ROW
1205: jmp repos
1206:
1207: ////////
1208: /
1209: / mm_ri - reverse index
1210: /
1211: / Moves the active position to the same horizontal position on the
1212: / preceding line. Scrolling occurs if above scrolling region.
1213: /
1214: ////////
1215:
1216: mm_ri: decb ROW
1217: cmpb %fs:MM_BROW(%ebp),ROW
1218: jge loc53
1219: movb %fs:MM_BROW(%ebp),ROW
1220: jmp scrolldown
1221: loc53: jmp repos
1222:
1223: ////////
1224: /
1225: / mm_scr - select cursor rendition
1226: /
1227: / Invokes the cursor rendition specified by the parameter.
1228: /
1229: / Recognized renditions are: 0 - cursor visible
1230: / 1 - cursor invisible
1231: ////////
1232:
1233: mm_scr: decb %fs:MM_N1(%ebp)
1234: je loc54
1235: jg loc55
1236: movl $0,%fs:MM_INVIS(%ebp)
1237: jmp eval
1238:
1239: loc54: movl $-1,%fs:MM_INVIS(%ebp)
1240: loc55: jmp eval
1241:
1242: ////////
1243: /
1244: / mm_sgr - select graphic rendition
1245: /
1246: / Invokes the graphic rendition specified by the parameter.
1247: / All following characters in the data stream are rendered
1248: / according to the parameters until the next occurrence of
1249: / SGR in the data stream.
1250: /
1251: / Recognized renditions are: 1 - high intensity
1252: / 4 - underline
1253: / 5 - slow blink
1254: / 7 - reverse video
1255: / 8 - concealed on
1256: / 30-37 - foreground color
1257: / 40-47 - background color
1258: / 50-57 - border color
1259: /
1260: ////////
1261:
1262: mm_sgr: movb %fs:MM_N1(%ebp),%al
1263:
1264: cmpb $0,%al / reset all = 0
1265: jne loc56
1266: movb $0x07,ATTR
1267: loc57: jmp eval
1268:
1269: loc56: cmpb $1,%al / bold = 1
1270: jne loc58
1271: orb $INTENSE,ATTR
1272: jmp loc57
1273:
1274: loc58: cmpb $4,%al / underline = 4
1275: jne loc59
1276: cmp $0x03D4,%fs:MM_PORT(%ebp) / color card?
1277: je loc57 / yes, ignore underline
1278: andb $0x88,ATTR
1279: orb $0x01,ATTR
1280: jmp loc57
1281:
1282: loc59: cmpb $5,%al / blinking = 5
1283: jne loc60
1284: orb $BLINK,ATTR
1285: jmp loc57
1286:
1287: loc60: cmpb $7,%al / reverse video = 7
1288: jne loc61
1289: movb $0x70,%al
1290: cmp $0x3D4,%fs:MM_PORT(%ebp) / color card?
1291: jne loc62
1292: movb ATTR,%al / yes, exchange foreground/background
1293: andb $0x77,%al
1294: rolb $1,%al
1295: rolb $1,%al
1296: rolb $1,%al
1297: rolb $1,%al
1298: loc62: andb $0x88,ATTR
1299: orb %al,ATTR
1300: jmp loc57
1301:
1302: loc61: cmpb $8,%al / concealed on = 8
1303: jne loc63
1304: cmp $0x3D4,%fs:MM_PORT(%ebp) / color card?
1305: jne loc64
1306:
1307: andb $0x70,ATTR / Yes, Set foreground color
1308: movb ATTR,%al / to background color.
1309: rorb $1,%al
1310: rorb $1,%al
1311: rorb $1,%al
1312: rorb $1,%al
1313: orb %al,ATTR
1314: jmp loc57
1315:
1316: loc64: andb $0x80,ATTR / No, set attributes to non-display.
1317: jmp loc57 / retain blink attribute.
1318:
1319: loc63: cmp $0x03D4,%fs:MM_PORT(%ebp) / color card?
1320: jne loc57 / no, ignore remaining options
1321: loc65: subb $30,%al / foreground color
1322: jl loc66
1323: cmpb $7,%al
1324: jg loc67
1325: movb %al,%bl
1326: andb $0xf8,ATTR
1327: orb %cs:fcolor(%ebx),ATTR
1328: jmp loc66
1329: loc67: subb $10,%al
1330: jl loc66
1331: cmpb $7,%al
1332: jg loc68
1333: movb %al,%bl
1334: andb $0x8f,ATTR
1335: orb %cs:bcolor(%ebx),ATTR
1336: jmp loc66
1337: loc68: subb $10,%al
1338: jl loc66
1339: cmpb $7,%al
1340: jg loc69
1341: movb %al,%bl
1342: movb %cs:fcolor(%ebx),%al
1343: push %edx
1344: mov %fs:MM_PORT(%ebp),%edx
1345: add $5,%edx
1346: outb (%dx)
1347: pop %edx
1348: / jmp loc66
1349: loc69:
1350: loc66: jmp eval
1351:
1352: ////////
1353: /
1354: / mm_ssr - set scrolling region
1355: /
1356: ////////
1357:
1358: mm_ssr: movb %fs:MM_N1(%ebp),%al
1359: decb %al
1360: jge loc70
1361: subb %al,%al
1362: loc70: cmpb %fs:MM_LROW(%ebp),%al
1363: ja loc71
1364: movb %fs:MM_N2(%ebp),%bl
1365: decb %bl
1366: jge loc72
1367: subb %bl,%bl
1368: loc72: cmpb %fs:MM_LROW(%ebp),%bl
1369: ja loc71
1370: cmpb %bl,%al
1371: ja loc71
1372: movb %al,%fs:MM_BROW(%ebp)
1373: movb %bl,%fs:MM_EROW(%ebp)
1374: movb %al,ROW
1375: subb COL,COL
1376: loc71: jmp repos
1377:
1378: ////////
1379: /
1380: / mm_vpa - vertical position absolute
1381: /
1382: / Moves the active position to the line specified by the parameter
1383: / without changing the horizontal position.
1384: / A parameter value of 0 or 1 moves the active position vertically
1385: / to the first line.
1386: /
1387: ////////
1388:
1389: mm_vpa: movb %fs:MM_N1(%ebp),ROW
1390: decb ROW
1391: jg loc73
1392: subb ROW,ROW
1393: loc73: cmpb %fs:MM_LROW(%ebp),ROW
1394: jna loc74
1395: movb %fs:MM_LROW(%ebp),ROW
1396: loc74: jmp repos / reposition cursor
1397:
1398: ////////
1399: /
1400: / mm_vpr - vertical position relative
1401: /
1402: / Moves the active position downward the number of lines specified
1403: / by the parameter without changing the horizontal position.
1404: / A parameter value of zero or one moves the active position
1405: / one line downward.
1406: /
1407: ////////
1408:
1409: mm_vpr: movb %fs:MM_N1(%ebp),%al
1410: orb %al,%al
1411: jne loc75
1412: incb %al
1413: loc75: addb %al,ROW
1414: cmpb %fs:MM_LROW(%ebp),ROW
1415: jb loc76
1416: movb %fs:MM_LROW(%ebp),ROW
1417: loc76: jmp repos / reposition cursor
1418:
1419: ////////
1420: /
1421: / asctab - table of functions indexed by ascii characters
1422: /
1423: ////////
1424:
1425: .align 4
1426: asctab: .long eval, eval, eval, eval /* NUL SOH STX ETX */
1427: .long eval, eval, eval, mmbell /* EOT ENQ ACK BEL */
1428: .long mm_cub, mm_cht, mm_cnl, mm_ind /* BS HT LF VT */
1429: .long eval, mm_cr, eval, eval /* FF CR SO SI */
1430: .long eval, eval, eval, eval /* DLE DC1 DC2 DC3 */
1431: .long eval, eval, eval, eval /* DC4 NAK SYN ETB */
1432: .long eval, eval, eval, mm_esc /* CAN EM SUB ESC */
1433: .long eval, eval, eval, eval /* FS GS RS US */
1434: .long mmputc, mmputc, mmputc, mmputc /* ! " # \040 - \043 */
1435: .long mmputc, mmputc, mmputc, mmputc /* $ % & ' \044 - \047 */
1436: .long mmputc, mmputc, mmputc, mmputc /* ( ) * + \050 - \053 */
1437: .long mmputc, mmputc, mmputc, mmputc /* , - . / \054 - \057 */
1438: .long mmputc, mmputc, mmputc, mmputc /* 0 1 2 3 \060 - \063 */
1439: .long mmputc, mmputc, mmputc, mmputc /* 4 5 6 7 \064 - \067 */
1440: .long mmputc, mmputc, mmputc, mmputc /* 8 9 : ; \070 - \073 */
1441: .long mmputc, mmputc, mmputc, mmputc /* < = > ? \074 - \077 */
1442: .long mmputc, mmputc, mmputc, mmputc /* @ A B C \100 - \103 */
1443: .long mmputc, mmputc, mmputc, mmputc /* D E F G \104 - \107 */
1444: .long mmputc, mmputc, mmputc, mmputc /* H I J K \110 - \113 */
1445: .long mmputc, mmputc, mmputc, mmputc /* L M N O \114 - \117 */
1446: .long mmputc, mmputc, mmputc, mmputc /* P Q R S \120 - \123 */
1447: .long mmputc, mmputc, mmputc, mmputc /* T U V W \124 - \127 */
1448: .long mmputc, mmputc, mmputc, mmputc /* X Y Z [ \130 - \133 */
1449: .long mmputc, mmputc, mmputc, mmputc /* \ ] ^ _ \134 - \137 */
1450: .long mmputc, mmputc, mmputc, mmputc /* ` a b c \140 - \143 */
1451: .long mmputc, mmputc, mmputc, mmputc /* d e f g \144 - \147 */
1452: .long mmputc, mmputc, mmputc, mmputc /* h i j k \150 - \153 */
1453: .long mmputc, mmputc, mmputc, mmputc /* l m n o \154 - \157 */
1454: .long mmputc, mmputc, mmputc, mmputc /* p q r s \160 - \163 */
1455: .long mmputc, mmputc, mmputc, mmputc /* t u v w \164 - \167 */
1456: .long mmputc, mmputc, mmputc, mmputc /* x y z { \170 - \173 */
1457: .long mmputc, mmputc, mmputc, mmputc /* | } ~ ? \174 - \177 */
1458:
1459: ////////
1460: /
1461: / esctab - table of functions indexed by ESC characters.
1462: /
1463: ////////
1464:
1465: esctab: .long mmputc, mmputc, mmputc, mmputc /* NUL SOH STX ETX */
1466: .long mmputc, mmputc, mmputc, mmputc /* EOT ENQ ACK BEL */
1467: .long mmputc, mmputc, mmputc, mmputc /* BS HT LF VT */
1468: .long mmputc, mmputc, mmputc, mmputc /* FF CR SO SI */
1469: .long mmputc, mmputc, mmputc, mmputc /* DLE DC1 DC2 DC3 */
1470: .long mmputc, mmputc, mmputc, mmputc /* DC4 NAK SYN ETB */
1471: .long mmputc, mmputc, mmputc, mmputc /* CAN EM SUB ESC */
1472: .long mmputc, mmputc, mmputc, mmputc /* FS GS RS US */
1473: .long eval, eval, eval, eval /* ! " # \040 - \043 */
1474: .long eval, eval, eval, eval /* $ % & ' \044 - \047 */
1475: .long eval, eval, eval, eval /* ( ) * + \050 - \053 */
1476: .long eval, eval, eval, eval /* , - . / \054 - \057 */
1477: .long eval, eval, eval, eval /* 0 1 2 3 \060 - \063 */
1478: .long eval, eval, eval, mm_new /* 4 5 6 7 \064 - \067 */
1479: .long mm_old, eval, eval, eval /* 8 9 : ; \070 - \073 */
1480: .long eval, mmspec, mmspec, eval /* < = > ? \074 - \077 */
1481: .long eval, eval, eval, eval /* @ A B C \100 - \103 */
1482: .long mm_ind, mm_cnl, eval, eval /* D E F G \104 - \107 */
1483: .long eval, eval, eval, eval /* H I J K \110 - \113 */
1484: .long eval, mm_ri, eval, eval /* L M N O \114 - \117 */
1485: .long eval, eval, eval, eval /* P Q R S \120 - \123 */
1486: .long eval, eval, eval, eval /* T U V W \124 - \127 */
1487: .long eval, eval, eval, csi_n1 /* X Y Z [ \130 - \133 */
1488: .long eval, eval, eval, eval /* \ ] ^ _ \134 - \137 */
1489: .long mm_dmi, eval, mm_emi, vtmminit /* ` a b c \140 - \143 */
1490: .long eval, eval, eval, eval /* d e f g \144 - \147 */
1491: .long eval, eval, eval, eval /* h i j k \150 - \153 */
1492: .long eval, eval, eval, eval /* l m n o \154 - \157 */
1493: .long eval, eval, eval, eval /* p q r s \160 - \163 */
1494: .long mmspec, mmspec, eval, eval /* t u v w \164 - \167 */
1495: .long eval, eval, eval, eval /* x y z { \170 - \173 */
1496: .long eval, eval, eval, eval /* | } ~ ? \174 - \177 */
1497:
1498:
1499: ////////
1500: /
1501: / csitab - table of functions indexed by ESC [ characters.
1502: /
1503: ////////
1504:
1505: csitab: .long eval, eval, eval, eval /* NUL SOH STX ETX */
1506: .long eval, eval, eval, eval /* EOT ENQ ACK BEL */
1507: .long eval, eval, eval, eval /* BS HT LF VT */
1508: .long eval, eval, eval, eval /* FF CR SO SI */
1509: .long eval, eval, eval, eval /* DLE DC1 DC2 DC3 */
1510: .long eval, eval, eval, eval /* DC4 NAK SYN ETB */
1511: .long eval, eval, eval, eval /* CAN EM SUB ESC */
1512: .long eval, eval, eval, eval /* FS GS RS US */
1513: .long eval, eval, eval, eval /* ! " # \040 - \043 */
1514: .long eval, eval, eval, eval /* $ % & ' \044 - \047 */
1515: .long eval, eval, eval, eval /* ( ) * + \050 - \053 */
1516: .long eval, eval, eval, eval /* , - . / \054 - \057 */
1517: .long eval, eval, eval, eval /* 0 1 2 3 \060 - \063 */
1518: .long eval, eval, eval, eval /* 4 5 6 7 \064 - \067 */
1519: .long eval, eval, eval, eval /* 8 9 : ; \070 - \073 */
1520: .long eval, eval, csi_gt, csi_q /* < = > ? \074 - \077 */
1521: .long eval, mm_cuu, mm_cud, mm_cuf /* @ A B C \100 - \103 */
1522: .long mm_cub, mm_cnl, mm_cpl, mm_cha /* D E F G \104 - \107 */
1523: .long mm_cup, mm_cht, mm_ed, mm_el /* H I J K \110 - \113 */
1524: .long mm_il, mm_dl, eval, mm_ea /* L M N O \114 - \117 */
1525: .long eval, eval, eval, mm_ind /* P Q R S \120 - \123 */
1526: .long mm_ri, eval, eval, eval /* T U V W \124 - \127 */
1527: .long eval, eval, mm_cbt, eval /* X Y Z [ \130 - \133 */
1528: .long eval, eval, eval, eval /* \ ] ^ _ \134 - \137 */
1529: .long mm_hpa, mm_hpr, eval, eval /* ` a b c \140 - \143 */
1530: .long mm_vpa, mm_vpr, mm_hvp, mm_cup /* d e f g \144 - \147 */
1531: .long eval, eval, eval, eval /* h i j k \150 - \153 */
1532: .long eval, mm_sgr, eval, eval /* l m n o \154 - \157 */
1533: .long eval, eval, mm_ssr, eval /* p q r s \160 - \163 */
1534: .long eval, eval, mm_scr, eval /* t u v w \164 - \167 */
1535: .long eval, eval, eval, eval /* x y z { \170 - \173 */
1536: .long eval, eval, eval, eval /* | } ~ ? \174 - \177 */
1537:
1538: ////////
1539: /
1540: / coltab - integer array of offsets to each column
1541: /
1542: ////////
1543:
1544: coltab: .long 0<<SCB, 1<<SCB, 2<<SCB, 3<<SCB
1545: .long 4<<SCB, 5<<SCB, 6<<SCB, 7<<SCB
1546: .long 8<<SCB, 9<<SCB, 10<<SCB, 11<<SCB
1547: .long 12<<SCB, 13<<SCB, 14<<SCB, 15<<SCB
1548: .long 16<<SCB, 17<<SCB, 18<<SCB, 19<<SCB
1549: .long 20<<SCB, 21<<SCB, 22<<SCB, 23<<SCB
1550: .long 24<<SCB, 25<<SCB, 26<<SCB, 27<<SCB
1551: .long 28<<SCB, 29<<SCB, 30<<SCB, 31<<SCB
1552: .long 32<<SCB, 33<<SCB, 34<<SCB, 35<<SCB
1553: .long 36<<SCB, 37<<SCB, 38<<SCB, 39<<SCB
1554: .long 40<<SCB, 41<<SCB, 42<<SCB, 43<<SCB
1555: .long 44<<SCB, 45<<SCB, 46<<SCB, 47<<SCB
1556: .long 48<<SCB, 49<<SCB, 50<<SCB, 51<<SCB
1557: .long 52<<SCB, 53<<SCB, 54<<SCB, 55<<SCB
1558: .long 56<<SCB, 57<<SCB, 58<<SCB, 59<<SCB
1559: .long 60<<SCB, 61<<SCB, 62<<SCB, 63<<SCB
1560: .long 64<<SCB, 65<<SCB, 66<<SCB, 67<<SCB
1561: .long 68<<SCB, 69<<SCB, 70<<SCB, 71<<SCB
1562: .long 72<<SCB, 73<<SCB, 74<<SCB, 75<<SCB
1563: .long 76<<SCB, 77<<SCB, 78<<SCB, 79<<SCB
1564:
1565: ////////
1566: /
1567: / rowtab - array of offsets to each row
1568: /
1569: ////////
1570:
1571: rowtab: .long 0, 160, 320, 480
1572: .long 640, 800, 960, 1120
1573: .long 1280, 1440, 1600, 1760
1574: .long 1920, 2080, 2240, 2400
1575: .long 2560, 2720, 2880, 3040
1576: .long 3200, 3360, 3520, 3680
1577: .long 3840, 4000, 4160, 4320
1578: .long 4480, 4640, 4800, 4960
1579:
1580:
1581: ////////
1582: /
1583: / fcolor - foreground color
1584: / bcolor - background color
1585: /
1586: / indexed by ansi color (black,red,green,brown,blue,magenta,cyan,white)
1587: / yields graphics color (black,blue,green,cyan,red,magenta,brown,white)
1588: / which is properly shifted for installation in attribute byte.
1589: /
1590: ////////
1591:
1592: fcolor: .byte 0x00, 0x04, 0x02, 0x06, 0x01, 0x05, 0x03, 0x07
1593: bcolor: .byte 0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70
1594:
1595: ////////
1596: /
1597: / mm_voff() -- turn video display off
1598: /
1599: ////////
1600: .globl vtmm_voff
1601: vtmm_voff:
1602: push %ebp
1603: mov %esp, %ebp
1604: mov 8(%ebp), %ebp / VTERM *
1605: mov %ds:MM_PORT(%ebp), %edx
1606:
1607: add $4,%edx
1608: movb $0x21,%al
1609: outb (%dx)
1610: pop %ebp
1611: ret
1612:
1613: ////////
1614: /
1615: / mm_von( vp ) -- turn video display on
1616: / VTDATA *vp;
1617: ////////
1618: .globl vtmm_von
1619: vtmm_von:
1620: push %ebp
1621: mov %esp, %ebp
1622: mov 8(%ebp), %ebp / VTERM *
1623: mov %ds:MM_PORT(%ebp), %edx
1624:
1625: add $4,%edx
1626: movb $0x29,%al
1627: outb (%dx)
1628: mov $900,vtmmvcnt / 900 seconds before video disabled
1629: pop %ebp
1630: ret
1631:
1632: .globl vtds_sel
1633: vtds_sel:
1634: mov $0, %eax
1635: mov %ds, %ax
1636: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.