-
Actually all languages except maybe scripting languages will allow you to directly access memory. And while BASIC does not have pointers per se....actually it does have pseudo pointers.
BASIC code to demo direct memory access
Code:
Screen 13
DEF SEG=&HA000
poke 32000,15
DEF SEG
dim MyArray(0 to 20) as integer
offsetMyArray%=VARPTR(MyArray)
segmentMyArray%=VARSEG(MyArray)
print"MyArray address: ";segmentMyArray%;":";offsetMyArray%
DEF SEG=segmentMyArray%
for i%=0 to 20
poke offsetMyArray%+i%,int(rnd(1)*255)+1
next
DEF SEG
DEF SEG is where poke will place a byte into memory and where peek will read a byte from. So in a sense this is a pointer. You can also call functions via pointers using VARSEG and VARPTR but QB 7.1 also allows you to simply call assembly language subroutines. Of course the assembly must use the small memory model and cannot have stack or data that exceed 64KB, but it is possible to combine assembly and QB.
It should be noted to that it is possible to program the DMA controller, floppy drive controller, etc. in QB as well. You can also use interrupts via CALL INTERRUPT and CALL INTERRUPTX or in old QB 45 you could embed assembly opcodes into your code, create a subroutine out of it by creating a pointer to the asm opcode string (using VARPTR) and simply call it with CALL ABSOLUTE.
You can also read memory with QB. This program will print out all the addresses that are in the IVT or interrupt vector table. You could even write code that would display the actual asm code for the handler at the address. You could then write code in QB as well to decode the opcodes into actual assembly instructions. Thus you could write a disassembler in pure QuickBasic code.
Code:
DEF SEG=0
moffset%=0
do
print"0000:";
ofst$=str$(moffset%);
length=len(ofst$)
ofst$=string$(4-length,"0")+ofst$
print ofst$;" ";
for i%=0 to 31
byte%=asc(peek(i%+moffset%))
asciichar$=chr$(byte%)
text$=hex$(byte%)
if len(text$)<2 then text$="0"+ text$
print text$;" ";
if byte%<>7 and byte%<>13 and byte%<>32 and byte%<>8 then asciichar$="."
locate ,80-i:print asciichar$
next
moffset%=moffset%+32;
loop until moffset%>=1020
The only language that probably cannot directly manipulate/read memory like this would probably be FORTRAN or COBOL since there application/usage is much different than C/C++, Pascal, QuickBasic, etc.
Sorry for all the BASIC code but I was proving a point.
I won't even go into the asm code for that.
:D
Incidentally you can do much of this in VB as well and there are 'pointers' in VB, but they are ugly to say the least.
-
>No, and I was here first :D
Not if we judge by my original join date and yours. ;)
-
-
Robc - if you're aware that your link points to Prelude's profile, do you mean to tell me that it was YOU who gave Thantos a lap dance? http://cboard.cprogramming.com/showthread.php?t=55089
-
>do you mean to tell me that it was YOU who gave Thantos a lap dance?
Don't tell me you actually believed that. :p
-
>i got it you are the the clone of Prelude
My user settings seemed to be crippled for the Prelude account, so I made a new one. :)
-
-
>and how is that possible
How is what possible? For my account to break or for me to create a new one? The former I have no clue, the latter I just log out and click the register link.
-
well IIRC she couldn't change the avatar :)
But why the change in birthdays? Now thats the main question :)
-
>But why the change in birthdays? Now thats the main question
I don't suppose you would accept me saying that it's a long story and you don't want to be bored by it?
-
You should know us better then that. We love long stories :)