home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / graphics / basplot.lbr / SDUMP.BZS / SDUMP.BAS
Encoding:
BASIC Source File  |  1991-06-25  |  2.8 KB  |  34 lines

  1. 1000 STATP%=241:DATP%=240:' status and data ports for the graphics card
  2. 1010 GOSUB 1190:PRINT"                    <<<  LOAD or DUMP GRAPHICS SCREEN  >>>":PRINT:PRINT:PRINT
  3. 1020 PRINT"Purpose:":PRINT:PRINT"     To save the screen graphics into a data file or to restore the screen"
  4. 1030 PRINT"     graphics from data file":PRINT:PRINT:PRINT"Method:":PRINT
  5. 1040 PRINT"     Each pixel on the graphics screen represent one bit of data.  On the"
  6. 1050 PRINT"     512x490 pixel screen that is 31,360 bytes of data.  The reading of the"
  7. 1060 PRINT"     graphics screen is done byte-wise by issuing command to read from the"
  8. 1070 PRINT"     screen memory.":FOR I%=1 TO 6:PRINT:NEXT:INPUT"Press ENTER to continue. ",A$
  9. 1080 M%=22:N%=1:GOSUB 1200:INPUT"Load or dump the graphics screen? (L/D) ",A$:IF A$<>"L" AND A$<>"D" THEN 1080
  10. 1090 IF A$="L" THEN LD%=1 ELSE LD%=0:' set the flag, load=1 dump=0
  11. 1100 GOSUB 1190:FOR I%=1 TO 10:PRINT:NEXT:PRINT"     Type the filename in UPPER case.  No check on file existence or"
  12. 1110 PRINT"     legality is provided.  Drive letter and colon can be included."
  13. 1120 GOSUB 1200:LINE INPUT"Filename: ",A$:IF A$="" THEN 1130 ELSE 1150
  14. 1130 GOSUB 1200:INPUT"Exit this program? (Y/N) ",A$:IF A$<>"Y" AND A$<>"N" THEN 1130
  15. 1140 IF A$="N" THEN 1000 ELSE END
  16. 1150 F$=A$:FL%=1:GOSUB 1240:IF LD%=1 THEN 1160 ELSE 1170
  17. 1160 BT%=165:GOSUB 1270:FOR I%=1 TO 30912:GET#1,I%:BT%=ASC(R$):GOSUB 1270:NEXT:CLOSE:GOSUB 1310:GOTO 1130
  18. 1170 BT%=164:GOSUB 1270:FOR I%=1 TO 30912:GOSUB 1280:LSET R$=CHR$(BT%):PUT#1,I%:NEXT:CLOSE:GOSUB 1310:GOTO 1130
  19. 1180 ' Codes are for the Televideo terminal
  20. 1190 PRINT CHR$(27)CHR$(42):RETURN:' clear the whole screen
  21. 1200 GOSUB 1220:PRINT CHR$(27)CHR$(89):GOSUB 1220:RETURN:' clear to the end of screen from the current cursot position
  22. 1210 GOSUB 1220:PRINT CHR$(27)CHR$(84):GOSUB 1220:RETURN:' clear to the end of line from the current cursot position
  23. 1220 PRINT CHR$(27)CHR$(61)CHR$(M%+31)CHR$(N%+31);:RETURN:' direct cursor address (set the cursor position)
  24. 1230 ' Subroutine to open a data file for random access, F$=filename, FL%=rec length
  25. 1240 OPEN"R",#1,F$,FL%:FIELD#1,FL% AS R$:RETURN
  26. 1250 ' Subroutines to send data to the GDC-512 board
  27. 1260 BT%=INT(WD%/256):GOSUB 1270:BT%=(WD% AND 255):GOSUB 1270:RETURN:' Subroutine to output a 16-bit data
  28. 1270 IF (INP(STATP%) AND 1)>0 THEN 1270 ELSE OUT(DATP%),(BT% AND 255):RETURN:' Subroutine to output a 8-bit data
  29. 1280 IF (INP(STATP%) AND 2)=0 THEN 1280 ELSE BT%=INP(DATP%):RETURN:' Subroutine to read a 8-bit data
  30. 1290 GOSUB 1280:WD%=BT%*256:GOSUB 1280:WD%=WD%+BT%:RETURN:' Subroutine to read a 16-bit data
  31. 1300 ' Subroutine to reset the GDC512 but not to clear the graphics
  32. 1310 OUT(STATP%),1:OUT(STATP%),0:RETURN
  33. 1320 END
  34.