flat assembler
Message board for the users of flat assembler.

Index > Examples and Tutorials > Trimmed Brand String

Author
Thread Post new topic Reply to topic
TightCoderEx



Joined: 14 Feb 2013
Posts: 58
Location: Alberta
TightCoderEx
This is essentially an extension to this thread, but I've settled upon how I want it to work and how it's coded.

As this and subsequent posts are building blocks for my OS project, the first thing you'll notice is I'm using STDCALL rather than FASTCALL. Where stack need be aligned on 32 bit boundry, I'll code that into those procedures individually. Code is sensitive to following 5 conditions;
    (a) Null string
    (b) Blank string (47 spaces)
    (c) Leading spaces
    (d) Trailing spaces
    (e) Full string

Algo was tested with this. Null string can be simulated by placing a NULL in first postion of any entry. Procedure frame is superfluous.
Code:
    format PE64 GUI 5.0
    include 'win64a.inc'

                section '.text' code readable executable

  entry $

  Begin:
        enter   56, 0

        mov     esi, Buffer
        mov     edi, Dest
        mov     r8b, 5

   @@:  push    rsi
        push    rdi
        call    GetBrandString
        mov     cl, 6
        or      rax, -1
        push    rdi
        rep     stosq
        pop     rdi
        add     esi, 48
        dec     r8b
        jnz     @B

        leave
        ret

        align   16
        include 'GetBString.asm'

                 section '.data' data readable writeable
; ============================================================================================

  Dest:         rq      6

  Buffer:       db         'Whatever could this be that I cant see the ends', 0
                db         '                                               ', 0
                db         '                 Intel Core (3) i18 3.84 gz CPU', 0
                db         'Branding String                                ', 0
                db         '        Generic CPU in Bochs                   ', 0

                section '.idata' import data readable writeable
; ============================================================================================

  library  user32,'USER32.DLL', kernel32,'KERNEL32.DLL'

  include 'api\user32.inc'
  include 'api\kernel32.inc'                  
    


Description:
Download
Filename: GetBString.ASM
Filesize: 2.78 KB
Downloaded: 178 Time(s)

Post 23 Jul 2013, 21:03
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.