I would trap the syntax error message and work my way back through the stack to find what gets trashed in EhBasic. Most probably the problem is in uart_tx. No registers including accumulator and processor status should be changed!
EhBasic memory locations
Re: EhBasic memory locations
ArnoldLayne wrote:
Anyone ever encountered this?
I would trap the syntax error message and work my way back through the stack to find what gets trashed in EhBasic. Most probably the problem is in uart_tx. No registers including accumulator and processor status should be changed!
6502 sources on GitHub: https://github.com/Klaus2m5
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Klaus2m5 wrote:
ArnoldLayne wrote:
Anyone ever encountered this?
Klaus2m5 wrote:
I would trap the syntax error message and work my way back through the stack to find what gets trashed in EhBasic. Most probably the problem is in uart_tx. No registers including accumulator and processor status should be changed!
Code: Select all
uart_tx:
pha
@l:
lda uart1lsr
and #$20
beq @l
pla
sta uart1rxtx
rts
Thanks,
/thomas
Re: EhBasic memory locations
OK, I didn't remember correctly! In your previous version you used chrout to your video adapter.
uart_tx looks OK off course. PLA restores A and NZ, C is never changed.
chrin is also constantly polled for [CTRL-C] and if no character is present should return carry clear (which you do) and A=0 (which you don't do). From the manual:I would add LDA #0 to chrin_nochar.
uart_tx looks OK off course. PLA restores A and NZ, C is never changed.
chrin is also constantly polled for [CTRL-C] and if no character is present should return carry clear (which you do) and A=0 (which you don't do). From the manual:
Quote:
This is a non halting scan of the input device. If a character is ready it should be placed in A and the carry flag set, if there is no character then A, and the carry flag, should be cleared.
6502 sources on GitHub: https://github.com/Klaus2m5
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Klaus2m5 wrote:
OK, I didn't remember correctly! In your previous version you used chrout to your video adapter.
uart_tx looks OK off course. PLA restores A and NZ, C is never changed.
uart_tx looks OK off course. PLA restores A and NZ, C is never changed.
Klaus2m5 wrote:
chrin is also constantly polled for [CTRL-C] and if no character is present should return carry clear (which you do) and A=0 (which you don't do). From the manual:I would add LDA #0 to chrin_nochar.
Quote:
This is a non halting scan of the input device. If a character is ready it should be placed in A and the carry flag set, if there is no character then A, and the carry flag, should be cleared.
But that doesn't seem to be the problem, I still get the same error. Further digging at the weekend then.
/thomas
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Something that just crossed my mind. I can't start EhBasic using the reset vector. So in order to be able to start it at the load address, I added a
just in front of LAB_COLD, shifting the remaining code by 3 bytes.
Could that be a problem somehow?
https://bitbucket.org/steckschwein/stec ... ic.asm-450
/thomas
Code: Select all
jmp RES_vec
Could that be a problem somehow?
https://bitbucket.org/steckschwein/stec ... ic.asm-450
/thomas
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: EhBasic memory locations
At first glance, the label RES_vec appears to me to be the address of a vector, not the address of valid machine code. At the risk of sounding foolish for assuming incorrectly or trying to tell you something you already know, you should only jmp indirectly through a vector, as in jmp (RES_vec).
Mike B.
[Edit: oops, RES_vec is the address of valid machine code, found here ... never-mind my foolishness ...]
Mike B.
[Edit: oops, RES_vec is the address of valid machine code, found here ... never-mind my foolishness ...]
Re: EhBasic memory locations
ArnoldLayne wrote:
Something that just crossed my mind. I can't start EhBasic using the reset vector. So in order to be able to start it at the load address, I added a
just in front of LAB_COLD, shifting the remaining code by 3 bytes.
Could that be a problem somehow?
Code: Select all
jmp RES_vec
Could that be a problem somehow?
Is there any background activity while EhBasic is running (timers, housekeeping, possible spurious interrupts)? Anything that could interfere with ehbasics memory locations?
Could EhBasic interfere with hardware addresses? Maybe you should move ccflag to $300.
What happens, if the UART reports a transmission error?
6502 sources on GitHub: https://github.com/Klaus2m5
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Klaus2m5 wrote:
ArnoldLayne wrote:
Something that just crossed my mind. I can't start EhBasic using the reset vector. So in order to be able to start it at the load address, I added a
just in front of LAB_COLD, shifting the remaining code by 3 bytes.
Could that be a problem somehow?
Code: Select all
jmp RES_vec
Could that be a problem somehow?
Klaus2m5 wrote:
Is there any background activity while EhBasic is running (timers, housekeeping, possible spurious interrupts)? Anything that could interfere with ehbasics memory locations?
Klaus2m5 wrote:
Could EhBasic interfere with hardware addresses? Maybe you should move ccflag to $300.
Klaus2m5 wrote:
What happens, if the UART reports a transmission error?
Re: EhBasic memory locations
So it is back to plan A. On syntax error you should print the registers, stack, page 0 and the ccflag page.
After the error, does a RUN command work (is the error transient or permanent)?
If not, have you tried a RUN command after a warmstart?
Did you ever run an exhaustive RAM test?
After the error, does a RUN command work (is the error transient or permanent)?
If not, have you tried a RUN command after a warmstart?
Did you ever run an exhaustive RAM test?
6502 sources on GitHub: https://github.com/Klaus2m5
Re: EhBasic memory locations
I have written a little tool to dump important memory locations in EhBasic.
In order to use the tool, you need to include it in min_mon.asm after the basic.asm include. This will keep EhBasic in the same place.
For the new checksum utility some more changes are required to min_mon.asm. The checksum must be initialized by inserting JMP chksum_init into the reset vector and the labels Code_base (in basic.asm) and Code_top must be defined:
In basic.asm you need to call the dump on syntax error:Although it is not necessary, JMP LAB_XERR is commented out to keep the program size the same.
When a syntax error occurs, you will seeThe dump waits for a key to allow you to get ready to capture the screen output.
UPDATE: dump.asm now dumps strings & protects code with a checksum, dumps code if checksum fails.
In order to use the tool, you need to include it in min_mon.asm after the basic.asm include. This will keep EhBasic in the same place.
For the new checksum utility some more changes are required to min_mon.asm. The checksum must be initialized by inserting JMP chksum_init into the reset vector and the labels Code_base (in basic.asm) and Code_top must be defined:
Code: Select all
; . . . .
.include "basic.asm"
.include "dump.asm" ; *** panic dump utility
; . . . .
RES_vec
CLD ; clear decimal mode
LDX #$FF ; empty stack
TXS ; set the stack
JSR chksum_init ; *** needed for dump.asm ***
; . . . .
LAB_mess
.byte $0D,$0A,"6502 EhBASIC [C]old/[W]arm ?",$00
; sign on string
Code_top ; *** label needed for dump.asm checksum
; . . . .
Code: Select all
; syntax error then warm start
LAB_SNER
JMP dump ; *** dump trap ***
LDX #$02 ; error code $02 ("Syntax" error)
; JMP LAB_XERR ; do error #X, then warm start
When a syntax error occurs, you will seeThe dump waits for a key to allow you to get ready to capture the screen output.
UPDATE: dump.asm now dumps strings & protects code with a checksum, dumps code if checksum fails.
Last edited by Klaus2m5 on Sat Nov 26, 2016 9:49 am, edited 1 time in total.
6502 sources on GitHub: https://github.com/Klaus2m5
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Awesome! Thank you very much! This is going to be helpful.
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Klaus2m5 wrote:
After the error, does a RUN command work (is the error transient or permanent)?
Klaus2m5 wrote:
Did you ever run an exhaustive RAM test?
Only the one the BIOS does, which is a very simple test that basically just checks if all the RAM is installed.
But I really should write a better one, because the "Syntax Error" problem went away after I installed different RAM-Chips.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: EhBasic memory locations
ArnoldLayne wrote:
Klaus2m5 wrote:
Did you ever run an exhaustive RAM test?
But I really should write a better one, because the "Syntax Error" problem went away after I installed different RAM-Chips.
A more exhaustive test would also use a series of shift instructions on each location, but that could quickly become too time-consuming.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: EhBasic memory locations
I am glad to hear, that you could fix the transient Syntax Error problem.
Yes, an exhaustive RAM test is too time consuming to run it as a power on self test. The BIOS basically only wants to know, wether the RAM is there or not. The typical $5A, $A5 pattern only picks up static cell failures. It does not test for data or address crosstalk or long term cell stability. You easily end up with pseudo random shifted patterns with location offset, that run for minutes just to complete a single pass.
So far I haven't found a 6502 RAM test that I liked but I must also admit, that I didn't look beyond the first few pages on a search engine.
Yes, an exhaustive RAM test is too time consuming to run it as a power on self test. The BIOS basically only wants to know, wether the RAM is there or not. The typical $5A, $A5 pattern only picks up static cell failures. It does not test for data or address crosstalk or long term cell stability. You easily end up with pseudo random shifted patterns with location offset, that run for minutes just to complete a single pass.
So far I haven't found a 6502 RAM test that I liked but I must also admit, that I didn't look beyond the first few pages on a search engine.
6502 sources on GitHub: https://github.com/Klaus2m5
-
ArnoldLayne
- Posts: 109
- Joined: 28 Dec 2014
- Location: Munich, Germany
- Contact:
Re: EhBasic memory locations
Klaus2m5 wrote:
I am glad to hear, that you could fix the transient Syntax Error problem.
EhBasic now runs perfectly stable, even the non-UART-Version using Screen output and everything.
Time to go forward and implement LOAD and SAVE and port some C64 BASIC fun stuff!
One last issue I've got, FRE(0) reports a negative number (-24xxx something) when I give EhBasic more RAM than configured now.
These are my current memory params :
Code: Select all
Code_base = $1000 ; *** RAM above code Patch ***
Ram_base = $4000 ; start of user RAM (set as needed, should be page aligned)
Ram_top = $e000 ; end of user RAM+1 (set as needed, should be page aligned)
Klaus2m5 wrote:
Yes, an exhaustive RAM test is too time consuming to run it as a power on self test. The BIOS basically only wants to know, wether the RAM is there or not.
Klaus2m5 wrote:
So far I haven't found a 6502 RAM test that I liked but I must also admit, that I didn't look beyond the first few pages on a search engine.
At least a better one is on my list. If you like it or not - we shall see.