Real mode assembly III: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
m Bot: Replace deprecated source tag with syntaxhighlight
 
Line 5:
==Timing: Fun in a Few Interrupts==
 
<sourcesyntaxhighlight lang="asm">
xor ax,ax
int 1Ah
</syntaxhighlight>
</source>
 
That little sprig of code grabs the timer ticks since midnight in CX:DX. It's a great seed for generating random numbers. Think what would happen if you threw in some things like this:
 
<sourcesyntaxhighlight lang="asm">
ror dx,2
shr cx,3
xchg dl,dh
</syntaxhighlight>
</source>
 
You could use them in conjunction with some other instructions (think multiplying, adding, subtracting, etc.) to really create a random number.