Форумчанин
Регистрация: 09.11.2009
Сообщений: 669
|
Вывести инициалы на ассемблере
Всем доброго времени суток, на этот раз прошу помощи у мастеров ассемблера, помогите пожалуйста разобраться в этом коде, я делал по аналогии с другими инициалами, исходник вот такой:
Код:
type
TPolyParm=record
color: byte;
h: byte;
st1: longint;
st2: longint;
k1,k2: longint;
a1, a2: longint;
end;
const
MyPolyParm: array [0..9] of TPolyParm=
((color: 14; h:105;
st1: (320*50+120) shl 16;
st2: (320*50+120) shl 16;
k1: 319 shl 16 + 30000;
k2: 319 shl 16 + 40000;
a1: 65536 div 170;
a2: 65536 div 160),
(color: 14; h:105;
st1: (320*50+190) shl 16;
st2: (320*50+190) shl 16;
k1: 319 shl 16 + 85000;
k2: 319 shl 16 + 100000;
a1: -65536 div 170;
a2: -65536 div 160),
(color: 14; h:60;
st1: (320*50+120) shl 16;
st2: (320*50+120) shl 16;
k1: 319 shl 16 + 110000;
k2: 319 shl 16 + 130000;
a1: -65536 div 170;
a2: -65536 div 160),
(color: 14; h:60;
st1: (320*50+190) shl 16;
st2: (320*50+190) shl 16;
k1: 319 shl 16 + 10000;
k2: 319 shl 16 + 30000;
a1: 65536 div 170;
a2: 65536 div 160),
(color: 14; h:55;
st1: (320*50+75) shl 16;
st2: (320*50+80) shl 16;
k1: 319 shl 16 + 32768;
k2: 320 shl 16+ 3000;
a1: -65536 div 50;
a2:-(65536*2) div 60),
(color: 14; h:55;
st1: (320*100+22) shl 16;
st2: (320*100+30) shl 16;
k1: 321 shl 16 + 32768;
k2: 322 shl 16 + 3000;
a1: -65536 div 50;
a2: -65536*2 div 50),
(color: 14; h:105;
st1: (320*50+19) shl 16;
st2: (320*50+30) shl 16;
k1: 320 shl 16;
k2: 320 shl 16;
a1: 0;
a2: 0),
(color: 14; h:55;
st1: (320*50+245) shl 16;
st2: (320*50+255) shl 16;
k1: 318 shl 16 + 0000;
k2: 318 shl 16 + 0000;
a1: 65536 div 12;
a2: 65536 div 12),
(color: 14; h:55;
st1: (320*50+260) shl 16;
st2: (320*50+270) shl 16;
k1: 319 shl 16 + 210000;
k2: 319 shl 16 + 210000;
a1: -65536 div 12;
a2: -65536 div 12),
(color: 14; h:105;
st1: (320*50+254) shl 16;
st2: (320*50+266) shl 16;
k1: 320 shl 16;
k2: 320 shl 16;
a1: 0;
a2: 0));
function Get_Time:longint;
assembler;
asm
xor ah,ah
int 1Ah
mov ax,dx
mov dx,cx;
end;
var start_time,end_time,counter:longint;
kh1, kh2,kl1,kl2,ah1,ah2,al1,al2: word;
vm,pn:byte;
period:real;
begin
writeln('enter period of test (sec)');
readln(period);
start_time:=Get_Time;
end_time:=round(start_time+period*18.2);
counter:=0;
asm
{SAVE VIDEO regime}
mov ah,0Fh
int 10h
mov vm,al
mov pn,bh
mov ax, 13h
int 10h
mov ax,$A000
mov es,ax
end;
while Get_Time<end_time do
begin
asm
CLD
mov si, offset(MyPolyParm)
mov cx,10
@NextPoly:
push cx
mov al,[si+TPolyParm.color]
mov cl, [si+TPolyParm.h]
xor ch,ch
mov dx, [si+ TPolyParm.st1.word]
mov di, [si +TPolyParm.st1.word+2]
mov bx, [si+TPolyParm.k1.word]
mov kl1, bx
mov bx, [si+TPolyParm.k1.word+2]
mov kh1,bx
mov bx, [si+ TPolyParm.k2.word]
mov kl2,bx
mov bx, [si+ TPolyParm.k2.word+2]
mov kh2, bx
mov bx, [si+TPolyParm.a1.word]
mov al1,bx
mov bx,[si+TPolyParm.a1.word+2]
mov ah1,bx
mov bx,[si+TPolyParm.a2.word]
mov al2,bx
mov bx,[si+TPolyParm.a2.word+2]
mov ah2,bx
mov bx, [si +TPolyParm.st2.word]
push si
mov si, [si+TPolyParm.st2.word+2]
@NextLine:
push cx
mov cx,si
sub cx,di
JNC @NC
xor cx,cx
@NC: inc cx
shr cx,1
push di
shr dx,1
js @nechet
{ push cx
mov cx,1 }
stosb
{ pop cx }
@nechet:
rep stosw
pop di
shl dx,1
add dx, kl1
adc di, kh1
add bx,kl2
adc si,kh2
mov cx,al1
add kl1,cx
mov cx,ah1
adc kh1,cx
mov cx,al2
add kl2,cx
mov cx,ah2
adc kh2,cx
pop cx
loop @NextLine
pop si
add si, type (TPolyParm)
pop cx
dec cx
JNZ @NextPoly
end;
inc(counter);
end;
writeln('FPS=',counter/period:5:2);
asm
{Restore VIDEO regime}
{xor ah,ah
mov ah,5
mov al,pn
int 10h}
end;
readln;
end .
Кому не трудно объясните пожалуйста каким образом тут организован таймер и если не трудно коментарии к коду не могли бы сделать?
Наверна могут не так понять, поясять что тако mov, что такое xor и т.д. не нужно, я это знаю, мне не понятно каким образом это ввобще все делается.
Я не всегда знаю, о чем говорю, но знаю, что прав. © Мухаммед Али.
К чёрту обстоятельства. Я создаю возможности. © Брюс Ли
Последний раз редактировалось Marsel737; 27.11.2009 в 19:06.
|