kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer
BSD 2-Clause "Simplified" License
229 stars 81 forks source link

lcc: 4-byte longs #67

Open kervinck opened 5 years ago

kervinck commented 5 years ago

Longs should eventually become 4-byte. (Now they're still int-sized.)

kervinck commented 5 years ago

Some code for adding two 32-bit numbers, each composed of a L and H word. In GCL notation:

{ long3 = long1 + long2 }
{ long1: L1 H1 }
{ long2: L2 H2 }
{ long3: L3 H3 }
L1 L2+ L3=
L1 L2^ [if<0 L3^ else L1] { carry in MSB }
[if<0 1 else 0]           { transfer carry to LSB }
H1+ H2+ H3=
lb3361 commented 1 year ago

Suggesting to close this issue since glcc does this already.