git @ Cat's Eye Technologies SixtyPical / aa5b069
Add some initial failing tests. Chris Pressey 3 years ago
1 changed file(s) with 74 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
516516 ? TypeMismatchError
517517
518518 You can also copy a literal word to a word table.
519
520 | word table[256] many
519 (Even if the table has fewer than 256 entries.)
520
521 | word table[32] many
521522 |
522523 | routine main
523524 | inputs many
528529 | copy 9999, many + x
529530 | }
530531 = ok
532
533 #### tables: range checking ####
534
535 A table may not have more than 256 entries.
536
537 | word table[512] many
538 |
539 | routine main
540 | inputs many
541 | outputs many
542 | trashes a, x, n, z
543 | {
544 | ld x, 0
545 | copy 9999, many + x
546 | }
547 ? zzzzz
548
549 The number of entries in a table must be a power of two.
550
551 | word table[48] many
552 |
553 | routine main
554 | inputs many
555 | outputs many
556 | trashes a, x, n, z
557 | {
558 | ld x, 0
559 | copy 9999, many + x
560 | }
561 ? zzzz
562
563 If a table has fewer than 256 entries, it cannot be read or written
564 beyond the maximum number of entries it has.
565
566 | byte table[32] many
567 |
568 | routine main
569 | inputs many
570 | outputs many
571 | trashes a, x, n, z
572 | {
573 | ld x, 31
574 | ld a, many + x
575 | st a, many + x
576 | }
577 = ok
578
579 | byte table[32] many
580 |
581 | routine main
582 | inputs many
583 | outputs many
584 | trashes a, x, n, z
585 | {
586 | ld x, 32
587 | ld a, many + x
588 | }
589 ? RangeError
590
591 | byte table[32] many
592 |
593 | routine main
594 | inputs many
595 | outputs many
596 | trashes a, x, n, z
597 | {
598 | ld x, 32
599 | ld a, 0
600 | st a, many + x
601 | }
602 ? RangeError
531603
532604 ### add ###
533605