📄 fft.lst
字号:
FFT PAGE 10
599 ;
4356 E525 600 Np1: mov a,celnum
4358 C3 601 clr c
4359 13 602 rrc a ; halve no. cells
435A F525 603 mov celnum,a
435C 6014 604 jz fftdun ; done out of cells
435E E526 605 mov a,pairnm
4360 C3 606 clr c
4361 33 607 rlc a
4362 F526 608 mov pairnm,a ; twice as many pairs
4364 E527 609 mov a,celdis
4366 C3 610 clr c
4367 33 611 rlc a
4368 F527 612 mov celdis,a ; twice as far apart
436A E528 613 mov a,delta
436C C3 614 clr c
436D 13 615 rrc a
436E F528 616 mov delta,a ; halve the angle
4370 41AD 617 jmp Npass
618
4372 22 619 fftdun: ret
620 ;
=1 621 $include(plotpwr.asm) ; 4014 graphics display
=1 622 $nolist
=1 1052 $list
=1 1053 ; plot power graph
001D =1 1054 vector equ 29 ; 4014 vector mode
001F =1 1055 alpha equ 31 ; 4014 text mode
0180 =1 1056 center equ 384 ; center baseline
027F =1 1057 toplin equ 640 - 1
0081 =1 1058 botlin equ 128 + 1
557F =1 1059 buff equ 557fh
FF7E =1 1060 samples equ not 129
=1 1061
4373 12449F =1 1062 ppg: call initgraf
=1 1063 ; title
4376 7A01 =1 1064 mov r2,#1
4378 7B1E =1 1065 mov r3,#30
437A B104 =1 1066 acall set_cursor
437C 120112 =1 1067 call ilprt
437F 1F506F77 =1 1068 db alpha,'Power Graph',0
4383 65722047
4387 72617068
438B 00
=1 1069
438C 90557F =1 1070 mov dptr,#pabuf ; where sampled data is
=1 1071 +1 shld head
=1 1072 +1 $nolist
=1 1074 +1 $list
438F 8008 =1 1075 +1 sjmp shld2
4391 E583 =1 1076 +1 SHLD1: MOV A,DPH
4393 F2 =1 1077 +1 MOVX @R0,A
4394 08 =1 1078 +1 INC R0
4395 E582 =1 1079 +1 MOV A,DPL
4397 F2 =1 1080 +1 MOVX @R0,A
4398 22 =1 1081 +1 ret
0001 =1 1082 +1 shld0 set 1
4399 =1 1083 +1 shld2:
FFT PAGE 11
=1 1084 +1 endif
=1 1085 +1 $list
4399 75A046 =1 1086 +1 MOV P2,#HIGH head
439C 7808 =1 1087 +1 MOV R0,#LOW head
439E 7191 =1 1088 +1 call shld1
43A0 90FF7E =1 1090 mov dptr,#samples
=1 1091 +1 shld sampl ; number of data points
=1 1092 +1 $nolist
=1 1105 +1 $list
43A3 75A046 =1 1106 +1 MOV P2,#HIGH sampl
43A6 780A =1 1107 +1 MOV R0,#LOW sampl
43A8 7191 =1 1108 +1 call shld1
43AA 900180 =1 1110 mov dptr,#center
=1 1111 +1 shld basel
=1 1112 +1 $nolist
=1 1125 +1 $list
43AD 75A046 =1 1126 +1 MOV P2,#HIGH basel
43B0 7810 =1 1127 +1 MOV R0,#LOW basel
43B2 7191 =1 1128 +1 call shld1
=1 1130 ;
=1 1131 ; show where baseline is
43B4 900000 =1 1132 mov dptr,#0
=1 1133 +1 shld x1
=1 1134 +1 $nolist
=1 1147 +1 $list
43B7 75A046 =1 1148 +1 MOV P2,#HIGH x1
43BA 7800 =1 1149 +1 MOV R0,#LOW x1
43BC 7191 =1 1150 +1 call shld1
=1 1152 +1 shld x2
=1 1153 +1 $nolist
=1 1166 +1 $list
43BE 75A046 =1 1167 +1 MOV P2,#HIGH x2
43C1 7804 =1 1168 +1 MOV R0,#LOW x2
43C3 7191 =1 1169 +1 call shld1
=1 1171 +1 lhld basel
=1 1172 +1 $nolist
=1 1174 +1 $list
43C5 800A =1 1175 +1 sjmp lhld2
43C7 F582 =1 1176 +1 lhld1: mov dpl,a
43C9 E2 =1 1177 +1 MOVX A,@R0
43CA F583 =1 1178 +1 MOV dph,A
43CC 08 =1 1179 +1 INC R0
43CD E2 =1 1180 +1 MOVX a,@R0
43CE C582 =1 1181 +1 xch a,dpl
43D0 22 =1 1182 +1 ret
0001 =1 1183 +1 lhld0 set 1
43D1 =1 1184 +1 lhld2:
=1 1185 +1 endif
=1 1186 +1 $list
43D1 75A046 =1 1187 +1 MOV P2,#HIGH basel
43D4 7810 =1 1188 +1 MOV R0,#LOW basel
43D6 71C7 =1 1189 +1 call lhld1
43D8 C3 =1 1191 clr c
43D9 E582 =1 1192 mov a,dpl
43DB 9408 =1 1193 subb a,#8
43DD F582 =1 1194 mov dpl,a
43DF E583 =1 1195 mov a,dph
43E1 9400 =1 1196 subb a,#0
FFT PAGE 12
43E3 F583 =1 1197 mov dph,a
=1 1198 +1 shld y1
=1 1199 +1 $nolist
=1 1212 +1 $list
43E5 75A046 =1 1213 +1 MOV P2,#HIGH y1
43E8 7802 =1 1214 +1 MOV R0,#LOW y1
43EA 7191 =1 1215 +1 call shld1
=1 1217 +1 shld y2
=1 1218 +1 $nolist
=1 1231 +1 $list
43EC 75A046 =1 1232 +1 MOV P2,#HIGH y2
43EF 7806 =1 1233 +1 MOV R0,#LOW y2
43F1 7191 =1 1234 +1 call shld1
43F3 1244AB =1 1236 call dot
43F6 120112 =1 1237 call ilprt
43F9 1F3E00 =1 1238 db alpha,'>',0
=1 1239
=1 1240 ; setup first data position
=1 1241 +1 lhld basel
=1 1242 +1 $nolist
=1 1256 +1 $list
43FC 75A046 =1 1257 +1 MOV P2,#HIGH basel
43FF 7810 =1 1258 +1 MOV R0,#LOW basel
4401 71C7 =1 1259 +1 call lhld1
=1 1261 +1 shld y1
=1 1262 +1 $nolist
=1 1275 +1 $list
4403 75A046 =1 1276 +1 MOV P2,#HIGH y1
4406 7802 =1 1277 +1 MOV R0,#LOW y1
4408 7191 =1 1278 +1 call shld1
=1 1280 +1 shld y2
=1 1281 +1 $nolist
=1 1294 +1 $list
440A 75A046 =1 1295 +1 MOV P2,#HIGH y2
440D 7806 =1 1296 +1 MOV R0,#LOW y2
440F 7191 =1 1297 +1 call shld1
4411 90000A =1 1299 mov dptr,#10
=1 1300 +1 shld x1
=1 1301 +1 $nolist
=1 1314 +1 $list
4414 75A046 =1 1315 +1 MOV P2,#HIGH x1
4417 7800 =1 1316 +1 MOV R0,#LOW x1
4419 7191 =1 1317 +1 call shld1
=1 1319 +1 shld x2
=1 1320 +1 $nolist
=1 1333 +1 $list
441B 75A046 =1 1334 +1 MOV P2,#HIGH x2
441E 7804 =1 1335 +1 MOV R0,#LOW x2
4420 7191 =1 1336 +1 call shld1
4422 91B8 =1 1338 acall plot ; start at baseline
4424 91C8 =1 1339 acall savit
=1 1340 ;
4426 75A046 =1 1341 plotr: mov p2,#high x1
4429 7801 =1 1342 mov r0,#low x1+1
442B E2 =1 1343 movx a,@r0
442C 2404 =1 1344 add a,#4 ; x1 = x1 + 1
442E F2 =1 1345 movx @r0,a
442F 18 =1 1346 dec r0
FFT PAGE 13
4430 E2 =1 1347 movx a,@r0
4431 3400 =1 1348 addc a,#0
4433 F2 =1 1349 movx @r0,a
4434 12012A =1 1350 call chkbrk ; quitter ?
4437 5001 =1 1351 jnc nokeyb
4439 22 =1 1352 ret
=1 1353 +1 nokeyb: lhld head ; buffer pointer
=1 1354 +1 $nolist
=1 1368 +1 $list
443A 75A046 =1 1369 +1 MOV P2,#HIGH head
443D 7808 =1 1370 +1 MOV R0,#LOW head
443F 71C7 =1 1371 +1 call lhld1
4441 E0 =1 1373 movx a,@dptr ; get data
4442 C0E0 =1 1374 push acc ; save data
4444 A3 =1 1375 inc dptr
=1 1376 +1 shld head
=1 1377 +1 $nolist
=1 1390 +1 $list
4445 75A046 =1 1391 +1 MOV P2,#HIGH head
4448 7808 =1 1392 +1 MOV R0,#LOW head
444A 7191 =1 1393 +1 call shld1
444C D0E0 =1 1395 pop acc ; get data
444E C0E0 =1 1396 PUSH ACC
=1 1397 +1 lhld basel
=1 1398 +1 $nolist
=1 1412 +1 $list
4450 75A046 =1 1413 +1 MOV P2,#HIGH basel
4453 7810 =1 1414 +1 MOV R0,#LOW basel
4455 71C7 =1 1415 +1 call lhld1
4457 D0E0 =1 1417 POP ACC
4459 75A046 =1 1418 mov p2,#high y1 ; put in Y1
445C 7803 =1 1419 mov r0,#low y1+1
445E 2582 =1 1420 add a,dpl
4460 F2 =1 1421 movx @r0,a ; y1 = data
4461 18 =1 1422 dec r0 ; to high byte of y1
4462 E4 =1 1423 clr a ; hi y always 0
4463 3583 =1 1424 addc a,dph
4465 F2 =1 1425 movx @r0,a ; y1 = data
=1 1426 +1 LHLD Y1
=1 1427 +1 $nolist
=1 1441 +1 $list
4466 75A046 =1 1442 +1 MOV P2,#HIGH Y1
4469 7802 =1 1443 +1 MOV R0,#LOW Y1
446B 71C7 =1 1444 +1 call lhld1
=1 1446 ; dont allow data above top
446D C3 =1 1447 clr c
446E E582 =1 1448 mov a,dpl
4470 947F =1 1449 subb a,#low toplin
4472 E583 =1 1450 mov a,dph
4474 9402 =1 1451 subb a,#high toplin
4476 400A =1 1452 jc dataok
4478 900280 =1 1453 mov dptr,#640 ; stop at top
=1 1454 +1 shld y1
=1 1455 +1 $nolist
=1 1468 +1 $list
447B 75A046 =1 1469 +1 MOV P2,#HIGH y1
447E 7802 =1 1470 +1 MOV R0,#LOW y1
4480 7191 =1 1471 +1 call shld1
FFT PAGE 14
4482 91BD =1 1473 dataok: acall line ; draw it
4484 91C8 =1 1474 acall savit
=1 1475 +1 lhld sampl
=1 1476 +1 $nolist
=1 1490 +1 $list
4486 75A046 =1 1491 +1 MOV P2,#HIGH sampl
4489 780A =1 1492 +1 MOV R0,#LOW sampl
448B 71C7 =1 1493 +1 call lhld1
448D A3 =1 1495 inc dptr ; next sample
=1 1496 +1 shld sampl
=1 1497 +1 $nolist
=1 1510 +1 $list
448E 75A046 =1 1511 +1 MOV P2,#HIGH sampl
4491 780A =1 1512 +1 MOV R0,#LOW sampl
4493 7191 =1 1513 +1 call shld1
4495 E582 =1 1515 mov a,dpl
4497 4583 =1 1516 orl a,dph ; done ?
4499 6003 =1 1517 jz alldone
449B 024426 =1 1518 ljmp plotr
=1 1519 ;========================================
449E =1 1520 alldone:
449E 22 =1 1521 ret
=1 1522
=1 1523
=2 1524 $include(d:\8051\plot.asm)
0060 =2 1525 yl equ 96
0020 =2 1526 yh equ 32
0040 =2 1527 xl equ 64
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -