News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Hello and a question

Started by Rogare, September 30, 2009, 08:45:56 PM

Previous topic - Next topic

dedndave

i have to ask - why is using an include file not a good idea ?
it is simply an expansion of text

FORTRANS

Quote from: dedndave on October 09, 2009, 02:36:38 PM
i have to ask - why is using an include file not a good idea ?
it is simply an expansion of text

Hi,

   I think it's fine.  I use it.  But it reassembles the code and data
each time, so for a larger project it might seem inefficient?

$0.02,

Steve N.

dedndave

ah yes - i agree Steve
i have not yet had a project in 32-bit large enough to mess with multiple files
i have, however, written a few procedures for distribution
i figure the programmer can either stick the proc in their program, or create an obj and lib it, if they like

Rogare

I am working on a little thing right now. is there a place where I could post it when it is partially done (or completely) and get some suggestions about better programming habits for ASM and optimizations?

dedndave

when you type in a reply, at the bottom is a place for Additional Options...
it has to be a ZIP file

Rogare

I got a little request.
Could you write a little program that:
reads a character
if escape was pushed it exits
if F1 was pushed it prints "1"
if F2 was pushed it prints "a"
and jumps back to "reads a character"
?
I think that if I got the idea of this, I could finish the first little program.
Thanks!

dedndave

i normally use INT 16h, functions 0 and 1 (BIOS calls) for keyboard stuff like that
is that ok ? - or did you want to use INT 21h (DOS calls) ?

Rogare

I prefer the 21h.
Just for curiosity - what is the difference for me? I know what is BIOS and what is DOS, why should it matter for the programmer?

dedndave

well - INT 16h is a simpler interface
but, INT 21h allows redirection, which BIOS does not
for example, you can create a "response file" that has all the text "answers" in it
then, at the DOS prompt, type "MyFile <response.txt"
all the input for MyFile can come from a pre-made text file
another example is piping through filters, which is very similar
MyFile|SomePipe.exe
SomePipe can filter and/or alter the input to MyFile
the selection of BIOS vs DOS also affects things like ANSI.SYS and codepages
DOS input can use alternate or re-defined character sets - BIOS cannot

it is easier to identify function keys, arrow keys, etc using BIOS

Rogare

#69
Until I research the BIOS I'd prefer to work with DOS functions which I already know how to use.

Edit: Nevermind, solved.

dedndave

this is not exaclty what you wanted
it reads any key and displays the character and code for it
if it is an extended key (like function keys or arrow keys), it displays the key code X 256
this program "polls" the keyboard, rather than just waiting for a key
if you wanted to, you could easily adapt it to do other things while there is no keyboard input

Rogare

Wow. I understood almost everything there (though I used the interrupt table many times). Learned few nice tricks from it.
Thanks again!

dedndave

here is a better version
same program, only it outputs the values in hex
a little easier to see the extended keys

Rogare

Nevermind - solved myself :)