home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / batch / library / batutl2 / banner1.asm < prev    next >
Assembly Source File  |  1988-04-20  |  7KB  |  402 lines

  1. TITLE    BANNER1    1-29-83    [4-15-88]
  2. ;Toad Hall Disassembly, tweak
  3.  
  4. LF    EQU    0AH
  5. CR    EQU    0DH
  6. ;
  7. ;INITIAL VALUES :    CS:IP    0000:0100
  8. ;            SS:SP    0000:FFFF
  9. CodeSeg    SEGMENT
  10.     ASSUME DS:CodeSeg, SS:CodeSeg ,CS:CodeSeg ,ES:CodeSeg
  11.  
  12.     ORG    100H
  13.  
  14. Banner1    proc    far
  15.     JMP    Start_22C
  16.  
  17. bconstBuff_103    DB    1CH,1BH,38H,5 DUP(0)
  18. bconstBuff_10B    DB    1EH,1BH,36H,5 DUP(0)
  19. buff_113    DB    100H DUP(0)
  20.  
  21. L0213        dw    0FA6EH,0F000H    ;DB 6EH,0FAH,0,0F0H
  22. byte_217    DB    0
  23. byte_218    DB    0
  24. bconst_219    DB    2AH
  25. bconst_21A    DB    7CH
  26. byte_21B    DB    0
  27. wptr_21C    dw    0
  28. word_21E    dw    0
  29. byte_220    DB    0
  30. byte_221    DB    0
  31. bcntr_222    DB    0
  32. word_223    dw    0
  33. byte_225    DB    0
  34. bprflag_226    DB    0
  35. bflagF_227    DB    0
  36. bflagI_228    DB    0
  37. bflagH_229    DB    0
  38. bflagW_22A    DB    0
  39.         db    0
  40.  
  41. ;L022C      Banner1 CJ  L03A8 DI
  42. Start_22C:
  43. ;    PUSH    DS
  44. ;    XOR    AX,AX
  45. ;    PUSH    AX
  46.     MOV    SI,81H
  47.     MOV    word_21E,SI
  48.     CALL    ZeroVars_3A5        ;zero some variables
  49.  
  50. Lup23A:    MOV    SI,word_21E        ;buffer pointer
  51.     LODSB                ;snarf first char
  52.     CMP    AL,CR            ;CR?
  53.     JNZ    L0246            ; nope
  54.      JMP    Terminate_3A4        ; yep, exit
  55.  
  56. L0246:    XOR    CX,CX
  57.     CMP    AL,20H            ;space?
  58.     JNZ    L024D            ; nope
  59.      LODSB                ;gobble the space, next char
  60. L024D:    MOV    wptr_21C,SI        ;save pointer
  61.     DEC    wptr_21C        ; decrement it
  62. Lup255:    CMP    AL,CR            ;CR?
  63.     JZ    L025F            ; yep
  64.      CMP    AL,bconst_21A        ;7CH?
  65.      JNZ    L0262            ; nope
  66. L025F:    JMP    SHORT    KeyCr_2E0
  67.  
  68. ;    NOP
  69. L0262:    INC    CX            ;incr counter
  70.     CMP    AL,2FH    ;'/'        ;slash?
  71.     JZ    L026A            ; yep
  72.      LODSB                ; nope, next char
  73.      JMP    SHORT    Lup255        ; and loop
  74. ;char was "/"
  75. L026A:    DEC    CX            ;adjust counter
  76. Lup26B:    LODSB                ;snarf next char
  77.     CMP    AL,CR            ; CR?
  78.     JZ    KeyCr_2E0        ; yep
  79.     CMP    AL,bconst_21A        ;7CH?
  80.     JZ    KeyCr_2E0        ; yep
  81.     CMP    AL,60H            ;weird back apostrophe '`'
  82.     JB    L027C
  83.      AND    AL,0DFH            ;mask
  84. L027C:    CMP    AL,'D'
  85.     JZ    KeyD_2A2
  86.     CMP    AL,'F'
  87.     JZ    KeyF_2A9
  88.     CMP    AL,'H'
  89.     JZ    KeyH_2B0
  90.     CMP    AL,'I'
  91.     JZ    KeyI_2B7
  92.     CMP    AL,'L'
  93.     JZ    KeyL_2BE
  94.     CMP    AL,'S'
  95.     JZ    KeyS_2C3
  96.     CMP    AL,'U'
  97.     JZ    KeyU_2CA
  98.     CMP    AL,'W'
  99.     JZ    KeyW_2D4
  100.     CMP    AL,'X'
  101.     JZ    KeyX_2DB
  102.     JMP    SHORT    Lup26B
  103.  
  104. KeyD_2A2:
  105.     MOV    bprflag_226,1
  106.     JMP    SHORT    Lup26B
  107.  
  108. KeyF_2A9:
  109.     MOV    bflagF_227,1
  110.     JMP    SHORT    Lup26B
  111.  
  112. KeyH_2B0:
  113.     MOV    bflagH_229,1
  114.     JMP    SHORT    Lup26B
  115.  
  116. KeyI_2B7:
  117.     MOV    bflagI_228,1
  118.     JMP    SHORT    Lup26B
  119.  
  120. KeyL_2BE:
  121.     CALL    NewLine_435
  122.     JMP    SHORT    Lup26B
  123.  
  124. KeyS_2C3:
  125.     MOV    byte_225,0FFH
  126.     JMP    SHORT    Lup26B
  127.  
  128. KeyU_2CA:
  129.     LODSB                ;snarf next char
  130.     CMP    AL,CR            ;CR?
  131.     JZ    KeyCr_2E0        ; yep
  132.     MOV    byte_225,AL        ; nope, save
  133.     JMP    SHORT    Lup26B
  134.  
  135. KeyW_2D4:
  136.     MOV    bflagW_22A,1
  137.     JMP    SHORT    Lup26B
  138.  
  139. KeyX_2DB:
  140.     CALL    ZeroVars_3A5        ;clear the variables
  141.     JMP    SHORT    Lup26B
  142.  
  143. KeyCr_2E0:
  144.     MOV    word_21E,SI
  145.     MOV    byte_21B,AL        ;save the char
  146.     MOV    byte_220,CL        ;save counter
  147.     CALL    L0444
  148.     CMP    bflagF_227,1        ;flag set?
  149.     JNZ    L02F8            ; nope
  150.      CALL    ClrScr_45F        ;clear screen/FormFeed
  151. L02F8:    CALL    NewLine_435
  152.     MOV    bcntr_222,0        ;init counter
  153.     or    cx,cx            ;done?
  154.     JNZ    Lup308            ; not yet
  155.      JMP    Terminate_3A4        ; yep, terminate
  156.  
  157. Lup308:    MOV    SI,wptr_21C        ;buffer ptr
  158.     CALL    PurgeBuff_420        ;clear our buffer
  159.     XOR    DX,DX
  160.     XOR    DI,DI
  161.     MOV    byte_221,0
  162. ;L0318      L0379 CJ
  163. L0318:    LODSB                ;snarf buffer byte
  164.     MOV    byte_218,AL        ;save here
  165.     MOV    BL,8
  166.     MUL    BL            ;*8
  167.     ADD    AL,bcntr_222
  168.     ADC    AH,0            ;add carry to msb
  169.     MOV    BX,AX
  170.     PUSH    ES            ;save regs
  171.     PUSH    DI
  172. ;    LES    BH,DWORD PTR L0213    MASM 5.0 chokes on this
  173.     mov    es,L0213+2        ;segment word
  174.     mov    bh,byte ptr L0213+1    ;msb of offset word
  175.     MOV    AL,ES:[BX+DI]        ;snarf char
  176.     MOV    CX,8            ;reinit cntr
  177.     POP    DI            ;restore regs
  178.     POP    ES
  179.  
  180. Lup337:    MOV    BL,20H    ;' '
  181.     SHL    AL,1            ;*2
  182.     JNB    L0355            ;no carry
  183.     MOV    BL,byte_225
  184.     CMP    BL,0FFH
  185.     JNZ    L034C
  186.      MOV    BL,byte_218
  187.      JMP    SHORT    L0355
  188.  
  189. L034C:    or    bl,bl            ;0?
  190.     JNZ    L0355
  191.     MOV    BL,bconst_219        ;constant 2AH
  192.  
  193. L0355:    CMP    DI,OFFSET Banner1    ;buffer end?
  194.     JZ    L036E            ; yep
  195.      MOV    [DI+buff_113],BL    ;stuff char in buffer
  196.      INC    DI            ;bump ptr
  197.      CMP    bflagW_22A,1
  198.      JNZ    L036C            ;only do it once
  199.       MOV    [DI+buff_113],BL    ;stuff char again
  200.       INC    DI            ;bump ptr again
  201. L036C:     LOOP    Lup337            ; and loop
  202.  
  203. L036E:    INC    byte_221
  204.     MOV    AL,byte_221
  205.     CMP    AL,byte_220
  206.     JNZ    L0318
  207.     MOV    word_223,DI
  208.     CALL    Output_3B8
  209.     CMP    bflagH_229,1
  210.     JNZ    L038C
  211.      CALL    Output_3B8
  212. L038C:    INC    bcntr_222
  213.     CMP    bcntr_222,8
  214.     JZ    L039A
  215.      JMP    Lup308
  216.  
  217. L039A:    CMP    byte_21B,CR    ;0DH
  218.     JZ    Terminate_3A4
  219.      JMP    Lup23A
  220.  
  221. ;L03A4      L0243 CJ  L0305 CJ  L039F CJ
  222. Terminate_3A4:
  223. ;    RET_FAR            ;to DOS
  224.     mov    ax,4C00H    ;terminate, Errorlevel 0
  225.     int    21H
  226. Banner1    endp
  227.  
  228.  
  229. ZeroVars_3A5    proc    near
  230.     PUSH    AX            ;save regs
  231.     PUSH    CX
  232.     PUSH    DI
  233.     MOV    CX,OFFSET Start_22C    ;code start
  234.     MOV    DI,OFFSET byte_220    ;start of some var space
  235.     SUB    CX,DI            ;get the difference
  236.     XOR    AL,AL            ;fill with zeros
  237.     REPZ    STOSB
  238.     POP    DI            ;restore regs
  239.     POP    CX
  240.     POP    AX
  241.     RET
  242. ZeroVars_3A5    endp
  243.  
  244.  
  245. ;maybe a tab function
  246. Output_3B8    proc    near
  247.     PUSH    AX
  248.     PUSH    CX
  249.     PUSH    DX
  250.     PUSH    SI
  251.     CMP    bflagI_228,1
  252.     JNZ    L03D4
  253.      MOV    CL,7
  254.      SUB    CL,bcntr_222
  255.      XOR    CH,CH            ;clear msb
  256.       JCXZ    L03D4            ;zero, exit loop
  257.       MOV    DL,20H            ;output a space
  258. ;L03CF      L03D2 CJ
  259. Lup3CF:    CALL    CharOut_492        ;output char
  260.     LOOP    Lup3CF
  261.  
  262. L03D4:    MOV    AL,byte_220
  263.     CMP    AL,byte_217
  264.     JBE    L03EA
  265.      CMP    bprflag_226,0        ;printer output? (0)
  266.      JNZ    L03EA                ; nope
  267.       MOV    SI,OFFSET bconstBuff_103    ;ctrl string
  268.       CALL    StrOut_47B            ;output it
  269. L03EA:    MOV    SI,OFFSET buff_113
  270.     MOV    CX,word_223            ;loop counter
  271. Lup3F1:    LODSB                    ;snarf buff char
  272.     MOV    DL,AL                ;need it in DL
  273.     CALL    CharOut_492            ;display/print it
  274.     LOOP    Lup3F1
  275.     CMP    bprflag_226,0            ;printer output? (0)
  276.     JZ    L0409                ; yep
  277.      CMP    word_223,50H    ;'P'
  278.      JB    L0418
  279.       JMP    SHORT    PopRet_41B
  280.  
  281. L0409:    MOV    AL,byte_220
  282.     CMP    AL,byte_217
  283.     JBE    L0418
  284.      MOV    SI,OFFSET bconstBuff_10B    ;ctrl string
  285.      CALL    StrOut_47B            ;output it
  286. L0418:    CALL    NewLine_435            ;CR/LF
  287. PopRet_41B:
  288.     POP    SI
  289.     POP    DX
  290.     POP    CX
  291.     POP    AX
  292.     RET
  293. Output_3B8    endp
  294.  
  295.  
  296. PurgeBuff_420    proc    near
  297.     PUSH    ES
  298.     PUSH    AX
  299.     PUSH    CX
  300.     PUSH    DI
  301.     PUSH    DS
  302.     POP    ES
  303.     MOV    DI,OFFSET buff_113
  304.     MOV    CX,OFFSET Banner1
  305.     MOV    AL,20H    ;' '
  306.     REPZ    STOSB            ;fill buff with spaces
  307.     POP    DI
  308.     POP    CX
  309.     POP    AX
  310.     POP    ES
  311.     RET
  312. PurgeBuff_420    endp
  313.  
  314.  
  315. NewLine_435    proc    near
  316.     PUSH    AX
  317.     PUSH    DX
  318.     MOV    DL,CR
  319.     CALL    CharOut_492
  320.     MOV    DL,LF
  321.     CALL    CharOut_492
  322.     POP    DX
  323.     POP    AX
  324.     RET
  325. NewLine_435    endp
  326.  
  327.  
  328. L0444    proc    near
  329.     PUSH    AX            ;save AX a sec
  330.     MOV    AL,0AH
  331.     CMP    bflagI_228,1
  332.     JNZ    L0450
  333.      DEC    AL
  334. L0450:    CMP    bflagW_22A,1
  335.     JNZ    L0459
  336.     SHR    AL,1            ;/2
  337. L0459:    NOP
  338.     MOV    byte_217,AL
  339.     POP    AX            ;restore AX
  340.     RET
  341. L0444    endp
  342.  
  343.  
  344. ClrScr_45F    proc    near
  345.     PUSH    AX            ;save regs
  346.     PUSH    DX
  347.     CMP    bprflag_226,0        ;printer flag set (0)
  348.     JZ    L0472            ; yep, output Formfeed
  349.      MOV    AH,0FH            ;get current video mode
  350.      INT    10H
  351.      xor    ah,ah            ;set video mode
  352.      INT    10H
  353.      JMP    SHORT    PopRet_478
  354.  
  355. L0472:    MOV    DL,0CH            ;form feed
  356.     MOV    AH,5            ;printer output
  357.     INT    21H
  358. PopRet_478:
  359.     POP    DX            ;restore regs
  360.     POP    AX
  361.     RET
  362. ClrScr_45F    endp
  363.  
  364.  
  365. StrOut_47B    proc    near
  366.     PUSH    AX
  367.     PUSH    DX
  368.     PUSH    SI
  369. Lup47E:    LODSB            ;snarf constant
  370.     CMP    AL,'$'        ;string end?
  371.     JZ    PopRet_48E    ;yep, done
  372.     or    al,al        ;zero?
  373.     JZ    PopRet_48E    ;yep, done
  374.      MOV    DL,AL        ;need char in DL
  375.      CALL    CharOut_492    ;display or print it
  376.      JMP    SHORT    Lup47E    ;and loop
  377.  
  378. PopRet_48E:
  379.     POP    SI
  380.     POP    DX
  381.     POP    AX
  382.     RET
  383. StrOut_47B    endp
  384.  
  385.  
  386. CharOut_492    proc    near
  387.     CMP    bprflag_226,0        ;output to printer?
  388.     JZ    PrOut_49E        ; yep
  389.      MOV    AH,2            ;display output in DL
  390.      INT    21H
  391.      RET
  392.  
  393. PrOut_49E:
  394.     MOV    AH,5            ;print output in DL
  395.     INT    21H
  396.     RET
  397. CharOut_492    endp
  398.  
  399.     CodeSeg    ENDS
  400. ;
  401. END    Banner1
  402.