X and Y axis. Printing Sinclair BASIC
X and Y axis. Printing Sinclair BASIC
Does anyone know why Sinclair went against the accepted standard of X & Y coordinates when creating the BASIC PRINT AT X,Y?
Thanks
Thanks
Re: X and Y axis. Printing Sinclair BASIC
Well...
PCs GW Basic BASICA's LOCATE have the same syntax
LOCATE [row][,[col]
40 LOCATE 5,1: PRINT 55
Moves the cursor to line 5, column 1
is the same as PRINT AT 5,1;55
why the reason? good question
PCs GW Basic BASICA's LOCATE have the same syntax
LOCATE [row][,[col]
40 LOCATE 5,1: PRINT 55
Moves the cursor to line 5, column 1
is the same as PRINT AT 5,1;55
why the reason? good question
Re: X and Y axis. Printing Sinclair BASIC
My guess: row counting in a text starts from top.
Re: X and Y axis. Printing Sinclair BASIC
The row,column format makes a lot more sense to me when printing on screen. I always think of it as PRINT AT (this number of ENTER characters),(TAB this number);"Text" - and if I'm using variables with PRINT AT, I'll use r and c rather than x and y.
Then, if you want to dig into the QL, there's the CURSOR command, which allows the PRINT position to be anywhere on screen, so you can centre your text perfectly - and that uses the pixel-coordinate grid which is calculated from the top left with x and y coordinates the way round you'd expect. Hence:
MODE 4 - AT #chan,row,col: PRINT #chan,"text" becomes CURSOR #chan,c*6,r*10: PRINT #chan,"text"
MODE 8 - AT #chan,row,col: PRINT #chan,"text" becomes CURSOR #chan,c*12,r*10: PRINT #chan,"text"
I make heavy use of this command any time any time there's centred text involved.
Then, if you want to dig into the QL, there's the CURSOR command, which allows the PRINT position to be anywhere on screen, so you can centre your text perfectly - and that uses the pixel-coordinate grid which is calculated from the top left with x and y coordinates the way round you'd expect. Hence:
MODE 4 - AT #chan,row,col: PRINT #chan,"text" becomes CURSOR #chan,c*6,r*10: PRINT #chan,"text"
MODE 8 - AT #chan,row,col: PRINT #chan,"text" becomes CURSOR #chan,c*12,r*10: PRINT #chan,"text"
I make heavy use of this command any time any time there's centred text involved.
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Re: X and Y axis. Printing Sinclair BASIC
I'd always assumed this. The PRINT command is for text, it where convention would be "first line / first character" to describe location of a word on a page. We start at the top of a page and read from left to right.
X,Y is convention for graphs, so the graphics commands follow this. Graphs are generally drawn with an origin at the bottom left.
Using PRINT for graphics is just a quirk of the way people (mis/ab)use BASIC.
- 1024MAK
- Bugaboo
- Posts: 3123
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: X and Y axis. Printing Sinclair BASIC
PRINT in BASIC originally output to either a terminal or a file. A terminal could use a real printer (teletype). Only later was a screen (VDU) used.
Most BASIC versions did not include any command or function to specify which line the output would appear on. To move to a different line you had to move down a line by using PRINT on its own…
The Microsoft BASICs that @zx_if1 mentioned are improved versions of older Microsoft BASICs.
Mark
Most BASIC versions did not include any command or function to specify which line the output would appear on. To move to a different line you had to move down a line by using PRINT on its own…
The Microsoft BASICs that @zx_if1 mentioned are improved versions of older Microsoft BASICs.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: X and Y axis. Printing Sinclair BASIC
Ok
more older Microsoft Basic?
CP/M's M-Basic use ESCape codes:
sintaxis: PRINT CHR$(27);"Y";CHR$(x+32);CHR$(y+32);....
Mallard Basic use that too
where: 27 = ESC, Y = AT code type, x & y = coordinates +32
more older Microsoft Basic?
CP/M's M-Basic use ESCape codes:
sintaxis: PRINT CHR$(27);"Y";CHR$(x+32);CHR$(y+32);....
Mallard Basic use that too
where: 27 = ESC, Y = AT code type, x & y = coordinates +32
Re: X and Y axis. Printing Sinclair BASIC
Hi all
I want not to let the subject die, then let's turn it into a comparison
Apple uses two statements instead of one:
VTAB and HTAB
For this purpose Applesoft BASIC has two commands, VTAB (row) and
HTAB (column), which take a row and column to move the cursor to.
So in order to print something starting on third line from top of the screen,
at the leftmost position, you set cursor position with
"VTAB 3 : HTAB 1: PRINT XXX"
What if Sinclair had chosen something similar to this for his Basic?
I want not to let the subject die, then let's turn it into a comparison
Apple uses two statements instead of one:
VTAB and HTAB
For this purpose Applesoft BASIC has two commands, VTAB (row) and
HTAB (column), which take a row and column to move the cursor to.
So in order to print something starting on third line from top of the screen,
at the leftmost position, you set cursor position with
"VTAB 3 : HTAB 1: PRINT XXX"
What if Sinclair had chosen something similar to this for his Basic?
Re: X and Y axis. Printing Sinclair BASIC
PRINT AT()
Re: X and Y axis. Printing Sinclair BASIC
PRINT AT()
AT...
Ok
The more oldest AT was TRS80 MODEL I LEVEL I BASIC's AT
sintax: PRINT AT nn;text
where nn= 0 to (64*16)-1=1023
Begins print at specified location on Display. Example: 10 PRINT AT 650 "HELLO"
The TRS80 LEVEL II BASIC version was @
now: 10 PRINT @ 650 "HELLO"
Tandy Color and Dragon 32 use @ too
but nn= 0 to (32*16)-1= 511 positions on Display
Laser 200 use P'RINT @ too
what if the speccy had used that version of AT?
AT...
Ok
The more oldest AT was TRS80 MODEL I LEVEL I BASIC's AT
sintax: PRINT AT nn;text
where nn= 0 to (64*16)-1=1023
Begins print at specified location on Display. Example: 10 PRINT AT 650 "HELLO"
The TRS80 LEVEL II BASIC version was @
now: 10 PRINT @ 650 "HELLO"
Tandy Color and Dragon 32 use @ too
but nn= 0 to (32*16)-1= 511 positions on Display
Laser 200 use P'RINT @ too
what if the speccy had used that version of AT?
Re: X and Y axis. Printing Sinclair BASIC
Continuing with the TANDY Color and Dragon 32 PRINT @
I try to convert it to Spectrum as:
1 DEF FN x(x)=INT(x/32): DEF FN a$(x)=CHR$ 22+CHR$ FNx(x)+CHR$ INT(x-32*FN x(x))
Dragon @ example: PRINT @360;"HELLO"
in Speccy: PRINT FN a$(360);"HELLO" - do the same
I try to convert it to Spectrum as:
1 DEF FN x(x)=INT(x/32): DEF FN a$(x)=CHR$ 22+CHR$ FNx(x)+CHR$ INT(x-32*FN x(x))
Dragon @ example: PRINT @360;"HELLO"
in Speccy: PRINT FN a$(360);"HELLO" - do the same
Re: X and Y axis. Printing Sinclair BASIC
Acorn BBC micro
BBC Basic's TAB
sintax: TAB (col {,row})
examples:
10 PRINT TAB(5);"HELLO"
20 PRINT TAB(5,5);"HELLO"
BBC Basic's TAB
sintax: TAB (col {,row})
examples:
10 PRINT TAB(5);"HELLO"
20 PRINT TAB(5,5);"HELLO"
Re: X and Y axis. Printing Sinclair BASIC
Row, Column is the most common text output coordinate system.
What was more annoying was the inverted y-axis for PLOT/DRAW et al. I know this was because paper graphs generally tend to have their origin at the bottom-right, but as a coder it bugged the hell out of me when the first byte of a display is at the top-left.
What was more annoying was the inverted y-axis for PLOT/DRAW et al. I know this was because paper graphs generally tend to have their origin at the bottom-right, but as a coder it bugged the hell out of me when the first byte of a display is at the top-left.
Re: X and Y axis. Printing Sinclair BASIC
Now is Atari Basic's time
Position
abbrevation: POS.
syntax: POSITION col,row
Example:
10 POSITION 5,5: ?"HELLO WORLD"
Position
abbrevation: POS.
syntax: POSITION col,row
Example:
10 POSITION 5,5: ?"HELLO WORLD"
Re: X and Y axis. Printing Sinclair BASIC
Locomotive BASIC on the Amstrad CPC uses:
LOCATE x,y
LOCATE x,y
Re: X and Y axis. Printing Sinclair BASIC
yeah
Spectravideo 318/328 and MSX the same Amstrad LOCATE too:
LOCATE x, y
but is not the same as Gwbasic LOCATE row, col
but
LOCATE col, row
Spectravideo 318/328 and MSX the same Amstrad LOCATE too:
LOCATE x, y
but is not the same as Gwbasic LOCATE row, col
but
LOCATE col, row
Re: X and Y axis. Printing Sinclair BASIC
while other BASICs use LOCATE (Microsoft), POSITION (Atari), HTAB and VTAB (Apple), or @ (Dragon)....
Commodore instead chose to use special characters within PRINT to it. Thus, typing:
PRINT"Q equals PRINTCHR$(16) - cursor down
PRINT"] equals PRINTCHR$(29) - cursor right
PRINT"| equals PRINTCHR$(157) - left cursor
PRINT"^ equals PRINTCHR$(145) - cursor up
because I cannot type the real cbm signs I use any aliked
and the other is through POKEs, as we will see below.
POKE(7680+x+y*22),z
The CBM VIC-20 prints the character z on the screen, at positions x,y. Starting with the memory area 7680 through 8185. If an inverse character is desired, simply do z+128.
Commodore instead chose to use special characters within PRINT to it. Thus, typing:
PRINT"Q equals PRINTCHR$(16) - cursor down
PRINT"] equals PRINTCHR$(29) - cursor right
PRINT"| equals PRINTCHR$(157) - left cursor
PRINT"^ equals PRINTCHR$(145) - cursor up
because I cannot type the real cbm signs I use any aliked
and the other is through POKEs, as we will see below.
POKE(7680+x+y*22),z
The CBM VIC-20 prints the character z on the screen, at positions x,y. Starting with the memory area 7680 through 8185. If an inverse character is desired, simply do z+128.
Re: X and Y axis. Printing Sinclair BASIC
And something I soon found on all the Commies is: the codes to POKE a character to the screen are not the same as the codes required for CHR$...
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Re: X and Y axis. Printing Sinclair BASIC
It never ceases to amaze me how many simple things to require resorting to POKE on the CBM. I mean I understand why (they cheaper out and did a deal with Microsoft for a non-customised version of BASIC) but it really makes the machine feel very unfinished compared to other machines. I guess it survived by being a solid games machine where others were more compromised.
- 1024MAK
- Bugaboo
- Posts: 3123
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: X and Y axis. Printing Sinclair BASIC
The Commodore 64 did well because of it’s sophisticated (for the time) hardware. It did cost more than the ZX Spectrum.
The later PET systems got a better BASIC. But the Commodore 64 kept the generic Microsoft BASIC with a severe lack of support for the hardware facilities. Which was a real shame.
Of course, for use as a games machine, how good the BASIC is becomes irrelevant. If you were serious about programming in BASIC, you could always buy one of the extended BASIC cartridges…
Or later on buy a Plus/4 which had a much better BASIC and more RAM available for BASIC programs.
Mark
The later PET systems got a better BASIC. But the Commodore 64 kept the generic Microsoft BASIC with a severe lack of support for the hardware facilities. Which was a real shame.
Of course, for use as a games machine, how good the BASIC is becomes irrelevant. If you were serious about programming in BASIC, you could always buy one of the extended BASIC cartridges…
Or later on buy a Plus/4 which had a much better BASIC and more RAM available for BASIC programs.
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: X and Y axis. Printing Sinclair BASIC
Now is C=64s time
POKE(1024+x+40*y),c
The CBM C=64 prints the character c on the screen, at positions x,y, starting with the memory area 1024 through 2023. If an inverse character is desired, simply do c+128. As Vic-20 but different address
POKE(1024+x+40*y),c
The CBM C=64 prints the character c on the screen, at positions x,y, starting with the memory area 1024 through 2023. If an inverse character is desired, simply do c+128. As Vic-20 but different address
Re: X and Y axis. Printing Sinclair BASIC
VIC Super Expander have: CHAR row,col,"txt"
C=16, Plus/4 and C=128version: CHAR {color source},col,row,"txt"{,rvs}
where rvs= 1(inverse on) / 0(inv. off)
C=16, Plus/4 and C=128version: CHAR {color source},col,row,"txt"{,rvs}
where rvs= 1(inverse on) / 0(inv. off)
Re: X and Y axis. Printing Sinclair BASIC
Sharp's time!
mz series (700,800,1500)
syntax: cursor col, row
esample: 10 CURSOR 5,6:PRINT"HELLO WORLD"
mz series (700,800,1500)
syntax: cursor col, row
esample: 10 CURSOR 5,6:PRINT"HELLO WORLD"
Re: X and Y axis. Printing Sinclair BASIC
MEMOTECH basic
syntax: csr col, row
example: 10 CSR 5,6:PRINT "HELLO WORLD"
syntax: csr col, row
example: 10 CSR 5,6:PRINT "HELLO WORLD"
Re: X and Y axis. Printing Sinclair BASIC
Oric's time
You need select text mode with TEXT sentences o LORES 0/1 first
to use PLOT to PRINT into display
Example:
10 LORES 0
20 PLOT 16,12,“HELLO"
You need select text mode with TEXT sentences o LORES 0/1 first
to use PLOT to PRINT into display
Example:
10 LORES 0
20 PLOT 16,12,“HELLO"