git @ Cat's Eye Technologies SixtyPical / master include / stdlib / prbyte.60p
master

Tree @master (Download .tar.gz)

prbyte.60p @masterraw · history · blame

// SPDX-FileCopyrightText:  Chris Pressey, the original author of this work, has dedicated it to the public domain.
// For more information, please refer to <https://unlicense.org/>
// SPDX-License-Identifier: Unlicense

byte table[16] hexchars : "0123456789ABCDEF"

define prbyte routine
  inputs a, hexchars
  trashes a, z, n, c, v
{
    save x {
        save a {
            st off, c
            shr a
            shr a
            shr a
            shr a
            and a, 15
            ld x, a
            ld a, hexchars + x
            call chrout
        }
        save a {
            and a, 15
            ld x, a
            ld a, hexchars + x
            call chrout
        }
    }
}