Deriving a new dialect of Very Tiny Language from VTL-2 6800 version
Revisão | e16e8f4e35290c6305f6cb99a0f1c5107f444de9 (tree) |
---|---|
Hora | 2022-10-06 10:09:08 |
Autor | Joel Matthew Rees <joel.rees@gmai...> |
Commiter | Joel Matthew Rees |
detour working out parameter and local discipline too far in advance
@@ -442,7 +442,7 @@ GOTIT | ||
442 | 442 | * RSTRT LBRA START ; warm start over |
443 | 443 | * |
444 | 444 | PRNT PULU B ; PRINT DECIMAL |
445 | -PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL | |
445 | +PRNT2 LDX #DECBUF ; CONVERT TO DECIMAL ** fix this reference later | |
446 | 446 | STX CNVPTR |
447 | 447 | LDX #PWRS10 |
448 | 448 | CVD1 PSHU X |
@@ -643,31 +643,41 @@ PWRS10 FCB $27 ; 10000 | ||
643 | 643 | FCB $00 ; 1 |
644 | 644 | FCB $01 |
645 | 645 | * |
646 | -DIVIDE CLR MLDVCT ; DEVIDE 16-BITS | |
647 | -GOT INC MLDVCT | |
648 | - ASL 1,X | |
649 | - ROL 0,X | |
646 | +* parameters (should prefer to use SET rather than EQU) | |
647 | +DIVSR EQU 3 ; divisor | |
648 | +DIVCT EQU 2 ; lead bit count | |
649 | +DIVQ EQU 0 ; quotient | |
650 | +DIVLOC EQU DIVCT+1 | |
651 | +DIVIDE LEAU -DIVLOC,U | |
652 | + CLR DIVCT,U ; DEVIDE 16-BITS | |
653 | +GOT INC DIVCT,U | |
654 | + ASL DIVSR+1,U | |
655 | + ROL DIVSR,U | |
650 | 656 | BCC GOT |
651 | - ROR 0,X | |
652 | - ROR 1,X | |
653 | - CLR DIVQUO | |
654 | - CLR DIVQUO+1 | |
655 | -DIV2 SUBD 0,X | |
657 | + ROR DIVSR,U | |
658 | + ROR DIVSR+1,U | |
659 | + CLR DIVQ,U | |
660 | + CLR DIVQ+1,U | |
661 | +DIV2 SUBD DIVSR,U | |
656 | 662 | BCC OK |
657 | - ADDD 0,X | |
663 | + ADDD DIVSR,U | |
658 | 664 | ANDCC #$FE |
659 | 665 | BRA DIVNOC ; instead of the trick |
660 | 666 | * The 6809 CMPX affects all relevant flags, can't use this trick. |
661 | 667 | * And the op-codes are different in the 6809, too. |
662 | 668 | * FCB $9C ; CMPX |
663 | 669 | OK ORCC #$01 |
664 | -DIVNOC ROL DIVQUO+1 | |
665 | - ROL DIVQUO | |
666 | - DEC MLDVCT | |
670 | +DIVNOC ROL DIVQ+1,U | |
671 | + ROL DIVQ,U | |
672 | + DEC DIVCT,U | |
667 | 673 | BEQ DONE |
668 | - LSR 0,X | |
669 | - ROR 1,X | |
674 | + LSR DIVSR,U | |
675 | + ROR DIVSR+1,U | |
670 | 676 | BRA DIV2 |
677 | +DIVDUN LEAU DIVLOC,U | |
678 | +DONE ANDCC #$FE | |
679 | + RTS | |
680 | + | |
671 | 681 | * |
672 | 682 | TSTN LDB 0,X ; TEST FOR NUMERIC |
673 | 683 | CMPB #$3A |
@@ -675,9 +685,9 @@ TSTN LDB 0,X ; TEST FOR NUMERIC | ||
675 | 685 | CMPB #'0 |
676 | 686 | BGE DONE |
677 | 687 | NOTDEC ORCC #$01 |
678 | - RTS | |
679 | -DONE ANDCC #$FE | |
680 | 688 | DUN RTS |
689 | +*DONE ANDCC #$FE | |
690 | +*DUN RTS | |
681 | 691 | * |
682 | 692 | CVTLN BSR INLN |
683 | 693 | * |