forked from MightyPork/crsn
Compare commits
No commits in common. 'b5016c6b125e4c2d722019f5ba549aa742b21c67' and 'ab5fed3cfa60e27a36d9f64c7e4f3b396ef2e28f' have entirely different histories.
b5016c6b12
...
ab5fed3cfa
@ -1,58 +0,0 @@ |
|||||||
( |
|
||||||
; Helper to check key codes of physical keys |
|
||||||
|
|
||||||
(sc-init 200 200) |
|
||||||
(lds @cout "Press keys in the window to see their codes...\n") |
|
||||||
(sym pressed r15) |
|
||||||
(mkbf pressed 256) |
|
||||||
(:loop) |
|
||||||
(sc-poll) |
|
||||||
(mslp 10) |
|
||||||
(sym cnt r14) |
|
||||||
(ld cnt 0) |
|
||||||
(:next) |
|
||||||
(sc-key _ cnt |
|
||||||
(inval? (nop)) |
|
||||||
(nz? |
|
||||||
(bfrd r1 @pressed cnt |
|
||||||
(z? |
|
||||||
(call printnum cnt) |
|
||||||
(lds @cout " PRESS\n") |
|
||||||
(bfwr @pressed cnt 1) |
|
||||||
(rng r0 0 #ffffff) |
|
||||||
(sc-erase r0) |
|
||||||
(sc-blit) |
|
||||||
) |
|
||||||
) |
|
||||||
) |
|
||||||
(z? |
|
||||||
(bfrd r1 @pressed cnt |
|
||||||
(nz? |
|
||||||
(call printnum cnt) |
|
||||||
(lds @cout " RELEASE\n") |
|
||||||
(bfwr @pressed cnt 0) |
|
||||||
) |
|
||||||
) |
|
||||||
) |
|
||||||
) |
|
||||||
(inc cnt) |
|
||||||
(cmp cnt 256 (ne? (j :next))) |
|
||||||
(j :loop) |
|
||||||
|
|
||||||
; this is a version if itoa that prints a number |
|
||||||
(proc printnum num |
|
||||||
(mkbf r15) |
|
||||||
(ld r1 num) |
|
||||||
(tst r1 (<0? (mul r1 -1))) |
|
||||||
(:next) |
|
||||||
(mod r0 r1 10) |
|
||||||
(add r0 '0') |
|
||||||
(bfrpush @r15 r0) |
|
||||||
(div r1 10 (z? |
|
||||||
(tst num (<0? (bfrpush @r15 '-'))) |
|
||||||
(lds @cout @r15) |
|
||||||
(del @r15) |
|
||||||
(ret))) |
|
||||||
(j :next) |
|
||||||
) |
|
||||||
) |
|
Loading…
Reference in new issue