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