git @ Cat's Eye Technologies SixtyPical / semaphore-setup eg / rudiments / buffer.60p
semaphore-setup

Tree @semaphore-setup (Download .tar.gz)

buffer.60p @semaphore-setupraw · history · blame

// Include `support/${PLATFORM}.60p` before this source
// Should print Y

byte table[2048] buf
pointer ptr @ 254
byte foo

define main routine
  inputs buf
  outputs buf, y, foo
  trashes a, z, n, c, ptr
{
    ld y, 0
    point ptr into buf {
        reset ptr 0
        copy 123, [ptr] + y
        copy [ptr] + y, foo
        copy foo, [ptr] + y
    }

    // TODO: support saying `cmp foo, 123`, maybe
    ld a, foo
    cmp a, 123

    if z {
        ld a, 89
        call chrout
    } else {
        ld a, 78
        call chrout
    }
}