Jump to content
IGNORED

Cortex BASIC in 80 Column


Stuart

Recommended Posts

Omega, did you burn a 512K test chip (using the 512K Type 8 Tursi Bank Test) and put it into the cartridge to see what was going on--that one test will give you ALL of the information I need to figure out how your board is working. . .and if there IS a problem on the hardware side. Everything else you do there will just frustrate you. . .because it won't isolate the issue.

  • Like 1
Link to comment
Share on other sites

Ok, this worked for me on my red board. Attached is a 512k image that I've created that as long as your ubergrom doesn't boot into bank 2,3 or 4, it should work. I've padded the trailing 60 banks with bank 1 of the cortex 040 image that Stuart posted.

 

CBASIC80_040_512k.zip

 

What I did to create this image was just some unix-fu.

 

first I renamed the JS99... file that was padded to 32k to something I could type... CBASIC80.bin don't confuse that with the other CBASIC80.bin's in Stuarts original zip...

 

Then...

 

# copy the first 8k to a separate file

dd if=CBASIC80.bin of=bank1.bin bs=8192 count=1

 

# 'fill' the 1st 4 banks with the original bits (just copying the file)

cp CBASIC80.bin CBASIC80_040.bin

 

# pad the remaining 60 banks (512k/8k == 64; 64 - 4 == 60)

for i in {1..60}; do cat bank1.bin >>CBASIC80_040.bin ; done

 

 

  • Like 1
Link to comment
Share on other sites

Ok, this worked for me on my red board. Attached is a 512k image that I've created that as long as your ubergrom doesn't boot into bank 2,3 or 4, it should work. I've padded the trailing 60 banks with bank 1 of the cortex 040 image that Stuart posted.

 

THANK YOU!!!!

Now it'll be on tap for when I need it! :)

 

sml_gallery_35324_1027_27353.jpg

med_gallery_35324_1027_25668.jpg

 

gallery_35324_1027_13590.jpg

  • Like 1
Link to comment
Share on other sites

I of course then wonder, is it time for the battle of the basics ? Just kidding... But I can't resist doing a little computation test...

 

For Cortex Basic computing primes from 1 to 100 with my non-optimized implementation takes 1 minute and 56 seconds.

80  REM TAKES 1:56 ON 4A
90  PRINT 1
100  FOR I=2 TO 100
105   P=0
110   FOR J=2 TO (I-1)
111    D=I/J
112    E=INT[I/J]
120    IF D=E THEN P=1
130   NEXT J
135   IF P=0 THEN PRINT I
140  NEXT I

For extended basic (using xb2.7) basically the same code took 2 minutes and 31 seconds

100 REM TAKES 2:31 IN XB ON 4A
110 PRINT 1
120 FOR I=2 TO 100
130 P=0
140 FOR J=2 TO (I-1)
150 D=I/J
160 E=INT(I/J)
170 IF D=E THEN P=1
180 NEXT J
190 IF P=0 THEN PRINT I
200 NEXT I

  • Like 3
Link to comment
Share on other sites

 

I of course then wonder, is it time for the battle of the basics ? Just kidding... But I can't resist doing a little computation test...

 

For Cortex Basic computing primes from 1 to 100 with my non-optimized implementation takes 1 minute and 56 seconds.

80  REM TAKES 1:56 ON 4A
90  PRINT 1
100  FOR I=2 TO 100
105   P=0
110   FOR J=2 TO (I-1)
111    D=I/J
112    E=INT[I/J]
120    IF D=E THEN P=1
130   NEXT J
135   IF P=0 THEN PRINT I
140  NEXT I

For extended basic (using xb2.7) basically the same code took 2 minutes and 31 seconds

100 REM TAKES 2:31 IN XB ON 4A
110 PRINT 1
120 FOR I=2 TO 100
130 P=0
140 FOR J=2 TO (I-1)
150 D=I/J
160 E=INT(I/J)
170 IF D=E THEN P=1
180 NEXT J
190 IF P=0 THEN PRINT I
200 NEXT I

Without wishing to derail the thread, TurboForth takes about 0.5 seconds!

 

Wanna see it? Load TurboForth from Classic99. After it has booted type

 

DEMOS

 

You'll see "Prime numbers to 1000" on block 15.

 

Type:

 

15 LOAD

 

It will show you the prime numbers to 1000 (which takes ~2.5 seconds)

 

Then type:

 

PAGE

 

(this will clear the screen)

 

Then type:

 

100 primes

 

Ta dah!

 

Okay. As you were.... :)

Link to comment
Share on other sites

That cartridge label looks real nice!

 

So, how compatible is this basic with software for the cortex computer? Was there a document on the port to the 4A?

 

Most Cortex BASIC programs seem to work as long as they don't contain peeks/pokes and/or calls to assembler. I've got a couple typed out from the user magazines that I'll post up soon. The main difference, particularly for games, is the keyboard scanning, as the keyboard on the Cortex is interrupt driven. If you have a look at [http://www.avjd51.dsl.pipex.com/ti/ti.htm#programs], then just under the keyboard mapping table there is a section "Changes and Restrictions in the TI Implementation".

 

(Thanks for sorting out the EPROM image Matt!)

Link to comment
Share on other sites

Okay, here are the results......

Totally possible and completely legal - these chips do NOT have a pre-defined startup state. It has worked out that all the chips used to date were reproducible once it was determined where they started (either in the first or last bank), but it's interesting to see the behavior of yours.

 

It's /also/ possible that it's caused by a bad contact on the ROM, but I would expect to see multiple banks tagged for startup and other errors in that case.

 

My recommendation remains that multi-bank ROM cartridges simply include startup code in all banks that includes a header and enough code to switch to the correct bank before continuing, you can easily do it in 32 bytes or less. Then it always works. :) (Carts that include a GROM can use a GPL power-up routine to set the correct bank, as well.)

Link to comment
Share on other sites

Omega, just get a 74LS378 and put it in place of the 25LS07. It should eliminate your problem (and it is interesting that yours switches between two startup banks--I've only seen one other chip out of several hundred tested that did that, but it is a permissible startup based on the chip specs since the startup state is undefined).

Link to comment
Share on other sites

.., TurboForth takes about 0.5 seconds! ...

 

That's not quite a fair comparison since Matt's code was not optimized. The TurboForth code is highly optimized and using integer math. Even a first optimizing pass of exiting the inner loop with the first exact division reduces the XB time in Classic99 to 43 seconds. Of course, the two big hits for XB (which cannot be optimized out) are floating point math and GPL interpretation.

 

...lee

Link to comment
Share on other sites

Omega, just get a 74LS378 and put it in place of the 25LS07. It should eliminate your problem (and it is interesting that yours switches between two startup banks--I've only seen one other chip out of several hundred tested that did that, but it is a permissible startup based on the chip specs since the startup state is undefined).

 

Good advice, and I normally would have acted on your suggestion, but since Jedimatt42 came to my aid with that 512K image, I decided to just 'finalize' that cartridge board by making it a permanent Cortex BASIC 80 cartridge instead. BTW - I need a couple more Uber Carts... :-D

 

I know I'm not alone on this... I'd really like to see a PDF, with supporting software for the PC, so I, and others, can make our own 512K images... without being dependent on others. A "Cartridge Making for Dummies" sort of thing.

 

It would be nice to know how to put on the header that Tursi talked about or how to make my own compilation images, or even a single image and know how to replicate X number of times to make a valid and usable .BIN file.

 

Making cartridges sure turned out to be a hell of a lot more fun than I thought it would be.

Link to comment
Share on other sites

It would be nice to know how to put on the header that Tursi talked about or how to make my own compilation images, or even a single image and know how to replicate X number of times to make a valid and usable .BIN file.

 

It's not a question of just "adding a header"... the cartridge needs to be designed that way, because it occupies space that some carts might otherwise use for code or data. Not very much space, and to me it's well worth it, but it's not something that can be easily inserted after the fact, and certainly not automatically or via a fixed process.

 

My proposal, though, is that programs written for bank switching carts have, as their first instruction, a command to switch to the intended 'first' bank... and then that much is copied to the beginning of every bank. That way you guarantee the startup state, even after a reset.

 

Something like this:

 

 

 AORG >6000
 DATA >AA01,>0100,>0000,PROG,>0000,>0000
PROG
 DATA >0000,START
 BYTE >04
 TEXT 'TEST'
 
 EVEN
START
 CLR @>6000   * set bank 0

 

That block would take 28 bytes -- if every bank on the ROM started with that exact set of bytes, you'd always get the header and always start up correctly (banks other than the first one can stop after the CLR statement, after the bank switch the code will then continue in the first bank).

 

This is the wrong thread for this though...

Link to comment
Share on other sites

 

Something like this:

 AORG >6000
 DATA >AA01,>0100,>0000,PROG,>0000,>0000
PROG
 DATA >0000,START
 BYTE >04
 TEXT 'TEST'
 
 EVEN
START
 CLR @>6000   * set bank 0

That block would take 28 bytes -- if every bank on the ROM started with that exact set of bytes, you'd always get the header and always start up correctly (banks other than the first one can stop after the CLR statement, after the bank switch the code will then continue in the first bank).

 

This is the wrong thread for this though...

 

 

Is this something that can be loaded and run - can't seem to figure out what to do with it?

 

It's designed to work with a cartridge, simply to get it to start up in the appropriate spot. If you don't have EEPROM burner, it's probably something that you'll never need. I'm starting a new folder, and that little piece of code will be the first entry. 2016 is going to be the year I *TRY* to find the time to learn how to make my own cartridges, not just program in someone else's work.

 

Having that little piece of code and knowing how to use it are two different things, sadly my ignorance meter is pegged on this topic. Anyone want to start a new thread teaching NEWBS?

  • Like 1
Link to comment
Share on other sites

Yes, sorry, it's only useful to people creating new cartridges, it's not useful for any existing cartridge and does nothing standalone (well, it'll display a menu entry that crashes when selected ;) ).

 

I'm okay with the idea of teaching, but are you asking to learn to program from scratch? Cause if so, bank-switched cartridge programming is way down the line.

  • Like 1
Link to comment
Share on other sites

Yep - I have a programmer, a bunch of adapters, and just received a 512K flash ROM/GROM. Seems to also have a small AT49F040 loose in the static bag. Not sure what the next step should be. I have been reading the forums - and a version of Basic that supported 80 col would be very high my my list of desired projects! :)

 

Seems to be the same board in my Extended Basic 2.7 Suite cart minus the big chip!

Link to comment
Share on other sites

The AT49F040 is the 512k eeprom you can program with your programmer using the adapter that fits, I think it is a 32pin dip adapter.

 

Set the programmer to that chip type, and load the .bin image in this post: http://atariage.com/forums/topic/245962-cortex-basic-in-80-column/page-2?do=findComment&comment=3376824

into your programmer, and program it.

 

--- Ω --- had a blog post that describes how he got started with the same cartridge board and chip.

 

http://atariage.com/forums/blog/567/entry-12391-making-ones-own-cartridges-under-revision/

Link to comment
Share on other sites

It is the same board as used with XB 2.7--and it works well with 512K images as well, but ONLY if it has one of the quarter-circle green stickers on it! If it doesn't, all you have to do is change out the 25LS07 with a 74LS378 and test it that way to see if it starts in the first or last banks.

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...