Remix.run Logo
buredoranna 8 hours ago

Still my all time favorite snippet of code.

    TC    BANKCALL    # TEMPORARY, I HOPE HOPE HOPE
    CADR  STOPRATE    # TEMPORARY, I HOPE HOPE HOPE
    TC    DOWNFLAG    # PERMIT X-AXIS OVERRIDE
https://github.com/chrislgarry/Apollo-11/blob/master/Luminar...
f1shy 6 hours ago | parent | next [-]

Cadr here has no relation with lisp cadr, right?

jasomill 4 hours ago | parent | next [-]

Correct.

CADR is an AGC assembly directive defining a "complete address" including a memory bank, in this case a subroutine to be called by the preceding BANKCALL (TC = transfer control, i.e., store return address and jump to subroutine), which switches to the memory bank specified in the CADR before jumping to the address specified in the CADR.

For a brief explanation of AGC subroutine calls, see [1].

CAR and CDR in Lisp come from the original implementation on the IBM 704, where pointers to the two components of a cons cell were stored as the (C)ontents of the (A)ddress and (D)ecrement fields of a (R)egister (memory word).

(CADR x) is just shorthand for (CAR (CDR x)), i.e., a function that returns the second element of a list (assuming x is a well-formed list).

[1] https://epizodsspace.airbase.ru/bibl/inostr-yazyki/American_...

jacquesm 6 hours ago | parent | prev [-]

https://news.ycombinator.com/item?id=16008239

foxyv 4 hours ago | parent | prev | next [-]

I'm having a really bad Mandala effect right now where I remember some XKCD that wrote a poem about this. Maybe I'm thinking of another comic.

watt 2 hours ago | parent [-]

Oh, it's Mandala effect now? I could swear it was Mandela before.

donkeyboy 7 hours ago | parent | prev [-]

Can you explain this to me?

dylan604 7 hours ago | parent | next [-]

I think the point was the comments more than any of the code requiring explanation. There's nothing more permanent than a temporary solution

buredoranna 7 hours ago | parent | prev [-]

Wish I could... but I know of it from a previous HN post, where there is some discussion on its purpose.

https://news.ycombinator.com/item?id=22367416