Getting EhBasic on the Micro UK101

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
Post Reply
micro_brain
Posts: 85
Joined: 31 Mar 2011

Getting EhBasic on the Micro UK101

Post by micro_brain »

According to Lee's EhBasic site, in order to run it on a 6502 SBC like the Micro UK101 I just completed, I the addresses of routines for input and output. Unfortunately I can't yet decipher 6502 machine code so the CEGMON disassembly so I can't see where the i/o routines are. I assume you have to give these addresses to the assembler when building the interpreter. Is there a convention for parameter passing for these functions that Lee's BASIC is expecting?

Also, for burning the EEPROM, I'm not sure where to put the BASIC. I guess it needs to be at the same address as the 8k Microsoft incumbent (that would be 0xA000), but it's a guess.

Can anyone offer some clues?

Thanks

JonB
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

The vectors are normally found near the top of memory, and so it is in this case: you want
FFEB INVEC
FFEE OUTVEC
and the calling convention is to pass the parameter/result in A.
(With high degree of confidence, but not certainty)

As for the base address, just be sure that EhBASIC doesn't overrun the monitor at F800 and you should be OK.

Oh, and you need to be able to enter EhBASIC somehow. Cegmon has 0xBD11 burned in as the cold reset entry point (for 'C') at address 7f3a / ff3a. But I suppose you can enter using the monitor.

Cheers
Ed
micro_brain
Posts: 85
Joined: 31 Mar 2011

Post by micro_brain »

Well, the CEGMON cold reset point is changeable as it is a vector, right? So that's fine, I can amend prior to burning the EPROM. What about warm reset vector? My intention is for it to work like the existing basic so I don't need to drop into the monitor to launch BASIC. I'm sure Lee has a ROM for the MUK101; he refers to it somewhere in my build thread.

Seems to me that I'd always want CEGMON in there for pretty well anything I want to burn on the EEPROM. But all I really need is the I/O routine, as I can't imagine why I need to use the monitor if I'd developed the actual program on an emulator (which I would).

Cheers

JonB
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

Why not create a micro-monitor with just simple I/O routines? Unless you plan to use CEGMON, you don't need it.
Bill
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

I think I want to do this too. If I get done before you Jon, I'll give you a hand of even send you my HEX file to burn. I'm going to do it without CEGMON though.
Bill
micro_brain
Posts: 85
Joined: 31 Mar 2011

Post by micro_brain »

BillO wrote:
Why not create a micro-monitor with just simple I/O routines? Unless you plan to use CEGMON, you don't need it.
Indeed.. but I haven't got any 6502 experience yet (I know, it's a good start point, but this is why I bought a BBC Micro).

I would be very interested in a working binary of your finished ROM. I'm not really interested in Ceggy anyway, it's just a board for mucking about in BASIC. Although, writing a decent screen editor and patching it into the interpreter might be fun. I like the Sinclair Spectrum's approach to editing program lines (not too sure about all the tokenised keywords though)... and I think it should do syntax checking when you enter the line rather than at runtime (this'd speed it up). So, ultimately I may end up hacking EhBasic about a little anyway.
micro_brain
Posts: 85
Joined: 31 Mar 2011

NEW IDENTITY

Post by micro_brain »

Guys, I am going to start using a new identity on 6502.org. From now on, I will be using the forum account "jonb" as it seems better than "micro_brain" (dunno why I chose that one..).

Cheers

JonB
jonb
Posts: 104
Joined: 08 May 2011

Post by jonb »

Here I am.. :D
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

Okay, had a chance to look at this.

Grant's decoding looks like it produces a memory map like this:

0000 - 7FFF : RAM
8000 - 9FFF : Nothing
A000 - BFFF : ROM (BASIC is here)
C000 - EFFF : Nothing
F000 - F7FF : ACIA selected many times
F800 - FFFF : ROM (CEGMON is here)

Now I remember why I modified his decoding. EhBASIC will not fit into this map because it assembles to more than 8K.

Jon, I altered Grant's decoding considerably. It's not more complicated but just works better. My decoding fills in those holes with ROM. The original ROM still works, but it gives you a whole lot more room for other things. It looks like this:

0000 - 7FFF : RAM
8000 - EFFF : ROM
F000 - F7FF : Eight 256 byte I/O blocks (ACIA is at F000 + F001)
F800 - FFFF : ROM

I can send you the revised decoding logic, but it will require you to make some substantial changes to your board wiring, or build a second board. Let me know if you are interested in doing that, but I can't fit EhBASIC into the original micro-UK101.
Bill
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

Okay, I had a few more minutes and ...

Wrote the code to initialize the 6850 and the basic I/O routines.
Edited these into Lee's mini_mon.asm
Changed basic.asm to put EhBASIC at $8000
Assembled it in Michal Kowalski's emulator
Burned into a 27C256
And now ...

I have EhBasic running on my board! Works well too. Thanks for writing this interpreter Lee.
Bill
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Post by BillO »

Jon,

I have figured out a way to get your board to run either ROM just by adding 1 chip and only making minor wiring changes.

You’ll need a 74LS30 (8 input nand gate) added to the board. Connect pin 7 to ground and pin 14 to VCC.

These changes are assuming you wired things exactly as Grant instructed.

1) Disconnect pins 12 and 13 of the 74LS00 from pins 12 and 13 of the 74LS138
2) Disconnect pin 11 of the 74LS00 from pin 12 of the 74LS02.
3) Connect pin 7 of the 74LS30 to ground and pins 12 and 14 to VCC.
4) Connect pins 9 thru 15 of the 74LS138 to pins 1 thru 6 and pin 11 of the 74LS30, order is not important.
5) Connect pin 8 of the 74LS30 to pin 12 of the 74LS02

Test this with the UK101 ROM. It should work fine.

This will make the memory map like mine except the I/O select block.

PM me with an e-mail address and I will send you the EhBASIC BIN file and the modified source files
Bill
jonb
Posts: 104
Joined: 08 May 2011

Post by jonb »

Ahh, this could be fun... PM sent!

Hmm, to be fair, the ACIA should occupy only what it needs and not be copied over a range. I realise this means more decoding logic, but it's better to have more space for ROM. Could you send me your new glue schematic as well, please? I may redo this board if it looks straightforward enough.

Thanks

JonB
Post Reply