factor/examples/lcd.factor

15 lines
431 B
Factor
Raw Normal View History

USING: sequences kernel math stdio strings ;
2005-02-18 19:09:24 -05:00
: lcd-digit ( digit row -- str )
{
" _ _ _ _ _ _ _ _ "
" | | | _| _| |_| |_ |_ | |_| |_| "
" |_| | |_ _| | _| |_| | |_| | "
} nth >r 4 * dup 4 + r> substring ;
2005-02-18 19:09:24 -05:00
: lcd-row ( num row -- )
swap [ CHAR: 0 - over lcd-digit write ] each drop ;
2005-02-18 19:09:24 -05:00
: lcd ( num -- str )
3 [ 2dup lcd-row terpri ] repeat drop ;