So, regarding BASIC:
I've spent quite a lot of time reading EhBASIC's source and chasing things around. I just can't find the things I want... I like to comment my code delimiting the major parts, I can figure out the details if I need to. But I just find details and not the general flow of things on the BASIC source...
So here is what I've done so far:
On the BASIC source I've changed the following line:
Code:
Ram_top = $6F00 ;= $C000 ; end of user RAM+1 (set as needed, should be page aligned)
And assembled it on the Kowalski simulator.
I wrote a couple routines to match what the mim_mon.asm example does. (Or I think it does). I only "initialized" INPUT and OUTPUT vectors, as I'm not doing anything with LOAD, SAVE or interrupts just yet.
Code:
;************************************************************
;* EH BASIC ROUTINES *
;************************************************************
;###############START######################
basicStart: lda #lo basicIn ;INPUT VECTOR
sta $205
lda #hi basicIn
sta $206
lda #lo basicOut ;OUTPUT VECTOR
sta $207
lda #hi basicOut
sta $208
ldx #$ff ;RESET STACK
txs
printMacro "\nEhBASIC [C]old/[W]arm?"
bSKb: lda kbBuffer
beq bSKb
ldy #$0
sty kbBuffer
cmp #'W'
beq doWarm
cmp #'C'
bne basicStart
jmp coldStart
doWarm: jmp warmStart
;###############INPUT#####################
basicIn: lda kbBuffer
beq bIEnd ;No key
pha ;Clear buffer
lda #0
sta kbBuffer
pla
sec
rts
bIEnd: clc
rts
;############OUTPUT#######################
basicOut: jsr vgaTerm ;Pla affects N and Z
rts
basicStart is called by the monitor with the 'B' command.
I moved the monitor and I/O code to $F000, reduced the zero page use to a minimum, so the monitor only uses $e2 to $ee, which are said to be unused in the BASIC source, and moved the monitor's input buffer to the top of RAM, out of the BASIC area (That is $6F00...$6FFFF).
I also modified the monitor so upon a BRK it shows the program counter and registers, and also has ability to continue after the BRK, to aid in debugging. At this rate, my monitor is going to be pretty powerful by the time I get BASIC is running...
So, after joining basic and my monitor on the EEPROM programmer software, and programming the ROM, here is what happens:
I do get the Memory size ? prompt. Writing a number sometimes results in it giving a sensible output, others it gives random letters in place of the number of bytes free.
If I press CR, it goes on to detect how much memory is available. Sometimes it gives a number (not always the same one), others more random letters. (Which, in case it makes a difference, have bit 7 set).
Ignoring all this, if one types LIST or RUN, it responds with the usual "ready" as no program was entered.
Entering something like PRINT "HELLO" does in fact print HELLO, but actually trying to store a program in memory with line numbers does not. For example, after 10 PRINT "HELLO" and CR, it either executes a BRK and goes back to the monitor, or gets in an infinite loop. See "screenshots" attached.
I'm using the version of EhBASIC with the decimal mode patch, as my CPU does not have decimal mode.
So character input/output is working, but not much else. I don't really know what to to with this. One might suspect monitor and BASIC zero page overlapping or something, but I made sure I'm only using the bytes marked as unused on the source.
I read on this thread:
viewtopic.php?f=5&t=5036 that $14 - $5A was allegedly free as well.
Any insight is certainly welcome.
Again, I'm not sure if I should post this here or create a separate thread on the EhBASIC sub-forum. I may try something like tiny Basic that I can perhaps understand more easily.
Juan