\r
ram[sp] = tos\r
\r
+\r
+cons\r
+------------------------------\r
+\r
+ [グ,ケ,ゲ,ド,ゴ,サ],ヮ(cons),\r
+\r
+ グ pop(TEMP0, TOS) split_word(TEMP0, TOS), high_half_to(To, From), swap_halves(To, From), ror_imm(To, From, 16)\r
+ low_half(To) and_imm(Reg, Reg, 0xffff)\r
+ low_half(From) and_imm(Reg, Reg, 0xffff)\r
+\r
+ Puts the term on tos (the list to cons onto) into temp0 and points tos\r
+ deref(TOS) to the value under tos (the item to cons onto the list.)\r
+\r
+ ケ high_half(TEMP1, TOS) mov_imm_with_shift(0, 0xffff), Mask off the high half of (new) tos to isolate value.\r
+ and(TEMP1, TOS, 0)\r
+ ゲ or_inplace(TEMP0, TEMP1) ior(TEMP0, TEMP0, TEMP1) Combines value with the list in a new pair record.\r
+ ド write_cell(TEMP0, SP) add_imm(SP, SP, 4), Writes the new pair cell word to ++sp.\r
+ store_word(TEMP0, SP, 0)\r
+ ゴ low_half(TOS) and_imm(TOS, TOS, 0xffff) Delete the reference to second item down.\r
+ サ merge(SP, TOS) lsl_imm(0, SP, 16), Make a new pair record from the SP which points to the new cons'd list\r
+ ior(TOS, TOS, 0), and TOS which points to the rest of the stack. This record is then the\r
+ add_imm(SP, SP, 4) new TOS pair cell word, and we let the mainloop write it to RAM for us.\r
+\r
+So now that i've recreated it, what is it doing?\r
+\r
+⦾(グ, pop(TEMP0, TOS))\r
+⦾(ケ, high_half(TEMP1, TOS))\r
+⦾(ゲ, or_inplace(TEMP0, TEMP1))\r
+⦾(ド, write_cell(TEMP0, SP))\r
+⦾(ゴ, low_half(TOS))\r
+⦾(サ, merge(SP, TOS))\r
+\r
+⟐(pop(Reg, TOS)) --> ⟐([split_word(Reg, TOS), deref(TOS)]).\r
+⟐(high_half(To, From)) --> [mov_imm_with_shift(0, 0xffff), and(To, From, 0)].\r
+⟐(or_inplace(To, From)) --> [ior(To, To, From)].\r
+⟐(write_cell(From, SP)) --> [add_imm(SP, SP, 4), store_word(From, SP, 0)].\r
+⟐( low_half(Reg)) --> [and_imm(Reg, Reg, 0xffff)].\r
+⟐(merge(SP, TOS)) -->\r
+ [lsl_imm(0, SP, 16),\r
+ ior(TOS, TOS, 0),\r
+ add_imm(SP, SP, 4)].\r
+\r
+\r
+This blows, just write it in assembly already.\r