Re: [BLACKBOX] Ofront supporting for unsigned types

From: [at]} <Norayr>
Date: Thu, 26 Apr 2012 02:27:05 +0400

----boundary-LibPST-iamunique-1141343840_-_-
Content-type: text/plain

On Wed, 25 Apr 2012 21:29:14 +0300
"Oleg N. Cher" <allot{([at]})nowhere.xy

> Dear Norayr,
>
> You wrote in your nmos6502-oo2c's README:
>
> "this work is based on the Stewart Greenhill's port of oo2c for avr
> microcontrollers
> He prepared patches for oo2c to produce c code for 8 bit machines, and a
> small mini library."
>
> What is sort of this patch? Is there a possibility to use unsigned data
> types?

Actually, Stewart work was easier because AVR has a GCC port while I had to force it to work with CC65 which meant there were more changes required.
No, Stewart's patch don't support unsigned numbers, however, oo2c has built in type - SYSTEM.BYTE which is unsigned.
>
> Mr. Josef Templ wrote me: "As far as I know, there is no simple way to
> support new types without significantly extending the compiler incl. the
> symbol file format and the code generator. This may get messy."
>
I think, may be, it should be possible to define SYSTEM.BYTE in Ofront's SYSTEM.h.
i. e. not changing any of the existing types.

> many of questions. Let to mix signed and unsigned types (as in C) or
> disallow (as in Modula-2)? What to do with casting the types? Must be
Besides, if you really need unsigned, you may want to take a look to the GNU Modula-2 compiler.
It works with 8 bit AVR's, just there is no avr-libc binding or native Modula-2 implementation of avr specific low level libraries.
Currently it is only possible to do low level staff by using assembler insets.
> only in-SYSTEM solution for the casting, or end-user?
In most of Oberon implementations I know there is a SYSTEM.BYTE type which does exactly what you want.

>I am afraid
> that this will be not improvement, but a hack.
I have a little different perception of the word "hack", not like Wirth :)
For me, hacking may be associated with beauty, art, and good solutions. Paul Graham has a very close point of view: http://paulgraham.com/gba.html
However, I do not like Eric Raimond's definitions :)
> You certainly know that for such weak CPU as 6502 (or Z80) unsigned
> arithmetic is not luxury, but absolute necessary. Every C developers
> says me: "For loop with counter from 0 to 255 I've used in C one-byte
> variable, and you in Oberon must use two-byte.

Besides, I had completely different problems because of the absence of the unsigned types.
Here https://github.com/norayr/i2c-tiny-usb_in_oberon you may find my bindings to libusb.
There we may see that if uint16_t* is mapped to INTEGER (which is signed 16bit type) then I've got overflows and negative numbers because actual values of the variables were too big for INTEGER type.

However, I would like to mention that personally I do not think that Oberon must have unsigned types.
I believe that removal of the unsigned types from the language is well justified.
Also then someone may add other features he considers useful, and we may end up having language which looks like Oberon but is not Oberon.

>Oberon is bad and ugly".
There always will be people like this.
- If you do not use mainstream, whatever it is.
- They may believe that widespread technology is the best.
- People may have beliefs, and belief is not necessarily rational.
- People may have values. Or absence of values. :)
And then make decisions according to those values.
So if one considers some feature valuable, others may not.

There are a lot of other possible reasons for that.

I think that disputes with people about superiority of the language are useless. If people can see it, they see it. If not, then may be they are not ready or they think different. Like I have a friend who thinks in Haskell.

What we can do is just write our software modestly and decently by using technologies that we believe are better.

> Is unsigned really need in Ofront for developing for 6502 CPU?
As I said, I didn't use Ofront to develop for 6502 much, because the code it produces is much bigger than the code produced with oo2c. (16kb vs 2kb minimal size)
However, it should be possible to cut out some garbage collection related functions and decrease the size.

Sincerely,
Norayr


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1141343840_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIE9uIFdlZCwgMjUgQXByIDIwMTIgMjE6Mjk6MTQg
KzAzMDB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lbGwuXHBhcg0KXHBhcg0KV2hhdCB3ZSBjYW4g
ZG8gaXMganVzdCB3cml0ZSBvdXIgc29mdHdhcmUgbW9kZXN0bHkgYW5kIGRlY2VudGx5IGJ5IHVz
aW5nIHRlY2hub2xvZ2llcyB0aGF0IHdlIGJlbGlldmUgYXJlIGJldHRlci5ccGFyDQpccGFyDQo+
IElzIHVuc2lnbmVkIHJlYWxseSBuZWVkIGluIE9mcm9udCBmb3IgZGV2ZWxvcGluZyBmb3IgNjUw
MiBDUFU/XHBhcg0KQXMgSSBzYWlkLCBJIGRpZG4ndCB1c2UgT2Zyb250IHRvIGRldmVsb3AgZm9y
IDY1MDIgbXVjaCwgYmVjYXVzZSB0aGUgY29kZSBpdCBwcm9kdWNlcyBpcyBtdWNoIGJpZ2dlciB0
aGFuIHRoZSBjb2RlIHByb2R1Y2VkIHdpdGggb28yYy4gKDE2a2IgdnMgMmtiIG1pbmltYWwgc2l6
ZSlccGFyDQpIb3dldmVyLCBpdCBzaG91bGQgYmUgcG9zc2libGUgdG8gY3V0IG91dCBzb21lIGdh
cmJhZ2UgY29sbGVjdGlvbiByZWxhdGVkIGZ1bmN0aW9ucyBhbmQgZGVjcmVhc2UgdGhlIHNpemUu
XHBhcg0KXHBhcg0KU2luY2VyZWx5LFxwYXINCk5vcmF5clxwYXINClxwYXINClxwYXINCi0tLS1c
cGFyDQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJM
QUNLQk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0hccGFyDQp9
----boundary-LibPST-iamunique-1141343840_-_---
Received on Thu Apr 26 2012 - 00:27:05 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:03 UTC