Jump to content
IGNORED

Atari Basic Question


Guitarman

Recommended Posts

If I scan a printed BASIC listing and OCR it, what do I need to do to make a .BAS file that will load into Basic properly?? It is saved at this point as a .txt file on my PC, already scanned and OCR'ed.

 

If you can get it into atariwriter, check the formatting and just save it as .bas and it should work. I did this once. The tricky part is making sure it has no syntax errors from the OCR conversion.

Link to comment
Share on other sites

I actually tried it with a 9-pin dot-matrix listing several years back.

 

Turns out it's just faster to type it in, although the OCR software is probably better now than back then.

 

It can be enormously helpful to first load the scan into Photoshop, and run a posturize and despeckle on it.

 

You'd just want a .TXT file that you then ENTER through the emulator (use the H5: device so it does the CRLF translation).

 

But still, you might find that it has lots of errors.

Link to comment
Share on other sites

Yes.

 

Don't expect miracles from OCR though. Although the source font and spacing might have a large bearing.

 

Stuff like confusion between O, Q, 0 (zero) is all easily dealt with. It's just when the thing starts banging out (QlZ3AS6TBg instead of 0123456789 that it gets tedious.

Link to comment
Share on other sites

What I am trying to do is convert a Commodore BASIC program to Atari. It is a program for testing the Chalkboard PowerPad and is listed in a PowerPad programming guide for the Commodore. It OCR'ed good, straight from a clean PDF file. I use Omnipage Pro which is a very good and accurate OCR program. I guess I also need to know the variances between Commodore BASIC and Atari BASIC.

 

Better yet, is there someone here that knows both and could do a conversion?? The list is not that long.

 

 

PowerPad.txt

Edited by Guitarman
Link to comment
Share on other sites

edit it with your PC and correct it for normal atari basic syntax.. then just save it as a normal text file..

 

once you have it on an ATARI disk (or Via APE/SIO2pc),

 

when you are at the atari basic prompt, insted of typeing LOAD"D:FILENAME.EXT",

 

Type ENTER"D:FILENAME.EXT" instead.

 

 

similarly, if you want to save an atari basic program as a text file, instead of a tokenized BASIC file, just type LIST"D:FILENAME.EXT"

Link to comment
Share on other sites

What I am trying to do is convert a Commodore BASIC program to Atari. It is a program for testing the Chalkboard PowerPad and is listed in a PowerPad programming guide for the Commodore. It OCR'ed good, straight from a clean PDF file. I use Omnipage Pro which is a very good and accurate OCR program. I guess I also need to know the variances between Commodore BASIC and Atari BASIC.

 

Better yet, is there someone here that knows both and could do a conversion?? The list is not that long.

 

I spotted 4 OCR errors: Lines 10010 and 11010 have lowercase L's where they should have the number 1, and lines 10050 and 10060 have capital O's where they should have zeroes (though on 10050 it's only a REM that's wrong, won't hurt anything).

 

The key to porting this program isn't really the differences in BASIC between the two machines. It's the hardware... in the Commodore, the joystick ports are controlled by a chip presumably called the CIA (according to the comments in the code), mapped at $DC00. In the Atari, the equivalent chip is the PIA, mapped at $D300. I don't know much about the Commodore, but I found a memory map: http://sta.c64.org/cbm64mem.html

 

It looks like what this program does to initialize the pad is to set the joystick "down", "right", and "fire" pins as outputs (POKE BDDR,22 at line 11030), set them all low (0), then send a short pulse on the "down" line (POKE BPR,2 followed by POKE BPR,0). To read the pad, it check the "left" bit (line 12050), and if it's 0, the subroutines at line 13000 and 14000 read in the X/Y coordinates serially over the "right" line. The POKEs to BPR and BADDR should be replaced with appropriate values POKEd into PORTA and PACTL ($D300 and $D302 on the Atari), and you could actually use STICK(0) to read the inputs instead of a PEEK.

 

Also, ADR and ADDR are used for reading the keyboard. Replace with PEEK(764).

 

This wouldn't be too hard to port to Atari BASIC, except for one thing: I don't know whether it matters, but you can't set the joystick fire button line as an output on the Atari. The program sets the fire button as an output, but doesn't ever actually use it for anything (it gets set to 0 by the initialization, and stays that way the whole time). If the pad *needs* this, it might not be possible to make it work on an Atari.

 

I can take a crack at porting the code, but without having access to the hardware I can't actually test it... Presumably the timing matters (the pad reads and writes pulses of some minimum duration). There are no timing loops or anything in the Commodore program, but if Atari BASIC is significantly faster than Commodore BASIC, the Atari version might need some empty loops for timing (I don't have any idea whether it's faster or not, and I don't have a Commodore handy to test it).

 

What exactly is the Power Pad? Graphics tablet? Is it possible that it's compatible with the Koala pad? Easy to test (get the version of Micro Illustrator that uses the Koala pad, plug in Power Pad, and try it). Just a thought...

Link to comment
Share on other sites

Here's what I came up with. I opened it in Word, converted paragraph returns to line returns. I saved from Word as text file and used the 'add LF (line feed) only. In A800Win, I used ENTER "H6:POWERLF.TXT" and it loaded without any errors. I also tried running it but without the PowerPad attached, it loops to the end. Now I just need to translate code that needs to be Atari specific and try it on a real A8 with the PowerPad attached.

 

powerlf.txt

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...
  • Recently Browsing   0 members

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