comparison clojure/com/aurellem/assembly.clj @ 116:e45031af5327

functional number-input bootstrap code complete
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 17:03:05 -0500
parents 39fb0cbab25e
children bcb5c41626b4
comparison
equal deleted inserted replaced
115:39fb0cbab25e 116:e45031af5327
275 ;; the next two button presses indicates the start 275 ;; the next two button presses indicates the start
276 ;; memory location which to which the bootstrap 276 ;; memory location which to which the bootstrap
277 ;; program will write. 277 ;; program will write.
278 ;; This is done by using each of the eight buttons to 278 ;; This is done by using each of the eight buttons to
279 ;; spell out an 8 bit number. The order of buttons is 279 ;; spell out an 8 bit number. The order of buttons is
280 ;; ["A" "B" "start" "select" "up" "right" "down" "left"], 280 ;; [:d :u :l :r :start :select :b :a]
281 ;; [:a :start :l] --> 10100001 281 ;; [:a :start :l] --> 00101001
282 282
283 ;; the next button press determines how many bytes are to be 283 ;; the next button press determines how many bytes are to be
284 ;; written, starting at the start position. 284 ;; written, starting at the start position.
285 285
286 ;; then, the actual bytes are entered and are written to the 286 ;; then, the actual bytes are entered and are written to the
391 0x00 ;D357 --> ; 00010000, into FF00 391 0x00 ;D357 --> ; 00010000, into FF00
392 0xFF ;D358 --> FF00 392 0xFF ;D358 --> FF00
393 393
394 0x06 ;D359 394 0x06 ;D359
395 ;D35A 395 ;D35A
396 (Integer/parseInt "11110000") ; "11110000" -> B 396 (Integer/parseInt "11110000" 2) ; "11110000" -> B
397 0xFA ;D35B ; (FF00) -> A 397 0xFA ;D35B ; (FF00) -> A
398 0x00 ;D35C 398 0x00 ;D35C
399 0xFF ;D35D 399 0xFF ;D35D
400 400
401 0xCB ;D35E ; swap nybbles on A 401 0xCB ;D35E ; swap nybbles on A
412 0xEA ; ; load (A), which is 412 0xEA ; ; load (A), which is
413 0x00 ; --> ; 00001000, into FF00 413 0x00 ; --> ; 00001000, into FF00
414 0xFF ; --> FF00 414 0xFF ; --> FF00
415 415
416 0x0E ; 416 0x0E ;
417 (Integer/parseInt "00001111") ; "00001111" -> C 417 (Integer/parseInt "00001111" 2) ; "00001111" -> C
418 418
419 0xFA ; ; (FF00) -> A 419 0xFA ; ; (FF00) -> A
420 0x00 ; 420 0x00 ;
421 0xFF ; 421 0xFF ;
422 422