Смекни!
smekni.com

Системне програмне забезпечення С (стр. 4 из 4)

AFX_ID_Dialog_Dialog "Dialog"

AFX_ID_FILE_Dialog "Dialog"

ID_CHILDNEXT "RUN"

ID_RUUN_RUUN "яюхїрыш"

ID_FILE_HELP "HELP"

END

STRINGTABLE DISCARDABLE

BEGIN

ID_FILE_OPEN "OPEN"

ID_FILE_SAVE "RUUN"

END

STRINGTABLE DISCARDABLE

BEGIN

AFX_ID_RUN_RUN "INFO"

END

#endif // Unknown language: 0x22, 0x1 resources

#ifndef APSTUDIO_INVOKED

#endif // not APSTUDIO_INVOKED


Додаток 3.

Resource.h

//{{NO_DEPENDENCIES}}

// Microsoft Developer Studio generated include file.

// Used by proba.rc

//

#define IDR_MENU1 101

#define IDR_ACCELERATOR1 102

#define IDD_DIALOG 103

#define ID_LIST2 1001

#define IDC_LIST2 1001

#define ID_EDIT 1002

#define IDC_EDIT1 1002

#define IDC_RADIO1 1003

#define IDC_RADIO2 1004

#define IDC_RADIO3 1005

#define ID_STATIC 1006

#define ID_STATIC2 1007

#define ID_LIST1 1008

#define IDC_LIST1 1008

#define ID_STATIC3 1009

#define ID_LIST3 1010

#define IDC_LIST3 1010

#define IDC_OK 1011

#define ID_FILE_EXIT 40001

#define ID_HELP_INFO 40002

#define AFX_ID_FILE_RENAME 40003

#define AFX_ID_FILE_QUIT 40004

#define AFX_ID_RESUET_RESUET 40006

#define AFX_ID_Dialog_Dialog 40007

#define AFX_ID_FILE_Dialog 40008

#define ID_CHILD 40009

#define ID_CHILDNEXT 40010

#define ID_RUUN_RUUN 40011

#define ID_FILE_HELP 40012

#define AFX_ID_RUN_RUN 65535

#define ID_FILE_INFO 65535

// Next default values for new objects

//

#ifdef APSTUDIO_INVOKED

#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NEXT_RESOURCE_VALUE 104

#define _APS_NEXT_COMMAND_VALUE 40013

#define _APS_NEXT_CONTROL_VALUE 1012

#define _APS_NEXT_SYMED_VALUE 101

#endif

#endifДодаток 4.

Лістинг програми на Assembler

STACKSG SEGMENT PARA STACK 'Stack'

DW 80 DUP(?)

STACKSG ENDS

;----------------------------------------------------------------------------

DATASG SEGMENT PARA 'Data'

HANDLE DW 0

MIN DW 0fff0H ;минимальный элемент

MAX DW 0

SREDN DW 0

TEN DB 10

IN_FNAME DB "IN.DAT",0 ;имя входного файла

OUT_FNAME DB "OUT.DAT",0 ;имя выходного файла

NUMROWSDW 1 ;количество строк

NUMCOLSDW 1 ;количество столбцов

ROW DW 0

TMP DW ? ;temporary cell

BUFFER DB 64 DUP(5) ;буфер ввода

stringlen DB ?

STRING DB 4 DUP(?) ;temporary string

DATASG ENDS

CODESG SEGMENT PARA 'Code'

BEGIN PROC FAR

ASSUME CS:CODESG,DS:DATASG,SS:STACKSG

PUSH DS

SUB AX,AX

PUSH AX

MOV AX,DATASG

MOV DS,AX

CALL LOAD_FROM_FILE ;вызов

CALL CALCULATE ;пользовательских

CALL SAVE_TO_FILE ;процедур

RET

BEGINENDP

LOAD_FROM_FILE PROC NEAR

MOV AH,03Dh ;­

MOVAL,0C2h ; открытие файла

MOV DX,OFFSET IN_FNAME ;‑

INT 21h

MOV HANDLE,AX

mov BX,0

push BX

@Cicle1:

MOV BX,HANDLE

MOV AH,03Fh ;­

MOVCX,1 ; считываем 1 байт в буфер

MOV DX,OFFSET NUMROWS ;‑

INT 21h

cmp NUMROWS,32 ; Space

jz @EndCicle1

sub NUMROWS,48

pop BX

mov AX,BX

mul TEN

add AX,NUMROWS

mov BX,AX

push BX

jmp @Cicle1

@EndCicle1:

pop BX

mov NUMROWS,BX

mov BX,0

push BX

@Cicle2:

MOV BX,HANDLE

MOV AH,03Fh ;­

MOVCX,1 ; считываем 1 байт в буфер

MOV DX,OFFSET NUMCOLS ;‑

INT 21h

cmp NUMCOLS,32 ; Space

jz @EndCicle2

sub NUMCOLS,48

pop BX

mov AX,BX

mul TEN

add AX,NUMCOLS

mov BX,AX

push BX

jmp @Cicle2

@EndCicle2:

pop BX

mov NUMCOLS,BX

mov BX,0

push BX

@Cicle3:

MOV BX,HANDLE

MOV AH,03Fh ;­

MOVCX,1 ; считываем 1 байт в буфер

MOV DX,OFFSET ROW ;‑

INT 21h

cmp ROW,32 ; Space

jz @EndCicle3

sub ROW,48

pop BX

mov AX,BX

mul TEN

add AX,ROW

mov BX,AX

push BX

jmp @Cicle3

@EndCicle3:

pop BX

mov ROW,BX

MOV AX,NUMROWS

MOV CX,NUMCOLS

MUL CX ; AX = NUMROWS * NUMCOLS

mov CX,AX

mov SI,0

@GlobalCicle:

push CX

mov BX,0

push BX

@Cicle4:

MOV BX,HANDLE

MOV AH,03Fh ;­

MOVCX,1 ; считываем 1 байт в буфер

MOV DX,OFFSET TMP ;‑

INT 21h

cmp TMP,32 ; Space

jz @EndCicle4

sub TMP,48

pop BX

mov AX,BX

mul TEN

add AX,TMP

mov BX,AX

push BX

jmp @Cicle4

@EndCicle4:

pop BX

mov buffer[SI],BL

inc SI

pop CX

loop @GlobalCicle

MOV Ah,3Eh

MOV BX,HANDLE

INT 21H

RET

LOAD_FROM_FILE ENDP

CALCULATE PROC NEAR

MOV BX, OFFSET BUFFER

MOV AX, ROW

MOV CX,NUMCOLS

MUL CX

MOV SI,AX

MOV CX, NUMCOLS

mov DX,SI

mov al,[bx+si]

xor ah,ah

mov min,ax

mov max,ax

mov sredn,ax

dec cx

inc si

jcxz @endcycle

@CYCLE1:

MOV Al, [BX+SI]

xor ah,ah

CMP AX,MIN

JA @NEXT1

MOV MIN, AX

@NEXT1:

inc SI

LOOP @CYCLE1

MOV CX, NUMCOLS

MOV SI,DX

@CYCLE2:

MOV Al, [BX+SI]

xor ah,ah

CMP AX,MAX

JB @NEXT2

MOV MAX, AX

@NEXT2:

inc SI

LOOP @CYCLE2

MOV AX,MIN

ADD AX,MAX

SHR AX,1

MOV SREDN,AX

@ENDCYCLE:

RET

CALCULATE ENDP

SAVE_TO_FILE PROC NEAR

MOV AH,03Ch ;­

MOVCX,0 ; открытие файла

MOV DX,OFFSET OUT_FNAME ;‑

INT 21h

MOV HANDLE,AX

mov AX,min

push AX

mov stringlen,0

@2Cicle1:

pop AX

xor ah,ah

or AL,AL

jz @2EndCicle1

mov BX,AX

div TEN

push AX

mul TEN

sub BX,AX

add BX,48 ; '0'

mov CL,stringlen

or CL,CL

jz @end_disl1

xor CH,CH

mov SI,CX

@dislocation1:

mov AL, string[SI-1]

mov string[SI], AL

dec SI

loop @dislocation1

@end_disl1:

inc stringlen

mov String[0],BL

jmp @2Cicle1

@2EndCicle1:

MOV BX,HANDLE ;­

MOV AH,040h ;¦

MOV CL,stringlen ; сохранение MIN

xor ch,ch

MOV DX,OFFSET string ;‑

INT 21h

mov MIN,32 ; Space

MOV BX,HANDLE

MOV AH,040h

MOV CX,1

MOV DX,OFFSET MIN

INT 21h

mov AX,max

push AX

mov stringlen,0

@2Cicle2:

pop AX

xor ah,ah

or AL,AL

jz @2EndCicle2

mov BX,AX

div TEN

push AX

mul TEN

sub BX,AX

add BX,48 ; '0'

mov CL,stringlen

or CL,CL

jz @end_disl2

xor CH,CH

mov SI,CX

@dislocation2:

mov AL, string[SI-1]

mov string[SI], AL

dec SI

loop @dislocation2

@end_disl2:

inc stringlen

mov String[0],BL

jmp @2Cicle2

@2EndCicle2:

MOV BX,HANDLE ;­

MOV AH,040h ;¦

MOV CL,stringlen ; сохранение MAX

xor ch,ch

MOV DX,OFFSET string ;‑

INT 21h

mov MIN,32 ; Space

MOV BX,HANDLE

MOV AH,040h

MOV CX,1

MOV DX,OFFSET MIN

INT 21h

mov AX,sredn

push AX

mov stringlen,0

@2Cicle3:

pop AX

xor ah,ah

or AL,AL

jz @2EndCicle3

mov BX,AX

div TEN

push AX

mul TEN

sub BX,AX

add BX,48 ; '0'

mov CL,stringlen

or CL,CL

jz @end_disl3

xor CH,CH

mov SI,CX

@dislocation3:

mov AL, string[SI-1]

mov string[SI], AL

dec SI

loop @dislocation3

@end_disl3:

inc stringlen

mov String[0],BL

jmp @2Cicle3

@2EndCicle3:

MOV BX,HANDLE ;­

MOV AH,040h ;¦

MOV CL,stringlen ; сохранение SREDN

xor ch,ch

MOV DX,OFFSET string ;‑

INT 21h

mov MIN,32 ; Space

MOV BX,HANDLE

MOV AH,040h

MOV CX,1

MOV DX,OFFSET MIN

INT 21h

MOV Ah,3Eh

MOV BX,HANDLE

INT 21H

RET

SAVE_TO_FILE ENDP

CODESG ENDS

END BEGIN