<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 11 Jan 1991 20:16:03 GMT
From   : dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!cc.utah.edu!cc.usu.edu!slsw2@ucsd.edu
Subject: CP/M & MBASIC question

In article <77348@unix.cis.pitt.edu>, kwgst@unix.cis.pitt.edu (Filip Gieszczykiewicz)
writes:
>   Greetings I have a Kaypro 10 and am starting to experiment
>   with CP/M. (My first z80 machine)
>
>   1) Is there a command in Miscrosoft BASIC (M-80) that will
>   clear the screen and home the cursor? I have all docs but they
>   say nothing.

Try this:

PRINT CHR$(26) : REM Clear screen
PRINT CHR$(27);"=";CHR$(X+31);CHR$(Y+31) : REM move cursor

CP/M machines work the way God intended (they have terminals instead of
standard hardware that everyone has to know about), so it was not possible
for Microsoft to put those commands in.

I might have the coordinate order backwards, and +31 means that the upper
left hand corner is (1,1). If you want it to be (0,0), add 32 instead.

>   2) I have a simple CLS.COM program that is about 15 bytes long
>   that clears the screen. Now, I DUMPed it and converted the
>   hex to decimal and poked those values from within BASIC.
>   When I CALL it, it clears the screen and does a "Warm Boot"
>   [bummer]. Anyways, I got rid of the JMP 0000h (for the
>   warm boot) but now in hangs. [bummer^2] Arghh... Good lord,
>   even my Apple ][+ has a HOME command! ;-)

If you have the manuals, you should look up how to call a machine language
routine; it's been long enough since I played with BASIC at that level (I've
discovered the magic of assemblers now) that I don't remember. At the very
least you have to replace the JMP 0000h with a RET (opcode C9H). If you just
delete the JMP, you'll wind up wandering through memory; I usually trash a
disk when that happens, so I tend to be careful.

>   3) How do I load a binary file so I can use it with the
>   USR# function? I have an assembler (RMAC), a linker, a
>   BASICLIB.REL (what is that <--- ?), and MBASIC. Is this
>   all I need? Oh, yeah, I have a hard disk so space in not
>   a problem.

I used to hand poke them, but I have done things like read a binary image
into a string and use that to construct a source statement on disk. Getting
machine code into BASIC is not easy.

BASICLIB.REL is the run-time library for a BASIC compiler, e.g., BASCOM,
which compiles Microsoft BASIC. I seem to recall that its library was called
BASLIB, though.

>   (I have the source for SAFETY.COM, which also clears the screen,
>   but even that does not work when POKEed from BASIC. Can I use
>   &HD000? I have no idea where empty space is in BASIC.)

The traditional way to do this is store the code in a string variable and 
use VARPTR to find the address of the variable; if you've got manuals you
can figure out how to do that. I seem to recall that VARPTR( A$ ) is the
length of A$ and then VARPTR( A$ ) + 1 contains the low-order byte of the
data area and VARPTR( A$ ) + 2 contains the high-order byte. But it's been
a while.

>   I also don't have a text editor (WS died) so I wrote my own
>   in basic.... can't use the "," with INPUT... it gives a
>   "Redo from start" (or something similar).

Try using LINE INPUT.

>   4) Anyone know how to read a text file using random-access?
>   I tried every possible combination. I can create but I can't
>   read it. (Remember, you can't read a file that contains ","s
>   with the INPUT# statement)

Try using LINE INPUT#.

-- 
==============================================================================
Roger Ivie

35 S 300 W
Logan, Ut.  84321
(801) 752-8633
==============================================================================

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>