Annotation of coherent/d/PS2_KERNEL/io.386/mmas.s, revision 1.1

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

unix.superglobalmegacorp.com

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