Вы находитесь на странице: 1из 34

PROGRAMA CALCULADOR DE RMS

DECLARE SUB sinewave () DECLARE SUB squarewave () DECLARE SUB sawtoothwave () DIM SHARED waveType AS INTEGER DIM SHARED outputFile AS INTEGER DIM SHARED pi AS SINGLE pi = 3.141593 DIM SHARED A AS SINGLE DIM SHARED B AS SINGLE DIM SHARED D AS SINGLE DIM SHARED E AS SINGLE DIM SHARED F AS SINGLE DIM SHARED K AS SINGLE DIM SHARED X AS SINGLE DIM SHARED arccosX AS SINGLE DIM SHARED average AS SINGLE DIM SHARED totalRMS AS SINGLE DIM SHARED acRMS AS SINGLE DIM SHARED rectAve AS SINGLE DIM SHARED acRectAve AS SINGLE DIM SHARED acRctAveCF AS SINGLE SCREEN 12 CLS 10 PRINT "Enter the type of waveform you want to analyze." PRINT "1 for sine wave, 2 for square wave, " INPUT "3 for sawtooth/triangle wave, 4 to end program."; waveType IF waveType = 4 THEN SYSTEM PRINT " " CLOSE INPUT "Enter 1 if you want to save the output to a file called RMSOUT.TXT"; outputFile PRINT " " IF outputFile = 1 THEN OPEN "RMSout.txt" FOR APPEND AS #1 END IF IF waveType = 1 THEN CALL sinewave ELSEIF waveType = 2 THEN CALL squarewave ELSEIF waveType = 3 THEN CALL sawtoothwave ELSE GOTO 10 END IF PRINT "Average Voltage ="; average PRINT "Total RMS Voltage ="; totalRMS PRINT "AC RMS Voltage ="; acRMS PRINT "Rectified Average Voltage ="; rectAve PRINT "AC Rectified Average Voltage ="; acRectAve PRINT "AC Rectified Average times 1.110721 (AC voltmeter reading) ="; acRctAveCF PRINT " " PRINT " " IF outputFile = 1 THEN PRINT #1, "Average Voltage ="; average PRINT #1, "Total RMS Voltage ="; totalRMS PRINT #1, "AC RMS Voltage ="; acRMS PRINT #1, "Rectified Average Voltage ="; rectAve PRINT #1, "AC Rectified Average Voltage ="; acRectAve PRINT #1, "AC Rectified Average times 1.110721 (AC voltmeter reading) ="; acRctAveCF PRINT #1, " " PRINT #1, " " END IF

CLOSE GOTO 10 SUB sawtoothwave 100 INPUT "enter A, (the upper peak voltage)"; A INPUT "enter B, (the lower peak voltage)"; B PRINT " " IF A < B THEN PRINT "A must be greater than or equal to B." GOTO 100 END IF average = (A + B) / 2 totalRMS = SQR((A ^ 2 + A * B + B ^ 2) / 3) E = A - average F = B - average acRMS = E / SQR(3) IF B > 0 OR B = 0 THEN rectAve = average ELSEIF A < 0 OR A = 0 THEN rectAve = -average ELSE rectAve = (A ^ 2 + B ^ 2) / (2 * A - 2 * B) END IF acRectAve = E / 2 acRctAveCF = acRectAve * 1.110721# PRINT "Sawtooth/Triangle Wave" PRINT "Upper Peak Voltage A ="; A PRINT "Lower Peak Voltage B ="; B IF outputFile = 1 THEN PRINT #1, "Sawtooth/Triangle Wave" PRINT #1, "Upper Peak Voltage A ="; A PRINT #1, "Lower Peak Voltage B ="; B END IF END SUB SUB sinewave 200 INPUT "enter A, (the upper peak voltage)"; A INPUT "enter B, (the lower peak voltage)"; B PRINT " " IF A < B THEN PRINT "A must be greater than or equal to B." GOTO 200 END IF average = (A + B) / 2 totalRMS = SQR((((A - B) ^ 2) / 8) + (((A + B) ^ 2) / 4)) E = A - average F = B - average acRMS = E / SQR(2) IF B > 0 OR B = 0 THEN rectAve = average ELSEIF A < 0 OR A = 0 THEN rectAve = -average ELSE X = (B + A) / (B - A) IF X = 1 THEN arccosX = 0 ELSE arccosX = ATN(-X / SQR(1 - X ^ 2)) + pi / 2 END IF K = (1 / pi) * arccosX rectAve = (((A - B) / pi) * SIN(K * pi)) + K * (A + B) - ((A + B) / 2) END IF acRectAve = (2 * E) / pi acRctAveCF = acRectAve * 1.110721# PRINT "Sine Wave"

PRINT "Upper Peak Voltage PRINT "Lower Peak Voltage IF outputFile = 1 THEN PRINT #1, "Sine Wave" PRINT #1, "Upper Peak PRINT #1, "Lower Peak END IF END SUB

A ="; A B ="; B Voltage A ="; A Voltage B ="; B

SUB squarewave 300 INPUT "enter A, (the upper peak voltage)"; A INPUT "enter B, (the lower peak voltage)"; B PRINT " " IF A < B THEN PRINT "A must be greater than or equal to B." GOTO 300 END IF 310 PRINT "enter D, (the duty cycle of the square wave)" PRINT "The duty cycle D is the fraction of a period" PRINT "during which the wave remains at A." INPUT "Therefore D can be from 0 to 1"; D PRINT " " IF D > 1 GOTO 310 IF D < 0 GOTO 310 average = A * D + B - B * D totalRMS = SQR(((A ^ 2) * D) + (B ^ 2) - ((B ^ 2) * D)) E = A - average F = B - average acRMS = SQR(((E ^ 2) * D) + (F ^ 2) - ((F ^ 2) * D)) IF B > 0 OR B = 0 THEN rectAve = average ELSEIF A < 0 OR A = 0 THEN rectAve = -average ELSE rectAve = A * D - B + B * D END IF acRectAve = E * D - F + F * D acRctAveCF = acRectAve * 1.110721# PRINT "Square Wave" PRINT "Upper Peak Voltage A ="; A PRINT "Lower Peak Voltage B ="; B PRINT "Duty Cycle is"; D * 100; "%" IF outputFile = 1 THEN PRINT #1, "Square Wave" PRINT #1, "Upper Peak Voltage A ="; A PRINT #1, "Lower Peak Voltage B ="; B PRINT #1, "Duty Cycle is"; D * 100; "%" END IF END SUB

REM IgnCapCoil.bas written by Louis Dudzik Feb 12 '04

DECLARE SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) SCREEN 12 5 CLS 0 PRINT "This program analyzes a capacitor-driven ignition-coil-circuit. It is a" PRINT "special case of a general RLC series circuit. Specifically, the capacitor" PRINT "has an initial voltage on it, but there is no initial current in the circuit." PRINT "Given R, L, C, and the initial voltage on the capacitor, the program plots" PRINT "the current as a function of time, and the capacitor's voltage as a" PRINT "function of time." PRINT " The program first determines the damping of the circuit. It can be" PRINT "underdamped, overdamped, or critically damped. Depending on the " PRINT "damping, the program selects the appropriate equations to use." PRINT "The current is plotted as a thin, solid line." PRINT "The capacitor voltage is plotted as a dotted line." PRINT "The X axis is time in seconds." PRINT "The Y axis is both current in Amps and voltage in Volts." PRINT " Note: there is no checking of out-of-range variables, so overflow" PRINT "errors may result if input values are not selected carefully." PRINT "Printing: This progam can generate a bitmap file of the screen. The files" PRINT "will appear in the same folder as this program file resides. If it will be " PRINT "printed out, it is recommended the file be opened in MSPaint and edited." PRINT "If converting to black and white, first save as 24bit BMP then " PRINT "invert colors and convert to black and white. It's all done in MSPaint." PRINT " Seven different time scales can be chosen from." PRINT "0 to .001 sec." PRINT "0 to .01 sec." PRINT "0 to .1 sec." PRINT "0 to 1 sec." PRINT "0 to 10 sec." PRINT "0 to 100 sec." PRINT "0 to 1000 sec." INPUT "Enter the number of seconds for the x axis (default is .1)"; tScale REM "tScale" is the range of the x axis in seconds IF tScale < 0 THEN GOTO 5 IF tScale = 0 THEN REM default case tScale = .1 GOTO 8 END IF IF tScale < .0011 THEN tScale = .001 GOTO 8 END IF IF tScale < .011 THEN tScale = .01 GOTO 8 END IF IF tScale < .11 THEN tScale = .1 GOTO 8 END IF IF tScale < 1.1 THEN tScale = 1 GOTO 8

END IF IF tScale < 11 THEN tScale = 10 GOTO 8 END IF IF tScale < 110 THEN tScale = 100 GOTO 8 END IF tScale = 1000 8 CLS 0 REM the graphics port is set to leave room to the left and bottom for scale indicators REM Vertically, 0-368 gives 23 spaces, but 1/2 is wasted on top and 1/2 is wasted on bottom REM to leave room for the scale numbers so the center of the number lines up with the graph lines. REM The graph is broken into 22 useable spaces vertically with a 1/2 unused on top, REM and 1/2 unused on bottom for a total of 23, and the scale gets 22 numbers. REM It has to be that way in order for the vertical scale numbers to line up. REM Vertically, one line of text takes 16 vertical pixels. 368/23 = 16 REM if more vertical space is needed at the bottom for text, the graph loses 16 pixels per line. VIEW (39, 0)-(639, 368) REM graphics port scale will be 0 to "tScale" seconds by -7 to +15 amps/volts. REM (15.5 and -7.5 in order to center the scale with the scale numbers) REM tScale is either .001, .01, .1, 1, 10, 100, or 1000. WINDOW (0, 15.5)-(tScale, -7.5) REM show the scale numbers of the y axis as 15 to -7 REM note: using "PRINT USING" command to force the formatting. REM without it, extra spaces get printed. LOCATE 1, 1 FOR y = 15 TO -7 STEP -1 PRINT USING "####"; y NEXT y REM print the x axis time-scale values LOCATE 24, 1 IF tScale = .001 THEN PRINT " 0sec .0001 .0002 .0003 .0004 .0005 .0006 .0007 .0008 .0009 .001" IF tScale = .01 THEN PRINT " 0sec .001 .002 .003 .004 .005 .006 .007 .008 .009 .01" IF tScale = .1 THEN PRINT " 0sec .01 .02 .03 .04 .05 .06 .07 .08 .09 .1" IF tScale = 1 THEN PRINT " 0sec .1 .2 .3 .4 .5 .6 .7 .8 .9 1" IF tScale = 10 THEN PRINT " 0sec 1 2 3 4 5 6 7 8 9 10" IF tScale = 100 THEN PRINT " 0sec 10 20 30 40 50 60 70 80 90 100" IF tScale = 1000 THEN PRINT " 0sec 100 200 300 400 500 600 700 800 900 1000" 10 VIEW PRINT 25 TO 30 CLS CLS 2

REM -------------Sets up the graph underlay----------------------------------------------------COLOR 8 FOR y = -7 TO 15 LINE (0, y)-(tScale, y) NEXT y FOR x = 0 TO tScale + tScale / 100 STEP tScale / 100 REM The x loop goes to "tScale + tScale/100" to put one extra step in the loop. REM Due to rounding errors, the last step in the loop was not being performed. REM This is because the STEP calculation was not exactly tScale /100 LINE (x, -7)-(x, 15) NEXT x COLOR 15 LINE (0, 15)-(0, -7) LINE (0, 0)-(tScale, 0) LINE (0, -23 / 368)-(tScale, -23 / 368) FOR x = 0 TO tScale + tScale / 10 STEP tScale / 10 REM one extra step is put into the loop. see rem notes above. LINE (x, -7)-(x, 15) LINE (x + tScale / 600, -7)-(x + tScale / 600, 15) NEXT x REM-------------------------------------------------------------------------------------------REM This initializes the color for the plot. REM each successive plot changes color. GrphColor = 8

REM command section-----------------------------------------------------------------------------20 VIEW PRINT 27 TO 30 LOCATE 28, 1 COLOR 15 PRINT "Enter 475 to generate a bitmap (BMP) of the screen." PRINT "Enter 1 to clear screen. 2 to exit. Enter 3 to change time scale (start)." INPUT "Or just enter 0 to continue."; command% CLS 2 IF command% = 2 THEN SYSTEM IF command% = 1 THEN GOTO 10 IF command% = 3 THEN REM this next line is needed to expand the text port before starting over VIEW PRINT 1 TO 30 GOTO 5 END IF IF command% = 475 THEN 'this increments a new bitmap name-number every time a bitmap is generated (up to 9999) BMPnumber% = BMPnumber% + 1 'this makes the new bitmap name based on the new number BMPname$ = "IGCC" + STR$(BMPnumber%) PRINT "A bitmap of this screen called "; BMPname$; ".BMP is being generated. Please wait. " 'the previously set VIEW and WINDOW commands have to be cleared for the sub to work. VIEW WINDOW FourBIT 0, 0, 639, 479, BMPname$ 'must now reinstate the VIEW and WINDOW VIEW (39, 0)-(639, 368) WINDOW (0, 15.5)-(tScale, -7.5) CLS 2

PRINT "Image file "; BMPname$; " is saved in the folder in which this program resides." GOTO 20 END IF REM---------------------------------------------------------------------

REM input section-------------------------------------------------------------------------------REM all equation variables should be double-length floating point. They end in # INPUT "Enter DC resistance of coil (plus ballast if any) in Ohms "; R# INPUT "Enter the inductance of the coil in milli-Henrys "; ML# REM convert to henrys L# = ML# / 1000 INPUT "Enter the capacitance of the capacitor in Farads "; C# INPUT "Enter the initial voltage on the capacitor in Volts "; V# REM --------------------------------------------------------------------------------------------

REM clear text window CLS 2 REM Redraw X axis LINE (0, 0)-(tScale, 0) REM change plot color for new plot GrphColor = GrphColor + 1 IF GrphColor = 15 THEN GrphColor = 9 COLOR GrphColor VIEW PRINT 25 TO 27 CLS 2 PRINT "The line plot is current. The dotted plot is capacitor voltage." REM reprint input values in same color REM to print neatly, they should be converted to single length. They end in ! R! = R# ML! = ML# C! = C# V! = V# PRINT R!; "ohms "; ML!; "mHenrys "; C!; "farads "; V!; "volts "; REM determine damping type alpha# = R# / (2 * L#) alphaSQ# = alpha# ^ 2 omegaSQ# = 1 / (L# * C#) IF omegaSQ# < alphaSQ# THEN GOTO 100 IF omegaSQ# > alphaSQ# THEN GOTO 200 IF omegaSQ# = alphaSQ# THEN GOTO 300 GOTO 20

100 REM---------------------------------------overdamp-----------------------------------PRINT " Overdamped."

s1# = -1 * alpha# + SQR(alphaSQ# - omegaSQ#) s2# = -1 * alpha# - SQR(alphaSQ# - omegaSQ#) a1# = V# / (L# * (s2# - s1#)) a2# = (-1 * V#) / (L# * (s2# - s1#)) REM move current graphic cursor to origin PSET (0, 0) REM plot i(t) (solid line) REM t is in seconds FOR t = 0 TO tScale STEP tScale / 620 i# = a1# * (EXP(s1# * t)) + a2# * (EXP(s2# * t)) i# = -1 * i# LINE STEP(0, 0)-(t, i#) NEXT t REM plot capacitor v(t) dotted line FOR t = 0 TO tScale STEP tScale / 6200 vc# = -1 * R# * a1# * (EXP(s1# * t)) - R# * a2# * (EXP(s2# * t)) - L# * s1# * a1# * (EXP(s1# * t)) - L# * s2# * a2# * (EXP(s2# * t)) REM This checks for distance between points on the plot. It skips the point if the previous point was too close. IF ABS(vcPrevious# - vc#) < .25 AND ABS(t - tPrevious) < tScale / 130 THEN GOTO 110 REM draw a circle and fill it radius = tScale / 600 CIRCLE (t, vc#), radius PAINT (t, vc#) REM save coordinates of plotted point vcPrevious# = vc# tPrevious = t 110 NEXT t GOTO 20

200 REM-----------------------------------underdamp--------------------------------------PRINT " Underdamped." omegaD# = SQR(omegaSQ# - alphaSQ#) b2# = -1 * V# / (L# * omegaD#) REM move current graphic cursor to origin PSET (0, 0) REM plot i(t) (solid line) REM t is in seconds FOR t = 0 TO tScale STEP tScale / 620 i# = b2# * EXP(-1 * alpha# * t) * SIN(omegaD# * t) i# = -1 * i# LINE STEP(0, 0)-(t, i#)

NEXT t REM plot capacitor v(t) dotted line FOR t = 0 TO tScale STEP tScale / 6200 vc# = -1 * L# * omegaD# * b2# * (EXP(-1 * alpha# * t)) * COS(omegaD# * t) + L# * alpha# * b2# * (EXP(-1 * alpha# * t)) * SIN(omegaD# * t) - R# * b2# * (EXP(-1 * alpha# * t)) * SIN(omegaD# * t) REM This checks for distance between points on the plot. It skips the point if the previous point was too close. IF ABS(vcPrevious# - vc#) < .25 AND ABS(t - tPrevious) < tScale / 130 THEN GOTO 210 REM draw a circle and fill it radius = tScale / 600 CIRCLE (t, vc#), radius PAINT (t, vc#) REM save coordinates of plotted point vcPrevious# = vc# tPrevious = t 210 NEXT t GOTO 20

300 REM-----------------------------------------critically damp--------------------------------PRINT " Critically damped." d1# = -1 * V# / L# REM move current graphic cursor to origin PSET (0, 0) REM plot i(t) (solid line) REM t is in seconds FOR t = 0 TO tScale STEP tScale / 620 i# = d1# * t * EXP(-1 * alpha# * t) i# = -1 * i# LINE STEP(0, 0)-(t, i#) NEXT t REM plot capacitor v(t) dotted line FOR t = 0 TO tScale STEP tScale / 6200 vc# = -1 * L# * d1# * (EXP(-1 * alpha# * t)) + alpha# * L# * d1# * t * (EXP(-1 * alpha# * t)) - R# * d1# * t * (EXP(-1 * alpha# * t)) REM This checks for distance between points on the plot. It skips the point if the previous point was too close. IF ABS(vcPrevious# - vc#) < .25 AND ABS(t - tPrevious) < tScale / 130 THEN GOTO 310 REM draw a circle and fill it radius = tScale / 600 CIRCLE (t, vc#), radius PAINT (t, vc#)

REM save coordinates of plotted point vcPrevious# = vc# tPrevious = t 310 NEXT t GOTO 20 '------------------------this is the screen 12 bitmap generator--------------SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM FileCOLORS%(1 TO 48) DIM Colors4%(15) IF INSTR(FileNAME$, ".BMP") = 0 THEN FileNAME$ = RTRIM$(LEFT$(FileNAME$, 8)) + ".BMP" END IF FOR x = x1% TO x2% FOR y = y1% TO y2% Colors4%(POINT(x, y)) = 1 NEXT y NEXT x FOR n = 0 TO 15 IF Colors4%(n) = 1 THEN SigCOLORS& = SigCOLORS& + 1 NEXT n FileTYPE$ = "BM" Reserved1% = 0 Reserved2% = 0 OffsetBITS& = 118 InfoHEADER& = 40 PictureWIDTH& = x2% - x1% + 1 PictureDEPTH& = y2% - y1% + 1 NumPLANES% = 1 BPP% = 4 Compression& = 0 WidthPELS& = 3780 DepthPELS& = 3780 NumCOLORS& = 16 IF PictureWIDTH& MOD 8 <> 0 THEN ZeroPAD$ = SPACE$((8 - PictureWIDTH& MOD 8) \ 2) END IF ImageSIZE& = (((ImageWIDTH& + LEN(ZeroPAD$)) * ImageDEPTH&) + .1) / 2 FileSIZE& = ImageSIZE& + OffsetBITS& Colr = 0 FOR n = 1 TO 48 STEP 3 OUT &H3C7, Colr FileCOLORS%(n) = INP(&H3C9) FileCOLORS%(n + 1) = INP(&H3C9) FileCOLORS%(n + 2) = INP(&H3C9) Colr = Colr + 1 NEXT n OPEN FileNAME$ FOR BINARY AS #1 PUT PUT PUT PUT PUT PUT PUT #1, #1, #1, #1, #1, #1, #1, , , , , , , , FileTYPE$ FileSIZE& Reserved1% 'should be zero Reserved2% 'should be zero OffsetBITS& InfoHEADER& PictureWIDTH&

PUT PUT PUT PUT PUT PUT PUT PUT PUT

#1, #1, #1, #1, #1, #1, #1, #1, #1,

, , , , , , , , ,

PictureDEPTH& NumPLANES% BPP% Compression& ImageSIZE& WidthPELS& DepthPELS& NumCOLORS& SigCOLORS&

u$ = " " FOR n% = 1 TO 46 STEP 3 Colr$ = CHR$(FileCOLORS%(n% + 2) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n% + 1) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n%) * 4) PUT #1, , Colr$ PUT #1, , u$ 'Unused byte NEXT n% FOR y = y2% TO y1% STEP -1 FOR x = x1% TO x2% STEP 2 HiX = POINT(x, y) LoX = POINT(x + 1, y) HiNIBBLE$ = HEX$(HiX) LoNIBBLE$ = HEX$(LoX) HexVAL$ = "&H" + HiNIBBLE$ + LoNIBBLE$ a$ = CHR$(VAL(HexVAL$)) PUT #1, , a$ NEXT x PUT #1, , ZeroPAD$ NEXT y CLOSE #1 END SUB

'This program is built from RLseries.BAS. DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE DECLARE

10-18-10

SUB Intro () SUB SetTscale () SUB SetVscale () SUB DrawScreen () SUB DrawGrid () SUB PrintVar () SUB Charge () 'Plots charging function SUB Discharge () 'Plots discharging function FUNCTION CheckRange# (y#) FUNCTION subtract# (aaa#, bbb#) SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$)

DIM SHARED Fault AS INTEGER 'This holds a fault code DIM SHARED StyleHex 'This holds the alternating style pattern to create the dotted plot. DIM SHARED tScale AS DOUBLE 'tScale is the range of the x axis in seconds. DIM SHARED vMax AS DOUBLE 'vMax is the max of the y axis in volts and amps. DIM SHARED vMin AS DOUBLE 'vMin is the min of the y axis in volts and amps. DIM SHARED GrphColor AS INTEGER 'Holds the color to be used for each plot. The color value increments for each successive plot. DIM SHARED CharOrDis AS STRING 'this holds whether the circuit is charging or discharging DIM SHARED R AS DOUBLE 'resistance in ohms DIM SHARED L AS DOUBLE 'inductance in Henrys DIM SHARED V AS DOUBLE 'initial voltage on the capacitor DIM SHARED Rs AS SINGLE 'resistance in ohms used for display DIM SHARED Ls AS SINGLE 'inductance in Henrys used for display DIM SHARED Vs AS SINGLE 'initial voltage on the capacitor used for display DIM SHARED Isat AS SINGLE 'This is the saturation current based on V and R SCREEN 12 CLS 0 'Clears everything Intro CLS 0 'Clears everything '----------This initializes the variables.-----------tScale = .1 REM vMax = 15.5 not used REM vMin = -7.5 not used R = 2.6 L = .0063 V = 13 REM CharOrDis = "Charging" not used GrphColor = 8 'This initializes the color for the plot. Each successive plot changes color. '---------------------------------------------------DrawScreen 'Setup the graphics port and print the graph scales. DrawGrid COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar REM command section-----------------------------------------------------------------------------DO COLOR 15 VIEW PRINT 28 TO 30 CLS 2 PRINT "Enter 1 to clear. 2 exit. 475 to generate a bitmap (BMP)." REM PRINT "3 time scale. 4 vertical scale. 5 charge. 6 discharge. Or hit enter to plot." not used. PRINT "3 change time scale. Or hit enter to plot." INPUT "Or the variable name (r, l, v) to be changed."; Comand$ 'Mispelled Comand$ intentionally beause COMMAND$ is recognized by Qbasic as a "special feature"

CLS 2 IF Comand$ = "2" THEN SYSTEM ELSEIF Comand$ = "1" THEN CLS 0 DrawScreen DrawGrid COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar ELSEIF Comand$ = "475" THEN 'this increments a new bitmap name-number every time a bitmap is generated (up to 9999) BMPnumber% = BMPnumber% + 1 'this makes the new bitmap name based on the new number BMPname$ = "IGcoil" + LTRIM$(STR$(BMPnumber%)) PRINT "A bitmap of this screen called "; BMPname$; ".BMP is being generated. Please wait. " 'the previously set VIEW and WINDOW commands have to be cleared for the sub to work. VIEW WINDOW FourBIT 0, 0, 639, 479, BMPname$ 'must now reinstate the VIEW and WINDOW DrawScreen VIEW PRINT 28 TO 30 CLS 2 LOCATE 29, 1 PRINT "Image file "; BMPname$; " is saved in the folder in which this program resides." INPUT "Enter to continue"; Continue ELSEIF Comand$ = "3" THEN VIEW PRINT 1 TO 30 'needed to expand the text port CLS 2 SetTscale CLS 0 DrawScreen DrawGrid COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar 'ELSEIF Comand$ = "4" THEN ' VIEW PRINT 1 TO 30 'needed to expand the text port ' CLS 2 ' SetVscale ' CLS 0 ' DrawScreen ' DrawGrid ' COLOR 7 ' VIEW PRINT 25 TO 30 ' CLS 2 ' PrintVar 'ELSEIF Comand$ = "5" THEN 'set to charging ' CharOrDis = "Charging" ' COLOR 7 ' VIEW PRINT 25 TO 30 ' CLS 2 ' PrintVar 'ELSEIF Comand$ = "6" THEN 'set to discharging ' CharOrDis = "Discharging" ' COLOR 7 ' VIEW PRINT 25 TO 30 ' CLS 2 ' PrintVar ELSEIF Comand$ = "r" THEN DO

INPUT "Enter resistance of the coil primary in Ohms "; R IF R < .001# OR R > 1000000000# THEN PRINT "Enter .001 to 1,000,000,000" LOOP WHILE R < .001# OR R > 1000000000# COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar ELSEIF Comand$ = "l" THEN DO INPUT "Enter the inductance of the coil primary in Henrys "; L IF L < .0000000000001# OR L > 1000# THEN PRINT "Enter .0000000000001 to 1000" LOOP WHILE L < .0000000000001# OR L > 1000# COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar ELSEIF Comand$ = "v" THEN DO INPUT "Enter the applied voltage in Volts "; V IF V < -100000000# OR V > 100000000# THEN PRINT "Enter -100,000,000 to 100,000,000" LOOP WHILE V < -100000000# OR V > 100000000# COLOR 7 VIEW PRINT 25 TO 30 CLS 2 PrintVar ELSEIF Comand$ = "" THEN 'plot 'CLS 2 LINE (0, 0)-(tScale, 0) 'Redraw X axis GrphColor = GrphColor + 1 'change plot color for new plot IF GrphColor = 15 THEN GrphColor = 9 COLOR GrphColor VIEW PRINT 11 TO 24 LOCATE 23 PrintVar PRINT " " REM IF CharOrDis = "Charging" THEN Charge not used REM IF CharOrDis = "Discharging" THEN Discharge not used Charge END IF LOOP REM command section-------------------------------------------------------------------SUB DIM DIM DIM DIM tau Charge '--------------------- Charge--------------------------t AS DOUBLE i AS DOUBLE vl AS DOUBLE tau AS DOUBLE = L / R

REM plot i(t) (solid line) REM t is in seconds FOR t = 0 TO tScale STEP tScale / 600# IF -1# * t / tau > 709 THEN Fault = 1 'EXP function can't take an input higher than about 709 IF Fault = 1 THEN PRINT "Combination of inputs out of Range. Cannot continue plot." Fault = 0 EXIT SUB END IF i = (V / R) - (V / R) * EXP(-1# * t / tau) i = CheckRange(i) 'Checks to see if i is far off scale. Alters it if necessary. IF t = 0 THEN PSET (t, i) 'This sets the graphic cursor to the first point. LINE STEP(0, 0)-(t, i)

NEXT t 'REM plot inductor v(t) dotted line 'StyleHex = &HAAAA 'This initializes the style option. Each style has every other pixel blank. This style starts with a color pixel, 'then will alternate for each plot, between starting with blank pixel to starting with color pixel. 'FOR t = 0 TO tScale STEP tScale / 600# 'IF -1# * t / tau > 709 THEN Fault = 1 'EXP function can't take an input higher than about 709 'IF Fault = 1 THEN ' PRINT "Combination of inputs out of Range. Cannot continue plot." ' Fault = 0 ' EXIT SUB 'END IF 'vl = V * EXP(-1# * t / tau) 'vl = CheckRange(vl) 'Checks to see if v is far off scale. Alters it if necessary. 'IF t = 0 THEN PSET (t, vl) 'This sets the graphic cursor to the first point. 'LINE STEP(0, 0)-(t, vl), , , StyleHex 'The commas separate the non-used optons to designate the "style" option. The 16bit hex 'number is a pixel pattern. The style alternates from starting with a color pixel to starting with a blank pixel so consecutive 1-pixel 'lines will still be dotted. 'IF StyleHex = &HAAAA THEN 'This if statement flip flops the stylehex from AAAA to 5555 and vice versa. ' StyleHex = &H5555 'ELSE ' StyleHex = &HAAAA 'END IF 'NEXT t END SUB '---------------------------Charge---------------------------------------FUNCTION CheckRange# (y#) '----------------------------------CheckRange------------'This function is to avoid the glitch in Qbasic which plots errantly ("wrapping around") if the plotting points are very far off scale. 'This function checks the y value to be plotted and alters it if it's very far off the scale. 'If it's over 3 times the scale, it will be set to three times the scale range. If it's less than 3 times the scale it will not be altered. '(The negative side only has half the range of the positive side, so 6 is the multiplier for the negative side.) 'This is so the slope of the line will be straight up if the point is far off scale, and the slope will have proper slope if it's not far off scale. 'This will then make the slope appear correct. vMax = 8 vMin = -4 'Adding these limits for the ignition coil version.

IF y# > (3# * vMax) THEN y# = 3# * vMax ELSEIF y# < (6# * vMin) THEN y# = 6# * vMin END IF CheckRange# = y# END FUNCTION '----------------------------------------CheckRange--------------SUB DIM DIM DIM DIM tau Discharge '--------------------- Discharge---------------------------NOT USED t AS DOUBLE i AS DOUBLE vl AS DOUBLE tau AS DOUBLE = L / R

REM plot i(t) (solid line) REM t is in seconds FOR t = 0 TO tScale STEP tScale / 600#

IF -1# * t / tau > 709 THEN Fault = 1 'EXP function can't take an input higher than about 709 IF Fault = 1 THEN PRINT "Combination of inputs out of Range. Cannot continue plot." Fault = 0 EXIT SUB END IF i = (-1# * V / R) * EXP(-1# * t / tau) i = -1# * i 'Due to the passive sign convention, the current will come out negative, but for convenience will be plotted as positive. i = CheckRange(i) 'Checks to see if i is far off scale. Alters it if necessary. IF t = 0 THEN PSET (t, i) 'This sets the graphic cursor to the first point. LINE STEP(0, 0)-(t, i) NEXT t REM plot inductor v(t) dotted line StyleHex = &HAAAA 'This initializes the style option. Each style has every other pixel blank. This style starts with a color pixel, then will alternate for each plot, between starting with blank pixel to starting with color pixel. FOR t = 0 TO tScale STEP tScale / 600# IF -1# * t / tau > 709 THEN Fault = 1 'EXP function can't take an input higher than about 709 IF Fault = 1 THEN PRINT "Combination of inputs out of Range. Cannot continue plot." Fault = 0 EXIT SUB END IF vl = V * EXP(-1# * t / tau) vl = CheckRange(vl) 'Checks to see if i is far off scale. Alters it if necessary. IF t = 0 THEN PSET (t, vl) 'This sets the graphic cursor to the first point. LINE STEP(0, 0)-(t, vl), , , StyleHex 'The commas separate the non-used optons to designate the "style" option. The 16bit hex number is a pixel pattern. The style alternates from starting with a color pixel to starting with a blank pixel so consecutive 1-pixel lines will still be dotted. IF StyleHex = &HAAAA THEN 'This if statement flip flops the stylehex from AAAA to 5555 and vice versa. StyleHex = &H5555 ELSE StyleHex = &HAAAA END IF NEXT t END SUB '---------------------------discharge---------------------------------------SUB DrawGrid '-------------DrawGrid----------------------------------------------------COLOR 8 'FOR y = vMax - vMax / 31 TO vMin + vMax / 31 STEP -(vMax / 15.5) 'LINE (0, y)-(tScale, y) 'draws horizontal gray lines 'NEXT y 'LINE (0, (vMax - vMin) / 368)-(tScale, (vMax - vMin) / 368) 'adds a gray line above the zero line 'LINE (0, (vMin - vMax) / 368)-(tScale, (vMin - vMax) / 368)'adds a gray line below the zero line FOR y = 8 TO 0 STEP -1 LINE (0, y)-(tScale, y) NEXT y 'draws horizontal gray lines

FOR x = 0 TO tScale + tScale / 100 STEP tScale / 100 'The x loop goes to "tScale + tScale/100" to put one extra step in the loop. 'Due to rounding errors, the last step in the loop was not being performed. 'This is because the STEP calculation was not exactly tScale /100

'LINE (x, vMin + vMax / 31)-(x, vMax - vMax / 31) vertical gray lines LINE (x, 0)-(x, 8) NEXT x COLOR 15 'LINE (0, vMax - vMax / 31)-(0, vMin + vMax / 31) zero line in white LINE (0, 0)-(0, 8)

'draws

'adds vertical

LINE (0, 0)-(tScale, 0) 'adds horizontal zero line in white FOR x = 0 TO tScale + tScale / 10 STEP tScale / 10 'One extra step is put into the loop. See notes above. 'LINE (x, vMin + vMax / 31)-(x, vMax - vMax / 31) 'draws vertical white lines LINE (x, 0)-(x, 8) 'LINE (x + tScale / 600, vMin + vMax / 31)-(x + tScale / 600,vMax - vMax / 31 ) 'draws extra vertical white lines to thicken the vertical white lines. Not used for now. NEXT x END SUB'-------------------DrawGrid------------------------------------------------------SUB DrawScreen '---------------------------DrawScreen---------------------------------'The graphics port is set to leave room to the left and bottom for scale indicators. 'Vertically, 0-368 gives 23 spaces, but 1/2 is wasted on top and 1/2 is wasted on bottom to leave room for the scale numbers so the center of the number lines up with the graph lines. 'The graph is broken into 22 useable spaces vertically with a 1/2 unused on top, and 1/2 unused on bottom for a total of 23, and the scale gets 22 numbers. 'It has to be that way in order for the vertical scale numbers to line up. 'Vertically, one line of text takes 16 vertical pixels. 368/23 = 16 . 'If more vertical space is needed at the bottom for text, the graph loses 16 pixels per line. REM not used VIEW (39, 0)-(639, 368) 'must be 601 by 369 (The View and Window commands are also reinstated after bitmap generator call.) VIEW (39, 0)-(639, 144) 'For ignition coils, must be 601 by 145.

'Graphics port scale will be 0 to "tScale" seconds by -7 to +15 amps/volts (multiplied ordivided by some factor of 10 and called vmax and vmin). '(15.5 and -7.5 in order to center the scale with the scale numbers) 'tScale is either .0001, .001, .01, .1, 1, 10, 100, 1000, or 10000. REM not using WINDOW (0, vMax)-(tScale, vMin) 'vMax/248 is one pixel, vMin/120 is one pixel. WINDOW (0, 8.5)-(tScale, -.5) 'For ignition coils, only using 0 to 8 amps

'Show the scale numbers of the y axis as 15 to -7 'note: using "PRINT USING" command to force the formatting. Without it, extra spaces get printed. VIEW PRINT 1 TO 30 LOCATE 1, 1 'FOR y = vMax - vMax / 31 TO vMin + vMax / 31 STEP -(vMax / 15.5) FOR y = 8 TO 0 STEP -1 PRINT USING "####"; y NEXT y 'IF vMax = .0155 THEN ' PRINT USING ".###"; ABS(y) 'ELSEIF vMax = .155 THEN ' PRINT USING "#.##"; y

'ELSEIF vMax = 1.55 THEN ' PRINT USING "#.##"; y 'ELSE ' PRINT USING "####"; y 'END IF 'NEXT y 'Print the x axis time-scale values LOCATE 10, 1 IF tScale = .0001 THEN PRINT " 0msec .01ms .02ms .03ms .04ms .05ms .06ms .07ms .08ms .09ms .1ms" IF tScale = .001 THEN PRINT " 0sec .0001 .0002 .0003 .0004 .0005 .0006 .0007 .0008 .0009 .001" IF tScale = .01 THEN PRINT " 0sec .001 .002 .003 .004 .005 .006 .007 .008 .009 .01" IF tScale = .1 THEN PRINT " 0sec .01 .02 .03 .04 .05 .06 .07 .08 .09 .1" IF tScale = 1 THEN PRINT " 0sec .1 .2 .3 .4 .5 .6 .7 .8 .9 1" IF tScale = 10 THEN PRINT " 0sec 1 2 3 4 5 6 7 8 9 10" IF tScale = 100 THEN PRINT " 0sec 10 20 30 40 50 60 70 80 90 100" IF tScale = 1000 THEN PRINT " 0sec 100 200 300 400 500 600 700 800 900 1000" IF tScale = 10000 THEN PRINT " 0sec 1k 2k 3k 4k 5k 6k 7k 8k 9k 10k" END SUB'--------------------------------------DrawScreen--------------------------------------'------------------------this is the screen 12 bitmap generator--------------SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM FileCOLORS%(1 TO 48) DIM Colors4%(15) IF INSTR(FileNAME$, ".BMP") = 0 THEN FileNAME$ = RTRIM$(LEFT$(FileNAME$, 8)) + ".BMP" END IF FOR x = x1% TO x2% FOR y = y1% TO y2% Colors4%(POINT(x, y)) = 1 NEXT y NEXT x FOR n = 0 TO 15 IF Colors4%(n) = 1 THEN SigCOLORS& = SigCOLORS& + 1 NEXT n FileTYPE$ = "BM" Reserved1% = 0 Reserved2% = 0 OffsetBITS& = 118 InfoHEADER& = 40 PictureWIDTH& = x2% - x1% + 1 PictureDEPTH& = y2% - y1% + 1 NumPLANES% = 1 BPP% = 4 Compression& = 0 WidthPELS& = 3780 DepthPELS& = 3780 NumCOLORS& = 16 IF PictureWIDTH& MOD 8 <> 0 THEN ZeroPAD$ = SPACE$((8 - PictureWIDTH& MOD 8) \ 2) END IF ImageSIZE& = (((ImageWIDTH& + LEN(ZeroPAD$)) * ImageDEPTH&) + .1) / 2 FileSIZE& = ImageSIZE& + OffsetBITS&

Colr = 0 FOR n = 1 TO 48 STEP 3 OUT &H3C7, Colr FileCOLORS%(n) = INP(&H3C9) FileCOLORS%(n + 1) = INP(&H3C9) FileCOLORS%(n + 2) = INP(&H3C9) Colr = Colr + 1 NEXT n OPEN FileNAME$ FOR BINARY AS #1 PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, , , , , , , , , , , , , , , , , FileTYPE$ FileSIZE& Reserved1% 'should be zero Reserved2% 'should be zero OffsetBITS& InfoHEADER& PictureWIDTH& PictureDEPTH& NumPLANES% BPP% Compression& ImageSIZE& WidthPELS& DepthPELS& NumCOLORS& SigCOLORS&

u$ = " " FOR n% = 1 TO 46 STEP 3 Colr$ = CHR$(FileCOLORS%(n% + 2) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n% + 1) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n%) * 4) PUT #1, , Colr$ PUT #1, , u$ 'Unused byte NEXT n% FOR y = y2% TO y1% STEP -1 FOR x = x1% TO x2% STEP 2 HiX = POINT(x, y) LoX = POINT(x + 1, y) HiNIBBLE$ = HEX$(HiX) LoNIBBLE$ = HEX$(LoX) HexVAL$ = "&H" + HiNIBBLE$ + LoNIBBLE$ a$ = CHR$(VAL(HexVAL$)) PUT #1, , a$ NEXT x PUT #1, , ZeroPAD$ NEXT y CLOSE #1 END SUB SUB Intro '----------------------Intro-------------------------------'PRINT "This program analyzes a resistor-inductor series circuit." 'PRINT "It can analyze the charging of the RL circuit in series with a voltage" 'PRINT "source, or analyze the discharging of the RL circuit without any sources" 'PRINT "connected." 'PRINT "Given R, L, and V, the program plots the current as a function of time," 'PRINT "and the inductor's voltage as a function of time." PRINT "This program plots the primary current of an idealized ignition coil." PRINT "The resistance, inductance, and applied voltage are the input values."

PRINT "Resistance is in ohms, inductance is in Henrys, voltage in volts." PRINT "The current is plotted as a thin, solid line." 'PRINT "The inductor voltage is plotted as a dotted line." PRINT "The X axis is time in seconds." 'PRINT "The Y axis is both current in amps and voltage in Volts." PRINT "The Y axis is current in amps." PRINT " Note: there is only some checking of out-of-range variables, so overflow" PRINT "errors may result if input values are not selected carefully." PRINT "Printing: This progam can generate a bitmap file of the screen. The files" PRINT "will be saved in the folder in which this program resides. If it will be " PRINT "printed out, it is recommended the file be opened in MSPaint and edited." PRINT "If converting to black and white, first save as 256 color or 24bit BMP then " PRINT "invert colors and convert to black and white. It's all done in MSPaint." INPUT "Enter to continue"; Continue END SUB'----------------------Intro---------------------------------SUB PrintVar '---------------------------PrintVar--------------'CLS 2 'PRINT "The line plot is current. The dotted plot is inductor voltage." '-------reprint input values in same color----------'to print neatly, they should be converted to single length. Rs = R Ls = L Vs = V Isat = Vs / Rs PRINT "R"; Rs; "ohms, L"; Ls; "henrys, V"; Vs; "volts, Isat"; Isat; "amps."

'PRINT "R"; Rs; "ohms L"; Ls; "henrys V"; Vs; "volts " ; 'IF CharOrDis = "Charging" THEN PRINT " Charging." 'IF CharOrDis = "Discharging" THEN PRINT " Discharging." END SUB '--------------------------------PrintVar---------------SUB SetTscale '----------------------------SetTscale------------------------------PRINT " Nine different time scales can be chosen from." PRINT "0 to .0001 sec." PRINT "0 to .001 sec." PRINT "0 to .01 sec." PRINT "0 to .1 sec." PRINT "0 to 1 sec." PRINT "0 to 10 sec." PRINT "0 to 100 sec." PRINT "0 to 1000 sec." PRINT "0 to 10,000 sec." DO INPUT "Enter the number of seconds for the x axis (default is .1)"; tScale LOOP WHILE tScale < 0 IF tScale = 0 THEN tScale = .1 'default case ELSEIF tScale < .00011 THEN tScale = .0001 ELSEIF tScale < .0011 THEN tScale = .001 ELSEIF tScale < .011 THEN tScale = .01 ELSEIF tScale < .11 THEN tScale = .1 ELSEIF tScale < 1.1 THEN tScale = 1 ELSEIF tScale < 11 THEN tScale = 10 ELSEIF tScale < 110 THEN tScale = 100 ELSEIF tScale < 1100 THEN tScale = 1000 ELSE tScale = 10000 END IF END SUB'----------------------------SetTscale------------------------------SUB SetVscale '----------------------------SetVscale-----------NOT USED------------------PRINT " Five different vertical scales can be chosen from."

PRINT "-.007 to +.015 volts and amps." PRINT "-.07 to +.15 volts and amps." PRINT "-.7 to +1.5 volts and amps." PRINT "-7 to +15 volts and amps." PRINT "-70 to +150 volts and amps." DO INPUT "Enter the max number for the y axis (default is 15)"; vMax LOOP WHILE vMax < 0 IF vMax = 0 THEN vMax = 15.5 'default casefx vMin = -7.5 'default case ELSEIF vMax < .016 THEN vMax = .0155 vMin = -.00750001# 'Scale has to be fudged a little to get the full scale to show since it is not an integer in this case. ELSEIF vMax < .16 THEN vMax = .155 vMin = -.0750001 'Scale has to be fudged a little to get the full scale to show since it is not an integer in this case. ELSEIF vMax < 1.6 THEN vMax = 1.55 vMin = -.750001 'Scale has to be fudged a little to get the full scale to show since it is not an integer in this case. ELSEIF vMax < 16 THEN vMax = 15.5 vMin = -7.5 ELSE vMax = 155 vMin = -75 END IF END SUB'--------------------------------SetVscale-------------------------------FUNCTION subtract# (aaa#, bbb#) '---------------Subtraction function-------------' The purpose of this function is to avoid loss-of-significance errors. ' subtract# = aaa# - bbb# ' But, if both aaa and bbb are positive or both negative, then loss-of-sig is possible. ' In that case, check the ratio of aaa to bbb, and bbb to aaa. (Use different ratio for Double and Single precision math.) ' If too close, then loss of sig is going to happen. ' In that case, subtract# = 0. subtract# = aaa# - bbb# IF (aaa# > 0# AND bbb# > 0#) OR (aaa# < 0# AND bbb# < 0#) THEN IF ((aaa# / bbb#) < 1.0000000000001# AND (aaa# / bbb#) > 1#) OR ((bbb# / aaa#) < 1.0000000000001# AND (bbb# / aaa#) > 1#) THEN subtract# = 0 END IF END IF END FUNCTION'----------------------------------Subtraction function--------------

SCREEN 12 SCREEN 0

PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT

"This program compares carburetor needle profiles for an '81 GPZ 550." "One is a stock (stok) needle (brass) with one clip position." "The second (kaw2) is same as stock but has 5 clip positions." "2nd position from the top makes it the same as the stock needle." "The third is a Dynojet (dyno) needle (stainless steel) with 6" "clip positions. "; "3rd position from the top is the Dynojet recommended position." "Each clip position moves the needle by 1 mm." " " "Reading the output:" "The numbers marked (x), on the left, represent "; "the distance (in mm) from the bottom of the clip at which the diameter "; "was measured." "The middle numbers are the needle's diameter (at the position x from "; "the clip) in inches." "The numbers on the right are differences in "; "diameters in inches (at distance x from the clip) between the two clips. " "The final column on the right tells which needle is richer (at position x, "; "based on the specified clip positions and measured diameters)."

PRINT " " INPUT "(enter 4 to print the above)"; p IF p = 4 THEN LPRINT "This program compares carburetor needle profiles for an '81 GPZ 550." LPRINT " " LPRINT "One is a stock (stok) needle (brass) with one clip position." LPRINT " " LPRINT "The second (kaw2) is same as stock but has 5 clip positions." LPRINT "2nd position from the top makes it the same as the stock needle." LPRINT " " LPRINT "The third is a Dynojet (dyno) needle (stainless steel) with 6" LPRINT "clip positions. "; LPRINT "3rd position from the top is the Dynojet recommended position." LPRINT " " LPRINT "Each clip position moves the needle by 1 mm." LPRINT " " LPRINT " " LPRINT "Reading the output:" LPRINT "The numbers marked (x), on the left, represent "; LPRINT "the distance (in mm) from the bottom of the clip at which the diameter "; LPRINT "was measured." LPRINT "The middle numbers are the needle's diameter (at the position x from "; LPRINT "the clip) in inches." LPRINT "The numbers on the right are differences in "; LPRINT "diameters in inches (at distance x from the clip) between the two clips. " LPRINT "The final column on the right tells which needle is richer (at position x, "; LPRINT "based on the specified clip positions and measured diameters)." LPRINT "" LPRINT "" END IF CLS INPUT "Enter 5 to print the results to the printer."; p CLS

DIM stok(-2 TO 60) AS SINGLE DIM kaw2(-2 TO 60) AS SINGLE DIM dyno(-2 TO 60) AS SINGLE 10 INPUT "Enter clip position for Kaw2 needle (1 to 5 counted from top)"; clipk IF clipk < 1 OR clipk > 5 THEN PRINT "Must be 1 to 5" GOTO 10 END IF clipk = clipk - 2 20 INPUT "Enter clip position for Dyno needle (1 to 6 counted from top)"; clipd IF clipd < 1 OR clipd > 6 THEN PRINT "Must be 1 to 6" GOTO 20 END IF clipd = clipd - 3

'initializes stok and kaw2 arrays FOR x = -2 TO 60 IF x < 21 THEN stok(x) = .1 kaw2(x) = .1 GOTO 99 END IF IF x < 25 THEN stok(x) = .1 - ((.002 / 4) * (x - 20)) kaw2(x) = .1 - ((.002 / 4) * (x - 20)) GOTO 99 END IF IF x < 44 THEN stok(x) = .1 - .002 - ((.038 / 19.3) * (x - 24)) kaw2(x) = .1 - .002 - ((.038 / 19.3) * (x - 24)) GOTO 99 END IF stok(x) = 0 kaw2(x) = 0 99 NEXT x

'initializes dyno array FOR x = -2 TO 60 IF x < 22 THEN dyno(x) = .1 GOTO 199 END IF IF x < 51 THEN dyno(x) = .1 - ((.05 / 29.5) * (x - 21.5)) GOTO 199 END IF dyno(x) = 0 199 NEXT x

'rounds FOR x = stok(x) kaw2(x) dyno(x) NEXT x

off the values -2 TO 60 = (CINT(stok(x) * 10000)) / 10000 = (CINT(kaw2(x) * 10000)) / 10000 = (CINT(dyno(x) * 10000)) / 10000

'prints results PRINT "Stock versus Kawasaki2 at clip position"; clipk + 2 IF p = 5 THEN LPRINT "Stock versus Kawasaki2 at clip position"; clipk + 2 FOR x = 0 TO 55 diff = (CINT((stok(x) - kaw2(x + clipk)) * 10000)) / 10000 PRINT "x="; x; " Stock="; stok(x); " Kaw2="; kaw2(x + clipk); " IF diff > 0 THEN PRINT " K2 richer" IF diff < 0 THEN PRINT " Stk richer" IF diff = 0 THEN PRINT " same" IF p = 5 THEN GOTO 100 FOR t = 1 TO 24000 NEXT t 100 IF p = 5 THEN LPRINT "x="; x; " Stock="; stok(x); " IF diff > 0 THEN LPRINT " K2 richer" IF diff < 0 THEN LPRINT " Stk richer" IF diff = 0 THEN LPRINT " same" END IF NEXT x PRINT " " IF p = 5 THEN LPRINT " " PRINT "Stock versus Dynojet at clip position"; clipd + 3 IF p = 5 THEN LPRINT "Stock versus Dynojet at clip position"; clipd + 3 FOR x = 0 TO 55 diff = (CINT((stok(x) - dyno(x + clipd)) * 10000)) / 10000 PRINT "x="; x; " Stock="; stok(x); " Dyno="; dyno(x + clipd); " IF diff > 0 THEN PRINT " Dy richer" IF diff < 0 THEN PRINT " Stk richer" IF diff = 0 THEN PRINT " same" IF p = 5 THEN GOTO 200 FOR t = 1 TO 24000 NEXT t 200 IF p = 5 THEN LPRINT "x="; x; " Stock="; stok(x); " IF diff > 0 THEN LPRINT " Dy richer" IF diff < 0 THEN LPRINT " Stk richer" IF diff = 0 THEN LPRINT " same" END IF NEXT x PRINT " " IF p = 5 THEN LPRINT " "

Stk-K2="; diff;

Kaw2="; kaw2(x + clipk); "

Stk-K2="; diff;

Stk-Dy="; diff;

Dyno="; dyno(x + clipd); "

Stk-Dy="; diff;

PRINT "Dynojet at clip pos"; clipd + 3; " versus Kawasaki2 at clip pos"; clipk + 2 IF p = 5 THEN LPRINT "Dynojet at clip pos"; clipd + 3; " versus Kawasaki2 at clip pos"; clipk + 2 FOR x = 0 TO 55 diff = (CINT((dyno(x + clipd) - kaw2(x + clipk)) * 10000)) / 10000 PRINT "x="; x; " Dyno="; dyno(x + clipd); " Kaw2="; kaw2(x + clipk); " diff; IF diff > 0 THEN PRINT " K2 richer" IF diff < 0 THEN PRINT " Dy richer" IF diff = 0 THEN PRINT " same" IF p = 5 THEN GOTO 300 FOR t = 1 TO 24000 NEXT t 300 IF p = 5 THEN LPRINT "x="; x; " Dyno="; dyno(x + clipd); " diff; IF diff > 0 THEN LPRINT " K2 richer" IF diff < 0 THEN LPRINT " Dy richer" IF diff = 0 THEN LPRINT " same" END IF NEXT x

Dy-K2=";

Kaw2="; kaw2(x + clipk); "

Dy-K2=";

PRINT " " PRINT " " PRINT " " IF p = 5 THEN LPRINT " " LPRINT " " LPRINT " " END IF INPUT "hit enter to run again"; a RUN

SCREEN 12 PRINT "This program creates a chart of dwell time as a function of dwell angle and RPM." PRINT "" PRINT "This is best viewed on a printout." PRINT "If you have a printer, enter P to print." INPUT "If you do not have a printer, hit enter."; Cont$ IF Cont$ = "P" GOTO 2 IF Cont$ = "p" GOTO 2 GOTO 3 2

LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT LPRINT

" DWELL TIME" "" "This is Dwell time as a function of RPM and Dwell Angle." "Dwell time in msec. Dwell angle in crank degrees." "Dwell time = (Dwell Angle / RPM) * 166.6667 " "This is for one coil fired from the crank one time per revolution." "" "Left side is Dwell Angle. Top is RPM. Chart is Dwell time in msec. " "" "To get the Dwell Time for 4000 RPM, divide the dwell time for 400" "by 10." "" "" " RPM" " 100 200 300 400 500 600 700 800 900 1000" "--------|------|-----|-----|-----|-----|-----|-----|-----|-----|------"

FOR angle = 0 TO 360 STEP 10 LPRINT USING "###"; angle; LPRINT " deg : "; FOR rpm = 100 TO 1000 STEP 100 time time time time = = = = 166.6667 * angle / rpm time * 10 CINT(time) time / 10

LPRINT USING "###.#"; time; LPRINT " "; NEXT rpm LPRINT "" NEXT angle 3 CLS PRINT PRINT PRINT INPUT CLS PRINT PRINT PRINT PRINT PRINT PRINT PRINT

"To pause the screen: press CTRL & Break." "Then hit F4 to view the output screen." "" "hit enter to continue"; zz " DWELL TIME" "" "This is Dwell time as a function of RPM and Dwell Angle." "Dwell time in msec. Dwell angle in crank degrees." "Dwell time = (Dwell Angle / RPM) * 166.6667 " "This is for one coil fired from the crank one time per revolution." ""

PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT PRINT

"Left side is Dwell Angle. Top is RPM. Chart is Dwell time in msec. " "" "To get the Dwell Time for 4000 RPM, divide the dwell time for 400" "by 10." "" "" " RPM" " 100 200 300 400 500 600 700 800 900 1000" "--------|------|-----|-----|-----|-----|-----|-----|-----|-----|------"

FOR angle = 0 TO 360 STEP 10 FOR timedelay = 1 TO 70000 NEXT timedelay PRINT USING "###"; angle; PRINT " deg : "; FOR rpm = 100 TO 1000 STEP 100 time time time time = = = = 166.6667 * angle / rpm time * 10 CINT(time) time / 10

PRINT USING "###.#"; time; PRINT " "; NEXT rpm PRINT "" NEXT angle

PROGRAMA GENERADOR MEDIO


DECLARE SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM SHARED deg AS DOUBLE DIM SHARED rad AS DOUBLE DIM SHARED x1 AS DOUBLE DIM SHARED y1 AS DOUBLE DIM SHARED xx1 AS INTEGER DIM SHARED yy1 AS INTEGER DIM SHARED x2 AS DOUBLE DIM SHARED y2 AS DOUBLE DIM SHARED xx2 AS INTEGER DIM SHARED yy2 AS INTEGER DIM SHARED dash AS INTEGER CONST pi = 3.1415927# 'This is a degree wheel bitmap generator. Written by Lou Dudzik 12/2009. 'Screen 12 cannot set background color. Re-save as 24bit bitmap in paint, then invert colors. ' this sets up the screen with graphics viewport and text area CLS 'Clear screen. SCREEN 12 'Screen 12 is 640 by 480 pxl. PRINT "This will save the image as a bitmap. It will be saved in the PRINT "same folder this program resides in. Open it in paint and save" PRINT "as a 24-bit bitmap. Then invert the colors. After that, copy and " PRINT "paste as necessary to complete the wheel." INPUT ""; g CLS VIEW (0, 0)-(479, 479) WINDOW (0, 0)-(479, 479) 'x Scale will be 0 to +479. This way pxl location is rounded off using CINT. Then a pxl is plotted with an exact pxl location, instead of relying on the LINE function to round off pixl location. LINE (0, 0)-(0, 479) LINE (0, 0)-(479, 0) LINE (350, 350)-(479, 479) FOR dash = 50 TO 350 STEP 50 LINE (dash, -5)-(dash, 5) LINE (-5, dash)-(5, dash) NEXT dash 'vertical axis 'horizontal axis 'diag upper right 'draws hash marks on the axes.

FOR deg = 0 TO 45 'only drawing 1/8 of the wheel. Use paint past to complete the wheel. This way it will have symmetry in every way. rad = deg * (pi / 180#) 'converts degrees to radians IF CINT(deg / 45) = deg / 45 THEN 'plot the 45 degree increments x1 = 350# * COS(rad) 'this determines the x position of the the degree mark. y1 = 350# * SIN(rad) 'this determines the y position of the the degree mark. x2 = 475# * COS(rad) 'this determines the x position of the of the degree mark. y2 = 475# * SIN(rad) 'this determines the y position of the of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 10) = deg / 10 THEN 'plot the 10 degree increments x1 = 100# * COS(rad) 'this determines the x position of the the degree mark. y1 = 100# * SIN(rad) 'this determines the y position of the the degree mark.

to copy and

start point of start point of finish point finish point

start point of start point of

x2 = 479# * COS(rad) 'this determines the x position of of the degree mark. y2 = 479# * SIN(rad) 'this determines the y position of of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 5) = deg / 5 THEN 'plot the 5-degree increments x1 = 440# * COS(rad) 'this determines the x position of the degree mark. y1 = 440# * SIN(rad) 'this determines the y position of the degree mark. x2 = 475# * COS(rad) 'this determines the x position of of the degree mark. y2 = 475# * SIN(rad) 'this determines the y position of of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSE 'plot the 1-degree increments x1 = 450# * COS(rad) 'this determines the x position of the degree mark. y1 = 450# * SIN(rad) 'this determines the y position of the degree mark. x2 = 470# * COS(rad) 'this determines the x position of of the degree mark. y2 = 470# * SIN(rad) 'this determines the y position of of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) END IF NEXT deg 'END is saved.

the finish point the finish point

the start point of the start point of the finish point the finish point

the start point of the start point of the finish point the finish point

'this is used for troubleshooting. it stops before the bitmap

VIEW 'needed before saving the bitmap WINDOW 'needed before saving the bitmap FourBIT 0, 0, 639, 479, "DegWhlSml" 'this is the line to call the screen 12 bitmap generator 'important to note, before the call, if a WINDOW or VIEW command was set, they should be cancelled before calling the sub. 'This is done by a simple WINDOW and/or VIEW statement with no arguments. 'They must be reinstated after returning from the sub if further screen printing will be done. SYSTEM '------------------------this is the screen 12 bitmap generator--------------SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM FileCOLORS%(1 TO 48) DIM Colors4%(15) IF INSTR(FileNAME$, ".BMP") = 0 THEN FileNAME$ = RTRIM$(LEFT$(FileNAME$, 8)) + ".BMP" END IF FOR x = x1% TO x2% FOR y = y1% TO y2% Colors4%(POINT(x, y)) = 1

NEXT y NEXT x FOR n = 0 TO 15 IF Colors4%(n) = 1 THEN SigCOLORS& = SigCOLORS& + 1 NEXT n FileTYPE$ = "BM" Reserved1% = 0 Reserved2% = 0 OffsetBITS& = 118 InfoHEADER& = 40 PictureWIDTH& = x2% - x1% + 1 PictureDEPTH& = y2% - y1% + 1 NumPLANES% = 1 BPP% = 4 Compression& = 0 WidthPELS& = 3780 DepthPELS& = 3780 NumCOLORS& = 16 IF PictureWIDTH& MOD 8 <> 0 THEN ZeroPAD$ = SPACE$((8 - PictureWIDTH& MOD 8) \ 2) END IF ImageSIZE& = (((ImageWIDTH& + LEN(ZeroPAD$)) * ImageDEPTH&) + .1) / 2 FileSIZE& = ImageSIZE& + OffsetBITS& Colr = 0 FOR n = 1 TO 48 STEP 3 OUT &H3C7, Colr FileCOLORS%(n) = INP(&H3C9) FileCOLORS%(n + 1) = INP(&H3C9) FileCOLORS%(n + 2) = INP(&H3C9) Colr = Colr + 1 NEXT n OPEN FileNAME$ FOR BINARY AS #1 PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, #1, , , , , , , , , , , , , , , , , FileTYPE$ FileSIZE& Reserved1% 'should be zero Reserved2% 'should be zero OffsetBITS& InfoHEADER& PictureWIDTH& PictureDEPTH& NumPLANES% BPP% Compression& ImageSIZE& WidthPELS& DepthPELS& NumCOLORS& SigCOLORS&

u$ = " " FOR n% = 1 TO 46 STEP 3 Colr$ = CHR$(FileCOLORS%(n% + 2) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n% + 1) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n%) * 4) PUT #1, , Colr$ PUT #1, , u$ 'Unused byte NEXT n% FOR y = y2% TO y1% STEP -1

FOR x = x1% TO x2% STEP 2 HiX = POINT(x, y) LoX = POINT(x + 1, y) HiNIBBLE$ = HEX$(HiX) LoNIBBLE$ = HEX$(LoX) HexVAL$ = "&H" + HiNIBBLE$ + LoNIBBLE$ a$ = CHR$(VAL(HexVAL$)) PUT #1, , a$ NEXT x PUT #1, , ZeroPAD$ NEXT y CLOSE #1 END SUB '-------------------------Four Bit----------------

PROGRAMA GENERADOR PEQUEO


DECLARE SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM SHARED deg AS DOUBLE DIM SHARED rad AS DOUBLE DIM SHARED x1 AS DOUBLE DIM SHARED y1 AS DOUBLE DIM SHARED xx1 AS INTEGER DIM SHARED yy1 AS INTEGER DIM SHARED x2 AS DOUBLE DIM SHARED y2 AS DOUBLE DIM SHARED xx2 AS INTEGER DIM SHARED yy2 AS INTEGER DIM SHARED dash AS INTEGER CONST pi = 3.1415927# 'This is a degree wheel bitmap generator. Written by Lou Dudzik 12/2009. 'Screen 12 cannot set background color. Re-save as 24bit bitmap in paint, then invert colors. ' this sets up the screen with graphics viewport and text area CLS 'Clear screen. SCREEN 12 'Screen 12 is 640 by 480 pxl. PRINT "This will save the image as a bitmap. It will be saved in the PRINT "same folder this program resides in. Open it in paint and save" PRINT "as a 24-bit bitmap. Then invert the colors. After that, copy and " PRINT "paste as necessary to complete the wheel." INPUT ""; g CLS VIEW (0, 0)-(478, 478) 'Making the graphics veiwport square. In order to put a zero point in the middle, need an odd number of pixels. Instead of 480 pxls, using 479 pxls. Therefore 0 to 478. WINDOW (-239, -239)-(239, 239) 'Scale will be -239 to +239. This way pxl location is rounded off using CINT. Then a pxl is plotted with an exact pxl location, instead of relying on the LINE function to round off pixl location. LINE LINE LINE LINE LINE LINE (0, -239)-(0, 239) 'vertical axis (-239, 0)-(239, 0) 'horizontal axis (-180, -180)-(-239, -239) 'diag lower left (-180, 180)-(-239, 239) 'diag upper left (180, -180)-(239, -239) 'diag lower right (180, 180)-(239, 239) 'diag upper right 'draws hash marks on the axes.

FOR dash = 25 TO 175 STEP 25 LINE (dash, -3)-(dash, 3) LINE (-3, dash)-(3, dash) NEXT dash

FOR deg = 0 TO 45 'only drawing 1/8 of the wheel. Use paint to copy and past to complete the wheel. This way it will have symmetry in every way. rad = deg * (pi / 180#) 'converts degrees to radians IF CINT(deg / 45) = deg / 45 THEN 'plot the 45 degree increments x1 = 190# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 190# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 237# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 237# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 10) = deg / 10 THEN 'plot the 10 degree increments x1 = 50# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 50# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 239# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 239# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 5) = deg / 5 THEN 'plot the 5-degree increments x1 = 219# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 219# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 237# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 237# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSE 'plot the 1-degree increments x1 = 225# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 225# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 235# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 235# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) END IF NEXT deg 'END is saved. VIEW 'this is used for troubleshooting. it stops before the bitmap 'needed before saving the bitmap

WINDOW 'needed before saving the bitmap FourBIT 0, 0, 639, 479, "DegWhlSml" 'this is the line to call the screen 12 bitmap generator 'important to note, before the call, if a WINDOW or VIEW command was set, they should be cancelled before calling the sub. 'This is done by a simple WINDOW and/or VIEW statement with no arguments. 'They must be reinstated after returning from the sub if further screen printing will be done. SYSTEM '------------------------this is the screen 12 bitmap generator--------------SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM FileCOLORS%(1 TO 48) DIM Colors4%(15) IF INSTR(FileNAME$, ".BMP") = 0 THEN FileNAME$ = RTRIM$(LEFT$(FileNAME$, 8)) + ".BMP" END IF FOR x = x1% TO x2% FOR y = y1% TO y2% Colors4%(POINT(x, y)) = 1 NEXT y NEXT x FOR n = 0 TO 15 IF Colors4%(n) = 1 THEN SigCOLORS& = SigCOLORS& + 1 NEXT n FileTYPE$ = "BM" Reserved1% = 0 Reserved2% = 0 OffsetBITS& = 118 InfoHEADER& = 40 PictureWIDTH& = x2% - x1% + 1 PictureDEPTH& = y2% - y1% + 1 NumPLANES% = 1 BPP% = 4 Compression& = 0 WidthPELS& = 3780 DepthPELS& = 3780 NumCOLORS& = 16 IF PictureWIDTH& MOD 8 <> 0 THEN ZeroPAD$ = SPACE$((8 - PictureWIDTH& MOD 8) \ 2) END IF ImageSIZE& = (((ImageWIDTH& + LEN(ZeroPAD$)) * ImageDEPTH&) + .1) / 2 FileSIZE& = ImageSIZE& + OffsetBITS& Colr = 0 FOR n = 1 TO 48 STEP 3 OUT &H3C7, Colr FileCOLORS%(n) = INP(&H3C9) FileCOLORS%(n + 1) = INP(&H3C9) FileCOLORS%(n + 2) = INP(&H3C9) Colr = Colr + 1 NEXT n OPEN FileNAME$ FOR BINARY AS #1 PUT PUT PUT PUT PUT PUT #1, #1, #1, #1, #1, #1, , , , , , , FileTYPE$ FileSIZE& Reserved1% 'should be zero Reserved2% 'should be zero OffsetBITS& InfoHEADER&

PUT PUT PUT PUT PUT PUT PUT PUT PUT PUT

#1, #1, #1, #1, #1, #1, #1, #1, #1, #1,

, , , , , , , , , ,

PictureWIDTH& PictureDEPTH& NumPLANES% BPP% Compression& ImageSIZE& WidthPELS& DepthPELS& NumCOLORS& SigCOLORS&

u$ = " " FOR n% = 1 TO 46 STEP 3 Colr$ = CHR$(FileCOLORS%(n% + 2) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n% + 1) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n%) * 4) PUT #1, , Colr$ PUT #1, , u$ 'Unused byte NEXT n% FOR y = y2% TO y1% STEP -1 FOR x = x1% TO x2% STEP 2 HiX = POINT(x, y) LoX = POINT(x + 1, y) HiNIBBLE$ = HEX$(HiX) LoNIBBLE$ = HEX$(LoX) HexVAL$ = "&H" + HiNIBBLE$ + LoNIBBLE$ a$ = CHR$(VAL(HexVAL$)) PUT #1, , a$ NEXT x PUT #1, , ZeroPAD$ NEXT y CLOSE #1 END SUB '-------------------------Four Bit----------------

Вам также может понравиться