Page 3 of 5

Posted: Sun Feb 15, 2009 9:21 pm
by kc5tja
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.

Posted: Fri Feb 20, 2009 4:41 am
by DaveK
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.

Posted: Sat Feb 21, 2009 9:03 pm
by dclxvi
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.

Posted: Sun Feb 22, 2009 12:27 am
by 8BIT
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.

Posted: Sun Feb 22, 2009 2:38 am
by leeeeee
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.

Posted: Sun Feb 22, 2009 7:15 am
by 8BIT
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

Posted: Sun Feb 22, 2009 1:52 pm
by DaveK
Anyone know of a comparable BASIC for 6809/6309? I need something to run on my 6309 board.

Posted: Sun Feb 22, 2009 11:43 pm
by leeeeee
Do you know of a decent Win32 6809 emulator?

Lee.

Posted: Mon Feb 23, 2009 2:41 am
by GARTHWILSON
Lee, I can't believe you're still using Windows! :wink: I just Yahoo'ed "Linux 6809 simulator" and got 14,000 results.

Posted: Tue Feb 24, 2009 7:34 am
by kc5tja
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.

Posted: Thu Feb 26, 2009 1:33 am
by dclxvi
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.

Posted: Thu Feb 26, 2009 10:20 am
by leeeeee
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.

Posted: Sat Feb 28, 2009 8:55 pm
by 8BIT
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

Posted: Sun Mar 01, 2009 4:56 am
by 8BIT
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

Re:

Posted: Wed Jan 02, 2013 6:37 am
by BigDumbDinosaur
faybs wrote:
I'm sorry if this is a dumb question, but why can't one do a pc-relative jsr like this?

Code: Select all

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