lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Apr 24, 2018 at 10:24 AM, Dirk Laurie <> wrote:

> I grew up as a programmer in a time when there were only three languages: FORTRAN, COBOL and Assembler.


> We wrote everything in capitals and our arrays started at index 1.

While it is debatable whether an assembly language really has a notion of "array" and "bounds", I can say that the Symbolic Assembly Program (SAP) developed for the IBM 704 series, the one that FORTRAN was developed for originally, provided some programming primitives in terms of zero-based offsets: "DEC: the decimal data beginning in column 12 is converted to binary and assigned to consecutive locations L, L + 1, ..." [1]. It also had primitives for -N (yes, minus N) based offsets, when N is the length of the data block: "BSS: The block of storage extending from L to L+N-1 [...] L is replaced by L+N" [2].

The -N twist was thanks to the 704 index registers, their content would always be subtracted from the immediate address. The arithmetic was 2-complement modulo the memory size (8K words would be typical), so one might have effective positive offsets to the immediate address using negative index values, which makes the whole 0 vs 1 debate quite trivial in comparison.


[1] Page 9 of "Description of the SHARE Assembly Program for the I. B. M. 704 Computer", in "Coding for the MIT-IBM 704 Computer", F. Helwig (ed.). Available at 

[2] Page 11, Ibid.