# The QB Times

## ASM in QBasic

Lesson no.3 More ASM commands

Now we've went through some very fundimental commands but these are not enough for us to do jack sqaut. ; ) We need to learn how to make use of our computer's I/O abilities! What use is calculations were you can't see the results let alone interact with them? Not much.

Some of you would have look at the famous mouse.bas asm code. Somewhere along the line, you'd see this:

```mov ax,1
int 33h
retf
```

It's very simple think of a INT command as a secratary. You give this beautiful blonde a peice of paper outlining thing to do (the input). She then goes off mysteriously on her own doing what she was trained to. At a later time you get back a peice of paper back with feedback on what she has done (output). Some times the jobs you ask her are too simple for feedback so she gives you none.

On to the point now (enough fun) INTs are basicly QB's equivalent of SUBs. Now heres that code agian with a little explaination:

```mov ax,1        ;gives AX a value of 1
int 33h         ;does an int 33, this will
;basiclly call the mouse
;function. Because AX's value
;is 1, that function acts by
;showing the mouse.
retf            ;Returns
```
Ok, INT 33 takes input from AX.

If ax is 1 then the int show the mouse
If ax is 2 then the int hides the mouse
If ax is 3 then the int gives info on the mouse at AX, BX and CX.
Aha! So all the code up there just show the mouse! Handy eh?

Lesson no.4 Procedures

Have you noticed the retf up there? Well that's just a return from a call.

Here's an example of a procedure:

```1E7D:0100       CALL 200
RETF

1E7D:0200     MOV AX,1
INT 33h
RETN
```
Hmmm ... first the program does a near call (A near call is a call to a procedure from a procedure from the same segment e.g 1E7D) to 200. After reaching 200 the program shows the mouse then returns from the near call.

After that retf actually exits the program and returns back to the OS.

Well that sums it up for this issue, next issue we are going to actually do something useful with ints. Be sure to pick it up. = )