Hacker News new | ask | show | jobs
by dfinninger 2110 days ago
I had to use this recently for an online course. It was super nice:

  def pushConstant(num: Int): String =
    s"""
       |@$num
       |D=A
       |$accessTopOfStack
       |M=D
       |$incrementStackPointer
       |""".stripMargin
accessTopOfStack and incrementStackPointer are other functions that return text. It made composing Assembly a breeze.
1 comments

Yup, and it’s super nice for json or yaml strings.