Add matrix-matrix multiply

To see how many FLOP/s we get
This commit is contained in:
Vince Weaver 2012-05-09 23:12:19 -04:00
parent e8fd1c403d
commit 9e92b8fae0
2 changed files with 35 additions and 2 deletions

View File

@ -4,12 +4,16 @@ LFLAGS =
all: presenter_demo.dsk
presenter_demo.dsk: PRESENTER_DEMO TITLE.IMG NUM.SHAPE
presenter_demo.dsk: PRESENTER_DEMO TITLE.IMG NUM.SHAPE MMM
../dos33 presenter_demo.dsk SAVE A PRESENTER_DEMO
../dos33 presenter_demo.dsk SAVE B TITLE.IMG
../dos33 presenter_demo.dsk SAVE B NUM.SHAPE
../dos33 presenter_demo.dsk SAVE A MMM
MMM: mmm.bas
../tokenize_asoft < mmm.bas > MMM
NUM.SHAPE: num.table
../shape_table -b < num.table > NUM.SHAPE
@ -23,5 +27,5 @@ demo.bas: ../asoft_presenter
../asoft_presenter . > demo.bas
clean:
rm -f *~ *.IMG *.bas PRESENTER_DEMO NUM.SHAPE
rm -f *~ *.IMG demo.bas PRESENTER_DEMO NUM.SHAPE MMM

29
presenter_demo/mmm.bas Normal file
View File

@ -0,0 +1,29 @@
10 DIM A(10,10): DIM B(10,10): DIM C(10,10)
20 FOR I = 0 TO 9
30 FOR J = 0 TO 9
40 A(I,J) = I / 2 + J * 5
50 B(I,J) = I / 4 * (I + 8) * J
60 NEXT J,I
70 PRINT CHR$ (7);"START!"
100 FOR J = 0 TO 9
110 FOR I = 0 TO 9
120 S = 0
130 FOR K = 0 TO 9
140 S = S + (A(K,J) * B(I,K))
150 NEXT K
160 C(I,J) = S
170 NEXT I
180 NEXT J
190 PRINT CHR$ (7);"STOP"
200 FOR I = 0 TO 9
210 FOR J = 0 TO 9
220 PRINT C(I,J);" ";
230 NEXT J
240 PRINT
250 NEXT I
300 PRINT "HOW MANY SECONDS? ";
310 INPUT T
320 PRINT 2000 / T;" FLOP/s"
330 PRINT "Yes I know using BASIC is unfair"
340 PRINT "But I am too lazy to code up a "
350 PRINT "6502 FP implementaion in assembler"