News for hackers. Stuff that matters.
Re:Octojam 7: The CHIP-8 game jam by sowbug on Wednesday September 23, 2020 @03:57PM (#24571227)
Can someone explain how the variable i works in the home page's sample source code?

    : main
      i := ball
      loop
        sprite v0 v1 7
        v0 += 3
        v1 += 5
      again

    : ball
      0x38 0x74 0xFA 0xFE 0xFE 0x7C 0x38
I understand v0 and v1 -- makes sense they're initialized to zero, and the language must not require declarations -- but i is a mystery. ball is assigned to it, but then nobody refers to it again.
Re:Octojam 7: The CHIP-8 game jam by daitangio on Wednesday September 23, 2020 @04:16PM (#24571468)
I registrar contains the image to ... sprite. See https://github.com/JohnEarnest/Octo/blob/gh-pages/docs/Begin...
Re:Octojam 7: The CHIP-8 game jam by tsukikage on Wednesday September 23, 2020 @04:08PM (#24571372)
They're not variables, they're CHIP8 registers. The I register is used to hold memory locations; in particular, the operation that displays a sprite reads sprite data from the memory address in I.

Check out this reference: http://devernay.free.fr/hacks/chip8/C8TECH10.HTM

Re:Octojam 7: The CHIP-8 game jam by meheleventyone on Wednesday September 23, 2020 @04:05PM (#24571334)
I believe i is a register that in this case points to the location of the sprite data used by the sprite command. In this case the data represents the pixels of the ball.
Re:Octojam 7: The CHIP-8 game jam by RodgerTheGreat on Wednesday September 23, 2020 @04:18PM (#24571481)
That's correct. The index register is implicitly used by the CHIP-8 instructions Octo calls `sprite`, `bcd`, `load`, and `store`.