Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Libraries in QBasic 1.1
#1
I was just thinking... QBasic 1.1 can't use QLBs, right? So...external libs. I mean... Wouldn't it be quite possible to write some kind of a thing in assembler, let's say a sort of 35-byte COM program and then OPEN it FOR BINARY and then INPUT$(35, 1) it into a string variable or something like an integer array. Like images for GET & PUT. And then you could CALL ABSOLUTE it... You know... So... Is it a good idea or not? You know, if you don't have a compiler...
url=http://www.google.com/search?q=%22Ain%27t+I+weird%3F%22&start=10]Ain't I Weird?[/url]
Reply
#2
Here:

http://rel.betterwebber.com/junk.php?id=9
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
Oh, man, I've just discovered some severe mistakes in my first post. Let me correct them.

First of all - it's NOT possible to use COMs. Well, I mean, it IS possible, but only to some extent. It won't always work. And you're not going to execute the external programs, after all. So this is what I want to say - assemble the programs to EXE files. Then use EXE2BIN to change them into BINs. And if you really have the urge to execure the programs after you've made them, then you just place a RETN in the very beginning of them. Then compile to EXE, and EXE2BIN into COM. And DO NOT EVER use the ORG 100H thing. That's the reason you shouldn't use COM files, too.

Second - it's NOT possible to use string variables. I found out the hard way. I was clever enough to PEEK through the string before CALL ABSOLUTEing it, and I saw what I believe was a string DESCRIPTOR. No sign of the program. So thank THE DUDE ALMIGHTY, I didn't CALL ABSOLUTE it. Use an INTEGER array. Not LONG, not SINGLE, not DOUBLE, and CERTAINLY not STRING. You see, if we have a 37-byte program, you can't just save it as a 37-byte array, as QB doesn't have a BYTE data type. Instead, DIM an array of 19 integers. This gives us 38 bytes to play with, and that's quite enough, I'd say. That's the reason you shouldn't use LONG, as LONG would give you 40 bytes. So by using integer, you can save 2 bytes. But that's a case of personal taste. I prefer saving bytes instead of leaving them "used" and thus redundant.

Third - you can't just INPUT$(35, 1) into an integer array. But you can use ASC. Well, use something like this:

Code:
DIM Sahib(0 TO 17) AS INTEGER
OPEN "B", 1, "sahib.bin"

DEF SEG = VARSEG(Sahib(0))
FOR F = 0 TO 34
  R = ASC(INPUT$(1, 1))
  POKE VARPTR(Sahib(0)) + F, R
NEXT F
DEF SEG

CLOSE 1

CALL ABSOLUTE VARPTR(Ayat(0))

And YES, I know that you can just include the external routine as DATA statements. But I just wanted to present an example of EXTERNAL libraries, and NOT inline assembly.

Hehe... Anybody remember my old graphics editor, PCIE? I've made a new version, which uses codecs... And those codecs are in fact such external programs... This saves me a lot of space... The new PCIE (v6.2) will be uploaded as soon as I gain access to some broadband, as my modem's top uploading speed of approx. 17.6Kb/s just makes me want to cry!!!
url=http://www.google.com/search?q=%22Ain%27t+I+weird%3F%22&start=10]Ain't I Weird?[/url]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)