├── BASIC_examples ├── AmericanFootball.BAS ├── BEERNAZI.BAS ├── FORNEXT.BAS ├── FORNEXTNESTED.BAS └── GUESSMYNUMBER.BAS ├── PS2Keyboard.zip ├── SD_KB_BASIC_Arduino └── SD_KB_BASIC_Arduino.ino ├── SDcardMOD.zip ├── TVout_Arduino └── TVout_Arduino.ino ├── preprocessor ├── AmericanFootball.qb ├── AmericanFootball.txt ├── PROGRAM.BAS ├── quckbasicpreprocessor.py ├── readme.txt ├── sor adds the lines and changes the labels to line numbers ├── test.qb └── tored in PROGRAM.BAS └── readme /BASIC_examples/AmericanFootball.BAS: -------------------------------------------------------------------------------- 1 | 1 X=1 2 | 2 Y=100+1 3 | 3 N=RND 4 | 4 IF N<50 THEN 9 5 | 5 PRINT "YOU LOST TOSS" 6 | 6 REM when O is 1 player is on the offence 0 is on deffence 7 | 7 O=0 8 | 8 GOTO 58 9 | 9 REM wintoss: 10 | 10 PRINT "YOU WON TOSS" 11 | 11 PRINT "[ENTER] TO CONTINUE" 12 | 12 INPUT Q 13 | 13 REM when O is 1 player is on the offence 0 is on deffence 14 | 14 O=1 15 | 15 GOTO 58 16 | 16 REM menu: 17 | 17 IF D=5 THEN 142 18 | 18 L=T 19 | 19 T=L+1 20 | 20 REM 120 downs in one game 21 | 21 IF T=120 THEN 192 22 | 22 REM info: 23 | 23 PRINT "Score,YOU,COMP:" 24 | 24 PRINT A 25 | 25 PRINT B 26 | 26 PRINT "[ENTER] TO CONTINUE" 27 | 27 INPUT Q 28 | 28 PRINT "Down,Yard:" 29 | 29 PRINT D 30 | 30 PRINT E 31 | 31 PRINT "[ENTER] TO CONTINUE" 32 | 32 INPUT Q 33 | 33 PRINT "1stDn,Turn of120:" 34 | 34 C=F-E 35 | 35 PRINT C 36 | 36 PRINT T 37 | 37 PRINT "[ENTER] TO CONTINUE" 38 | 38 INPUT Q 39 | 39 IF O=0 THEN 175 40 | 40 PTINT "1)LONG PASS 3)RUN" 41 | 41 PTINT "2)SHORTPASS 4)PUNT" 42 | 42 PTINT "5)FIELD GOAL6)INFO" 43 | 43 INPUT Q 44 | 44 X=1 45 | 45 Y=100 46 | 46 N=RND 47 | 47 IF Q=1 THEN 70 48 | 48 IF Q=2 THEN 76 49 | 49 IF Q=3 THEN 82 50 | 50 IF Q=4 THEN 88 51 | 51 IF Q=5 THEN 98 52 | 52 IF Q=6 THEN 22 53 | 53 PRINT "INCORRECT INPUT" 54 | 54 PRINT "MUST INPUT 1 TO 6" 55 | 55 PRINT "[ENTER] TO CONTINUE" 56 | 56 INPUT Q 57 | 57 GOTO 22 58 | 58 REM kickoff: 59 | 59 PRINT "KICKOFF" 60 | 60 PRINT "[ENTER] TO CONTINUE" 61 | 61 INPUT Q 62 | 62 REM E is for Yard, start the down with a distance from 1 to 30 63 | 63 Y=1 64 | 64 X=30+1 65 | 65 E=RND 66 | 66 F=E+10 67 | 67 REM D is for Down 68 | 68 D=1 69 | 69 GOTO 16 70 | 70 REM longpass: 71 | 71 PRINT "LONG PASS" 72 | 72 X=50 73 | 73 Y=100 74 | 74 IF N<10 THEN 125 75 | 75 GOTO 117 76 | 76 REM shortpass: 77 | 77 PRINT "SHORT PASS" 78 | 78 X=1 79 | 79 Y=50 80 | 80 IF N<25 THEN 125 81 | 81 GOTO 117 82 | 82 REM run: 83 | 83 PRINT "RUN" 84 | 84 X=1 85 | 85 Y=100 86 | 86 IF N<50 THEN 125 87 | 87 GOTO 117 88 | 88 REM punt: 89 | 89 REM I dont know how 88 works 90 | 90 PRINT "PUNT" 91 | 91 Y=1 92 | 92 X=50+1 93 | 93 E=RND 94 | 94 F=E+10 95 | 95 REM D is for Down 96 | 96 D=1 97 | 97 GOTO 142 98 | 98 REM fieldgoal: 99 | 99 PRINT "FIELD GOAL" 100 | 100 REM I gotta ask if this is corrrect, I think it it wrong 101 | 101 X=1 102 | 102 Y=100+1 103 | 103 N=RND 104 | 104 IF N<50 THEN 107 105 | 105 PRINT "FAILED" 106 | 106 GOTO 142 107 | 107 REM fielgoal125: 108 | 108 PRINT "SUCCEDED" 109 | 109 IF O=1 THEN 113 110 | 110 L=B 111 | 111 B=L+2 112 | 112 GOTO 142 113 | 113 REM add2pointsplayer: 114 | 114 L=A 115 | 115 A=L+2 116 | 116 GOTO 142 117 | 117 REM f175l: 118 | 118 PRINT "FAILED" 119 | 119 PRINT "[ENTER] TO CONTINUE" 120 | 120 INPUT Q 121 | 121 REM L is a temporary variable cause D=D+1 doesnt seem to work 122 | 122 L=D 123 | 123 D=L+1 124 | 124 GOTO 16 125 | 125 REM success: 126 | 126 PRINT "SUCCEDED" 127 | 127 PRINT "[ENTER] TO CONTINUE" 128 | 128 INPUT Q 129 | 129 N=RND 130 | 130 REM P is previous line of scrimmage 131 | 131 P=E 132 | 132 L=E 133 | 133 E=L+N 134 | 134 IF E>99 THEN 153 135 | 135 N=F+10 136 | 136 IF E>N THEN 149 137 | 137 REM L is a temporary variable cause D=D+1 doesnt seem to work 138 | 138 L=D 139 | 139 D=L+1 140 | 140 IF D>4 THEN 142 141 | 141 GOTO 16 142 | 142 REM ballchangesides: 143 | 143 IF O=1 THEN 146 144 | 144 O=1 145 | 145 GOTO 58 146 | 146 REM setdeffence: 147 | 147 O=0 148 | 148 GOTO 58 149 | 149 REM downone: 150 | 150 D=1 151 | 151 F=E+10 152 | 152 GOTO 16 153 | 153 REM touchdown: 154 | 154 PRINT "TOUCHDOWN!" 155 | 155 IF O=1 THEN 165 156 | 156 L=B 157 | 157 B=L+6 158 | 158 PRINT "EXTRA POINT" 159 | 159 X=1 160 | 160 Y=2 161 | 161 N=RND 162 | 162 L=B 163 | 163 B=L+N 164 | 164 GOTO 142 165 | 165 REM add6pointsplayer: 166 | 166 L=A 167 | 167 A=L+6 168 | 168 PRINT "EXTRA POINT" 169 | 169 X=1 170 | 170 Y=2 171 | 171 N=RND 172 | 172 L=A 173 | 173 A=L+N 174 | 174 GOTO 142 175 | 175 REM ai: 176 | 176 REM ask my father how the computer should play 177 | 177 PRINT "COMPUTER MOVE" 178 | 178 IF D<4 THEN 181 179 | 179 IF E>80 THEN 98 180 | 180 IF E<60 THEN 88 181 | 181 REM notfourth: 182 | 182 X=1 183 | 183 Y=3 184 | 184 N=RND 185 | 185 IF E<50 THEN 187 186 | 186 IF N=2 THEN 76 187 | 187 REM noshotrpass: 188 | 188 IF D<3 THEN 82 189 | 189 IF N=1 THEN 70 190 | 190 IF N=2 THEN 70 191 | 191 IF N=3 THEN 82 192 | 192 REM gameover: 193 | 193 PRINT "GameOver,YOU,COMP:" 194 | 194 PRINT A 195 | 195 PRINT B 196 | 196 PRINT "[ENTER] TO CONTINUE" 197 | 197 INPUT Q 198 | 198 IF A>B THEN 201 199 | 199 PRINT "COMPUTER WINS" 200 | 200 END 201 | 201 REM wingame: 202 | 202 PRINT "YOU WIN" 203 | -------------------------------------------------------------------------------- /BASIC_examples/BEERNAZI.BAS: -------------------------------------------------------------------------------- 1 | 1 REM BEER NAZI 2 | 10 PRINT "HOW OLD ARE YOU?" 3 | 20 INPUT A 4 | 30 IF A<18 THEN 80 5 | 40 PRINT "HERE IS YOUR BEER" 6 | 45 PRINT "NEXT!" 7 | 50 END 8 | 80 PRINT "NO BEER FOR YOU!" 9 | -------------------------------------------------------------------------------- /BASIC_examples/FORNEXT.BAS: -------------------------------------------------------------------------------- 1 | 10 FOR A=10 TO 15 2 | 20 PRINT A 3 | 30 NEXT A 4 | -------------------------------------------------------------------------------- /BASIC_examples/FORNEXTNESTED.BAS: -------------------------------------------------------------------------------- 1 | 10 FOR A=1 TO 3 2 | 15 FOR B=5 TO 7 3 | 20 PRINT B 4 | 22 REM INPUT is for waiting for the user to see the number, it is basically just pause until any button is pressed 5 | 23 INPUT X 6 | 25 NEXT B 7 | 30 NEXT A 8 | -------------------------------------------------------------------------------- /BASIC_examples/GUESSMYNUMBER.BAS: -------------------------------------------------------------------------------- 1 | 1 REM Guess my number 2 | 2 PRINT "1 to 100..." 3 | 3 X=1 4 | 4 Y=100 5 | 5 N=RND 6 | 6 PRINT "Your guess? " 7 | 7 INPUT G 8 | 8 IF G=N THEN 11 9 | 9 IF GN THEN 15 11 | 11 PRINT "Got it!" 12 | 12 END 13 | 13 PRINT "Too low" 14 | 14 GOTO 6 15 | 15 PRINT "Too high" 16 | 16 GOTO 6 17 | -------------------------------------------------------------------------------- /PS2Keyboard.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amigojapan/Arduino-Retro-Computer-TV/d358c7fdf8499377cd6ff4d1bc4896a322ad632b/PS2Keyboard.zip -------------------------------------------------------------------------------- /SD_KB_BASIC_Arduino/SD_KB_BASIC_Arduino.ino: -------------------------------------------------------------------------------- 1 | //Copyright 2012 Usmar Padow usm@padow@gmail.com and Greg Cox 2 | //SD memory manager and BASIC interpreter 3 | /* 4 | Wireing 5 | KB2 3 (other arduino TV7 9) SD10 11 12 13 6 | Datalines 4 5 6 8 A0 A1 A2 A3 A4 A5 7 | free but not very good 0 1 8 | */ 9 | /* to use PS2Keyboard library 10 | 11 | PS2Keyboard now requries both pins specified for begin() 12 | 13 | keyboard.begin(data_pin, irq_pin); 14 | 15 | Valid irq pins: 16 | Arduino: 2, 3 17 | Arduino Mega: 2, 3, 18, 19, 20, 21 18 | Teensy 1.0: 0, 1, 2, 3, 4, 6, 7, 16 19 | Teensy 2.0: 5, 6, 7, 8 20 | Teensy++ 1.0: 0, 1, 2, 3, 18, 19, 36, 37 21 | Teensy++ 2.0: 0, 1, 2, 3, 18, 19, 36, 37 22 | Sanguino: 2, 10, 11 23 | 24 | for more information you can read the original wiki in arduino.cc 25 | at http://www.arduino.cc/playground/Main/PS2Keyboard 26 | or http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html 27 | 28 | Like the Original library and example this is under LGPL license. 29 | 30 | Modified by Cuninganreset@gmail.com on 2010-03-22 31 | Modified by Paul Stoffregen June 2010 32 | */ 33 | /*Yotson parallel protocol. implemented by Usmar A Padow usmpadow@gmail.com copyright 2012 34 | sender: ------8 data lines------ : receiver 35 | : --------->-------------- :(sndack) 36 | : ---------<-------------- :(rcvack) 37 | 38 | -sender waits until -<-(rcvack) is LOW (receiver is free to accept data) 39 | -sender sets the 8 bits for transferring 1 byte. 40 | -sender sets line ->-(sndack) HIGH (signify that the sender has a full byte on the data lines, ready for reading) 41 | -sender waits until line -<-(rcvack) goes HIGH (signifying that the receiver has read the data bits) 42 | -sender sets ->-(sndack) to LOW (nothing to be send at this moment) 43 | 44 | -receiver waits until ->-(sndack) goes HIGH (sender has put 8 valid bits on the lines) 45 | -receiver reads the 8 data bits 46 | -receiver if finished sets -<-(rcvack) HIGH (telling the sender that the receiver got the 8 bits) 47 | -receiver waits until ->-(sndack) goes LOW 48 | -receiver sets -<-(rcvack) LOW (telling the sender to send some more) 49 | */ 50 | //Copyright 2011 Usmar A Padow usmpadow@gmail.com 51 | //Parallel communication between 2 arduinos 52 | #ifdef __linux__ 53 | #include "ArduinoSimulator.cpp" 54 | #define byte_type char 55 | 56 | char* freeMemory(){ 57 | return "This is just a dummy,so the ammount of memory wont be displayed"; 58 | } 59 | 60 | //SDCard library simulator 61 | char SDmem[1000000]; 62 | void sd_raw_write(int offset, char byteArray[],int length){ 63 | for(int counter=0;counter 80 | //int var[100];//this works 81 | #include 82 | #include 83 | #include 84 | #include 85 | #define byte_type byte 86 | #endif 87 | 88 | #include // I think sprintf might be contained in here 89 | //#include /* exit */ 90 | //#include /* errno */ 91 | 92 | int dataPin0=4; 93 | int dataPin1=5; 94 | int dataPin2=6; 95 | int dataPin3=8; 96 | int dataPin4=A5; 97 | int dataPin5=A4; 98 | int dataPin6=A3; 99 | int dataPin7=A2; 100 | int sndack=A0;// ***Yotron should this number should be opposite on the other arduino? 101 | int rcvack=A1;// ***Yotron should this number should be opposite on the other arduino? 102 | 103 | //these libraries for the binary converter functions 104 | //#include 105 | //#include //dont need this on the arduino cause pow used by the binary converstion functions seems to be already included by the arduino software 106 | #include 107 | 108 | //binary conversion function Binary to Ascii by GeDaMo 109 | void BtoA(unsigned char ch, char *b) { 110 | int mask = 0x80; 111 | int i; 112 | 113 | for (i = 0; i < 8; ++i) { 114 | b[i] = ch & mask ? '1' : '0'; 115 | mask >>= 1; 116 | } 117 | 118 | b[i] = '\0'; 119 | } 120 | 121 | 122 | 123 | void set_datapins_to_output_mode() { 124 | pinMode(dataPin0,OUTPUT); 125 | pinMode(dataPin1,OUTPUT); 126 | pinMode(dataPin2,OUTPUT); 127 | pinMode(dataPin3,OUTPUT); 128 | pinMode(dataPin4,OUTPUT); 129 | pinMode(dataPin5,OUTPUT); 130 | pinMode(dataPin6,OUTPUT); 131 | pinMode(dataPin7,OUTPUT); 132 | } 133 | #define WAIT_FOR_RECIEVER_FREE 0 134 | #define WAIT_FOR_RECIEVER_READ_BYTES 1 135 | int state=WAIT_FOR_RECIEVER_FREE; 136 | 137 | /* PS2Keyboard library example 138 | 139 | PS2Keyboard now requries both pins specified for begin() 140 | 141 | keyboard.begin(data_pin, irq_pin); 142 | 143 | Valid irq pins: 144 | Arduino: 2, 3 145 | Arduino Mega: 2, 3, 18, 19, 20, 21 146 | Teensy 1.0: 0, 1, 2, 3, 4, 6, 7, 16 147 | Teensy 2.0: 5, 6, 7, 8 148 | Teensy++ 1.0: 0, 1, 2, 3, 18, 19, 36, 37 149 | Teensy++ 2.0: 0, 1, 2, 3, 18, 19, 36, 37 150 | Sanguino: 2, 10, 11 151 | 152 | for more information you can read the original wiki in arduino.cc 153 | at http://www.arduino.cc/playground/Main/PS2Keyboard 154 | or http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html 155 | 156 | Like the Original library and example this is under LGPL license. 157 | 158 | Modified by Cuninganreset@gmail.com on 2010-03-22 159 | Modified by Paul Stoffregen June 2010 160 | */ 161 | 162 | #include 163 | 164 | const int DataPin = 2; 165 | const int IRQpin = 3; 166 | 167 | PS2Keyboard keyboard; 168 | 169 | 170 | #include 171 | char outputbuffer[100]=""; 172 | void output_update() { 173 | //-sender waits until -<-(rcvack) is LOW (receiver is free to accept data) 174 | if(state==WAIT_FOR_RECIEVER_FREE) { 175 | if(digitalRead(rcvack)==LOW && outputbuffer[0]!='\0') { 176 | //-sender sets the 8 bits for transferring 1 byte. 177 | char bitbuffer[9]; 178 | BtoA(outputbuffer[0], bitbuffer); 179 | digitalWrite(dataPin0, bitbuffer[0]=='1'?HIGH:LOW); 180 | digitalWrite(dataPin1, bitbuffer[1]=='1'?HIGH:LOW); 181 | digitalWrite(dataPin2, bitbuffer[2]=='1'?HIGH:LOW); 182 | digitalWrite(dataPin3, bitbuffer[3]=='1'?HIGH:LOW); 183 | digitalWrite(dataPin4, bitbuffer[4]=='1'?HIGH:LOW); 184 | digitalWrite(dataPin5, bitbuffer[5]=='1'?HIGH:LOW); 185 | digitalWrite(dataPin6, bitbuffer[6]=='1'?HIGH:LOW); 186 | digitalWrite(dataPin7, bitbuffer[7]=='1'?HIGH:LOW); 187 | //-sender sets line ->-(sndack) HIGH (signify that the sender has a full byte on the data lines, ready for reading) 188 | digitalWrite(sndack, HIGH); 189 | strcpy(outputbuffer,outputbuffer+1); 190 | //Serial.print(outputbuffer); 191 | state=WAIT_FOR_RECIEVER_READ_BYTES; 192 | } 193 | } 194 | //-sender waits until line -<-(rcvack) goes HIGH (signifying that the receiver has read the data bits) 195 | if(state==WAIT_FOR_RECIEVER_READ_BYTES) { 196 | if(digitalRead(rcvack)==HIGH) { 197 | //-sender sets ->-(sndack) to LOW (nothing to be send at this moment) 198 | digitalWrite(sndack, LOW); 199 | state=WAIT_FOR_RECIEVER_FREE; 200 | } 201 | } 202 | } 203 | void print2(char str[]) { 204 | strcpy(outputbuffer,str); 205 | while(outputbuffer[0]!='\0') output_update(); 206 | } 207 | void newline() { 208 | print2("\r\n"); 209 | } 210 | 211 | void print2nl(char str[]) { 212 | print2(str); 213 | newline(); 214 | } 215 | void cls() { 216 | //implement later as a command 217 | //lcd.clear(); 218 | //strcpy(buffer," ");//20*4 spaces 219 | //pos=0; 220 | } 221 | 222 | 223 | 224 | 225 | //Arduino SD BASIC interpretera Copyright 2011 Usmar A Padow 226 | 227 | #include 228 | #include 229 | //we want this only to compule for the simulator, for the real arduino, we want to use the SD card 230 | 231 | //#include 232 | //PS2uartKeyboard keyboard; 233 | #define rows 20 234 | #define cols 4 235 | void printWelcome(); 236 | 237 | void setup() { 238 | delay(1000); 239 | keyboard.begin(DataPin, IRQpin); 240 | Serial.begin(9600); 241 | pinMode(rcvack, INPUT); 242 | pinMode(sndack,OUTPUT); 243 | set_datapins_to_output_mode(); 244 | 245 | printWelcome(); 246 | if(!sd_raw_init()) { 247 | print2("MMC/SD initialization failed"); 248 | } 249 | randomSeed(millis());//randomize the seed 250 | } 251 | 252 | 253 | int ProgNum=0; 254 | unsigned char NumberOfLines=0; 255 | #define LineLength 30//I made this small because o the limit in arudino memory 256 | //warning this is because of the limit of the size of char which we will use to store ln, we may change it later 257 | #define LineCount 250 258 | #define NumberOfPrograms 10 259 | #define ProgramSize LineLength*LineCount 260 | #define ln0offset ProgramSize*NumberOfPrograms 261 | //nol=number of lines 262 | #define noloffset ln0offset+(LineCount*NumberOfPrograms) 263 | //greg, is this the same thing? #define noloffset ln0offset+(ProgramSize*NumberOfPrograms) 264 | //#include 265 | //byte_type tempbytes[LineLength]; 266 | byte_type tempbytes[LineCount];//this is nessesary to have a program delete command, but it might be too much memory when I mix it with the TVout library, so I may need to change it to the commented line above 267 | 268 | char OneLine[LineLength];//used many times, global var 269 | int i; 270 | int ReturnStack[5];//increase this if you think there will be more than 5 levels of return from GOSUBs 271 | int StackCount=0; 272 | 273 | void delete_lns() { 274 | for(i=1;iLineCount) { 436 | print2("Error, the maximum number of lines possible is 250"); 437 | } 438 | NumberOfLines++; 439 | set_nol(); 440 | set_ln(RealLineNumber,NumberOfLines); 441 | offset=(unsigned long) ProgNum*ProgramSize+NumberOfLines*LineLength; 442 | } 443 | writeString(offset,str,strlen(str)+1);//the +1 is so that it will also add the null character of teh string 444 | /* 445 | //make a string that takes up the whole line legnth 446 | strcpy(OneLine," ");//30 spaces 447 | for(i=0;i"); 451 | print2(OneLine); 452 | print2("<--"); 453 | writeString(offset,OneLine,LineLength); 454 | */ 455 | } 456 | void get_Line(char *p, unsigned char RealLineNumber) { 457 | unsigned char SDPointer=get_ln(RealLineNumber); 458 | unsigned long offset; 459 | if(SDPointer==0) { 460 | //*p='\0'; 461 | strcpy(p,"EMPTYLINE"); 462 | return; 463 | } 464 | offset=(unsigned long)ProgNum*ProgramSize+SDPointer*LineLength; 465 | detachInterrupt(IRQpin); 466 | detachInterrupt(DataPin); 467 | sd_raw_read(offset,tempbytes,LineLength); 468 | keyboard.begin(DataPin, IRQpin); 469 | 470 | 471 | //bytecpy(p,tempbytes); 472 | //print2(p); 473 | } 474 | 475 | void get_Line2(unsigned char RealLineNumber) { 476 | unsigned char SDPointer=get_ln(RealLineNumber); 477 | //OKprint2("\r\nSDPointer=get_ln(RealLineNumber);\r\n"); 478 | unsigned long offset; 479 | if(SDPointer==0) { 480 | //*p='\0'; 481 | strcpy(OneLine,"EMPTYLINE"); 482 | return; 483 | } 484 | offset=(unsigned long)ProgNum*ProgramSize+SDPointer*LineLength; 485 | //sd_raw_read(offset,tempbytes,LineLength); 486 | //delay(1000); 487 | //print2("\r\npr(offset,LineLength)="); 488 | //pr(offset,LineLength); 489 | //print2("\r\nend"); 490 | 491 | 492 | //char tmp[30]; 493 | //sprintf(tmp,"\r\nRLN=%i,offset=%lu\r\n",RealLineNumber,offset); 494 | //print2(tmp); 495 | 496 | //print2("\r\npr(offset,LineLength)="); 497 | //print2("\r\nbefore pr2(offset,LineLength);\r\n"); 498 | pr2(offset, LineLength );//bug in this function 499 | //print2("\r\nafter pr2(offset,LineLength);\r\n"); 500 | //print2("\r\nend"); 501 | 502 | } 503 | 504 | //Spinelli's Basic interpreter, ported to arduino bu Usmar A Padow usmpadow@gmail.com 505 | #include 506 | #include 507 | #include 508 | int *callp,callstk[10]; 509 | #define NumberOfNestedLoops 4 510 | int forln[NumberOfNestedLoops],forend[NumberOfNestedLoops],for_itteration[NumberOfNestedLoops]; 511 | int var[100],CurrentLineNumber,quoted; 512 | char buf[100],F[2];//size of buf might be reducible 513 | //char *ln[100],*p,*q,*x,*y,*z,*s,*d,*f; 514 | char *p,*q,*x,*y,*z,*s,*d,*f; 515 | 516 | 517 | char *findstr(char *s,char *o) { 518 | for(x=s;*x;x++){ 519 | for(y=x,z=o; *z&&*y==*z; y++) 520 | z++; 521 | if(z>o&&!*z) 522 | return x; 523 | } 524 | return 0; 525 | } 526 | void editln(){ 527 | CurrentLineNumber=atoi(buf); 528 | //ln[l] && free(ln[l]); 529 | p=findstr(buf," "); 530 | if(findstr(buf," ")) { 531 | AddLine(CurrentLineNumber, p+1); 532 | } 533 | } 534 | 535 | int eqexp(); 536 | int atomexp(); 537 | int mulexp(); 538 | int addexp(); 539 | int cmpeexp(); 540 | int cmpexp(); 541 | 542 | int eqexp(){ 543 | int o=cmpexp(); 544 | switch(*p++){ 545 | ; 546 | break; 547 | case '=': 548 | return o == eqexp(); 549 | ; 550 | break; 551 | case '#': 552 | return o != eqexp(); 553 | default: 554 | p--; 555 | return o; 556 | } 557 | } 558 | int debug(){ 559 | char tmp[6]; 560 | sprintf(tmp,"*p is %s,var[*p] is %d\r\n",*p,var[*p]); 561 | print2(tmp); 562 | return 0; 563 | } 564 | 565 | int atomexp(){ 566 | int o; 567 | return *p=='-' 568 | ? p++,-atomexp() 569 | : *p>='0' && *p<='9' 570 | ? strtol(p,&p,0) 571 | : *p=='(' 572 | ? p++,o=eqexp(),p++,o 573 | : var[*p++]; 574 | } 575 | 576 | int mulexp(){ 577 | int o=atomexp(); 578 | switch(*p++){ 579 | ; 580 | break; 581 | case '*': 582 | return o * mulexp(); 583 | ; 584 | break; 585 | case '/': 586 | return o / mulexp(); 587 | default: 588 | p--; 589 | return o; 590 | } 591 | } 592 | 593 | int addexp(){ 594 | int o=mulexp(); 595 | switch(*p++){ 596 | ; 597 | break; 598 | case '+': 599 | return o + addexp(); 600 | ; 601 | break; 602 | case '-': 603 | return o - addexp(); 604 | default: 605 | p--; 606 | return o; 607 | } 608 | } 609 | 610 | int cmpeexp(){ 611 | int o=addexp(); 612 | switch(*p++){ 613 | ; 614 | break; 615 | case '$': 616 | return o <= cmpeexp(); 617 | ; 618 | break; 619 | case '!': 620 | return o >= cmpeexp(); 621 | default: 622 | p--; 623 | return o; 624 | } 625 | } 626 | int cmpexp(){ 627 | int o=cmpeexp(); 628 | switch(*p++){ 629 | ; 630 | break; 631 | case '<': 632 | return o < cmpexp(); 633 | ; 634 | break; 635 | case '>': 636 | return o > cmpexp(); 637 | default: 638 | p--; 639 | return o; 640 | } 641 | } 642 | 643 | void puts2(char *s) { 644 | //print2("puts2"); 645 | print2(s); 646 | //return 0; 647 | } 648 | void gets2(char *str) { 649 | int inbyte=0; 650 | char tmp[2]; 651 | //strcpy(s,"");//clear string 652 | str[0]='\0';//initialize string 653 | while(inbyte!=13){//13 is enter 654 | //print2("x"); 655 | 656 | if(keyboard.available()) { 657 | inbyte=keyboard.read(); 658 | //convert upper case to lower case and lower case to upper case 659 | if(inbyte>64&& inbyte<91) {//the character is uppercase 660 | inbyte+=32;//convert to lower case 661 | } else{ 662 | if(inbyte>60&& inbyte<123) {//the character is lowercase 663 | inbyte-=32;//convert to upper case 664 | } 665 | } 666 | //echo character to LCD if it is not ENTER 667 | sprintf(tmp,"%c",inbyte); 668 | //later add check for input lenght; 669 | /* 670 | if(strlen(str)+1>4) { 671 | print2("INPUT TOO LONG"); 672 | return; 673 | } 674 | */ 675 | strcat(str,tmp);//add this byte_type 676 | if(inbyte!=13) print2(tmp);//echo inbyte to terminal 677 | } 678 | 679 | } 680 | //how to flush serials // Read bytes and toss them out until no more are available while(inbyte_type!=13){//13 is enter 681 | while(keyboard.available()) { 682 | inbyte=keyboard.read(); 683 | } 684 | 685 | } 686 | 687 | 688 | 689 | int print_disk_info(); 690 | int sample(); 691 | int readDisk(); 692 | 693 | byte_type incomingbyte_type; 694 | long int address; 695 | 696 | 697 | /* 698 | void setup() 699 | { 700 | 701 | Serial.begin(9600); 702 | delay(1000); 703 | 704 | } 705 | 706 | char buf[100]; 707 | */ 708 | void loop() { 709 | NumberOfLines=get_nol();//get the LineCount for program 0 710 | while(1) { 711 | //puts2("\n\rOk\n\"); 712 | newline(); 713 | strcpy(buf,"OK"); 714 | print2nl(buf); 715 | //needs to be gets on PC and gets2 on arduino 716 | #ifdef __linux__ 717 | gets(buf); 718 | #else 719 | gets2(buf); 720 | #endif 721 | if(buf[0]=='M') {//case 'M': // MEM shows how much free memory is left 722 | print2("in loop(),freeMemory()="); 723 | sprintf(buf,"%i",freeMemory()); 724 | print2(buf); 725 | } 726 | switch(buf[0]) { 727 | case 'R': // RUN 728 | callp=callstk; 729 | for(i=0;i<100;i++) var[i]=0;//reinitializes all variables to 0 730 | for(CurrentLineNumber=0;CurrentLineNumber-------------- :(sndack) 11 | : ---------<-------------- :(rcvack) 12 | 13 | -sender waits until -<-(rcvack) is LOW (receiver is free to accept data) 14 | -sender sets the 8 bits for transferring 1 byte. 15 | -sender sets line ->-(sndack) HIGH (signify that the sender has a full byte on the data lines, ready for reading) 16 | -sender waits until line -<-(rcvack) goes HIGH (signifying that the receiver has read the data bits) 17 | -sender sets ->-(sndack) to LOW (nothing to be send at this moment) 18 | 19 | -receiver waits until ->-(sndack) goes HIGH (sender has put 8 valid bits on the lines) 20 | -receiver reads the 8 data bits 21 | -receiver if finished sets -<-(rcvack) HIGH (telling the sender that the receiver got the 8 bits) 22 | -receiver waits until ->-(sndack) goes LOW 23 | -receiver sets -<-(rcvack) LOW (telling the sender to send some more) 24 | 25 | Arduino uno pin | TVout 26 | ------------------------------------------- 27 | pin 9 | to 1kohm resistor ____to center of RCA video 28 | pin 7 | to 470 ohm resistor__/ 29 | ground | Ground (to outside of RCA video) 30 | */ 31 | //Copyright 2011 Usmar A Padow usmpadow@gmail.com 32 | //Parallel communication between 2 arduinos 33 | 34 | #include // I think sprintf might be contained in here 35 | #include 36 | #include 37 | 38 | TVout TV; 39 | 40 | int dataPin0=4; 41 | int dataPin1=5; 42 | int dataPin2=6; 43 | int dataPin3=8; 44 | int dataPin4=A5; 45 | int dataPin5=A4; 46 | int dataPin6=A3; 47 | int dataPin7=A2; 48 | int sndack=A0;// ***Yotron should this number should be opposite on the other arduino? 49 | int rcvack=A1;// ***Yotron should this number should be opposite on the other arduino? 50 | 51 | //binary conversion function Ascii to Binary by GeDaMo 52 | int AtoB(char *b){ 53 | int value = 0; 54 | int i; 55 | 56 | for (i = 0; i < 8; ++i) { 57 | value <<= 1; 58 | value |= (b[i] == '1') ? 1 : 0; 59 | } 60 | return value; 61 | } 62 | 63 | #include 64 | void set_datapins_to_input_mode() { 65 | pinMode(dataPin0,INPUT); 66 | pinMode(dataPin1,INPUT); 67 | pinMode(dataPin2,INPUT); 68 | pinMode(dataPin3,INPUT); 69 | pinMode(dataPin4,INPUT); 70 | pinMode(dataPin5,INPUT); 71 | pinMode(dataPin6,INPUT); 72 | pinMode(dataPin7,INPUT); 73 | } 74 | #define WAIT_FOR_SENDER_HIGH 0 75 | #define WAIT_FOR_SENDER_LOW 1 76 | int state=WAIT_FOR_SENDER_HIGH; 77 | char buffer='\0'; 78 | /* 79 | void poll_parallel() { 80 | } 81 | */ 82 | void setup(){ 83 | Serial.begin(9600); 84 | pinMode(rcvack, OUTPUT); 85 | pinMode(sndack,INPUT); 86 | set_datapins_to_input_mode(); 87 | TV.begin(_NTSC); 88 | //TV.set_hbi_hook(poll_parallel); 89 | TV.select_font(font6x8); 90 | TV.println("TVout driver chip boot sucessfull"); 91 | } 92 | void loop() { 93 | //-receiver waits until ->-(sndack) goes HIGH (sender has put 8 valid bits on the lines) 94 | if(state==WAIT_FOR_SENDER_HIGH) { 95 | if(digitalRead(sndack)==HIGH) { 96 | //-receiver reads the 8 data bits 97 | char bitbuffer[9]; 98 | sprintf(bitbuffer,"%i%i%i%i%i%i%i%i" 99 | ,digitalRead(dataPin0) 100 | ,digitalRead(dataPin1) 101 | ,digitalRead(dataPin2) 102 | ,digitalRead(dataPin3) 103 | ,digitalRead(dataPin4) 104 | ,digitalRead(dataPin5) 105 | ,digitalRead(dataPin6) 106 | ,digitalRead(dataPin7) 107 | ); 108 | //-receiver if finished sets -<-(rcvack) HIGH (telling the sender that the receiver got the 8 bits) 109 | digitalWrite(rcvack, HIGH); 110 | int read_character; 111 | read_character=AtoB(bitbuffer); 112 | //output the character 113 | char output[2]; 114 | sprintf(output,"%c",read_character); 115 | //Serial.print("got this character:"); 116 | //Serial.print(output); 117 | TV.print(output); 118 | state=WAIT_FOR_SENDER_LOW; 119 | } 120 | } 121 | //-receiver waits until ->-(sndack) goes LOW 122 | if(state==WAIT_FOR_SENDER_LOW) { 123 | if(digitalRead(sndack)==LOW) { 124 | //-receiver sets -<-(rcvack) LOW (telling the sender to send some more) 125 | digitalWrite(rcvack, LOW); 126 | state=WAIT_FOR_SENDER_HIGH; 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /preprocessor/AmericanFootball.qb: -------------------------------------------------------------------------------- 1 | X=1 2 | Y=100+1 3 | N=RND 4 | IF N<50 THEN wintoss 5 | PRINT "YOU LOST TOSS" 6 | REM when O is 1 player is on the offence 0 is on deffence 7 | O=0 8 | GOTO kickoff 9 | wintoss: 10 | PRINT "YOU WON TOSS" 11 | PRINT "[ENTER] TO CONTINUE" 12 | INPUT Q 13 | REM when O is 1 player is on the offence 0 is on deffence 14 | O=1 15 | GOTO kickoff 16 | menu: 17 | IF D=5 THEN ballchangesides 18 | L=T 19 | T=L+1 20 | REM 120 downs in one game 21 | IF T=120 THEN gameover 22 | info: 23 | PRINT "Score,YOU,COMP:" 24 | PRINT A 25 | PRINT B 26 | PRINT "[ENTER] TO CONTINUE" 27 | INPUT Q 28 | PRINT "Down,Yard:" 29 | PRINT D 30 | PRINT E 31 | PRINT "[ENTER] TO CONTINUE" 32 | INPUT Q 33 | PRINT "1stDn,Turn of120:" 34 | C=F-E 35 | PRINT C 36 | PRINT T 37 | PRINT "[ENTER] TO CONTINUE" 38 | INPUT Q 39 | IF O=0 THEN ai 40 | PTINT "1)LONG PASS 3)RUN" 41 | PTINT "2)SHORTPASS 4)PUNT" 42 | PTINT "5)FIELD GOAL6)INFO" 43 | INPUT Q 44 | X=1 45 | Y=100 46 | N=RND 47 | IF Q=1 THEN longpass 48 | IF Q=2 THEN shortpass 49 | IF Q=3 THEN run 50 | IF Q=4 THEN punt 51 | IF Q=5 THEN fieldgoal 52 | IF Q=6 THEN info 53 | PRINT "INCORRECT INPUT" 54 | PRINT "MUST INPUT 1 TO 6" 55 | PRINT "[ENTER] TO CONTINUE" 56 | INPUT Q 57 | GOTO info 58 | kickoff: 59 | PRINT "KICKOFF" 60 | PRINT "[ENTER] TO CONTINUE" 61 | INPUT Q 62 | REM E is for Yard, start the down with a distance from 1 to 30 63 | Y=1 64 | X=30+1 65 | E=RND 66 | F=E+10 67 | REM D is for Down 68 | D=1 69 | GOTO menu 70 | longpass: 71 | PRINT "LONG PASS" 72 | X=50 73 | Y=100 74 | IF N<10 THEN success 75 | GOTO fail 76 | shortpass: 77 | PRINT "SHORT PASS" 78 | X=1 79 | Y=50 80 | IF N<25 THEN success 81 | GOTO fail 82 | run: 83 | PRINT "RUN" 84 | X=1 85 | Y=100 86 | IF N<50 THEN success 87 | GOTO fail 88 | punt: 89 | REM I dont know how punt works 90 | PRINT "PUNT" 91 | Y=1 92 | X=50+1 93 | E=RND 94 | F=E+10 95 | REM D is for Down 96 | D=1 97 | GOTO ballchangesides 98 | fieldgoal: 99 | PRINT "FIELD GOAL" 100 | REM I gotta ask if this is corrrect, I think it it wrong 101 | X=1 102 | Y=100+1 103 | N=RND 104 | IF N<50 THEN fielgoalsuccess 105 | PRINT "FAILED" 106 | GOTO ballchangesides 107 | fielgoalsuccess: 108 | PRINT "SUCCEDED" 109 | IF O=1 THEN add2pointsplayer 110 | L=B 111 | B=L+2 112 | GOTO ballchangesides 113 | add2pointsplayer: 114 | L=A 115 | A=L+2 116 | GOTO ballchangesides 117 | fail: 118 | PRINT "FAILED" 119 | PRINT "[ENTER] TO CONTINUE" 120 | INPUT Q 121 | REM L is a temporary variable cause D=D+1 doesnt seem to work 122 | L=D 123 | D=L+1 124 | GOTO menu 125 | success: 126 | PRINT "SUCCEDED" 127 | PRINT "[ENTER] TO CONTINUE" 128 | INPUT Q 129 | N=RND 130 | REM P is previous line of scrimmage 131 | P=E 132 | L=E 133 | E=L+N 134 | IF E>99 THEN touchdown 135 | N=F+10 136 | IF E>N THEN downone 137 | REM L is a temporary variable cause D=D+1 doesnt seem to work 138 | L=D 139 | D=L+1 140 | IF D>4 THEN ballchangesides 141 | GOTO menu 142 | ballchangesides: 143 | IF O=1 THEN setdeffence 144 | O=1 145 | GOTO kickoff 146 | setdeffence: 147 | O=0 148 | GOTO kickoff 149 | downone: 150 | D=1 151 | F=E+10 152 | GOTO menu 153 | touchdown: 154 | PRINT "TOUCHDOWN!" 155 | IF O=1 THEN add6pointsplayer 156 | L=B 157 | B=L+6 158 | PRINT "EXTRA POINT" 159 | X=1 160 | Y=2 161 | N=RND 162 | L=B 163 | B=L+N 164 | GOTO ballchangesides 165 | add6pointsplayer: 166 | L=A 167 | A=L+6 168 | PRINT "EXTRA POINT" 169 | X=1 170 | Y=2 171 | N=RND 172 | L=A 173 | A=L+N 174 | GOTO ballchangesides 175 | ai: 176 | REM ask my father how the computer should play 177 | PRINT "COMPUTER MOVE" 178 | IF D<4 THEN notfourth 179 | IF E>80 THEN fieldgoal 180 | IF E<60 THEN punt 181 | notfourth: 182 | X=1 183 | Y=3 184 | N=RND 185 | IF E<50 THEN noshotrpass 186 | IF N=2 THEN shortpass 187 | noshotrpass: 188 | IF D<3 THEN run 189 | IF N=1 THEN longpass 190 | IF N=2 THEN longpass 191 | IF N=3 THEN run 192 | gameover: 193 | PRINT "GameOver,YOU,COMP:" 194 | PRINT A 195 | PRINT B 196 | PRINT "[ENTER] TO CONTINUE" 197 | INPUT Q 198 | IF A>B THEN wingame 199 | PRINT "COMPUTER WINS" 200 | END 201 | wingame: 202 | PRINT "YOU WIN" 203 | -------------------------------------------------------------------------------- /preprocessor/AmericanFootball.txt: -------------------------------------------------------------------------------- 1 | Football rules 2 | Coin toss. 3 | Team that wins the toss elects to recieve or elects to defend which side of the field they want to play. 4 | Kickoff 5 | //if the ball goes mroe than 10 yards, it is a free ball(very rare) 6 | other team catches the ball and tries to run as much as they can. ball must be in bounds if it falls out of bounds, 7 | the revieving team gets it in their 40 yard line. 8 | recieving team has the ball... 9 | Offence 10 | must advance 10 yards to make first down, four downs and the ball possesion changes to the other team. 11 | Long Pass 30% of the time(if you succedd you go far), short pass 40% of the time(but if you succeed you dont 12 | go far, but better yards than run), Run succsefull 50% of the time(if run doesnt succeed you can loose yarage). 13 | 14 | when the pass in INCOMPLETE(falls to the floor) the yards don't advance. 15 | Interception: 16 | 10% for long pass, 4% for short pass.(to make the game mroe exciting lets make thisn 25% and 10%) 17 | 3 down and you have not gotten 10 yards you have to punt(kicking the ball to the other side). 18 | 19 | Defence 20 | #5-4 red-dog 21 | Defend against Long Pass, Defend Against short pass, Defend against run. 22 | 23 | If ball goes past 99 yards, it is a touchdown. 24 | 25 | question,. what do you call the kick where you try to kick it to the goalpost and can get points, hwo many points? how many points for a touch down? 26 | what about half times and stuff like that? does the ball change possesion at halftime? are there also quarters? 27 | 28 | example of screeen: on 16X2 display 29 | YOU WON TOSS 30 | 1)KICK2)RECIEVE 31 | 2 32 | KICKOFF 33 | Offensive 34 | S10-20D2YRD80OF(means Score 10-20 Down 2 Yard 80) 35 | 1)2)3)4)5)6Help 36 | 6 37 | the first line means Score PlayerTeam-ComputerTeam then D means what Down we are at YRD means what Yard we are at OF means OFFENDIVE DE meand DEFENSIVE 38 | 1)Long Ppass 2)Short Pass 3)RUN 4)PUNT 5)FIELD GOAL 39 | S10-20D2YRD80OF 40 | 1)2)3)4)5)6Help 41 | 1 42 | LONG PASS 43 | INCOMPLETE PASS 44 | S10-20D3YRD80 45 | 1)2)3)4)5)6Help 46 | 2 47 | SHORT PASS 48 | PASS COMPELETE 49 | S10-20D1YRD91 50 | 1)2)3)4)5)6Help 51 | 3 52 | RUN 53 | RUN FAILED 54 | S10-20D2YRD85 55 | 1)2)3)4)5)6Help 56 | 57 | 58 | X=1 59 | Y=100+1 60 | N=RND 61 | IF N<50 THEN wintoss 62 | PRINT "YOU LOST TOSS" 63 | REM when O is 1 player is on the offence 0 is on deffence 64 | O=0 65 | GOTO kickoff 66 | wintoss: 67 | PRINT "YOU WON TOSS" 68 | REM when O is 1 player is on the offence 0 is on deffence 69 | O=1 70 | GOTO kickoff 71 | menu: REM main menu 72 | T=T+1 73 | REM 40 turns in one game 74 | IF T=40 THEN gameover 75 | IF O=0 THEN ai 76 | PRINT "Your team Score" 77 | PRINT A 78 | PRINT "Computer team score" 79 | PRINT B 80 | INPUT Q 81 | PRINT "Down" 82 | PRINT D 83 | PRINT "Yard" 84 | PRINT E 85 | INPUT Q 86 | PTINT "1)LONG PASS 3)RUN" 87 | PTINT "2)SHORTPASS 4)PUNT" 88 | PTINT "5)FIELD GOAL" 89 | INPUT Q 90 | X=1 91 | Y=100+1 92 | N=RND 93 | IF Q=1 THEN longpass 94 | IF Q=2 THEN shortpass 95 | IF Q=3 THEN run 96 | IF Q=4 THEN punt 97 | IF Q=5 THEN fieldgoal 98 | PRINT "INCORRECT INPUT" 99 | PRINT "MUST INPUT 1 TO 5" 100 | INPUT Q 101 | GOTO menu 102 | 103 | kickoff: 104 | PRINT "KICKOFF" 105 | REM E is for Yard, start the down with a distance from 1 to 30 106 | Y=1 107 | X=30+1 108 | E=RND 109 | REM D is for Down 110 | D=1 111 | GOTO menu: 112 | 113 | longpass: 114 | PRINT "LONG PASS" 115 | IF N<10 THEN success 116 | GOTO fail 117 | shortpass: 118 | PRINT "SHORT PASS" 119 | X=1 120 | Y=50+1 121 | IF N<25 THEN success 122 | GOTO fail 123 | run: 124 | PRINT "RUN" 125 | IF N<50 THEN success 126 | GOTO fail 127 | punt: 128 | //I dont know how punt works 129 | PRINT "PUNT" 130 | Y=1 131 | X=50+1 132 | E=RND 133 | REM D is for Down 134 | D=1 135 | GOTO ballchangesides 136 | 137 | fieldgoal: 138 | PRINT "FIELD GOAL" 139 | // I gotta ask if this is corrrect, I think it it wrong 140 | X=1 141 | Y=100+1 142 | N=RND 143 | IF N<50 THEN fielgoalsuccess 144 | PRINT "FAILED" 145 | GOTO ballchangesides 146 | fielgoalsuccess: 147 | PRINT "SUCCEDED" 148 | IF O=1 THEN addpointsplayer 149 | B=B+2 150 | GOTO kickoff 151 | addpointsplayer: 152 | A=A+2 153 | GOTO kickoff 154 | 155 | fail: 156 | PRINT "FAILED" 157 | INPUT Q 158 | D=D+1 159 | GOTO menu 160 | success: 161 | PRINT "SUCCEDED" 162 | INPUT Q 163 | N=RND 164 | REM P is previous line of scrimmage 165 | P=E 166 | E=E+N 167 | IF E>=100 THEN touchdown 168 | N=P+10 169 | IF E>N THEN downone 170 | D=D+1 171 | IF D>4 THEN ballchangesides 172 | GOTO menu 173 | ballchangesides: 174 | IF O=1 THEN setdeffence 175 | O=1 176 | GOTO menu 177 | setdeffence: 178 | O=0 179 | GOTO menu 180 | downone: 181 | D=1 182 | GOTO menu 183 | touchdown: 184 | IF O=1 THEN addpointsplayer 185 | B=B+6 186 | GOTO kickoff 187 | addpointsplayer: 188 | A=A+6 189 | GOTO kickoff 190 | 191 | ai: 192 | PRINT "COMPUTER MOVE" 193 | IF E<20 THEN fieldgoal 194 | IF D=4 THEN punt 195 | X=1 196 | Y=3+1 197 | N=RND 198 | IF E<50 THEN noshotrpass 199 | IF N=2 THEN shortpass 200 | noshotrpass: 201 | IF D<3 THEN run 202 | IF N=1 THEN longpass 203 | IF N=3 THEN run 204 | //ask my father how the computer should play 205 | 206 | gameover: 207 | IF A>B THEN wingame 208 | PRINT "COMPUTER WINS" 209 | END 210 | wingame: 211 | PRINT "YOU WIN" 212 | -------------------------------------------------------------------------------- /preprocessor/PROGRAM.BAS: -------------------------------------------------------------------------------- 1 | 1 X=1 2 | 2 Y=100+1 3 | 3 N=RND 4 | 4 IF N<50 THEN 9 5 | 5 PRINT "YOU LOST TOSS" 6 | 6 REM when O is 1 player is on the offence 0 is on deffence 7 | 7 O=0 8 | 8 GOTO 58 9 | 9 REM wintoss: 10 | 10 PRINT "YOU WON TOSS" 11 | 11 PRINT "[ENTER] TO CONTINUE" 12 | 12 INPUT Q 13 | 13 REM when O is 1 player is on the offence 0 is on deffence 14 | 14 O=1 15 | 15 GOTO 58 16 | 16 REM menu: 17 | 17 IF D=5 THEN 142 18 | 18 L=T 19 | 19 T=L+1 20 | 20 REM 120 downs in one game 21 | 21 IF T=120 THEN 192 22 | 22 REM info: 23 | 23 PRINT "Score,YOU,COMP:" 24 | 24 PRINT A 25 | 25 PRINT B 26 | 26 PRINT "[ENTER] TO CONTINUE" 27 | 27 INPUT Q 28 | 28 PRINT "Down,Yard:" 29 | 29 PRINT D 30 | 30 PRINT E 31 | 31 PRINT "[ENTER] TO CONTINUE" 32 | 32 INPUT Q 33 | 33 PRINT "1stDn,Turn of120:" 34 | 34 C=F-E 35 | 35 PRINT C 36 | 36 PRINT T 37 | 37 PRINT "[ENTER] TO CONTINUE" 38 | 38 INPUT Q 39 | 39 IF O=0 THEN 175 40 | 40 PTINT "1)LONG PASS 3)RUN" 41 | 41 PTINT "2)SHORTPASS 4)PUNT" 42 | 42 PTINT "5)FIELD GOAL6)INFO" 43 | 43 INPUT Q 44 | 44 X=1 45 | 45 Y=100 46 | 46 N=RND 47 | 47 IF Q=1 THEN 70 48 | 48 IF Q=2 THEN 76 49 | 49 IF Q=3 THEN 82 50 | 50 IF Q=4 THEN 88 51 | 51 IF Q=5 THEN 98 52 | 52 IF Q=6 THEN 22 53 | 53 PRINT "INCORRECT INPUT" 54 | 54 PRINT "MUST INPUT 1 TO 6" 55 | 55 PRINT "[ENTER] TO CONTINUE" 56 | 56 INPUT Q 57 | 57 GOTO 22 58 | 58 REM kickoff: 59 | 59 PRINT "KICKOFF" 60 | 60 PRINT "[ENTER] TO CONTINUE" 61 | 61 INPUT Q 62 | 62 REM E is for Yard, start the down with a distance from 1 to 30 63 | 63 Y=1 64 | 64 X=30+1 65 | 65 E=RND 66 | 66 F=E+10 67 | 67 REM D is for Down 68 | 68 D=1 69 | 69 GOTO 16 70 | 70 REM longpass: 71 | 71 PRINT "LONG PASS" 72 | 72 X=50 73 | 73 Y=100 74 | 74 IF N<10 THEN 125 75 | 75 GOTO 117 76 | 76 REM shortpass: 77 | 77 PRINT "SHORT PASS" 78 | 78 X=1 79 | 79 Y=50 80 | 80 IF N<25 THEN 125 81 | 81 GOTO 117 82 | 82 REM run: 83 | 83 PRINT "RUN" 84 | 84 X=1 85 | 85 Y=100 86 | 86 IF N<50 THEN 125 87 | 87 GOTO 117 88 | 88 REM punt: 89 | 89 REM I dont know how 88 works 90 | 90 PRINT "PUNT" 91 | 91 Y=1 92 | 92 X=50+1 93 | 93 E=RND 94 | 94 F=E+10 95 | 95 REM D is for Down 96 | 96 D=1 97 | 97 GOTO 142 98 | 98 REM fieldgoal: 99 | 99 PRINT "FIELD GOAL" 100 | 100 REM I gotta ask if this is corrrect, I think it it wrong 101 | 101 X=1 102 | 102 Y=100+1 103 | 103 N=RND 104 | 104 IF N<50 THEN 107 105 | 105 PRINT "FAILED" 106 | 106 GOTO 142 107 | 107 REM fielgoal125: 108 | 108 PRINT "SUCCEDED" 109 | 109 IF O=1 THEN 113 110 | 110 L=B 111 | 111 B=L+2 112 | 112 GOTO 142 113 | 113 REM add2pointsplayer: 114 | 114 L=A 115 | 115 A=L+2 116 | 116 GOTO 142 117 | 117 REM f175l: 118 | 118 PRINT "FAILED" 119 | 119 PRINT "[ENTER] TO CONTINUE" 120 | 120 INPUT Q 121 | 121 REM L is a temporary variable cause D=D+1 doesnt seem to work 122 | 122 L=D 123 | 123 D=L+1 124 | 124 GOTO 16 125 | 125 REM success: 126 | 126 PRINT "SUCCEDED" 127 | 127 PRINT "[ENTER] TO CONTINUE" 128 | 128 INPUT Q 129 | 129 N=RND 130 | 130 REM P is previous line of scrimmage 131 | 131 P=E 132 | 132 L=E 133 | 133 E=L+N 134 | 134 IF E>99 THEN 153 135 | 135 N=F+10 136 | 136 IF E>N THEN 149 137 | 137 REM L is a temporary variable cause D=D+1 doesnt seem to work 138 | 138 L=D 139 | 139 D=L+1 140 | 140 IF D>4 THEN 142 141 | 141 GOTO 16 142 | 142 REM ballchangesides: 143 | 143 IF O=1 THEN 146 144 | 144 O=1 145 | 145 GOTO 58 146 | 146 REM setdeffence: 147 | 147 O=0 148 | 148 GOTO 58 149 | 149 REM downone: 150 | 150 D=1 151 | 151 F=E+10 152 | 152 GOTO 16 153 | 153 REM touchdown: 154 | 154 PRINT "TOUCHDOWN!" 155 | 155 IF O=1 THEN 165 156 | 156 L=B 157 | 157 B=L+6 158 | 158 PRINT "EXTRA POINT" 159 | 159 X=1 160 | 160 Y=2 161 | 161 N=RND 162 | 162 L=B 163 | 163 B=L+N 164 | 164 GOTO 142 165 | 165 REM add6pointsplayer: 166 | 166 L=A 167 | 167 A=L+6 168 | 168 PRINT "EXTRA POINT" 169 | 169 X=1 170 | 170 Y=2 171 | 171 N=RND 172 | 172 L=A 173 | 173 A=L+N 174 | 174 GOTO 142 175 | 175 REM ai: 176 | 176 REM ask my father how the computer should play 177 | 177 PRINT "COMPUTER MOVE" 178 | 178 IF D<4 THEN 181 179 | 179 IF E>80 THEN 98 180 | 180 IF E<60 THEN 88 181 | 181 REM notfourth: 182 | 182 X=1 183 | 183 Y=3 184 | 184 N=RND 185 | 185 IF E<50 THEN 187 186 | 186 IF N=2 THEN 76 187 | 187 REM noshotrpass: 188 | 188 IF D<3 THEN 82 189 | 189 IF N=1 THEN 70 190 | 190 IF N=2 THEN 70 191 | 191 IF N=3 THEN 82 192 | 192 REM gameover: 193 | 193 PRINT "GameOver,YOU,COMP:" 194 | 194 PRINT A 195 | 195 PRINT B 196 | 196 PRINT "[ENTER] TO CONTINUE" 197 | 197 INPUT Q 198 | 198 IF A>B THEN 201 199 | 199 PRINT "COMPUTER WINS" 200 | 200 END 201 | 201 REM wingame: 202 | 202 PRINT "YOU WIN" 203 | -------------------------------------------------------------------------------- /preprocessor/quckbasicpreprocessor.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | prcessed=[] 4 | labels=[] 5 | linenums=[] 6 | filename=sys.argv[1] 7 | f = open(filename, "r") 8 | line="String"#line needs to be initiated to something, it should be over ridden later, if you see String in hte memory, then this didnt work properly 9 | linenumber=0 10 | while line: 11 | line = f.readline() 12 | if not line == '': 13 | linenumber+=1 14 | #x=line[len(line)-2:len(line)-1] 15 | #print "-"+x+"-" 16 | #raw_input() 17 | if line[len(line)-2:len(line)-1]==":": #found label 18 | prcessed.append(str(linenumber)+" REM "+line) 19 | labels.append(line[0:len(line)-2]) 20 | linenums.append(linenumber) 21 | else: #not a label 22 | prcessed.append(str(linenumber)+" "+line) 23 | f.close() 24 | print "POST-PROCESS:" 25 | postproc="" 26 | for line in prcessed: 27 | postproc=postproc+line 28 | print "LABELS:" 29 | for counter in range(0,len(labels)): 30 | postproc=postproc.replace(labels[counter],str(linenums[counter])) 31 | postproc=postproc.replace("REM "+str(linenums[counter]),"REM "+labels[counter]) 32 | print labels[counter]+ " " + str(linenums[counter]) 33 | print postproc 34 | print "WRITING PROGRAM.BAS" 35 | FILE = open("PROGRAM.BAS","w") 36 | FILE.write(postproc) 37 | FILE.close() 38 | -------------------------------------------------------------------------------- /preprocessor/readme.txt: -------------------------------------------------------------------------------- 1 | the preprocessor adds the lines and changes the labels to line numbers 2 | quckbasicpreprocessor.py converts labels to line numbers 3 | example usage: 4 | python quckbasicpreprocessor.py AmericanFootball.qb 5 | the new program will be stored in PROGRAM.BAS 6 | -------------------------------------------------------------------------------- /preprocessor/sor adds the lines and changes the labels to line numbers: -------------------------------------------------------------------------------- 1 | 2 | SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS 3 | 4 | Commands marked with * may be preceded by a number, _N. 5 | Notes in parentheses indicate the behavior if _N is given. 6 | 7 | h H Display this help. 8 | q :q Q :Q ZZ Exit. 9 | --------------------------------------------------------------------------- 10 | 11 | MMOOVVIINNGG 12 | 13 | e ^E j ^N CR * Forward one line (or _N lines). 14 | y ^Y k ^K ^P * Backward one line (or _N lines). 15 | f ^F ^V SPACE * Forward one window (or _N lines). 16 | b ^B ESC-v * Backward one window (or _N lines). 17 | z * Forward one window (and set window to _N). 18 | w * Backward one window (and set window to _N). 19 | ESC-SPACE * Forward one window, but don't stop at end-of-file. 20 | d ^D * Forward one half-window (and set half-window to _N). 21 | u ^U * Backward one half-window (and set half-window to _N). 22 | ESC-) RightArrow * Left one half screen width (or _N positions). 23 | ESC-( LeftArrow * Right one half screen width (or _N positions). 24 | F Forward forever; like "tail -f". 25 | r ^R ^L Repaint screen. 26 | R Repaint screen, discarding buffered input. 27 | --------------------------------------------------- 28 | Default "window" is the screen height. 29 | Default "half-window" is half of the screen height. 30 | --------------------------------------------------------------------------- 31 | 32 | SSEEAARRCCHHIINNGG 33 | 34 | /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. 35 | ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. 36 | n * Repeat previous search (for _N-th occurrence). 37 | N * Repeat previous search in reverse direction. 38 | ESC-n * Repeat previous search, spanning files. 39 | ESC-N * Repeat previous search, reverse dir. & spanning files. 40 | ESC-u Undo (toggle) search highlighting. 41 | &_p_a_t_t_e_r_n * Display only matching lines 42 | --------------------------------------------------- 43 | Search patterns may be modified by one or more of: 44 | ^N or ! Search for NON-matching lines. 45 | ^E or * Search multiple files (pass thru END OF FILE). 46 | ^F or @ Start search at FIRST file (for /) or last file (for ?). 47 | ^K Highlight matches, but don't move (KEEP position). 48 | ^R Don't use REGULAR EXPRESSIONS. 49 | --------------------------------------------------------------------------- 50 | 51 | JJUUMMPPIINNGG 52 | 53 | g < ESC-< * Go to first line in file (or line _N). 54 | G > ESC-> * Go to last line in file (or line _N). 55 | p % * Go to beginning of file (or _N percent into file). 56 | t * Go to the (_N-th) next tag. 57 | T * Go to the (_N-th) previous tag. 58 | { ( [ * Find close bracket } ) ]. 59 | } ) ] * Find open bracket { ( [. 60 | ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. 61 | ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_> 62 | --------------------------------------------------- 63 | Each "find close bracket" command goes forward to the close bracket 64 | matching the (_N-th) open bracket in the top line. 65 | Each "find open bracket" command goes backward to the open bracket 66 | matching the (_N-th) close bracket in the bottom line. 67 | 68 | m_<_l_e_t_t_e_r_> Mark the current position with . 69 | '_<_l_e_t_t_e_r_> Go to a previously marked position. 70 | '' Go to the previous position. 71 | ^X^X Same as '. 72 | --------------------------------------------------- 73 | A mark is any upper-case or lower-case letter. 74 | Certain marks are predefined: 75 | ^ means beginning of the file 76 | $ means end of the file 77 | --------------------------------------------------------------------------- 78 | 79 | CCHHAANNGGIINNGG FFIILLEESS 80 | 81 | :e [_f_i_l_e] Examine a new file. 82 | ^X^V Same as :e. 83 | :n * Examine the (_N-th) next file from the command line. 84 | :p * Examine the (_N-th) previous file from the command line. 85 | :x * Examine the first (or _N-th) file from the command line. 86 | :d Delete the current file from the command line list. 87 | = ^G :f Print current file name. 88 | --------------------------------------------------------------------------- 89 | 90 | MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS 91 | 92 | -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. 93 | --_<_n_a_m_e_> Toggle a command line option, by name. 94 | __<_f_l_a_g_> Display the setting of a command line option. 95 | ___<_n_a_m_e_> Display the setting of an option, by name. 96 | +_c_m_d Execute the less cmd each time a new file is examined. 97 | 98 | !_c_o_m_m_a_n_d Execute the shell command with $SHELL. 99 | |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. 100 | v Edit the current file with $VISUAL or $EDITOR. 101 | V Print version number of "less". 102 | --------------------------------------------------------------------------- 103 | 104 | OOPPTTIIOONNSS 105 | 106 | Most options may be changed either on the command line, 107 | or from within less by using the - or -- command. 108 | Options may be given in one of two forms: either a single 109 | character preceded by a -, or a name preceeded by --. 110 | 111 | -? ........ --help 112 | Display help (from command line). 113 | -a ........ --search-skip-screen 114 | Forward search skips current screen. 115 | -b [_N] .... --buffers=[_N] 116 | Number of buffers. 117 | -B ........ --auto-buffers 118 | Don't automatically allocate buffers for pipes. 119 | -c ........ --clear-screen 120 | Repaint by clearing rather than scrolling. 121 | -d ........ --dumb 122 | Dumb terminal. 123 | -D [_x_n_._n] . --color=_x_n_._n 124 | Set screen colors. (MS-DOS only) 125 | -e -E .... --quit-at-eof --QUIT-AT-EOF 126 | Quit at end of file. 127 | -f ........ --force 128 | Force open non-regular files. 129 | -F ........ --quit-if-one-screen 130 | Quit if entire file fits on first screen. 131 | -g ........ --hilite-search 132 | Highlight only last match for searches. 133 | -G ........ --HILITE-SEARCH 134 | Don't highlight any matches for searches. 135 | -h [_N] .... --max-back-scroll=[_N] 136 | Backward scroll limit. 137 | -i ........ --ignore-case 138 | Ignore case in searches that do not contain uppercase. 139 | -I ........ --IGNORE-CASE 140 | Ignore case in all searches. 141 | -j [_N] .... --jump-target=[_N] 142 | Screen position of target lines. 143 | -J ........ --status-column 144 | Display a status column at left edge of screen. 145 | -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] 146 | Use a lesskey file. 147 | -L ........ --no-lessopen 148 | Ignore the LESSOPEN environment variable. 149 | -m -M .... --long-prompt --LONG-PROMPT 150 | Set prompt style. 151 | -n -N .... --line-numbers --LINE-NUMBERS 152 | Don't use line numbers. 153 | -o [_f_i_l_e] . --log-file=[_f_i_l_e] 154 | Copy to log file (standard input only). 155 | -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] 156 | Copy to log file (unconditionally overwrite). 157 | -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] 158 | Start at pattern (from command line). 159 | -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] 160 | Define new prompt. 161 | -q -Q .... --quiet --QUIET --silent --SILENT 162 | Quiet the terminal bell. 163 | -r -R .... --raw-control-chars --RAW-CONTROL-CHARS 164 | Output "raw" control characters. 165 | -s ........ --squeeze-blank-lines 166 | Squeeze multiple blank lines. 167 | -S ........ --chop-long-lines 168 | Chop long lines. 169 | -t [_t_a_g] .. --tag=[_t_a_g] 170 | Find a tag. 171 | -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] 172 | Use an alternate tags file. 173 | -u -U .... --underline-special --UNDERLINE-SPECIAL 174 | Change handling of backspaces. 175 | -V ........ --version 176 | Display the version number of "less". 177 | -w ........ --hilite-unread 178 | Highlight first new line after forward-screen. 179 | -W ........ --HILITE-UNREAD 180 | Highlight first new line after any forward movement. 181 | -x [_N[,...]] --tabs=[_N[,...]] 182 | Set tab stops. 183 | -X ........ --no-init 184 | Don't use termcap init/deinit strings. 185 | --no-keypad 186 | Don't use termcap keypad init/deinit strings. 187 | -y [_N] .... --max-forw-scroll=[_N] 188 | Forward scroll limit. 189 | -z [_N] .... --window=[_N] 190 | Set size of window. 191 | -" [_c[_c]] . --quotes=[_c[_c]] 192 | Set shell quote characters. 193 | -~ ........ --tilde 194 | Don't display tildes after end of file. 195 | -# [_N] .... --shift=[_N] 196 | Horizontal scroll amount (0 = one half screen width) 197 | 198 | --------------------------------------------------------------------------- 199 | 200 | LLIINNEE EEDDIITTIINNGG 201 | 202 | These keys can be used to edit text being entered 203 | on the "command line" at the bottom of the screen. 204 | 205 | RightArrow ESC-l Move cursor right one character. 206 | LeftArrow ESC-h Move cursor left one character. 207 | CNTL-RightArrow ESC-RightArrow ESC-w Move cursor right one word. 208 | CNTL-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word. 209 | HOME ESC-0 Move cursor to start of line. 210 | END ESC-$ Move cursor to end of line. 211 | BACKSPACE Delete char to left of cursor. 212 | DELETE ESC-x Delete char under cursor. 213 | CNTL-BACKSPACE ESC-BACKSPACE Delete word to left of cursor. 214 | CNTL-DELETE ESC-DELETE ESC-X Delete word under cursor. 215 | CNTL-U ESC (MS-DOS only) Delete entire line. 216 | UpArrow ESC-k Retrieve previous command line. 217 | DownArrow ESC-j Retrieve next command line. 218 | TAB Complete filename & cycle. 219 | SHIFT-TAB ESC-TAB Complete filename & reverse cycle. 220 | CNTL-L Complete filename, list all. 221 | 222 | 223 | -------------------------------------------------------------------------------- /preprocessor/test.qb: -------------------------------------------------------------------------------- 1 | test: 2 | -------------------------------------------------------------------------------- /preprocessor/tored in PROGRAM.BAS: -------------------------------------------------------------------------------- 1 | 2 | SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS 3 | 4 | Commands marked with * may be preceded by a number, _N. 5 | Notes in parentheses indicate the behavior if _N is given. 6 | 7 | h H Display this help. 8 | q :q Q :Q ZZ Exit. 9 | --------------------------------------------------------------------------- 10 | 11 | MMOOVVIINNGG 12 | 13 | e ^E j ^N CR * Forward one line (or _N lines). 14 | y ^Y k ^K ^P * Backward one line (or _N lines). 15 | f ^F ^V SPACE * Forward one window (or _N lines). 16 | b ^B ESC-v * Backward one window (or _N lines). 17 | z * Forward one window (and set window to _N). 18 | w * Backward one window (and set window to _N). 19 | ESC-SPACE * Forward one window, but don't stop at end-of-file. 20 | d ^D * Forward one half-window (and set half-window to _N). 21 | u ^U * Backward one half-window (and set half-window to _N). 22 | ESC-) RightArrow * Left one half screen width (or _N positions). 23 | ESC-( LeftArrow * Right one half screen width (or _N positions). 24 | F Forward forever; like "tail -f". 25 | r ^R ^L Repaint screen. 26 | R Repaint screen, discarding buffered input. 27 | --------------------------------------------------- 28 | Default "window" is the screen height. 29 | Default "half-window" is half of the screen height. 30 | --------------------------------------------------------------------------- 31 | 32 | SSEEAARRCCHHIINNGG 33 | 34 | /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. 35 | ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. 36 | n * Repeat previous search (for _N-th occurrence). 37 | N * Repeat previous search in reverse direction. 38 | ESC-n * Repeat previous search, spanning files. 39 | ESC-N * Repeat previous search, reverse dir. & spanning files. 40 | ESC-u Undo (toggle) search highlighting. 41 | &_p_a_t_t_e_r_n * Display only matching lines 42 | --------------------------------------------------- 43 | Search patterns may be modified by one or more of: 44 | ^N or ! Search for NON-matching lines. 45 | ^E or * Search multiple files (pass thru END OF FILE). 46 | ^F or @ Start search at FIRST file (for /) or last file (for ?). 47 | ^K Highlight matches, but don't move (KEEP position). 48 | ^R Don't use REGULAR EXPRESSIONS. 49 | --------------------------------------------------------------------------- 50 | 51 | JJUUMMPPIINNGG 52 | 53 | g < ESC-< * Go to first line in file (or line _N). 54 | G > ESC-> * Go to last line in file (or line _N). 55 | p % * Go to beginning of file (or _N percent into file). 56 | t * Go to the (_N-th) next tag. 57 | T * Go to the (_N-th) previous tag. 58 | { ( [ * Find close bracket } ) ]. 59 | } ) ] * Find open bracket { ( [. 60 | ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. 61 | ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_> 62 | --------------------------------------------------- 63 | Each "find close bracket" command goes forward to the close bracket 64 | matching the (_N-th) open bracket in the top line. 65 | Each "find open bracket" command goes backward to the open bracket 66 | matching the (_N-th) close bracket in the bottom line. 67 | 68 | m_<_l_e_t_t_e_r_> Mark the current position with . 69 | '_<_l_e_t_t_e_r_> Go to a previously marked position. 70 | '' Go to the previous position. 71 | ^X^X Same as '. 72 | --------------------------------------------------- 73 | A mark is any upper-case or lower-case letter. 74 | Certain marks are predefined: 75 | ^ means beginning of the file 76 | $ means end of the file 77 | --------------------------------------------------------------------------- 78 | 79 | CCHHAANNGGIINNGG FFIILLEESS 80 | 81 | :e [_f_i_l_e] Examine a new file. 82 | ^X^V Same as :e. 83 | :n * Examine the (_N-th) next file from the command line. 84 | :p * Examine the (_N-th) previous file from the command line. 85 | :x * Examine the first (or _N-th) file from the command line. 86 | :d Delete the current file from the command line list. 87 | = ^G :f Print current file name. 88 | --------------------------------------------------------------------------- 89 | 90 | MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS 91 | 92 | -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. 93 | --_<_n_a_m_e_> Toggle a command line option, by name. 94 | __<_f_l_a_g_> Display the setting of a command line option. 95 | ___<_n_a_m_e_> Display the setting of an option, by name. 96 | +_c_m_d Execute the less cmd each time a new file is examined. 97 | 98 | !_c_o_m_m_a_n_d Execute the shell command with $SHELL. 99 | |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. 100 | v Edit the current file with $VISUAL or $EDITOR. 101 | V Print version number of "less". 102 | --------------------------------------------------------------------------- 103 | 104 | OOPPTTIIOONNSS 105 | 106 | Most options may be changed either on the command line, 107 | or from within less by using the - or -- command. 108 | Options may be given in one of two forms: either a single 109 | character preceded by a -, or a name preceeded by --. 110 | 111 | -? ........ --help 112 | Display help (from command line). 113 | -a ........ --search-skip-screen 114 | Forward search skips current screen. 115 | -b [_N] .... --buffers=[_N] 116 | Number of buffers. 117 | -B ........ --auto-buffers 118 | Don't automatically allocate buffers for pipes. 119 | -c ........ --clear-screen 120 | Repaint by clearing rather than scrolling. 121 | -d ........ --dumb 122 | Dumb terminal. 123 | -D [_x_n_._n] . --color=_x_n_._n 124 | Set screen colors. (MS-DOS only) 125 | -e -E .... --quit-at-eof --QUIT-AT-EOF 126 | Quit at end of file. 127 | -f ........ --force 128 | Force open non-regular files. 129 | -F ........ --quit-if-one-screen 130 | Quit if entire file fits on first screen. 131 | -g ........ --hilite-search 132 | Highlight only last match for searches. 133 | -G ........ --HILITE-SEARCH 134 | Don't highlight any matches for searches. 135 | -h [_N] .... --max-back-scroll=[_N] 136 | Backward scroll limit. 137 | -i ........ --ignore-case 138 | Ignore case in searches that do not contain uppercase. 139 | -I ........ --IGNORE-CASE 140 | Ignore case in all searches. 141 | -j [_N] .... --jump-target=[_N] 142 | Screen position of target lines. 143 | -J ........ --status-column 144 | Display a status column at left edge of screen. 145 | -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] 146 | Use a lesskey file. 147 | -L ........ --no-lessopen 148 | Ignore the LESSOPEN environment variable. 149 | -m -M .... --long-prompt --LONG-PROMPT 150 | Set prompt style. 151 | -n -N .... --line-numbers --LINE-NUMBERS 152 | Don't use line numbers. 153 | -o [_f_i_l_e] . --log-file=[_f_i_l_e] 154 | Copy to log file (standard input only). 155 | -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] 156 | Copy to log file (unconditionally overwrite). 157 | -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] 158 | Start at pattern (from command line). 159 | -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] 160 | Define new prompt. 161 | -q -Q .... --quiet --QUIET --silent --SILENT 162 | Quiet the terminal bell. 163 | -r -R .... --raw-control-chars --RAW-CONTROL-CHARS 164 | Output "raw" control characters. 165 | -s ........ --squeeze-blank-lines 166 | Squeeze multiple blank lines. 167 | -S ........ --chop-long-lines 168 | Chop long lines. 169 | -t [_t_a_g] .. --tag=[_t_a_g] 170 | Find a tag. 171 | -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] 172 | Use an alternate tags file. 173 | -u -U .... --underline-special --UNDERLINE-SPECIAL 174 | Change handling of backspaces. 175 | -V ........ --version 176 | Display the version number of "less". 177 | -w ........ --hilite-unread 178 | Highlight first new line after forward-screen. 179 | -W ........ --HILITE-UNREAD 180 | Highlight first new line after any forward movement. 181 | -x [_N[,...]] --tabs=[_N[,...]] 182 | Set tab stops. 183 | -X ........ --no-init 184 | Don't use termcap init/deinit strings. 185 | --no-keypad 186 | Don't use termcap keypad init/deinit strings. 187 | -y [_N] .... --max-forw-scroll=[_N] 188 | Forward scroll limit. 189 | -z [_N] .... --window=[_N] 190 | Set size of window. 191 | -" [_c[_c]] . --quotes=[_c[_c]] 192 | Set shell quote characters. 193 | -~ ........ --tilde 194 | Don't display tildes after end of file. 195 | -# [_N] .... --shift=[_N] 196 | Horizontal scroll amount (0 = one half screen width) 197 | 198 | --------------------------------------------------------------------------- 199 | 200 | LLIINNEE EEDDIITTIINNGG 201 | 202 | These keys can be used to edit text being entered 203 | on the "command line" at the bottom of the screen. 204 | 205 | RightArrow ESC-l Move cursor right one character. 206 | LeftArrow ESC-h Move cursor left one character. 207 | CNTL-RightArrow ESC-RightArrow ESC-w Move cursor right one word. 208 | CNTL-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word. 209 | HOME ESC-0 Move cursor to start of line. 210 | END ESC-$ Move cursor to end of line. 211 | BACKSPACE Delete char to left of cursor. 212 | DELETE ESC-x Delete char under cursor. 213 | CNTL-BACKSPACE ESC-BACKSPACE Delete word to left of cursor. 214 | CNTL-DELETE ESC-DELETE ESC-X Delete word under cursor. 215 | CNTL-U ESC (MS-DOS only) Delete entire line. 216 | UpArrow ESC-k Retrieve previous command line. 217 | DownArrow ESC-j Retrieve next command line. 218 | TAB Complete filename & cycle. 219 | SHIFT-TAB ESC-TAB Complete filename & reverse cycle. 220 | CNTL-L Complete filename, list all. 221 | 222 | 223 | -------------------------------------------------------------------------------- /readme: -------------------------------------------------------------------------------- 1 | for infor look at the documentation page ADD LATER 2 | --------------------------------------------------------------------------------