home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
batch
/
library
/
batutl2
/
banner1.asm
< prev
next >
Wrap
Assembly Source File
|
1988-04-20
|
7KB
|
402 lines
TITLE BANNER1 1-29-83 [4-15-88]
;Toad Hall Disassembly, tweak
LF EQU 0AH
CR EQU 0DH
;
;INITIAL VALUES : CS:IP 0000:0100
; SS:SP 0000:FFFF
CodeSeg SEGMENT
ASSUME DS:CodeSeg, SS:CodeSeg ,CS:CodeSeg ,ES:CodeSeg
ORG 100H
Banner1 proc far
JMP Start_22C
bconstBuff_103 DB 1CH,1BH,38H,5 DUP(0)
bconstBuff_10B DB 1EH,1BH,36H,5 DUP(0)
buff_113 DB 100H DUP(0)
L0213 dw 0FA6EH,0F000H ;DB 6EH,0FAH,0,0F0H
byte_217 DB 0
byte_218 DB 0
bconst_219 DB 2AH
bconst_21A DB 7CH
byte_21B DB 0
wptr_21C dw 0
word_21E dw 0
byte_220 DB 0
byte_221 DB 0
bcntr_222 DB 0
word_223 dw 0
byte_225 DB 0
bprflag_226 DB 0
bflagF_227 DB 0
bflagI_228 DB 0
bflagH_229 DB 0
bflagW_22A DB 0
db 0
;L022C Banner1 CJ L03A8 DI
Start_22C:
; PUSH DS
; XOR AX,AX
; PUSH AX
MOV SI,81H
MOV word_21E,SI
CALL ZeroVars_3A5 ;zero some variables
Lup23A: MOV SI,word_21E ;buffer pointer
LODSB ;snarf first char
CMP AL,CR ;CR?
JNZ L0246 ; nope
JMP Terminate_3A4 ; yep, exit
L0246: XOR CX,CX
CMP AL,20H ;space?
JNZ L024D ; nope
LODSB ;gobble the space, next char
L024D: MOV wptr_21C,SI ;save pointer
DEC wptr_21C ; decrement it
Lup255: CMP AL,CR ;CR?
JZ L025F ; yep
CMP AL,bconst_21A ;7CH?
JNZ L0262 ; nope
L025F: JMP SHORT KeyCr_2E0
; NOP
L0262: INC CX ;incr counter
CMP AL,2FH ;'/' ;slash?
JZ L026A ; yep
LODSB ; nope, next char
JMP SHORT Lup255 ; and loop
;char was "/"
L026A: DEC CX ;adjust counter
Lup26B: LODSB ;snarf next char
CMP AL,CR ; CR?
JZ KeyCr_2E0 ; yep
CMP AL,bconst_21A ;7CH?
JZ KeyCr_2E0 ; yep
CMP AL,60H ;weird back apostrophe '`'
JB L027C
AND AL,0DFH ;mask
L027C: CMP AL,'D'
JZ KeyD_2A2
CMP AL,'F'
JZ KeyF_2A9
CMP AL,'H'
JZ KeyH_2B0
CMP AL,'I'
JZ KeyI_2B7
CMP AL,'L'
JZ KeyL_2BE
CMP AL,'S'
JZ KeyS_2C3
CMP AL,'U'
JZ KeyU_2CA
CMP AL,'W'
JZ KeyW_2D4
CMP AL,'X'
JZ KeyX_2DB
JMP SHORT Lup26B
KeyD_2A2:
MOV bprflag_226,1
JMP SHORT Lup26B
KeyF_2A9:
MOV bflagF_227,1
JMP SHORT Lup26B
KeyH_2B0:
MOV bflagH_229,1
JMP SHORT Lup26B
KeyI_2B7:
MOV bflagI_228,1
JMP SHORT Lup26B
KeyL_2BE:
CALL NewLine_435
JMP SHORT Lup26B
KeyS_2C3:
MOV byte_225,0FFH
JMP SHORT Lup26B
KeyU_2CA:
LODSB ;snarf next char
CMP AL,CR ;CR?
JZ KeyCr_2E0 ; yep
MOV byte_225,AL ; nope, save
JMP SHORT Lup26B
KeyW_2D4:
MOV bflagW_22A,1
JMP SHORT Lup26B
KeyX_2DB:
CALL ZeroVars_3A5 ;clear the variables
JMP SHORT Lup26B
KeyCr_2E0:
MOV word_21E,SI
MOV byte_21B,AL ;save the char
MOV byte_220,CL ;save counter
CALL L0444
CMP bflagF_227,1 ;flag set?
JNZ L02F8 ; nope
CALL ClrScr_45F ;clear screen/FormFeed
L02F8: CALL NewLine_435
MOV bcntr_222,0 ;init counter
or cx,cx ;done?
JNZ Lup308 ; not yet
JMP Terminate_3A4 ; yep, terminate
Lup308: MOV SI,wptr_21C ;buffer ptr
CALL PurgeBuff_420 ;clear our buffer
XOR DX,DX
XOR DI,DI
MOV byte_221,0
;L0318 L0379 CJ
L0318: LODSB ;snarf buffer byte
MOV byte_218,AL ;save here
MOV BL,8
MUL BL ;*8
ADD AL,bcntr_222
ADC AH,0 ;add carry to msb
MOV BX,AX
PUSH ES ;save regs
PUSH DI
; LES BH,DWORD PTR L0213 MASM 5.0 chokes on this
mov es,L0213+2 ;segment word
mov bh,byte ptr L0213+1 ;msb of offset word
MOV AL,ES:[BX+DI] ;snarf char
MOV CX,8 ;reinit cntr
POP DI ;restore regs
POP ES
Lup337: MOV BL,20H ;' '
SHL AL,1 ;*2
JNB L0355 ;no carry
MOV BL,byte_225
CMP BL,0FFH
JNZ L034C
MOV BL,byte_218
JMP SHORT L0355
L034C: or bl,bl ;0?
JNZ L0355
MOV BL,bconst_219 ;constant 2AH
L0355: CMP DI,OFFSET Banner1 ;buffer end?
JZ L036E ; yep
MOV [DI+buff_113],BL ;stuff char in buffer
INC DI ;bump ptr
CMP bflagW_22A,1
JNZ L036C ;only do it once
MOV [DI+buff_113],BL ;stuff char again
INC DI ;bump ptr again
L036C: LOOP Lup337 ; and loop
L036E: INC byte_221
MOV AL,byte_221
CMP AL,byte_220
JNZ L0318
MOV word_223,DI
CALL Output_3B8
CMP bflagH_229,1
JNZ L038C
CALL Output_3B8
L038C: INC bcntr_222
CMP bcntr_222,8
JZ L039A
JMP Lup308
L039A: CMP byte_21B,CR ;0DH
JZ Terminate_3A4
JMP Lup23A
;L03A4 L0243 CJ L0305 CJ L039F CJ
Terminate_3A4:
; RET_FAR ;to DOS
mov ax,4C00H ;terminate, Errorlevel 0
int 21H
Banner1 endp
ZeroVars_3A5 proc near
PUSH AX ;save regs
PUSH CX
PUSH DI
MOV CX,OFFSET Start_22C ;code start
MOV DI,OFFSET byte_220 ;start of some var space
SUB CX,DI ;get the difference
XOR AL,AL ;fill with zeros
REPZ STOSB
POP DI ;restore regs
POP CX
POP AX
RET
ZeroVars_3A5 endp
;maybe a tab function
Output_3B8 proc near
PUSH AX
PUSH CX
PUSH DX
PUSH SI
CMP bflagI_228,1
JNZ L03D4
MOV CL,7
SUB CL,bcntr_222
XOR CH,CH ;clear msb
JCXZ L03D4 ;zero, exit loop
MOV DL,20H ;output a space
;L03CF L03D2 CJ
Lup3CF: CALL CharOut_492 ;output char
LOOP Lup3CF
L03D4: MOV AL,byte_220
CMP AL,byte_217
JBE L03EA
CMP bprflag_226,0 ;printer output? (0)
JNZ L03EA ; nope
MOV SI,OFFSET bconstBuff_103 ;ctrl string
CALL StrOut_47B ;output it
L03EA: MOV SI,OFFSET buff_113
MOV CX,word_223 ;loop counter
Lup3F1: LODSB ;snarf buff char
MOV DL,AL ;need it in DL
CALL CharOut_492 ;display/print it
LOOP Lup3F1
CMP bprflag_226,0 ;printer output? (0)
JZ L0409 ; yep
CMP word_223,50H ;'P'
JB L0418
JMP SHORT PopRet_41B
L0409: MOV AL,byte_220
CMP AL,byte_217
JBE L0418
MOV SI,OFFSET bconstBuff_10B ;ctrl string
CALL StrOut_47B ;output it
L0418: CALL NewLine_435 ;CR/LF
PopRet_41B:
POP SI
POP DX
POP CX
POP AX
RET
Output_3B8 endp
PurgeBuff_420 proc near
PUSH ES
PUSH AX
PUSH CX
PUSH DI
PUSH DS
POP ES
MOV DI,OFFSET buff_113
MOV CX,OFFSET Banner1
MOV AL,20H ;' '
REPZ STOSB ;fill buff with spaces
POP DI
POP CX
POP AX
POP ES
RET
PurgeBuff_420 endp
NewLine_435 proc near
PUSH AX
PUSH DX
MOV DL,CR
CALL CharOut_492
MOV DL,LF
CALL CharOut_492
POP DX
POP AX
RET
NewLine_435 endp
L0444 proc near
PUSH AX ;save AX a sec
MOV AL,0AH
CMP bflagI_228,1
JNZ L0450
DEC AL
L0450: CMP bflagW_22A,1
JNZ L0459
SHR AL,1 ;/2
L0459: NOP
MOV byte_217,AL
POP AX ;restore AX
RET
L0444 endp
ClrScr_45F proc near
PUSH AX ;save regs
PUSH DX
CMP bprflag_226,0 ;printer flag set (0)
JZ L0472 ; yep, output Formfeed
MOV AH,0FH ;get current video mode
INT 10H
xor ah,ah ;set video mode
INT 10H
JMP SHORT PopRet_478
L0472: MOV DL,0CH ;form feed
MOV AH,5 ;printer output
INT 21H
PopRet_478:
POP DX ;restore regs
POP AX
RET
ClrScr_45F endp
StrOut_47B proc near
PUSH AX
PUSH DX
PUSH SI
Lup47E: LODSB ;snarf constant
CMP AL,'$' ;string end?
JZ PopRet_48E ;yep, done
or al,al ;zero?
JZ PopRet_48E ;yep, done
MOV DL,AL ;need char in DL
CALL CharOut_492 ;display or print it
JMP SHORT Lup47E ;and loop
PopRet_48E:
POP SI
POP DX
POP AX
RET
StrOut_47B endp
CharOut_492 proc near
CMP bprflag_226,0 ;output to printer?
JZ PrOut_49E ; yep
MOV AH,2 ;display output in DL
INT 21H
RET
PrOut_49E:
MOV AH,5 ;print output in DL
INT 21H
RET
CharOut_492 endp
CodeSeg ENDS
;
END Banner1