Author Topic: Bugs running MCS BASIC-52 on 8052  (Read 9881 times)

0 Members and 1 Guest are viewing this topic.

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Bugs running MCS BASIC-52 on 8052
« on: January 26, 2016, 04:07:49 pm »
Hey! So I've run into a strange problem, trying to get a junk 8052+eprom board to run MCS-basic.
It's occuring with both BASIC-52 V.1.1 (Intel's) and V1.2 (modified to work with 8051's as well).

I added 8K SRAM at 0000h in memory, for it to run basic, and it boots BASIC,
auto-detects baudrate to the terminal and everything.

But any operation that would require RAM, it seems returns "Error: invalid line number"
When I try to print mtop, it returns 0, and when I set it to something high, like 7FFFh, the error persists.

It seems like it isn't accessing the RAM properly, but it must do, since it won't boot at all without it.
All chips are tested good, btw.

Is BASIC taking my entire RAM? Should I add another 8K? Is it the wrong place in memory?

I'm at a loss!

Thanks in advance!

--Christoffer

--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Re: Bugs running MCS BASIC-52 on 8052
« Reply #1 on: January 26, 2016, 04:53:10 pm »
Upgraded to 32K SRAM - still boots fine, still same issues.
RAM and ROM are both addressed in the same space from 0000H, since it's Harvard architecture,
it has a "program-read" that enables the eprom, and "data read/write's" for the RAM.

--Christoffer
--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Bugs running MCS BASIC-52 on 8052
« Reply #2 on: January 26, 2016, 06:57:48 pm »
Quote
But any operation that would require RAM, it seems returns "Error: invalid line number"
Such as?   Are you able to get it to remember entered lines of a program?

Quote
It seems like it isn't accessing the RAM properly, but it must do, since it won't boot at all without it.
It could be using on-chip RAM for the "OS" and interpreter variables, and only using external RAM for storing the program and/or big arrays?

Where did you get the MCS-Basic from?
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Bugs running MCS BASIC-52 on 8052
« Reply #3 on: January 26, 2016, 07:09:23 pm »
Which RAM device you use? Have you checked that the device doesn't have any extra chip selects and that you enable the /CS along with the /RD and /WR.
 

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Re: Bugs running MCS BASIC-52 on 8052
« Reply #4 on: January 26, 2016, 07:14:11 pm »
Quote
But any operation that would require RAM, it seems returns "Error: invalid line number"
Such as?   Are you able to get it to remember entered lines of a program?

Quote
It seems like it isn't accessing the RAM properly, but it must do, since it won't boot at all without it.
It could be using on-chip RAM for the "OS" and interpreter variables, and only using external RAM for storing the program and/or big arrays?

Where did you get the MCS-Basic from?


Almost any operation, like entering any line of code like 10 print "something"
or trying to use LIST to list current program in RAM.

I got the basic distributions from this page; V1.1 is INTEL's, the rest are modifications
http://www.dos4ever.com/8031board/8031board.html


Which RAM device you use? Have you checked that the device doesn't have any extra chip selects and that you enable the /CS along with the /RD and /WR.

The RAM (62256, now) has two chip selects, a /WR and an /OE - all chip selects are tied to active, because I only have one memory device.

--Christoffer
--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: Bugs running MCS BASIC-52 on 8052
« Reply #5 on: January 26, 2016, 09:49:32 pm »
the ah basic does NOT use the standard memory layout.
http://www.nomad.ee/micros/Basic52Manual.pdf
the eprom is dual mapped in rom and ram space
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: Bugs running MCS BASIC-52 on 8052
« Reply #6 on: January 26, 2016, 10:02:11 pm »
1.9 ANSWERS TO A FEW QUESTIONS
QUESTION
After RESET or power-up, MCS BASIC-52 does not return the proper value for MTOP, what's the
problem?
ANSWER
Virtually every time this problem occurs it is because something is wrong with the decoding circuitry in
the system or one or more of the address lines to the RAM are open or shorted. The user should make
sure that all of the address lines to the system RAM are connected properly!
A simple memory test can be implemented in the COMMAND MODE to verify the addressing to the
RAM. First set XBY(1000H) = 55, then walk ones across the address (i.e. P. XBY(1001H) - P.
XBY(1002H) - P. XBY(1004H) -- P. XBY(1008H) P. XBY(1010H)) until all locations are tested. If for
instance, P. XBY(1008H) returns a result of 55, then address line 3 (A3) would probably be open or
shorted.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Bugs running MCS BASIC-52 on 8052
« Reply #7 on: January 26, 2016, 10:10:05 pm »
years ago I designed and built a tiny board like the one in the topic title: it works perfectly!

my board has
- external 27257, 32Kbyte EPROM (fetch only), BASIC takes the first 8Kbyte, my routines follow
- external 62256, 32Kbyte RAM (data only)
- external 3x 8Kbyte NVRAM (combining PSEN + R/W, so I can fetch and read/write data)
- external add on board, ADC 16 channels @ 14bit, RELE array(16), LCD, etc etc, including an ACIA@9600bps

and it has just worked greatly for the last 20 years
never turned off, it's the main controller of my greenhouse

the NVRAM takes a basic script plus environment data, and it's non volatile due to the DALLAS chip
« Last Edit: January 27, 2016, 11:58:05 am by legacy »
 

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Re: Bugs running MCS BASIC-52 on 8052
« Reply #8 on: January 26, 2016, 11:28:22 pm »
The MCS-51 manual does not mention having BASIC in external ROM. But the "microcontroller idea book" - featuring the 8052AH-basic does. It specifically said to have both atleast 2K RAM and BASIC in ROM at 0000H, but of course, this may be wrong.

I'll run the mentioned memory test later, didn't even notice that Q/A section of the manual!

Thanks for the hints!

It's worth noting, that I have the /EA pin tied low, to disable internal ROM, since I use some pre programmed 8052 - This essentially turns it into an 8032.

--Christoffer
« Last Edit: January 26, 2016, 11:31:15 pm by ChristofferB »
--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Bugs running MCS BASIC-52 on 8052
« Reply #9 on: January 27, 2016, 11:42:57 am »
Did you make a PCB?  8051 systems all apparently pre-date EAGLE, so I've been unable to find a simple PCB I could send off to OSHPARK or equivalent.
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Bugs running MCS BASIC-52 on 8052
« Reply #10 on: January 27, 2016, 11:50:33 am »
Did you make a PCB?

I did, 20 years ago, with OrCad for DOS  :-//
I am going to take a photo
 
The following users thanked this post: AndersJ

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Bugs running MCS BASIC-52 on 8052
« Reply #11 on: January 27, 2016, 02:55:26 pm »



I built 2 boards, one is currently in use in my greenhouse, so here it is the photo of her twin sister
 

Offline matseng

  • Frequent Contributor
  • **
  • Posts: 563
  • Country: se
    • My Github
Re: Bugs running MCS BASIC-52 on 8052
« Reply #12 on: January 27, 2016, 03:42:05 pm »
Just to chime in on this conversation (to get them in my "unread" list) I just wanted to say that I recently found two 8052-BASIC chips in my junk drawers.  They have the old revision 1.0 of the basic interpreter that apparently is unobtanium as a download on the internets :-) Not sure why anyone would like to run the 1.0 when the newer bugfixed versions are around.  If I get them up and running I hope to be able to dump the roms and "donate" them to community.

 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Bugs running MCS BASIC-52 on 8052
« Reply #13 on: January 27, 2016, 04:55:39 pm »
mine is v1  :-//
 

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Re: Bugs running MCS BASIC-52 on 8052
« Reply #14 on: January 27, 2016, 11:37:09 pm »



I built 2 boards, one is currently in use in my greenhouse, so here it is the photo of her twin sister

Wow! That's really a nice looking board! Love the Eurocard/Din4.1612 format!

-The v1.0 basic is, as far as i know, REALLY rare, I'm sure a lot of people would be grateful if you decide to dump it :)

--Christoffer
--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: Bugs running MCS BASIC-52 on 8052
« Reply #15 on: January 29, 2016, 02:38:52 am »
It is nice that you can recycle these chips even if they are OTP by telling them there's an external rom.
The larger the government, the smaller the citizen.
 

Offline ChristofferBTopic starter

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: dk
  • Chemistry phd student!
    • My channel:
Re: Bugs running MCS BASIC-52 on 8052
« Reply #16 on: January 29, 2016, 02:25:51 pm »
It is nice that you can recycle these chips even if they are OTP by telling them there's an external rom.

Indeed! Before I knew, I used to throw them out, thinking that a mask programmed µC was useless.
Such a waste..

--Christoffer
--Christoffer //IG:Chromatogiraffery
Check out my scientific instruments diy (GC, HPLC, NMR, etc) Channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ
 

Offline Stonent

  • Super Contributor
  • ***
  • Posts: 3824
  • Country: us
Re: Bugs running MCS BASIC-52 on 8052
« Reply #17 on: February 02, 2016, 01:12:11 am »
It is nice that you can recycle these chips even if they are OTP by telling them there's an external rom.

Indeed! Before I knew, I used to throw them out, thinking that a mask programmed µC was useless.
Such a waste..

--Christoffer

Actually I'd bet there was some smart guy/gal out there that used that to their advantage. They could sell a product that comes with the OTP version by default for cost, but you can optionally buy an upgrade chip to install in a socket next to it for some special add-on feature.

Or maybe just have two different modes in the product, selectable by a swtich.
The larger the government, the smaller the citizen.
 

Offline CDI1977

  • Contributor
  • Posts: 12
  • Country: ca
Re: Bugs running MCS BASIC-52 on 8052
« Reply #18 on: November 07, 2019, 09:14:19 pm »
I am playing with MCS-52.

I think you are in PROM mode, type RAM then it will accept statements.
 

Offline Jacon

  • Regular Contributor
  • *
  • Posts: 50
  • Country: pl
Re: Bugs running MCS BASIC-52 on 8052
« Reply #19 on: November 08, 2019, 06:40:42 am »
Pls check the dates of threads you're trying to reply to
- you just commented on post dated over 3.5 years ago  :palm:
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: Bugs running MCS BASIC-52 on 8052
« Reply #20 on: November 10, 2019, 06:57:59 am »
Pls check the dates of threads you're trying to reply to
- you just commented on post dated over 3.5 years ago  :palm:
It's OK. Some of us only read this thread just now, and might be curious to know the answer.

That 'PROM' mode is interesting! I don't think it's the problem here though, because it should display "ERROR: PROM MODE" if you try to edit a program.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4782
  • Country: pm
  • It's important to try new things..
Re: Bugs running MCS BASIC-52 on 8052
« Reply #21 on: November 10, 2019, 09:24:03 am »
Any practical experience with porting the 8052AH-Basic onto the Dallas DS89C440, DS89C450 ??
I've got few in DIL40 (up to 33MHz single clock/instr 805x, 32/64kB of on-chip flash with internal serial programmer), I think I need a fast 3973 and a 32-64kB 8-10ns sram (I collected few from old pentium motherboards), that is all..
« Last Edit: November 10, 2019, 09:28:00 am by imo »
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Bugs running MCS BASIC-52 on 8052
« Reply #22 on: November 10, 2019, 02:39:28 pm »
I uploaded a couple of firmware here. I can no more find basic v1.0, but I uploaded v1.2.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1416
  • Country: us
  • Very dangerous - may attack at any time
Re: Bugs running MCS BASIC-52 on 8052
« Reply #23 on: December 30, 2019, 07:47:35 am »
But any operation that would require RAM, it seems returns "Error: invalid line number"
When I try to print mtop, it returns 0, and when I set it to something high, like 7FFFh, the error persists.

This problem is caused by RAM being shadowed (repeating at following addresses). The fix is to do more complete addresses decoding. I am using a 62256 SRAM (32k x 8) and fixed the problem by connecting /CE to A15 so the RAM appears only in the lower 32k.

« Last Edit: December 30, 2019, 08:22:32 am by oPossum »
 
The following users thanked this post: edavid

Offline JohnnyQuest1111

  • Newbie
  • Posts: 3
  • Country: us
Re: Bugs running MCS BASIC-52 on 8052
« Reply #24 on: August 13, 2020, 01:09:15 am »
I know this topic has been visited more than 120 days ago but as I did not see any of the posts explaining the memory mapping required by MCS-BASIC, I was compelled to post. In the interest of those that are just now starting to explore the subject of 8052 and MCS-BASIC, I offer the following information with the hopes this explanation helps others that are working with (newly found?) 8052AH-BASIC parts or just wish to play with the 8052-BASIC.

Back in 2018, I spent some time researching and developing a minimal 8052 design. The project blog is here: http://8052sbc.wordpress.com. Although the main MCU would take an 8051 pin-compatible device, I used an ATMEL/MICROCHIP AT89S52 with internal 8KB of FLASH and 256 bytes of Internal RAM. I used a CPLD to implement 2 different address decoding schemes based on the level of the EA pin. It is currently running MCS-BASIC V1.30 (Bohling-Wulf) version, which implements EEPROM for saving programs. The addresses of memory are as follows; 8KB FLASH @ 0x0000 to 0x1FFF in program space (!PSEN and !RD), 32KB of SRAM from 0x0000 to 0x7FFF in data space (!RD/!WR and PSEN) and 8KB of EEPROM from 0x8000 to 0xBFFF in program/data space (!PSEN and !WR/!RD). From what I derive, this addressing scheme IS NOT the same as the original OP is attempting with his board, hence the reason it didn't work.

In addition, I recently pulled my NMIY-0031 board (circa 1994) off the shelf after more than a few years of collecting dust and programmed an 8KB EEPROM as program memory with the v1.3 version of MCS-BASIC and tried it. It works fine. The NMIY-0031 is strapped for mapping the 8KB EEPROM @ 0x0000 to 0x1FFF in program space and 32K of SRAM from 0x0000 to 0x7FFF in data space and the other 32KB of SRAM from 0x8000 to 0xFFFF in combined program/data space, which makes MCS-BASIC think there is EEPROM available for storing programs. MCS-BASIC used the 8052 because it has 256 bytes of internal RAM as opposed to the earlier 8051 series with 128 bytes of IRAM. Long ago, I replaced the original 8051 on the NMIY-0031 board with an INTEL 80C51FA part, which has 256 bytes of IRAM. So MCS-BASIC works properly on any 8051 part that supports 256 bytes of IRAM, has internal or external ROM mapped in starting at address 0x0000 in program space and has SRAM mapped in starting at address 0x0000 in data space.

Peace and blessing,
JQ
« Last Edit: August 13, 2020, 05:43:52 am by JohnnyQuest1111 »
 
The following users thanked this post: oPossum


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf