[SqNOS] Question for all

Gerardo Richarte gera at corest.com
Thu Jul 13 12:36:53 UTC 2006


uhm... one of this questions that newbies usually ask, I need your
subjectivity.

    PortHardwareDevices have a basePort. All I/O is indexes through this
port, i.e.

PortHardwareDeivce>>byteAt: portNumber
    ^ self primInPortByte: basePort+portNumber

(where portNumber should actually by portOffset or something).

    Anyway, from this implementation we can see that PortHardwareDevices
have a 0-based semantic for accessing the ports. This is what common
literature uses (register 0, register 1, for example), and what every
other software out there uses to (C based or asm based mostly).

    Now, we all know that indexable objects in Smalltalk have a 1-based
semantic.

    so, the obvious question for the incredulous reader is: should we
have 0-based or 1-based semantic for the PortHardwareDevices?

    0 based will be "mathematically correct"(?), will be ok according to
standard literature and other implementations.

    1 based will be Smalltalkish... and I guess we could get used to it
(but I'm sure will introduce more bugs when copying from documentation
or other code to Smalltalk)

    so? ah! got you! :-)
    I don't really want a debate, but some opinions will be nice

    gera

    gera


More information about the SqueakNOS mailing list