forked from Apple-2-HW/AppleIISd
Fixed bug in Write Block
This commit is contained in:
parent
624bd4e9a7
commit
7391fa7cbc
521
AppleIISd.lst
521
AppleIISd.lst
@ -10,7 +10,7 @@
|
|||||||
10 *
|
10 *
|
||||||
11 ********************************
|
11 ********************************
|
||||||
12
|
12
|
||||||
16-JUL-17 15:06
|
16-JUL-17 23:22
|
||||||
14
|
14
|
||||||
15 XC ; enable 65C02 code
|
15 XC ; enable 65C02 code
|
||||||
16 DEBUG = 1
|
16 DEBUG = 1
|
||||||
@ -185,10 +185,10 @@
|
|||||||
807F: A9 01 179 LDA #$01
|
807F: A9 01 179 LDA #$01
|
||||||
8081: 60 180 RTS
|
8081: 60 180 RTS
|
||||||
181
|
181
|
||||||
8082: 4C B8 82 182 :STATUS JMP STATUS
|
8082: 4C A8 82 182 :STATUS JMP STATUS
|
||||||
8085: 4C C0 82 183 :READ JMP READ
|
8085: 4C B0 82 183 :READ JMP READ
|
||||||
8088: 4C 06 83 184 :WRITE JMP WRITE
|
8088: 4C FA 82 184 :WRITE JMP WRITE
|
||||||
808B: 4C 47 83 185 :FORMAT JMP FORMAT
|
808B: 4C 8A 83 185 :FORMAT JMP FORMAT
|
||||||
186
|
186
|
||||||
187 * Signature bytes
|
187 * Signature bytes
|
||||||
188
|
188
|
||||||
@ -259,7 +259,7 @@
|
|||||||
811F: A9 0E 223 LDA #SS0 ; set CS low
|
811F: A9 0E 223 LDA #SS0 ; set CS low
|
||||||
8121: 9D 83 C0 224 STA SS,X
|
8121: 9D 83 C0 224 STA SS,X
|
||||||
225
|
225
|
||||||
8124: A9 4B 226 LDA #<CMD0 ; send CMD0
|
8124: A9 8E 226 LDA #<CMD0 ; send CMD0
|
||||||
8126: 85 40 227 STA CMDLO
|
8126: 85 40 227 STA CMDLO
|
||||||
8128: A9 83 228 LDA #>CMD0
|
8128: A9 83 228 LDA #>CMD0
|
||||||
812A: 85 41 229 STA CMDHI
|
812A: 85 41 229 STA CMDHI
|
||||||
@ -268,7 +268,7 @@
|
|||||||
8132: C9 01 232 CMP #$01
|
8132: C9 01 232 CMP #$01
|
||||||
8134: D0 39 233 BNE :ERROR1 ; error!
|
8134: D0 39 233 BNE :ERROR1 ; error!
|
||||||
234
|
234
|
||||||
8136: A9 57 235 LDA #<CMD8 ; send CMD8
|
8136: A9 9A 235 LDA #<CMD8 ; send CMD8
|
||||||
8138: 85 40 236 STA CMDLO
|
8138: 85 40 236 STA CMDLO
|
||||||
813A: A9 83 237 LDA #>CMD8
|
813A: A9 83 237 LDA #>CMD8
|
||||||
813C: 85 41 238 STA CMDHI
|
813C: 85 41 238 STA CMDHI
|
||||||
@ -278,13 +278,13 @@
|
|||||||
8146: D0 2A 242 BNE :SDV1 ; may be SD Ver. 1
|
8146: D0 2A 242 BNE :SDV1 ; may be SD Ver. 1
|
||||||
243
|
243
|
||||||
244 * check for $01aa match!
|
244 * check for $01aa match!
|
||||||
8148: A9 63 245 :SDV2 LDA #<CMD55
|
8148: A9 A6 245 :SDV2 LDA #<CMD55
|
||||||
814A: 85 40 246 STA CMDLO
|
814A: 85 40 246 STA CMDLO
|
||||||
814C: A9 83 247 LDA #>CMD55
|
814C: A9 83 247 LDA #>CMD55
|
||||||
814E: 85 41 248 STA CMDHI
|
814E: 85 41 248 STA CMDHI
|
||||||
8150: 20 D7 81 249 JSR CMD
|
8150: 20 D7 81 249 JSR CMD
|
||||||
8153: 20 EB 81 250 JSR GETR1
|
8153: 20 EB 81 250 JSR GETR1
|
||||||
8156: A9 69 251 LDA #<ACMD4140
|
8156: A9 AC 251 LDA #<ACMD4140
|
||||||
8158: 85 40 252 STA CMDLO
|
8158: 85 40 252 STA CMDLO
|
||||||
815A: A9 83 253 LDA #>ACMD4140
|
815A: A9 83 253 LDA #>ACMD4140
|
||||||
815C: 85 41 254 STA CMDHI
|
815C: 85 41 254 STA CMDHI
|
||||||
@ -302,12 +302,12 @@
|
|||||||
264
|
264
|
||||||
816F: 4C C8 81 265 :ERROR1 JMP :IOERROR ; needed for far jump
|
816F: 4C C8 81 265 :ERROR1 JMP :IOERROR ; needed for far jump
|
||||||
266
|
266
|
||||||
8172: A9 63 267 :SDV1 LDA #<CMD55
|
8172: A9 A6 267 :SDV1 LDA #<CMD55
|
||||||
8174: 85 40 268 STA CMDLO
|
8174: 85 40 268 STA CMDLO
|
||||||
8176: A9 83 269 LDA #>CMD55
|
8176: A9 83 269 LDA #>CMD55
|
||||||
8178: 85 41 270 STA CMDHI
|
8178: 85 41 270 STA CMDHI
|
||||||
817A: 20 D7 81 271 JSR CMD ; ignore response
|
817A: 20 D7 81 271 JSR CMD ; ignore response
|
||||||
817D: A9 6F 272 LDA #<ACMD410
|
817D: A9 B2 272 LDA #<ACMD410
|
||||||
817F: 85 40 273 STA CMDLO
|
817F: 85 40 273 STA CMDLO
|
||||||
8181: A9 83 274 LDA #>ACMD410
|
8181: A9 83 274 LDA #>ACMD410
|
||||||
8183: 85 41 275 STA CMDHI
|
8183: 85 41 275 STA CMDHI
|
||||||
@ -320,7 +320,7 @@
|
|||||||
282 * SD Ver. 1 initialized!
|
282 * SD Ver. 1 initialized!
|
||||||
8193: 4C AC 81 283 JMP :BLOCKSZ
|
8193: 4C AC 81 283 JMP :BLOCKSZ
|
||||||
284
|
284
|
||||||
8196: A9 51 285 :MMC LDA #<CMD1
|
8196: A9 94 285 :MMC LDA #<CMD1
|
||||||
8198: 85 40 286 STA CMDLO
|
8198: 85 40 286 STA CMDLO
|
||||||
819A: A9 83 287 LDA #>CMD1
|
819A: A9 83 287 LDA #>CMD1
|
||||||
819C: 85 41 288 STA CMDHI
|
819C: 85 41 288 STA CMDHI
|
||||||
@ -332,7 +332,7 @@
|
|||||||
81AA: D0 1C 294 BNE :IOERROR ; error!
|
81AA: D0 1C 294 BNE :IOERROR ; error!
|
||||||
295 * MMC Ver. 3 initialized!
|
295 * MMC Ver. 3 initialized!
|
||||||
296
|
296
|
||||||
81AC: A9 5D 297 :BLOCKSZ LDA #<CMD16
|
81AC: A9 A0 297 :BLOCKSZ LDA #<CMD16
|
||||||
81AE: 85 40 298 STA CMDLO
|
81AE: 85 40 298 STA CMDLO
|
||||||
81B0: A9 83 299 LDA #>CMD16
|
81B0: A9 83 299 LDA #>CMD16
|
||||||
81B2: 85 41 300 STA CMDHI
|
81B2: 85 41 300 STA CMDHI
|
||||||
@ -446,138 +446,138 @@
|
|||||||
404 *
|
404 *
|
||||||
405 ********************************
|
405 ********************************
|
||||||
406
|
406
|
||||||
8238: 5A 407 BLOCK PHY ; save Y
|
8238: DA 407 BLOCK PHX ; save X
|
||||||
8239: A4 3D 408 LDY SLOT
|
8239: 5A 408 PHY ; save Y
|
||||||
823B: A5 46 409 LDA $46 ; store block num
|
823A: A6 3D 409 LDX SLOT
|
||||||
823D: 99 F8 05 410 STA R33,Y ; in R30-R33
|
823C: A5 46 410 LDA $46 ; store block num
|
||||||
8240: A5 47 411 LDA $47
|
823E: 9D F8 05 411 STA R33,X ; in R30-R33
|
||||||
8242: 99 78 05 412 STA R32,Y
|
8241: A5 47 412 LDA $47
|
||||||
8245: A9 00 413 LDA #0
|
8243: 9D 78 05 413 STA R32,X
|
||||||
8247: 99 F8 04 414 STA R31,Y
|
8246: A9 00 414 LDA #0
|
||||||
824A: 99 78 04 415 STA R30,Y
|
8248: 9D F8 04 415 STA R31,X
|
||||||
416
|
824B: 9D 78 04 416 STA R30,X
|
||||||
824D: DA 417 PHX
|
417
|
||||||
824E: A0 09 418 LDY #9
|
824E: A0 09 418 LDY #9 ; ASL can't be used with Y
|
||||||
8250: A6 3D 419 LDX SLOT ; ASL can't be done with Y
|
8250: 1E F8 05 419 :LOOP ASL R33,X ; mul block num
|
||||||
8252: 1E F8 05 420 :LOOP ASL R33,X ; mul block num
|
8253: 3E 78 05 420 ROL R32,X ; by 512 to get
|
||||||
8255: 3E 78 05 421 ROL R32,X ; by 512 to get
|
8256: 3E F8 04 421 ROL R31,X ; real address
|
||||||
8258: 3E F8 04 422 ROL R31,X ; real address
|
8259: 3E 78 04 422 ROL R30,X
|
||||||
825B: 3E 78 04 423 ROL R30,X
|
825C: 88 423 DEY
|
||||||
825E: 88 424 DEY
|
825D: D0 F1 424 BNE :LOOP
|
||||||
825F: D0 F1 425 BNE :LOOP
|
825F: 7A 425 PLY ; restore Y
|
||||||
8261: FA 426 PLX
|
8260: FA 426 PLX ; restore X
|
||||||
8262: 7A 427 PLY ; restore Y
|
8261: 60 427 RTS
|
||||||
8263: 60 428 RTS
|
428
|
||||||
429
|
429
|
||||||
430
|
430 ********************************
|
||||||
===== Page 9 =====
|
===== Page 9 =====
|
||||||
|
|
||||||
431 ********************************
|
431 *
|
||||||
432 *
|
432 * Send SD command
|
||||||
433 * Send SD command
|
433 * Cmd is in A
|
||||||
434 * Cmd is in A
|
434 *
|
||||||
435 *
|
435 ********************************
|
||||||
436 ********************************
|
436
|
||||||
437
|
8262: 5A 437 COMMAND PHY ; save Y
|
||||||
8264: 7A 438 COMMAND PLY ; save Y
|
8263: A4 3D 438 LDY SLOT
|
||||||
8265: A4 3D 439 LDY SLOT
|
8265: 9D 80 C0 439 STA DATA,X ; send command
|
||||||
8267: 9D 80 C0 440 STA DATA,X ; send command
|
8268: 3C 81 C0 440 :WAIT BIT CTRL,X
|
||||||
826A: 3C 81 C0 441 :WAIT BIT CTRL,X
|
826B: 10 FB 441 BPL :WAIT
|
||||||
826D: 10 FB 442 BPL :WAIT
|
826D: B9 78 04 442 :ARG LDA R30,Y ; get arg from R30 on
|
||||||
826F: B9 78 04 443 :ARG LDA R30,Y ; get arg from R30 on
|
8270: 9D 80 C0 443 STA DATA,X
|
||||||
8272: 9D 80 C0 444 STA DATA,X
|
8273: 3C 81 C0 444 :WAIT1 BIT CTRL,X
|
||||||
8275: 3C 81 C0 445 :WAIT1 BIT CTRL,X
|
8276: 10 FB 445 BPL :WAIT1
|
||||||
8278: 10 FB 446 BPL :WAIT1
|
8278: B9 F8 04 446 LDA R31,Y
|
||||||
827A: B9 F8 04 447 LDA R31,Y
|
827B: 9D 80 C0 447 STA DATA,X
|
||||||
827D: 9D 80 C0 448 STA DATA,X
|
827E: 3C 81 C0 448 :WAIT11 BIT CTRL,X
|
||||||
8280: 3C 81 C0 449 :WAIT11 BIT CTRL,X
|
8281: 10 FB 449 BPL :WAIT11
|
||||||
8283: 10 FB 450 BPL :WAIT11
|
8283: B9 78 05 450 LDA R32,Y
|
||||||
8285: B9 78 05 451 LDA R32,Y
|
8286: 9D 80 C0 451 STA DATA,X
|
||||||
8288: 9D 80 C0 452 STA DATA,X
|
8289: 3C 81 C0 452 :WAIT12 BIT CTRL,X
|
||||||
828B: 3C 81 C0 453 :WAIT12 BIT CTRL,X
|
828C: 10 FB 453 BPL :WAIT12
|
||||||
828E: 10 FB 454 BPL :WAIT12
|
828E: B9 F8 05 454 LDA R33,Y
|
||||||
8290: B9 F8 05 455 LDA R33,Y
|
8291: 9D 80 C0 455 STA DATA,X
|
||||||
8293: 9D 80 C0 456 STA DATA,X
|
8294: 3C 81 C0 456 :WAIT13 BIT CTRL,X
|
||||||
8296: 3C 81 C0 457 :WAIT13 BIT CTRL,X
|
8297: 10 FB 457 BPL :WAIT13
|
||||||
8299: 10 FB 458 BPL :WAIT13
|
8299: A9 FF 458 LDA #DUMMY
|
||||||
829B: A9 FF 459 LDA #DUMMY
|
829B: 9D 80 C0 459 STA DATA,X ; dummy crc
|
||||||
829D: 9D 80 C0 460 STA DATA,X ; dummy crc
|
829E: 3C 81 C0 460 :WAIT2 BIT CTRL,X
|
||||||
82A0: 3C 81 C0 461 :WAIT2 BIT CTRL,X
|
82A1: 10 FB 461 BPL :WAIT2
|
||||||
82A3: 10 FB 462 BPL :WAIT2
|
82A3: 20 EB 81 462 JSR GETR1
|
||||||
82A5: A9 FF 463 :GETR1 LDA #DUMMY
|
82A6: 7A 463 PLY ; restore Y
|
||||||
82A7: 9D 80 C0 464 STA DATA,X ; get R1
|
82A7: 60 464 RTS
|
||||||
82AA: 3C 81 C0 465 :WAIT3 BIT CTRL,X
|
465
|
||||||
82AD: 10 FB 466 BPL :WAIT3
|
466
|
||||||
82AF: BD 80 C0 467 LDA DATA,X ; get response
|
467 ********************************
|
||||||
468 *
|
468 *
|
||||||
469 * TODO: check for error!
|
469 * Status request
|
||||||
470 *
|
470 * $43 Unit number DSSS000
|
||||||
82B2: C9 FE 471 CMP #$FE
|
471 * $44-45 Unused
|
||||||
82B4: D0 EF 472 BNE :GETR1 ; wait for $FE
|
472 * $46-47 Unused
|
||||||
82B6: 7A 473 PLY ; restore Y
|
473 *
|
||||||
82B7: 60 474 RTS
|
474 * C Clear - No error
|
||||||
475
|
475 * Set - Error
|
||||||
476
|
476 * A $00 - No error
|
||||||
477 ********************************
|
477 * $27 - I/O error
|
||||||
478 *
|
478 * $28 - No card inserted / no init
|
||||||
479 * Status request
|
479 * $2B - Card write protected
|
||||||
480 * $43 Unit number DSSS000
|
480 * x - Blocks avail (low byte)
|
||||||
481 * $44-45 Unused
|
481 * y - Blocks avail (high byte)
|
||||||
482 * $46-47 Unused
|
482 *
|
||||||
483 *
|
483 ********************************
|
||||||
484 * C Clear - No error
|
484
|
||||||
485 * Set - Error
|
82A8: 18 485 STATUS CLC ; no error
|
||||||
486 * A $00 - No error
|
82A9: A9 00 486 LDA #0
|
||||||
487 * $27 - I/O error
|
82AB: A2 FF 487 LDX #$FF ; 32 MB partition
|
||||||
===== Page 10 =====
|
===== Page 10 =====
|
||||||
|
|
||||||
488 * $28 - No card inserted / no init
|
82AD: A0 FF 488 LDY #$FF
|
||||||
489 * $2B - Card write protected
|
82AF: 60 489 RTS
|
||||||
490 * x - Blocks avail (low byte)
|
490
|
||||||
491 * y - Blocks avail (high byte)
|
491 * TODO: check for card detect and write protect!
|
||||||
492 *
|
492
|
||||||
493 ********************************
|
493
|
||||||
494
|
494 ********************************
|
||||||
82B8: 18 495 STATUS CLC ; no error
|
495 *
|
||||||
82B9: A9 00 496 LDA #0
|
496 * Read 512 byte block
|
||||||
82BB: A2 FF 497 LDX #$FF ; 32 MB partition
|
497 * $43 Unit number DSSS0000
|
||||||
82BD: A0 FF 498 LDY #$FF
|
498 * $44-45 Address (LO/HI) of buffer
|
||||||
82BF: 60 499 RTS
|
499 * $46-47 Block number (LO/HI)
|
||||||
500
|
500 *
|
||||||
501 * TODO: check for card detect and write protect!
|
501 * C Clear - No error
|
||||||
502
|
502 * Set - Error
|
||||||
503
|
503 * A $00 - No error
|
||||||
504 ********************************
|
504 * $27 - Bad block number
|
||||||
505 *
|
505 * $28 - No card inserted
|
||||||
506 * Read 512 byte block
|
506 *
|
||||||
507 * $43 Unit number DSSS0000
|
507 ********************************
|
||||||
508 * $44-45 Address (LO/HI) of buffer
|
508
|
||||||
509 * $46-47 Block number (LO/HI)
|
509 * TODO: check for card detect!
|
||||||
510 *
|
510
|
||||||
511 * C Clear - No error
|
82B0: 20 38 82 511 READ JSR BLOCK ; calc block address
|
||||||
512 * Set - Error
|
512
|
||||||
513 * A $00 - No error
|
82B3: A9 0E 513 LDA #SS0 ; enable /CS
|
||||||
514 * $27 - Bad block number
|
82B5: 9D 83 C0 514 STA SS,X
|
||||||
515 * $28 - No card inserted
|
82B8: A9 51 515 LDA #$51 ; send CMD17
|
||||||
516 *
|
82BA: 20 62 82 516 JSR COMMAND ; send command
|
||||||
517 ********************************
|
517
|
||||||
518
|
82BD: A9 FF 518 :GETTOK LDA #DUMMY ; get data token
|
||||||
519 * TODO: check for card detect!
|
82BF: 9D 80 C0 519 STA DATA,X
|
||||||
520
|
82C2: 3C 81 C0 520 :WAIT BIT CTRL,X
|
||||||
82C0: 20 38 82 521 READ JSR BLOCK ; calc block address
|
82C5: 10 FB 521 BPL :WAIT
|
||||||
522
|
82C7: BD 80 C0 522 LDA DATA,X ; get response
|
||||||
82C3: A9 0E 523 LDA #SS0 ; enable /CS
|
523 *
|
||||||
82C5: 9D 83 C0 524 STA SS,X
|
524 * TODO: check for error!
|
||||||
82C8: A9 51 525 LDA #$51 ; send CMD17
|
525 *
|
||||||
82CA: 20 64 82 526 JSR COMMAND ; send command
|
82CA: C9 FE 526 CMP #$FE
|
||||||
527
|
82CC: D0 EF 527 BNE :GETTOK ; wait for $FE
|
||||||
82CD: 5A 528 PHY
|
528
|
||||||
82CE: A0 02 529 LDY #2 ; read data from card
|
82CE: A0 02 529 LDY #2 ; read data from card
|
||||||
82D0: 64 3C 530 :LOOPY STZ WORK
|
82D0: 64 3C 530 :LOOPY STZ WORK
|
||||||
82D2: A9 FF 531 :LOOPW LDA #DUMMY
|
82D2: A9 FF 531 :LOOPW LDA #DUMMY
|
||||||
82D4: 9D 80 C0 532 STA DATA,X
|
82D4: 9D 80 C0 532 STA DATA,X
|
||||||
82D7: 3C 81 C0 533 :WAIT4 BIT CTRL,X
|
82D7: 3C 81 C0 533 :WAIT1 BIT CTRL,X
|
||||||
82DA: 10 FB 534 BPL :WAIT4
|
82DA: 10 FB 534 BPL :WAIT1
|
||||||
82DC: BD 80 C0 535 LDA DATA,X
|
82DC: BD 80 C0 535 LDA DATA,X
|
||||||
82DF: 92 44 536 STA ($44)
|
82DF: 92 44 536 STA ($44)
|
||||||
82E1: E6 44 537 INC $44
|
82E1: E6 44 537 INC $44
|
||||||
@ -587,128 +587,157 @@
|
|||||||
82E9: D0 E7 541 BNE :LOOPW
|
82E9: D0 E7 541 BNE :LOOPW
|
||||||
82EB: 88 542 DEY
|
82EB: 88 542 DEY
|
||||||
82EC: D0 E2 543 BNE :LOOPY
|
82EC: D0 E2 543 BNE :LOOPY
|
||||||
82EE: 7A 544 PLY
|
544
|
||||||
===== Page 11 =====
|
===== Page 11 =====
|
||||||
|
|
||||||
545
|
82EE: 20 06 82 545 JSR GETR3 ; read 2 bytes crc
|
||||||
82EF: 20 06 82 546 JSR GETR3 ; read 2 bytes crc
|
82F1: A9 0F 546 LDA #SSNONE
|
||||||
82F2: A9 0F 547 LDA #SSNONE
|
82F3: 9D 83 C0 547 STA SS,X ; disable /CS
|
||||||
82F4: 9D 83 C0 548 STA SS,X ; disable /CS
|
82F6: 18 548 CLC ; no error
|
||||||
82F7: 18 549 CLC ; no error
|
82F7: A9 00 549 LDA #$00
|
||||||
82F8: A9 00 550 LDA #$00
|
82F9: 60 550 RTS
|
||||||
82FA: 7A 551 PLY ; restore Y
|
551
|
||||||
82FB: 60 552 RTS
|
552
|
||||||
553
|
553 ********************************
|
||||||
82FC: A9 0F 554 :ERROR LDA #SSNONE
|
554 *
|
||||||
82FE: 9D 83 C0 555 STA SS,X ; disable /CS
|
555 * Write 512 byte block
|
||||||
8301: 38 556 SEC ; an error occured
|
556 * $43 Unit number DSSS000
|
||||||
8302: A9 27 557 LDA #$27
|
557 * $44-45 Address (LO/HI) of buffer
|
||||||
8304: 7A 558 PLY ; restore Y
|
558 * $46-47 Block number (LO/HI)
|
||||||
8305: 60 559 RTS
|
559 *
|
||||||
560
|
560 * C Clear - No error
|
||||||
561
|
561 * Set - Error
|
||||||
562 ********************************
|
562 * A $00 - No error
|
||||||
563 *
|
563 * $27 - I/O error or bad block number
|
||||||
564 * Write 512 byte block
|
564 * $28 - No card inserted
|
||||||
565 * $43 Unit number DSSS000
|
565 * $2B - Card write protected
|
||||||
566 * $44-45 Address (LO/HI) of buffer
|
566 *
|
||||||
567 * $46-47 Block number (LO/HI)
|
567 ********************************
|
||||||
568 *
|
568
|
||||||
569 * C Clear - No error
|
569 * TODO: check for card detect and write protect!
|
||||||
570 * Set - Error
|
570
|
||||||
571 * A $00 - No error
|
82FA: 20 38 82 571 WRITE JSR BLOCK ; calc block address
|
||||||
572 * $27 - Bad block number
|
572
|
||||||
573 * $28 - No card inserted
|
82FD: A9 0E 573 LDA #SS0 ; enable /CS
|
||||||
574 *
|
82FF: 9D 83 C0 574 STA SS,X
|
||||||
575 ********************************
|
8302: A9 58 575 LDA #$58 ; send CMD24
|
||||||
576
|
8304: 20 62 82 576 JSR COMMAND ; send command
|
||||||
577 * TODO: check for card detect and write protect!
|
577
|
||||||
578
|
8307: A9 FF 578 LDA #DUMMY
|
||||||
8306: 20 38 82 579 WRITE JSR BLOCK ; calc block address
|
8309: 9D 80 C0 579 STA DATA,X ; send dummy
|
||||||
580
|
830C: 3C 81 C0 580 :WAIT1 BIT CTRL,X
|
||||||
8309: A9 0E 581 LDA #SS0 ; enable /CS
|
830F: 10 FB 581 BPL :WAIT1
|
||||||
830B: 9D 83 C0 582 STA SS,X
|
8311: A9 FE 582 LDA #$FE
|
||||||
830E: A9 58 583 LDA #$58 ; send CMD24
|
8313: 9D 80 C0 583 STA DATA,X ; send data token
|
||||||
8310: 20 64 82 584 JSR COMMAND ; send command
|
8316: 3C 81 C0 584 :WAIT2 BIT CTRL,X
|
||||||
585
|
8319: 10 FB 585 BPL :WAIT2
|
||||||
8313: 5A 586 PHY
|
586
|
||||||
8314: A0 02 587 LDY #2 ; send data to card
|
831B: A0 02 587 LDY #2 ; send data to card
|
||||||
8316: 64 3C 588 :LOOPY STZ WORK
|
831D: 64 3C 588 :LOOPY STZ WORK
|
||||||
8318: B2 44 589 :LOOPW LDA ($44)
|
831F: B2 44 589 :LOOPW LDA ($44)
|
||||||
831A: 9D 80 C0 590 STA DATA,X
|
8321: 9D 80 C0 590 STA DATA,X
|
||||||
831D: 3C 81 C0 591 :WAIT4 BIT CTRL,X
|
8324: 3C 81 C0 591 :WAIT3 BIT CTRL,X
|
||||||
8320: 10 FB 592 BPL :WAIT4
|
8327: 10 FB 592 BPL :WAIT3
|
||||||
8322: E6 44 593 INC $44
|
8329: E6 44 593 INC $44
|
||||||
8324: D0 02 594 BNE :INW
|
832B: D0 02 594 BNE :INW
|
||||||
8326: E6 45 595 INC $45 ; inc msb on page boundary
|
832D: E6 45 595 INC $45 ; inc msb on page boundary
|
||||||
8328: E6 3C 596 :INW INC WORK
|
832F: E6 3C 596 :INW INC WORK
|
||||||
832A: D0 EC 597 BNE :LOOPW
|
8331: D0 EC 597 BNE :LOOPW
|
||||||
832C: 88 598 DEY
|
8333: 88 598 DEY
|
||||||
832D: D0 E7 599 BNE :LOOPY
|
8334: D0 E7 599 BNE :LOOPY
|
||||||
600
|
600
|
||||||
832F: A0 02 601 LDY #2 ; send 2 dummy crc bytes
|
8336: A0 02 601 LDY #2 ; send 2 dummy crc bytes
|
||||||
===== Page 12 =====
|
===== Page 12 =====
|
||||||
|
|
||||||
8331: 9D 80 C0 602 :CRC STA DATA,X
|
8338: 9D 80 C0 602 :CRC STA DATA,X
|
||||||
8334: 3C 81 C0 603 :WAIT5 BIT CTRL,X
|
833B: 3C 81 C0 603 :WAIT4 BIT CTRL,X
|
||||||
8337: 10 FB 604 BPL :WAIT5
|
833E: 10 FB 604 BPL :WAIT4
|
||||||
8339: 88 605 DEY
|
8340: 88 605 DEY
|
||||||
833A: D0 F5 606 BNE :CRC
|
8341: D0 F5 606 BNE :CRC
|
||||||
833C: 7A 607 PLY
|
607
|
||||||
608
|
8343: A9 FF 608 LDA #DUMMY ; get data response
|
||||||
833D: A9 0F 609 LDA #SSNONE ; disable /CS
|
8345: 9D 80 C0 609 STA DATA,X
|
||||||
833F: 9D 83 C0 610 STA SS,X
|
8348: 3C 81 C0 610 :WAIT5 BIT CTRL,X
|
||||||
8342: 18 611 CLC ; no error
|
834B: 10 FB 611 BPL :WAIT5
|
||||||
8343: A9 00 612 LDA #0
|
834D: BD 80 C0 612 LDA DATA,X
|
||||||
8345: 7A 613 PLY
|
8350: 29 1F 613 AND #$1F
|
||||||
8346: 60 614 RTS
|
8352: C9 05 614 CMP #$05
|
||||||
615
|
8354: D0 1A 615 BNE :ERROR ; check for write error
|
||||||
616
|
616
|
||||||
617 ********************************
|
8356: A9 FF 617 :WAIT6 LDA #DUMMY ; wait for write cycle
|
||||||
618 *
|
8358: 9D 80 C0 618 STA DATA,X ; to complete
|
||||||
619 * Format
|
835B: 3C 81 C0 619 :WAIT61 BIT CTRL,X
|
||||||
620 * not supported!
|
835E: 10 FB 620 BPL :WAIT61
|
||||||
621 *
|
8360: BD 80 C0 621 LDA DATA,X
|
||||||
622 ********************************
|
8363: C9 00 622 CMP #$00
|
||||||
623
|
8365: F0 EF 623 BEQ :WAIT6
|
||||||
8347: 38 624 FORMAT SEC
|
624
|
||||||
8348: A9 01 625 LDA #$01 ; invalid command
|
8367: A9 0F 625 LDA #SSNONE ; disable /CS
|
||||||
834A: 60 626 RTS
|
8369: 9D 83 C0 626 STA SS,X
|
||||||
627
|
836C: 18 627 CLC ; no error
|
||||||
628
|
836D: A9 00 628 LDA #0
|
||||||
834B: 40 00 00 629 CMD0 HEX 400000
|
836F: 60 629 RTS
|
||||||
834E: 00 00 95 630 HEX 000095
|
630
|
||||||
8351: 41 00 00 631 CMD1 HEX 410000
|
631 :ERROR
|
||||||
8354: 00 00 F9 632 HEX 0000F9
|
8370: A9 FF 632 :WAIT7 LDA #DUMMY ; wait for write cycle
|
||||||
8357: 48 00 00 633 CMD8 HEX 480000
|
8372: 9D 80 C0 633 STA DATA,X ; to complete
|
||||||
835A: 01 AA 87 634 HEX 01AA87
|
8375: 3C 81 C0 634 :WAIT71 BIT CTRL,X
|
||||||
835D: 50 00 00 635 CMD16 HEX 500000
|
8378: 10 FB 635 BPL :WAIT71
|
||||||
8360: 02 00 FF 636 HEX 0200FF
|
837A: BD 80 C0 636 LDA DATA,X
|
||||||
8363: 77 00 00 637 CMD55 HEX 770000
|
837D: C9 00 637 CMP #$00
|
||||||
8366: 00 00 65 638 HEX 000065
|
837F: F0 EF 638 BEQ :WAIT7
|
||||||
8369: 69 40 00 639 ACMD4140 HEX 694000
|
8381: A9 0F 639 LDA #SSNONE
|
||||||
836C: 00 00 77 640 HEX 000077
|
8383: 9D 83 C0 640 STA SS,X ; disable /CS
|
||||||
836F: 69 00 00 641 ACMD410 HEX 690000
|
8386: 38 641 SEC ; an error occured
|
||||||
8372: 00 00 FF 642 HEX 0000FF
|
8387: A9 27 642 LDA #$27
|
||||||
|
8389: 60 643 RTS
|
||||||
|
644
|
||||||
|
645
|
||||||
|
646 ********************************
|
||||||
|
647 *
|
||||||
|
648 * Format
|
||||||
|
649 * not supported!
|
||||||
|
650 *
|
||||||
|
651 ********************************
|
||||||
|
652
|
||||||
|
838A: 38 653 FORMAT SEC
|
||||||
|
838B: A9 01 654 LDA #$01 ; invalid command
|
||||||
|
838D: 60 655 RTS
|
||||||
|
656
|
||||||
|
657
|
||||||
|
838E: 40 00 00 658 CMD0 HEX 400000
|
||||||
|
===== Page 13 =====
|
||||||
|
|
||||||
|
8391: 00 00 95 659 HEX 000095
|
||||||
|
8394: 41 00 00 660 CMD1 HEX 410000
|
||||||
|
8397: 00 00 F9 661 HEX 0000F9
|
||||||
|
839A: 48 00 00 662 CMD8 HEX 480000
|
||||||
|
839D: 01 AA 87 663 HEX 01AA87
|
||||||
|
83A0: 50 00 00 664 CMD16 HEX 500000
|
||||||
|
83A3: 02 00 FF 665 HEX 0200FF
|
||||||
|
83A6: 77 00 00 666 CMD55 HEX 770000
|
||||||
|
83A9: 00 00 65 667 HEX 000065
|
||||||
|
83AC: 69 40 00 668 ACMD4140 HEX 694000
|
||||||
|
83AF: 00 00 77 669 HEX 000077
|
||||||
|
83B2: 69 00 00 670 ACMD410 HEX 690000
|
||||||
|
83B5: 00 00 FF 671 HEX 0000FF
|
||||||
|
|
||||||
|
|
||||||
--End assembly, 885 bytes, Errors: 0
|
--End assembly, 952 bytes, Errors: 0
|
||||||
|
|
||||||
|
|
||||||
Symbol table - alphabetical order:
|
Symbol table - alphabetical order:
|
||||||
|
|
||||||
ACMD410 =$836F ACMD4140=$8369 BLOCK =$8238 CMD =$81D7
|
ACMD410 =$83B2 ACMD4140=$83AC BLOCK =$8238 CMD =$81D7
|
||||||
CMD0 =$834B CMD1 =$8351 CMD16 =$835D CMD55 =$8363
|
CMD0 =$838E CMD1 =$8394 CMD16 =$83A0 CMD55 =$83A6
|
||||||
CMD8 =$8357 CMDHI =$41 CMDLO =$40 COMMAND =$8264
|
CMD8 =$839A CMDHI =$41 CMDLO =$40 COMMAND =$8262
|
||||||
CTRL =$C081 CURSLOT =$07F8 DATA =$C080 DEBUG =$01
|
CTRL =$C081 CURSLOT =$07F8 DATA =$C080 DEBUG =$01
|
||||||
DIV =$C082 DRIVER =$805A DUMMY =$FF FORMAT =$8347
|
DIV =$C082 DRIVER =$805A DUMMY =$FF FORMAT =$838A
|
||||||
GETR1 =$81EB GETR3 =$8206 INIT =$8100 INSLP =$801F
|
GETR1 =$81EB GETR3 =$8206 INIT =$8100 INSLP =$801F
|
||||||
INSLP2 =$8038 INSOUT =$8059 R30 =$0478 R31 =$04F8
|
INSLP2 =$8038 INSOUT =$8059 R30 =$0478 R31 =$04F8
|
||||||
R32 =$0578 R33 =$05F8 READ =$82C0 SLOT =$3D
|
R32 =$0578 R33 =$05F8 READ =$82B0 SLOT =$3D
|
||||||
SLOT16 =$2B SS =$C083 SS0 =$0E SSNONE =$0F
|
SLOT16 =$2B SS =$C083 SS0 =$0E SSNONE =$0F
|
||||||
===== Page 13 =====
|
STATUS =$82A8 WORK =$3C WRITE =$82FA
|
||||||
|
|
||||||
STATUS =$82B8 WORK =$3C WRITE =$8306
|
|
||||||
|
|
||||||
|
|
||||||
Symbol table - numerical order:
|
Symbol table - numerical order:
|
||||||
@ -718,9 +747,9 @@ Symbol table - numerical order:
|
|||||||
DUMMY =$FF R30 =$0478 R31 =$04F8 R32 =$0578
|
DUMMY =$FF R30 =$0478 R31 =$04F8 R32 =$0578
|
||||||
R33 =$05F8 CURSLOT =$07F8 INSLP =$801F INSLP2 =$8038
|
R33 =$05F8 CURSLOT =$07F8 INSLP =$801F INSLP2 =$8038
|
||||||
INSOUT =$8059 DRIVER =$805A INIT =$8100 CMD =$81D7
|
INSOUT =$8059 DRIVER =$805A INIT =$8100 CMD =$81D7
|
||||||
GETR1 =$81EB GETR3 =$8206 BLOCK =$8238 COMMAND =$8264
|
GETR1 =$81EB GETR3 =$8206 BLOCK =$8238 COMMAND =$8262
|
||||||
STATUS =$82B8 READ =$82C0 WRITE =$8306 FORMAT =$8347
|
STATUS =$82A8 READ =$82B0 WRITE =$82FA FORMAT =$838A
|
||||||
CMD0 =$834B CMD1 =$8351 CMD8 =$8357 CMD16 =$835D
|
CMD0 =$838E CMD1 =$8394 CMD8 =$839A CMD16 =$83A0
|
||||||
CMD55 =$8363 ACMD4140=$8369 ACMD410 =$836F DATA =$C080
|
CMD55 =$83A6 ACMD4140=$83AC ACMD410 =$83B2 DATA =$C080
|
||||||
CTRL =$C081 DIV =$C082 SS =$C083
|
CTRL =$C081 DIV =$C082 SS =$C083
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ BLOCK PHY ; save Y
|
|||||||
*
|
*
|
||||||
********************************
|
********************************
|
||||||
|
|
||||||
COMMAND PLY ; save Y
|
COMMAND PHY ; save Y
|
||||||
LDY SLOT
|
LDY SLOT
|
||||||
STA DATA,X ; send command
|
STA DATA,X ; send command
|
||||||
:WAIT BIT CTRL,X
|
:WAIT BIT CTRL,X
|
||||||
|
Loading…
Reference in New Issue
Block a user