Jump to content
IGNORED

Help with converting a Microsoft Basic line to Atari Basic


DavidMil
 Share

Recommended Posts

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 by DavidMil
Link to comment
Share on other sites

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 by russg
  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by russg
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by DavidMil
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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 by russg
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...