Fix for crc after read command

This commit is contained in:
Unknown 2017-08-13 13:46:00 +02:00 committed by Florian Reitz
parent 92f8061ea8
commit 3edc480c74
4 changed files with 221 additions and 207 deletions

Binary file not shown.

View File

@ -6,11 +6,11 @@
6 * (c) Florian Reitz, 2017 6 * (c) Florian Reitz, 2017
7 * 7 *
8 * X register usually contains SLOT16 8 * X register usually contains SLOT16
9 * Y register iss used for counting or SLOT 9 * Y register is used for counting or SLOT
10 * 10 *
11 ******************************** 11 ********************************
12 12
12-AUG-17 15::51 13-AUG-17 13:35
14 14
15 XC ; enable 65C02 code 15 XC ; enable 65C02 code
16 DEBUG = 0 16 DEBUG = 0
@ -186,13 +186,13 @@ C852: 85 2B 179 STA SLOT16 ; $s0
180 FIN 180 FIN
C854: AA 181 TAX ; X holds now SLOT16 C854: AA 181 TAX ; X holds now SLOT16
182 182
C855: 2C FF CF 183 BIT $CCFF C855: 2C FF CF 183 BIT $CFFF
C858: A4 3D 184 LDY SLOT C858: A4 3D 184 LDY SLOT
C85A: B9 78 06 185 LDA INITED,Y ; check for init C85A: B9 78 06 185 LDA INITED,Y ; check for init
C85D: C9 01 186 CMP #$01 C85D: C9 01 186 CMP #$01
C85F: 90 22 187 BCC :INIT C85F: 90 22 187 BCC :INIT
C861: A5 42 188 :CMD LDA $42 ; get command C861: A5 42 188 :CMD LDA $42 ; get command
C863: C9 90 189 CMP #$00 C863: C9 00 189 CMP #$00
C865: F0 10 190 BEQ :STATUS C865: F0 10 190 BEQ :STATUS
C867: C9 01 191 CMP #$01 C867: C9 01 191 CMP #$01
C869: F0 0F 192 BEQ :READ C869: F0 0F 192 BEQ :READ
@ -206,8 +206,8 @@ C876: 60 199 RTS
200 200
C877: 4C AF CA 201 :STATUS JMP STATUS C877: 4C AF CA 201 :STATUS JMP STATUS
C87A: 4C B7 CA 202 :READ JMP READ C87A: 4C B7 CA 202 :READ JMP READ
C87D: 4C 01 CB 203 :WRITE JMP WRITE C87D: 4C 0D CB 203 :WRITE JMP WRITE
C880: 4C 91 CB 204 :FORMAT JMP FORMAT C880: 4C 9D CB 204 :FORMAT JMP FORMAT
C883: 20 00 C9 205 :INIT JSR INIT C883: 20 00 C9 205 :INIT JSR INIT
C886: 80 D9 206 BRA :CMD C886: 80 D9 206 BRA :CMD
207 207
@ -282,16 +282,16 @@ C91D: D0 F5 243 BNE :LOOP ; do 10 times
C91F: A9 0E 244 LDA #SS0 ; set CS low C91F: A9 0E 244 LDA #SS0 ; set CS low
C921: 9D 83 C0 245 STA SS,X C921: 9D 83 C0 245 STA SS,X
246 246
C924: A9 95 247 LDA #<CMD0 ; send CMD0 C924: A9 A1 247 LDA #<CMD0 ; send CMD0
C926: 85 40 248 STA CMDLO C926: 85 40 248 STA CMDLO
C928: A9 CB 249 LDA #>CMD0 C928: A9 CB 249 LDA #>CMD0
C92A: 85 41 250 STA CMDHI C92A: 85 41 250 STA CMDHI
C92C: 20 DE C9 251 JSR CMD C92C: 20 DE C9 251 JSR CMD
C92F: 20 F2 C9 252 JSR GETR1 ; get response C92F: 20 F2 C9 252 JSR GETR1 ; get response
C932: C9 01 253 CMP #$01 C932: C9 01 253 CMP #$01
C934: D0 39 254 BNE :ERROR1 ; error! C934: D0 39 254 BNE :ERROR1 ; error!
255 255
C936: A9 A1 256 LDA #<CMD8 ; send CMD8 C936: A9 AD 256 LDA #<CMD8 ; send CMD8
C938: 85 40 257 STA CMDLO C938: 85 40 257 STA CMDLO
===== Page 6 ===== ===== Page 6 =====
@ -303,15 +303,15 @@ C944: C9 01 262 CMP #$01
C946: D0 2A 263 BNE :SDV1 ; may be SD Ver. 1 C946: D0 2A 263 BNE :SDV1 ; may be SD Ver. 1
264 264
265 * check for $01aa match! 265 * check for $01aa match!
C948: A9 AD 266 :SDV2 LDA #<CMD55 C948: A9 B9 266 :SDV2 LDA #<CMD55
C94A: 85 40 267 STA CMDLO C94A: 85 40 267 STA CMDLO
C94C: A9 CB 268 LDA #>CMD55 C94C: A9 CB 268 LDA #>CMD55
C94E: 85 41 269 STA CMDHI C94E: 85 41 269 STA CMDHI
C950: 20 DE C9 270 JSR CMD C950: 20 DE C9 270 JSR CMD
C953: 20 F2 C9 271 JSR GETR1 C953: 20 F2 C9 271 JSR GETR1
C956: A9 B3 272 LDA #<ACMD4140 C956: A9 BF 272 LDA #<ACMD4140
C958: 85 40 273 STA CMDLO C958: 85 40 273 STA CMDLO
C95A: A9 CB 274 LDA #>ACMD4140 C95A: A9 CB 274 LDA #>ACMD4140
C95C: 85 41 275 STA CMDHI C95C: 85 41 275 STA CMDHI
C95E: 20 DE C9 276 JSR CMD C95E: 20 DE C9 276 JSR CMD
C961: 20 F2 C9 277 JSR GETR1 C961: 20 F2 C9 277 JSR GETR1
@ -325,12 +325,12 @@ C96C: 4C AC C9 284 JMP :BLOCKSZ
285 285
C96F: 4C CF C9 286 :ERROR1 JMP :IOERROR ; needed for far jump C96F: 4C CF C9 286 :ERROR1 JMP :IOERROR ; needed for far jump
287 287
C972: A9 AD 288 :SDV1 LDA #<CMD55 C972: A9 B9 288 :SDV1 LDA #<CMD55
C974: 85 40 289 STA CMDLO C974: 85 40 289 STA CMDLO
C976: A9 CB 290 LDA #>CMD55 C976: A9 CB 290 LDA #>CMD55
C978: 85 41 291 STA CMDHI C978: 85 41 291 STA CMDHI
C97A: 20 DE C9 292 JSR CMD ; ignore response C97A: 20 DE C9 292 JSR CMD ; ignore response
C97D: A9 B9 293 LDA #<ACMD410 C97D: A9 C5 293 LDA #<ACMD410
C97F: 85 40 294 STA CMDLO C97F: 85 40 294 STA CMDLO
C981: A9 CB 295 LDA #>ACMD410 C981: A9 CB 295 LDA #>ACMD410
C983: 85 41 296 STA CMDHI C983: 85 41 296 STA CMDHI
@ -343,7 +343,7 @@ C991: D0 03 302 BNE :MMC ; may be MMC card
303 * SD Ver. 1 initialized! 303 * SD Ver. 1 initialized!
C993: 4C AC C9 304 JMP :BLOCKSZ C993: 4C AC C9 304 JMP :BLOCKSZ
305 305
C996: A9 9B 306 :MMC LDA #<CMD1 C996: A9 A7 306 :MMC LDA #<CMD1
C998: 85 40 307 STA CMDLO C998: 85 40 307 STA CMDLO
C99A: A9 CB 308 LDA #>CMD1 C99A: A9 CB 308 LDA #>CMD1
C99C: 85 41 309 STA CMDHI C99C: 85 41 309 STA CMDHI
@ -357,7 +357,7 @@ C9A8: C9 00 314 CMP #$00
C9AA: D0 23 315 BNE :IOERROR ; error! C9AA: D0 23 315 BNE :IOERROR ; error!
316 * MMC Ver. 3 initialized! 316 * MMC Ver. 3 initialized!
317 317
C9AC: A9 A7 318 :BLOCKSZ LDA #<CMD16 C9AC: A9 B3 318 :BLOCKSZ LDA #<CMD16
C9AE: 85 40 319 STA CMDLO C9AE: 85 40 319 STA CMDLO
C9B0: A9 CB 320 LDA #>CMD16 C9B0: A9 CB 320 LDA #>CMD16
C9B2: 85 41 321 STA CMDHI C9B2: 85 41 321 STA CMDHI
@ -366,7 +366,7 @@ C9B7: 20 F2 C9 323 JSR GETR1
C9BA: C9 00 324 CMP #$00 C9BA: C9 00 324 CMP #$00
C9BC: D0 11 325 BNE :IOERROR ; error! C9BC: D0 11 325 BNE :IOERROR ; error!
326 326
C9BE: A4 3D 327 :END LDY SLOT ; all ok C9BE: A4 3D 327 :END LDY SLOT ; all ok
C9C0: A9 01 328 LDA #$01 C9C0: A9 01 328 LDA #$01
C9C2: 99 78 06 329 STA INITED,Y ; initialized C9C2: 99 78 06 329 STA INITED,Y ; initialized
C9C5: 18 330 CLC C9C5: 18 330 CLC
@ -419,11 +419,11 @@ C9F4: 9D 80 C0 374 STA DATA,X
C9F7: 3C 81 C0 375 :WAIT BIT CTRL,X C9F7: 3C 81 C0 375 :WAIT BIT CTRL,X
C9FA: 10 FB 376 BPL :WAIT C9FA: 10 FB 376 BPL :WAIT
C9FC: BD 80 C0 377 LDA DATA,X ; get response C9FC: BD 80 C0 377 LDA DATA,X ; get response
C9FF: 85 C 378 STA WORK ; save R1 C9FF: 85 3C 378 STA WORK ; save R1
CA01: 29 80 379 AND #$80 CA01: 29 80 379 AND #$80
CA03: D0 ED 380 BNE GETR1 ; wait for MSB=0 CA03: D0 ED 380 BNE GETR1 ; wait for MSB=0
CA05: A9 FF 381 LDA #DUMMY CA05: A9 FF 381 LDA #DUMMY
CA07: 9D 80 C0 382 STT DATA,X ; send another dummy CA07: 9D 80 C0 382 STA DATA,X ; send another dummy
CA0A: A5 3C 383 LDA WORK ; restore R1 CA0A: A5 3C 383 LDA WORK ; restore R1
CA0C: 60 384 RTS CA0C: 60 384 RTS
385 385
@ -444,11 +444,11 @@ CA14: A9 FF 399 :LOOP LDA #DUMMY ; send dummy
CA16: 9D 80 C0 400 STA DATA,X CA16: 9D 80 C0 400 STA DATA,X
CA19: 3C 81 C0 401 :WAIT BIT CTRL,X CA19: 3C 81 C0 401 :WAIT BIT CTRL,X
CA1C: 10 FB 402 BPL :WAIT CA1C: 10 FB 402 BPL :WAIT
CA1E: BD 80 C0 403 LDA DATA,X CA1E: BD 80 C0 403 LDA DATA,X
CA21: 48 404 PHA CA21: 48 404 PHA
CA22: 88 405 DEY CA22: 88 405 DEY
CA23: D0 EF 406 BNE :LOOP ; do 4 times CA23: D0 EF 406 BNE :LOOP ; do 4 times
CA25: A4 3D 07 LDY SLOT CA25: A4 3D 407 LDY SLOT
CA27: 68 408 PLA CA27: 68 408 PLA
CA28: 99 F8 05 409 STA R33,Y ; save R3 CA28: 99 F8 05 409 STA R33,Y ; save R3
CA2B: 68 410 PLA CA2B: 68 410 PLA
@ -456,7 +456,7 @@ CA2C: 99 78 05 411 STA R32,Y
CA2F: 68 412 PLA CA2F: 68 412 PLA
CA30: 99 F8 04 413 STA R31,Y CA30: 99 F8 04 413 STA R31,Y
CA33: 68 414 PLA CA33: 68 414 PLA
CA34: 99 78 04 415 STA R30,, CA34: 99 78 04 415 STA R30,Y
CA37: 7A 416 PLY ; restore Y CA37: 7A 416 PLY ; restore Y
CA38: A9 FF 417 LDA #DUMMY CA38: A9 FF 417 LDA #DUMMY
CA3A: 9D 80 C0 418 STA DATA,X ; send another dummy CA3A: 9D 80 C0 418 STA DATA,X ; send another dummy
@ -476,7 +476,7 @@ CA3E: 60 420 RTS
430 430
CA3F: DA 431 BLOCK PHX ; save X CA3F: DA 431 BLOCK PHX ; save X
CA40: 5A 432 PHY ; save Y CA40: 5A 432 PHY ; save Y
CA41: A6 3D 433 LDX SLLT CA41: A6 3D 433 LDX SLOT
CA43: A5 46 434 LDA $46 ; store block num CA43: A5 46 434 LDA $46 ; store block num
CA45: 9D F8 05 435 STA R33,X ; in R30-R33 CA45: 9D F8 05 435 STA R33,X ; in R30-R33
CA48: A5 47 436 LDA $47 CA48: A5 47 436 LDA $47
@ -498,7 +498,7 @@ CA68: 60 451 RTS
452 452
453 453
454 ******************************** 454 ********************************
455 * 455 *
456 * Send SD command 456 * Send SD command
457 * Cmd is in A 457 * Cmd is in A
458 * 458 *
@ -506,7 +506,7 @@ CA68: 60 451 RTS
460 460
CA69: 5A 461 COMMAND PHY ; save Y CA69: 5A 461 COMMAND PHY ; save Y
CA6A: A4 3D 462 LDY SLOT CA6A: A4 3D 462 LDY SLOT
CA6C::9D 80 C0 463 STA DATA,X ; send command CA6C: 9D 80 C0 463 STA DATA,X ; send command
CA6F: 3C 81 C0 464 :WAIT BIT CTRL,X CA6F: 3C 81 C0 464 :WAIT BIT CTRL,X
CA72: 10 FB 465 BPL :WAIT CA72: 10 FB 465 BPL :WAIT
CA74: B9 78 04 466 :ARG LDA R30,Y ; get arg from R30 on CA74: B9 78 04 466 :ARG LDA R30,Y ; get arg from R30 on
@ -552,7 +552,7 @@ CAAE: 60 488 RTS
504 * x - Blocks avail (low byte) 504 * x - Blocks avail (low byte)
505 * y - Blocks avail (high byte) 505 * y - Blocks avail (high byte)
506 * 506 *
5077 ******************************** 507 ********************************
508 508
CAAF: 18 509 STATUS CLC ; no error CAAF: 18 509 STATUS CLC ; no error
CAB0: A9 00 510 LDA #0 CAB0: A9 00 510 LDA #0
@ -567,7 +567,7 @@ CAB6: 60 513 RTS
519 * 519 *
520 * Read 512 byte block 520 * Read 512 byte block
521 * $43 Unit number DSSS0000 521 * $43 Unit number DSSS0000
522 * $44-455Address (LO/HI) of buffer 522 * $44-45 Address (LO/HI) of buffer
523 * $46-47 Block number (LO/HI) 523 * $46-47 Block number (LO/HI)
524 * 524 *
525 * C Clear - No error 525 * C Clear - No error
@ -580,14 +580,13 @@ CAB6: 60 513 RTS
532 532
533 * TODO: check for card detect! 533 * TODO: check for card detect!
534 534
CAB7: 20 3F CA 55 READ JSR BLOCK ; calc block address CAB7: 20 3F CA 535 READ JSR BLOCK ; calc block address
536 536
CABA: A9 0E 537 LDA #SS0 ; enable /CS CABA: A9 0E 537 LDA #SS0 ; enable /CS
CABC: 9D 83 C0 538 STA SS,X CABC: 9D 83 C0 538 STA SS,X
CABF: A9 51 539 LDA #$51 ; send CMD17 CABF: A9 51 539 LDA #$51 ; send CMD17
CAC1: 22 69 CA 540 JSR COMMAND ; send command CAC1: 20 69 CA 540 JSR COMMAND ; send command
541
541
CAC4: A9 FF 542 :GETTOK LDA #DUMMY ; get data token CAC4: A9 FF 542 :GETTOK LDA #DUMMY ; get data token
===== Page 11 ===== ===== Page 11 =====
@ -601,10 +600,10 @@ CACE: BD 80 C0 546 LDA DATA,X ; get response
CAD1: C9 FE 550 CMP #$FE CAD1: C9 FE 550 CMP #$FE
CAD3: D0 EF 551 BNE :GETTOK ; wait for $FE CAD3: D0 EF 551 BNE :GETTOK ; wait for $FE
552 552
CAD5: A0 02 553 LDY #2 ; read dat from card CAD5: A0 02 553 LDY #2 ; read data from card
CAD7: 64 3C 554 :LOOPY STZ WORK CAD7: 64 3C 554 :LOOPY STZ WORK
CAD9: A9 FF 555 :LOOPW LDA #DUMMY CAD9: A9 FF 555 :LOOPW LDA #DUMMY
CADB: 9D 80 CC 556 STA DATA,X CADB: 9D 80 C0 556 STA DATA,X
CADE: 3C 81 C0 557 :WAIT1 BIT CTRL,X CADE: 3C 81 C0 557 :WAIT1 BIT CTRL,X
CAE1: 10 FB 558 BPL :WAIT1 CAE1: 10 FB 558 BPL :WAIT1
CAE3: BD 80 C0 559 LDA DATA,X CAE3: BD 80 C0 559 LDA DATA,X
@ -617,156 +616,163 @@ CAF0: D0 E7 565 BNE :LOOPW
CAF2: 88 566 DEY CAF2: 88 566 DEY
CAF3: D0 E2 567 BNE :LOOPY CAF3: D0 E2 567 BNE :LOOPY
568 568
CAF5: 20 0D CA 569 JSR GETR3 ; read 2 bytes crc CAF5: A0 02 569 LDY #2
CAF8: A9 0F 570 LDA #SSNONE CAF7: A9 FF 570 :CRC LDA #DUMMY ; read 2 bytes crc
CAFA: 9D 83 C0 571 STA SS,X ; disable /CS CAF9: 9D 80 C0 571 STA DATA,X ; and ignore
CAFD: 18 572 CLC ; no error CAFC: 3C 81 C0 572 :WAIT2 BIT CTRL,X
CAFE: A9 00 573 LDA #$00 CAFF: 10 FB 573 BPL :WAIT2
CB00: 60 574 RTS CB01: 88 574 DEY
575 CB02: D0 F3 575 BNE :CRC
576 576
577 ******************************** CB04: A9 0F 577 LDA #SSNONE
578 * CB06: 9D 83 C0 578 STA SS,X ; disable /CS
579 * Write 512 byte block CB09: 18 579 CLC ; no error
580 * $43 Unit number DSSS000 CB0A: A9 00 580 LDA #$00
581 * $44-45 Address (LO/HI) of buffer CB0C: 60 581 RTS
582 * $46-47 Block number (LO/HI) 582
583 * 583
584 * C Clear - No error 584 ********************************
585 * Set - Error 585 *
586 * A $00 - No error 586 * Write 512 byte block
587 * $27 - I/O error or bad block number 587 * $43 Unit number DSSS000
588 * $28 - No card inserted 588 * $44-45 Address (LO/HI) of buffer
589 * $2B - Card write protected 589 * $46-47 Block number (LO/HI)
590 * 590 *
591 ******************************** 591 * C Clear - No error
592 592 * Set - Error
593 * TODO: check for card detect and write protect! 593 * A $00 - No error
594 594 * $27 - I/O error or bad block number
CB01: 20 3F CA 599 WRITE JSR BLOCK ; calc block address 595 * $28 - No card inserted
596 596 * $2B - Card write protected
CB04: A9 0E 597 LDA #SS0 ; enable /CS 597 *
CB06: 9D 83 C0 598 STA SS,X 598 ********************************
CB09: A9 58 599 LDA #$58 ; send CMD24 599
===== Page 12 ===== ===== Page 12 =====
CB0B: 20 69 CA 600 JSR COMMAND ; send command 600 * TODO: check for card detect and write protect!
601 601
CB00: A9 FF 602 LDA #DUMMY CB0D: 20 3F CA 602 WRITE JSR BLOCK ; calc block address
CB10: 9D 80 C0 603 STA DATA,X ; send dummy 603
CB13: 3C 81 C0 604 :WAIT1 BIT CTRL,X CB10: A9 0E 604 LDA #SS0 ; enable /CS
CB16: 10 FB 605 BPL :WAIT1 CB12: 9D 83 C0 605 STA SS,X
CB18: A9 FE 606 LDA #$FE CB15: A9 58 606 LDA #$58 ; send CMD24
CB1A: 9D 80 C0 607 STA DATA,X ; send data token CB17: 20 69 CA 607 JSR COMMAND ; send command
CB1D: 3C 81 C0 608 :WAIT2 BIT CTRL,X 608
CB20: 10 FB 609 BPL :WAIT2 CB1A: A9 FF 609 LDA #DUMMY
610 CB1C: 9D 80 C0 610 STA DATA,X ; send dummy
CB22: A0 02 611 LDY #2 ; send data to card CB1F: 3C 81 C0 611 :WAIT1 BIT CTRL,X
CB24: 64 3C 612 :LOOPY STZ WORK CB22: 10 FB 612 BPL :WAIT1
CB26: B2 44 613 :LOOPW LDA ($44) CB24: A9 FE 613 LDA #$FE
CB28: 9D 80 C0 614 STA DATA,X CB26: 9D 80 C0 614 STA DATA,X ; send data token
CB2B: 3C 81 C0 615 :WAIT3 BIT CTRL,X CB29: 3C 81 C0 615 :WAIT2 BIT CTRL,X
CB2E: 10 FB 616 BPL :WAIT3 CB2C: 10 FB 616 BPL :WAIT2
CB30: E6 44 617 INC $44 617
CB32: D0 02 618 BNE :INW CB2E: A0 02 618 LDY #2 ; send data to card
CB34: E6 45 619 INC $45 ; inc msb on page boundary CB30: 64 3C 619 :LOOPY STZ WORK
CB36: E6 3C 620 :INW INC WORK CB32: B2 44 620 :LOOPW LDA ($44)
CB38: D0 EC 621 BNE :LOOPW CB34: 9D 80 C0 621 STA DATA,X
CB3A: 88 622 DEY CB37: 3C 81 C0 622 :WAIT3 BIT CTRL,X
CB3B: D0 E7 623 BNE :LOOPY CB3A: 10 FB 623 BPL :WAIT3
624 CB3C: E6 44 624 INC $44
CB3D: A0 02 625 LDY #2 ; send 2 dummy crc bytes CB3E: D0 02 625 BNE :INW
CB3F: 9D 80 C0 626 :CRC STA DATA,X CB40: E6 45 626 INC $45 ; inc msb on page boundary
CB42: 3C 81 C0 627 :WAIT4 BIT CTRL,X CB42: E6 3C 627 :INW INC WORK
CB45: 10 FB 628 BPL :WAIT4 CB44: D0 EC 628 BNE :LOOPW
CB47: 88 629 DEY CB46: 88 629 DEY
CB48: D0 F5 630 BNE :CRC CB47: D0 E7 630 BNE :LOOPY
631 631
CB4A: A9 FF 632 LDA #DUMMY ; get data response CB49: A0 02 632 LDY #2 ; send 2 dummy crc bytes
CB4C: 9D 80 C0 633 STA DATA,X CB4B: 9D 80 C0 633 :CRC STA DATA,X
CB4F: 3C 81 C0 634 :WAIT5 BIT CTRL,X CB4E: 3C 81 C0 634 :WAIT4 BIT CTRL,X
CB52: 10 FB 635 BPL :WAIT5 CB51: 10 FB 635 BPL :WAIT4
CB54: BD 80 C0 636 LDA DATA,X CB53: 88 636 DEY
CB57: 29 1F 637 AND #$1F CB54: D0 F5 637 BNE :CRC
CB59: C9 05 638 CMP #$05 638
CB5B: D0 1A 639 BNE :ERROR ; check for write error CB56: A9 FF 639 LDA #DUMMY ; get data response
640 CB58: 9D 80 C0 640 STA DATA,X
CB5D: A9 FF 641 :WAIT6 LDA #DUMMY ; wait for write cycle CB5B: 3C 81 C0 641 :WAIT5 BIT CTRL,X
CB5F: 9D 80 C0 642 STA DATA,X ; to complete CB5E: 10 FB 642 BPL :WAIT5
CB62: 3C 81 C0 643 :WAIT61 BIT CTRL,X CB60: BD 80 C0 643 LDA DATA,X
CB65: 10 FB 644 BPL :WAIT61 CB63: 29 1F 644 AND #$1F
CB67: BD 80 C0 645 LDA DATA,X CB65: C9 05 645 CMP #$05
CB6A: C9 00 646 CMP #$00 CB67: D0 1A 646 BNE :ERROR ; check for write error
CB6C: F0 EF 647 BEQ :WAIT6 647
648 CB69: A9 FF 648 :WAIT6 LDA #DUMMY ; wait for write cycle
CB6E: A9 0F 649 LDA #SSNONE ; disable /CS CB6B: 9D 80 C0 649 STA DATA,X ; to complete
CB70: 9D 83 C0 650 STA SS,X CB6E: 3C 81 C0 650 :WAIT61 BIT CTRL,X
CB73: 18 651 CLC ; no error CB71: 10 FB 651 BPL :WAIT61
CB74: A9 00 652 LDA #0 CB73: BD 80 C0 652 LDA DATA,X
CB76: 60 653 RTS CB76: C9 00 653 CMP #$00
654 CB78: F0 EF 654 BEQ :WAIT6
655 :ERROR 655
CB77: A9 FF 656 :WAIT7 LDA #DUMMY ; wait for write cycle CB7A: A9 0F 656 LDA #SSNONE ; disable /CS
===== Page 13 ===== ===== Page 13 =====
CB79: 9D 80 C0 657 STA DATA,X ; to complete CB7C: 9D 83 C0 657 STA SS,X
CB7C: 3C 81 C0 658 :WAIT71 BIT CTRL,X CB7F: 18 658 CLC ; no error
CB7F: 10 FB 659 BPL :WAIT71 CB80: A9 00 659 LDA #0
CB81: BD 80 C0 660 LDA DATA,X CB82: 60 660 RTS
CB84: C9 00 661 CMP #$00 661
CB86: F0 EF 662 BEQ :WAIT7 662 :ERROR
CB88: A9 0F 663 LDA #SSNONE CB83: A9 FF 663 :WAIT7 LDA #DUMMY ; wait for write cycle
CB8A: 9D 83 C0 664 STA SS,X ; disable /CS CB85: 9D 80 C0 664 STA DATA,X ; to complete
CB8D: 38 665 SEC ; an error occured CB88: 3C 81 C0 665 :WAIT71 BIT CTRL,X
CB8E: A9 27 666 LDA #$27 CB8B: 10 FB 666 BPL :WAIT71
CB90: 60 667 RTS CB8D: BD 80 C0 667 LDA DATA,X
668 CB90: C9 00 668 CMP #$00
669 CB92: F0 EF 669 BEQ :WAIT7
670 ******************************** CB94: A9 0F 670 LDA #SSNONE
671 * CB96: 9D 83 C0 671 STA SS,X ; disable /CS
672 * Format CB99: 38 672 SEC ; an error occured
673 * not supported! CB9A: A9 27 673 LDA #$27
674 * CB9C: 60 674 RTS
675 ******************************** 675
676 676
CB91: 38 677 FORMAT SEC 677 ********************************
CB92: A9 01 678 LDA #$01 ; invalid command 678 *
CB94: 60 679 RTS 679 * Format
680 680 * not supported!
681 681 *
CB95: 40 00 00 682 CMD0 HEX 400000 682 ********************************
CB98: 00 00 95 683 HEX 000095 683
CB9BB 1 00 00 684 CMD1 HEX 410000 CB9D: 38 684 FORMAT SEC
CB9E: 00 00 F9 685 HEX 0000F9 CB9E: A9 01 685 LDA #$01 ; invalid command
CBA1: 48 00 00 686 CMD8 HEX 480000 CBA0: 60 686 RTS
CBA4: 01 AA 87 687 HEX 01AA87 687
CBA7: 50 00 00 688 CMD16 HEX 500000 688
CBAA: 02 00 FF 689 HEX 0200FF CBA1: 40 00 00 689 CMD0 HEX 400000
CBAD: 77 00 00 690 CMD55 HEX 770000 CBA4: 00 00 95 690 HEX 000095
CBB0: 00 00 65 691 HEX 0000065 CBA7: 41 00 00 691 CMD1 HEX 410000
CBB3: 69 40 00 692 ACMD4140 HEX 694000 CBAA: 00 00 F9 692 HEX 0000F9
CBB6: 00 00 77 693 HEX 000077 CBAD: 48 00 00 693 CMD8 HEX 480000
CBB9: 69 00 00 694 ACMD410 EX 690000 CBB0: 01 AA 87 694 HEX 01AA87
CBBC: 00 00 FF 695 HEX 0000FF CBB3: 50 00 00 695 CMD16 HEX 500000
CBB6: 02 00 FF 696 HEX 0200FF
CBB9: 77 00 00 697 CMD55 HEX 770000
CBBC: 00 00 65 698 HEX 000065
CBBF: 69 40 00 699 ACMD4140 HEX 694000
CBC2: 00 00 77 700 HEX 000077
CBC5: 69 00 00 701 ACMD410 HEX 690000
CBC8: 00 00 FF 702 HEX 0000FF
--End assembly, 959 bytes, Errors: 0 --End assembly, 971 bytes, Errors: 0
Symbol table - alphabetical order: Symbol table - alphabetical order:
ACMD410 =$CBB9 ACMD4140=$CBB3 BLOCK =$CA3F ? BOOT =$C823 ACMD410 =$CBC5 ACMD4140=$CBBF BLOCK =$CA3F ? BOOT =$C823
MD =$C9DE CMD0 =$CB95 CMD1 =$CB9B CMD16 =$CBA7 CMD =$C9DE CMD0 =$CBA1 CMD1 =$CBA7 CMD16 =$CBB3
CMD55 =$CBAD CMD8 =$CBA1 CMDHI =$41 CMDLO =$40 CMD55 =$CBB9 CMD8 =$CBAD CMDHI =$41 CMDLO =$40
COMMAND =$CA69 CTRL =$C081 CURSLOT =$07F8 DATA =$C080 COMMAND =$CA69 CTRL =$C081 CURSLOT =$07F8 DATA =$C080
===== Page 14 =====
DEBUG =$00 DIV =$C082 DRIVER =$C83F DUMMY =$FF DEBUG =$00 DIV =$C082 DRIVER =$C83F DUMMY =$FF
FORMAT =$CB91 GETR1 =$C9F2 GETR3 =$CA0D INIT =$C900 FORMAT =$CB9D GETR1 =$C9F2 GETR3 =$CA0D INIT =$C900
INITED =$0678 R30 =$0478 R31 =$04F8 R32 =$0578 INITED =$0678 R30 =$0478 R31 =$04F8 R32 =$0578
R33 =$05F8 READ =$CAB7 SLOT =$3D SLOT16 =$2B R33 =$05F8 READ =$CAB7 SLOT =$3D SLOT16 =$2B
SS =$C083 SS0 =$0E SSNONE =$0F STATUS =$CAAF SS =$C083 SS0 =$0E SSNONE =$0F STATUS =$CAAF
WORK =$3C WRITE =$CB01 WORK =$3C WRITE =$CB0D
===== Page 14 =====
Symbol table - numerical order: Symbol table - numerical order:
@ -778,7 +784,7 @@ Symbol table - numerical order:
CTRL =$C081 DIV =$C082 SS =$C083 ? BOOT =$C823 CTRL =$C081 DIV =$C082 SS =$C083 ? BOOT =$C823
DRIVER =$C83F INIT =$C900 CMD =$C9DE GETR1 =$C9F2 DRIVER =$C83F INIT =$C900 CMD =$C9DE GETR1 =$C9F2
GETR3 =$CA0D BLOCK =$CA3F COMMAND =$CA69 STATUS =$CAAF GETR3 =$CA0D BLOCK =$CA3F COMMAND =$CA69 STATUS =$CAAF
READ =$CAB7 WRITE =$CB01 FORMAT =$CB91 CMD0 =$CB95 READ =$CAB7 WRITE =$CB0D FORMAT =$CB9D CMD0 =$CBA1
CMD1 =$CB9B CMD8 =$CBA1 CMD16 =$CBA7 CMD55 =$CBAD CMD1 =$CBA7 CMD8 =$CBAD CMD16 =$CBB3 CMD55 =$CBB9
ACMD4140=$CBB3 ACMD410 =$CBB9 ACMD4140=$CBBF ACMD410 =$CBC5

View File

@ -170,8 +170,8 @@ DRIVER CLD
LDA #$40 LDA #$40
STA SLOT16 STA SLOT16
ELSE ELSE
JJR $FF58 ; find slot nr JSR $FF58 ; find slot nr
TSS TSX
LDA $0100,X LDA $0100,X
STA CURSLOT ; $Cs STA CURSLOT ; $Cs
AND #$0F AND #$0F
@ -557,7 +557,7 @@ READ JSR BLOCK ; calc block address
LDA #$51 ; send CMD17 LDA #$51 ; send CMD17
JSR COMMAND ; send command JSR COMMAND ; send command
:GETTOK LDA #DUMMY ; get daata token :GETTOK LDA #DUMMY ; get data token
STA DATA,X STA DATA,X
:WAIT BIT CTRL,X :WAIT BIT CTRL,X
BPL :WAIT BPL :WAIT
@ -572,7 +572,7 @@ READ JSR BLOCK ; calc block address
:LOOPY STZ WORK :LOOPY STZ WORK
:LOOPW LDA #DUMMY :LOOPW LDA #DUMMY
STA DATA,X STA DATA,X
:WAIT1 BITT CTRL,X :WAIT1 BIT CTRL,X
BPL :WAIT1 BPL :WAIT1
LDA DATA,X LDA DATA,X
STA ($44) STA ($44)
@ -584,12 +584,19 @@ READ JSR BLOCK ; calc block address
DEY DEY
BNE :LOOPY BNE :LOOPY
JSR GETR3 ; read 2 bytes crc LDY #2
LDA #SSNONE :CRC LDA #DUMMY ; read 2 bytes crc
STA SS,X ; disable /CS STA DATA,X ; and ignore
CLC ; no error :WAIT2 BIT CTRL,X
===== Page 11 ===== ===== Page 11 =====
BPL :WAIT2
DEY
BNE :CRC
LDA #SSNONE
STA SS,X ; disable /CS
CLC ; no error
LDA #$00 LDA #$00
RTS RTS
@ -639,16 +646,16 @@ WRITE JSR BLOCK ; calc block address
INC $45 ; inc msb on page boundary INC $45 ; inc msb on page boundary
:INW INC WORK :INW INC WORK
BNE :LOOPW BNE :LOOPW
DEY DEY
===== Page 12 =====
BNE :LOOPY BNE :LOOPY
LDY #2 ; send 2 dummy crc bytes LDY #2 ; send 2 dummy crc bytes
:CRC STA DATA,X :CRC STA DATA,X
:WAIT4 BIT CTRL,X :WAIT4 BIT CTRL,X
BPL :WAIT4 BPL :WAIT4
DEY DEY
===== Page 12 =====
BNE :CRC BNE :CRC
LDA #DUMMY ; get data response LDA #DUMMY ; get data response
@ -668,7 +675,7 @@ WRITE JSR BLOCK ; calc block address
CMP #$00 CMP #$00
BEQ :WAIT6 BEQ :WAIT6
LDA #SSNONE ; disablee CS LDA #SSNONE ; disable /CS
STA SS,X STA SS,X
CLC ; no error CLC ; no error
LDA #0 LDA #0
@ -698,16 +705,16 @@ WRITE JSR BLOCK ; calc block address
FORMAT SEC FORMAT SEC
LDA #$01 ; invalid command LDA #$01 ; invalid command
RTS RTS
===== Page 13 =====
CMD0 HEX 400000 CMD0 HEX 400000
HEX 000095 HEX 000095
CMD1 HEX 410000 CMD1 HEX 410000
HEX 0000F9 HEX 0000F9
CMD8 HEX 480000 CMD8 HEX 480000
===== Page 13 =====
HEX 01AA87 HEX 01AA87
CMD16 HEX 500000 CMD16 HEX 500000
HEX 0200FF HEX 0200FF

View File

@ -6,8 +6,8 @@ S11300308545644664472CFFCF20B7CA4C0108D8D5
S11300402058FFBABD00018DF807290F853D0A0A23 S11300402058FFBABD00018DF807290F853D0A0A23
S11300500A0A852BAA2CFFCFA43DB97806C90190C2 S11300500A0A852BAA2CFFCFA43DB97806C90190C2
S113006022A542C900F010C901F00FC902F00EC95F S113006022A542C900F010C901F00FC902F00EC95F
S113007003F00D38A901604CAFCA4CB7CA4C01CB90 S113007003F00D38A901604CAFCA4CB7CA4C0DCB84
S11300804C91CB2000C980D9000000000000000082 S11300804C9DCB2000C980D9000000000000000076
S1130090000000000000000000000000000000005C S1130090000000000000000000000000000000005C
S11300A0000000000000000000000000000000004C S11300A0000000000000000000000000000000004C
S11300B0000000000000000000000000000000003C S11300B0000000000000000000000000000000003C
@ -17,15 +17,15 @@ S11300E0000000000000000000000000000000000C
S11300F0000000000000000000000000FFFF473F78 S11300F0000000000000000000000000FFFF473F78
S1130100D8A9039D81C0A90F9D83C0A9079D82C062 S1130100D8A9039D81C0A90F9D83C0A9079D82C062
S1130110A00AA9FF9D80C03C81C010FB88D0F5A92E S1130110A00AA9FF9D80C03C81C010FB88D0F5A92E
S11301200E9D83C0A9958540A9CB854120DEC920B9 S11301200E9D83C0A9A18540A9CB854120DEC920AD
S1130130F2C9C901D039A9A18540A9CB854120DEE6 S1130130F2C9C901D039A9AD8540A9CB854120DEDA
S1130140C9200DCAC901D02AA9AD8540A9CB8541D2 S1130140C9200DCAC901D02AA9B98540A9CB8541C6
S113015020DEC920F2C9A9B38540A9CB854120DEA0 S113015020DEC920F2C9A9BF8540A9CB854120DE94
S1130160C920F2C9C901F0E0C900D0034CACC94CA4 S1130160C920F2C9C901F0E0C900D0034CACC94CA4
S1130170CFC9A9AD8540A9CB854120DEC9A9B985E0 S1130170CFC9A9B98540A9CB854120DEC9A9C585C8
S113018040A9CB854120DEC920F2C9C901F0E3C9E9 S113018040A9CB854120DEC920F2C9C901F0E3C9E9
S113019000D0034CACC9A99B8540A9CB854120DE86 S113019000D0034CACC9A9A78540A9CB854120DE7A
S11301A0C920F2C9C901F0F6C900D023A9A7854026 S11301A0C920F2C9C901F0F6C900D023A9B385401A
S11301B0A9CB854120DEC920F2C9C900D011A43DD4 S11301B0A9CB854120DEC920F2C9C900D011A43DD4
S11301C0A90199780618A000900838A028B003382F S11301C0A90199780618A000900838A028B003382F
S11301D0A027A90F9D83C0A9009D82C098605AA042 S11301D0A027A90F9D83C0A9009D82C098605AA042
@ -46,17 +46,18 @@ S11302B0A900A2FFA0FF60203FCAA90E9D83C0A988
S11302C0512069CAA9FF9D80C03C81C010FBBD803C S11302C0512069CAA9FF9D80C03C81C010FBBD803C
S11302D0C0C9FED0EFA002643CA9FF9D80C03C8150 S11302D0C0C9FED0EFA002643CA9FF9D80C03C8150
S11302E0C010FBBD80C09244E644D002E645E63C23 S11302E0C010FBBD80C09244E644D002E645E63C23
S11302F0D0E788D0E2200DCAA90F9D83C018A900B9 S11302F0D0E788D0E2A002A9FF9D80C03C81C01055
S113030060203FCAA90E9D83C0A9582069CAA9FFCD S1130300FB88D0F3A90F9D83C018A90060203FCAC1
S11303109D80C03C81C010FBA9FE9D80C03C81C073 S1130310A90E9D83C0A9582069CAA9FF9D80C03C2D
S113032010FBA002643CB2449D80C03C81C010FB21 S113032081C010FBA9FE9D80C03C81C010FBA002CF
S1130330E644D002E645E63CD0EC88D0E7A0029D36 S1130330643CB2449D80C03C81C010FBE644D002C2
S113034080C03C81C010FB88D0F5A9FF9D80C03CD3 S1130340E645E63CD0EC88D0E7A0029D80C03C8125
S113035081C010FBBD80C0291FC905D01AA9FF9D0B S1130350C010FB88D0F5A9FF9D80C03C81C010FB74
S113036080C03C81C010FBBD80C0C900F0EFA90F64 S1130360BD80C0291FC905D01AA9FF9D80C03C814A
S11303709D83C018A90060A9FF9D80C03C81C01066 S1130370C010FBBD80C0C900F0EFA90F9D83C01859
S1130380FBBD80C0C900F0EFA90F9D83C038A92729 S1130380A90060A9FF9D80C03C81C010FBBD80C056
S11303906038A901604000000000954100000000A1 S1130390C900F0EFA90F9D83C038A9276038A901CF
S11303A0F948000001AA875000000200FF7700000E S11303A0604000000000954100000000F948000092
S11203B00000656940000000776900000000FF4D S11303B001AA875000000200FF7700000000656971
S10E03C040000000776900000000FF0F
S9030000FC S9030000FC