IBM PC. . 35 page 60,132 TITLE STRING (EXE) ; --------------------------------------------------- STACKSG SEGMENT PARA STACK 'Stack' DW 32 DUP(?) STACKG ENDS ; --------------------------------------------------- DATASG SEGMENT PARA 'Data' NAME1 DB 'Assemblers' ; NAME2 DB 10 DUP(' ') NAME3 DB 10 DUP(' ') DATASG ENDS ; --------------------------------------------------- CODESG SEGMENT PARA 'Code' BEGIN PROC FAR ; ASSUME CS:CODESG,DS:DATASG,SS:STACKSG,ES:DATASG PUSH DS SUB AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV ES,AX CALL C10MVSB ; MVSB CALL D10MVSW ; LODS CALL E10LODS ; LODS CALL F10STOS ; CMPS CALL H10SCAS ; SCAS RET BEGIN ENDP ; MOVSB: ; ------------------- C10MVSB PROC NEAR CLD LEA SI,NAME1 LEA D1,NAME2 MOV CX,10 ; 10 REP MOVSB ; NAME1 NAME2 RET C10MVSB ENDP ; MOVSW: ; ------------------- D10MVSW PROC NEAR CLD LEA SI,NAME2 LEA DI,NAME3 MOV CX,05 ; 5 REP MOVSW ; NAME2 NAME3 RET D10MVSW ENDP ; LODSW: ; ------------------- E10LODS PROC NEAR IBM PC. . 36 CLD LEA SI,NAME1 ; LODSW ; NAME1 AX RET E10LODS ENDP ; STOSW: ; ------------------- F10STOS PROC NEAR CLD LEA D1,NAME3 MOV CX,05 MOV AX,2020H ; REP STOSW ; NAME3 RET F10STOS ENDP ; CMPSB: ; ------------------- G10CMPS PROC NEAR CLD MOV CX,10 LEA SI,NAME1 LEA DI,NAME2 REPE CMPSB ; NAME1 NAME2 JNE G20 ; ? MOV BH,01 G20: MOV CX,10 LEA SI,NAME2 LEA DI,NAME3 REPE CMPSB ; NAME2 NAME3 JE G30 ; , MOV BL,02 G30: RET G10CMPS ENDP ; SCASB: ; ------------------- H10SCAS PROC NEAR CLD MOV CX,10 LEA DI,NAME1 MOV AL,'m' ; 'm' REPNE SCASB ; NAME1 JNE H20 ; - MOV AH,03 H20: RET H10SCAS ENDP CODES ENDS END BEGIN IBM PC. . 37 page 60,132 TITLE EXRING (COM) , CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,SS:CODESG,ES:CODESG ORG 100H BEGIN: JMP SHORT MAIN ;-------------------------------------------------------- NAMEPAR LABEL BYTE ; MAXNLEN DB 31 ;. ACTNLEN DB ? ; NAMEFLD DB 31 DUP(' ') ; PROMPT DB 'Name?', '$' NAMEDSP DB 31 DUP(' '), 13, 10, '$' ROW DB 00 ;-------------------------------------------------------- MAIN PROC NEAR ; MOV AX,0600H CALL Q10SCR ; SUB DX,DX ; 00,00 CALL Q20CURS A10LOOP: CALL B10INPT ; TEST ACTNLEN,0FFH ; ? (.. ) JZ A90 ; - CALL D10SCAS ; CMP AL,'*' ;? JE A10LOOP ; - CALL E10RGHT ; CALL A10LOOP A90: RET MAIN ENDP ; : ; ----------------------------- B10INPT PROC MOV AH,09 LEA DX,PROMPT ; INT 21H RET B10INPT ENDP ; : ; ----------------------- D10SCAS PROC CLD MOV AL,'*' MOV CX,30 ; - 30 LEA DI,NAMEFLD REPNE SCASB ; ? JE D20 ; - , MOV AL,20H ; * AL D20: RET D10SCAS ENDP IBM PC. . 38 ; : ; ------------------------------------ E10RGHT PROC STD SUB CH,CH MOV CL,ACTNLEN ; CX REP LEA SI,NAMEFLD ; ADD SI,CX ; DEC SI ; LEA DI,NAMEDSP+30 ; . REP MOVSB ; MOV DH,ROW MOV DL,48 CALL Q20CURS ; MOV AH,09 LEA DX,NAMEDSP ; INT 21H CMP ROW,20 ; ? JAE E20 ; - INC ROW ; , JMP E90 E20: MOV AX,0601H ; - CALL Q10SCR ; MOV DH,ROW ; MOV DL,00 CALL Q20CURS E90: RET E10RGHT ENDP ; : ; ---------------------- F10CLNM PROC CLD MOV AX,2020H MOV CX,15 ; 15 LEA DI,NAMEDSP REP STOSW RET F10CLNM ENDP ; : ; ---------------- Q10SCR PROC ;AX MOV BH,30 ; ( 07 /) MOV CX,00 MOV DX,184FH INT 10H RET Q10SCR ENDP ; (/): ; ---------------------------------- Q20CURS PROC ;DX MOV AH,02 SUB BH,BH IBM PC. . 39 INT 10H RET Q20CURS ENDP CODESG ENDS END BEGIN IBM PC. . 84 TITLE EXDWMUL - CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,SS:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; --------------------------------------------- MULTCND DW 3206H ; DW 2521H MULTPLR DW 6400H DW 0A26H PRODUCT DW 0 DW 0 DW 0 DW 0 ; --------------------------------------------- MAIN PROC NEAR ; CALL E10XMUL ; 1- CALL Z10ZERO ; CALL F10XMUL ; 2- RET MAIN ENDP ; : ; ----------------------------------------------- E10XMUL PROC MOV AX,MULTCND+2 ; MUL MULTPLR ; MOV PRODUCT+4,AX ; MOV PRODUCT+2,DX MOV AX,MULTCND ; MUL MULTPLR ; ADD PRODUCT+2,AX ; ADC PRODUCT,DX RET E10XMUL ENDP ; : ; -------------------------------------------- F10XMUL PROC MOV AX,MULTCND+2 ;-2 MUL MULTPLR+2 ; * -2 MOV PRODUCT+6,AX ; MOV PRODUCT+4,DX MOV AX,MULTCND+2 ;-2 MUL MULTPLR ; * -1 ADD PRODUCT+4,AX ; ADC PRODUCT+6,DX ADC PRODUCT,00 ; MOV AX,MULTCND ;-1 MUL MULTPLR+2 ; * -2 ADD PRODUCT+4,AX ; IBM PC. . 85 ADC PRODUCT+6,DX ADC PRODUCT,00 ; MOV AX,MULTCND ;-1 MUL MULTPLR ; * -1 ADD PRODUCT+2,AX ; ADC PRODUCT,DX RET F10XMUL ENDP ; : ; ---------------------------------------- Z10XMUL PROC MOV PRODUCT,0000 MOV PRODUCT+2,0000 MOV PRODUCT+4,0000 MOV PRODUCT+6,0000 RET Z10XMUL ENDP CODESG ENDS END BEGIN IBM PC. . 86 page 60,132 TITLE EXDIV (COM) DIV IDIV CODESG SEGMENT PARA 'Code' ORG 100H BEGIN: JMP SHORT MAIN ; --------------------------------------------- BYTE1 DB 80H ;Data items BYTE2 DB 16H WORD1 DW 2000H WORD2 DW 0010H WORD3 DW 1000H ; --------------------------------------------- MAIN PROC NEAR ; CALL D10DIV ; DIV CALL E10IDIV ; IDIV MAIN ENDP ; DIV: ; --------------------------------------------- D10DIV PROC MOV AX,WORD1 ; / DIV BYTE1 ; : AH:AL MOV AL,BYTE1 ; / SUB AH,AH ; AH DIV BYTE3 ; : AH:AL MOV DX,WORD2 ; / MOV AX,WORD3 ; DX:AX DIV WORD1 ; : DX:AX MOV AX,WORD1 ; / SUB DX,DX ; DX DIV WORD3 ; : DX:AX RET D10DIV ENDP ; IDIV: ; --------------------------------------------- E10IDIV PROC MOV AX,WORD1 ; / IDIV BYTE1 ; : AH:AL MOV AL,BYTE1 ; / CBW ; AH IDIV BYTE3 ; : AH:AL MOV DX,WORD2 ; / MOV AX,WORD3 ; DX:AX IDIV WORD1 ; : DX:AX MOV AX,WORD1 ; / CWD ; DX IDIV WORD3 ; : DX:AX RET E10DIV ENDP CODESG ENDS IBM PC. . 87 END BEGIN TITLE ASCADD (COM) ASCII- CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,SS:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; ----------------------------------------------- ASC1 DB '578' ; ASC2 DB '694' ASC3 DB '0000' ; ----------------------------------------------- MAIN PROC NEAR CLC LEA SI,AASC1+2 ; ASCII- LEA DI,AASC2+2 LEA BX,AASC1+3 MOV CX,03 ; 3 A20: MOV AH,00 ; AH MOV AL,[SI] ; ASCII- ADC AL,[DI] ; ( ) AAA ; ASCII MOV [BX],AL ; DEC SI DEC DI DEC BX LOOP A20 ; 3 MOV [BX],AH ; RET MAIN ENDP CODESG ENDS END BEGIN IBM PC. . 88 TITLE ASCMUL (COM) ASCII- CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,SS:CODESG ORG 100H BEGIN: JMP MAIN ; --------------------------------------------- MULTCND DB '3783' ; MULTPLR DB '5' PRODUCT DB 5 DUP(0) ; --------------------------------------------- MAIN PROC NEAR MOV CX,04 ;4 LEA SI,MULTCND+3 LEA DI,PRODUCT+4 AND MULTPLR,0FH ; ASCII- A20: MOV AL,[SI] ; ASCII- ; ( LODSB) AND AL,OFH ; ASCII- MUL MULTPLR ; AAM ; ASCII ADD AL,[DI] ; AAA ; MOV [DI],AL ; DEC DI MOV [DI],AH ; DEC SI LOOP A20 ; 4 RET MAIN ENDP CODESG ENDS END BEGIN TITLE ASCDIV (COM) ASCII- CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,SS:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; --------------------------------------------- DIVDND DB '3698' ; DIVSOR DB '4' QUOTNT DB 4 DUP(0) ; --------------------------------------------- MAIN PROC NEAR MOV CX,04 ;4 SUB AH,AH ; AND DIVSOR,0FH ; ASCII 3 LEA SI,DIVDND LEA DI,QUOTNT A20: IBM PC. . 89 MOV AL,[SI] ; ASCII ; ( LODSB) AND AL,0FH ; ASCII AAD ; DIV DIVSOR ; MOV [DI],AL ; INC SI INC DI LOOP A20 ; 4 RET MAIN ENDP CODEGS ENDS END BEGIN IBM PC. . 90 TITLE SCREMP (EXE) , ; ; ---------------------------------------------------- STACKSG SEGMENT PARA STACK 'Stack' DW 32 DUP(?) STACKSG ENDS ; ---------------------------------------------------- DATASG SEGMENT PARA 'Data' HRSPAR LABLE BYTE ; ; : MAXHLEN DB 6 ;--------------------- ACTHLEN DB ? HRSFLD DB 6 DUP(?) RATEPAR LABLE BYTE ; ; : MAXRLEN DB 6 ;--------------------- ACTRLEN DB ? RATEFLN DB 6 DUP(?) MESSG1 DB 'Hours worked? ','$' MESSG2 DB 'Rate of pay? ','$' MESSG3 DB 'Wage = ' ASCWAGE DB 10 DUP(30H), 13, 10, '$' ADJUST DW ? ASCHRS DB 0 ASCRATE DB 0 BINVAL DW 00 BINHRS DW 00 BINRATE DW 00 COL DB 00 DECIND DB 00 MULT10 DW 01 NODEC DW 00 ROW DB 00 SHIFT DW ? TENWD DW 10 DATASG ENDS ; ---------------------------------------------------- CODESG SEGMENT PARA 'Code' BEGIN PROC FAR ASSUME CS:CODESG,DS:DATASG,SS:STACKSG,ES:DATASG PUSH DS SUB AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV ES,AX MOV AX,0600H CALL Q10SCR ; CALL Q20CURS ; A20LOOP: IBM PC. . 91 CALL B10INPT ; CMP ACTHLEN,00 ; ? JE A30 CALL D10HOUR ; CALL E10RATE ; CALL F10MULT ; CALL G10WAGE ; ASCII CALL K10DISP ; JMP A20LOOP A30: MOV AX,0600H CALL Q10SCR ; RET ; BEGIN ENDP ; ; ---------------------------------------------------- B10INPT PROC LEA DX,MESSG1 ; MOV AH,09 INT 21H LEA DX,HRSPAR ; MOV AH,0AH INT 21H CMP ACTHLEN,00 ; ? JNE B20 RET ; - A20LOOP B20: MOV COL,25 ; CALL Q20CURS LEA DX,MESSG2 ; MOV AH,09 INT 21H LEA DX,RATEPAR ; MOV AH,0AH INT 21H RET B10INPT ENDP ; : ; ----------------- D10HOUR PROC MOV NODEC,00 MOV CL,ACTHLEN SUB CH,CH LEA SI,HRSFLD-1 ; ADD SI,CX ; CALL M10ASBI ; MOV AX,BINVAL MOV BINHRS,AX RET D10HOUR ENDP ; : ; ------------------ E10RATE PROC IBM PC. . 92 MOV CL,ACTRLEN SUB CH,CH LEA SI,RATEFLD-1 ; ADD SI.CX ; CALL M10ASBI ; MOV AX,BINVAL MOV BINRATE,AX RET E10RATE ENDP ; , : ; ----------------------------- F10MULT PROC MOV CX,05 LEA DI,ASCWAGE ; MOV AX,3030H ; ASCII (30) CLD REP STOSW MOV SHIFT,10 MOV ADJUST,00 MOV CX,NODEC CMP CL,06 ; 6 JA F40 ; , DEC CX DEC CX JLE F30 ;, 3 MOV NODEC,02 MOV AX,01 F20: MUL TENWD ; LOOP F20 MOV SHIFT,AX SHR AX,1 ; MOV ADJUST,AX F30: MOV AX,BINHRS MUL BINRATE ; ADD AX,ADJUST ; ADC DX,00 CMP DX,SHIFT ; JB F50 ; DIV? F40: SUB AX,AX JMP F70 F50: CMP ADJUST,00 ; ? JZ F80 DIV SHIFT ; F70: SUB DX,DX ; F80: RET F10MULT ENDP ; ASCII : ; ----------------------------- G10WAGE PROC IBM PC. . 93 LEA SI,ASCWAGE+7 ; . MOV BYTE PTR[SI],'.' ADD SI,NODEC ; G30: CMP BYTE PTR[SI],'.' JNE G35 ;, .. DEC SI G35: CMP DX,00 ; dx:ax < 10, JNZ G40 CMP AX,0010 ; JB G50 G40: DIV TENWD ; - ASCII- OR DL,30H MOV [SI],DL ; ASCII DEC SI SUB DX,DX ; JMP G30 G50: OR AL,30H ; ASCII MOV [SI],AL ; RET G10WAGE ENDP ; : ; --------------------- K10DISP PROC MOV COL,50 ; CALL Q20CURS MOV CX,09 LEA SI,ASCWAGE K20: ; CMP BYTE PTR[SI],30H JNE K30 ; MOV BYTE PTR[SI],20H INC SI LOOP K20 K30: LEA DX,MESSG3 ; MOV AH,09 INT 21H CMP ROW,20 ; ? JAE K80 INC ROW ; - JMP K90 K80: MOV AX,0601H ; -- CALL Q10SCR ; MOV COL,00 ; CALL Q20CURS K90: RET K10DISP ENDP ; ASCII- IBM PC. . 94 ; : ; -------------------------- M10ASBI PROC MOV MULT10,0001 MOV BINVAL,00 MOV DECIND,00 SUB BX,BX M20: MOV AL,[SI] ;ASCII- CMP AL,'.' ;, . JNE M40 MOV DECIND,01 JMP M90 M40: AND AX,000FH MUL MULT10 ; ADD BINVAL,AX ; . MOV AX,MULT10 ; MUL TENVD ; x 10 MOV MULT10,AX CMP DECIND,00 ; ? JNZ M90 INC BX ; - M90: DEC SI LOOP M20 ; CMP DECIND,00 ; .? JZ M100 ; -- ADD NODEC,BX ; M100: RET M10ASBI ENDP ; : ; ---------------- Q10SCR PROC NEAR ;AX MOV BH,30 ; (07 /) SUB CX,CX MOV DX,184FH INT 10H RET Q10SCR ENDP ; : ; ----------------- Q20CURS PROC NEAR MOV AH,02 SUB BH,BH MOV DH,ROW MOV DL,COL INT 10H RET Q20CURS ENDP CODESG ENDS IBM PC. . 95 END BEGIN IBM PC. . 96 page 60,132 TITLE DIRECT (COM) CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,ES:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; ------------------------------------------------ THREE DB 3 MONIN DB '11' ALFMON DB '???','$' MONTAB DB 'JAN','FEB','MAR','APR','MAY','JUN' DB 'JUL','AUG','SEP','OKT','NOV','DEC' ; ------------------------------------------------ MAIN PROC NEAR ; CALL C10CONV ; CALL D10LOC ; CALL F10DISP ; RET MAIN ENDP ; ASCII : ; -------------------------------------- C10CONV PROC MOV AH,MONIN ; MOV AL,MONIN+1 XOR AX,3030H ; ASCII CMP AH,00 ; 01-09? JZ C20 ; - SUB AH,AH ; - AH, ADD AL,10 ; C20 RET C10CONV ENDP ; : ; --------------------------- D10LOC PROC LEA SI,MONTAB DEC AL ; MUL THREE ; AL 3 ADD SI,AX MOV CX,03 ; CLD LEA DI,ALFMON REP MOVSB ; 3 RET D10LOC ENDP ; .: ; -------------------------- F10DISP PROC LEA DX,ALFMON MOV AH,09 INT 21H RET F10DISP ENDP IBM PC. . 97 CODESG ENDS END BEGIN IBM PC. . 98 page 60,132 TITLE TABSRCH (COM) CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,ES:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; ----------------------------------------------- STOKNIN DW '23' STOKTAB DB '05','Excavators' DB '08','Lifters ' DB '09','Presses ' DB '12','Valves ' DB '23','Processors' DB '27','Pumps ' DESCRN 10 DUP(?) ; ----------------------------------------------- MAIN PROC NEAR MOV AX,STOKNIN ; XCHG AL,AH MOV CX,06 ; LEA SI,STOKTAB ; A20: CMP AX,[SI] ; JE A30 ; - , ADD SI,12 ; - LOOP A20 CALL R10ERR ; RET A30: MOV CX,05 ; LEA DI,DESCRN ; INC SI INC SI ; REP MOVSW ; RET MAIN ENDP ; R10ERR PROC ; < > RET R10ERR ENDP CODESG ENDS END BEGIN IBM PC. . 99 page 60,132 TITLE TABSRCH (COM) , CMPSB CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,ES:CODESG ORG 100H BEGIN: JMP SHORT MAIN ; ---------------------------------------------------- STOKNIN DW '123' STOKTAB DB '035','Excavators' ; DB '038','Lifters ' DB '049','Presses ' DB '102','Valves ' DB '123','Processors' DB '127','Pumps ' DB '999', 10 DUP(' ') ; DESCRN 10 DUP(?) ; ---------------------------------------------------- MAIN PROC NEAR CLD LEA SI,STOKTAB ; A20: MOV CX,03 ; 3 LEA DI,STOKNIN ; REPE CMPSB ; JE A30 ; - , JA A40 ; - ADD SI,CX ; CX JMP A20 ; A30: MOV CX,05 ; 5 LEA DI,DESCRN ; REP MOVSV ; RET A40: CALL R10ERR ; RET MAIN ENDP R10ERR PROC ; < > RET R10ERR ENDP CODESG ENDS END BEGIN IBM PC. . 100 page 60,132 TITLE XLATE (COM) ASCII EBCDIC CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,ES:CODESG ORG 100H BEGIN: JMP MAIN ; ---------------------------------------------------- ASCNO DB '-31.5' EBCNO DB 6 DUP(' ') XLTAB DB 45 DUP(40H) DB 60H, 2DH DB 5CH DB 0F0H,0F1H,0F2H,0F3H,0F4H DB 0F5H,0F6H,0F7H,0F8H,0F9H DB 199 DUP(40H) ; ---------------------------------------------------- MAIN PROC NEAR ; LEA SI,ASCNO ; ASCNO LEA DI,EBCNO ; EBCNO MOV CX,06 ; LEA BX,XLTAB ; A20: MOV AL,[SI] ; ASCII XLAT ; MOV [DI],AL ; EBCNO INC DI INC SI LOOP A20 ; 6 RET MAIN ENDP CODESG ENDS END BEGIN IBM PC. . 101 page 60,132 TITLE ASCHEX (COM) ASCII . CODESG SEGMENT PARA 'Code' ASSUME CS:CODESG,DS:CODESG,ES:CODESG ORG 100H BEGIN: JMP MAIN ; ----------------------------------------------- DISPROW DB 16 DUP(' '), 13 HEXSTR DB 00 XLATAB DB 30H,31H,32H,33H,34H,35H,36H,37H,38H,39H DB 41H,42H,43H,44H,45H,46H ; ----------------------------------------------- MAIN PROC NEAR ; CALL Q10CLR ; LEA SI,DISPROW A20LOOP: CALL C10HEX ; CALL D10DISP ; CMP HEXCTR,0FFH ; (FF)? JE A50 ; - INC HEXCTR ; - JMP A20LOOP A50: RET MAIN ENDP C10HEX PROC NEAR ; . MOV AH,00 MOV AL,HEXCTR ; . SHR AX,CL ; . LEA BX,XLATAB ; MOV CL,04 ; XLAT ; . MOV [SI],AL ; MOV AL,HEXCTR SHL AX,CL ; XLAT MOV [SI]+1,AL ; . RET ; C10HEX ENDP D10DISP PROC NEAR ; MOV AL,HEXCTR MOV [SI]+3,AL CMP AL,1AH ; EOF? JE D20 ; - CMP AL,07H ;/ 08? JB D30 ; - OK CMP AL,10H ;/ 0F? JAE D30 ; - OK D20: MOV BYTE PTR [SI]+3,20H IBM PC. . 102 D30: ADD SI,05 ; LEA DI,DISPROW+80 CMP DI,SI JNE D40 MOV AH,40H ; MOV BX,01 ; MOV CX,81 ; LEA DX,DISPROW INT 21H LEA SI,DISPROW ; D40: RET D10DISP ENDP Q10CLR PROC NEAR ; MOV AX,0600H MOV BH,03 ; (07 /) MOV CX,0000 MOV DX,184FH INT 10H RET Q10CLR ENDP CODESG ENDS END BEGIN IBM PC. . 103 page 60,132 TITLE NMSORT (EXE) ; ----------------------------------------------- STACK SGMENT PARA STACK 'Stack' DW 32 DUP(?) STACK ENDS ; ----------------------------------------------- DATASG SEGMENT PARA 'Data' NAMEPAR LABEL BYTE ; : MAXNLEN DB 21 ; . NAMELEN DB ? ; NAMEFLD DB 21 DUP(' ') ; CRLF DB 13, 10, '$' ENDADDR DW ? MESSG1 DB 'Name?', '$' NAMECTR DB 00 NAMETAB DB 30 DUP(20 DUP(' ')) ; NAMESAV DB 20 DUP(?), 13, 10, '$' SWAPPED DB 00 DATA ENDS ; ----------------------------------------------- CODESG SEGMENT PARA 'Code' BEGIN PROC FAR ASSUME CS:CODESG,DS:DATDSG,SS:STACK,ES:DATASG PUSH DS SUB AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV ES,AX CLD LEA DI,NAMETAB CALL Q10CLR ; CALL Q20CURS ; A20LOOP: CALL B10READ ; CMP NAMELEN,00 ; ? JZ A30 ; - CMP NAMECTR,30 ; 30 ? JE A30 ; - CALL D10STOR ; JMP A20LOOP A30: ; CALL Q10CLR ; CALL Q20CURS ; CMP NAMECTR,01 ; 2 ? JBE A40 ; - CALL G10SORT ; CALL K10DISP ; A40: RET ; BEGIN ENDP IBM PC. . 104 ; ? ; ---------------------- B10READ PROC MOV AH,09 LEA DX,MESSG1 ; INT 21H MOV AH,0AH LEA DX,NAMEPAR ; INT 21H MOV AH,09 LEA DX,CRLF ; CRLF INT 21H MOV BH,00 ; MOV BL,NAMELEN ; MOV CX,21 SUB CX,BX ; B20: MOV NAMEFLD[BX],20H ; INC BX LOOP B20 RET B10READ ENDP ; : ; ---------------------- D10STOR PROC INC NAMECTR ; CLD LES SI,NAMEFLD MOV CX,10 REP MOVSV ; RET D10STOR ENDP ; : ; ------------------------- G10SORT PROC SUB DI,40 ; MOV ENDADDR,DI G20: MOV SWAPPED,00 ; LEA SI,NAMETAB ; G30: MOV CX,20 ; MOV DI,SI ADD DI,20 ; MOV AX,DI MOV BX,SI REPE CMPSB ; JBE G40 ; CALL H10XCHG ; G40: MOV SI,AX CMP SI,ENDADDR ; ? IBM PC. . 105 JBE G30 ; - CMP SWAPPED,00 ; ? JNZ G20 ; - , RET ; - G10SORT ENDP ; : ; ------------------------------ H10XCHG PROC MOV CX,10 LEA DI,NAMESAV MOV SI,BX REP MOVSW ; MOV CX,10 MOV DI,BX REP MOVSW ; ; MOV CX,10 LEA SI,NAMESAV REP MOVSW ; ; MOV SWAPPED,01 ; RET H10XCHG ENDP ; : ; ------------------------------------ K10DISP PROC LEA SI,NAMETAB K20: LEA DI,NAMESAV ; MOV CX,10 REP MOVSV MOV AH,09 LEA DX,NAMESAV INT 21H ; DEC NAMECTR ; ? JNZ K20 ; - , RET ; - K10DISP ENDP ; : ; -------------- Q10CLR PROC MOV AX,0600H MOV BH,61H ; (07 /) SUB CX,CX MOV DX,184FH INT 10H RET Q10CLR ENDP ; : ; ----------------- Q20CURS PROC MOV AH,02 IBM PC. . 106 SUB BH,BH SUB DX,DX ; 00,00 INT 10H RET Q20CURS ENDP CODESG ENDS END BEGIN IBM PC. . 107 page 60,132 TITLE FCBCREAT (EXE) FCB ;---------------------------------------------------------- STACKSG SEGMENT PARA STACK 'Stack' DW 80 DUP(?) STACKSG ENDS ;---------------------------------------------------------- DATASG SEGMENT PARA 'Data' RECLEN EQU 32 NAMEPAR LABEL BYTE ; : MAXLEN DB RECLEN ; . NAMELEN DB ? ; NAMEDTA DB RECLEN DUP(' ') ; (DTA) FCBREC LABEL BYTE ;FCB FCBDRIV DB 04 ; D FCBNAME DB 'NAMEFILE' ; FCBEXT DB 'DAT' ; FCBBLK DW 0000 ; FCBRCSZ DW ? ; FCBFLSZ DD ? ; (DOS) DW ? ; (DOS) DT ? ; (DOS) FCBSQRC DB 00 ; DD ? ; CRLF DB 13,10,'$' ERRCDE DB 00 PROMPT DB 'Name? ','$' ROW DB 01 OPNMSG DB '*** Open error ***', '$' WRTMSG DB '*** Write error ***', '$' DATASG ENDS ; --------------------------------------------------------- CODESG SEGMENT PARA 'Code' BEGIN PROC FAR ASSUME CS:CODESG,DS:DATASG,SS:STACKSG,ES:DATASG PUSH DS SUB AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV ES,AX MOV AX,0600H CALL Q10SCR ; CALL Q20CURS ; CALL C10OPEN ;, DTA CMP ERRCDE,00 ; ? JZ A20LOOP ; - , RET ; - DOS A20LOOP: CALL D10PROC IBM PC. . 108 CMP NAMELEN,00 ; ? JNE A20LOOP ; - , CALL