3 ms·
Can anybody make a https://en.wikipedia.org/wiki/Quine_%28computing%29 https://en.wikipedia.org/wiki/Quine_%28computing%29 ?
by daveloyall 11y ago
Can anybody make a https://en.wikipedia.org/wiki/Quine_%28computing%29 https://en.wikipedia.org/wiki/Quine_%28computing%29 ?
- ketralnis 11y agoThe straight forward way is a loop that reads in every byte and prints it. But you can only read from literal addresses; there's no instruction to read from the address in the register or to even read out the program counter. If you could control the initial register value to set it to , this would be a quine: RAM AD PC ADDR ________ _ _ ---- |---*****|-|*| ---* |---*****|-|-| --*- |---*****|-|-| --** |---*****|-|-| -*-- |---*****|-|-| -*-* |---*****|-|-| -**- |---*****|-|-| -*** |---*****|-|-| *--- |---*****|-|-| *--* |---*****|-|-| *-*- |---*****|-|-| *-** |---*****|-|-| **-- |---*****|-|-| **-* |---*****|-|-| ***- |---*****|-|-| **** | OUTPUT |-|-| ############ But since you can't, that instead prints out all zeroes. I don't have any other ideas :)
- daveloyall 11y agoDoes this provide any inspiration? RAM AD PC ADDR ________ _ _ ---- |-----*-*|-|*| ; read FOO ---* |---*----|-|-| ; write FOO to 0 (now points at BAR) --*- |---*****|-|-| ; print --** |-*------|-|-| ; back to the top! -*-- |-----*-*|-|-| ; BAR -*-* |-----*--|-|-| ; FOO -**- |--------|-|-| -*** |--------|-|-| *--- |--*---*-|-|-| ; a grand tradition in ROMs *--* |--------|-|-| ; though this isn't a ROM *-*- |----*---|-|-| ; anymore, is it? :) *-** |--------|-|-| **-- |--*---*-|-|-| **-* |---***--|-|-| ***- |--------|-|-|