. - 3GL   - 4GL   5GL  

3GL

MS-DOS BIOS (Basic Input/Output System /) , , , . . , , INT :

INT , , , , . , .

, , . 10.1. , .

10.1.




.


. ()


.

DX

/. 32- " "



.
SI ( DS) ( )
DI ( DS) ( )
DS ()
ES

Flags


, , DX 8- , ( 8 ), AL ( 8 ), , BL, CH, CL, DH, DL.

, . -, , .

, , .

: int86(n,&in_regs,&out_regs) ;

intdos(&in_regs,&out_regs); // n=021

: Intr(n,regs);

MSDOS(regs); { n=$21}

interrupt . Intel 8086, 80186, 80286, 80386, 80486.

, "" BIOS, -. 33 (Ox2i=$2i) MS-DOS. 85 .

dos. h :

Struct WORDREGS

{unsigned int ax,t>x, cx,dx, si,di,cflags, flags;} ;

struct BYTEREGS {unsigned char al,ah,bl,bh,cl,ch,dl,dh;};

union REGS {struct WORDREGS x; struct BYTEREGS h;};

REGS in_regs out_regs, intse intdos. , , reg (union REGS reg;), c reg.x. ax, reg.x.bx, reg.h.al, reg.h. ah.

, , AL, . in_regs out_regs, , , . .

Turbo Pascal , . intr MSDOS Registers, DOS :

type

Registers=record case integer of

0: (AX,BX,CX,DX,BP,SI,DI,DS,ES,flags:word);

1: (AL,AH,BL,BH,CL,CH,DL,DH:byte) ; end;

reg (reg:Registers;), reg., RG., reg.AL, reg., ,

, , AL, .

gotoxy, . () movetoxy .

10_1.

#include <dos.h>

void movetoxy(int x, int y, int page)

{

union REGS r;

r.h.ah=2; //

.h.bh=page; // , 0 7

r.h.dl=x; // , 1 80

r.h.dh=y; // , 1 25

int86(0xl0,&r,&r); // BIOS 16

}

10_1.pas

program cursor; uses Dos;

procedure movetoxy(x,y,page:byte);

var

Registers r; begin

r.AH:=2;

r.BH:=page;

r.DL:=x;

r.DH:=y;

Intr ($10, r) ;

end;

, , , 02 ($2A) 0x33 ($33). , , :

AL (0 , 1 , ..., 6 ); DL ; ; .

10_2.

/*0 , 33:42*/

#include <dos.h>

#include <stdio.h>

#include <conio.h>

void DatePrint(void);

void main() (

DatePrint(); getch();

}

/ *----------------------------------* /

void DatePrint(void)

{

char *WeekDays[7]={"","",

"","","","",""};

union REGS r;

r.h.ah=0x2A;

/* */

intdos(&r,&r);

/*DL-, DH-, -, AL- */

printf("\n %d/%d/%d - %s",r.h.dl,r.h.dh,r.x.ex,

WeekDays[r.h.al]); }

10_2.pas

program intl; uses Dos;

procedure DatePrint; const

WeekDays:array [0..6] of string=('','1,

'','','',''); var

r:Registers;

begin

with r do begin

AH:=$2A; { }

MSDOS(r); {DL-, DH-, -, AL- }

write(' ',DL,':',DH:2,':',,' - ');

writeln(WeekDays[AL]);

end;

end;

begin

DatePrint;

readln;

end.

, QBasic , . , DATA, CALL ABSOLUTE. [7] 38 . , (32 ), , , , .

, . , ( ). . . , ( RegAX, RegBx, RegCx, RegDx, , ). ( mov) . ( push, pusha) . ( pop, ) . ret .

. (intoos) , (far - ).

, . , .

0000

IntDos PROC far

/

0000 60

pusha

;

0001 1E

push ds

; ds

0002

push cs

; cs

0003 1F

pop ds

; cs n ds

0004 1 0018

mov ax, RegAX

; RegAX

0007

CD 33


int

33h

; 33h

0009

89 IE

001A

mov

RcgBX,bx

; b

000D

89 0E

001C

mov

RegCX, cx

;

00

89 16

001E

mov

RegDX, dx

; dx

0015

IF


pop

ds

; ds

0016

61


popa

;

0017

CB


ret

;

0018

0000

RegAX

DW

0

;

001A

0000

RegBX

DW

0

;

001C

0000

RegCX

DW

0

;

001E

0000

RegDX

DW

0

; dx



IntDos

ENDP



:

DATA &60,&1,&,&H1F,&1,&18,SH00,&HCD,&,&89

DATA &1,&1,&00,&89,&0,&1,SH00,&H89,&H16,&H1E

DATA &H00,&H1F,&H61,&HCB

32 -intProgd 16) AS" INTEGER. 24

RegAX, RegBX, RegCX RegDX:

DIM IntProgd T0 16) AS INTEGER

' DEF SEG=VARSEG(IntProg(1))

' Int33&=VARPTR(IntProgd) )

' F0R J%=0 T0 23

READ K% : P0KE Int33&+J%,K% NEXT J%

, () . intProg, .

, [7], - . . , - . - int mov RegAX,ax, ( RegDX). RegAX, RegBX, RegCX RegDX . , . . . NOP ( 90h):

0000

IntDos PROC far


0000 60

pus ha


0001 IE

push ds

ds

0002

push cs

cs

0003 IF

pop ds

cs ds

0004 Al 001C

mov ax, RegAX

RegAX

0007 90



0008 CD 33

int 33h

33h

A3 001

mov RegAX, ax


OOOD 89 IE 001E

mov RegBX,bx


89 0020

mov RegCX, ex


0015 89 16 0022

mov RegDX,dx

dx

0019 IF

pop ds

ds

001 61

popa


001

ret


001 0000

RegAX DW 0


001 0000

RegBX DW 0


0020 0000

RegCX DW 0


0022 0000

RegDX DW 0

dx


IntDos ENDP


, td.exe (Turbo Debugger ). Borland-. , .

INT 33h INT 21h :

IntProg(5)=SH21CD

- , INT , . . , , &H21CD . , mov.

, , intProg, RegAX. , . . intProg(1), &1=28 intProg(15). "" ,

, DX

IntProg(15), IntProg(16), IntProg(17)

IntProg(18).

intProg, .

, .

10_2.bas

DATA &60,&1,SH0E,&H1F,&1,&1,&00, &90, &HCD, &

DATA &HA3,&H1C,&H00,&H89,&H1E,&H1E,SH00,SH89,&H0E,&H20

DATA &H00,&H89,&16,&H22,&H00,&H1F,&H61,&HCB

DIM IntProg(1 T0 18) AS INTEGER

'

DEF SEG=VARSEG(IntProg(1))

'

Int33& = VARPTR{IntProg(1))

'

F0R J%=0 T0 27

READ K%: P0KE Int33&+J%,% NEXT J%

IntProg(5)=&H21CD IntProg(15)=&H2A00 CALL ABS0LUTE(Int33&)

F0R K=15 T0 18

PRINT IntProg(K) NEXT WeekDay=IntProg(15) M0D 256: ' = AL

Day=IntProg(18) MOD 256: ' = DL

Month=IntProg(18) 256: ' = DH

Year=IntProg(17): ' = CX

PRINT USING " - ##/##/#### - #";Day;Month;Year;WeekDay

DEF SEG

END


, QBasic , . , MS-DOS Windows. , , , . .

0x33 ($33) 30 , . [16]. . , . . . "Turbo Pascal 7.0. . " [13].

0 "" . , . , , MS-DOS - Windows 95/98, . , , , , (=0). , . . , , .

1 . 2, .

3, (=CX, =DX) (BX=1 , BX=2 , BX=4 ). , . (row) (col):

x=8*(col-l) y=8*(row-l)

, . "" 5- , ( ). . 60 1 , . , . 0 632, 0 192.

10_3.bas

' [7], ' )

DATA &60,SH1E,SH0E,SH1F,&1,&18,SH00,&HCD, &H33,&H89

DATA &H1E,&H1A,&H00,&H89,SH0E,&H1C,&H00,&H89,&H16,&H1E

DATA &H00,&H1F,&H61,&HCB

DIM IntProgd T0 16) AS INTEGER

' DEF

SEG=VARSEG(IntProg(1)}

'

Int33&=VARPTR(IntProg(1))

'

F0R j%=0 T0 23

READ K%: P0KE IntDos&+j%, % NEXT j%

'

CLS

C0L0R 7,1

F0R I=1 11

F0R j%=0 T0 79

PRINT USING "#";j% M0D 10;

NEXT j%

PRINT : PRINT NEXT I COLOR 7,0

IntProg(13)=0: '

CALL ABSOLUTE(Int33&) LOCATE 2,1

IF IntProg(13)=-1 THEN

PRINT " MS-DOS ";

PRINT " = ";

IntProg(14);

SLEEP 5

IntProg(13)=1: '

CALL ABSOLUTE(Int33&)

IntProg(13)=3: '

15:=

16:DX=y

14:= :

' 1 - ,- 2 - , 4 -

FOR j%=l TO 60

CALL ABSOLUTE(Int33&)

LOCATE 4,1

PRINT USING "x=### y=### #";IntProg(15);IntProg(16);

IntProg(14)

SLEEP 1 NEXT j%

LOCATE 6,1: PRINT " . '"

SLEEP DEE SEG END

10_3.

/* */

#include <dos.h>

#include <stdio.h>

#include <conio.h>

void main() (

int i,j;

union REGS r; clrscr () ;

/* */

cextcolor (7); textbackground (1) ;

for(1=1; i<12; i++) {

for(j=0; j<80; j++) cprintf("%d", j%10) ;

printf{"\n"); }

r.x.ax=0;

/* */

int86(0x33,&r,&r);

textbackground(0);

gotoxy(1,2);

if(r.x.ax==0xFFFF) cprintf(" MS-DOS ");

cprintf(" = %d",r.x.bx);

r.x.ax=l; sleep(5);

/* */

int86(0x33,&r,&r); r.x.ax=3;

/* */

for(j=0; j<60; j++) {

int86(0x33,&r,Sr);

gotoxy(1,4);

clreol();

cprintf("x=%d y=%d %d",r.x.ex,r.x.dx,r.x.bx);

sleep(1); }

gotoxy(1,6);

cprintf(" . ' ");

getch (); }

10_3.pas

program intl; uses Crt,Dos;

var

i,j:longint;

r:Registers;

begin

clrscr; { }

textcolor(7);

textbackground(1);

s

for i:=0 to 10 do

begin

for j:=0 to 79 do

write(j mod 10); writeln;

end;

textbackground(0);

{ }

r.AX:=0;

Intr($33,r);

gotoxy(l,2);

if r.AX=$FFFF then write(' MS-DOS ');

write(' = ',r.);

r.AX:=l;

{ }

Intr($33,r); r.AX:=3;

{ }

for j:=1 to 60 do begin

Intr($33,r);

gotoxy(l,4);

clreol;

write('x=',r.CX, ' y=',r.DX, ' =',r.BX);

for i:=0 to 10000000 do i:=i;

end;

gotoxy(1,6); write(' . Enter');

readln;

end.


, 1990 ., - MS-DOS. . " " . . " ".

_ . 21 , BIOS 010. . 10.2. Oxio , , .

10.2.



ask attr (&cs, &cf, sin, sbl)


set attr (cs, cf , in, bl)


ask_cur (&x, &y)


set_ cur(x,y)


move_cur(n)

n

box_abs (rowl, coll, row2, col2, bord, shade)


box rel (rowl, coll, rows, cols, bord, shade)


cl_rect (row, col, rows, cols, color)


s_out (ch)


s_out h (ch, n)

n

s_out v(ch,n)

n

s_box abs (rowl, coll, row2, col2,ch)


s_box rel (rowl, coll, rows, cols, ch)


s_out_ (row, col, nc, str)
s_ out_1 (row, col, nc, str)
s_out_ r (row, col, nc, str )
ask_page ( )
set_page (n)
out_err (str) init_txt ( )

xy_s_out (row, col, ch)


:

:

ask_attr

, , 3.5.5.

int ask_attrtint *cs,int *cf,int *in,int *bl)

// cs - , 0 7

// cf - , 0 7

//in - , 0 1

// b1 - , 0 1

{

=8;

//

BH=_PAGE;

//

INT10h ;

//

_ATTR=AH;

//

__COLOR__S=_ATTR & 0x07;

//

_COLOR_F=(_ATTR & 0x70) >> 4;

//

_INTENS=(_ATTR & 0x08) >> 3;

//

_BLINK=(_ATTR & 0x80) >> 7;

//

*cs=_COLOR__S;

//

*cf=_COLOR_F;

//

*in= INTENS;

//

*b1=_BLINK;

//

return ( ATTR);

//

}

set_attr

void set_attr(int cs,int cf,int in,int b1) {

//

if(cs>=0 && cs<8 && cf>=0 && cf<8 &&

in>=0 && in<2 && bl>=0 && bl<2) {

_COLOR__S=cs ;

_COLOR_F=cf;

_INTENS=in;

_BLINK=bl; //

_ATTR=_BLINK << 7 | _COLOR_F << 4 | _INTENS << 3 | _COLOR__S;

}

else err_out(" set_attr"); }

move_cur

(_ROW_CUR, _COL_CUR), set_cur . , .

void move_cur(int n)

{

int pos;

pos=_ROW_CUR* 80+_COL_CUR+n;

_ROW_CUR=pos/80;

_COL_CUR=pos-_ROW_CUR*8 0;

if(_ROW_CUR > 24)

{

_ROW_CUR=0; _COL_CUR=0;

}

set_cur(_ROW_CUR+1,_COL_CUR+1) ;

}

box_abs

, / "" . lu, id, ru rd , , (lu), (id), (ru) (rd) . horiz vert , . bord rpth rptv .

, (shade=-1) (shade=1) . , set_attr.

void box_abs(int row1,int coll,int row2,int col2, int bord,int shade)

// rowl,coll - ,

// row2,co12 -

// bord - , 0 4

// shade = -1( ), 0(), 1( )

{

char lu[5]={ 0x20,0xDA,09,0xD6,0xD5 };

char ld[5]={ 0x20,0xC0,0xC8,0xD3,0xD4 };

char ru[5]={ 0x20,0xBF,0xBB,0xB7,0xB8 };

char rd[5]={ 0x20,0xD9,0xBC,0xBD,0xBE };

char horiz[5]=( 0x20,0xC4,0xCD,0xC4,0xCD };

char vert[5] ={ 0x20,0,0,0,0 };

int rpth,rptv,attr;

rptv=co12-coll-l;

//

if(rptv <= 0) rptv=l;

rpth=row2-rowl;

//

if{rpth <= 0) rpth=l;

//

if(shade == 1 && coll+rptv >= 79) goto ml;

if(shade ==-1 && coll==l) goto ml;

if(shade != 0 && rowl+rpth >= 25) goto ml;

if(rowl+rpth > 25 || coll+rptv+1 > 80) goto ml;

xy_s_out(rowl,coll,lu[bord]);

//

s_out_h(horiz[bord],rptv);

//

s_out_h(ru[bord],1);

//

set_cur(rowl+1,coll);

//

s_out_v(vert[bord],rpth);

//

set_cur(rowl+1,co!2);

//

s_out_v(vert[bord],rpth);

//

//

sbox_rel(rowl+1,coll+1,rpth,rptv, 32) ;

xy__s_out(row2,coll,Idfbord]);

//

s_out_h(horiz[bord],rptv);

//

s_out_h(rd[bord],1);

//

if(shade == 0) goto m;

//,

attr=_ATTR;

//

set_attr(7,0,0,0);

// ,

if(shade == -1)

//

{

set_cur(rowl+1,coll-1); //

s_out_v{219,rpth+1); //

s_out_h(219,rptv+1); // , }

else // {

set_cur(rowl+1,col2+l); //

s_out_v(219,rpth+1); //

set_cur(row2+l,coll+1); //

s_out_h(219,rptv+1); // }

_ATTR=attr; //

m: set_cur (rowl+1, coll+1) ; //

return;

ml:err_out(" box... "); }

b_r1

(rows) (cols). .

void box__rel(int rowl,int coll,int rows,int cols,int bord,int shade)

// rows,cols -

{

box_abs(rowl,coll,rowl+rows-1,col1+cols-l,bord,shade);

}

cl_rect

void cl_rect(int row,int col,int rows,int cols,int color)

// row, col - ,

// rows, cols - ,

// color - , 0 7

//( RED=4 GREEN=2 BLUE=1 )

{

AL=rows+l; //

=006; //

CH=row-l; //

CL=col-l; //

DH=row+rows-2; //

DL=col+cols2; //

=1*1; //

INT10h;

set_cur(row,col); // }

s_out

void s_out(char s) {

=9; //

AL=s; //

= PAGE; //

BL=_ATTR; //

=1; //

INT10h;

move_cur(1); // 1 }

s_out_h

. .

void s_out_h(char s,int rpt)

// s -

// rpt - {

=9; //

AL=s ;

BH=_PAGE ;

BL=_ATTR;

CX=rpt;

INT10h;

move_cur(rpt); }

s_out_v

. .

void s_out_v(char s,int rpt)

//s-

// rpt -

{

int row,col,i;

row=_ROW_CUR;

col=_COL_CUR;

BH=_PAGE;

DL=col;

BL=_ATTR;

CX=1;

for(i=row; i<row+rpt; i++)

{

AH=2; //

DH=i; //

INT10h;

=9; //

AL=s; //

INT10h;

if(i==25) break;

}

set_cur(i,col+1); // }

sbox_abs

, s_out_h . .

void sbox_abs(int rowl,int coll,int row2,int col2,char s)

// s - -

// rowl,coll -

// row2,col2. -

s_out_c

. , , . .

void st_out__c(int row,int col,int nc,char *string)

// row,col - ,

//nc - ,

// string -

(

int ls,i;

ls=strlen(string);

i=(nc-ls)/2;

if(Is <= nc)

st_out_l(row,col+i,nc,string) ;

else

st_out_l(row,col,nc,&string[i]); }

s_out_l

, , . .

void st_out_l{int row,int col,int nc,char *string)

// row,col - ,

// nc - ,

// string -

{

char s; int i ;

for(i=0; i<nc && string[i] != 0x00; i++)

{

s=string[i]; xy_s_out(row,col+i, s);

}

}

s_out_r

, , , st_out_1. , .

void st_out_r(int row,int col,int nc, char *string)

// row,col - ,

//nc - ,

// string -

{

int ls,i;

ls=strlen(string);

i=nc-ls;

if(Is <= nc)

st_out_l(row,col+i,Is,string);

else

st_out_l(row,col,nc, &string[i] ) ; }

ask__page

_PAGE.

int ask_page(void) {

return (_PAGE); }

set_page

_PAGE, BIOS 5.

void set_page(int p) // - , 0 7 {

if(p>=0 && <8)

{

_PAGE=p;

AH=5;

AL=p;

INT10h; } else err_out(" set_page");

}

err_out

. .

void err_out (char *string) {

set_attr(7,4,1,1);

st_out_l(25,1,80,string);

getch(); }

init_txt text_box

void init_txt (void)

/*********************************************/

/* : */

/* -25x80 */

/* - 8 14 */

/*********************************************/

{

extern union REGS reg;

AH=0;

AL=2 ;

INT10h; /* */

set_page(0); /* 0- */

set_cur(1,1); /* - */

set_attr(7,0,0,0);/* */

=9;

AL=32; /* */

BL=7; /* */

=0; /* 0- */

=2000;

INT10h ; /* */

}

tst_text text_box

, :

#include "text.h"

void main() {

init_txt();

set_attr(4,2,1,0); // ,

box_abs(2,2,10,30,4,1); //

getch();

move_cur(2); //

getch();

s_out(''); //

getch();

s_out_h('',3); //

getch();

s_out_v('',4); //

getch();

cl_rect(3,3,7,27,4) ; //

getch();

set_attr(7,1,0,1);

box_rel(13, 40,8,28,4,-1);//

getch();

set_attr(7,1,0,0);

sbox_rel(14,41,6,26,' 7 ') ;

getch();

st_out_l(13,5,16,"1234567890123456"); //

st_out_l(14,5,16," "); //

getch();

st_out_l(14,5,16,""); //

getch();

st_out_l(15,5,16," "); //

getch();

st__out_c (15, 5,16, "") ; // getch();

st_out 1(16,5,16," "}; //

getch ();

st_out_r(16,5,16,""); //

getch () ; }

text.h:

#include <conio.h>

#include <dos.h>

#include <string.h>

union REGS reg;

#define AH reg.h.ah

#define AL reg.h.al

#define BH reg.h.bh

#define BL reg.h.bl

#define CH reg.h.ch

#define CL reg.h.cl

#define CX reg.x.ex

#define DL reg.h.dl

#define DH reg.h.dh

#define INTlOh

int86(0x10,&reg,Sreg)

unsigned char

_PAGE,_ATTR,_COLOR_S,_COLOR_F,_INTENS,_BLINK;

unsigned ctear _ROW_CUR,_COL_CUR;

int ask__attr (int *cs,int *cf, int *in,int *bl) ;

void ask_cur (int *r, int *c) ;

int ask_page (void);

void box_abs(int rowl,int coll,int row2,int col2, int bord,int shade);

void box_rel(int rowl,int coll,int rows,int cols, int bord,int shade);

void cl_rect(int rowl,int coll, int rows, int cols, int color) ;

void err_out(char *string);

void init txt (void);

void move_cur (int n) ;

void s_out (char s);

void s_out_h (char s,int rpt) ;

void s_out_v (char s,int rpt);

void sbox_abs (int row1,int coll,int row2,int col2,char s) ;

void sbox rel (int rowl,int coll,int rows,int cols,char s) ;

void set_attr (int cs,int cf,int in,int b1);

void set_cur (int r,int c);

void set_page (int p);

void st_out_c (int row,int col,int nc, char *string);

void st_out_l (int row,int col,int nc, char *string);

void st__out_r (int row, int col, int nc, char *string);

void xy_s_out (int row,int col,char s);

, tlib.exe . .

      . - 3GL   - 4GL   5GL  

, , Encapsulation - .In - + Capsula - , - - . , .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution