News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Newbie can't make the computer go 'Beep!'

Started by Nicole74, May 31, 2015, 12:44:24 AM

Previous topic - Next topic

Nicole74

Okay! I changed the old MASM folder name to MASM_HLA, and then installed the newest MASM. I am now up to date with that, and I'm gonna start reading some tutorials, help files, and readmes.  I am starting from scratch.  This will make it easier to communicate in the forum without having to troubleshoot every little thing.


hutch--

> I did try alt-7 (typo, I didn't mean alt-F7), and that didn't work either

Well, the problem is you have modified the statement, I tested this on Win7 64 bit Ultimate and it works perfectly so no, it was not a typo.

Type in "echo", then 1 space, then hold down the ALT key then press the number seven (7) [not the F7 key]. When you release the 7 key you should get an unprintable character after the space. Then release the ALT key and press ENTER.

Something you need to understand, the MASM32 SDK is aimed at programmers who already know how to write Widows API code and are at least familiar with writing assembler mnemonic code and unless you have this background your task is nearly impossible. Unless you are confident in writing API based compiler code you don't yet have enough experience to write assembler code and the best advice is to find a compiler that you can learn with and ge5t going from there. You can always come back to assembler programming once you have enough experience.

dedndave

and it has to be the 7 on the ten-key pad - not the one up top   :biggrin:

rrr314159

hi hutch,

AFAIK you must use the "7" on the number pad, it doesn't work with the "7" on the keyboard (under the &). Using that, ALT-7 just gives you a "7". And, Nicole74 said she's using a netbook: they don't have number pads (neither of mine do, anyway). So, as I told her: doesn't work on her computer. Don't doubt it can be done on a netbook, but needs some other key combination.

Of course this isn't a vital issue, more important is the q. of whether a beginner (not, after all, a *complete* beginner) can use MASM32 happily. Personally I think she can do it, but what do I know? Fortunately we can just wait and find out!

Tell u what, if u want to bet enough money on it - say, $10,000 - I'm up for it. Then I could PM her, give her the necessary code (to prove she's learned it), and we could split the difference. $5,000 bucks each, even if they're Aussies - would be worth it! And, she doesn't have to learn anything! What do u say, is it a deal?

p.s. (in case it's not obvious) just kidding :biggrin:
I am NaN ;)

jj2007

Quote from: Nicole74 on May 31, 2015, 11:06:16 AM
Okay! I changed the old MASM folder name to MASM_HLA, and then installed the newest MASM. I am now up to date with that, and I'm gonna start reading some tutorials, help files, and readmes.  I am starting from scratch.  This will make it easier to communicate in the forum without having to troubleshoot every little thing.

Sounds OK. There are many nice proggies to study in \Masm32\Examples. In the beginning, you can stick to console mode, because creating a full-fledged Window with buttons and all that is a little bit more difficult.

Get familiar with the Masm32 macros, such as print and rv:
print "Hello World", 13, 10
prints hello world and a newline (=carriage return plus linefeed); trashes registers eax, ecx and edx, so if you still need ecx (for example):

push ecx
print "ecx is safe"
pop ecx

mov wc.hIcon, rv(LoadIcon, rv(GetModuleHandle, 0), IDI_APPLICATION)


To understand, google LoadIcon GetModuleHandle IDI_APPLICATION and see what the C/C++ guys are using. In contrast to Hutch, I think assembler is a lot easier than all the {brackets} and; semicolon; stuff;

P.S.: On my Win7-64 notebook, the only way to get the beep is typing echo [space] [Ctrl G], [Return]

MichaelW

Printing ascii character 7 to the console, whether I do it with print chr$(7) or printf("%c\n",7), on my Windows 8.1-64 laptop plays Windows Foreground.wav.
Well Microsoft, here's another nice mess you've gotten us into.

Nicole74

Yeah, it's a netbook without the numeric keypad.  So it only prints the number 7.

Nicole74

I really want to learn it now that people are betting! :D

Nicole74

If I used virtual 8086 mode, would I be able to send signals to the speaker directly?  I was just reading about not being able to do 16 bit interrupts because of protected mode in the 32 bit computers.

And yeah, sadly, not even 'echo (space) ctrl-g' works in the command prompt.

Neither the 'invoke beep' nor the 'invoke messagebeep' programs worked either, from dave and rrr .  I did also un-mute my speaker, in case I was to expect a sound coming from the normal speakers like a Windows error message type of beep, but it didn't happen. 

I wondered if it matters that this computer is only Windows 7 starter, but I don't think so...

dedndave

you are talking about writing 16-bit programs, rather than 32-bit or 64-bit programs
i suggest you skip 16-bit, altogether

when i started writing 32-bit code, i found that looking at the masm32 library routines
was a good way to learn
they can be found in the masm32\m32lib folder
those, and the examples that Jochen mentioned, are your fastest way to learn

if making sound is your interest, the multi-media functions are what you want

in the examples...
Bill Cravener folder:
mvolume
playmidi
PlayMP3

also...
exampl03\lcd
exampl04\jacts
exampl07\sleepex

i found those by using windows explorer search and looking for files that contain "winmm"
winmm.inc and winmm.lib are needed for programs that use the multi-media functions

rrr314159

Nicole74,

I don't know why the program using "INVOKE Beep,440,1000" doesn't work. Now, dedndave mentions "if making sound is your interest...", but I'm assuming it is NOT a particular interest, right? Rather that's just the first problem u ran into in your book, that u asked us about. In that case, for the time being don't worry about it. Instead do as jj2007 suggests, use print to see what's going on in your console mode programs. For instance replace that "beep"ing Beep statement with

print "Hello World", 13, 10

and see it print the message to the console. Of course, it will just flash a DOS Window and disappear ... couple ways to handle that. Most people use "wait_key" but I prefer to hit CTRL-D in Qeditor (or File Menu - Cmd Prompt) to bring up a DOS console. Then launch the prog from the command prompt (in this case, type beep and ENTER). That way the "hello world" stays put!

And so on. Read the examples mentioned; try to make each one actually work for you b4 going to the next one; etc. Be nice to jj2007, he's had a lot of experience with newbies and knows everything. (Everybody else knows everything also, of course, but I think he's particularly good in the newbie dep't)

U can try MichaelW's suggestions for printing the character "7" also, but as I say, mainly just learn masm32 in general. The beep problem will come out in the wash, solve itself as u go along.

Alternatively, take this problem to a higher authority! Go to "I hate Dell" web site and get email addresses and phone numbers of Michael S. Dell and other top exec's at Dell Computer. Email & call them, tell them your Dell computer "doesn't go beep!!!!". If that doesn't work camp out on His front lawn with a sign. I hear He has a place in Maryland, not too far from PA. Get a big sign, maybe 10 feet by 30 feet ...

Anyway don't hesitate to ask dumb questions, everybody happy to answer them ... except, of course, anyone who has bet $10,000 bucks that you can't learn a simple little thing like masm32!

p.s. If it takes u 30 years to learn it, that's fine - I still win. So take your time, no pressure, just don't ever admit you're giving up, at least until I die - then I'll never have to pay off. Thanks!
I am NaN ;)

rrr314159

BTW MichaelW

I also get a .wav with character 7, from keyboard or from program. I was assuming 1) hutch and everyone else gets this .wav sound when using ALT 7, and might refer to it casually as a "beep"; and 2) when Nicole74 says "no beep" she means no sound of any sort. Hope these assumptions are correct or at least harmless
I am NaN ;)

jj2007

Quote from: rrr314159 on June 01, 2015, 02:30:48 AM... print the message to the console. Of course, it will just flash a DOS Window and disappear ...

The console program exits, and many editors do not realise that the user might want to see the output. Simple workaround is an inkey just before the ExitProcess:
include \masm32\include\masm32rt.inc
.code
start:
  print "line 1", 13, 10
  print "line 2", 13, 10
  inkey "line 3", 13, 10
  invoke ExitProcess, 0
end start

Nicole74

okay...it beeped. I un-muted the speaker, but later on today I realized that there are a whole bunch of different separate things that you can mute, and I had the system sounds muted out even though the speaker was on for everything else.  Grumble grumble.  Well, it won't be necessary for me to camp on Mr. Dell's lawn, although that sounded like fun. 

I'd be cheering that I finally got it to beep, but I'm too busy being embarrassed.

Thank you all for having the patience of saints!