Re: HLA v1.86 is now available



On 26 Jul 2006 11:28:58 -0700, "randyhyde@xxxxxxxxxxxxx" wrote:
...
you're just sick (like Rene). We'll leave it at that.

As for the argument for making students write their own routines, just
keep in mind that every minute they spend writing an integer to string
conversion routine is one minute they aren't spending learning machine
instructions and other true assembly stuff.

Open TAOCP, Vol.2, Section 4.4, p. 321. There is a description how to
write such a routine.

If a student is told to read that page, and write a routine in x86 asm
based on it, he will probably come up with something close to that:

;;
Calling sequence: call 'gpl32.dec2mem'
Entry conditions: EAX = Integer to add to string, EDI -> string.
Exit conditions: Integer converted to ASCII and added to string.
;;
align 16
subrt dec2mem:
push eax ebx ecx edx
; Extract leading digit.
mov ebx 1_000_000_000
xor edx edx | div ebx
or al 030 | mov b$edi al
; Other digits go into eax with the radix point at the left.
mov eax ebx, ebx (-9)
div eax
; Multiply out the other digits and add them to string.
S1: mul d${d$ 10} | or dl 030 | mov b$edi+10+ebx dl
inc ebx | js S1
; Add a space and adjust string pointer.
mov b$edi+10 ' ' | add edi 11
pop edx ecx ebx eax
ret
ends dec2mem

You dare to call Herbert sick, but it's you who needs a doctor,
because only someone very sick can believe that a student would have
learned nothing about machine instructions after doing that!
--
wfz
.



Relevant Pages

  • Re: Date Subtraction Routines
    ... days in EAX). ... we are not passing the 'date' information to this routine - we are ... where to find it - and the routine subtracts some amount of 'days' ... mov(theDate, ebx); ...
    (alt.lang.asm)
  • Here is some Macros for benchmarking code.
    ... rdtsc | pop ecx ebx | sub eax ebx ... Say you have created a routine that take no parameters. ... mov eax PSeudoParticles ... RunBenchMark 10000 RoutineToBeTested ...
    (alt.lang.asm)
  • Re: What is this code doing?
    ... Randall Hyde wrote: ... > takes between three and five weeks for the average student. ... > abc ebx 10 ... > ALREADY KNOW SOME MACHINE INSTRUCTIONS ...
    (alt.lang.asm)