FreeCalypso > hg > freecalypso-reveng
comparison bootrom.disasm @ 13:e0ce45f043c0
boot ROM re: continuing plowing through the serial protocol code
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 24 Apr 2013 22:48:12 +0000 |
parents | 25b016d16602 |
children | 3443b1b08af4 |
comparison
equal
deleted
inserted
replaced
12:25b016d16602 | 13:e0ce45f043c0 |
---|---|
221 ; R0 points to a byte of RAM, an additional output | 221 ; R0 points to a byte of RAM, an additional output |
222 ; | 222 ; |
223 ; *R0 return byte values: | 223 ; *R0 return byte values: |
224 ; 00 = got nothing (timeout) or an invalid/non-understood command | 224 ; 00 = got nothing (timeout) or an invalid/non-understood command |
225 ; 01 = got 'i' | 225 ; 01 = got 'i' |
226 ; 02 = | 226 ; 02 = got 'p', 9 additional bytes received, a bunch of vars filled |
227 ; 03 = | 227 ; 03 = got 'w', the rest of the command read into the buffer at |
228 ; 80010C, the flag at 80053C set | |
228 ; 04 = got 'c', 1 additional byte received, extended to a half-word | 229 ; 04 = got 'c', 1 additional byte received, extended to a half-word |
229 ; and written to 80052C | 230 ; and written to 80052C |
230 ; 05 = got 'a' | 231 ; 05 = got 'a' |
231 ; 06 = got 'b', 4 bytes written to 800538 | 232 ; 06 = got 'b', 4 bytes written to 800538 |
232 | 233 |
260 ; R4=0x800518, byte at 80053C used for something, init to 0 | 261 ; R4=0x800518, byte at 80053C used for something, init to 0 |
261 330: e5c45018 strb r5, [r4, #24] | 262 330: e5c45018 strb r5, [r4, #24] |
262 334: e3a0a000 mov r10, #0 ; 0x0 | 263 334: e3a0a000 mov r10, #0 ; 0x0 |
263 338: e3a06000 mov r6, #0 ; 0x0 | 264 338: e3a06000 mov r6, #0 ; 0x0 |
264 33c: ea000015 b 0x398 | 265 33c: ea000015 b 0x398 |
266 ; more blocks | |
265 340: e5d40008 ldrb r0, [r4, #8] | 267 340: e5d40008 ldrb r0, [r4, #8] |
266 344: e5971000 ldr r1, [r7] | 268 344: e5971000 ldr r1, [r7] |
267 348: e28d2002 add r2, sp, #2 ; 0x2 | 269 348: e28d2002 add r2, sp, #2 ; 0x2 |
268 34c: eb000435 bl 0x1428 | 270 34c: eb000435 bl 0x1428 |
269 350: e3500000 cmp r0, #0 ; 0x0 | 271 350: e3500000 cmp r0, #0 ; 0x0 |
282 384: e5ddc002 ldrb r12, [sp, #2] | 284 384: e5ddc002 ldrb r12, [sp, #2] |
283 388: e35c0077 cmp r12, #119 ; 0x77 | 285 388: e35c0077 cmp r12, #119 ; 0x77 |
284 38c: 0a000001 beq 0x398 | 286 38c: 0a000001 beq 0x398 |
285 390: e3a0c001 mov r12, #1 ; 0x1 | 287 390: e3a0c001 mov r12, #1 ; 0x1 |
286 394: e5c4c018 strb r12, [r4, #24] | 288 394: e5c4c018 strb r12, [r4, #24] |
289 ; the entry to the 'w' handling block branches here | |
287 398: e5d40008 ldrb r0, [r4, #8] | 290 398: e5d40008 ldrb r0, [r4, #8] |
288 39c: e5971000 ldr r1, [r7] | 291 39c: e5971000 ldr r1, [r7] |
289 3a0: e1a0200d mov r2, sp | 292 3a0: e1a0200d mov r2, sp |
290 3a4: eb00041f bl 0x1428 | 293 3a4: eb00041f bl 0x1428 |
291 3a8: e3500000 cmp r0, #0 ; 0x0 | 294 3a8: e3500000 cmp r0, #0 ; 0x0 |
335 458: 0a0000a4 beq 0x6f0 | 338 458: 0a0000a4 beq 0x6f0 |
336 45c: e5ddc002 ldrb r12, [sp, #2] | 339 45c: e5ddc002 ldrb r12, [sp, #2] |
337 460: e18c8408 orr r8, r12, r8, lsl #8 | 340 460: e18c8408 orr r8, r12, r8, lsl #8 |
338 464: e2599001 subs r9, r9, #1 ; 0x1 | 341 464: e2599001 subs r9, r9, #1 ; 0x1 |
339 468: 1afffff5 bne 0x444 | 342 468: 1afffff5 bne 0x444 |
340 46c: e59fc9a4 ldr r12, [pc, #2468] ; 0xe18 | 343 46c: e59fc9a4 ldr r12, =0x800750 ; via 0xe18 |
341 470: e158000c cmp r8, r12 | 344 470: e158000c cmp r8, r12 |
342 474: 3a00004e bcc 0x5b4 | 345 474: 3a00004e bcc 0x5b4 |
343 478: e59f099c ldr r0, [pc, #2460] ; 0xe1c | 346 478: e59f099c ldr r0, =0x7F8AF ; via 0xe1c |
344 47c: e080c00c add r12, r0, r12 | 347 47c: e080c00c add r12, r0, r12 |
345 480: e158000c cmp r8, r12 | 348 480: e158000c cmp r8, r12 |
346 484: 8a00004a bhi 0x5b4 | 349 484: 8a00004a bhi 0x5b4 |
347 488: e085c006 add r12, r5, r6 | 350 488: e085c006 add r12, r5, r6 |
348 48c: e35c0ffe cmp r12, #1016 ; 0x3f8 | 351 48c: e35c0ffe cmp r12, #1016 ; 0x3f8 |
349 490: aa000037 bge 0x574 | 352 490: aa000037 bge 0x574 |
350 494: e59fc970 ldr r12, [pc, #2416] ; 0xe0c | 353 494: e59fc970 ldr r12, =0x80010C ; via 0xe0c |
351 498: e5dd0000 ldrb r0, [sp] | 354 498: e5dd0000 ldrb r0, [sp] |
352 49c: e7c6000c strb r0, [r6, r12] | 355 49c: e7c6000c strb r0, [r6, r12] |
353 4a0: e2860001 add r0, r6, #1 ; 0x1 | 356 4a0: e2860001 add r0, r6, #1 ; 0x1 |
354 4a4: e1a00800 mov r0, r0, lsl #16 | 357 4a4: e1a00800 mov r0, r0, lsl #16 |
355 4a8: e1a06820 mov r6, r0, lsr #16 | 358 4a8: e1a06820 mov r6, r0, lsr #16 |
401 560: 0a000062 beq 0x6f0 | 404 560: 0a000062 beq 0x6f0 |
402 564: e2899001 add r9, r9, #1 ; 0x1 | 405 564: e2899001 add r9, r9, #1 ; 0x1 |
403 568: e2555001 subs r5, r5, #1 ; 0x1 | 406 568: e2555001 subs r5, r5, #1 ; 0x1 |
404 56c: 1afffff6 bne 0x54c | 407 56c: 1afffff6 bne 0x54c |
405 570: ea00000a b 0x5a0 | 408 570: ea00000a b 0x5a0 |
409 ; length exceeded: read and discard | |
410 ; the increment of R5 looks like a bug! | |
406 574: e285c001 add r12, r5, #1 ; 0x1 | 411 574: e285c001 add r12, r5, #1 ; 0x1 |
407 578: e1a0c80c mov r12, r12, lsl #16 | 412 578: e1a0c80c mov r12, r12, lsl #16 |
408 57c: e1a0582c mov r5, r12, lsr #16 | 413 57c: e1a0582c mov r5, r12, lsr #16 |
409 580: e5d40008 ldrb r0, [r4, #8] | 414 580: e5d40008 ldrb r0, [r4, #8] |
410 584: e5971000 ldr r1, [r7] | 415 584: e5971000 ldr r1, [r7] |
417 5a0: e35a0000 cmp r10, #0 ; 0x0 | 422 5a0: e35a0000 cmp r10, #0 ; 0x0 |
418 5a4: 0affff65 beq 0x340 | 423 5a4: 0affff65 beq 0x340 |
419 5a8: e3a0c003 mov r12, #3 ; 0x3 | 424 5a8: e3a0c003 mov r12, #3 ; 0x3 |
420 5ac: e5cbc000 strb r12, [r11] | 425 5ac: e5cbc000 strb r12, [r11] |
421 5b0: ea00005b b 0x724 | 426 5b0: ea00005b b 0x724 |
427 ; error path (<w load address outside of the permissible IRAM range) | |
422 5b4: e3a0c001 mov r12, #1 ; 0x1 | 428 5b4: e3a0c001 mov r12, #1 ; 0x1 |
423 5b8: e5c4c018 strb r12, [r4, #24] | 429 5b8: e5c4c018 strb r12, [r4, #24] |
424 5bc: e3a0c003 mov r12, #3 ; 0x3 | 430 5bc: e3a0c003 mov r12, #3 ; 0x3 |
425 5c0: e5cbc000 strb r12, [r11] | 431 5c0: e5cbc000 strb r12, [r11] |
426 5c4: e5d40008 ldrb r0, [r4, #8] | 432 5c4: e5d40008 ldrb r0, [r4, #8] |
427 5c8: e59f1850 ldr r1, [pc, #2128] ; 0xe20 | 433 5c8: e59f1850 ldr r1, =0xFFFFF ; via 0xe20 |
428 5cc: e28d2002 add r2, sp, #2 ; 0x2 | 434 5cc: e28d2002 add r2, sp, #2 ; 0x2 |
429 5d0: eb000394 bl 0x1428 | 435 5d0: eb000394 bl 0x1428 |
430 5d4: e3500001 cmp r0, #1 ; 0x1 | 436 5d4: e3500001 cmp r0, #1 ; 0x1 |
431 5d8: 0afffff9 beq 0x5c4 | 437 5d8: 0afffff9 beq 0x5c4 |
432 5dc: ea000050 b 0x724 | 438 5dc: ea000050 b 0x724 |
439 ; another error path (bad block number voodoo) | |
433 5e0: e3a0c001 mov r12, #1 ; 0x1 | 440 5e0: e3a0c001 mov r12, #1 ; 0x1 |
434 5e4: e5c4c018 strb r12, [r4, #24] | 441 5e4: e5c4c018 strb r12, [r4, #24] |
435 5e8: e3a0c003 mov r12, #3 ; 0x3 | 442 5e8: e3a0c003 mov r12, #3 ; 0x3 |
436 5ec: e5cbc000 strb r12, [r11] | 443 5ec: e5cbc000 strb r12, [r11] |
444 ; flush serial input (wait for long silence), then return | |
437 5f0: e5d40008 ldrb r0, [r4, #8] | 445 5f0: e5d40008 ldrb r0, [r4, #8] |
438 5f4: e59f1824 ldr r1, [pc, #2084] ; 0xe20 | 446 5f4: e59f1824 ldr r1, =0xFFFFF ; via 0xe20 |
439 5f8: e28d2002 add r2, sp, #2 ; 0x2 | 447 5f8: e28d2002 add r2, sp, #2 ; 0x2 |
440 5fc: eb000389 bl 0x1428 | 448 5fc: eb000389 bl 0x1428 |
441 600: e3500001 cmp r0, #1 ; 0x1 | 449 600: e3500001 cmp r0, #1 ; 0x1 |
442 604: 0afffff9 beq 0x5f0 | 450 604: 0afffff9 beq 0x5f0 |
443 608: ea000045 b 0x724 | 451 608: ea000045 b 0x724 |
444 ; got 'p' | 452 ; got 'p' |
445 60c: e59f67f8 ldr r6, [pc, #2040] ; 0xe0c | 453 ; R4=0x800518 |
454 60c: e59f67f8 ldr r6, =0x80010C ; via 0xe0c | |
446 610: e3a08009 mov r8, #9 ; 0x9 | 455 610: e3a08009 mov r8, #9 ; 0x9 |
447 614: e5d40008 ldrb r0, [r4, #8] | 456 614: e5d40008 ldrb r0, [r4, #8] |
448 618: e5971000 ldr r1, [r7] | 457 618: e5971000 ldr r1, [r7] |
449 61c: e1a02006 mov r2, r6 | 458 61c: e1a02006 mov r2, r6 |
450 620: eb000380 bl 0x1428 | 459 620: eb000380 bl 0x1428 |
451 624: e3500000 cmp r0, #0 ; 0x0 | 460 624: e3500000 cmp r0, #0 ; 0x0 |
452 628: 0a000030 beq 0x6f0 | 461 628: 0a000030 beq 0x6f0 |
453 62c: e2866001 add r6, r6, #1 ; 0x1 | 462 62c: e2866001 add r6, r6, #1 ; 0x1 |
454 630: e2588001 subs r8, r8, #1 ; 0x1 | 463 630: e2588001 subs r8, r8, #1 ; 0x1 |
455 634: 1afffff6 bne 0x614 | 464 634: 1afffff6 bne 0x614 |
456 638: e59fc7cc ldr r12, [pc, #1996] ; 0xe0c | 465 638: e59fc7cc ldr r12, =0x80010C ; via 0xe0c |
457 63c: e5dc0000 ldrb r0, [r12] | 466 63c: e5dc0000 ldrb r0, [r12] |
458 640: e5c40000 strb r0, [r4] | 467 640: e5c40000 strb r0, [r4] ; into 800518 |
459 644: e5dc0001 ldrb r0, [r12, #1] | 468 644: e5dc0001 ldrb r0, [r12, #1] |
460 648: e5c40009 strb r0, [r4, #9] | 469 648: e5c40009 strb r0, [r4, #9] ; into 800521 |
461 64c: e1c450ba strh r5, [r4, #10] | 470 64c: e1c450ba strh r5, [r4, #10] ; 16-bit 0 into 800522 |
462 650: e5dc1003 ldrb r1, [r12, #3] | 471 650: e5dc1003 ldrb r1, [r12, #3] |
463 654: e5dc0002 ldrb r0, [r12, #2] | 472 654: e5dc0002 ldrb r0, [r12, #2] |
464 658: e1810400 orr r0, r1, r0, lsl #8 | 473 658: e1810400 orr r0, r1, r0, lsl #8 |
465 65c: e1c400ba strh r0, [r4, #10] | 474 65c: e1c400ba strh r0, [r4, #10] |
466 660: e5dc0004 ldrb r0, [r12, #4] | 475 660: e5dc0004 ldrb r0, [r12, #4] |
618 | 627 |
619 8a4: e3a00003 mov r0, #3 ; 0x3 | 628 8a4: e3a00003 mov r0, #3 ; 0x3 |
620 8a8: ebfffe23 bl 0x13c | 629 8a8: ebfffe23 bl 0x13c |
621 8ac: e3a00000 mov r0, #0 ; 0x0 | 630 8ac: e3a00000 mov r0, #0 ; 0x0 |
622 8b0: e8bd83f0 ldmia sp!, {r4, r5, r6, r7, r8, r9, pc} | 631 8b0: e8bd83f0 ldmia sp!, {r4, r5, r6, r7, r8, r9, pc} |
632 | |
633 ; The routine at 0x8b4 handles the command received by the 0x2c8 routine. | |
634 ; The argument in R0 is the code produced by the latter. | |
623 | 635 |
624 8b4: e92d4070 stmdb sp!, {r4, r5, r6, lr} | 636 8b4: e92d4070 stmdb sp!, {r4, r5, r6, lr} |
625 8b8: e24dd008 sub sp, sp, #8 ; 0x8 | 637 8b8: e24dd008 sub sp, sp, #8 ; 0x8 |
626 8bc: e59f4560 ldr r4, [pc, #1376] ; 0xe24 | 638 8bc: e59f4560 ldr r4, [pc, #1376] ; 0xe24 |
627 8c0: e5d4c000 ldrb r12, [r4] | 639 8c0: e5d4c000 ldrb r12, [r4] |