home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib34b.dsk
/
VARPTR.DEMO.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
3KB
|
46 lines
10 REM *************************
20 REM * VARPTR.DEMO *
30 REM * BY TOM TROMEY *
40 REM * COPYRIGHT(C) 1988 *
50 REM * MICROSPARC, INC. *
60 REM * CONCORD, MA 01742 *
70 REM *************************
80 PRINT CHR$(4)"BRUN VARPTR": HOME : PRINT CHR$(21): POKE 34,6: POKE 35,21: VTAB 22: FOR I = 1 TO 40: PRINT "=";: NEXT
90 VTAB 6: FOR I = 1 TO 40: PRINT "=";: NEXT : VTAB 3: HTAB 15: PRINT "VARPTR DEMO";: VTAB 4: HTAB 14: PRINT "BY TOM TROMEY": HTAB 9: PRINT "(C) 1988 MICROSPARC, INC.";:
100 HOME : REM MAIN MENU
110 VTAB 10: HTAB 13: PRINT "1) INTEGER DEMO"
120 HTAB 13: PRINT "2) REAL DEMO"
130 HTAB 13: PRINT "3) STRING DEMO"
140 HTAB 13: PRINT "4) QUIT"
150 VTAB 15: HTAB 13: PRINT "ENTER 1,2,3 OR 4: ";: POKE 16368,0: GET A$
160 A = VAL(A$): IF A <1 OR A >4 THEN 150
170 ON A GOTO 180,250,310,450
180 HOME : VTAB 11: PRINT "ENTER AN INTEGER (-32767 TO 32767) ": PRINT : INPUT "--> ";A$:A = VAL(A$)
190 IF A < -32767 OR A >32767 THEN 180
200 A% = A
210 HI = USR(0)'A%:LO = HI +1
220 PRINT : PRINT "HIGH BYTE OF ";A%;" = "; PEEK(HI)
230 PRINT " LOW BYTE OF ";A%;" = "; PEEK(LO)
240 VTAB 23: PRINT "PRESS RETURN FOR MENU ";: POKE -16368,0: GET A$: HTAB 1: PRINT SPC( 40);: GOTO 100
250 HOME : VTAB 11: PRINT "ENTER A REAL NUMBER": PRINT : INPUT "--> ";A$:A = VAL(A$)
260 EX = USR(0)'A:L = LEN( STR$(A))
270 PRINT : PRINT "EXPONENT OF ";A;" = "; PEEK(EX)
280 PRINT "MANTISSA OF ";A;" = ";:
290 FOR I = 1 TO 4: HTAB L +16: PRINT PEEK(EX +I): NEXT
300 VTAB 23: PRINT "PRESS RETURN FOR MENU ";: POKE -16368,0: GET A$: HTAB 1: PRINT SPC( 40);: GOTO 100
310 HOME : VTAB 9
320 Z$ = "":PZ = USR(0)'Z$
330 POKE PZ +1,0: POKE PZ +2,2: POKE PZ,254: REM SET STRING ADDRESS TO $200, LENGTH TO 254
340 PRINT "ENTER ANY STRING": PRINT : PRINT "--> ";: CALL 54572: REM ROM INPUT ROUTINE
350 REM NOW WE LOOP TO FIND CORRECT LENGTH
360 ADR = 511:L = 0: REM 511=$200-1
370 L = L +1:ADR = ADR +1
380 IF PEEK(ADR) = 0 THEN POKE PZ,L -1: GOTO 400
390 GOTO 370
400 PRINT : PRINT "THE ORIGINAL STRING IS ": PRINT : HTAB 5: PRINT Z$
410 PRINT : PRINT "AND WE CAN CUT IT IN HALF WITH A POKE": POKE PZ, LEN(Z$)/2
420 PRINT : HTAB 5: PRINT Z$
430 NZ$ = Z$: REM SAVE STRING IN SAFE PLACE BEFORE CONTINUING...
440 VTAB 23: PRINT "PRESS RETURN FOR MENU ";: POKE -16368,0: GET A$: HTAB 1: PRINT SPC( 40);: GOTO 100
450 PRINT : VTAB 23: PRINT "ARE YOU SURE? ";: POKE -16368,0: GET A$: HTAB 1: PRINT SPC( 40);: IF A$ < >"Y" AND A$ < >"y" THEN GOTO 100
460 POKE 34,0: POKE 35,23: HOME : VTAB 23: END