[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
QbasicFAQ_CallAbs
Here is the easiest way to prepare a show cursor function for Qbasic.
First, use DOS debug. In windows, go to start, run, and type debug and press enter. In DOS, type debug and press enter.
at the "-" prompt, type "a 100" (no quotes) and press enter.
Remember the number that appears after the ":" in your new prompt. this number is "0100".
Now enter the following lines, pressing ENTER after each one:
mov ax,1 int 33 retf
Look at the prompt now. the number after the ":" has changed to "0106". Look at the one above (after the ":"). We will use it. In this case it is "0105". Now keep pressing enter (maybe one more time) until you see the "-" prompt again.
Now type "u 0100 0105" (no quotes) and press enter.
You should see:
2A9F:0100 B80100 MOV AX,0001 2A9F:0103 CD33 INT 33 2A9F:0105 CB RETF
Now the codes are in the second column. We read them from left to right, then top to bottom. We also group the digits in pairs.
Something like this:
B8 01 00 CD 33 CB
Simple enough?
Now we can store all this into a string variable, like this:
d$ = chr$(&HB8)+chr$(&H01)+chr$(&H00)+chr$(&HCD)+chr$(&H33)+chr$(&HCB)
now we need to run it, so we need to define the default segment to the data. Do it like this:
def seg = varseg(d$)
Next, we need to grab the offset of the data and call the function. Do this:
call absolute(sadd(d$))
We aren't passing, nor are we expecting extra parameters, so "call absolute" takes one argument, and that is the offset of our code.
once "call absolute" is processed, a cursor will appear on your screen. If the screen is a text mode, you see a block. If it is graphics mode, you see an arrow.
BUT, you have to remember to remind Qbasic the segment and the offset of your code before you have it execute it, or it will crash.
Sometimes in windows, if your machine code crashes, a message box will popup stating an error with Qbasic, and Qbasic will be ready to close.
Click on Details, and you will find out the actual address of the code that is causing the crash.
the number before the ":" is the segment, and the number after the ":" is the offset.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
QbasicFAQ_CallAbs
Call Absolute
Call Absolute is a way of transferring control from your program to a section of memory which contains the machine code to be executed.Here is the easiest way to prepare a show cursor function for Qbasic.
First, use DOS debug. In windows, go to start, run, and type debug and press enter. In DOS, type debug and press enter.
at the "-" prompt, type "a 100" (no quotes) and press enter.
Remember the number that appears after the ":" in your new prompt. this number is "0100".
Now enter the following lines, pressing ENTER after each one:
mov ax,1 int 33 retf
Look at the prompt now. the number after the ":" has changed to "0106". Look at the one above (after the ":"). We will use it. In this case it is "0105". Now keep pressing enter (maybe one more time) until you see the "-" prompt again.
Now type "u 0100 0105" (no quotes) and press enter.
You should see:
2A9F:0100 B80100 MOV AX,0001 2A9F:0103 CD33 INT 33 2A9F:0105 CB RETF
Now the codes are in the second column. We read them from left to right, then top to bottom. We also group the digits in pairs.
Something like this:
B8 01 00 CD 33 CB
Simple enough?
Now we can store all this into a string variable, like this:
d$ = chr$(&HB8)+chr$(&H01)+chr$(&H00)+chr$(&HCD)+chr$(&H33)+chr$(&HCB)
now we need to run it, so we need to define the default segment to the data. Do it like this:
def seg = varseg(d$)
Next, we need to grab the offset of the data and call the function. Do this:
call absolute(sadd(d$))
We aren't passing, nor are we expecting extra parameters, so "call absolute" takes one argument, and that is the offset of our code.
once "call absolute" is processed, a cursor will appear on your screen. If the screen is a text mode, you see a block. If it is graphics mode, you see an arrow.
BUT, you have to remember to remind Qbasic the segment and the offset of your code before you have it execute it, or it will crash.
Sometimes in windows, if your machine code crashes, a message box will popup stating an error with Qbasic, and Qbasic will be ready to close.
Click on Details, and you will find out the actual address of the code that is causing the crash.
the number before the ":" is the segment, and the number after the ":" is the offset.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
