🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
6 messages
6 total messages Started by ACPS2924 Sun, 27 Jan 1991 03:31
MSC 5.1 Question
#727
Author: ACPS2924
Date: Sun, 27 Jan 1991 03:31
7 lines
511 bytes
Is it possible in MSC 5.1 to gain access to the registers directly.
Turbo C has the _AX,_BX... pseudo-variables for them
is this possible in MSC and if so HOW???


Peter
ACPS2924@ryerson.ca
Re: MSC 5.1 Question
#728
Author: Steve Resnick
Date: Tue, 29 Jan 1991 17:13
20 lines
1174 bytes
In article <91026.223149ACPS2924@Ryerson.Ca> ACPS2924@Ryerson.Ca writes:
>Is it possible in MSC 5.1 to gain access to the registers directly.
>Turbo C has the _AX,_BX... pseudo-variables for them
>is this possible in MSC and if so HOW???

Nope. I believe MSC 6.0 supports this, but I am not sure....


Cheers!
Steve


-- 
-------------------------------------------------------------------------------
resnicks@netcom.com, apple!camphq!105!steve.resnick, IFNA:	1:143/105.0, 
USNail: 530 Lawrence Expressway, Suite 374 
        Sunnyvale, Ca 94086
- In real life: Steve Resnick. Flames, grammar and spelling errors >/dev/null
0x2b |~ 0x2b, THAT is the question.
-------------------------------------------------------------------------------
Alloca for Turbo C
#729
Author: Gene Ressler
Date: Tue, 29 Jan 1991 20:06
39 lines
2252 bytes
GNUish MSDOS code (extremely useful stuff) 
often compiles nicely under Turbo C
(though the port was apparently done for MS-C), except it
frequently uses alloca(), which is supposed to get
new memory in the current stack frame.  The memory
is supposed to be automatically freed when the current
 { ... } block (or at least the current function call)
closes.  So far I've been able to get bison and flex (GNU's
yacc and lex) to compile by faking alloca() with malloc(), but
it's a pain to ensure that free() is called correctly, and of
course free() is time-consuming in an inner loop because it has
to merge free blocks, etc.

The question is whether I can get away with writing my own
alloca().  Allocation seems pretty easy.  SP points to the last
loc in use on the stack, so (without checking for alignment,
overflow, etc.) we can get _cdecl near void *alloca(unsigned n)
with something like:

alloca	proc near
	pop bx			; get return address
	pop cx			; get n
	sub sp,cx 		; allocate space on stack
	mov ax, sp		; set up return pointer
	sub sp, 2		; compensate for caller's increment
	jmp bx			; return
alloca 	endp

The problem is with deallocation.  WILL IT ALWAYS BE DONE BY
CODE GENERATED BY TC?  Things are fine with the `normal' activation
protocol: push bp; mov bp,sp; sub sp,?  ...  mov sp,bp; pop bp; ret
A possible bad case is if Standard Stack Frame is Off.  Then this
protocol can be skipped entirely and mucking with SP is disaster.
I'm asking those who are really familiar with the TC's code generator 
if they know of other dangers e.g. functions with no locals,
tail calls, nested blocks with locals, and so on.  Of course a
working alloca() would be even better (-8 .

Gene Ressler
Re: MSC 5.1 Question
#730
Author: nathan engle
Date: Tue, 29 Jan 1991 21:28
28 lines
1800 bytes
In article <91026.223149ACPS2924@Ryerson.Ca> ACPS2924@Ryerson.Ca writes:
>Is it possible in MSC 5.1 to gain access to the registers directly.
>Turbo C has the _AX,_BX... pseudo-variables for them
>is this possible in MSC and if so HOW???
>
>
>Peter
>ACPS2924@ryerson.ca

  Not directly from 5.1. Whenever I needed to get at my registers in 5.1
I would drop into assembler. There's a neat little microcontroller from
NEC called the V25 which is code compatible with the V20, and which WILL
allow you to access register contents directly. The '25 actually has 8
sets of registers which can be addressed either normally as registers or
they can also be mapped as memory locations (so you would find the
contents of a register by reading a memory location - SLOW but it
works).

  Direct access to the registers is much simpler in MSC6.0 using the
inline assembler. I don't think that there are C constructs for
referring to the registers, but I had never seen that as a problem. 
Direct access to registers just means more reserved words and more rope 
to hang yourself with (as if C programmers needed any more). What
exactly are you trying to accomplish?

Nathan Engle             Software Evangelist
Indiana University       Dept of Psychology
nengle@copper.ucs.indiana.edu
Re: MSC 5.1 Question
#738
Author: Jon Brinkmann
Date: Wed, 30 Jan 1991 18:11
15 lines
1202 bytes
In article <91026.223149ACPS2924@Ryerson.Ca> ACPS2924@Ryerson.Ca writes:
#Is it possible in MSC 5.1 to gain access to the registers directly.
#Turbo C has the _AX,_BX... pseudo-variables for them
#is this possible in MSC and if so HOW???

The variables _AX, _BX, etc are not defined in MicroSoft C 5.1.  If  there
are variables or functions which get and put register values, they aren't
documented.

Jon
--
Jon Brinkmann					Astronomy Department
Internet:	jvb7u@Virginia.EDU		University of Virginia
UUCP:		...!uunet!virginia!jvb7u	P.O. Box 3818
SPAN/HEPnet:	6654::jvb7u			Charlottesville, VA 22903-0818
Re: MSC 5.1 Question
#739
Author: Jim V. Potter
Date: Thu, 31 Jan 1991 15:27
9 lines
1072 bytes
In article <91026.223149ACPS2924@Ryerson.Ca> ACPS2924@Ryerson.Ca writes:
>Is it possible in MSC 5.1 to gain access to the registers directly.
>Turbo C has the _AX,_BX... pseudo-variables for them
>is this possible in MSC and if so HOW???

I suggest that you look at the union REGS defined in dos.h to see how to
define registers that are passed to functions.  The functions bdos(), int86(),
int86x(), intdos(), and intdosx() are some functions that use the REGS union;
see the Runtime Library manual for examples of calling these functions.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads