Home > CBM > BASIC > Keywords > Pos 180 Subpages: (divide), (equal), (less), (minus), (more), (multiply), (plus), (power), Abs, And, Append, Asc, Atn, Auto, Backup, Bank, Begin, Bend, Bload, Boot, Box, Bsave, Bump, Catalog, Char, Chr, Circle, Close, Clr, Cmd, Collect, Collision, Color, Concat, Cont, Copy, Cos, Data, Dclear, Dclose, Dec, Def, Delete, Dim, Directory, Dispose, Dload, Do, Dopen, Draw, Ds, Ds string, Dsave, Dverify, El, Else, End, Envelope, Er, Err, Exit, Exp, Fast, Fetch, Filter, Fn, For, Fre, Get, Get num, Getkey, Go, Gosub, Goto, Graphic, Gshape, Header, Help, Hex, If, Input, Input num, Instr, Int, Joy, Key, Left, Len, Let, List, Load, Locate, Log, Loop, Mid, Monitor, Movspr, New, Next, Not, Off, On, Open, Or, Paint, Peek, Pen, Pi, Play, Pointer, Poke, Pot, Print, Print num, Pudef, Quit, Rclr, Rdot, Read, Record, Rem, Rename, Renumber, Restore, Resume, Return, Rgr, Right, Rlum, Rnd, Rreg, Rspcolor, Rsppos, Rsprite, Run, Rwindow, Save, Scale, Scnclr, Scratch, Sgn, Sin, Sleep, Slow, Sound, Spc, Sprcolor, Sprdef, Sprite, Sprsav, Sqr, Sshape, St, Stash, Step, Stop, Str, Swap, Sys, Tab, Tan, Tempo, Then, Ti, Ti string, To, Trap, Troff, Tron, Until, Using, Usr, Val, Verify, Vol, Wait, While, Width, Window, Xor |
| Keyword | Abbreviation | Token (hex) | Version(s) | Classification |
| POS | none | B9 | 1.0+ | Function |
POS ( dummy )
| Parameters | Type | Legal Value(s) | Note(s) |
| dummy | Numeric | any | |
| Returns | Type | Value(s) | Note(s) |
| column | Integer | 0 to screenWidth -1 | On the C128, this is relative to the active WINDOW |
Return horizontal position of the text cursor.
The POS function reports the current horizonatal position ( column) of the text cursor.
The text cursor is normally not shown while a program is running; it is the screen location where the next
PRINT will occur. The returned column is a zero-based value. In other words,
the left-most character position is zero, the position to the right of that is 1, and so on
until the maximum of screenWidth -1 where screenWidth is 22 for VIC-20, and 40 or 80
for other CBMs.
Because the C128 has two video displays, the screenWidth is physically either 40 or 80
depending on which is currently active (see GRAPHIC).
On the C128, the column is relative to the active WINDOW. So if the the text cursor is
at the left-most position of the current window (which may not physically be the left-most position
on the screen) the reported column will be zero. Note the TED series (C16 and Plus/4)
allow windows to be created with ESC sequences, but the returned POS is always relative
to the physical screen.
The POS function can be considered to be the complement to CHAR or TAB.
Unfortunately, CBM BASIC does not provide a function to determine the row of the text cursor.
If dummy is not numeric, a TYPE MISMATCH ERROR is generated. If dummy is omitted
or not a valid expression, a SYNTAX ERROR occurs.
Examples:
PRINT POS(0)
0
READY.
PRINT "HELLO";: X=POS(0)
HELLO
READY.
PRINT X
5
READY.
|
EL, INSTR, JOY,
PEN, POINTER, POT,
RDOT, RSPPOS, RWINDOW
CHAR, GOTO, LOCATE,
MOVSPR, RECORD, TAB
CMD, PRINT, WINDOW
© H2Obsession, 2014 |