6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 10, 2024 2:50 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Sat Apr 16, 2011 7:04 am 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
kozlojak wrote:
Besides that anything else scream out as bad?

http://pastebin.com/4fwMGnbj


Quite possibly I don't have any idea what you're trying to do.

I assume the point of the IRQ is to tell you when the 6551 is
ready either with another character incoming or for another
character out going. In which case I would expect that to be
all that is in the IRQ routine ie input one character or output
one character and update the pointers.
I'd expect all the rest of what you're doing should be outside
the IRQ routine.
eg looks like LAB_PARSSUCESSLOOP, LAB_PARSFAILLOOP
output characters like you had a big FIFO in the 6551 but you
have to implement that in software*.

Also, I'd suggest you add comments to say exactly what you're
trying to do and exactly how you're going to do it.

No offense intended, but eg commenting an rts with ";Return"
is the stuff of bad jokes.

What ever else it is, code is exposition and the basic rule of exposition
is tell em what you're going to tell them, tell them, then tell them what you told them.

Honestly I don't mean to be too sever, your comments aren't totaly
useless but they could be a lot better.

(really, I speak in all sympathy, good comments are hard and
I usually don't do a very good job my self)

*I suppose this is the new and improved 6551XL with the 256 byte
buffers or something ;P


Top
 Profile  
Reply with quote  
 Post subject: Re: My own basic
PostPosted: Sat Apr 16, 2011 5:29 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
kozlojak wrote:
Well, I finished a very basic monitor, if anyone can it would be nice for some feedback or a THIS WONT WORK AT ALL! so I can start over I did not have much more to go on then the data sheets, so I am not sure if I am even on the right track. It Works in the Kowalski simulator when i modify the the 6551 specific code, so that is the part I am not sure about

http://pastebin.com/Y7pbi9ya

Why do the names of all the branch and jump targets begin with LAB_?

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 16, 2011 6:38 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
ChuckT wrote:
I think that a more modern system could be devised where the variable system acts more like a disk drive in RAM.

I kept running out of variable space on the Commodore 64.

The C-64 sandwiched variables between the end of program text and the start of the BASIC interpreter ROM, which is at $A000. Not only was variable storage constrained, garbage collection was painfully slow if a lot of string manipulation occurred. Exacerbating the situation was the reduction in BASIC RAM that occurred if the fake RS-232 functions in the kernel were used, as the RxD and TxD buffers were set up right below the interpreter ROM.

Interpreted business BASICs (BB), such as BBx and Thoroughbred, use a indexing system for variables that does have some resemblance to a filesystem on disk. The index is actually part of the program—that is, stored as part of the program text—in the form of a symbol table (in fact, Thoroughbred has a function that can examine the symbol table of a disk-resident program). The symbol table, in which variable names are lexically sorted, is generated when a program is saved, and thus is loaded into memory when the program is run. Hence when a variable reference is made, the interpreter runtime engine has only minimal work to do to find the variable and access the data that it contains. A simple binary search of the symbol table is all it takes to find a variable descriptor.

The BB indexing method, in addition to improving execution speed, preserves variables when program chaining is used in a large application, a common technique in BB software. Indexing also allows arbitrarily long variable names, up to 33 characters in the case of Thoroughbred. Using a 3-for-2 encoding scheme, only 22 bytes are needed to store the longest variable name (variable names are case-insensitive).

Contrast this to the method used in Microsoft BASIC, in which variable descriptor information is not part of the program and must be recreated each time the program is run. Also, as descriptors are stored in the order in which they are created, a linear search of descriptor space is required to locate a variable—which, incidentally, explains the two-character limit for variable names found in older versions of MS BASIC. The linear search characteristic also explains why MS BASIC programs will run faster when the most frequently used variables are declared first.

In order for the BB indexing methodology to work, memory assigned to variable content storage obviously has to be independent of program storage, which is a feature of BASIC 7.0 on the Commodore 128. The C-128 does it by having separate 64K RAM banks for programs and variables, and uses a set of cross-bank transfer subroutines to read and write variables. As the transfer functions have to change the memory map twice for each byte retrieved or written, variable access tends to be slow, even in 2 MHz mode. When the linear search of variable descriptors is taken into account, it's easy to see why C-128 BASIC programs benefited so much from optimizing compilers like Blitz-128. The C-64 didn't have to constantly remap the system to access variables, so execution was as fast or faster than with the C-128.

I have been thinking about how to adapt Lee's EhBASIC to my next generation POC computer. The memory mapping scheme I envision for that unit produces 48K banks—up to 256 of them if a full complement of RAM is installed—that are available for programs and data. I could conceivably add code to EhBASIC that would implement a cross-bank variable storage function, with the kernel doling out storage as needed. At 20 MHz, the 65C816 would handle the transfers with alacrity, thus avoiding the principle performance bottleneck seen with BASIC in the C-128.

However, large amounts of variable storage are a hallmark of a BASIC environment in which limited mass storage facilities are available. All of the systems for which BB interpreters have been developed include ample mass storage, and the language implementation includes indexing methods that allow disk-resident files to be essentially treated as large variable arrays. Hence, the traditional methods of variable storage in, say, MS BASIC, are less important—a BB programmer is not likely to set up a 1000 element string variable array in RAM and write code to sort and search it when s/he can use a disk-resident B-tree index and some simple BASIC statements to accomplish the same thing.

As I have the hardware needed to implement SCSI-2 on my next generation POC, I may try to devise an extension to EhBASIC to implement the keyed-index file functions of BB. I do have some experience with implementing a B-tree in the C-128 environment on the Lt. Kernal hard drive subsystem (along with a matching record-oriented random access data file), so at least I wouldn't being starting from a point of total ignorance. Yet another thing to add to the "bucket list"...

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 16, 2011 6:47 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10976
Location: England
RTRussell has a page here explaining memory layout for variables in one of his versions of BBC BASIC.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 17, 2011 12:30 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
I added two documents, with annotated disassembly of the Acorn Atom BASIC and OS roms. It's a simple BASIC version (single letter variables, for instance), but some of the techniques may be interesting to study.

http://ladybug.xs4all.nl/arlet/fpga/6502/basic.dis
http://ladybug.xs4all.nl/arlet/fpga/6502/kernel.dis

Note that part of the OS rom is also used for the BASIC interpreter (graphics routines, cassette tape interface and 6502 assembler)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 17, 2011 5:29 pm 
Offline

Joined: Tue Apr 12, 2011 7:08 pm
Posts: 20
Location: NB, Canada
Well, once again I cleaned up the code and added some extra comments.

Removed a lot of the fluff from the 6551 IRQ functions still need to add some more stuff to make it fully functional but it should at least print the welcome msg and print it again when I enter the "ver" command

http://pastebin.com/SdTMRysy


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 19, 2011 3:21 am 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
Lee Davison's polling instead of interupts

http://members.multimania.co.uk/leeedavison/6502/acia/index.html


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Jun 05, 2011 9:02 pm 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
bogax wrote:
Also I think you need to familiarize yourself with syntax diagrams
if you're not already (including BNF and the bubble and box pictures),
if for no other reason than almost anything that's worth a damn is going
to use them.


Can't decide if I should take that back or not, but I had forgotten about
this:

http://javascript.crockford.com/tdop/tdop.html

http://hall.org.ua/halls/wizzard/pdf/Va ... t.TDOP.pdf


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jul 11, 2011 8:31 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 34
Also consider studying Atari Basic.

http://users.telenet.be/kim1-6502/6502/absb.html

It has very nice management of variables.
It keeps table of variables, so only index to table of variables is stored in tokenized program code.

Improved Atari Basic versions (Turbo Basic) allowed for listing all variables mentioned in program, renaming of variable was possible too.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: