Помогите чуток
Это меню с 2умя прогами.
Первая на файлы.Вторая на графику.
Вот первая пашет гуд, а вторая не пашет просто выходит в волков и все.
Помогите плиизззз.
Я это сдам и свободен))
Очень нужна помощь.
stacksegment segment para stack 'stack'
dw 10h dup(?)
stacksegment ends
datasegment segment para public 'data'
NameFile db '11.txt',0
Handle dw 0
buffer db 0
summator dw 0
message db 13,10,'Srednee arifmeticheskoe: '
counter db 0
db 24h; end of string for 09h(int 21h)
firstmsg db '1-Dan fail s chislovoi informaciei.Vuchislit SA',13,10,'2-Graficheskaya ',13,10,24h
datasegment ends
codesegment segment para public 'code'
assume cs:codesegment, ds:datasegment, ss:stacksegment
start:
mov ax,datasegment
mov ds,ax
mov dx,offset firstmsg
mov ah,09h
int 21h
wait_key:
mov ah,06h
mov dl,0ffh
int 21h
jz wait_key
cmp al,31h
je prg_1
prg_2:
call progr2
jmp exit
prg_1:
call progr1
exit:
;-------- exit ----
mov ax,4c00h
int 21h
;------------------
progr1 proc
mov ah,3dh
mov dx,offset NameFile
mov al,2;r/w
int 21h
jc p1_ErrorOpening
;not error
mov Handle,ax;received handle
p1_my_loop:
mov ah,3fh
mov bx,Handle
mov dx,offset buffer
mov cx,1
int 21h
jc p1_ErrorReading
cmp ax,cx
jl p1_EndOfFile
;readed 1 byte from file successfully
mov al,buffer
cmp al,39h ;>9?
ja p1_BadSymbol
cmp al,30h ;<0?
jb p1_BadSymbol
;symbol of the digit
and al,0Fh
;good digit 0..9
xor ah,ah;clear ah
add summator,ax
inc counter
p1_BadSymbol:
mov ah,06h
mov dl,buffer
int 21h
jmp p1_my_loop
p1_EndOfFile:
;...
p1_SeekError:
;......
p1_ErrorReading:
;......
p1_ErrorOpening:
;......
mov ax,summator
mov bl,counter
div bl
add al,30h
mov counter,al
mov dx,offset message
mov ah,09h
int 21h
mov ah,40h
mov bx,Handle
mov dx,offset message
mov cx,28;length of the message
int 21h;write to file
mov ah,3eh
mov bx,Handle
int 21h
ret
progr1 endp
progr2 proc
.286
data segment
_srav DW ?
_Horg DW ?
adr DW ?
cen_x DW ?
cen_y DB 100
X_Left DW ?
X_Rigth DW ?
Y_Down DB ?
Y_UP DB ?
Color DB 4
Mas DB ?
LineData STRUC
X1 DW ?
Y1 DB ?
X2 DW ?
Y2 Db ?
LineData Ends
LineTable LineData<160,37,175,80>
LineData<175,80,220,87>
LineData<220,87,185,110>
LineData<185,110,195,150>
LineData<195,150,160,125>
LineData<160,125,125,150>
LineData<125,150,135,110>
LineData<135,110,100,87>
LineData<100,87,145,80>
LineData<145,80,160,37>
DB 0FFh
data Ends
;________________________________
stak segment
dw 256 (?)
stak ends
code segment
assume CS:code,DS:data
;________________________________
Line PROC
CMP Cl,Ch
JNC UpToDown
XCHG Ch,Cl
XCHG BX,DX
UpToDown:
SUB Cl,Ch
MOV Al,160
MUL Ch
ADD AX,AX
MOV DI,AX
ADD DI,BX
MOV Ch,0
SUB DX,BX
JC @@RightToLeft
CMP CX,DX
JC @@RightDown
MOV AX,CX
MOV BP,CX
SHR AX,1
@@DownRightCicle:
MOV Bl,Color
MOV ES:[DI],Bl
ADD DI,320
SUB AX,DX
JNC @@DownRightTest
INC DI
ADD AX,BP
@@DownRightTest:
LOOP @@DownRightCicle
RET
@@RightDown:
XCHG DX,CX
MOV AX,CX
MOV BP,CX
SHR AX,1
@@RightDownCicle:
MOV Bl,Color
MOV ES:[DI],Bl
INC DI
SUB AX,DX
JNC @@RightDownTest
ADD DI,320
ADD AX,BP
@@RightDownTest:
LOOP @@RightDownCicle
RET
;‘Їа_ў_ __«Ґў®
@@RightToLeft:
NEG DX
CMP CX,DX
JC @@LeftDown
MOV AX,CX
MOV BP,CX
SHR AX,1
@@DownLeftCicle:
MOV Bl,Color
MOV ES:[DI],Bl
ADD DI,320
SUB AX,DX
JNC @@DownLeftTest
DEC DI
ADD AX,BP
@@DownLeftTest:
LOOP @@DownLeftCicle
RET
@@LeftDown:
XCHG DX,CX
MOV AX,CX
MOV BP,CX
SHR AX,1
@@LeftDownCicle:
MOV Bl,Color
MOV ES:[DI],Bl
DEC DI
SUB AX,DX
JNC @@LeftDownTest
ADD DI,320
ADD AX,BP
@@LeftDownTest:
LOOP @@LeftDownCicle
RET
Line ENDP
;________________________________
_Left PROC
PUSH DI
@@LD:
MOV AL,ES:[DI-1]
CMP AL,Color
JE @@LD_Cicle
DEC DI
JMP @@LD
@@LD_Cicle:
MOV X_Left,DI
POP DI
RET
_Left EndP
;________________________________
_Rigth PROC
PUSH DI
@@RD:
MOV AL,ES:[DI]
CMP AL,Color
JE @@RD_Cicle
INC DI
JMP @@RD
@@RD_Cicle:
MOV X_Rigth,DI
POP DI
RET
_Rigth EndP
;________________________________
Cen_Zac PROC
PUSH DI
MOV DI,X_Left
@@Cen_Zac:
MOV BL,Color
MOV ES:[DI],BL
INC DI
CMP DI,X_Rigth
JE @@Cen_IN
JMP @@Cen_Zac
@@Cen_IN:
POP DI
RET
Cen_Zac EndP
;__________________________
Qute PROC
MOV AH,06h
MOV DL,0FFh
INT 21h
; JNZ @@Symb
; @@Symb:
; CMP AL,0
; JNE @@_QIN
; MOV AH,06h
; MOV DL,0FFh
; INT 21h
; CMP AL,10h
; JE @@_QOut
; JMP @@_QIN
; @@_QOut:
RET
Qute EndP
;________________________________
;‡_Єа_б дЁЈгал
Up_Zac PROC
@@_Up:
MOV AL,160 ;Lehgth string
MUL CH
ADD AX,AX
ADD AX,cen_x
MOV DI,AX
CALL _Left
CALL _Rigth
CALL Cen_Zac
MOV AL,ES:[DI-320]
CMP AL,Color
JE @@_Out1
DEC CH
JMP @@_Up
@@_Out1:
RET
Up_Zac EndP
;___________________________
Down_Zac PROC
@@_Down:
MOV AL,160 ;Lehgth string
MUL CH
ADD AX,AX
ADD AX,cen_x
MOV DI,AX
CALL _Left
CALL _Rigth
CALL Cen_Zac
MOV AL,ES:[DI+320]
CMP AL,Color
JE @@_Out2
INC CH
JMP @@_Down
@@_Out2:
RET
Down_Zac EndP
;________________________________
;Ќ_з_«® Їа®Ја_¬л
MOV AX,data
MOV DS,AX
MOV AX,0A000h
MOV ES,AX
MOV AX,13h
INT 010h
MOV SI,OFFSET LineTable
@@LineCicle:
MOV BX,DS:[SI]+[LineData.X1]
MOV Ch,DS:[SI]+[LineData.Y1]
MOV DX,DS:[SI]+[LineData.X2]
MOV Cl,DS:[SI]+[LineData.Y2]
MOV AL,Color
Call Line
ADD SI,SIZE LineData
MOV AX,DS:[SI]
CMP AX,250
JC @@LineCicle
MOV AH,00h
INT 16h
;____________________________________
MOV DX,03CEh
MOV al,2
MOV AH,Color
OUT dx,ax
;____________________________________
MOV cen_x,160
MOV CH,cen_y
CALL Up_Zac
;____________________________________
MOV cen_x,160
MOV CH,cen_y
INC CH
CALL Down_Zac
MOV Mas,CH
INC CH
@@L_Cen:
SUB cen_x,2
CMP cen_x,126
JLE @@_Out3
CALL Down_Zac
INC CH
JMP @@L_Cen
@@_Out3:
MOV cen_x,127
CALL Down_Zac
MOV CH,Mas
MOV cen_x,160
INC CH
@@R_Cen:
ADD cen_x,2
CMP cen_x,192
JA @@_Out4
CALL Down_Zac
INC CH
JMP @@R_Cen
@@_Out4:
MOV cen_x,193
CALL Down_Zac
MOV AH,00h
INT 16h
;____________________________________
MOV CX,63
@@Nok: CLI
mov dx,3C8h
mov al,Color
out dx,al
mov dx,3C9h
mov ah,63
sub ah,cl
mov al,ah ;Blue
out dx,al
mov al,cl ;Green
out dx,al
mov al,cl ;Red
out dx,al
sti
mov ah,0
int 16h
dec cx
cmp cx,0
jne @@Nok
MOV AH,00h
INT 16h
MOV AH,03h
INT 10h
; ‚л室 Ё§ Їа®Ја_¬¬л ў DOS
INT 21h
code Ends
ret
progr2 endp
codesegment ends
end start