Annotation of coherent/b/etc/Build_401/dpb.s, revision 1.1

1.1     ! root        1: ////////
        !             2: /
        !             3: / Display XT/AT Disk Parameter Bootblock.
        !             4: / Copy to a boot block on hard disk partition, then reboot to display info.
        !             5: /
        !             6: ////////
        !             7: 
        !             8: NSTK   =       256                     / # of bytes of stack.
        !             9: CR     =       0x0D                    / CR character.
        !            10: LF     =       0x0A                    / LF character.
        !            11: BOOTLC =       0x7C00                  / Boot location (ROM).
        !            12: BOOTS  =       0                       / boot segment (ROM).
        !            13: RBOOTS =       0x2060                  / Relocated boot segment.
        !            14: BSHIFT =       9                       / Shift, bytes to blocks.
        !            15: BUFSIZE =      512                     / Block size.
        !            16: BUFMSK2 =      0x00FF                  / Block [word] mask, for reads.
        !            17: DISK   =       0x13                    / Disk Interrupt
        !            18: KEYBD  =       0x16                    / Keyboard Interrupt
        !            19: READ1  =       0x0201                  / read one sector
        !            20: JMPF   =       0xEA                    / Jump far, direct.
        !            21: FIRST  =       8                       / relative start of partition
        !            22: 
        !            23: ////////
        !            24: /
        !            25: /
        !            26: ////////
        !            27: 
        !            28:        .blkb   0x0100                  / PC-DOS base page.
        !            29: entry:
        !            30:        mov     ax, es
        !            31:        mov     ds, ax
        !            32: 
        !            33: restart:
        !            34:        call    login                   / print signon message
        !            35: ///
        !            36:        xorb    bl, bl                  / zero the drive count
        !            37: 2:
        !            38:        movb    drive, bl
        !            39:        movb    dl, $0x80               / get drive number
        !            40:        addb    dl, bl
        !            41:        movb    ah, $8                  / get drive parameters
        !            42:        push    bx
        !            43:        int     DISK
        !            44: 
        !            45:        push    dx
        !            46:        movb    al, ch                  / fetch cyl(lo)
        !            47:        movb    ah, cl                  / move cyl(hi), sects
        !            48:        rolb    ah, $1                  / shift cylinder high to
        !            49:        rolb    ah, $1                  / the least sig bits
        !            50:        andb    ah, $3                  / mask out cylinder bits
        !            51:        inc     ax
        !            52:        mov     cyls, ax
        !            53:        
        !            54:        movb    al, $0x3F               / sector mask
        !            55:        andb    al,cl                   / mask sector
        !            56:        movb    sects, al
        !            57: 
        !            58:        incb    dh                      / change to # of heads
        !            59:        movb    heads, dh
        !            60: ///
        !            61:        mov     si, $msgdrive
        !            62:        call    print
        !            63:        sub     ax, ax
        !            64:        movb    al, drive
        !            65:        call    putu
        !            66:        mov     si, $msgcyls
        !            67:        call    print
        !            68:        mov     ax, cyls
        !            69:        call    putu
        !            70:        mov     si, $msgheads
        !            71:        call    print
        !            72:        sub     ax, ax
        !            73:        movb    al, heads
        !            74:        call    putu
        !            75:        mov     si, $msgsects
        !            76:        call    print
        !            77:        sub     ax, ax
        !            78:        movb    al, sects
        !            79:        call    putu
        !            80: 
        !            81:        mov     si, $crlf
        !            82:        call    print
        !            83: 
        !            84:        pop     dx              / recall # of drives in dl
        !            85:        pop     bx              / recall # of previous drive in bl
        !            86:        incb    bl
        !            87:        cmpb    bl, dl          / more drives to check?
        !            88:        jb      2b
        !            89: 0:     
        !            90:        movb    al, $'?         / set prompt
        !            91:        call    putc
        !            92: 
        !            93:        movb    ah, $0          / Get ASCII opcode.
        !            94:        int     KEYBD           / Read keyboard ROM call.
        !            95: 
        !            96:        mov     si, $crlf       / Echo LF followed by CR.
        !            97:        call    print
        !            98: 
        !            99:        int     0x19            / reboot, in real mode
        !           100: 
        !           101: ////////
        !           102: /
        !           103: / Print signon message
        !           104: /
        !           105: ////////
        !           106: 
        !           107: login: mov     si, $msg00              / point si to message
        !           108: 
        !           109: print: movb    al, (si)
        !           110:        inc     si
        !           111:        orb     al, al                  /
        !           112:        je      0f
        !           113:        call    putc                    / Type it and
        !           114:        jne     print                   / go back for more.
        !           115: 0:     ret
        !           116: 
        !           117: ////////
        !           118: /
        !           119: / Write the character in "al" out to
        !           120: / the display, using routines in the ROM.
        !           121: / Like most calls to the ROM, this routine spends
        !           122: / most of its time saving and restoring the
        !           123: / registers.
        !           124: /
        !           125: / Note: The ZF in the PSW word must be preserved.
        !           126: /
        !           127: ////////
        !           128: 
        !           129: putc:  push    si              / Save registers.
        !           130:        push    di
        !           131:        push    bp
        !           132:        pushf
        !           133: 
        !           134:        cmpb    lz, $1          / zero suppress?
        !           135:        jne     2f              / skip if not
        !           136:        cmpb    al, $'0
        !           137:        je      3f              / skip if we're suppressing a zero now
        !           138:        movb    lz, $0          / else turn off zero suppression and print char
        !           139: 2:
        !           140:        mov     bx, $0x0007     / Page 0, white on black
        !           141:        movb    ah, $0x0E       / Write TTY.
        !           142:        int     0x10            / Call video I/O in ROM.
        !           143: 3:
        !           144:        popf
        !           145:        pop     bp              / Restore registers.
        !           146:        pop     di
        !           147:        pop     si
        !           148: return: ret                    / Return
        !           149: 
        !           150: ////////
        !           151: /
        !           152: / Output the unsigned integer in AX.
        !           153: /
        !           154: ////////
        !           155: 
        !           156: putu:                          / putu( i )
        !           157:        push    si              / int i;
        !           158:        push    di              /
        !           159:        push    bp              /
        !           160: 
        !           161:        sub     dx, dx          /
        !           162:        movb    lz, $1          / suppress leading zeroes
        !           163:        mov     bx, $10000      /
        !           164:        div     bx              /
        !           165:        push    dx              /
        !           166:        addb    al, $'0         /
        !           167:        call    putc            /
        !           168:        pop     ax              /
        !           169: 
        !           170:        sub     dx, dx          /
        !           171:        mov     bx, $1000       /
        !           172:        div     bx              /
        !           173:        push    dx              /
        !           174:        addb    al, $'0         /
        !           175:        call    putc            /
        !           176:        pop     ax              /
        !           177: 
        !           178:        sub     dx, dx          /
        !           179:        mov     bx, $100        /
        !           180:        div     bx              /
        !           181:        push    dx              /
        !           182:        addb    al, $'0         /
        !           183:        call    putc            /
        !           184:        pop     ax              /
        !           185: 
        !           186:        sub     dx, dx          /
        !           187:        mov     bx, $10         /
        !           188:        div     bx              /
        !           189:        push    dx              /
        !           190:        addb    al, $'0         /
        !           191:        call    putc            /
        !           192:        pop     ax              /
        !           193: 
        !           194:        movb    lz, $0          / don't suppress final leading zero
        !           195:        addb    al, $'0         /
        !           196:        call    putc            /
        !           197: 
        !           198:        pop     bp              /
        !           199:        pop     di
        !           200:        pop     si
        !           201:        ret
        !           202: 
        !           203: ////////
        !           204: /
        !           205: / Data. There is some pure data in
        !           206: / the "prvd" segment. This data is moved to the
        !           207: / new memory when the boot is relocated. All buffers
        !           208: / are in the BSS, and are not actually moved, or even
        !           209: / saved in the boot block.
        !           210: /
        !           211: ////////
        !           212: 
        !           213: NHD = 1
        !           214: NSPT = 9
        !           215: NTRK = 40
        !           216: 
        !           217:        .prvd
        !           218: 
        !           219: cyls:  .word   0
        !           220: sects: .byte   0
        !           221: heads: .byte   0
        !           222: 
        !           223: drive: .byte   0
        !           224: first: .word   0
        !           225:        .word   0
        !           226: 
        !           227: lz:    .byte   0       / nonzero if we are doing zero suppression
        !           228: 
        !           229: msgdrive:.ascii        "Drive "
        !           230:        .byte   0
        !           231: msgheads:.ascii "  Heads="
        !           232:        .byte   0
        !           233: msgcyls:.ascii ":  Cylinders="
        !           234:        .byte   0
        !           235: msgsects:.ascii        "  Sectors per track="
        !           236:        .byte   0
        !           237: msg00:
        !           238:        .byte   CR, LF
        !           239:        .ascii  "Here are the BIOS parameters for your hard drive(s)."
        !           240:        .byte   CR, LF
        !           241:        .ascii  "Write them down for use during installation."
        !           242:        .byte   CR, LF
        !           243:        .ascii  "Then press <Enter> to reboot."
        !           244:        .byte   CR, LF
        !           245: crlf:  .byte   CR, LF
        !           246:        .byte   0

unix.superglobalmegacorp.com

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