R
Romiros
Здравствуйте - вот исзодник программы! Помогите пожалуйста поправить: мне нужно чтобы при нажатии на ентер не открывалось окно с ещё одним меню - а переходило бы на процедуру!
Вот исходник!
.model small
.code
P1 db ' Rabota 1$'
P2 db ' Rabota 2$'
P3 db ' Rabota 3$'
lencur db $-P3
TabAdr dw p1, p2, p3
len_adr=($-tabAdr)/2
TabKey db 48h, 50h, 01h, 1ch
Lenkey=$-TabKey
buf db 4000 dup(?)
Menu0:
str0_ db 9
stb0_ db 9
lvuStr0 db 7
LvuStb0 db 7
PnuStr0 db 13
PnuStb0 db 20
atrcur0 db 00011110b
atrfon0 db 00010111b
TabProc0 dw StrUp, StrDn, Esc_, enter_in
Menu1:
str1_ db 3
stb1_ db 20
lvuStr1 db 1
LvuStb1 db 18
PnuStr1 db 7
PnuStb1 db 30
atrcur1 db 01110000b
atrfon1 db 00010111b
TabProc1 dw StrUp, StrDn, Escp1, enter_
Menu2:
str2_ db 9
stb2_ db 20
lvuStr2 db 8
LvuStb2 db 18
PnuStr2 db 12
PnuStb2 db 31
atrcur2 db 01100000b
atrfon2 db 01010110b
TabProc2 dw StrUp, StrDn, Escp1, enter_
Menu3:
str3_ db 13
stb3_ db 20
lvuStr3 db 12
LvuStb3 db 18
PnuStr3 db 16
PnuStb3 db 31
atrcur3 db 01100000b
atrfon3 db 01010111b
TabProc3 dw StrUp, StrDn, Escp1, enter_
@Menu:
str_ db ?
stb_ db ?
lvuStr db ?
LvuStb db ?
PnuStr db ?
PnuStb db ?
atrcur db ?
atrfon db ?
TabProc dw ?,?,?,?
@lenmenu = $-@menu
start:
push @data
pop ds
lea si, Menu0
lea di, @Menu
call ChangeParams
mov ax, 0003h
int 10h
.code
push cs
pop ds
lea Si, Menu0
lea di, @Menu
call ChangeParams
Esc1:
call Pyatno
call MenuWR
xor cx, cx
xor si,si
xor dx,dx
Key:
mov cx, lenkey
xor bx,bx
mov ah,0
int 16h
KeyC:
cmp ah, TabKey[bx]
je KeyGo
inc bx
loop KeyC
jmp Key
KeyGo:
push bx
shl bx,1
call TabProc[bx]
jmp Key
pop bx
StrUp:
mov bl, atrfon
call ReadWrite
cmp Si, 0
je mz
dec str_
sub si,2
mov bl, atrcur
call ReadWrite
jmp Key
mz:
mov si,4
add str_,2
mov bl, atrcur
call ReadWrite
jmp Key
StrDn:
mov bl,atrfon
call ReadWrite
cmp si,4
je dn
inc Str_
add si,2
mov bl, atrcur
call ReadWrite
jmp Key
dn:
mov si, 0
sub str_, 2
mov bl, atrcur
call ReadWrite
jmp Key
enter_in:
call SaveScreen
cmp Si,0
je M1
cmp Si,2
je M2
cmp Si,4
je M3
M1:
push si
push di
lea si, Menu1
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
M2:
push si
push di
lea si, Menu2
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
M3:
push si
push di
lea si, Menu3
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
Enter_:
mov bl,atrfon
call ReadWrite
Call ResetScr
lea Si, Menu0
lea di, @Menu
call ChangeParams
mov si,0
mov di,0
jmp Key
Escp1:
call ResetScr
lea Si, Menu0
lea di, @Menu
call ChangeParams
mov si,0
mov di,0
jmp Key
Esc_:
mov ah, 4ch
int 21h
;-------- Procedures--------
; процедура записи пунктов меню на экран в позицию курсора
MenuWR proc
mov cx, len_adr
xor bx,bx
mov bh,0
mov dh, str_
mov dl, stb_
mwr:
mov ah,2h
int 10h
push dx
mov ah, 9h
mov dx, TabAdr[bx]
int 21h
pop dx
inc dh
inc bx
inc bx
loop mwr
ret
MenuWR endp
Pyatno proc
mov ah,06h
mov ch, lvustr
mov cl, Lvustb
mov dh, pnustr
mov dl, pnustb
mov al, 00h
mov bh, atrfon
int 10h
Pyatno endp
ReadWrite proc
mov cl, lencur
mov dh, str_
mov dl, stb_
mov ah, 2
int 10h
rw:
push cx
mov cx,1
mov ah,8h
int 10h
mov ah, 9h
int 10h
inc dl
mov ah, 2h
int 10h
pop cx
loop rw
ret
ReadWrite endp
ChangeParams proc
mov cx, @Lenmenu
cp: mov al, [si]
mov [di], al
inc si
inc di
loop cp
ret
ChangeParams endp
savescreen proc
mov ax, 0b800h
mov es, ax
mov cx, 4000
mov bx, 0
SSc: mov al, es:[bx]
mov buf[bx], al
inc bx
loop SSc
ret
savescreen endp
ResetScr proc
mov bl,atrfon
call ReadWrite
mov cx, 4000
mov bx, 0
RS: mov al, buf[bx]
mov es:[bx], al
inc bx
loop RS
ret
ResetScr endp
end start
Вот исходник!
.model small
.code
P1 db ' Rabota 1$'
P2 db ' Rabota 2$'
P3 db ' Rabota 3$'
lencur db $-P3
TabAdr dw p1, p2, p3
len_adr=($-tabAdr)/2
TabKey db 48h, 50h, 01h, 1ch
Lenkey=$-TabKey
buf db 4000 dup(?)
Menu0:
str0_ db 9
stb0_ db 9
lvuStr0 db 7
LvuStb0 db 7
PnuStr0 db 13
PnuStb0 db 20
atrcur0 db 00011110b
atrfon0 db 00010111b
TabProc0 dw StrUp, StrDn, Esc_, enter_in
Menu1:
str1_ db 3
stb1_ db 20
lvuStr1 db 1
LvuStb1 db 18
PnuStr1 db 7
PnuStb1 db 30
atrcur1 db 01110000b
atrfon1 db 00010111b
TabProc1 dw StrUp, StrDn, Escp1, enter_
Menu2:
str2_ db 9
stb2_ db 20
lvuStr2 db 8
LvuStb2 db 18
PnuStr2 db 12
PnuStb2 db 31
atrcur2 db 01100000b
atrfon2 db 01010110b
TabProc2 dw StrUp, StrDn, Escp1, enter_
Menu3:
str3_ db 13
stb3_ db 20
lvuStr3 db 12
LvuStb3 db 18
PnuStr3 db 16
PnuStb3 db 31
atrcur3 db 01100000b
atrfon3 db 01010111b
TabProc3 dw StrUp, StrDn, Escp1, enter_
@Menu:
str_ db ?
stb_ db ?
lvuStr db ?
LvuStb db ?
PnuStr db ?
PnuStb db ?
atrcur db ?
atrfon db ?
TabProc dw ?,?,?,?
@lenmenu = $-@menu
start:
push @data
pop ds
lea si, Menu0
lea di, @Menu
call ChangeParams
mov ax, 0003h
int 10h
.code
push cs
pop ds
lea Si, Menu0
lea di, @Menu
call ChangeParams
Esc1:
call Pyatno
call MenuWR
xor cx, cx
xor si,si
xor dx,dx
Key:
mov cx, lenkey
xor bx,bx
mov ah,0
int 16h
KeyC:
cmp ah, TabKey[bx]
je KeyGo
inc bx
loop KeyC
jmp Key
KeyGo:
push bx
shl bx,1
call TabProc[bx]
jmp Key
pop bx
StrUp:
mov bl, atrfon
call ReadWrite
cmp Si, 0
je mz
dec str_
sub si,2
mov bl, atrcur
call ReadWrite
jmp Key
mz:
mov si,4
add str_,2
mov bl, atrcur
call ReadWrite
jmp Key
StrDn:
mov bl,atrfon
call ReadWrite
cmp si,4
je dn
inc Str_
add si,2
mov bl, atrcur
call ReadWrite
jmp Key
dn:
mov si, 0
sub str_, 2
mov bl, atrcur
call ReadWrite
jmp Key
enter_in:
call SaveScreen
cmp Si,0
je M1
cmp Si,2
je M2
cmp Si,4
je M3
M1:
push si
push di
lea si, Menu1
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
M2:
push si
push di
lea si, Menu2
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
M3:
push si
push di
lea si, Menu3
lea di, @Menu
call changeParams
pop di
pop si
jmp esc1
Enter_:
mov bl,atrfon
call ReadWrite
Call ResetScr
lea Si, Menu0
lea di, @Menu
call ChangeParams
mov si,0
mov di,0
jmp Key
Escp1:
call ResetScr
lea Si, Menu0
lea di, @Menu
call ChangeParams
mov si,0
mov di,0
jmp Key
Esc_:
mov ah, 4ch
int 21h
;-------- Procedures--------
; процедура записи пунктов меню на экран в позицию курсора
MenuWR proc
mov cx, len_adr
xor bx,bx
mov bh,0
mov dh, str_
mov dl, stb_
mwr:
mov ah,2h
int 10h
push dx
mov ah, 9h
mov dx, TabAdr[bx]
int 21h
pop dx
inc dh
inc bx
inc bx
loop mwr
ret
MenuWR endp
Pyatno proc
mov ah,06h
mov ch, lvustr
mov cl, Lvustb
mov dh, pnustr
mov dl, pnustb
mov al, 00h
mov bh, atrfon
int 10h
Pyatno endp
ReadWrite proc
mov cl, lencur
mov dh, str_
mov dl, stb_
mov ah, 2
int 10h
rw:
push cx
mov cx,1
mov ah,8h
int 10h
mov ah, 9h
int 10h
inc dl
mov ah, 2h
int 10h
pop cx
loop rw
ret
ReadWrite endp
ChangeParams proc
mov cx, @Lenmenu
cp: mov al, [si]
mov [di], al
inc si
inc di
loop cp
ret
ChangeParams endp
savescreen proc
mov ax, 0b800h
mov es, ax
mov cx, 4000
mov bx, 0
SSc: mov al, es:[bx]
mov buf[bx], al
inc bx
loop SSc
ret
savescreen endp
ResetScr proc
mov bl,atrfon
call ReadWrite
mov cx, 4000
mov bx, 0
RS: mov al, buf[bx]
mov es:[bx], al
inc bx
loop RS
ret
ResetScr endp
end start