6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 22, 2024 6:33 pm

All times are UTC




Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 2:12 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
Arlet wrote:
The amount of software doesn't really matter, if the development environment is set up to handle it. With good use of symbolic constants and/or macros, it could be a simple matter of 'make all' to rebuild everything. Assuming of course, the changes aren't too radical.

I have to disagree to some extent. Assembly is generally done a source file at a time. In some environments, assembly just to accommodate a change in a kernel jump table would become very tedious if a lot of software is involved. I've been there and done that multiple times over the years.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 3:05 am 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 395
Location: Minnesota
I once scanned through an Apple ProDos programming manual. They had a slightly different approach to a single-entry point BIOS. Their calls looked something like this, IIRC:
Code:
JSR BiosEntry
dw APInum
dw addr/number
dw addr/number
..and so on as necessary...


The idea being that from the address the JSR pushed on the stack it was possible to create a pointer to the arguments immediately following. Those could be either constants or a pointer to something (a variable, a block of variables, an i/o location, whatever).

The BIOS would take care of reading the arguments and updating the return address to point past them. No need for the programmer to worry about saving or restoring registers.

Although it still seems easier to load the accumulator with a value you went sent to output, rather than put that value somewhere and point an API call at it. I never programmed ProDos, so I don't know ultimately how easy it was to work with.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 3:09 am 
Offline
User avatar

Joined: Sat Aug 22, 2015 8:54 pm
Posts: 31
Did anyone see the post about SourceForge? XD

Seriously though, should I put up a Git repo for the community to contribute to?

_________________
It may look hard, but it won't take long if you take it one byte at a time.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 5:41 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
nkeck72 wrote:
Arlet, I'm assuming you are referring to using a makefile for the project?

Yes.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 5:48 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8511
Location: Southern California
BigDumbDinosaur wrote:
Assembly is generally done a source file at a time.

I use INCLude statements which bring the other needed source-code files in, then only mention the main source-code file when calling the assembler. I have a friend who, until he retired recently, managed software projects so huge and involving so many programmers that they took around 24 hours to re-compile. What we do with our 65xx efforts will assemble the whole thing in a few seconds.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 5:54 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
teamtempest wrote:
I once scanned through an Apple ProDos programming manual. They had a slightly different approach to a single-entry point BIOS. Their calls looked something like this, IIRC:
Code:
JSR BiosEntry
dw APInum
dw addr/number
dw addr/number
..and so on as necessary...

The idea being that from the address the JSR pushed on the stack it was possible to create a pointer to the arguments immediately following. Those could be either constants or a pointer to something (a variable, a block of variables, an i/o location, whatever).

The BIOS would take care of reading the arguments and updating the return address to point past them. No need for the programmer to worry about saving or restoring registers.

Although it still seems easier to load the accumulator with a value you went sent to output, rather than put that value somewhere and point an API call at it. I never programmed ProDos, so I don't know ultimately how easy it was to work with.

That procedure is analogous to Commodore's PRIMM (PRint IMMediate) kernel subroutine in the C-128, in which the null-terminated character string to be printed follows the JSR PRIMM. That's good for API calls where the data location is known at assembly time, but becomes a programming headache if the data location has to be computed at run-time.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 6:08 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
GARTHWILSON wrote:
BigDumbDinosaur wrote:
Assembly is generally done a source file at a time.

I use INCLude statements which bring the other needed source-code files in, then only mention the main source-code file when calling the assembler.

As do I. However, the main source file for each program has to be submitted to the assembler. Currently I have 13 separate programs that I have written for POC, each of which would have to be reassembled if I changed the BIOS jump table. It would take some time, since the actual assembly processing time is only part of the total time needed.

Quote:
I have a friend who, until he retired recently, managed software projects so huge and involving so many programmers that they took around 24 hours to re-compile. What we do with our 65xx efforts will assemble the whole thing in a few seconds.

I have had experiences like that, although not involving multiple programmers. Back when I wrote a truck leasing and billing system for the Commodore 128 running on a Lt. Kernal hard drive subsystem I was working with around 100,000 lines of code. Assembly of the entire mess took about 8 hours. Needless to say, I did my best to avoid making any changes that would have required full reassembly. Once it was all working changes could often be made to a few source files and only those would require reassembly, reducing the development cycle time quite a bit.

I just ran POC's BIOS through the assembler to see how long it would take to assemble it. It took about 5 seconds to run through 12,218 source lines. The program that I am working on that generates an S51K filesystem analog takes about 8 seconds to assemble, and runs to nearly 20,000 lines spread out through a bunch of INCLUDE files. And I'm not even finished with it!

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 6:12 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
BigDumbDinosaur wrote:
I have to disagree to some extent. Assembly is generally done a source file at a time. In some environments, assembly just to accommodate a change in a kernel jump table would become very tedious if a lot of software is involved. I've been there and done that multiple times over the years.


I've used ca65 for assembly. It can assemble into object files that can be linked at a later time, so you can split up a project into different files. You can also use include files to combine several sources into a single program. Having lots of different programs doesn't have to be a problem either. You can have a makefile that automatically rebuilds any number of programs, just add a rule for each program. You can even set up rules to combine all the binaries into a disk/eprom image and actually program the system (as long as all your tools are command line, and don't require mouse interaction). Most of my projects have a 'make prog' target, that will build the project, and upon success, burn it into the flash, so that's all I need to type to test out any code changes.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 6:15 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
nkeck72 wrote:
Did anyone see the post about SourceForge? XD

Seriously though, should I put up a Git repo for the community to contribute to?


I don't know if anybody wants to contribute actual code, but just having the option to read all the code can be useful. I don't know sourceforge, but I know several people here that use github, myself included: https://github.com/Arlet


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 7:23 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
BigDumbDinosaur wrote:
nkeck72 wrote:
The way I see it is I could push the original value of A, X and Y to the stack and then BRK. When the ISR returns you could pop those off (after processing the returned data) and no registers are sacrificed. Unless, of course, you are low on stack space.

Or you could have your BRK handler push and pull registers for you, like any other ISR. This method would reduce the size of the code needed to call your API, as you could reduce it to loading the registers as required and then executing BRK.

The problem is that these are utility calls, not "transparent" interrupts. Some of them need to return values, and the best place for that would be in registers.

Sure, you could shove return values into the stack space that will be popped, but that's a lot fiddlier than it needs to be. However, I do agree that the BIOS should preserve registers that are not directly used as input or output.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 7:41 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8511
Location: Southern California
White Flame wrote:
The problem is that these are utility calls, not "transparent" interrupts.
Good point.

Quote:
Some of them need to return values, and the best place for that would be in registers.

Sure, you could shove return values into the stack space that will be popped, but that's a lot fiddlier than it needs to be.

The nice thing about using the stack is that you don't need variables space. The "variables" are on the stack, and when they're no longer needed, they cease taking any memory. Having a separate data stack in ZP makes it a lot less fiddly.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 8:17 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
It's always best to do your development in the open - I'd recommend github rather than sourceforge, as sourceforge seems to be dying, and google code is also dead. There are other places, but github seems presently to be the popular choice.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 10:21 am 
Offline
User avatar

Joined: Sat Aug 22, 2015 8:54 pm
Posts: 31
Github it is then :D

_________________
It may look hard, but it won't take long if you take it one byte at a time.


Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 3:29 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
White Flame wrote:
BigDumbDinosaur wrote:
nkeck72 wrote:
The way I see it is I could push the original value of A, X and Y to the stack and then BRK. When the ISR returns you could pop those off (after processing the returned data) and no registers are sacrificed. Unless, of course, you are low on stack space.

Or you could have your BRK handler push and pull registers for you, like any other ISR. This method would reduce the size of the code needed to call your API, as you could reduce it to loading the registers as required and then executing BRK.

The problem is that these are utility calls, not "transparent" interrupts. Some of them need to return values, and the best place for that would be in registers.

Sure, you could shove return values into the stack space that will be popped, but that's a lot fiddlier than it needs to be. However, I do agree that the BIOS should preserve registers that are not directly used as input or output.

No question that overwriting stack copies of registers is fiddly with the 65C02. It's a very simple process with the 65C816, involving use of the ,S addressing mode to replace the pushed register value with a new one. I use that procedure all the time.

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


Last edited by BigDumbDinosaur on Thu Aug 27, 2015 3:32 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Multiple interrupts?
PostPosted: Thu Aug 27, 2015 3:31 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
GARTHWILSON wrote:
The nice thing about using the stack is that you don't need variables space. The "variables" are on the stack, and when they're no longer needed, they cease taking any memory. Having a separate data stack in ZP makes it a lot less fiddly.

That will work as long as the function being called doesn't have to be recursive/reentrant.

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 27 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: