The MASM Forum

Miscellaneous => The Orphanage => Topic started by: Magnum on August 02, 2016, 02:10:02 PM

Title: Track down why program will not run under Wine
Post by: Magnum on August 02, 2016, 02:10:02 PM
Is there a way to track down why a program will not run correctly under Wine ?

I have Ollydbg.

This is one example that does not run correctly.

;Telephone.asm
;              Simulate telephone ringing
;              Help from SuperDave -- a.k.a. DednDave,
;
;              PRODUCE 1 KHz TONE FOR 54.9 mS
;              PRODUCE 800 Hz TONE FOR 54.9 mS

.486                       ; create 32 bit code
.model flat, stdcall       ; 32 bit memory model
option casemap :none       ; case sensitive

include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
include \masm32\macros\macros.asm

.data

.code 
                 
start:

mov ecx, 15
@@:
push ecx
invoke Beep, 1000, 55 ; Frequency in hertz and sound duration
invoke Beep, 800, 55   
pop ecx
dec ecx
jnz @B
invoke Sleep, 1500   

mov ecx, 15
@@:
push ecx
invoke Beep, 1000, 55 ; Frequency in hertz and sound duration
invoke Beep, 800, 55   
pop ecx
dec ecx
jnz @B
invoke Sleep, 1500

; mov ecx, 15
; @@:
; push ecx
; invoke Beep, 1000, 55 ;
; invoke Beep, 800, 55   
; pop ecx
; dec ecx
; jnz

invoke ExitProcess,0

end start


Title: Re: Track down why program will not run under Wine
Post by: anunitu on August 03, 2016, 05:41:23 AM
Main reason,it is an emulator,and may not do this in a perfect way. Write your own version(open source) and make it do as you wish..

Now there is a project to work your inner programmer dreams.

The source be with you.

https://wiki.winehq.org/Source_Code (https://wiki.winehq.org/Source_Code)

Title: Re: Track down why program will not run under Wine
Post by: Magnum on August 03, 2016, 08:33:17 AM
Do you mean to write it using a Linux assembler ?

Title: Re: Track down why program will not run under Wine
Post by: cman on August 03, 2016, 08:42:49 AM
You could try to write this using NASM. The most difficult part of this is that Linux does not have an API function to play a sound ( as far as I can tell ). You would have to use a special library to generate a tone.  :(
Title: Re: Track down why program will not run under Wine
Post by: mineiro on August 03, 2016, 11:09:23 AM
Hello Magnum
I think beep is not working because speakers need priviledge access (root) under linux. As I say on previous topic I don't have speakers on my machine to try, nor speaker box nor speaker on motherboard.
Wine have a debug command 'winedbg'.
I do not have tried but you can try 'sudo wine yourprogram'.

On linux everything is a file. So, devices are files, a text file can be viewed as a sound card, a graphic card, hard disks. This means that if you like to clone a hard disk you just deal with it as being a file. A raw dump will clone it.
I'm saying this because you can try to echo on terminal (tty) a bell ascii and that will output on speaker. You can try too /dev/dsp device or other related to sound.
You can try to change permissions on some files/devices but I don't recomend this, so, you can access speaker as a normal user or group of users.