Message board for the users of flat assembler.
> Examples and Tutorials > Trimmed Brand String
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;
(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.
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'
|23 Jul 2013, 21:03||
< Last Thread | Next Thread >
Copyright © 1999-2019, Tomasz Grysztar.
Powered by rwasa.