ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

FBSL - How to use machine code to get your CPU name

(1/4) > >>

Gerome:
Hello,

FBSL and machine code are not incompatible... :)
You can use the FBSL online compiler to see the results : http://gedd123.free.fr/studio/fbsl2exe.php


--- ---#Option Explicit

'// The last one is 0 to null-terminate
Dim $CPUName    : Alloc( CPUName, 13 )

'// Set up machine code
Dim MachineCode = Data(&H55,&H8B,&HEC,&H57,&H52,&H51,&H53,&H8B,&H45,&H8,&HF,_
                  &HA2,&H8B,&H7D,&HC,&H89,&H1F,&H8B,&H7D,&H10,&H89,&HF,&H8B,_
                  &H7D,&H14,&H89,&H17,&H58,&H59,&H5A,&H55,&HC9,&HC2,&H10,&H0_
                  )

'// Calls the machine code
CallAbsolute( MachineCode, 0, @CPUName, @CPUName+8, @CPUName+4)
MsgBox(0, CpuName, "You CPU is...", 0)

f0dder:
Eek, that looks like how pascal did machine code before the inline assembler was added :P

Gerome:
Hello,

Eek, that looks like how pascal did machine code before the inline assembler was added :P

-f0dder (March 18, 2006, 12:25 PM)
--- End quote ---

The way Fbsl handles 'asm' is in fact a pure trick available via a system APi call, but it works from win95 up to 2003 and even latests M$ actual betas... :)

f0dder:
Oh, system call API?

btw, how does your 'asm' code do API calls? :P

Carol Haynes:
Looks remarkably like what you used to have to do with a Sinclair ZX81 back in the early 70s ;)

Anyone else remember peeking and poking bytes in memory?

Navigation

[0] Message Index

[#] Next page

Go to full version