home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PAS_0593
/
AAMFUN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-30
|
1KB
|
37 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 262 of 314
From : Sean Palmer 1:104/123.0 11 May 93 16:06
To : All
Subj : Fun with AAM
────────────────────────────────────────────────────────────────────────────────
I've been playing around with the AAM instruction and came up with some
things you guys might find useful...}
function div10(b:byte):byte;assembler;asm
mov al,b; aam; mov al,ah;
end;
function mod10(b:byte):byte;assembler;asm
mov al,b; aam;
end;
type
str2=string[2];
str8=string[8];
function toStr2(b:byte):str2;assembler;asm {only call with b=0~99}
les di,@RESULT; cld; mov al,2; stosb;
mov al,b; aam; xchg ah,al; add ax,$3030; stosw;
end;
{makes date string in MM/DD/YY format from m,d,y}
function toDateStr(m,d,y:byte):str8;assembler;asm {only call with m,d,y=0~99}
les di,@RESULT; cld; mov al,8; stosb;
mov al,m; aam; xchg ah,al; add ax,$3030; stosw;
mov al,'/'; stosb;
mov al,d; aam; xchg ah,al; add ax,$3030; stosw;
mov al,'/'; stosb;
mov al,y; aam; xchg ah,al; add ax,$3030; stosw;
end;
{strings as function results are WIERD with the inline Assembler. 8)}