How to get Nudds laid! 
Author Message
 How to get Nudds laid!

: >   You have?  You are undoubtedly referring to Alicia Carla Longstreets
: > program that sends a line feed to the printer.  She challenged me to
: > produce a smaller version of the program.  I seem to remember that my
: > program was 2.6 times smaller than hers.


: And your program did not use even 1 byte lestt disk space, it did not
: takes even 1/10 of a second less time to execute, and it was not as
: flexible or as maintainable.

  Alicia Carla Longstreet is correct, the program didn't use any less
disk space since both programs fit into a single sector.  Longstreet
is being dishonest of course in claiming that this is in any way
relevant to the efficiency of her code.  The fact remains that her
bloated sloth code was reduced in size by a factor of 2.4. and its speed
of execution was increased by a similar amount.

  Alicia Carla Longstreet hides behind the fact that both programs
execute un under 1/10th of a second.  This is of course irrelevant.  She
set the challenge, (program size and efficiency), and she lost.  Her
14 line program was 2.4 times larger and at least a factor of 2 slower
than its replacement.

  A reduction of 2.4 on a 14 line program shows that Alicia's code
sufferes from extreme bloat.

  As for flexability, the problem was to send a line feed to the
printer.  Both programs perform this task.

  Longstreets code however contains a logic error since it assumes that
there will be no error when it tries to open a file/device.

  If there is no printer port attached for example, Longstreets code
sends a linefeed to an undefined file handle.


: Okay Scott I am going to call your bluff.

: You said you could take any 'C' program and increase it speed 2-fold and
: decrease its code size by, at least, a factor of 2.  So put you assembly
: where you mouth and improve on this code.

  Trivial...  > factors of 2 everywhere...

INCLUDE C:\MASM\MYDEFS.INC

    COMTOP CSEG

 PRINT_CODES:
   OMOV DX,PRN_NAME   ; point to the printer's device name
   MOV  AX,03D01H     ; MSDOS codes for "open for writing"
   INT  DOS           ; call MSDOS to open the printer device
   XCHG BX,AX         ; swap the printer's open-file handle into BX
   OMOV DX,CODES      ; point to the codes we are outputting
   MOV  CX,CLEN       ; load the number of code bytes
   MOV  AH,040H       ; MSDOS code for "write"
   INT  DOS           ; write the codes to the printer
   MOV  AX,04C00H     ; MSDOS codes for "successful process termination"
   INT  DOS           ; go back to the operating system

 PRN_NAME   DB 'PRN',0

 CODES   DB 0CH            ; single form-feed for the PAGE program
 CLEN   EQU $-CODES

;Oh golly! My code is below
; Your code 30 bytes   -   12 instructions
; My code   11 BYTES   -    5 INSTRUCTIONS
;           30/11 = 2.7   12/5 = 2.4

;  MOV AL,5            ; WILL OUTPUT CHAR TO PRINTER
;  MOV DL,0CH          ; CHAR TO OUTPUT = FORM FEED
;  INT DOS             ; OUTPUT CHAR TO PRINTER
;  MOV AX,04C00H       ; RETURN TO DOS WITHOUT ERROR
;  INT DOS

COMBOT CSEG

; I'm afraid I'm going to have to critique your assembler code...

: PRINT_CODES:
:   MOV  DX,PRN_NAME   ; point to the printer's device name
                 <<< mov dx,prn_name => ptr = prn_name[0]
                     you should have used mov dx, &prn_name.

:   MOV  AX,03D01      ; MSDOS codes for "open for writing"
                 <<< no hex specifier.

:   INT  33            ; call MSDOS to open the printer device
                 <<< form: int # should be hex.

:   XCHG BL,AX         ; swap the printer's open-file handle into BX
                 <<< error:  You can not exchange a byte with a word
                 <<< warning: prn may already be open.  You must test
                     for this condition and avoid the remainder of the
                     code if open fails.

:   MOV  DX,CODES      ; point to the codes we are outputting
                 <<< mov dx,codes => ptr = codes[0]
                     you should have used mov dx, &codes.

:   MOV  CX,LENGTH     ; load the number of code bytes
                 <<< error: length is a reserved word.

:   MOV  AH,040        ; MSDOS code for "write"
                 <<< warning/error: value should be hex.  Is it?

:   INT  33            ; write the codes to the printer
                 <<< form: should int # should be hex.

:   MOV  AX,04C00      ; MSDOS codes for "successful process termination"
                 <<< warning/error: value should be hex.  Is it?
:   INT  33            ; go back to the operating system
                 <<< form: should int # should be hex.

: PRN_NAME:
:   DB 'PRN',0
                 <<< form: prn_name: is a code label. a data label
                     should be used.

: CODES:
:   DB 0C             ; single form-feed for the PAGE program
                 <<< form: prn_name: is a code label. a data label
                     should be used.

: LENGTH EQU $-CODES
                 <<< length is a reserved word.

--
<---->



Sat, 28 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

: I hate to step on toes here but syntax refers to case, order and
: structure.
:        int_ptr a, b ;
:        INT_PTR c, d ;
: These are not syntactically equivalent!! END OF STORY...

  They are exactly equivalent.  End of story...

--
<---->



Sat, 28 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!


 > ; I'm afraid I'm going to have to critique your assembler code...

Scott, here you go again.  None of the errors you mention are errors with
the assembler Alicia is using, except one, and that she admitted as a typo.
--
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn  amsterdam, nederland; http://www.cwi.nl/~dik/



Sun, 29 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!


: Scott, here you go again.  None of the errors you mention are errors with
: the assembler Alicia is using, except one, and that she admitted as a typo.

  You will noice the word "error" has been removed from the critique.

  Her code was wrong, 2.4 times larger than required, about as slow and
poorly written.



Sun, 29 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

Quote:


> : >   You have?  You are undoubtedly referring to Alicia Carla Longstreets
> : > program that sends a line feed to the printer.  She challenged me to
> : > produce a smaller version of the program.  I seem to remember that my
> : > program was 2.6 times smaller than hers.


> : And your program did not use even 1 byte lestt disk space, it did not
> : takes even 1/10 of a second less time to execute, and it was not as
> : flexible or as maintainable.

>   Alicia Carla Longstreet is correct, the program didn't use any less
> disk space since both programs fit into a single sector.  Longstreet
> is being dishonest of course in claiming that this is in any way
> relevant to the efficiency of her code.  The fact remains that her
> bloated sloth code was reduced in size by a factor of 2.4. and its speed
> of execution was increased by a similar amount.

>   Alicia Carla Longstreet hides behind the fact that both programs
> execute un under 1/10th of a second.  This is of course irrelevant.  She
> set the challenge, (program size and efficiency), and she lost.  Her
> 14 line program was 2.4 times larger and at least a factor of 2 slower
> than its replacement.

>   A reduction of 2.4 on a 14 line program shows that Alicia's code
> sufferes from extreme bloat.

We obviously have differing definitions here.  I use gross execution
time not CPU cycles.  By my metrics, CPU cycles is not the most relevant
measure.

Quote:
>   As for flexability, the problem was to send a line feed to the
> printer.  Both programs perform this task.

Yes but mine could send to any printer with a simple change.

Quote:
>   Longstreets code however contains a logic error since it assumes that
> there will be no error when it tries to open a file/device.

No, usage guarenteed that the printer would always be available, one
doesn't send a line feed except after sending some data.  If there were
no printer the previous command would discover that.

Quote:
>   If there is no printer port attached for example, Longstreets code
> sends a linefeed to an undefined file handle.

Wrong again, the program will issue a:

Device not available
(A)bort, (R)etry, (I)gnore

Under MS-DOS and a error dialog under Windows 95, but then this comes
back to the built-in error handler with DOS functions that you claim
doesn't exist.  Well I have been funing at this error handler for over
10 years.

Quote:

> : Okay Scott I am going to call your bluff.
> : You said you could take any 'C' program and increase it speed 2-fold and
> : decrease its code size by, at least, a factor of 2.  So put you assembly
> : where you mouth and improve on this code.
>   Trivial...  > factors of 2 everywhere...

Except you didn't do it.

- Show quoted text -

Quote:
> INCLUDE C:\MASM\MYDEFS.INC

>     COMTOP CSEG

>  PRINT_CODES:
>    OMOV DX,PRN_NAME   ; point to the printer's device name
>    MOV  AX,03D01H     ; MSDOS codes for "open for writing"
>    INT  DOS           ; call MSDOS to open the printer device
>    XCHG BX,AX         ; swap the printer's open-file handle into BX
>    OMOV DX,CODES      ; point to the codes we are outputting
>    MOV  CX,CLEN       ; load the number of code bytes
>    MOV  AH,040H       ; MSDOS code for "write"
>    INT  DOS           ; write the codes to the printer
>    MOV  AX,04C00H     ; MSDOS codes for "successful process termination"
>    INT  DOS           ; go back to the operating system

>  PRN_NAME   DB 'PRN',0

>  CODES   DB 0CH            ; single form-feed for the PAGE program
>  CLEN   EQU $-CODES

> ;Oh golly! My code is below
> ; Your code 30 bytes   -   12 instructions
> ; My code   11 BYTES   -    5 INSTRUCTIONS
> ;           30/11 = 2.7   12/5 = 2.4

> ;  MOV AL,5            ; WILL OUTPUT CHAR TO PRINTER   But I am on LPT2:
> ;  MOV DL,0CH          ; CHAR TO OUTPUT = FORM FEED
> ;  INT DOS             ; OUTPUT CHAR TO PRINTER
> ;  MOV AX,04C00H       ; RETURN TO DOS WITHOUT ERROR
> ;  INT DOS
> COMBOT CSEG

Where is the error handler?

Quote:
> ; I'm afraid I'm going to have to critique your assembler code...

> : PRINT_CODES:
> :   MOV  DX,PRN_NAME   ; point to the printer's device name
>                  <<< mov dx,prn_name => ptr = prn_name[0]
>                      you should have used mov dx, &prn_name.

Wrong.

Quote:
> :   MOV  AX,03D01      ; MSDOS codes for "open for writing"
>                  <<< no hex specifier.

Don't need one.

Quote:
> :   INT  33            ; call MSDOS to open the printer device
>                  <<< form: int # should be hex.

Wrong.

Quote:
> :   XCHG BL,AX         ; swap the printer's open-file handle into BX
>                  <<< error:  You can not exchange a byte with a word
>                  <<< warning: prn may already be open.  You must test
>                      for this condition and avoid the remainder of the
>                      code if open fails.

Well you got me here, one error, fortunatly my assembler knew how to
properly correct it.  Note: I have been using the results of this code
for more than 6 years.  It did assemble.

Quote:
> :   MOV  DX,CODES      ; point to the codes we are outputting
>                  <<< mov dx,codes => ptr = codes[0]
>                      you should have used mov dx, &codes.

Wrong.

Quote:
> :   MOV  CX,LENGTH     ; load the number of code bytes
>                  <<< error: length is a reserved word.

Wrong.

Quote:
> :   MOV  AH,040        ; MSDOS code for "write"
>                  <<< warning/error: value should be hex.  Is it?

No it is correctly in decimal.  My assembler uses decimal, like normal
humans.

Quote:
> :   INT  33            ; write the codes to the printer
>                  <<< form: should int # should be hex.

Wrong.

Quote:
> :   MOV  AX,04C00      ; MSDOS codes for "successful process termination"
>                  <<< warning/error: value should be hex.  Is it?

Wrong.

Quote:
> :   INT  33            ; go back to the operating system
>                  <<< form: should int # should be hex.

Wrong.

Quote:
> : PRN_NAME:
> :   DB 'PRN',0
>                  <<< form: prn_name: is a code label. a data label
>                      should be used.

Wrong again.

Quote:
> : CODES:
> :   DB 0C             ; single form-feed for the PAGE program
>                  <<< form: prn_name: is a code label. a data label
>                      should be used.

Wrong agian, when are you going to give up being wrong?

Quote:
> : LENGTH EQU $-CODES
>                  <<< length is a reserved word.

Boy you sure do like being wrong!

--

--
********************************************

********************************************

The first element of greatness is fundamental humbleness
(this should not be confused with servility);
the second is freedom from self;
the third is intrepid courage,
which, taken in its widest interpretation,
generally goes with truth;
and the fourth-the power to love-
although I have put it last, is the rarest.
                                    Margot Asquith



Sun, 29 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!


 > : Scott, here you go again.  None of the errors you mention are errors with
 > : the assembler Alicia is using, except one, and that she admitted as a typo.
 >
 >   You will noice the word "error" has been removed from the critique.

Not true, the word "error" occurred three times, only once correctly.
:   MOV  AX,03D01      ; MSDOS codes for "open for writing"
                 <<< no hex specifier.
What is the reason for this critique?
--
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn  amsterdam, nederland; http://www.cwi.nl/~dik/



Mon, 30 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

As I recall:
* Alicia uses A86 as her assembler
* A86 defaults to hexadecimal

Conclusion: Since A86 defaults to hexadecimal, hexadecimal, the specifier
is not needed. Reduces portability, of course, but there's no "formal"
standard for x86 assembly sooo..... ;-)

I imagine thats the reason.

Dennis


Quote:



>  > : Scott, here you go again.  None of the errors you mention are errors
with
>  > : the assembler Alicia is using, except one, and that she admitted as
a typo.

>  >   You will noice the word "error" has been removed from the critique.

> Not true, the word "error" occurred three times, only once correctly.

> :   MOV  AX,03D01      ; MSDOS codes for "open for writing"
>                  <<< no hex specifier.
> What is the reason for this critique?
> --
> dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland,
+31205924131
> home: bovenover 215, 1025 jn  amsterdam, nederland;

http://www.cwi.nl/~dik/

- Show quoted text -



Tue, 31 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

: Conclusion: Since A86 defaults to hexadecimal, hexadecimal, the specifier
: is not needed. Reduces portability, of course, but there's no "formal"
: standard for x86 assembly sooo..... ;-)

  This is why I removed the word "error" from the critique.

  There is still the issue of form. Clara's form is rather poor.  I
suspect this is also true of her pictorial form.

  Clara seems to be interested in getting me laid.  I think this is
rather strange coming from a complete stranger.



Tue, 31 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

Like anyone really care about who can solve a toy problem in the quaintest
way possible.

===============================================================================
    The above article is the personal view of the poster and should not be
       considered as an official comment from the JET Joint Undertaking
===============================================================================



Tue, 31 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!


   >Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.asm.x86

   >> :   XCHG BL,AX         ; swap the printer's open-file handle into BX                   <<< error:  You can not exchange a byte with

   >Well you got me here, one error, fortunatly my assembler knew how to
   >properly correct it.  Note: I have been using the results of this
   >code for more than 6 years.  It did assemble.

   Your assembler "corrects" the above code?

   What sorta crapola assembler are you using?

   Your looking at a 1/3rd chance of this bug "getting it right" ..

   xchg bl, al           all easily could be the intended code
   xchg bl, ah
   xchg bx, ax


--: COMPUTERVREDEBREUK

Net-Tamer V 1.08 - Test Drive



Tue, 31 Aug 1999 03:00:00 GMT  
 How to get Nudds laid!

: Not true, the word "error" occurred three times, only once correctly.

  The word "error" documents here "errors". This is quite appropriate.
The term has been removed where it is not appropriate.


: Okay Scott I am going to call your bluff.

: You said you could take any 'C' program and increase it speed 2-fold and
: decrease its code size by, at least, a factor of 2.  So put you assembly
: where you mouth and improve on this code.

  Trivial...  > factors of 2 everywhere...

INCLUDE C:\MASM\MYDEFS.INC

    COMTOP CSEG

 PRINT_CODES:
   OMOV DX,PRN_NAME   ; point to the printer's device name
   MOV  AX,03D01H     ; MSDOS codes for "open for writing"
   INT  DOS           ; call MSDOS to open the printer device
   XCHG BX,AX         ; swap the printer's open-file handle into BX
   OMOV DX,CODES      ; point to the codes we are outputting
   MOV  CX,CLEN       ; load the number of code bytes
   MOV  AH,040H       ; MSDOS code for "write"
   INT  DOS           ; write the codes to the printer
   MOV  AX,04C00H     ; MSDOS codes for "successful process termination"
   INT  DOS           ; go back to the operating system

 PRN_NAME   DB 'PRN',0

 CODES   DB 0CH            ; single form-feed for the PAGE program
 CLEN   EQU $-CODES

;Oh golly! My code is below
; Your code 30 bytes   -   12 instructions
; My code   11 BYTES   -    5 INSTRUCTIONS
;           30/11 = 2.7   12/5 = 2.4

;  MOV AL,5            ; WILL OUTPUT CHAR TO PRINTER
;  MOV DL,0CH          ; CHAR TO OUTPUT = FORM FEED
;  INT DOS             ; OUTPUT CHAR TO PRINTER
;  MOV AX,04C00H       ; RETURN TO DOS WITHOUT ERROR
;  INT DOS

COMBOT CSEG

; I'm afraid I'm going to have to critique your assembler code...

: PRINT_CODES:
:   MOV  DX,PRN_NAME   ; point to the printer's device name
                 <<< mov dx,prn_name => ptr = prn_name[0]
                     you should have used mov dx, &prn_name.

:   MOV  AX,03D01      ; MSDOS codes for "open for writing"
                 <<< no hex specifier.

:   INT  33            ; call MSDOS to open the printer device
                 <<< form: int # should be hex.

:   XCHG BL,AX         ; swap the printer's open-file handle into BX
                 <<< error:  You can not exchange a byte with a word
                 <<< warning: prn may already be open.  You must test
                     for this condition and avoid the remainder of the
                     code if open fails.

:   MOV  DX,CODES      ; point to the codes we are outputting
                 <<< mov dx,codes => ptr = codes[0]
                     you should have used mov dx, &codes.

:   MOV  CX,LENGTH     ; load the number of code bytes
                 <<< error: length is a reserved word.

:   MOV  AH,040        ; MSDOS code for "write"
                 <<< warning/error: value should be hex.  Is it?

:   INT  33            ; write the codes to the printer
                 <<< form: should int # should be hex.

:   MOV  AX,04C00      ; MSDOS codes for "successful process termination"
                 <<< warning/error: value should be hex.  Is it?
:   INT  33            ; go back to the operating system
                 <<< form: should int # should be hex.

: PRN_NAME:
:   DB 'PRN',0
                 <<< form: prn_name: is a code label. a data label
                     should be used.

: CODES:
:   DB 0C             ; single form-feed for the PAGE program
                 <<< form: prn_name: is a code label. a data label
                     should be used.

: LENGTH EQU $-CODES
                 <<< length is a reserved word.

(Dik T. Winter)
: What is the reason for this critique?

  Why to document Alicia's continued refusal to admit failure of course.

--
<---->



Mon, 06 Sep 1999 03:00:00 GMT  
 
 [ 20 post ]  Go to page: [1] [2]

 Relevant Pages 

1. (Impossible Mission) How to get Nudds laid!

2. How to get Nudds laid!

3. D.C. area software engineer, laid off, need contract/permanent position

4. Laid off: Need help finding a job fast

5. Laying an Egg

6. searching for algorithm for laying pipes

7. lay man terms

8. VESA memory lay out!!

9. Thikness of Shapes which lay upon an other

10. TypeError: multiple bases have instance lay-out conflict

11. Prolog choicepoints - Was: Card laying problem in SWI-prolog

12. Card laying problem in SWI-prolog

 

 
Powered by phpBB® Forum Software