Re: A Parable of Two Carpenters
From: C (blackmarlin_at_asean-mail.com)
Date: 12/02/03
- Next message: Frank Kotler: "Re: Strings"
- Previous message: Bx. C: "Re: Strings"
- In reply to: Beth: "Re: A Parable of Two Carpenters"
- Next in thread: Betov: "Re: A Parable of Two Carpenters"
- Reply: Betov: "Re: A Parable of Two Carpenters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 2 Dec 2003 06:07:31 -0800
"Beth" <BethStone21@hotmail.NOSPICEDHAM.com> wrote in message news:<5_Iyb.743$4P5.426@newsfep3-gui.server.ntli.net>...
> ...we're all human, we're all on the
> same planet, we're all subject to the same forces of Nature, the same
> _TRUTHS_ apply to us all, etc....it was humans themselves that
> invented these _PATENTLY ABSURD_ notions that because there was a
> river and a mountain, they'd draw a line on a map, create a flag of
> different colours and then proceed to kill each other repeatedly in a
> periodic cycle because of...well...it's anyone's guess why humans
> insist on this nonsense...
'Nature rejects the monarch, not the man;
The subject, not the citizen; for kings
And subjects, mutual foes, forever play
A losing game into each other's hands,
Whose stakes are vice and misery.
Bonus points to whom ever can get the
quote -- and any who have to google for
it should read the remainder of the
accompanying text; though tempting, posting
it in its entirity would be impolite.
Anyway for something more on topic: RH posted
this code a few days ago...
> HexPrn:
> mov ebx eax | mov edi HexPrintString | add edi 7
> std
> mov ecx 8
> L1: mov al bl | and al 0F | cmp al 0A | jb L2>
> add al 7
> L2: add al '0' | stosb | shr ebx 4 | loop L1<
> cld
> call 'USER32.MessageBoxA' &NULL HexPrintString MessageTitle &NULL
> ret
It is very inefficient, and hence I have optimised it...
(Nb: The code was posted not as an example of efficiency,
but on an unrealted topic. As a result I and others
will and should not criticise RH for this code)
HexPrn:
mov edi ( HexPrintString - 1 ) | mov ecx 8 | mov ebx eax
L1: rol ebx 4 | mov al 0F | and al bl | inc edi | cmp al 0A | jb L2>
add al ( 'A' - '0' + 0A )
L2: add al '0' | dec ecx | mov B$edi al | jnz L1<
call 'USER32.MessageBoxA' &NULL HexPringString MessageTitle &NULL
ret
As, lacking a copy of Windows, I cannot run RosASM,
or read the syntax help files. There will probably be
errors in the syntax -- so here is a NASM copy too...
HexPrn:
mov edi, ( HexPrintString - 1 ) ; U 1
mov ecx, 8 ; V
mov ebx, eax ; U 1
; V stall
.1: rol ebx, 4 ; U 1
mov al, 15 ; V
and al, bl ; U 1
inc edi ; V
cmp al, 10 ; U 1
jb .2 ; V ?
add al, ( 'A' - '0' + 10 ) ; U
; V stall
.2: add al, '0' ; U 1
dec ecx ; V
mov [edi], al ; U 1
jnz .1 ; V ?
call ...
;; Execution time (5*8)+2 = 42 cycles timing estimate
;; (excluding call) for 586+ (most instructions pair)
;; Replace "inc/dec reg" with "add/sub reg, 1" for iP4
;; Use MOVcc instead of JB .. ADD .. ADD if <586 support
;; is not required (left as exercise for the reader)
C
2003/12/2
- Next message: Frank Kotler: "Re: Strings"
- Previous message: Bx. C: "Re: Strings"
- In reply to: Beth: "Re: A Parable of Two Carpenters"
- Next in thread: Betov: "Re: A Parable of Two Carpenters"
- Reply: Betov: "Re: A Parable of Two Carpenters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]