Changes

Jump to: navigation, search

Locomotive BASIC

1,513 bytes added, 09:33, 24 January 2019
/* Functions */
</pre>
==== <code><big>PEEK (add<address expression>)</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': Reports the contents of the Z80 memory location specified in the <address expression> which should be in the range &0000 to &FFFF (0 to 65535). In all cases PEEK will return the value at the RAM address specified (not the ROM), and will be in the range &00 to &FF (0 to 255)
: Returns the contents of the specified memory location (0-65535)'''Associated keywords''': POKE
: '''Example''':<pre>10 MODE 1: ZONE 720 WINDOW 1,40,1,2:WINDOW #1,1,40,3,2530 PRINT "memory-address"40 LOCATE 20,1:PRINT "memory-contents"50 FOR n=1 to 6553560 p=PEEK(n)70 PRINT #1,n,"(&";HEX$(n);")";80 PRINT #1,TAB(20);p,"(&";HEX$(p);")"90 NEXTrun</pre>==== <code><big>PI</big></code> ====: ''BASIC 1.0 & 1.1'': '''FUNCTION''': The value of the ratio between the circumference and the diameter of a circle.
: Returns value of PI (3.14159265) ==== <code>POS (#st)</code> ==== : Returns column number of print position relative to left edge of text window on stream st. st must be specified. : Example'''Associated keywords''':DEG, RAD
: '''Example''':
<pre>
PRINT POS(#0) - prints 1PI 3.14159265
</pre>
==== <code><big>POS (#<stream expression>)</big></code> ====
: ''BASIC 1.0 & 1.1''
: '''FUNCTION''': Reports the current horizontal POSition of the text cursor relative to the left edge of the text window. The <stream expression> MUST be specified, and does NOT default to #0.
: POS(#8) reports the current horizontal carriage position for the printer, where 1 is the extreme left hand edge.
: POS(#9) reports the logical position in the disc file stream, i.e. the number of printing characters sent to the stream since the last carriage return.
: '''Associated keywords''': VPOS, WINDOW
: '''Example''':
<pre>
10 MODE 1: BORDER 0:LOCATE 8,2
20 PRINT "use cursor left/right keys"
30 WINDOW 1,40,12,12:CURSOR 1,1
40 FOR n=1 TO 19:PRINT CHR$(9);:NEXT
50 IF INKEY(1)<>-1 THEN PRINT CHR$(9);
60 IF INKEY(8)<>-1 THEN PRINT CHR$(8);
70 LOCATE #1,2,24
80 PRINT #1,"text cursor ";
90 PRINT #1,"horizontal position = ";
100 PRINT #1,POS(#0):GOTO 50
run
</pre>
==== <code>REMAIN (i)</code> ====
205
edits