Jump to content
IGNORED

Programming with c#


MasterI

Recommended Posts

I am working on using C# (or Basic or Java) for the XL/XE - and I am at starting phase :-)

I have the first 6502 Asm-Files generated and compiled them with the atasm compiler on the PC.

After that I am stuck. I converted the .65o file to data lines for Turbo Basic to test the first routines in Page 6.

I am using the Atari800Win V4.0 Emulator and I haven´t manged to bring in code (or even Text from the clipboard) from the pc in a fast way to the emulator.

After typing in the code by hand it seems to work, but is not optimized and I don't want to type it in every time.

What kind of transfer do you prefer for development on PC and testing on emulator ?

Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE - and I am at starting phase :-)

I have the first 6502 Asm-Files generated and compiled them with the atasm compiler on the PC.

After that I am stuck. I converted the .65o file to data lines for Turbo Basic to test the first routines in Page 6.

I am using the Atari800Win V4.0 Emulator and I haven´t manged to bring in code (or even Text from the clipboard) from the pc in a fast way to the emulator.

After typing in the code by hand it seems to work, but is not optimized and I don't want to type it in every time.

What kind of transfer do you prefer for development on PC and testing on emulator ?

 

Huh?

Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE - and I am at starting phase :-)

I have the first 6502 Asm-Files generated and compiled them with the atasm compiler on the PC.

After that I am stuck. I converted the .65o file to data lines for Turbo Basic to test the first routines in Page 6.

I am using the Atari800Win V4.0 Emulator and I haven´t manged to bring in code (or even Text from the clipboard) from the pc in a fast way to the emulator.

After typing in the code by hand it seems to work, but is not optimized and I don't want to type it in every time.

What kind of transfer do you prefer for development on PC and testing on emulator ?

Atari800Win plus (and Atari800) expects text files to be linux style, i.e just linefeeds to terminate a line vs CR/LF. I think Atari800win plus has a text converter. If not find and download joyfulcoder's very good, utility called Memopad. It's a universal text viewer for ATASCII or ASCII (LF or CR/LF for end of line) and it can convert your text to have Atari EOLs.

 

To actually load text files into the emulator the easiest method is to put your files in a subdirectory and point one of the H: drives at that directory. From BASIC you can then simply type ENTER H:myprog.lst. You don't even need Atari DOS to use the H: drives.

 

Another way you could load raw binary data into the emulator is via the monitor (F8 key). The syntax to do this is "READ filename startaddr nbytes". Typing CONT returns you to emulation mode.

 

It's quick and dirty and you don't have to create a BASIC program just to do a test.

 

- Steve Sheppard

Edited by a8isa1
Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE - and I am at starting phase :-)

I have the first 6502 Asm-Files generated and compiled them with the atasm compiler on the PC.

After that I am stuck. I converted the .65o file to data lines for Turbo Basic to test the first routines in Page 6.

I am using the Atari800Win V4.0 Emulator and I haven´t manged to bring in code (or even Text from the clipboard) from the pc in a fast way to the emulator.

After typing in the code by hand it seems to work, but is not optimized and I don't want to type it in every time.

What kind of transfer do you prefer for development on PC and testing on emulator ?

 

ATASM can directly asemble binary code into an ATR or XFD File. This file can then 'mounted' into the Emulator. That should be the fastes way to bring the assembled binary into the Emulator.

 

I guess you are using C# or Java on the PC to 'compile' a High Level Language to 6502 Assembler code, then assemble this on the PC to a 6502 binray, and send then to the 6502, right? Or are you trying to port C# or Java to the 6502 (which is not impossible I guess, as both are basically stack machines, but it is a huge task).

 

CArsten

Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE

C# or Java aren't going to happen on the A8s

 

I am about to make it happen. Think of it as translating output of C#, Java, Basic - ILASM to 6502 Assembler. But it is still in exploring Phase, there are a few limitations in using c# on the small Atari, but it is already working with the first little test.cs.

 

I decided that

- Integer would not be 32 Bit

- Reflection will not work

 

Maybe all will fail on something, but I am going to find out what it is :-)

Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE

C# or Java aren't going to happen on the A8s

 

I am about to make it happen. Think of it as translating output of C#, Java, Basic - ILASM to 6502 Assembler. But it is still in exploring Phase, there are a few limitations in using c# on the small Atari, but it is already working with the first little test.cs.

 

I decided that

- Integer would not be 32 Bit

- Reflection will not work

 

Maybe all will fail on something, but I am going to find out what it is :-)

 

The C# and Java byte code require virtual machines, it is not simply a matter of translating the byte code to 6502 ASM. You'll need to implement the virtual machines on the A8, and that just isn't going to happen. You'll have to seriously castrate the VMs to have any chance of running one in 64K. I doubt even the garbage collector would fit.

 

I suspect trying to actually compile to 6502 machine code would be worse. You might be able to get a trivia example up and running, but anything beyond that really isn't feasible.

 

Then there's the issue of the class libraries, C# or Java without class libraries isn't worth a lot.

 

I applaud your efforts, but this is putting 3 liters of soda in a shot glass.

Link to comment
Share on other sites

The C# and Java byte code require virtual machines, it is not simply a matter of translating the byte code to 6502 ASM. You'll need to implement the virtual machines on the A8, and that just isn't going to happen. You'll have to seriously castrate the VMs to have any chance of running one in 64K. I doubt even the garbage collector would fit.

 

I don't think so. I reasonable Java VM would fit in 32 K or so, even with garbage collection. But what would be the sense of it? The overhead of executing bytecode is high on 8bit machine, especially on the 6502. Look at the JavaME VMs available for mobile devices.

 

Compiling Java or C# source to 6502 Assembler or machinecode would be a syntax frontend for C-like languages. Why not directly use CC65 then? Java and C# are interesting to developers because of their bytecode nature and their class libraries (not because they are esp. good languages). Both will not be available on the A8.

 

JavaScript or other Prototype based languages like Lua or Self would be more interesting on a A8.

 

Carsten

Link to comment
Share on other sites

I am working on using C# (or Basic or Java) for the XL/XE

C# or Java aren't going to happen on the A8s

 

I am about to make it happen. Think of it as translating output of C#, Java, Basic - ILASM to 6502 Assembler. But it is still in exploring Phase, there are a few limitations in using c# on the small Atari, but it is already working with the first little test.cs.

 

I decided that

- Integer would not be 32 Bit

- Reflection will not work

 

Maybe all will fail on something, but I am going to find out what it is :-)

 

The C# and Java byte code require virtual machines, it is not simply a matter of translating the byte code to 6502 ASM. You'll need to implement the virtual machines on the A8, and that just isn't going to happen. You'll have to seriously castrate the VMs to have any chance of running one in 64K. I doubt even the garbage collector would fit.

 

I suspect trying to actually compile to 6502 machine code would be worse. You might be able to get a trivia example up and running, but anything beyond that really isn't feasible.

 

Then there's the issue of the class libraries, C# or Java without class libraries isn't worth a lot.

 

I applaud your efforts, but this is putting 3 liters of soda in a shot glass.

 

I thought of running compiled code on the 6502 without any JIT-Compiler, because it is too big (as you mentioned). Garbage Collection is not done yet, but is possible if it is not a parallel task like in c# but like in C++.

 

Libraries for C# can be compiled to 6502 but I think the standard libraries will be to big for 64k. So the librarries must be build like a super compact framework. There will be not much compatibility to existing programs, but that is not the intention.

What kind of programs are build on the Atari ?

I thought of libraries for graphics, joysticks and sound. A system.string will be nice, but a DateTime is not necessary for me at first. But if it is, one can do something like that. I thought of programming games like all others do :-) (on the Atari 8 Bit). And I thought of doing some of the functions as a linkable library in handmade-assembler for speed purposes.

So it looks like Basic but it is expandable - unless the ram is full.

The shot glass contains 64KB - or 40k of usable ram. If you compare that to a 1.5 GB free Laptop ram it will be an amount of 1500 liter soda.

So it is impossible. But I do it anyway :-) And if it is not enough ram, then I can switch to an Amiga. If it is plenty I will switch to a tamagotchi.

But I set the goal to be an Atari 8 bit and that makes the borders. How big can the library be ? What about 10k or 16k ?

So the implementation of graphics does not mean using DirectX 10 :-). -> It is more C# but less the .Net Framework.

Maybe I schould use another name for it, so it is better accepted: 8C# for 8bit C# or ABC# for Atari binary c# or ...

- It is work to make a library

- Building optimized compact and fast 6502 Code out of the IL is a complex thing (but interesting)

 

You know much about c# and the Atari. If that limitations are fixed and there has to be an implementation, what would you do ?

Link to comment
Share on other sites

TCL would be a comparatively quick implementation, and might be better to start with, because it is much smaller. A tiny TK subset could also be fun.

 

In fact, a Bourne shell (sh) scripting language front-end to Spartados might be an even quicker & more satisfying thing to do, and a lot of people would love it.

 

Another fun port would be AmigaDos CLI, implemented in the same fashion as sh, above.

 

 

All of those things would be cool on an Atari.

Link to comment
Share on other sites

I don't think so. I reasonable Java VM would fit in 32 K or so, even with garbage collection. But what would be the sense of it? The overhead of executing bytecode is high on 8bit machine, especially on the 6502. Look at the JavaME VMs available for mobile devices.

JavaME is hardly Java per se, and even at 32K, that doesn't leave much for application data and programs (or class libraries)

 

OOP Languages with VMs and class libraries aren't a very good fit for the A8. They trade speed, efficiency and memory footprint for their ease of use. All things that our little A8's don't have to spare.

 

TCL would be a comparatively quick implementation, and might be better to start with, because it is much smaller. A tiny TK subset could also be fun.

 

In fact, a Bourne shell (sh) scripting language front-end to Spartados might be an even quicker & more satisfying thing to do, and a lot of people would love it.

 

Another fun port would be AmigaDos CLI, implemented in the same fashion as sh, above.

 

All of those things would be cool on an Atari.

bash would be a nice start... maybe something like BusyBox too, a much better fit for the A8.

Link to comment
Share on other sites

TCL would be a comparatively quick implementation, and might be better to start with, because it is much smaller. A tiny TK subset could also be fun.

 

In fact, a Bourne shell (sh) scripting language front-end to Spartados might be an even quicker & more satisfying thing to do, and a lot of people would love it.

 

Another fun port would be AmigaDos CLI, implemented in the same fashion as sh, above.

 

 

All of those things would be cool on an Atari.

 

Then do it! (Really). You thought of what would be nice and now you should do it.

 

I am using the output of C# (from VS2008 on PC) and converting it to 6502 on A8. I can´t see how I can do the shells in that way. That would be totally different work. Is anything written in C# ? If it is C, I suggest to use cc65 and convert the sources. Personally I find shells and scripts a bit boring. I am motivated in doing a kind of C# or however it is called as a A8 subset.

 

The way I am going is easy and agile, because it already works and now I can improve it step by step.

Link to comment
Share on other sites

That's ironic, I find both Java & C# to be the incredibly boring result of khaki-wearing-goatee-having-Dockers-doting-belly-over-over-the-star-trek-utility-belt-wearing-

future-VW-Geek-Squad-Driving-imp-pawns-of-middle-management.

 

But that's just me.

 

 

Let us all know when you get HoopSnake v.1.0 rolling for the Atari, Sparky.

Link to comment
Share on other sites

That's ironic, I find both Java & C# to be the incredibly boring result of khaki-wearing-goatee-having-Dockers-doting-belly-over-over-the-star-trek-utility-belt-wearing-

future-VW-Geek-Squad-Driving-imp-pawns-of-middle-management.

 

But that's just me.

 

Let us all know when you get HoopSnake v.1.0 rolling for the Atari, Sparky.

 

So now we have a competition ?

You do the cli-shell-stuff (and a game of your choice if you wish) and I do what makes me happy and a game. And if I find something interesting for a game with the name HoopSnake then I will do it too !

 

BTW: C# is mainly from Anders Hejlsberg who brought us Turbo Pascal long ago. He has improved things and hopefully will in future.

BTW2: Star trek is cool, VW not, middle-management would be cool. I know c# and that is cool for me too.

Link to comment
Share on other sites

Somebody watches a lot of martial arts movies.

 

= )

 

 

Let me guess, you live in some remote part of the planet, right?

 

It's OK, just take the case off of your PC, to keep you warm through the six months of darkness, and implement this language to keep you company.

 

= )

 

Totally wrong UNIXcoffee928.

- You don´t understand what I am doing.

- It´s already working

- Seemingly you have no idea of thermodynamics

 

I wanted to know how to get text into the emulator and got answers on that. And now it works.

Thanks for that again.

Link to comment
Share on other sites

Hi poobah and UNIXcoffee928,

 

please don't be too negative on this project. As I understand it, MasterI is not implementing a VM to execute C# on the A8. Instead it is a crosscompiler to compile CIL (http://en.wikipedia.org/wiki/Common_Intermediate_Language) to 6502 machinecode on the PC, then the machinecode will then be executed. I also guess that it can not only crosscompile C#, but also the output of other .NET languages like Oberon, Pascal, IronPython ....

 

Depending on the quality of the generated machinecode it might be quite useful.

 

I'm quite interested in seeing this work

 

Anyone who want to criticise this effort should get some experience of writing a VM or a crosscompiler himself, to really know what is possible and what not.

 

Carsten

Link to comment
Share on other sites

Hi poobah and UNIXcoffee928,

 

please don't be too negative on this project. As I understand it, MasterI is not implementing a VM to execute C# on the A8. Instead it is a crosscompiler to compile CIL (http://en.wikipedia.org/wiki/Common_Intermediate_Language) to 6502 machinecode on the PC, then the machinecode will then be executed. I also guess that it can not only crosscompile C#, but also the output of other .NET languages like Oberon, Pascal, IronPython ....

 

Depending on the quality of the generated machinecode it might be quite useful.

 

I'm quite interested in seeing this work

 

Anyone who want to criticise this effort should get some experience of writing a VM or a crosscompiler himself, to really know what is possible and what not.

 

Carsten

 

As I said, i would like to see this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...