MSX -> Arduino

Página 1/4
| 2 | 3 | 4

Por NYYRIKKI

Enlighted (5776)

Imagen del NYYRIKKI

19-10-2013, 09:57

As there exists plenty of low-cost Arduino shield adapters such as Bluetooth, LCD, WLAN, LAN, GSM, USB, SSD, XBee etc. I've been playing with the idea of making Arduino shield compatible MSX-cartridge.

As I don't know C-language practically at all my question is, how hard it would be to port Arduino C-source so that you could compile Arduino programs to MSX?

As Arduino has been developed to run on multiple CPU's with minimal requirements, I think this should be possible. Making something like this would give us lots of new toys to play with & tons of ready made software. Smile

Can you C-language experts tell me if I'm only dreaming or if this could be done?

Login sesión o register para postear comentarios

Por rogermm

Master (130)

Imagen del rogermm

19-10-2013, 16:08

Arduino code is C++(g++). Not C-language.

Por MsxKun

Paladin (992)

Imagen del MsxKun

19-10-2013, 17:27

" The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing)."

I don't know any C or C++ and I can program an Arduino quite easily. Yep, probably nothing ultra advanced and I need to look at some examples first, but it's not so hard.

Anyway, you can add an Arduino on the MSX PCB board to make the job and send data to it with the MSX, the Arduino and the MSX would "talk". Usuario_MSX2 pointed me to some Arduino Pro Mini on ebay that cost barely 3 euro.

Por rogermm

Master (130)

Imagen del rogermm

19-10-2013, 21:38

Wiring is C++!!!! It uses the gcc(Linux/Unix GCC) AVR compiler. I think that is a bad idea associate a complex language(C++) with Arduino. Then they called Wiring!!!
See: https://ccrma.stanford.edu/~juanig/articles/wiriavrlib/AVR_G...
http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GC...

I have coded some Arduino C++ code and I have used a lot of C++ advanced features: templates, multiple inheritance, operator overloading, function overloading, namespaces, embeded AVR assembly..., interrupt rotines

In fact code simple programs with C++(Wiring) is really easy(the complex part is hidden). But C++ complex software needs a lot of expertise.
Anyway, add an Arduino on the MSX PCB board(or cartridge) can be a easy task(Arduino programming!)

Por rogermm

Master (130)

Imagen del rogermm

20-10-2013, 02:52

Some Arduino C++ applications dont uses C++ constructs. Then I think that is possible to implement a subset of Arduino core in Z80 assembler. You will need to use a ANSI C compiler(SDCC Z80) to compile the application. Link with the MSX-Arduino engine library(Z80 asm).

Some examples which can be compiled on SDCC Z80:
http://arduino.cc/en/Tutorial/Debounce

Some examples which can be compiled on SDCC Z80 (with some patches):
http://arduino.cc/en/Tutorial/InputPullupSerial

void setup(){
//start serial connection
Serial.begin(9600); // Change to Serial->begin(9600);
//configure pin2 as an input and enable the internal pull-up resistor
pinMode(2, INPUT_PULLUP);
pinMode(13, OUTPUT);

}

void loop(){
//read the pushbutton value into a variable
int sensorVal = digitalRead(2);
//print out the value of the pushbutton
Serial.println(sensorVal); // Change to Serial->println(sensorVal)

// Keep in mind the pullup means the pushbutton's
// logic is inverted. It goes HIGH when it's open,
// and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
}
}

http://arduino.cc/en/Tutorial/PhysicalPixel

Por rogermm

Master (130)

Imagen del rogermm

20-10-2013, 03:50

Arduino C++ strings code(http://arduino.cc/en/Tutorial/StringAdditionOperator) will need more patches

Por NYYRIKKI

Enlighted (5776)

Imagen del NYYRIKKI

20-10-2013, 14:05

Ok, the lack of C++ compiler for Z80 sounds like a showstopper... I'm just wondering would it be more easy to interact with devices by patching Arduino sources or to write all from scratch in asm... Surely it depends of what device / protocol you are implementing...

Por boomlinde

Resident (54)

Imagen del boomlinde

20-10-2013, 14:21

rogermm, you wouldn't have to change any of that! You can use dot-syntax in C if "Serial" isn't a pointer, and the "Serial" object in Arduino is basically a singleton, so the methods can all refer to a global fixed structure, while "Serial" itself would just be a struct of function pointers (just a neat way to keep a namespace clean). For objects with methods that actually need to reference a particular instance, you would have to call the object with the instance as a parameter, such as "instance.method(&instance, 100);" or "instance->method(instance, 100);"

AFAIK, there's very little code in the arduino standard library that justifies the use of C++. You can do it all in C with minimal or no change in syntax.

Por boomlinde

Resident (54)

Imagen del boomlinde

20-10-2013, 14:23

Lack of operator overloading would be an issue of course, if you're aiming for strict compliance.

Por rogermm

Master (130)

Imagen del rogermm

20-10-2013, 16:49

Compilers which convert C++ to C for the purpose of compiling onto a platform that yet doesn't have a C++ compiler:

http://www.parashift.com/c++-faq/convert-to-c.html

http://stackoverflow.com/questions/1833484/c-frontend-only-c...

https://www.google.com.br/search?q=sdcc+llvm

Página 1/4
| 2 | 3 | 4