[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Low-level vs. High-level programming
- Subject: Re: Low-level vs. High-level programming
- From: "Kevin Lawton" <kepla@btinternet.com>
- Date: Mon, 23 Jun 2003 09:49:28 +0000 (UTC)
- Newsgroups: comp.sys.cbm, comp.sys.apple2, rec.games.video.classic, comp.os.cpm
- Organization: Portmanteau Software Limited
- References: <b3qo6h$5ar$1@barad-dur.nas.com> <2N4Ia.587$_d3.499@fe03.atl2.webusenet.com> <rhcIa.7524$nY2.2383@fe07.atl2.web <bd5fsv$qli$5@titan.btinternet.com> <bd6942$1595$1@merope.saaf.se>
- Xref: archiver1.google.com comp.sys.cbm:59164 comp.sys.apple2:31796 rec.games.video.classic:59308 comp.os.cpm:13498
Paul Schlyter <pausch@saaf.se> wrote:
| In article <bd5fsv$qli$5@titan.btinternet.com>,
| Kevin Lawton <kepla@btinternet.com> wrote:
|
||| I would love to see someone control a port at a non-standard address
||| in Basic, Fortran, Cobol, C, C++, etc without using extensions
||| beyond the standard language. The truth is that your statement "If
||| you can do it in asm you can do it in any language that is
||| sufficiently complete." is not quite true. Many computer languages
||| do have limitations built into them. One good example is reentrant
||| code, some can some can not.
||
|| Fine, and I would love to oblige you.
|| If you would care to give me the address of the hypothetical port,
|| then I would be happy to furnish you with examples in Basic (yeauch
|| !), Fortran, Cobol
|
| It'll be very hard to do this in Fortran and Cobol unless you use
| some compiler specific extension of the language. Sorry....
I can envisage two possible techniques for this when using 'traditional'
compiled languages like Fortran or Cobol which don't include facilities for
addressing memory-mapped hardware directly (because in many installations
they would be running on a virtual machine).
Either:
1) Link out to a module written in a language which does allow direct
memory mapped hardware access, like C or Assembler.
Or:
2) Make use of the inbuilt features of the language in a roundabout
fashion, noting that a program written in Fortran or Cobol uses a rigidly
fixed (at compilation time) internal data structure which allows the same
data areas to be viewed in a variety of different ways. If the location
(within the memory map) of the program's data storage area can be discovered
then it is not difficult to calculate an offset from the start of program
data storage to the required memory-mapped location and access it, provided
that the location falls within one of the program's accessible memory
blocks. The leaves only the issue of knowing whereabouts within the (virtual
or real) machine memory map the program storage lies, and this can be either
determined at program run time or (preferably) the program loaded at a given
address prior to execution.
|| and C. Can't really clain to know C++ that well, but might be
|| persuaded to give it a try.
|
| In this particular case you can consider C and C++ equivalent: do it
| in C, and it will most likely be acceptable as C++ as well.
|
|| Might even be persuaded to give it a go in Forth, Assembler
|
| It's trivial in Forth and assembler...
Well, that would keep the cost down ! :-)
|| and Java too if you ask nicely
|
| How do you get out of the VM in Java? OK, you could use JNI and do
| it in C of course..... <g>
Of course.
|| (and pay well).
�30 / hour is not particularly 'well' for contract programming services, it
is just a reasonable going rate. You'd pay similar fees for an on-call
plumber, doctor, dentist, accountant, pilot, prostitute or politician -
maybe even more.
| And what if you fail? Do you refund the money in such a case? <g>
Wouldn't actually present an invoice for my fee untill the job had been
completed satisfactorily, the results proven and signed-off by the sponsor.
|| Please don't ask me to try it in HTML or XML.
The point is that some way of doing this can probably be found in any real
programming language (as opposed to a mark-up language, a scripting language
or a data language). However, it would be far more sensible to choose to use
a language with facilities for doing this in a simple and efficient way
rather than take a long and difficult approach with an inappropriate
language.
Kevin.