6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 10:00 am

All times are UTC




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Sun Feb 15, 2009 9:21 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I know the feeling. This is why I no longer write any code without using test-driven development OR apply formal methods to help back me up. I won't even consider software that is not written using at least a modular approach.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Feb 20, 2009 4:41 am 
Offline

Joined: Sat Aug 30, 2008 11:12 pm
Posts: 34
Location: Kent, UK
I noticed some math issues when I tried Daryl's version earlier in the thread. I made a little program to print a sine wave to the terminal, which worked with the simulator and my own 6502 SBC, but not on the SBC-3- random dots everywhere. On further investigation the variable in which I was counting the angle, that should have been having a certain amount added each time, was coming up with something completely different.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Feb 21, 2009 9:03 pm 
Offline
User avatar

Joined: Thu Mar 11, 2004 7:42 am
Posts: 362
8BIT wrote:
The FP issue is corrected. Now, a FOR/NEXT loop will only execute the first pass and then locks up.


One of the other threads reminded me that the FP routines depend on ZP page boundary wrap around, and native mode has no page boundary wrap around. There may be other routines that depend on ZP wrap around as well -- I haven't looked at the EhBASIC source in a while.

FOR/NEXT uses the stack, so if you didn't disable your native mode TXS fix when you went back to emulation mode, that may be causing some difficulties. Just a thought.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 22, 2009 12:27 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Yes, when I tried the emulation mode, I did put the TXS's back in, so the stack operations should have been ok. Its possible there was some zero page wrap, but since it is not documented with the zero page definitions, I don't know for sure. I had also relocated some of the zp variables as they had been conflicting with the System Monitor variables, cause jumps from one to the other to fail.

I think there must be some differences between emulation mode and native mode addressing that are coming into play. When I finish the other projects on my pile, I may revisit this and dig deeper.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 22, 2009 2:38 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
There may be other routines that depend on ZP wrap around

I don't think there ever were any routines in EhBASIC that depended on ZP wrap around. There aren't any now, if there were I'm sure it would break on microcontrollers that don't fill ZP with RAM.

The problems may still be stack related. NEXT copies the stack pointer to X and uses absolute indexed addressing, $0100,X, to access the FOR NEXT values on the stack. LOOP and DIM also access the stack like this.

There is also a direct access to the stack used when the stack is flushed during CLEAR.

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 22, 2009 7:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Thanks Lee, I'll recheck both of those situations. I believe I found all the absolute, x references, but its worth a second look.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 22, 2009 1:52 pm 
Offline

Joined: Sat Aug 30, 2008 11:12 pm
Posts: 34
Location: Kent, UK
Anyone know of a comparable BASIC for 6809/6309? I need something to run on my 6309 board.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 22, 2009 11:43 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Do you know of a decent Win32 6809 emulator?

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 23, 2009 2:41 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Lee, I can't believe you're still using Windows! :wink: I just Yahoo'ed "Linux 6809 simulator" and got 14,000 results.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 24, 2009 7:34 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
24,500 for Win32 emulator.

But, why not just use a TRS-80 CoCo emulator for your development? That's a 6809-based system ready-made for you. I'm pretty sure there'll be tons of those.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 26, 2009 1:33 am 
Offline
User avatar

Joined: Thu Mar 11, 2004 7:42 am
Posts: 362
leeeeee wrote:
I don't think there ever were any routines in EhBASIC that depended on ZP wrap around. There aren't any now, if there were I'm sure it would break on microcontrollers that don't fill ZP with RAM.


The STA expneg+1,X instruction near LAB_1238 and the STA FACt_3,X instruction at LAB_2701 both depend on ZP wrap around. I was thinking there were more instances than that, but after grabbing the latest code from the website, those were only two I could find. (I suppose I could've actually looked at the source code before running my mouth, but what's the fun in that? :)) Anyway, those two instructions won't work in native mode, so that should be a fairly easy fix.

The other thing to keep in mind in emulation mode is to make sure that the direct page starts on a page boundary (i.e. the D register = $XX00); if not, there is no ZP wrap around even in emulation mode. I haven't run EhBASIC on a 65816 in emulation mode in quite some time, but I didn't really have any trouble getting it up and running.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 26, 2009 10:20 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
The STA expneg+1,X instruction near LAB_1238 and the STA FACt_3,X instruction at LAB_2701 both depend on ZP wrap around.

Oh bother! I fixed both those back in V1.something because neither worked on the GEC version of the 6502 core used in a DMAC conditional access module. I must have neglected to integrate the fixes back into the main source.

Guess I'll have to do it again.

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Feb 28, 2009 8:55 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
dclxvi wrote:
The STA expneg+1,X instruction near LAB_1238 and the STA FACt_3,X instruction at LAB_2701 both depend on ZP wrap around. I was thinking there were more instances than that, but after grabbing the latest code from the website, those were only two I could find. (I suppose I could've actually looked at the source code before running my mouth, but what's the fun in that? :)) Anyway, those two instructions won't work in native mode, so that should be a fairly easy fix.


I modified the Native Mode code I created and can now get proper values for x^2 as well as the For/Next loop working.

I'll test more code to ensure I don't have anything else obviously wrong.

Thanks for pointing those out!!!

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 01, 2009 4:56 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
I have the completed binary and source files on my website for EhBASIC running in Native mode on my SBC-3.

There is a text file with a list of all the changes made to the original source file.

There is also a readme file with instructions on loading EhBASIC on the SBC-3, cold start, warm start, LOAD and SAVE procedures.

There is a demo file that contains a small program.

Enjoy!

http://sbc.rictor.org/download/EhBASIC.zip

Daryl


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Wed Jan 02, 2013 6:37 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8503
Location: Midwestern USA
faybs wrote:
I'm sorry if this is a dumb question, but why can't one do a pc-relative jsr like this?

Code:
.macro BSR  ; Branch to Subroutine
  per *+6
  brl \0
.endmacro

That's 100% position independent and takes only 10 cycles, 6 for PER plus 4 for BRL.

It's also incorrect and will cause a return to the wrong place. I happened to see this while looking at something else concerning EhBasic and thought it would be a good idea to correct it. My '816 macros correctly implement BSR.

_________________
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  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

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