News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

converting an usb.h include file

Started by Siekmanski, October 12, 2015, 09:22:31 AM

Previous topic - Next topic

Zen

...Interesting,...
Thanks for the information. And, thanks for alerting us to the possibilities,...:bgrin:
I'll spend some more time reading through all the USDLIB source and info.
...As you are well aware,...this is an excellent concept for a MASM project,...

Siekmanski

libusb-win32 setup example source code.
Creative coders use backward thinking techniques as a strategy.

TWell

So without proper driver libusb-win32 doesn't find anything ?

Siekmanski

You have to install the libusb-win32 drivers for the usb-device you want to communicate with.
With these drivers it only finds those usb-devices.

This is what it shows on my PC,

libusb-win32 setup example.

usb busses count     : 1
usb devices count    : 2

bus-0 VID: 16C0, PID: 05DC
DeviceNumber: 1
Manufacturer: 1
Product     : 2
SerialNumber: 0

bus-0 VID: 0BDA, PID: 2838
DeviceNumber: 2
Manufacturer: 1
Product     : 2
SerialNumber: 3


Press any key to continue...


Those 2 usb devices are my USBasp avr programmer and my just bought RTL-SDR dongle.  :biggrin:
Creative coders use backward thinking techniques as a strategy.

Siekmanski

Hi guys,
How do I translate this piece of C code to asm ?

a = 5;
b = 7;
c = (a & ~b);
Creative coders use backward thinking techniques as a strategy.

TWell

mov eax, a
mov edx, b
not edx ; ~b
and eax, edx ; a & b
mov c, eax

dedndave

it depends on whether you want "a" and "b" and "c" to be globals or locals
in the case of "a" and "b", they might even be constants (EQU or =)

they might also be arguments of a PROC...

SomeProc PROC a:DWORD,b:DWORD

    mov     eax,b
    not     eax
    and     eax,a
    ret

SomeProc ENDP


something similar would be a macro   :P

TouEnMasm

a = 5;
b = 7;
c = (a & ~b);

anwered by cl /Fa
; Line 12
   mov   DWORD PTR a$[rbp], 5
; Line 13
   mov   DWORD PTR b$[rbp], 7
; Line 14
   mov   eax, DWORD PTR b$[rbp]
   not   eax
   mov   ecx, DWORD PTR a$[rbp]
   and   ecx, eax
   mov   eax, ecx
   mov   DWORD PTR c$[rbp], eax
Fa is a musical note to play with CL

Siekmanski

Creative coders use backward thinking techniques as a strategy.