All pastes #171232 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-15 06:32 UTC
rendered paste body
inloop:
    in a,(stdin)  ; Grab a character from the keyboard
    ld (hl),a     ; stick it in main memory 
    inc hl
nine:
    cp #00111000  ; ASCII 9
    jp z inloop   ; If  we got a 9, then read the next character.
eight:
    cp #00111001  ; 8
    jp z inloop   ; ditto 

    bit 3,a       ; check that it is #00110xxx, not 00111xxx
    jp nz got_bad
rest:
    and #00110000 ; 0-7 have this bit pattern but we don't care about the lower 3 bits
    cp  #00110000
    jp z inloop