; MB.ASM
; Grooms D. L.

. 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 'PRIHOD',0
LABEL2 DB 'RASHOD',0
title1 db' Name Quantity', 0

ukeys1 db 1Eh, 0
ukeys2 db 1Fh, 0
skeys1 db 'ENTER',0
NKEYS1 DB 'VVEDI',0
skeys2 db 'INS',0
NKEYS2 DB 'NOVYY',0
skeys3 db 'DEL',0
NKEYS3 DB 'UDALI',0
skeys4 db 'F5',0
NKEYS4 DB 'PECHAT',0
skeys5 db 'F6',0
NKEYS5 DB 'PORYAD',0
skeys6 db 'F7',0
NKEYS6 DB 'POISK',0
skeys7 db 'F8',0
NKEYS7 DB 'SUMMA',0
skeys8 db 'F10',0
NKEYS8 DB 'MENYU',0
skeys9 db 'ESC',0
NKEYS9 DB 'VYYDI',0

;---Head procedure
func main
; Stack
cli
mov SP, size_com+len_stack
sti
; I open system
farrelease <* CS of 00,00 size_com+len_stack+len_vars>
initcon
release <* size_com+len_stack, 0>
initsys
initmouse
cursor_off
; I draw the main shot
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>>>
; Menyu-stroka
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>
; I open the file
recopen <@ rec_A,@ file_A, len_A>
getmem <len_A>, <buf_A>; recbuffer
recempty <@ rec_A,@ _mb_empty>
; I work with the file
color <MainAttr>
mov done, TRUE
while <done e TRUE>
dbedit <@ rec_A, 0, 3,79,23,@ cs:__pic,@ cs: __ fuser>
endwh
; I close the file
freemem <* buf_A>
recclose <@ rec_A>
; I close the other
mkeys_of
; I close system
mouse_off
cursor_on
; An exit from the program
clrscr
halt <0>
endf
END START



Advertising on the site