Re: BASIC with character LCD
Posted: Sat May 27, 2017 4:07 am
Quote:
At any rate, it is more of the same. If I do a "PRINT" without anything after, it prints a CR, just like you'd expect. Is when I give it a value to print, or a string, etc. Then it freezes and I cannot control-C out of it. It doesn't like to process values or strings, it seems.
Quote:
Also, when I run it from monitor, I'm not asked cold or warm start. Does this matter?
Warm start is jumping to LAB_WARM (at $0000 after EhBasic initializes).
Here is a sample session of a minimally modified EhBasic I ran in a 6502 (really 65816) simulator:
Code: Select all
E:\65816>\65816s\release\65816s ehbas.lst
65816S Mar 6 2017 22:39:02
65c265 mode on
A=0000 X=0000 Y=0000 S=0180 EnvMXdIzc D=0000 B=00 A004B9F2 00c000 ldy #04
.g (starts 6502 execution)
Memory size ?
48383 Bytes free
Enhanced BASIC 2.22
Ready
PRINT
Ready
PRINT 2*3
6
Ready
PRINT "abcd"
abcd
Ready
A$="abCD"
Ready
PRINT A$
abCD
Ready
10 FOR I=1 TO 10
20 PRINT I
30 NEXT
RUN
1
2
3
4
5
6
7
8
9
10
Ready
A=0002 X=0000 Y=0002 S=01FB EnvMXdIzc D=0000 B=00 4A900302 000210 lsr a
.d300,37f
000300: 00 10 03 0A 00 81 20 49 C1 31 20 AD 20 31 30 00
000310: 18 03 14 00 9F 20 49 00 1E 03 1E 00 82 00 00 00
000320: 49 00 84 30 00 00 AA AA AA AA AA AA AA AA AA AA
000330: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
000340: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
000350: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
000360: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
000370: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
.dbf80,c00f
00BF80: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BF90: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFA0: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFB0: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFC0: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFD0: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFE0: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
00BFF0: AA AA AA AA AA AA AA AA AA AA AA 34 61 20 31 30
00C000: A0 04 B9 F2 E0 99 00 02 88 10 F7 A2 FF 86 88 9A
.
g
Quote:
I run BASIC from my monitor, but I don't think my monitor would affect it. BASIC should just overwrite any of MY zero page usage from the monitor, right?
I don't know if it has to do with the way the buffers and everything are set up in ram. It needed me to set RAM base and buffer location before assembling. Perhaps I am setting these wrong?
I don't know if it has to do with the way the buffers and everything are set up in ram. It needed me to set RAM base and buffer location before assembling. Perhaps I am setting these wrong?
- most of $0000..$00ff; EhBasic will overwrite anything previously there (hopefully your monitor doesn't need these values & doesn't overwrite EhBasic values while EhBasic is running)
- most of $0100..$01ff; hardware stack; you can use some stack space, just don't overwrite deeper stack entries.
- $0200..approx $0270;
- Ram_base..Ram_top-1;
Try entering 1000 at the "Memory size" prompt; this tells EhBasic to use only Ram_base thru approx 1000 .
Quote:
I am only using a 16x2 LCD, so I know that I will be printing some data in a region of the screen controller that I can't see. I am hitting enter until the screen loops back around before confirming that BASIC is in act freezing. I ordered a 40x2 LCD which should be here soon. That will allow me to see everything, though I know BASIC is crashing.
Quote:
So I currently do have it set where if no character is present, it clears carry and returns. It doesn't keep scanning the keyboard. If a key is pressed, it's loaded into the acc, carry set, and return. So it doesn't loop waiting for just a key press like before.
Quote:
Still though, no luck. A few times it printed a ? on crash
- Is the EhBasic code getting into the ROM without error? Is ROM working, properly selected & addressed? Try reading some randomly chosen bytes from the ROM & compare them to the build listings.
- Is RAM working, properly selected & addressed? Try writing some bytes at addresses scattered throughout the range, then reading all of them back & verifying they didn't change. Maybe add a "memory test" function to your monitor that fills a memory block with a pseudo-random sequence of values, then verifies all the bytes are still the pseudo-random sequence.
- Write a routine to send more characters fast to the LCD. Does it have any unexpected behavior with fast sequences, writing off the end, multiple lines, etc. ?
- When EhBasic crashes: Look at the 6502 address lines - resistors & LEDs or a logic probe or a voltmeter will do. Are they pretty constant, like the program is in a tight loop? What code is around that address?
If you can single-step the 6502, step it through several instructions - what is it doing?