DavidMil Posted December 11, 2017 Share Posted December 11, 2017 (edited) These four lines are from the Epson RX80 users manual and are coded using Microsoft basic. Anyone know how to change this to Atari Basic? I am only interested in the first line (100). But here are all four lines: 100 LPRINT CHR$(27) "K"CHR$(20) CHR$(0); (CHR$27) this part of the line is sent to the Epson printer to set it to graphics mode. This allows direct access to the nine pins in the printhead. The "K"CHR$(40) is an escape sequence telling the printer that the next 40 bits will be data. The following CHR$(0) is for printers that can send 9 bits of data (in this case it is to be ignored) but needs to be include in the line for the printer. 200 FOR X= 1 to 40 Loop for the 40 data bits 300 LPRINT CHR$(1) Sends one bit of data, telling the printer to strike only pin one on the printhead (pins are designated by binary numbers (top and bottom pins 1 and 8 would be CHR$(129)). 400 NEXT X Return to finish loop A passing thought... Sometime back I tried to send bits of data to the printer via the parallel port on the 850, but I couldn't get it work properly. I have learned why I couldn't get it to work like that. The printer may not print until it knows what mode you want, and if nothing special is sent to the 850, the interface assumes standard mode and passes that info to the printer at the start of each print job. It's embedded in the communications and we never see it. We can change it by sending a code to tell the Epson printer that we want print in bold or italics or whatever. But the code is still sent at the start of each job and there is no way short of modifying the ROM in the 850 to change it. I can do it this way but I had wanted the bits to be the first thing sent to the printer. As you can see, that just won't work. Any help would be appreciated. DavidMil Edited December 11, 2017 by DavidMil Quote Link to comment Share on other sites More sharing options...
MrMaddog Posted December 11, 2017 Share Posted December 11, 2017 LPRINT will still work on Atari BASIC just like it does in MS BASIC, you don't need to use OPEN/CLOSE statements to use the printer. You can check out the commands here... https://www.scribd.com/doc/21872361/Atari-Basic-Reference-Guide-c061948-Rev-b-1983 Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 11, 2017 Share Posted December 11, 2017 You need semi-colons in between each string and function. e.g. 100 LPRINT CHR$(27) "K"CHR$(20) CHR$(0); should be 100 LPRINT CHR$(27) ; "K";CHR$(20); CHR$(0); 4 Quote Link to comment Share on other sites More sharing options...
russg Posted December 11, 2017 Share Posted December 11, 2017 (edited) 10 CLOSE #1 20 OPEN #1,8,0,"P:" 30 FOR N =1 TO 10 40 READ A:PUT #1;A 50 NEXT N 60 CLOSE #1 100 DATA 1,2,3,4,5,ANY NUMBER TO 10 ENTRIES THE DATA SHOULD BE THE ASCII CODES FOR THE CHARACTER YOU WANT TO SEND. EG. 65 FOR A "A" It has been a long time, so I think it is correct. The 850 should recognize the "P:" device. You don't want to use "LPT"s. The 'A's in line 40 could be any letter, like "X" Edited December 11, 2017 by russg 1 Quote Link to comment Share on other sites More sharing options...
russg Posted December 11, 2017 Share Posted December 11, 2017 10 CLOSE #1 20 OPEN #1,8,0,"P:" 30 FOR N =1 TO 10 40 READ A:PUT #1;A 50 NEXT N 60 CLOSE #1 100 DATA 1,2,3,4,5,ANY NUMBER TO 10 ENTRIES THE DATA SHOULD BE THE ASCII CODES FOR THE CHARACTER YOU WANT TO SEND. EG. 65 FOR A "A" It has been a long time, so I think it is correct. The 850 should recognize the "P:" device. You don't want to use "LPT"s. The 'A's in line 40 could be any letter, like "X" You have to load a 'driver' for the P: device. I don't remember how. Maybe not since it is a standard device. Quote Link to comment Share on other sites More sharing options...
russg Posted December 11, 2017 Share Posted December 11, 2017 (edited) LPRINT will still work on Atari BASIC just like it does in MS BASIC, you don't need to use OPEN/CLOSE statements to use the printer. You can check out the commands here... https://www.scribd.com/doc/21872361/Atari-Basic-Reference-Guide-c061948-Rev-b-1983 The problem with LPRINT is it is a 'line' print, it always puts a 155 at the end. I think a semicolon somewhere fixes that. Edited December 11, 2017 by russg Quote Link to comment Share on other sites More sharing options...
+David_P Posted December 11, 2017 Share Posted December 11, 2017 There's a resident P: driver (one of the five resident drivers - SPECK) Here's an adapted version of the MS BASIC program. Not tested on real hardware, but should work 100 LPRINT CHR$(27);"K";CHR$(20);CHR$(0); 200 FOR X= 1 to 40 300 LPRINT CHR$(1); 400 NEXT X 500 LPRINT The final LPRINT is needed to send a carriage return/line feed. Quote Link to comment Share on other sites More sharing options...
DavidMil Posted December 11, 2017 Author Share Posted December 11, 2017 (edited) 10 CLOSE #1 20 OPEN #1,8,0,"P:" 30 FOR N =1 TO 10 40 READ A:PUT #1;A 50 NEXT N 60 CLOSE #1 100 DATA 1,2,3,4,5,ANY NUMBER TO 10 ENTRIES THE DATA SHOULD BE THE ASCII CODES FOR THE CHARACTER YOU WANT TO SEND. EG. 65 FOR A "A" It has been a long time, so I think it is correct. The 850 should recognize the "P:" device. You don't want to use "LPT"s. The 'A's in line 40 could be any letter, like "X" Remember that the CHR$(27) puts the printer into graphics mode. In graphics mode you are directly accessing the pins on the print head (in powers of 2). Sending the printer a 65 would cause pins one and seven to fire, leaving to tiny dots on the page. Line 300 causes the printer to fire pin one 40 times leaving a tiny straight line on the page. Sorry I see in the program I sent that I put CHR$(20), it should have been CHR$(40) to specify 40 pin strikes of pin 1 CHR$(40) You need semi-colons in between each string and function. e.g. 100 LPRINT CHR$(27) "K"CHR$(20) CHR$(0); should be 100 LPRINT CHR$(27) ; "K";CHR$(20); CHR$(0); The "K"CHR$(20)CHR$(0) is all one command telling the printer to expect 20 bits of data and ignore pin 9 on the printhead. When I tried to split this line up with semicolons, I just got garbage all over the page. Just throw everything about ASCII codes out the window because CHR$(27) puts you in graphics mode on the EPSON printer. Confusing, I know... David Edited December 11, 2017 by DavidMil Quote Link to comment Share on other sites More sharing options...
Frankie Posted December 12, 2017 Share Posted December 12, 2017 When I did it I used open and print, so it was something like this 100 OPEN #1,8,0,"P:" 110 ? #1;CHR$(27);CHR$(83);CHR$(0);CHR$(15) 1 Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted December 13, 2017 Share Posted December 13, 2017 These four lines are from the Epson RX80 users manual and are coded using Microsoft basic. 100 LPRINT CHR$(27) "K"CHR$(20) CHR$(0); 200 FOR X= 1 to 40 300 LPRINT CHR$(1) 400 NEXT X First of all, as others said, there are semicolons missing between the components of the LPRINTs, and another at the end of line 300. Second, unlike what others said: DO NOT use LPRINT. No matter what, any semicolon at the end of an LPRINT Is ignored, and you always get a line feed in the way. This is due to how LPRINT works and is unfortunately unavoidable. Instead, open a channel in line 90 like that: 90 OPEN #1,8,0,"P": close it in lie 500: 500 CLOSE #1 and replace "LPRINT" by "PRINT #1;" and you should be fine. Unlike what others say, "P:" is a resident driver and does not need to be loaded from disk. 2 Quote Link to comment Share on other sites More sharing options...
+David_P Posted December 13, 2017 Share Posted December 13, 2017 It's been a long time since I used LPRINT - good catch. Besides, it's better form to use an IOCB - easier to redirect output to another device, if you want... Quote Link to comment Share on other sites More sharing options...
russg Posted December 14, 2017 Share Posted December 14, 2017 (edited) 10 CLOSE #1 20 OPEN #1,8,0,"P:" 30 FOR N =1 TO 10 40 READ A:PUT #1;A 50 NEXT N 60 CLOSE #1 100 DATA 1,2,3,4,5,ANY NUMBER TO 10 ENTRIES THE DATA SHOULD BE THE ASCII CODES FOR THE CHARACTER YOU WANT TO SEND. EG. 65 FOR A "A" It has been a long time, so I think it is correct. The 850 should recognize the "P:" device. You don't want to use "LPT"s. The 'A's in line 40 could be any letter, like "X" I got around to entering my print program in Altirra. Everything was OK, except line 40 PUT #1;A. .... The PUT statement needs a comma, not a semicolon. .... 40 READ A:PUT #1,A Line 100 could be 100 DATA 65,66,67,68,69,70,71,72,73,74 to print "ABCDEFGHIJ" You could have ATASCII strings in the DATA. You'd need a 5 DIM A$(10):A$="F":A$(10)=A$:A$(2)=A$. This gives a A$ inited with 10 'F's to access any part of the string, up to 10 characters. That sequence of code comes from 'Your Atari Computer' Poole and McNiff, a way to initialize a string variable and fill it with characters. I forget why that is necessary lots of times, initing a string variable. After initing, you can access any part of the string eg. ? A$(2,9). You could use the string to store stuff and access any part of it in your program. Then 100 DATA STRING1,STR2, STR3,S4,S5,S6,S7,S8,S9,S10 You could READ A$ in the FOR NEXT loop. Atari BASIC knows where you are in the DATA statements, doesn't repeat the STRING1. Edited December 14, 2017 by russg Quote Link to comment Share on other sites More sharing options...
+slx Posted December 14, 2017 Share Posted December 14, 2017 You'd need a 5 DIM A$(10):A$="F":A$(10)=A$:A$(2)=A$. This gives a A$ inited with 10 'F's to access any part of the string, up to 10 characters. That sequence of code comes from 'Your Atari Computer' Poole and McNiff, a way to initialize a string variable and fill it with characters. I forget why that is necessary lots of times, initing a string variable. After initing, you can access any part of the string eg. ? A$(2,9). That is a way to quickly fill a (large) string. For a 10-byte string you‘re probably faster and use far less memory by just using DIM A$(10):A$="FFFFFFFFFF". Gesendet von iPhone mit Tapatalk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.