;matA en matB zijn gevuld ;if(det(A) != 0){ ; matC = det(A) (1x1) ; matD = MatA^-1 x matB x matC ;}else ; dspMsg(); matrixMathStart: ld hl, matD b_call (_mov9toop1) ld a, (matDim) ld h, a ld l, 1 b_call (_createRmat) push de inc de inc de ld a, (matDim) ld h, 0 ld l, a call matClear ld hl, matC b_call (_mov9toop1) ld hl, $0101 b_call (_createRmat) inc de inc de push de ld hl, 1 call matClear matrixMath: ld hl, matA b_call (_mov9toop1) ld a, opDet b_call (_unopexec) b_call (_pushop1);(cl005) hier onder ook nog verandering errhandon(goedwantdetgroter0);dit is omdat ie foutmelding kan geven als getal wat ie convert groter is dan 10^3 b_call (_convop1) errhandoff() ld h, d ld l, e ld de, 0 cphlde jp z, errdet0 goedwantdetgroter0: pop de b_call (_PopReal) ld hl, matA b_call (_mov9toop1) ld a, opinverse b_call (_unopexec);op1 = a^-1 b_call (_pushop1) ld hl, matb b_call (_mov9toop1) ld a, opMult b_call (_binopexec);op1 = a^-1*B b_call (_pushop1) ld hl, matc b_call (_mov9toop1) ld a, opMult b_call (_binopexec);op1 = a^-1*B*C b_call (_findsym) jp c, errunknown push de ld a, (matDim) ld de, 9 call hlisaxde inc hl inc hl ld b, h ld c, l pop hl;a^-1*B*C pop de;matD ldir jp listPage errdet0: ld a, (rij1en) or a jp z, waar ;02 ;waarvoor is dit?? ;ld hl, mata ;b_call (_mov9toop1) ;b_call (_pushop1) ;ld hl, mate ;b_call (_mov9toop1) ; clear l1, l2 ; create l1, l2 len: matdim ; ; hl = mata begin ; bc = matdim*9 ; de = l1 ; ldir ;volgende matdim-1 keer(n){ ; volgende mata rij naar l2 ; l1/l2-> l3 ; a = l3(1) ; matdim-1 x(m){ ; if l3(m) != a ; jr volgende mata rij ; } ; rowswap([a], n, matdim) ; rowswap([b], n, matdim) ; redim([a]) ;h = l = matdim-1; ; redim([b]) ;h = matdim-1;l=1 ; opnieuw Det( checken ;} ; clear l1, l2 ; create l1, l2 len: matdim ; begin l2 = varl2Start ; ; hl = mata begin ; bc = matdim*9 ; de = l1 ; ldir ; push HL ; ; N = 1 (lijstNR);K = matdim-1 ; LOOP: ; n ++ ; ld a, k ; cp n ; jr c, stop ; volgende mata rij naar l2 ; pop hl ; ld de, varl2Start ; ld bc, matdim*9 ; ldir ; push hl ; l1/l2-> l3 ; a = l3(1) ; matdim-1 x(m){ ; if l3(m) != a ; jr volgende mata rij ; } ;x rowswap([a], n, matdim) ;x rowswap([b], n, matdim) ; pop de ; de -= matdim*9 ; hl = (de + matdim-n)matdim*9 ; bc = matdim*9 ; ldir ; redim([a]) ;h = l = matdim-1; ; redim([b]) ;h = matdim-1;l=1 ; opnieuw Det( checken ;} ld a, (rij1en) dec a ld (rij1en), a ld a, (matdim) dec a ld (matdim), a call getDoubleRow ; call debuga ;; swaprow([A],(var),matDim+1)->[A] ;; Redim([A],matDim,matDim) ld hl, matA b_call (_mov9toop1) b_call (_pushop1) ld a, (var) b_call (_setxxop1) b_call (_pushop1) ld a, (matDim) inc a b_call (_setxxop1) ld a, oprswap b_call (_threeexec); swaprow([A],(var),matDim+1) b_call (_pushop1) ld hl, matA b_call (_mov9toop1) b_call (_stoother);->[A] ld hl, matA b_call (_mov9toop1) ld a, (matDim) ld h, a ld l, a b_call (_redimmat);Redim([A],matDim,matDim) ;; swaprow([B],(var),matDim+1)->[B] ;; Redim([B],matDim,1) ld hl, matB b_call (_mov9toop1) b_call (_pushop1) ld a, (var) b_call (_setxxop1) b_call (_pushop1) ld a, (matDim) inc a b_call (_setxxop1) ld a, oprswap b_call (_threeexec); swaprow([B],(var),matDim+1) b_call (_pushop1) ld hl, matB b_call (_mov9toop1) b_call (_stoother);->[B] ld hl, matb b_call (_mov9toop1) ld a, (matDim) ld h, a ld l, 1 b_call (_redimmat);Redim([B],matDim,1) ld hl, matrixMathStart push hl ld hl, 0 push hl ld hl, matc push hl ld hl, matd push hl jp clearPopVars getDoubleRow: ;output ; (var) number of row(1,2,..) xor a ld (var), a volgendeRowCheck: ld a, (var) inc a ld (var), a ld hl, mata b_call (_mov9toop1) b_call (_pushop1) ld a, (var) b_call (_setxxop1) b_call (_pushop1) ld a, (matDim) inc a b_call (_setxxop1) ld a, oprswap b_call (_threeexec) b_call (_op1toop2) ld a, (matDim) ld h, a ld l, a b_call (_redimmat) b_call (_op2toop1) ld a, opDet b_call (_unopexec) errhandon(goedwantdetgroter0);dit is omdat ie foutmelding kan geven als getal wat ie convert groter is dan 10^3 b_call (_convop1) errhandoff() ld h, d ld l, e ld de, 0 cphlde jr nz, goedwantdetgroter0_2 ld a, (var) ld b, a ld a, (matDim) cp b jr nz, volgendeRowCheck;we checken dus niet de laatste rij niet maar das niet erg, dubbele rij heeft 2 rijen ;ld a, 99 ;ld (counter), a;we veranderen counter niet goedwantdetgroter0_2: ld a, (var) ret waar: ld hl, errunsolvablemsg call dspmsg jp menu2 errunknown: ld hl, errunknownmsg call dspmsg jp menu2