Annotation of coherent/b/kernel/io.386/mmas.s, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.