Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Re: Assembly La...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 13 Topic 4927 of 5113
Post > Topic >>

Re: Assembly Language Question

by Frank Kotler <fbkotler@[EMAIL PROTECTED] > Mar 27, 2008 at 11:16 AM

Wolfgang Kern wrote:
> Frank Kotler wrote:
> 
> 
>>>>db "Hello There",$
> 
> 
>>>It's just a string definition, usually preceded by a label.
>>>If you find it within code right after a call without a label,
>>>then you found one of these well known weird HLL functions.
> 
> 
>>; nasm -f bin -o pfm.com pfm.asm
>>
>>org 100h
>>segment .text
>>     call print_following_message
>>     db 'Hello, World!', 0Dh, 0Ah, 0
>>; note: zero-terminated, not '$'!!!
>>
>>;    mov ah, 4Ch    ; or "exitprocess" of your choice
>>;    int 21h
>>     ret
>>
>>;----------------------
>>; trashes si
>>;----------------------
>>print_following_message
>>     ;xchg si, [esp]    ; if known 386+
>>     pop si
>>     push ax
>>pfm1:
>>;    lodsb            ; ok if ds == cs
>>     mov al, [cs:si]
>>     inc si
>>     or al, al
>>     jz pfm2
>>     int 29h       ; or "putchar" of your choice
>>     jmp pfm1
>>pfm2:
>>     pop ax
>>     push si
>>     ;xchg si,[esp]     ; if known 386+
>>     ret
>>;-------------------------
>>
>>Where's the HLL? "Weird"? Okay... "weird" I'll give ya! :)
> 
> 
> When I first saw this method used on an x86 it came from HLA ...

Wolfgang, you know a lot about a lot of things. HLA ain't one of 'em! 
I'd be willing to bet you *can't* find this method in HLA. Any version. 
(UCR stdlib, yes, IIRC)

(FWIW, I think I first saw it in GRDB code, but the method's been around 
a *lot* longer than that!)

> it is an excellent example of how to useless detour things  :)

How is it "detoured"? Given that we want our string in the middle of our 
code (a *horrible* idea, IMO), what less detoured method would you use? 
Jump over it? (like some packages which shall remain nameless...)

> I'd use si as the strptr instead.

Okay... (I use si, too...) What then?

Best,
Frank
 




 13 Posts in Topic:
Assembly Language Question
Brian <briansipler@[EM  2008-03-26 21:04:11 
Re: Assembly Language Question
Dirk Wolfgang Glomp <d  2008-03-27 07:31:10 
Re: Assembly Language Question
Frank Kotler <fbkotler  2008-03-27 07:24:42 
Re: Assembly Language Question
"Wolfgang Kern"  2008-03-27 07:58:10 
Re: Assembly Language Question
Frank Kotler <fbkotler  2008-03-27 08:33:02 
Re: Assembly Language Question
"Wolfgang Kern"  2008-03-27 10:39:05 
Re: Assembly Language Question
Frank Kotler <fbkotler  2008-03-27 11:16:08 
Re: Assembly Language Question
"Bill Leary" &l  2008-03-27 07:39:19 
Re: Assembly Language Question
"Wolfgang Kern"  2008-03-27 15:33:43 
Re: Assembly Language Question
Herbert Kleebauer <kle  2008-03-27 10:43:49 
Re: Assembly Language Question
Frank Kotler <fbkotler  2008-03-27 11:48:11 
Re: Assembly Language Question
Herbert Kleebauer <kle  2008-03-27 22:39:47 
Re: Assembly Language Question
Terence <tbwright@[EMA  2008-03-27 15:06:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 13:18:25 CDT 2008.