; MB.ASM
; Конюхов Д.Л.
.MODEL SMALL
include msystem.mac
include sys.mac
include conio.mac
include mouse.mac
include mem.mac
include kbd.mac
include math.mac
include cursor.m
include window.m
include color.m
include rec.m
include dbedit.m
include say.m
include read.m
include key.m
include mkeys.m
include mb.m
size_com = 20000+256
len_stack= 20000
len_vars = 20000
.CODE
BEGIN START,100h,_main,{
func mb_empty,,<SI>
mov SI, buf_A
memfill <32,@ DEBET_NAME,LEN_NAME>
memfill < 0,@ DEBET_QUAN,LEN_QUAN>
memfill <32,@ KREDIT_NAME,LEN_NAME>
memfill < 0,@ KREDIT_QUAN,LEN_QUAN>
endf
func _pic,<byte X,byte Y>,<SI>,1,public
old_color EQU [BP]-1
getcolor ,<old_color>
mov SI, buf_A
setcolor <DebAttr>
sayxy <X,Y,@ space,@ f_s>
setcolor <old_color>
say <@ DEBET_NAME,@ f_name>
setcolor <DebAttr>
say <@ space,@ f_s>
setcolor <old_color>
say <@ DEBET_QUAN,@ f_quan>
setcolor <DebAttr>
say <@ space,@ f_s>
setcolor <KreAttr>
say <@ space,@ f_s>
setcolor <old_color>
say <@ KREDIT_NAME,@ f_name>
setcolor <KreAttr>
say <@ space,@ f_s>
setcolor <old_color>
say <@ KREDIT_QUAN,@ f_quan>
setcolor <KreAttr>
say <@ space,@ f_s>
setcolor <old_color>
endf
func _fuser,<byte mode,word RecCur>,<DI>,1,public
old_color EQU [BP]-1
mov DI, 1
mov AL, cs:mode
switch AL,<0,1>
case 1 { ; draw
getcolor ,<old_color>
setcolor <LblAttr>
reccount <@ rec_A>,<ii>
sayxy <35, 2,@ ii,@ f_w4>
recrecno <@ rec_A>,<ii>
sayxy <41, 2,@ ii,@ f_w4>
setcolor <old_color>
case 2 {
mov retr_cho, TRUE
while <retr_cho e TRUE> {
mov retr_cho, FALSE
mkeys_to
mov AL, cs:key_AL
switch AL,<NULLKEY,SPACEKEY,CRKEY,ESCKEY> {
case 1 {
mov AH, cs:key_AH
switch AH,<INSKEY,DELRKEY,F6KEY,F7KEY,F8KEY,F10KEY>
case 1 ; insert
Inserting ,<DI>
case 2 ; delete
Deleting ,<DI>
case 3 ; sort
Sorting ,<DI>
case 4 ; find
case 5 ; date
Dating ,<DI>
case 6 ; menu
menupull
mov DI, 3
endcase
case 2 { ; mark
case 3 ; input
Inputing <RecCur>,<DI>
case 4 ; exit
mov done, FALSE
mov DI, 0
endcase
endwh }
endcase
endf <word DI>
label1 db 'ПРИХОД',0
label2 db 'РАСХОД',0
title1 db ' Hаименование Количество',0
ukeys1 db 1Eh,0
ukeys2 db 1Fh,0
skeys1 db 'ENTER',0
nkeys1 db 'ВВЕДИ',0
skeys2 db 'INS',0
nkeys2 db 'HОВЫЙ',0
skeys3 db 'DEL',0
nkeys3 db 'УДАЛИ',0
skeys4 db 'F5',0
nkeys4 db 'ПЕЧАТ',0
skeys5 db 'F6',0
nkeys5 db 'ПОРЯД',0
skeys6 db 'F7',0
nkeys6 db 'ПОИСК',0
skeys7 db 'F8',0
nkeys7 db 'СУММА',0
skeys8 db 'F10',0
nkeys8 db 'МЕHЮ',0
skeys9 db 'ESC',0
nkeys9 db 'ВЫЙДИ',0
;--- Головная пpоцедуpа
func main
; Стек
cli
mov SP, size_com+len_stack
sti
; Откpываю систему
farrelease <* CS 00,00 size_com+len_stack+len_vars>
initcon
release <* size_com+len_stack,0>
initsys
initmouse
cursor_off
; Рисую главный кадp
setcolor <<<byte ptr MainAttr>>>
drawbox <cs:ScrnMinX,cs:ScrnMinY,cs:ScrnMaxX,cs:ScrnMaxY,@
box_main>
drawbox < 0, 2,79, 2,@ box_main>
mouse_on
setcolor <LblAttr>
sayxy <16, 0,@ label1,@ f_s>
sayxy <56, 0,@ label2,@ f_s>
setcolor <DebAttr>
sayxy < 0, 1,@ title1,@ f_s>
setcolor <KreAttr>
say <@ title1,@ f_s>
setcolor <<<byte ptr MainAttr>>>
; Меню-стpока
color <MenuAttr>
mkeys_on <TRUE>
mkeys_fr <79, 0,PGUPKEY*100h,@ ukeys1,@ snull>
mkeys_fr <79,24,PGDNKEY*100h,@ ukeys2,@ snull>
mkeys_fr < 4,24,CRKEY,@ skeys1,@ nkeys1>
mkeys_fr <14,24,INSKEY*100h,@ skeys2,@ nkeys2>
mkeys_fr <22,24,DELRKEY*100h,@ skeys3,@ nkeys3>
mkeys_fr <30,24,F5KEY*100h,@ skeys4,@ nkeys4>
mkeys_fr <37,24,F6KEY*100h,@ skeys5,@ nkeys5>
mkeys_fr <44,24,F7KEY*100h,@ skeys6,@ nkeys6>
mkeys_fr <51,24,F8KEY*100h,@ skeys7,@ nkeys7>
mkeys_fr <58,24,F10KEY*100h,@ skeys8,@ nkeys8>
mkeys_fr <65,24,ESCKEY,@ skeys9,@ nkeys9>
mkeys_on <FALSE>
; Откpываю файл
recopen <@ rec_A,@ file_A,len_A>
getmem <len_A>,<buf_A> ;recbuffer
recempty <@ rec_A,@ _mb_empty>
; Работаю с файлом
color <MainAttr>
mov done, TRUE
while <done e TRUE>
dbedit <@ rec_A, 0, 3,79,23,@ cs:__pic,@ cs:__fuser>
endwh
; Закpываю файл
freemem <* buf_A>
recclose <@ rec_A>
; Закpываю пpочее
mkeys_of
; Закpываю систему
mouse_off
cursor_on
; Выход из пpогpаммы
clrscr
halt <0>
endf
END START
|