├── .gitignore ├── IntyBASIC.cpp ├── IntyBASIC.m ├── LICENSE ├── Makefile ├── ReadMe.txt ├── code.cpp ├── code.h ├── contrib ├── 42k.bas ├── AppleCatcher.bas ├── ColouredSquares.bas ├── Gram2GromFont.bas ├── IntySmap.c ├── TinyFont.bas ├── accel.bas ├── clowns.bas ├── constants.bas ├── hello.bas ├── intbas.pl ├── intro.bas ├── keypad.bas └── tcg.bas ├── global.h ├── intybasic_epilogue.asm ├── intybasic_prologue.asm ├── manual.txt ├── microcode.cpp ├── microcode.h ├── node.cpp ├── node.h └── samples ├── banks.bas ├── bats.bas ├── constants.bas ├── controller.bas ├── envelope.bas ├── flash.bas ├── frame.bas ├── game1.bas ├── game2.bas ├── lander.bas ├── landscape.bas ├── landscape.bmp ├── music.bas ├── pak.bas ├── pumpkin_master.bas ├── rain.bas ├── sample.bmp ├── screen.bas ├── scroll.bas ├── segments.bas ├── sprites.bas ├── test.bas ├── title.bas ├── voice.bas ├── woman.bas └── woman.bmp /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | *.pbxuser 6 | *.mode1v3 7 | *.mode2v3 8 | *.perspectivev3 9 | *.xcuserstate 10 | project.xcworkspace/ 11 | xcuserdata/ 12 | 13 | # Generated files 14 | *.o 15 | intybasic 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | IntyBASIC compiler 2 | Copyright (c) 2014 Oscar Toledo G. http://nanochess.org/ 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | OBJS= node.o microcode.o code.o IntyBASIC.o 2 | CXXFLAGS= -O2 3 | 4 | intybasic: $(OBJS) 5 | $(CXX) -o $@ $(OBJS) 6 | 7 | node.o: node.cpp global.h microcode.h code.h node.h 8 | 9 | microcode.o: microcode.cpp global.h microcode.h 10 | 11 | code.o: code.cpp global.h microcode.h code.h 12 | 13 | IntyBASIC.o: IntyBASIC.cpp global.h microcode.h code.h node.h 14 | 15 | man: intybasic 16 | help2man --no-discard-stderr --name="BASIC language cross-compiler for the Intellivision" --no-info --output=$?.1 ./$? 17 | 18 | 19 | clean: 20 | $(RM) $(OBJS) 21 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- 1 | IntyBASIC compiler v1.5.1 2 | (c) Copyright 2014-2025 Óscar Toledo Gutiérrez 3 | http://nanochess.org/ 4 | 5 | BASIC language cross-compiler for the Intellivision. 6 | 7 | IntyBASIC.cpp The IntyBASIC compiler C++ language source code 8 | LICENSE Source code license 9 | 10 | intybasic_prologue.asm Prologue file needed for compiled programs 11 | intybasic_epilogue.asm Epilogue file needed for compiled programs 12 | 13 | IntyBASIC.m A version of IntyBASIC written in Objective-C 14 | (not maintained, I wrote it for learning purposes) 15 | 16 | manual.txt English manual for IntyBASIC 17 | manual_es.txt Spanish manual for IntyBASIC 18 | 19 | ReadMe.txt This file. 20 | 21 | 22 | >>>>>>>>>>>>>> Usage guide 23 | 24 | intybasic [--jlp] [--cc3] [--title \"title\"] infile.bas outfile.asm [library_path] 25 | 26 | --jlp Enables use of 8K-words extra memory feature of JLP 27 | and also usage of hardware acceleration for 28 | multiplication and division. 29 | --cc3 Enables use of 8K-words extra memory feature of 30 | Cuttle Cart 3. 31 | --cc3 0xc000 Enables Cuttle Cart 3 in selected page, useful 32 | with Keyboard Component. 33 | --title "a" Selects title of the compiled program. 34 | By default this is "IntyBASIC program". 35 | Only appears in emulators/multicarts. 36 | -w Disable warnings globally (has priority over 37 | OPTION WARNINGS) 38 | 39 | The library path is where the intybasic_prologue.asm and 40 | intybasic_epilogue.asm files are searched for inclusion. 41 | 42 | It will return a zero error code if compilation was successful and 43 | non-zero otherwise. 44 | 45 | 46 | >>>>>>>>>>>>>> Notes 47 | 48 | The current official version is v1.5.0. 49 | 50 | Also look for the swiss-knife companion tool IntyColor for converting BMP 51 | images to IntyBASIC data. Located at: 52 | 53 | https://github.com/nanochess/IntyColor 54 | 55 | 56 | >>>>>>>>>>>>>> Acknowledgments 57 | 58 | Thanks to following members of Atariage for contributing valuable suggestions, 59 | test programs and even support libraries: 60 | 61 | Albert 62 | artrag 63 | atari2600land 64 | awhite2600 65 | carlsson 66 | catsfolly 67 | ckblackm 68 | CrazyBoss 69 | Cybearg 70 | DZ-Jay 71 | First Spear 72 | freewheel 73 | GroovyBee 74 | intvnut 75 | Jess Ragan 76 | Kiwi 77 | mmarrero 78 | RevEng 79 | SpiceWare 80 | Tarzilla 81 | 82 | 83 | >>>>>>>>>>>>>> Supporting the developer 84 | 85 | If you find IntyBASIC useful, please show your appreciation making a donation 86 | via Paypal ($9 USD suggested) to b-i+y-u+b-i (at) gmail.com 87 | 88 | If you find a bug, please report to same email and I'll try to look into 89 | it. Because lack of time I cannot guarantee it will be corrected. 90 | 91 | Also you can get the book "Programming Games for Intellivision" that is a book 92 | version of the manual, and also including an introductory course to game 93 | programming with full examples and source code: Game of Ball, Monkey Moon, 94 | Space Raider & Bouncy Cube. 95 | 96 | Paperback: 97 | https://www.lulu.com/en/en/shop/oscar-toledo-gutierrez/programming-games-for-intellivision/paperback/product-1p7mvg87.html 98 | 99 | Hardcover: 100 | https://www.lulu.com/en/en/shop/oscar-toledo-gutierrez/programming-games-for-intellivision/hardcover/product-16ye5m5n.html 101 | 102 | Ebook: 103 | https://nanochess.org/store.html 104 | -------------------------------------------------------------------------------- /code.h: -------------------------------------------------------------------------------- 1 | // 2 | // code.h 3 | // intybasic 4 | // 5 | // Created by Oscar Toledo on 07/01/16. 6 | // Copyright (c) 2016 Oscar Toledo. All rights reserved. 7 | // 8 | 9 | #ifndef _intybasic_code_ 10 | #define _intybasic_code_ 11 | 12 | // 13 | // Intermediate code generator with peephole optimization. 14 | // 15 | class code { 16 | 17 | list everything; 18 | 19 | int cycles; 20 | 21 | // Relates which registers contain which constants or addresses. 22 | struct { 23 | int valid; // This content is valid. 24 | string prefix; // Refers to this prefix label... (empty string for value) 25 | int value; // ...contains this label number or value... 26 | int offset; // ...plus this offset. 27 | } register_content[8]; 28 | 29 | int flags_valid; // Which flags are valid currently. 30 | int flags_register; // Which register evaluation is in flags. 31 | 32 | bool subexpression_valid; // Subexpression in r3 is valid... 33 | int subexpression_base; 34 | int subexpression_offset; 35 | int subexpression_index; 36 | 37 | // Relates which registers are in which memory locations 38 | struct { 39 | int valid; // This content is valid 40 | string prefix; 41 | int value; 42 | int offset; 43 | } register_memory[8]; 44 | 45 | // Envelope for code trying to avoid PUSH/PULR 46 | list subeverything; // This sounds so deep 47 | int push_register; 48 | 49 | public: 50 | code(void); 51 | bool subexpression_available(int base, int offset, int index); 52 | void annotate_subexpression(int base, int offset, int index); 53 | void trash_registers(void); 54 | void trash_partial(int r); 55 | void check_for_cycles(int how_many, int limit); 56 | void push(int r); 57 | void pop(void); 58 | void emit_256(int r1); 59 | void emit(enum opcode type); 60 | void emit_r(enum opcode type, int r1); 61 | void emit_rr(enum opcode type, int r1, int r2); 62 | void emit_nr(enum opcode type, string prefix, int value, int r); 63 | void emit_nor(enum opcode type, string prefix, int value, int offset, int r); 64 | void emit_lr(enum opcode type, string prefix, int value, int r); 65 | void emit_lor(enum opcode type, string prefix, int value, int offset, int r); 66 | void emit_rl(enum opcode type, int r, string prefix, int value); 67 | void emit_rlo8(enum opcode type, int r, string prefix, int value, int offset); 68 | void emit_rlo(enum opcode type, int r, string prefix, int value, int offset); 69 | void emit_a(enum opcode type, string prefix, int value); 70 | void emit_s(enum opcode type, int r, int s); 71 | void emit_m(enum opcode type, int r1, int r2, int v); 72 | void emit_l(string prefix, int value); 73 | void emit_l3(string prefix, int value); 74 | void emit_d(enum opcode type, int d); 75 | void emit_d2(enum opcode type, int d1, int d2); 76 | void emit_dl(enum opcode type, string prefix, int value); 77 | void emit_dlo(enum opcode type, string prefix, int value, int offset); 78 | void emit_literal(string text); 79 | void emit_nnr(enum opcode type, int r, int array1, int array2, int diff); 80 | void dump(void); 81 | }; 82 | 83 | #endif /* defined(_intybasic_code_) */ 84 | -------------------------------------------------------------------------------- /contrib/42k.bas: -------------------------------------------------------------------------------- 1 | REM Module: 42K.BAS 2 | REM 3 | REM Description: A template for creating the largest ROM possible (42K DECLES) 4 | REM without using bank switching. 5 | REM Author: Mark Ball 6 | REM Date: 20/08/15 7 | REM Version: 1.00F 8 | REM 9 | REM HISTORY 10 | REM ------- 11 | REM 1.00F 20/08/15 - First release 12 | REM 1.01F 20/08/15 - Moved ROM segments around so that IntyBASIC epilogue 13 | REM code will be appended in a segment with only compiled 14 | REM IntyBASIC code in it. 15 | REM 1.02F 21/08/15 - Fixed procedure name typo. 16 | REM 17 | 18 | REM ------------------------------------------------------------------------- 19 | REM 42K ROM memory map 20 | REM ------------------------------------------------------------------------- 21 | REM SEGMENT ADDRESS RANGE SIZE NOTES 22 | REM ======= ============== ===== ===== 23 | REM 0 $5000 to $6FFF $2000 - Default segment 24 | REM 1 $A000 to $BFFF $2000 25 | REM 2 $C040 to $FFFF $3FC0 - Avoid STIC aliasing. 26 | REM 3 $2100 to $2FFF $0F00 27 | REM 4 $7100 to $7FFF $0F00 - Avoid EXEC's ECS ROM probe. 28 | REM 5 $4810 to $4FFF $0800 - Account for game's ECS ROM mapping out code. 29 | REM ------------------------------------------------------------------------- 30 | 31 | ' We need some important constants. 32 | include "CONSTANTS.BAS" 33 | 34 | REM ------------------------------------------------------------------------- 35 | REM START OF ROM SEGMENT 0 ($5000 to $6FFF) - Default 36 | REM ------------------------------------------------------------------------- 37 | sound 5,0 ' Ensure ECS ROMs are mapped out. 38 | 39 | cls ' Clear the screen. 40 | 41 | gosub PROC0 ' This procedure is located in segment 0. 42 | gosub PROC1 ' This procedure is located in segment 1. 43 | gosub PROC2 ' This procedure is located in segment 2. 44 | gosub PROC3 ' This procedure is located in segment 3. 45 | gosub PROC4 ' This procedure is located in segment 4. 46 | gosub PROC5 ' This procedure is located in segment 5. 47 | 48 | loop: 49 | wait 50 | goto loop 51 | 52 | PROC0: PROCEDURE 53 | print at screenpos(0,0), "This is segment 0" 54 | return 55 | END 56 | 57 | REM ------------------------------------------------------------------------- 58 | REM END OF ROM SEGMENT 0 59 | REM ------------------------------------------------------------------------- 60 | 61 | REM ------------------------------------------------------------------------- 62 | REM START OF ROM SEGMENT 1 ($A000 to $BFFF). 63 | REM ------------------------------------------------------------------------- 64 | asm org $A000 65 | 66 | PROC1: PROCEDURE 67 | print at screenpos(0,1), "This is segment 1" 68 | return 69 | END 70 | 71 | REM ------------------------------------------------------------------------- 72 | REM END OF ROM SEGMENT 1 73 | REM ------------------------------------------------------------------------- 74 | 75 | REM ------------------------------------------------------------------------- 76 | REM START OF ROM SEGMENT 2 ($C040 to $FFFF). 77 | REM ------------------------------------------------------------------------- 78 | asm org $C040 79 | 80 | PROC2: PROCEDURE 81 | print at screenpos(0,2), "This is segment 2" 82 | return 83 | END 84 | 85 | REM ------------------------------------------------------------------------- 86 | REM END OF ROM SEGMENT 2 87 | REM ------------------------------------------------------------------------- 88 | 89 | REM ------------------------------------------------------------------------- 90 | REM START OF ROM SEGMENT 3 ($2100 to $2FFF). 91 | REM ------------------------------------------------------------------------- 92 | asm org $2100 93 | 94 | PROC3: PROCEDURE 95 | print at screenpos(0,3), "This is segment 3" 96 | return 97 | END 98 | 99 | REM ------------------------------------------------------------------------- 100 | REM END OF ROM SEGMENT 3 101 | REM ------------------------------------------------------------------------- 102 | 103 | REM ------------------------------------------------------------------------- 104 | REM START OF ROM SEGMENT 5 ($4810 to $4FFF). 105 | REM ------------------------------------------------------------------------- 106 | asm org $4810 107 | 108 | PROC5: PROCEDURE 109 | print at screenpos(0,5), "This is segment 5" 110 | return 111 | END 112 | 113 | REM ------------------------------------------------------------------------- 114 | REM END OF ROM SEGMENT 5 115 | REM ------------------------------------------------------------------------- 116 | 117 | REM ------------------------------------------------------------------------- 118 | REM START OF ROM SEGMENT 4 ($7100 to $7FFF). 119 | REM Notes 120 | REM ----- 121 | REM 1) Keep this as the last segment so that the IntyBASIC epilogue code is 122 | REM appended to the end of this segment. 123 | REM ------------------------------------------------------------------------- 124 | asm org $7100 125 | 126 | PROC4: PROCEDURE 127 | print at screenpos(0,4), "This is segment 4" 128 | return 129 | END 130 | 131 | REM ------------------------------------------------------------------------- 132 | REM END OF ROM SEGMENT 4 133 | REM ------------------------------------------------------------------------- 134 | -------------------------------------------------------------------------------- /contrib/AppleCatcher.bas: -------------------------------------------------------------------------------- 1 | 'Apple catching 2 | 3 | REM Include useful predefined constants 4 | INCLUDE "constants.bas" 5 | 6 | reset: 7 | cls 8 | print at SCREENPOS(0, 4) color CS_RED,"Apple Catching Game" 9 | print at SCREENPOS(0, 5) color CS_RED," v0.1" 10 | print at SCREENPOS(0, 9) color CS_RED,"Made by Kiwi" 11 | print at SCREENPOS(0, 10) color CS_RED,"IntyBASIC by" 12 | print at SCREENPOS(0, 11) color CS_RED,"nanochess" 13 | title: 14 | IF cont1.button THEN goto start 15 | goto title 16 | start: 17 | wait 18 | define DEF00,2,basket 19 | wait 20 | define DEF02,2,apple 21 | wait 22 | define DEF04,2,worm 23 | wait 24 | define DEF16,15,tiles 25 | wait 26 | wait 27 | wait 28 | POKE $2C,$00 29 | POKE $28,$04 30 | POKE $29,$0b 31 | POKE $2A,$01 32 | POKE $2B,$0f 33 | 'POKE $32,$01 34 | cls 35 | 36 | gosub background1 37 | 38 | 'print at SCREENPOS(0, 0) color CS_BLUE,"\274\275\276\277\278\279\280\281\282\283\284\285\286\287\288\289" 39 | print at SCREENPOS(4, 11) color CS_LIGHTBLUE + CS_ADVANCE,"\256" 40 | 'print at SCREENPOS(16, 11) color CS_PINK,"\274\274\274\274" 41 | print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\273" 42 | 43 | 44 | #score=0 45 | lives=3 46 | applecount=0 47 | basketx=80 48 | baskety=80 49 | applex=RAND/2+20 50 | appley=40 51 | applep=0 52 | gravity=0 53 | time1=16 54 | time1max=16 55 | time2=3 56 | time2max=3 57 | hardness=0 58 | wormchance=10 59 | #univclock=0 60 | #nextlife=250 61 | univtick=0 62 | worm=0 63 | gosub writescore 64 | gosub drawheart 65 | 66 | gameloop1: 67 | 'POKE $2C,hardness 68 | if COL2 AND $3 then if worm=0 then #score=#score+1:applecount=applecount+1:gosub applecaught:gosub drawapple:gosub writescore 69 | if COL2 AND $3 then if worm=15 then gosub checkcount:applecount=0:gosub applecaught:gosub drawapple 70 | 71 | if applecount>11 then gosub basketfull:#score=#score+9:gosub writescore 72 | if #score>#nextlife then lives=lives+1:#nextlife=#nextlife+#nextlife:gosub drawheart 73 | sprite 0,basketx+VISIBLE+HIT+ZOOMX2,baskety+ZOOMY2, SPR00+SPR_ORANGE 74 | sprite 1,basketx+VISIBLE+HIT+ZOOMX2,baskety+ZOOMY2, SPR01+SPR_BROWN 75 | sprite 2,applex+VISIBLE+HIT,appley+DOUBLEY, SPR02+SPR_PURPLE+worm 76 | 77 | if time2=1 then appley=appley+applep 78 | 79 | if cont1.left then if basketx>20 then basketx=basketx-3 80 | if cont1.right then if basketx<138 then basketx=basketx+3 81 | 82 | if time1=1 then applep=applep+1 83 | 84 | if appley>96 then wormchance=wormchance+2:gosub applecaught 85 | 86 | univtick=univtick+1 87 | 'if univtick=55 then POKE $2C,$0f 88 | 'if univtick=59 then POKE $2C,hardness 89 | if wormchance>245 then wormchance=230 90 | if #univclock=60 then gosub secretbonus 91 | if univtick=60 then wormchance=wormchance+4:univtick=0:#univclock=#univclock+1 92 | if lives=0 then POKE $29,$02:print at 105 color 4,"Game Over":goto end 93 | time2=time2-1 94 | if time2=0 then time2=time2max 95 | time1=time1-1 96 | if time1=0 then time1=time1max 97 | wait 98 | goto gameloop1 99 | 100 | 101 | end: 102 | IF cont1.button THEN goto reset 103 | goto end 104 | 105 | 106 | drawapple:procedure 107 | wait 108 | print at SCREENPOS(4, 11) color CS_LIGHTBLUE + CS_ADVANCE,"\256" 109 | if applecount= 0 then print at SCREENPOS(5, 11) color CS_RED," " 110 | if applecount= 1 then print at SCREENPOS(5, 11) color CS_RED,"\272 " 111 | if applecount= 2 then print at SCREENPOS(5, 11) color CS_RED,"\272\272 " 112 | if applecount= 3 then print at SCREENPOS(5, 11) color CS_RED,"\272\272\272 " 113 | if applecount= 4 then print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272 " 114 | if applecount= 5 then print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272 " 115 | if applecount= 6 then #score=#score+1:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272 " 116 | if applecount= 7 then #score=#score+1:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272\272 " 117 | if applecount= 8 then #score=#score+2:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272\272\272 " 118 | if applecount= 9 then #score=#score+2:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272\272\272\272 " 119 | if applecount=10 then #score=#score+3:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272\272\272\272\272 " 120 | if applecount=11 then #score=#score+3:print at SCREENPOS(5, 11) color CS_RED,"\272\272\272\272\272\272\272\272\272\272\272" 121 | return 122 | end 123 | 124 | applecaught: procedure 125 | 'if worm=15 then applecount=0:wait:drawapple 126 | appley=20 127 | applep=1 128 | applex=RAND/2+20 129 | wait 130 | x=rand 131 | if xCS_WHITE then b=CS_BLACK 172 | wait 173 | next a 174 | for a=0 to 60 175 | print at SCREENPOS(5, 11) color b,"ENDURANCE " 176 | b=b+1 177 | if b>CS_WHITE then b=CS_BLACK 178 | wait 179 | next a 180 | for a=0 to 60 181 | print at SCREENPOS(5, 11) color b," BONUS " 182 | b=b+1 183 | if b>CS_WHITE then b=CS_BLACK 184 | wait 185 | next a 186 | for a=0 to 90 187 | print at SCREENPOS(5, 11) color b,"100 POINTS " 188 | b=b+1 189 | if b>CS_WHITE then b=CS_BLACK 190 | wait 191 | next a 192 | #score=#score+100 193 | gosub writescore 194 | print at SCREENPOS(5, 11) color CS_RED," " 195 | hardness=hardness+1 196 | gosub difftier 197 | applecount=0 198 | return 199 | end 200 | difftier: procedure 201 | wormchance=20 202 | #univclock=0 203 | if hardness=0 then time1max=16:time2max=3 204 | if hardness=1 then time1max=15:time2max=3 205 | if hardness=2 then time1max=14:time2max=3 206 | if hardness=3 then time1max=13:time2max=3 207 | if hardness=4 then time1max=12:time2max=3 208 | if hardness=5 then time1max=11:time2max=3 209 | if hardness=6 then time1max=10:time2max=3 210 | if hardness=7 then time1max=16:time2max=2 211 | if hardness=8 then time1max=14:time2max=2 212 | if hardness=9 then time1max=12:time2max=2 213 | if hardness=10 then time1max=10:time2max=2 214 | if hardness=11 then time1max=9:time2max=2 215 | if hardness=12 then time1max=8:time2max=2 216 | if hardness=13 then time1max=12:time2max=1 217 | if hardness=14 then time1max=11:time2max=1 218 | if hardness=15 then time1max=10:time2max=1 219 | if hardness=16 then time1max=9:time2max=1 220 | if hardness=17 then time1max=8:time2max=1 221 | if hardness=18 then time1max=7:time2max=1 222 | if hardness=19 then time1max=6:time2max=1 223 | if hardness=20 then time1max=5:time2max=1 224 | if hardness=21 then time1max=4:time2max=1 225 | if hardness=22 then time1max=3:time2max=1 226 | if hardness=23 then time1max=2:time2max=1 227 | if hardness=24 then wormchance=30 228 | if hardness=25 then wormchance=40 229 | if hardness=26 then wormchance=50 230 | if hardness=27 then wormchance=60 231 | if hardness=28 then wormchance=70 232 | if hardness=29 then wormchance=80 233 | if hardness=30 then wormchance=90 234 | if hardness=31 then wormchance=120 235 | if hardness=32 then wormchance=150:hardness=31 236 | wait 237 | POKE $2C,hardness 238 | return 239 | end 240 | 241 | drawheart:procedure 242 | POKE $2B,$02 243 | wait 244 | if lives=1 then print at SCREENPOS(16, 11) color CS_PINK,"\274\274\274\274":print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\274" 245 | if lives=2 then print at SCREENPOS(16, 11) color CS_PINK,"\273\274\274\274":print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\273" 246 | if lives=3 then print at SCREENPOS(16, 11) color CS_PINK,"\273\273\274\274":print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\273" 247 | if lives=4 then print at SCREENPOS(16, 11) color CS_PINK,"\273\273\273\274":print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\273" 248 | if lives=5 then print at SCREENPOS(16, 11) color CS_PINK,"\273\273\273\273":print at SCREENPOS(16, 11) color CS_PINK + CS_ADVANCE,"\273" 249 | wait 250 | POKE $2B,$0f 251 | return 252 | end 253 | 254 | checkcount:procedure 255 | if applecount=0 then lives=lives-1:gosub drawheart 256 | return 257 | end 258 | 259 | background1:procedure 260 | for a=SCREENPOS(0, 1) to SCREENPOS(18, 1) step 2 261 | print at a color CS_PURPLE,"\275\281" 262 | next a 263 | 264 | for a=SCREENPOS(0, 0) to SCREENPOS(18, 0) step 2 265 | print at a color CS_GREEN,"\279\280" 266 | next a 267 | 268 | for a=SCREENPOS(0, 2) to SCREENPOS(19, 2) 269 | print at a color CS_BLACK,"\275" 270 | next a 271 | 272 | for a=SCREENPOS(0, 3) to SCREENPOS(18, 3) step 2 273 | print at a color CS_BLACK,"\277\278" 274 | next a 275 | 276 | for a=SCREENPOS(0, 4) to SCREENPOS(19, 4) 277 | print at a color CS_BLACK,"\276" 278 | next a 279 | 280 | for a=SCREENPOS(0, 10) to SCREENPOS(19, 10) 281 | print at a color CS_BLACK,"\286" 282 | next a 283 | 284 | 285 | 286 | for a=SCREENPOS(8, 3) to SCREENPOS(11, 9) step BACKGROUND_COLUMNS 287 | print at a color CS_YELLOW,"\282\283\284\285" 288 | next a 289 | 290 | print at SCREENPOS(0, 4) color CS_ADVANCE,"\276" 291 | 'print at SCREENPOS(1, 3) color CS_GRAY + CS_ADVANCE,"\275" 292 | 'print at SCREENPOS(2, 3) color CS_GRAY + CS_ADVANCE,"\275" 293 | 'print at SCREENPOS(3, 3) color CS_GRAY + CS_ADVANCE,"\275" 294 | return 295 | end 296 | 297 | 298 | basket: 299 | BITMAP "########" 300 | BITMAP ".#.#.#.#" 301 | BITMAP "#.#.#.#." 302 | BITMAP ".#.#.#.#" 303 | BITMAP "#.#.#.#." 304 | BITMAP ".#.#.#.." 305 | BITMAP "..#.#.#." 306 | BITMAP ".######." 307 | 308 | BITMAP "########" 309 | BITMAP "#.#.#.#." 310 | BITMAP ".#.#.#.#" 311 | BITMAP "#.#.#.#." 312 | BITMAP ".#.#.#.#" 313 | BITMAP "..#.#.#." 314 | BITMAP ".#.#.#.." 315 | BITMAP ".######." 316 | apple: 317 | 318 | BITMAP ".....#.." 319 | BITMAP ".##.#..." 320 | BITMAP "####.##." 321 | BITMAP "########" 322 | BITMAP "########" 323 | BITMAP "########" 324 | BITMAP "########" 325 | BITMAP "########" 326 | 327 | BITMAP "########" 328 | BITMAP "########" 329 | BITMAP "########" 330 | BITMAP "########" 331 | BITMAP "#######." 332 | BITMAP ".######." 333 | BITMAP ".######." 334 | BITMAP ".##..#.." 335 | 336 | worm: 337 | 338 | BITMAP ".....##." 339 | BITMAP "....###." 340 | BITMAP "...###.." 341 | BITMAP "..###..." 342 | BITMAP ".###...." 343 | BITMAP ".##....." 344 | BITMAP ".###...." 345 | BITMAP "..###..." 346 | 347 | BITMAP "...###.." 348 | BITMAP "....###." 349 | BITMAP ".....#.." 350 | BITMAP "...#...#" 351 | BITMAP "....###." 352 | BITMAP "...#.#.#" 353 | BITMAP "...#.#.#" 354 | BITMAP "....###." 355 | 356 | tiles: 357 | 'apple icon 358 | BITMAP ".....#.." 359 | BITMAP "....#..." 360 | BITMAP "..##.##." 361 | BITMAP ".#######" 362 | BITMAP ".#######" 363 | BITMAP ".#######" 364 | BITMAP "..#####." 365 | BITMAP "..##.##." 366 | 'heart icon 367 | BITMAP "........" 368 | BITMAP ".##.##.." 369 | BITMAP "#.##.##." 370 | BITMAP "#######." 371 | BITMAP ".#####.." 372 | BITMAP "..###..." 373 | BITMAP "...#...." 374 | BITMAP "........" 375 | 'empty heart icon 376 | BITMAP "........" 377 | BITMAP ".##.##.." 378 | BITMAP "##.##.#." 379 | BITMAP "#.....#." 380 | BITMAP ".#...#.." 381 | BITMAP "..#.#..." 382 | BITMAP "...#...." 383 | BITMAP "........" 384 | 385 | 'background tiles 386 | BITMAP "........" 387 | BITMAP "........" 388 | BITMAP "........" 389 | BITMAP "........" 390 | BITMAP "........" 391 | BITMAP "........" 392 | BITMAP "........" 393 | BITMAP "........" 394 | 395 | BITMAP "########" 396 | BITMAP "########" 397 | BITMAP "########" 398 | BITMAP "########" 399 | BITMAP "########" 400 | BITMAP "########" 401 | BITMAP "########" 402 | BITMAP "########" 403 | 404 | 405 | 'bottom tree left 406 | 407 | BITMAP "........" 408 | BITMAP "........" 409 | BITMAP "........" 410 | BITMAP "........" 411 | BITMAP "........" 412 | BITMAP "#......#" 413 | BITMAP "##...###" 414 | BITMAP "########" 415 | 'bottom tree right 416 | BITMAP "........" 417 | BITMAP "........" 418 | BITMAP "........" 419 | BITMAP "........" 420 | BITMAP "#......." 421 | BITMAP "##.....#" 422 | BITMAP "####..##" 423 | BITMAP "########" 424 | 'green top tree 425 | BITMAP "########" 426 | BITMAP "########" 427 | BITMAP "########" 428 | BITMAP ".#######" 429 | BITMAP "..######" 430 | BITMAP "....####" 431 | BITMAP "........" 432 | BITMAP "........" 433 | 434 | BITMAP "########" 435 | BITMAP "########" 436 | BITMAP "########" 437 | BITMAP "#######." 438 | BITMAP "######.." 439 | BITMAP "####...." 440 | BITMAP "........" 441 | BITMAP "........" 442 | 'apple tree 443 | BITMAP "........" 444 | BITMAP "........" 445 | BITMAP "#...##.." 446 | BITMAP "#######." 447 | BITMAP "#######." 448 | BITMAP ".######." 449 | BITMAP "..##.#.." 450 | BITMAP "........" 451 | 'treetrunk 452 | BITMAP ".##....#" 453 | BITMAP "..#...#." 454 | BITMAP ".###...#" 455 | BITMAP "..#...##" 456 | BITMAP ".#.#.#.#" 457 | BITMAP ".##...#." 458 | BITMAP ".#.#...#" 459 | BITMAP "..#...#." 460 | 461 | 462 | BITMAP "#.####.." 463 | BITMAP "#..####." 464 | BITMAP "#..####." 465 | BITMAP "...####." 466 | BITMAP "#..###.." 467 | BITMAP ".#.###.." 468 | BITMAP "#..####." 469 | BITMAP "...####." 470 | 471 | BITMAP ".####.##" 472 | BITMAP ".####.##" 473 | BITMAP ".####..#" 474 | BITMAP "..###.##" 475 | BITMAP "..##..##" 476 | BITMAP ".###...#" 477 | BITMAP ".####..#" 478 | BITMAP ".####.##" 479 | 480 | BITMAP ".##...#." 481 | BITMAP ".###.#.." 482 | BITMAP "..#...#." 483 | BITMAP ".#.#.##." 484 | BITMAP ".##...#." 485 | BITMAP ".#.#...." 486 | BITMAP "..#...#." 487 | BITMAP ".###.#.." 488 | 489 | 490 | BITMAP "########" 491 | BITMAP "#.######" 492 | BITMAP "#.#.###." 493 | BITMAP "#.#.#.#." 494 | BITMAP "#...#.#." 495 | BITMAP "....#..." 496 | BITMAP "........" 497 | BITMAP "........" 498 | 499 | -------------------------------------------------------------------------------- /contrib/ColouredSquares.bas: -------------------------------------------------------------------------------- 1 | REM Module: ColouredSquares.bas 2 | REM 3 | REM Description: An example of line drawing in Coloured Squares mode. 4 | REM Author: Mark Ball 5 | REM Date: 14/01/16 6 | REM Version: 1.00F 7 | REM 8 | REM HISTORY 9 | REM ------- 10 | REM 1.00F 14/01/16 - First release 11 | REM 12 | REM ------------------------------------------------------------------------- 13 | 14 | ' We need some important constants. 15 | include "constants.bas" 16 | 17 | REM ------------------------------------------------------------------------- 18 | REM Constants. 19 | REM ------------------------------------------------------------------------- 20 | CONST ROBOTRON_WIPE_START_WIDTH =17 21 | CONST ROBOTRON_WIPE_START_HEIGHT =1 22 | CONST ROBOTRON_WIPE_GROW_STEP_X =2 23 | CONST ROBOTRON_WIPE_GROW_STEP_Y =2 24 | 25 | REM ------------------------------------------------------------------------- 26 | REM Variables. 27 | REM ------------------------------------------------------------------------- 28 | dim xx(2) ' Array to hold start/end X coordinates for the line. 29 | dim yy(2) ' Array to hold start/end Y coordinates for the line. 30 | 31 | REM ------------------------------------------------------------------------- 32 | REM Main loop 33 | REM ------------------------------------------------------------------------- 34 | loop: 35 | 36 | ' Rotating line wipe. 37 | gosub RotatingWipe 38 | 39 | ' "Robotron" style wipe. 40 | cls 41 | gosub RobotronWipe 42 | 43 | goto loop 44 | 45 | REM ------------------------------------------------------------------------- 46 | REM RobotronWipe - Robotron style wipe. 47 | REM 48 | REM Notes: 49 | REM 50 | REM Inputs: 51 | REM 52 | REM Trashes: 53 | REM 54 | REM ------------------------------------------------------------------------- 55 | RobotronWipe: procedure 56 | 57 | ' ====================================================================== 58 | ' PHASE 1 - Alternating colour bars spreading out from centre of screen. 59 | ' ====================================================================== 60 | 61 | ' Initial box width and height. 62 | width=ROBOTRON_WIPE_START_WIDTH 63 | height=ROBOTRON_WIPE_START_HEIGHT 64 | 65 | ' start with a red box. 66 | colour=2 67 | 68 | for p=11 to 0 step -1 69 | 70 | ' Horizontal bar across the top. 71 | xx(0)=p 72 | yy(0)=p 73 | yy(1)=p 74 | xx(1)=p+width 75 | gosub CsLine 76 | 77 | ' Vertical bar down the right side. 78 | xx(0)=p+width 79 | yy(0)=p 80 | yy(1)=p+height 81 | xx(1)=p+width 82 | gosub CsLine 83 | 84 | ' Horizontal bar across the bottom. 85 | xx(0)=p+width 86 | yy(0)=p+height 87 | yy(1)=p+height 88 | xx(1)=p 89 | gosub CsLine 90 | 91 | ' Vertical bar up the left side. 92 | xx(0)=p 93 | yy(0)=p+height 94 | yy(1)=p 95 | xx(1)=p 96 | gosub CsLine 97 | 98 | ' Increase box size. 99 | width=width+ROBOTRON_WIPE_GROW_STEP_X 100 | height=height+ROBOTRON_WIPE_GROW_STEP_Y 101 | 102 | ' Alternate colours between red and yellow. 103 | colour=colour XOR 4 104 | 105 | ' Wait for VBLANK 106 | wait 107 | next p 108 | 109 | ' ======================================================== 110 | ' PHASE 2 - Black box spreading out from centre of screen. 111 | ' ======================================================== 112 | 113 | ' Initial box width and height. 114 | width=ROBOTRON_WIPE_START_WIDTH 115 | height=ROBOTRON_WIPE_START_HEIGHT 116 | 117 | ' start with a black box. 118 | colour=0 119 | 120 | for p=11 to 0 step -1 121 | 122 | ' Horizontal bar across the top. 123 | xx(0)=p 124 | yy(0)=p 125 | yy(1)=p 126 | xx(1)=p+width 127 | gosub CsLine 128 | 129 | ' Vertical bar down the right side. 130 | xx(0)=p+width 131 | yy(0)=p 132 | yy(1)=p+height 133 | xx(1)=p+width 134 | gosub CsLine 135 | 136 | ' Horizontal bar across the bottom. 137 | xx(0)=p+width 138 | yy(0)=p+height 139 | yy(1)=p+height 140 | xx(1)=p 141 | gosub CsLine 142 | 143 | ' Vertical bar up the left side. 144 | xx(0)=p 145 | yy(0)=p+height 146 | yy(1)=p 147 | xx(1)=p 148 | gosub CsLine 149 | 150 | ' Increase box size. 151 | width=width+ROBOTRON_WIPE_GROW_STEP_X 152 | height=height+ROBOTRON_WIPE_GROW_STEP_Y 153 | 154 | ' Wait for VBLANK 155 | wait 156 | next p 157 | 158 | end 159 | REM ------------------------------------------------------------------------- 160 | REM RobotronWipe - END 161 | REM ------------------------------------------------------------------------- 162 | 163 | REM ------------------------------------------------------------------------- 164 | REM RotatingWipe - Rotating line wipe. 165 | REM 166 | REM Notes: 167 | REM 168 | REM Inputs: 169 | REM 170 | REM Trashes: 171 | REM 172 | REM ------------------------------------------------------------------------- 173 | RotatingWipe: procedure 174 | 175 | for colour=1 to 6 176 | ' Along top and bottom X. 177 | for x=0 to 39 178 | xx(0)=x 179 | yy(0)=0 180 | xx(1)=39-x 181 | yy(1)=23 182 | gosub CsLine 183 | 184 | wait 185 | next x 186 | 187 | ' Along left and right Y. 188 | for y=1 to 22 189 | xx(0)=39 190 | yy(0)=y 191 | xx(1)=0 192 | yy(1)=23-y 193 | gosub CsLine 194 | 195 | wait 196 | next y 197 | next colour 198 | 199 | end 200 | REM ------------------------------------------------------------------------- 201 | REM RotatingWipe - END 202 | REM ------------------------------------------------------------------------- 203 | 204 | REM ------------------------------------------------------------------------- 205 | REM CsLine - Draw a line using coloured squares mode. 206 | REM ------------------------------------------------------------------------- 207 | REM 208 | REM Notes: 209 | REM - Ref: http://rosettacode.org/wiki/Bitmap/Bresenham%27s_line_algorithm#C 210 | REM 211 | REM Input: 212 | REM xx(0) - Source X coordinate (in range 0 to 39). 213 | REM yy(0) - Source Y coordinate (in range 0 to 23). 214 | REM xx(1) - Destination X coordinate (in range 0 to 39). 215 | REM yy(1) - Destination Y coordinate (in range 0 to 23). 216 | REM colour - Colour of the pixel (in the range 0 to 6). 217 | REM 218 | REM Trashes:- 219 | REM x(0), y(0), deltaX, deltaY, signX, signY, #e2, #error 220 | REM 221 | REM ------------------------------------------------------------------------- 222 | CsLine: procedure 223 | 224 | ' Compute slope delta and direction for X. 225 | deltaX=abs(xx(1)-xx(0)) 226 | signX=sgn(xx(1)-xx(0)) 227 | 228 | ' Compute slope delta and direction for Y. 229 | deltaY=abs(yy(1)-yy(0)) 230 | signY=sgn(yy(1)-yy(0)) 231 | 232 | ' Initialise the error. 233 | if (deltaX>deltaY) then #error=deltaX/2 else #error=-(deltaY/2) 234 | 235 | CsLineLoop: 236 | 237 | ' Plot the point in the current colour, 238 | gosub CsPlot 239 | 240 | ' Finished drawing the line? 241 | if xx(0)=xx(1) AND yy(0)=yy(1) then return 242 | 243 | #e2=#error 244 | 245 | ' Check if its time to change X coordinate. 246 | if #e2>-deltaX then 247 | #error=#error-deltaY 248 | xx(0)=xx(0)+signX 249 | end if 250 | 251 | ' Check if its time to change Y coordinate. 252 | if #e2 #junk 49 | ' Change 1st digit to the colour orange. 50 | #BACKTAB(SCREENPOS(DIGITS_X,DIGITS_Y))=#BACKTAB(SCREENPOS(DIGITS_X,DIGITS_Y))-(("0"-" ")*8)+CS_ORANGE+GRAM+(DEF26*8) 51 | ' change 2nd digit to the colour cyan. 52 | #BACKTAB(SCREENPOS(DIGITS_X+1,DIGITS_Y))=#BACKTAB(SCREENPOS(DIGITS_X+1,DIGITS_Y))-(("0"-" ")*8)+CS_CYAN+GRAM+(DEF26*8) 53 | 54 | ' Wait for a key press before continuing. 55 | gosub WaitForKeyDownThenUp 56 | 57 | REM ------------------------------------------------------------------------- 58 | REM Main loop 59 | REM ------------------------------------------------------------------------- 60 | loop: 61 | 62 | ' Display the test data in the Italic font and wait for a key. 63 | gosub PrepareTheItalicFont 64 | gosub WaitForKeyDownThenUp 65 | 66 | ' Display the test data in the thin font and wait for a key. 67 | gosub PrepareTheThinFont 68 | gosub WaitForKeyDownThenUp 69 | 70 | ' Display the test data in the thin font and wait for a key. 71 | gosub PrepareThe3DFont 72 | gosub WaitForKeyDownThenUp 73 | 74 | ' Display the test data in the normal font and wait for a key. 75 | gosub PrepareTheNormalFont 76 | gosub WaitForKeyDownThenUp 77 | 78 | goto loop 79 | 80 | REM ------------------------------------------------------------------------- 81 | REM WaitForKeyDownThenUp - Wait for any button to and then its release. 82 | REM ------------------------------------------------------------------------- 83 | REM 84 | REM Input: 85 | REM Nothing! 86 | REM 87 | REM Trashes: 88 | REM Noting! 89 | REM 90 | REM ------------------------------------------------------------------------- 91 | WaitForKeyDownThenUp: procedure 92 | 93 | ' Wait for a key to be pressed. 94 | do while cont=0 95 | wait 96 | loop 97 | 98 | ' Wait for a key to be released. 99 | do while cont<>0 100 | wait 101 | loop 102 | 103 | end 104 | REM ------------------------------------------------------------------------- 105 | REM WaitForKeyDownThenUp - END 106 | REM ------------------------------------------------------------------------- 107 | 108 | REM ------------------------------------------------------------------------- 109 | REM PrepareTheNormalFont - Copy the GROM cards of interest into position in GRAM. 110 | REM ------------------------------------------------------------------------- 111 | REM 112 | REM Notes: 113 | REM - In IntyBASIC 1.2.4 this function generates 6 warnings due to forward 114 | REM references at the assembly language phase. *These are safe*, but always 115 | REM check the project's *.lst file (just in case). 116 | REM - Takes 3 VBLANK ticks to execute. 117 | REM 118 | REM Input: 119 | REM Nothing! 120 | REM 121 | REM ------------------------------------------------------------------------- 122 | PrepareTheNormalFont: procedure 123 | 124 | ' Copy "A" to "M" into GRAM at index DEF00. 125 | call COPYFONT("A",DEF00,13,FONT_IS_NORMAL) 126 | 127 | ' Copy "M" to "Z" into GRAM at index DEF13. 128 | call COPYFONT("N",DEF13,13,FONT_IS_NORMAL) 129 | 130 | ' Copy "0" to "9" into GRAM at index DEF26. 131 | call COPYFONT("0",DEF26,10,FONT_IS_NORMAL) 132 | 133 | end 134 | REM ------------------------------------------------------------------------- 135 | REM PrepareTheNormalFont - END 136 | REM ------------------------------------------------------------------------- 137 | 138 | REM ------------------------------------------------------------------------- 139 | REM PrepareTheItalicFont - Copy the GROM cards of interest into position in 140 | REM GRAM.and apply an italic algorithm to them. 141 | REM ------------------------------------------------------------------------- 142 | REM 143 | REM Notes: 144 | REM - In IntyBASIC 1.2.4 this function generates 8 warnings due to forward 145 | REM references at the assembly language phase. *These are safe*, but always 146 | REM check the project's *.lst file (just in case). 147 | REM - Takes 4 VBLANK ticks to execute. 148 | REM 149 | REM Input: 150 | REM Nothing! 151 | REM 152 | REM ------------------------------------------------------------------------- 153 | PrepareTheItalicFont: procedure 154 | 155 | ' Copy "A" to "L" into GRAM at index DEF00. 156 | call COPYFONT("A",DEF00,12,FONT_IS_ITALIC) 157 | 158 | ' Copy "M" to "X" into GRAM at index DEF12. 159 | call COPYFONT("M",DEF12,12,FONT_IS_ITALIC) 160 | 161 | ' Copy "Y" to "Z" into GRAM at index DEF24. 162 | call COPYFONT("Y",DEF24,2,FONT_IS_ITALIC) 163 | 164 | ' Copy "0" to "9" into GRAM at index DEF26. 165 | call COPYFONT("0",DEF26,10,FONT_IS_ITALIC) 166 | 167 | end 168 | REM ------------------------------------------------------------------------- 169 | REM PrepareTheItalicFont - END 170 | REM ------------------------------------------------------------------------- 171 | 172 | REM ------------------------------------------------------------------------- 173 | REM PrepareTheThinFont - Copy the GROM cards of interest into position in 174 | REM GRAM.and apply a "thinning" algorithm to them. 175 | REM ------------------------------------------------------------------------- 176 | REM 177 | REM Notes: 178 | REM - In IntyBASIC 1.2.4 this function generates 12 warnings due to forward 179 | REM references at the assembly language phase. *These are safe*, but always 180 | REM check the project's *.lst file (just in case). 181 | REM - Takes 6 VBLANK ticks to execute. 182 | REM 183 | REM Input: 184 | REM Nothing! 185 | REM 186 | REM ------------------------------------------------------------------------- 187 | PrepareTheThinFont: procedure 188 | 189 | ' Copy "A" to "G" into GRAM at index DEF00. 190 | call COPYFONT("A",DEF00,7,FONT_IS_THIN) 191 | 192 | ' Copy "H" to "N" into GRAM at index DEF07. 193 | call COPYFONT("H",DEF07,7,FONT_IS_THIN) 194 | 195 | ' Copy "O" to "U" into GRAM at index DEF14. 196 | call COPYFONT("O",DEF14,7,FONT_IS_THIN) 197 | 198 | ' Copy "V" to "Z" into GRAM at index DEF21. 199 | call COPYFONT("V",DEF21,5,FONT_IS_THIN) 200 | 201 | ' Copy "0" to "6" into GRAM at index DEF26. 202 | call COPYFONT("0",DEF26,7,FONT_IS_THIN) 203 | 204 | ' Copy "7" to "9" into GRAM at index DEF33. 205 | call COPYFONT("7",DEF33,3,FONT_IS_THIN) 206 | 207 | end 208 | REM ------------------------------------------------------------------------- 209 | REM PrepareTheThinFont - END 210 | REM ------------------------------------------------------------------------- 211 | 212 | REM ------------------------------------------------------------------------- 213 | REM PrepareThe3DFont - Copy the GROM cards of interest into position in 214 | REM GRAM.and apply a "3D" algorithm to them. 215 | REM ------------------------------------------------------------------------- 216 | REM 217 | REM Notes: 218 | REM - In IntyBASIC 1.2.4 this function generates 12 warnings due to forward 219 | REM references at the assembly language phase. *These are safe*, but always 220 | REM check the project's *.lst file (just in case). 221 | REM - Takes 6 VBLANK ticks to execute. 222 | REM 223 | REM Input: 224 | REM Nothing! 225 | REM 226 | REM ------------------------------------------------------------------------- 227 | PrepareThe3DFont: procedure 228 | 229 | for c = 0 to 25 step 5 230 | 231 | call COPYFONT("A" + c, DEF00 + c, 5, FONT_IS_3D) 232 | 233 | NEXT c 234 | 235 | ' Copy "Z" into GRAM at index DEF25. 236 | call COPYFONT("Z",DEF25,1,FONT_IS_3D) 237 | 238 | ' Copy "0" to "4" into GRAM at index DEF26. 239 | call COPYFONT("0",DEF26,5,FONT_IS_3D) 240 | 241 | ' Copy "5" to "9" into GRAM at index DEF31. 242 | call COPYFONT("5",DEF31,5,FONT_IS_3D) 243 | 244 | end 245 | REM ------------------------------------------------------------------------- 246 | REM PrepareThe3DFont - END 247 | REM ------------------------------------------------------------------------- 248 | 249 | REM ------------------------------------------------------------------------- 250 | REM COPYFONT - Copy GROM cards to GRAM. 251 | REM ------------------------------------------------------------------------- 252 | REM 253 | REM Notes: 254 | REM - Takes 1 VBLANK tick to execute. 255 | REM 256 | REM Usage: 257 | REM USR COPYFONT(A,B,C,D) 258 | REM 259 | REM Input: 260 | REM A - Starting card in GROM to copy data from (source). 261 | REM B - Starting index card in GRAM to copy data to (destination). 262 | REM C - Number of consecutive cards to copy. 263 | REM D - Font style (0 - normal, 1 - Italics, 2 - thin). 264 | REM 265 | REM Returns: 266 | REM Nothing! 267 | REM 268 | REM Trashes: 269 | REM r0-r5 270 | REM 271 | REM ------------------------------------------------------------------------- 272 | asm COPYFONT: PROC 273 | asm pshr r5 274 | 275 | asm ; Find out which font data handler we need. 276 | asm addi #@@JumpTable, r3 ; Index into the jump table. 277 | asm mvi@ r3, r3 ; Get the pointer to the routine to execute later. 278 | asm pshr r3 ; Stack it! 279 | 280 | asm ; Convert 1st parameter into an offset in GROM. 281 | asm sll r0, 2 282 | asm sll r0, 1 ; A=A*8 283 | asm addi #$3000, r0 ; A=$3000+(A*8) 284 | asm pshr r0 ; Stack it! 285 | 286 | asm ; Convert 2nd parameter into an offset in GRAM. 287 | asm sll r1, 2 288 | asm sll r1, 1 ; B=B*8 289 | asm addi #$3800, r1 ; B=$3800+(B*8) 290 | asm pshr r1 ; Stack it! 291 | 292 | asm ; Save the 3rd parameter (length) for later. 293 | asm pshr r2 ; Stack it! 294 | 295 | asm ; Wait for VBLANK to occur. 296 | asm call _wait 297 | 298 | asm ; Get the card's GROM/GRAM start addresses and the number of cards 299 | asm ; to copy from the stack. 300 | asm pulr r1 ; No of cards to copy. 301 | asm pulr r5 ; Destination data pointer in GRAM. 302 | asm pulr r4 ; Source data pointer in GROM. 303 | asm pulr pc ; Execute the handler! 304 | 305 | asm ; Jump table. 306 | asm @@JumpTable: 307 | asm DECLE @@HandleNormal 308 | asm DECLE @@HandleItalic 309 | asm DECLE @@HandleThin 310 | asm DECLE @@Handle3D 311 | 312 | asm ; NORMAL 313 | asm ; ====== 314 | asm ; Copy the data directly from GROM to GRAM (a cards worth at a time). 315 | asm @@HandleNormal: 316 | asm @@CopyLoop1: 317 | asm repeat 8 318 | asm mvi@ r4, r0 319 | asm mvo@ r0, r5 320 | asm endr 321 | asm decr r1 322 | asm bne @@CopyLoop1 323 | asm pulr pc 324 | 325 | asm ; ITALIC 326 | asm ; ====== 327 | asm ; Copy the data from GROM, apply italics and store to GRAM (a cards worth 328 | asm ; at a time). 329 | asm @@HandleItalic: 330 | asm @@CopyLoop2: 331 | asm repeat 3 332 | asm mvi@ r4, r0 333 | asm slr r0, 1 334 | asm mvo@ r0, r5 335 | asm endr 336 | asm repeat 2 337 | asm mvi@ r4, r0 338 | asm mvo@ r0, r5 339 | asm endr 340 | asm repeat 3 341 | asm mvi@ r4, r0 342 | asm sll r0, 1 343 | asm mvo@ r0, r5 344 | asm endr 345 | asm decr r1 346 | asm bne @@CopyLoop2 347 | asm pulr pc 348 | 349 | asm ; THIN 350 | asm ; ==== 351 | asm ; Copy the data from GROM, apply "thinning" and store to GRAM (a cards worth 352 | asm ; at a time). 353 | asm @@HandleThin: 354 | asm @@CopyLoop3: 355 | asm repeat 8 356 | asm mvi@ r4, r0 357 | asm movr r0, r2 358 | asm slr r0, 1 359 | asm andr r2, r0 360 | asm mvo@ r0, r5 361 | asm endr 362 | asm decr r1 363 | asm bne @@CopyLoop3 364 | asm pulr pc 365 | 366 | asm ; 3D 367 | asm ; ==== 368 | asm ; Copy the data from GROM, apply "3D" and store to GRAM (a cards worth 369 | asm ; at a time). 370 | asm @@Handle3D: 371 | asm clrr r2 372 | asm @@CopyLoop4: 373 | asm repeat 8 374 | asm mvi@ r4, r0 375 | asm movr r0, r3 376 | asm andi #$f0, r0 377 | asm subr r0, r3 378 | asm xorr r2, r0 379 | asm movr r3, r2 380 | asm mvo@ r0, r5 381 | asm endr 382 | asm decr r1 383 | asm bne @@CopyLoop4 384 | asm pulr pc 385 | 386 | asm ENDP 387 | REM ------------------------------------------------------------------------- 388 | REM COPYFONT - END 389 | REM ------------------------------------------------------------------------- 390 | -------------------------------------------------------------------------------- /contrib/IntySmap.c: -------------------------------------------------------------------------------- 1 | /* ======================================================================== */ 2 | /* Merge SMAP: Simple utility for merging IntyBASIC 1.0 details into a */ 3 | /* source map file from AS1600. */ 4 | /* */ 5 | /* Author: Joe Zbiciak. */ 6 | /* Public domain. */ 7 | /* Edited Jan/20/2017 by Oscar Toledo G. to correct crash with this line: */ 8 | /* while ( remap_sz[ asm_file ] < asm_lineno ) to <= */ 9 | /* */ 10 | /* Note: I'd prefer to write this in C++11, but I instead wrote it in C */ 11 | /* to ensure the greatest portability across compilers and platforms. */ 12 | /* ======================================================================== */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #ifdef NEED_STRDUP 20 | char *strdup( const char *s ) 21 | { 22 | char *ss = malloc( strlen( s ) + 1 ); 23 | return strcpy( ss, s ); 24 | } 25 | #endif 26 | 27 | #ifdef _WIN32 28 | #define PATH_SEP '\\' 29 | 30 | int is_absolute_path( const char *const p ) 31 | { 32 | return p[0] == '\\' || p[0] == '/' || 33 | (isalpha( p[0] ) && p[1] == ':' && ( p[2] == '\\' || p[2] == '/')); 34 | } 35 | #else 36 | #define PATH_SEP '/' 37 | int is_absolute_path( const char *const p ) 38 | { 39 | return p[0] == '/'; 40 | } 41 | #endif 42 | 43 | char **strmemo = 0; 44 | int strmemo_sz = 0; 45 | int strmemo_cnt = 0; 46 | 47 | int memo_string( const char *str ) 48 | { 49 | int i; 50 | for ( i = 0; i < strmemo_cnt; i++ ) 51 | { 52 | if ( !strcmp( str, strmemo[i] ) ) 53 | return i; 54 | } 55 | 56 | if ( strmemo_cnt >= strmemo_sz ) 57 | { 58 | strmemo_sz = strmemo_sz ? strmemo_sz << 1 : 16; 59 | strmemo = realloc( strmemo, strmemo_sz * sizeof( char * ) ); 60 | } 61 | 62 | strmemo[ strmemo_cnt++ ] = strdup( str ); 63 | return strmemo_cnt - 1; 64 | } 65 | 66 | char *listing = NULL; 67 | char *cwd = NULL; 68 | int cwd_len = 0; 69 | char **path_array = NULL; 70 | int num_path = 0; 71 | 72 | void add_to_path( const char *p ) 73 | { 74 | path_array = realloc( path_array, ++num_path * sizeof(char *) ); 75 | path_array[ num_path - 1 ] = strdup( p ); 76 | } 77 | 78 | void set_cwd( const char *p ) 79 | { 80 | if ( cwd ) free( cwd ); 81 | cwd = strdup( p ); 82 | cwd_len = strlen( cwd ); 83 | } 84 | 85 | void set_listing( const char *l ) 86 | { 87 | if ( listing ) free( listing ); 88 | listing = strdup( l ); 89 | } 90 | 91 | 92 | FILE *open_with_path( int file_memo ) 93 | { 94 | const char *const file = strmemo[ file_memo ]; 95 | FILE *f = fopen( file, "r" ); 96 | int cur_path = 0, file_len; 97 | 98 | if ( is_absolute_path( file ) ) 99 | { 100 | if ( !f ) 101 | { 102 | perror("fopen()"); 103 | fprintf( stderr, "could not open file %s for reading", file ); 104 | exit(1); 105 | } 106 | } 107 | 108 | file_len = strlen( file ); 109 | 110 | while ( !f && cur_path < num_path ) 111 | { 112 | int abs_path = is_absolute_path( path_array[ cur_path ] ); 113 | int cur_len = strlen( path_array[ cur_path ] ); 114 | int to_alloc = cur_len + file_len + 2 + ( abs_path ? 0 : cwd_len + 1); 115 | 116 | char *filepath = malloc( to_alloc ); 117 | 118 | if ( abs_path ) 119 | sprintf( filepath, "%s%c%s", 120 | path_array[ cur_path ], PATH_SEP, file ); 121 | else 122 | sprintf( filepath, "%s%c%s%c%s", 123 | cwd, PATH_SEP, path_array[ cur_path ], PATH_SEP, file ); 124 | 125 | f = fopen( filepath, "r" ); 126 | 127 | free( filepath ); 128 | cur_path++; 129 | } 130 | 131 | if ( !f ) 132 | fprintf( stderr, "Could not find file %s to open it.\n", file ); 133 | 134 | return f; 135 | } 136 | 137 | #define BUFSZ ( 32768 ) 138 | char buf[ BUFSZ ]; 139 | 140 | typedef struct smap_rec_t smap_rec_t; 141 | 142 | struct smap_rec_t 143 | { 144 | smap_rec_t *next; 145 | int src_file; /* in memo_string table */ 146 | int s_addr; 147 | int e_addr; 148 | int flags; 149 | int src_line; 150 | int lst_line; 151 | }; 152 | 153 | smap_rec_t *smap_head = NULL, *smap_tail = NULL; 154 | 155 | int *asm_files; 156 | int asm_file_cnt = 0; 157 | 158 | void record_asm_file( int asm_file ) 159 | { 160 | int i; 161 | 162 | for ( i = 0; i < asm_file_cnt; i++ ) 163 | if ( asm_files[ i ] == asm_file ) 164 | return; 165 | 166 | asm_files = realloc( asm_files, ++asm_file_cnt * sizeof( int ) ); 167 | 168 | asm_files[ asm_file_cnt - 1 ] = asm_file; 169 | } 170 | 171 | void slurp_smap( const char *smap_fname ) 172 | { 173 | int cur_file = memo_string( "UNKNOWN" ); 174 | FILE *f = fopen( smap_fname, "r" ); 175 | 176 | if ( !f ) 177 | { 178 | perror( "fopen()" ); 179 | fprintf( stderr, "Could not open smap file %s\n", smap_fname ); 180 | exit( 1 ); 181 | } 182 | 183 | while ( fgets( buf, BUFSZ, f ) ) 184 | { 185 | char *c; 186 | smap_rec_t *rec = calloc( 1, sizeof( smap_rec_t ) ); 187 | 188 | if ( ( c = strchr( buf, '\r' ) ) != NULL ) *c = 0; 189 | if ( ( c = strchr( buf, '\n' ) ) != NULL ) *c = 0; 190 | 191 | if ( !strncmp( buf, "CWD ", 4 ) ) 192 | { 193 | set_cwd( buf + 4 ); 194 | continue; 195 | } 196 | 197 | if ( !strncmp( buf, "LISTING ", 8 ) ) 198 | { 199 | set_listing( buf + 8 ); 200 | continue; 201 | } 202 | 203 | if ( !strncmp( buf, "PATH ", 5 ) ) 204 | { 205 | add_to_path( buf + 5 ); 206 | continue; 207 | } 208 | 209 | if ( !strncmp( buf, "FILE ", 5 ) ) 210 | { 211 | cur_file = memo_string( buf + 5 ); 212 | record_asm_file( cur_file ); 213 | continue; 214 | } 215 | 216 | if ( sscanf( buf, "%x %x %x %d %d", 217 | &( rec->s_addr ), &( rec->e_addr ), &( rec->flags ), 218 | &( rec->src_line ), &( rec->lst_line ) ) != 5 ) 219 | { 220 | free( rec ); 221 | fprintf( stderr, "WARNING: unhandled smap line \"%s\"\n", buf ); 222 | continue; 223 | } 224 | 225 | rec->src_file = cur_file; 226 | 227 | if ( !smap_head ) 228 | smap_head = smap_tail = rec; 229 | else 230 | { 231 | smap_tail->next = rec; 232 | smap_tail = rec; 233 | } 234 | } 235 | 236 | fclose( f ); 237 | } 238 | 239 | typedef struct remap_rec_t 240 | { 241 | int bas_file; 242 | int bas_lineno; 243 | } remap_rec_t; 244 | 245 | remap_rec_t **remap_tbl = NULL; 246 | int *remap_sz = NULL; 247 | int remap_tbl_sz = 0; 248 | 249 | void init_remap_tbl( void ) 250 | { 251 | /* this relies on the strmemo_tbl already having all the ASM file names */ 252 | remap_tbl = calloc( strmemo_cnt, sizeof( remap_rec_t ) ); 253 | remap_sz = calloc( strmemo_cnt, sizeof( int ) ); 254 | 255 | remap_tbl_sz = strmemo_cnt; 256 | } 257 | 258 | void put_remap( int asm_file, int asm_lineno, int bas_file, int bas_lineno ) 259 | { 260 | /* Usu. iterates 0 or 1 times. I don't care if it iterates 2+ times */ 261 | while ( remap_sz[ asm_file ] <= asm_lineno ) 262 | { 263 | int old_sz = remap_sz[ asm_file ], i; 264 | int new_sz = remap_sz[ asm_file ] = old_sz ? old_sz * 2 : 1024; 265 | 266 | remap_tbl[ asm_file ] = realloc 267 | ( 268 | remap_tbl[ asm_file ], new_sz * sizeof( remap_rec_t ) 269 | ); 270 | 271 | for ( i = old_sz ; i < new_sz ; i++ ) 272 | { 273 | remap_tbl[ asm_file ][ i ].bas_file = -1; 274 | remap_tbl[ asm_file ][ i ].bas_lineno = -1; 275 | } 276 | } 277 | 278 | remap_tbl[ asm_file ][ asm_lineno ].bas_file = bas_file; 279 | remap_tbl[ asm_file ][ asm_lineno ].bas_lineno = bas_lineno; 280 | } 281 | 282 | const remap_rec_t* get_remap( int asm_file, int asm_lineno ) 283 | { 284 | if ( remap_sz[ asm_file ] <= asm_lineno ) 285 | return NULL; 286 | 287 | if ( remap_tbl[ asm_file ][ asm_lineno ].bas_file < 0 ) 288 | return NULL; 289 | 290 | return &( remap_tbl[ asm_file ][ asm_lineno ] ); 291 | } 292 | 293 | 294 | void process_asm( int asm_file ) 295 | { 296 | int bas_file = -1; 297 | int asm_lineno = 0, bas_lineno = 0; 298 | FILE *f = open_with_path( asm_file ); 299 | 300 | while ( fgets( buf, BUFSZ, f ) != NULL ) 301 | { 302 | char *c; 303 | int l; 304 | 305 | asm_lineno++; 306 | 307 | if ( ( c = strchr( buf, '\r' ) ) != NULL ) *c = 0; 308 | if ( ( c = strchr( buf, '\n' ) ) != NULL ) *c = 0; 309 | 310 | if ( strstr( buf, "Epilogue for IntyBASIC programs" ) ) 311 | break; 312 | 313 | if ( !strncmp( buf, "\t;FILE ", 7 ) ) 314 | { 315 | bas_file = memo_string( buf + 7 ); 316 | continue; 317 | } 318 | 319 | if ( sscanf( buf, "\t;[%d]", &l ) == 1 ) 320 | { 321 | bas_lineno = l; 322 | continue; 323 | } 324 | 325 | if ( !strncmp( buf, "\t;ENDFILE", 9 ) ) 326 | { 327 | bas_file = -1; 328 | continue; 329 | } 330 | if ( bas_file > 0 ) 331 | put_remap( asm_file, asm_lineno, bas_file, bas_lineno ); 332 | } 333 | 334 | fclose( f ); 335 | 336 | return; 337 | } 338 | 339 | void filter_smap( void ) 340 | { 341 | smap_rec_t *smap_rec = smap_head; 342 | 343 | while ( smap_rec ) 344 | { 345 | const remap_rec_t* remap_rec = get_remap( smap_rec->src_file, 346 | smap_rec->src_line ); 347 | 348 | if ( remap_rec ) 349 | { 350 | smap_rec->src_file = remap_rec->bas_file; 351 | smap_rec->src_line = remap_rec->bas_lineno; 352 | smap_rec->lst_line = 0; 353 | } 354 | smap_rec = smap_rec->next; 355 | } 356 | 357 | return; 358 | } 359 | 360 | void rewrite_smap( const char *smap_fname ) 361 | { 362 | char *rename_fname = malloc( strlen( smap_fname ) + 2 ); 363 | FILE *f; 364 | int i, cur_file = -1; 365 | smap_rec_t *smap_rec; 366 | 367 | sprintf( rename_fname, "%s~", smap_fname ); /* I'm lazy. */ 368 | 369 | rename( smap_fname, rename_fname ); /* a nicety */ 370 | 371 | if ( !(f = fopen( smap_fname, "w" ) ) ) 372 | { 373 | perror("fopen()"); 374 | fprintf( stderr, "Could not open %s for writing\n", smap_fname ); 375 | exit( 1 ); 376 | } 377 | 378 | if ( cwd ) fprintf( f, "CWD %s\n", cwd ); 379 | 380 | for ( i = 0; i < num_path; i++ ) 381 | fprintf( f, "PATH %s\n", path_array[ i ] ); 382 | 383 | if ( listing ) fprintf( f, "LISTING %s\n", listing ); 384 | 385 | for ( smap_rec = smap_head ; smap_rec ; smap_rec = smap_rec->next ) 386 | { 387 | if ( cur_file < 0 || cur_file != smap_rec->src_file ) 388 | { 389 | cur_file = smap_rec->src_file; 390 | fprintf( f, "FILE %s\n", strmemo[ cur_file ] ); 391 | } 392 | 393 | fprintf( f, "%04X %04X %02X %d %d\n", 394 | smap_rec->s_addr, smap_rec->e_addr, smap_rec->flags, 395 | smap_rec->src_line, smap_rec->lst_line ); 396 | } 397 | 398 | fclose( f ); 399 | } 400 | 401 | /* 402 | ** Main program 403 | */ 404 | int main( int argc, char *argv[] ) 405 | { 406 | int i; 407 | 408 | if ( argc != 2 ) 409 | { 410 | fprintf( stderr, "Usage: %s foo.smap\n", argv[0] ); 411 | exit( 1 ); 412 | } 413 | 414 | slurp_smap( argv[1] ); 415 | init_remap_tbl( ); 416 | 417 | for ( i = 0 ; i < asm_file_cnt ; i++ ) 418 | { 419 | const int asm_file = asm_files[ i ]; 420 | printf( "processing %s...\n", strmemo[ asm_file ] ); 421 | process_asm( asm_file ); 422 | } 423 | 424 | filter_smap( ); 425 | rewrite_smap( argv[1] ); 426 | 427 | return 0; 428 | } 429 | -------------------------------------------------------------------------------- /contrib/TinyFont.bas: -------------------------------------------------------------------------------- 1 | REM Module: TinyFont.bas 2 | REM 3 | REM Description: An example of using a 4 pixel wide font. 4 | REM Author(s): Mark Ball 5 | REM Date: 21/03/16 6 | REM Version: 1.00F 7 | REM 8 | REM HISTORY 9 | REM ------- 10 | REM 1.00F 21/03/16 - First release. 11 | REM 12 | REM ------------------------------------------------------------------------- 13 | 14 | ' We need some important constants. 15 | include "constants.bas" 16 | 17 | REM ------------------------------------------------------------------------- 18 | REM Initialisation. 19 | REM ------------------------------------------------------------------------- 20 | 21 | ' Display a long string in the tiny font. 22 | call TINYFONT(varptr string(0)) 23 | 24 | REM ------------------------------------------------------------------------- 25 | REM Main loop 26 | REM ------------------------------------------------------------------------- 27 | loop: 28 | wait 29 | goto loop 30 | 31 | REM ------------------------------------------------------------------------- 32 | REM Message to print on screen. 33 | REM ------------------------------------------------------------------------- 34 | REM 1st element - The destination on screen (must use constants). 35 | REM 2nd element - The colour of the text (with GRAM flag set). 36 | REM 3rd element - The start index in GRAM (DEF00 to DEF63). 37 | REM 4rd element - The string to print (no punctuation). 38 | REM 5th element - The string terminator (any negative number). 39 | REM ------------------------------------------------------------------------- 40 | string: 41 | data SCREENADDR(0,0), CS_CYAN+GRAM, DEF00, "HELLO WORLD! " 42 | data "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG. SOME PUNCTUATION (+-[]=<>!)%" 43 | data "....... THATS ALL FOLKS!", -1 44 | 45 | REM ------------------------------------------------------------------------- 46 | REM TINYFONT - Display a string in a 4 pixel wide font. 47 | REM ------------------------------------------------------------------------- 48 | REM 49 | REM Notes: 50 | REM - Takes N VBLANK tick to execute (depends on string length). 51 | REM 52 | REM Usage: 53 | REM CALL TINYFONT(A) 54 | REM 55 | REM Input: 56 | REM A - VARPTR of a message data structure. Where :- 57 | REM 1st data element is the destination address in RAM. 58 | REM 2nd data element is the text/background colour+GRAM. 59 | REM 3rd data element is the GRAM index to start the string bitmap in. 60 | REM 4th-N data element is the string in upper case with limited punctuation. 61 | REM N+1 data element is the string terminator (any negative number). 62 | REM 63 | REM Returns: 64 | REM Nothing! 65 | REM 66 | REM Trashes: 67 | REM r0-r5 68 | REM 69 | REM ------------------------------------------------------------------------- 70 | asm TINYFONT: PROC 71 | 72 | asm ; Font character indexes into the bitmaps. 73 | asm @@INDEX_A: EQU ( 0*4) 74 | asm @@INDEX_0: EQU (26*4) 75 | asm @@INDEX_DOT: EQU (36*4) 76 | asm @@INDEX_COMMA: EQU (37*4) 77 | asm @@INDEX_SEMICOLON: EQU (38*4) 78 | asm @@INDEX_COLON: EQU (39*4) 79 | asm @@INDEX_MINUS: EQU (40*4) 80 | asm @@INDEX_PLUS: EQU (41*4) 81 | asm @@INDEX_STAR: EQU (42*4) 82 | asm @@INDEX_FSLASH: EQU (43*4) 83 | asm @@INDEX_PLING: EQU (44*4) 84 | asm @@INDEX_QUOTE: EQU (45*4) 85 | asm @@INDEX_PERCENT: EQU (46*4) 86 | asm @@INDEX_QUESTION: EQU (47*4) 87 | asm @@INDEX_EQUALS: EQU (48*4) 88 | asm @@INDEX_LESSTHAN: EQU (49*4) 89 | asm @@INDEX_MORETHAN: EQU (50*4) 90 | asm @@INDEX_RBRACKET: EQU (51*4) 91 | asm @@INDEX_LBRACKET: EQU (52*4) 92 | asm @@INDEX_LSBRACKET: EQU (53*4) 93 | asm @@INDEX_RSBRACKET: EQU (54*4) 94 | asm @@INDEX_BSLASH: EQU (55*4) 95 | asm @@INDEX_DOLLAR: EQU (56*4) 96 | 97 | asm pshr r5 98 | 99 | asm movr r0, r5 ; Get the argument pointer. 100 | asm mvi@ r5, r0 ; Get position on screen. 101 | asm pshr r0 ; Save it for later! 102 | 103 | asm mvi@ r5, r0 ; Get colour. 104 | asm pshr r0 ; Save it for later. 105 | 106 | asm mvi@ r5, r0 ; Get GRAM card to start putting letters into. 107 | asm sll r0, 2 108 | asm sll r0, 1 ; x8. 109 | asm pshr r0 ; Save it for later. 110 | asm addi #$3800, r0 ; Add base address of GRAM... 111 | asm movr r0, r4 ; to create a destination pointer. 112 | asm pshr r4 ; Save it for later 113 | 114 | asm ; GRAM nlock filling main loop. 115 | asm @@BlockFillLoop: 116 | asm pshr r5 ; Save message pointer. 117 | asm pshr r4 ; Save GRAM pointer. 118 | asm call _wait ; Wait for VBLANK 119 | asm pulr r4 ; Restore GRAM pointer. 120 | asm pulr r5 ; Restore message pointer. 121 | 122 | asm ; Copy up to 7 completed characters to GRAM. 123 | asm mvii #7, r1 124 | asm @@L1: 125 | 126 | asm ; Get left side character's data pointer. 127 | asm mvi@ r5, r2 128 | asm tstr r2 129 | asm bmi @@PrintMessageOnScreen 130 | asm addi #@@LeftFontTable, r2 131 | asm mvi@ r2, r2 132 | 133 | asm ; Get right side character's data pointer. 134 | asm mvi@ r5, r3 135 | asm tstr r3 136 | asm bmi @@DoLeftHalfOfLastCharacter 137 | asm addi #@@RightFontTable, r3 138 | asm mvi@ r3, r3 139 | 140 | asm ; Copy the sources and combine them into the destination. 141 | asm REPEAT 4 142 | asm mvi@ r2, r0 143 | asm incr r2 144 | asm xor@ r3, r0 145 | asm incr r3 146 | asm mvo@ r0, r4 147 | asm swap r0 148 | asm mvo@ r0, r4 149 | asm ENDR 150 | 151 | asm ; Any more to do? 152 | asm decr r1 153 | asm bne @@L1 154 | asm b @@BlockFillLoop 155 | 156 | asm ; Message now exists in the GRAM cards, now display it. 157 | asm @@PrintMessageOnScreen: 158 | asm pulr r2 ; Get start address in GRAM. 159 | asm subr r2, r4 ; Subtract it from the end address. 160 | asm movr r4, r2 161 | asm slr r2, 2 162 | asm slr r2, 1 ; /8 = no of cards to display. 163 | 164 | asm pulr r0 ; Get GRAM start index. 165 | asm pulr r1 ; Get text colour. 166 | asm xorr r1, r0 ; Create BACKTAB starting card. 167 | 168 | asm pulr r5 ; Get destination on screen. 169 | asm @@CopyToScreenLoop: 170 | asm mvo@ r0, r5 171 | asm addi #1 SHL 3, r0 172 | asm decr r2 173 | asm bne @@CopyToScreenLoop 174 | 175 | asm pulr pc ; All done! 176 | 177 | asm ; Right side of the last character to display is empty. 178 | asm @@DoLeftHalfOfLastCharacter: 179 | asm REPEAT 4 180 | asm mvi@ r2, r0 181 | asm incr r2 182 | asm mvo@ r0, r4 183 | asm swap r0 184 | asm mvo@ r0, r4 185 | asm ENDR 186 | asm b @@PrintMessageOnScreen 187 | 188 | asm ; Left chracter look up table (first 62 characters only). 189 | asm @@LeftFontTable: 190 | asm DECLE @@FontSpaceData ; " " 191 | asm DECLE @@LeftFont_bitmaps+@@INDEX_PLING ; "!" 192 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; """ 193 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; "#" 194 | asm DECLE @@LeftFont_bitmaps+@@INDEX_DOLLAR ; "$" 195 | asm DECLE @@LeftFont_bitmaps+@@INDEX_PERCENT ; "%" 196 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; "&" 197 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUOTE ; "'" 198 | asm DECLE @@LeftFont_bitmaps+@@INDEX_LBRACKET ; "(" 199 | asm DECLE @@LeftFont_bitmaps+@@INDEX_RBRACKET ; ")" 200 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; "o" 201 | asm DECLE @@LeftFont_bitmaps+@@INDEX_PLUS ; "+" 202 | asm DECLE @@LeftFont_bitmaps+@@INDEX_COMMA ; "," 203 | asm DECLE @@LeftFont_bitmaps+@@INDEX_MINUS ; "-" 204 | asm DECLE @@LeftFont_bitmaps+@@INDEX_DOT ; "." 205 | asm DECLE @@LeftFont_bitmaps+@@INDEX_FSLASH ; "/" 206 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(0*4) ; "0" 207 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(1*4) ; "1" 208 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(2*4) ; "2" 209 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(3*4) ; "3" 210 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(4*4) ; "4" 211 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(5*4) ; "5" 212 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(6*4) ; "6" 213 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(7*4) ; "7" 214 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(8*4) ; "8" 215 | asm DECLE @@LeftFont_bitmaps+@@INDEX_0+(9*4) ; "9" 216 | asm DECLE @@LeftFont_bitmaps+@@INDEX_COLON ; ":" 217 | asm DECLE @@LeftFont_bitmaps+@@INDEX_SEMICOLON ; ";" 218 | asm DECLE @@LeftFont_bitmaps+@@INDEX_LESSTHAN ; "<" 219 | asm DECLE @@LeftFont_bitmaps+@@INDEX_EQUALS ; "=" 220 | asm DECLE @@LeftFont_bitmaps+@@INDEX_MORETHAN ; ">" 221 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; "?" 222 | asm DECLE @@LeftFont_bitmaps+@@INDEX_QUESTION ; "@" 223 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 0*4) ; "A" 224 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 1*4) ; "B" 225 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 2*4) ; "C" 226 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 3*4) ; "D" 227 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 4*4) ; "E" 228 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 5*4) ; "F" 229 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 6*4) ; "G" 230 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 7*4) ; "H" 231 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 8*4) ; "I" 232 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+( 9*4) ; "J" 233 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(10*4) ; "K" 234 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(11*4) ; "L" 235 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(12*4) ; "M" 236 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(13*4) ; "N" 237 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(14*4) ; "O" 238 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(15*4) ; "P" 239 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(16*4) ; "Q" 240 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(17*4) ; "R" 241 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(18*4) ; "S" 242 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(19*4) ; "T" 243 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(20*4) ; "U" 244 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(21*4) ; "V" 245 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(22*4) ; "W" 246 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(23*4) ; "X" 247 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(24*4) ; "Y" 248 | asm DECLE @@LeftFont_bitmaps+@@INDEX_A+(25*4) ; "Z" 249 | asm DECLE @@LeftFont_bitmaps+@@INDEX_LSBRACKET ; "[" 250 | asm DECLE @@LeftFont_bitmaps+@@INDEX_BSLASH ; "\" 251 | asm DECLE @@LeftFont_bitmaps+@@INDEX_RSBRACKET ; "]" 252 | 253 | asm ; Right character look up table (first 62 characters only). 254 | asm @@RightFontTable: 255 | asm DECLE @@FontSpaceData ; " " 256 | asm DECLE @@RightFont_bitmaps+@@INDEX_PLING ; "!" 257 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; """ 258 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; "#" 259 | asm DECLE @@RightFont_bitmaps+@@INDEX_DOLLAR ; "$" 260 | asm DECLE @@RightFont_bitmaps+@@INDEX_PERCENT ; "%" 261 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; "&" 262 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUOTE ; "'" 263 | asm DECLE @@RightFont_bitmaps+@@INDEX_LBRACKET ; "(" 264 | asm DECLE @@RightFont_bitmaps+@@INDEX_RBRACKET ; ")" 265 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; "o" 266 | asm DECLE @@RightFont_bitmaps+@@INDEX_PLUS ; "+" 267 | asm DECLE @@RightFont_bitmaps+@@INDEX_COMMA ; "," 268 | asm DECLE @@RightFont_bitmaps+@@INDEX_MINUS ; "-" 269 | asm DECLE @@RightFont_bitmaps+@@INDEX_DOT ; "." 270 | asm DECLE @@RightFont_bitmaps+@@INDEX_FSLASH ; "/" 271 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(0*4) ; "0" 272 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(1*4) ; "1" 273 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(2*4) ; "2" 274 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(3*4) ; "3" 275 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(4*4) ; "4" 276 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(5*4) ; "5" 277 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(6*4) ; "6" 278 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(7*4) ; "7" 279 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(8*4) ; "8" 280 | asm DECLE @@RightFont_bitmaps+@@INDEX_0+(9*4) ; "9" 281 | asm DECLE @@RightFont_bitmaps+@@INDEX_COLON ; ":" 282 | asm DECLE @@RightFont_bitmaps+@@INDEX_SEMICOLON ; ";" 283 | asm DECLE @@RightFont_bitmaps+@@INDEX_LESSTHAN ; "<" 284 | asm DECLE @@RightFont_bitmaps+@@INDEX_EQUALS ; "=" 285 | asm DECLE @@RightFont_bitmaps+@@INDEX_MORETHAN ; ">" 286 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; "?" 287 | asm DECLE @@RightFont_bitmaps+@@INDEX_QUESTION ; "@" 288 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 0*4) ; "A" 289 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 1*4) ; "B" 290 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 2*4) ; "C" 291 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 3*4) ; "D" 292 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 4*4) ; "E" 293 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 5*4) ; "F" 294 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 6*4) ; "G" 295 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 7*4) ; "H" 296 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 8*4) ; "I" 297 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+( 9*4) ; "J" 298 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(10*4) ; "K" 299 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(11*4) ; "L" 300 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(12*4) ; "M" 301 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(13*4) ; "N" 302 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(14*4) ; "O" 303 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(15*4) ; "P" 304 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(16*4) ; "Q" 305 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(17*4) ; "R" 306 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(18*4) ; "S" 307 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(19*4) ; "T" 308 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(20*4) ; "U" 309 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(21*4) ; "V" 310 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(22*4) ; "W" 311 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(23*4) ; "X" 312 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(24*4) ; "Y" 313 | asm DECLE @@RightFont_bitmaps+@@INDEX_A+(25*4) ; "Z" 314 | asm DECLE @@RightFont_bitmaps+@@INDEX_LSBRACKET ; "[" 315 | asm DECLE @@RightFont_bitmaps+@@INDEX_BSLASH ; "\" 316 | asm DECLE @@RightFont_bitmaps+@@INDEX_RSBRACKET ; "]" 317 | 318 | asm ; Just a space. 319 | asm @@FontSpaceData: 320 | asm DECLE 0,0,0,0 321 | 322 | asm ; Left side font character bitmap data 323 | asm @@LeftFont_bitmaps: 324 | asm DECLE $4000,$A0A0,$A0E0,$00A0 325 | asm DECLE $C000,$C0A0,$A0A0,$00C0 326 | asm DECLE $4000,$80A0,$A080,$0040 327 | asm DECLE $C000,$A0A0,$A0A0,$00C0 328 | asm DECLE $E000,$C080,$8080,$00E0 329 | asm DECLE $E000,$C080,$8080,$0080 330 | asm DECLE $4000,$80A0,$A0A0,$0060 331 | asm DECLE $A000,$E0A0,$A0A0,$00A0 332 | asm DECLE $E000,$4040,$4040,$00E0 333 | asm DECLE $E000,$2020,$A020,$0040 334 | asm DECLE $A000,$C0A0,$A0A0,$00A0 335 | asm DECLE $8000,$8080,$8080,$00E0 336 | asm DECLE $A000,$E0E0,$A0A0,$00A0 337 | asm DECLE $A000,$E0E0,$E0E0,$00A0 338 | asm DECLE $4000,$A0A0,$A0A0,$0040 339 | asm DECLE $C000,$A0A0,$80C0,$0080 340 | asm DECLE $4000,$A0A0,$A0E0,$0060 341 | asm DECLE $C000,$A0A0,$A0C0,$00A0 342 | asm DECLE $6000,$4080,$A020,$0040 343 | asm DECLE $E000,$4040,$4040,$0040 344 | asm DECLE $A000,$A0A0,$A0A0,$0060 345 | asm DECLE $A000,$A0A0,$A0A0,$0040 346 | asm DECLE $A000,$A0A0,$E0E0,$00A0 347 | asm DECLE $A000,$40A0,$A0A0,$00A0 348 | asm DECLE $A000,$A0A0,$4040,$0040 349 | asm DECLE $E000,$4020,$8040,$00E0 350 | asm DECLE $4000,$E0A0,$A0E0,$0040 351 | asm DECLE $4000,$40C0,$4040,$00E0 352 | asm DECLE $4000,$20A0,$8040,$00E0 353 | asm DECLE $E000,$4020,$A020,$0040 354 | asm DECLE $8000,$A080,$E0A0,$0020 355 | asm DECLE $E000,$C080,$A020,$0040 356 | asm DECLE $6000,$C080,$A0A0,$0040 357 | asm DECLE $E000,$2020,$4040,$0040 358 | asm DECLE $4000,$40A0,$A0A0,$0040 359 | asm DECLE $6000,$A0A0,$2060,$0020 360 | asm DECLE $0000,$0000,$0000,$0040 361 | asm DECLE $0000,$0000,$2000,$4020 362 | asm DECLE $0000,$2000,$2000,$4020 363 | asm DECLE $0000,$8000,$0000,$0080 364 | asm DECLE $0000,$E000,$0000,$0000 365 | asm DECLE $4000,$E040,$4040,$0000 366 | asm DECLE $A000,$E040,$A040,$0000 367 | asm DECLE $2000,$4020,$8040,$0080 368 | asm DECLE $4000,$4040,$0040,$0040 369 | asm DECLE $4000,$8040,$0000,$0000 370 | asm DECLE $A000,$4020,$8040,$00A0 371 | asm DECLE $E000,$E020,$0080,$0080 372 | asm DECLE $0000,$E000,$E000,$0000 373 | asm DECLE $2000,$8040,$2040,$0000 374 | asm DECLE $8000,$2040,$8040,$0000 375 | asm DECLE $4000,$2020,$2020,$0040 376 | asm DECLE $4000,$8080,$8080,$0040 377 | asm DECLE $C000,$8080,$8080,$00C0 378 | asm DECLE $6000,$2020,$2020,$0060 379 | asm DECLE $8000,$4080,$2040,$0020 380 | asm DECLE $4000,$C060,$60E0,$00C0 381 | 382 | asm ; Right side font character bitmap data 383 | asm @@RightFont_bitmaps: 384 | asm DECLE $0400,$0A0A,$0A0E,$000A 385 | asm DECLE $0C00,$0C0A,$0A0A,$000C 386 | asm DECLE $0400,$080A,$0A08,$0004 387 | asm DECLE $0C00,$0A0A,$0A0A,$000C 388 | asm DECLE $0E00,$0C08,$0808,$000E 389 | asm DECLE $0E00,$0C08,$0808,$0008 390 | asm DECLE $0400,$080A,$0A0A,$0006 391 | asm DECLE $0A00,$0E0A,$0A0A,$000A 392 | asm DECLE $0E00,$0404,$0404,$000E 393 | asm DECLE $0E00,$0202,$0A02,$0004 394 | asm DECLE $0A00,$0C0A,$0A0A,$000A 395 | asm DECLE $0800,$0808,$0808,$000E 396 | asm DECLE $0A00,$0E0E,$0A0A,$000A 397 | asm DECLE $0A00,$0E0E,$0E0E,$000A 398 | asm DECLE $0400,$0A0A,$0A0A,$0004 399 | asm DECLE $0C00,$0A0A,$080C,$0008 400 | asm DECLE $0400,$0A0A,$0A0E,$0006 401 | asm DECLE $0C00,$0A0A,$0A0C,$000A 402 | asm DECLE $0600,$0408,$0A02,$0004 403 | asm DECLE $0E00,$0404,$0404,$0004 404 | asm DECLE $0A00,$0A0A,$0A0A,$0006 405 | asm DECLE $0A00,$0A0A,$0A0A,$0004 406 | asm DECLE $0A00,$0A0A,$0E0E,$000A 407 | asm DECLE $0A00,$040A,$0A0A,$000A 408 | asm DECLE $0A00,$0A0A,$0404,$0004 409 | asm DECLE $0E00,$0402,$0804,$000E 410 | asm DECLE $0400,$0E0A,$0A0E,$0004 411 | asm DECLE $0400,$040C,$0404,$000E 412 | asm DECLE $0400,$020A,$0804,$000E 413 | asm DECLE $0E00,$0402,$0A02,$0004 414 | asm DECLE $0800,$0A08,$0E0A,$0002 415 | asm DECLE $0E00,$0C08,$0A02,$0004 416 | asm DECLE $0600,$0C08,$0A0A,$0004 417 | asm DECLE $0E00,$0202,$0404,$0004 418 | asm DECLE $0400,$040A,$0A0A,$0004 419 | asm DECLE $0600,$0A0A,$0206,$0002 420 | asm DECLE $0000,$0000,$0000,$0004 421 | asm DECLE $0000,$0000,$0200,$0402 422 | asm DECLE $0000,$0200,$0200,$0402 423 | asm DECLE $0000,$0800,$0000,$0008 424 | asm DECLE $0000,$0E00,$0000,$0000 425 | asm DECLE $0400,$0E04,$0404,$0000 426 | asm DECLE $0A00,$0E04,$0A04,$0000 427 | asm DECLE $0200,$0402,$0804,$0008 428 | asm DECLE $0400,$0404,$0004,$0004 429 | asm DECLE $0400,$0804,$0000,$0000 430 | asm DECLE $0A00,$0402,$0804,$000A 431 | asm DECLE $0E00,$0E02,$0008,$0008 432 | asm DECLE $0000,$0E00,$0E00,$0000 433 | asm DECLE $0200,$0804,$0204,$0000 434 | asm DECLE $0800,$0204,$0804,$0000 435 | asm DECLE $0400,$0202,$0202,$0004 436 | asm DECLE $0400,$0808,$0808,$0004 437 | asm DECLE $0C00,$0808,$0808,$000C 438 | asm DECLE $0600,$0202,$0202,$0006 439 | asm DECLE $0800,$0408,$0204,$0002 440 | asm DECLE $0400,$0C06,$060E,$000C 441 | 442 | asm ENDP 443 | REM ------------------------------------------------------------------------- 444 | REM TINYFONT - END 445 | REM ------------------------------------------------------------------------- 446 | -------------------------------------------------------------------------------- /contrib/accel.bas: -------------------------------------------------------------------------------- 1 | '' ======================================================================== '' 2 | '' Acceleration and velocity '' 3 | '' J. Zbiciak '' 4 | '' Licence: Creative Commons CC0 '' 5 | '' '' 6 | '' This demo illustrates one method for implementing object motion. '' 7 | '' '' 8 | '' Press keypad 1 through 8 to select an object. '' 9 | '' Press DISC to accelerate an object in the desired direction. '' 10 | '' Press an action button to decelerate the object. '' 11 | '' ======================================================================== '' 12 | ASM CFGVAR "author" = "Joe Zbiciak" 13 | ASM CFGVAR "name" = "Acceleration and Velocity Demo" 14 | ASM CFGVAR "short_name" = "Accel & Vel Demo" 15 | ASM CFGVAR "description" = \ 16 | "A simple demonstration of acceleration and velocity for object motion." 17 | ASM CFGVAR "year" = 2018 18 | ASM CFGVAR "build_date" = TODAY_STR_LOC("%Y-%m-%d %H:%M:%S %z") 19 | ASM CFGVAR "license" = "CC CC0" 20 | 21 | '' ======================================================================== '' 22 | '' Belt, braces, staples, and glue. '' 23 | '' ======================================================================== '' 24 | OPTION WARNINGS ON 25 | OPTION EXPLICIT ON 26 | 27 | '' ======================================================================== '' 28 | '' Position, velocity and acceleration variables: '' 29 | '' '' 30 | '' #PX() and #PY() contain 8.8 object positions. '' 31 | '' VX() and VY() contain 2.6 object velocities. '' 32 | '' AX and AY contain 2.6 object acceleration for current object. '' 33 | '' SEL is the currently selected object. '' 34 | '' '' 35 | '' Here, 8.8 means "8 integer bits, 8 fractional bits." Also, for Y '' 36 | '' coordinates, it's actually 7.8. We ignore the MSB of the Y coord, '' 37 | '' since the display is only 96 rows tall. '' 38 | '' '' 39 | '' 2.6 is similar, meaning "2 integer bits, 6 fractional bits." '' 40 | '' '' 41 | '' User input only modifies the acceleration of the object. The rest is '' 42 | '' handled by the physics computations. '' 43 | '' ======================================================================== '' 44 | DIM #PX(8), #PY(8) ' Positions 45 | DIM VX(8), VY(8) ' Velocities 46 | DIM AX, AY ' Acceleration for selected object 47 | DIM SEL ' Currently selected object 48 | 49 | SIGNED VX, VY, AX, AY 50 | UNSIGNED #PX, #PY 51 | 52 | '' ======================================================================== '' 53 | '' Movement smoothing: '' 54 | '' '' 55 | '' We accelerate/decelerate smoothly with a first-order differential '' 56 | '' equation. All that really means is that we compute our new velocity '' 57 | '' in terms of the current velocity, plus a fraction of how far we are '' 58 | '' from our target velocity. '' 59 | '' '' 60 | '' accel = (vel_target - vel_current) / smoothing_factor '' 61 | '' vel_current = vel_current + accel '' 62 | '' '' 63 | '' The following two smoothing constants control the smoothing factors '' 64 | '' used for acceleration and deceleration. Smaller factors converge '' 65 | '' faster. For efficient computation, these should be powers of 2. '' 66 | '' ======================================================================== '' 67 | CONST ACCEL_SMOOTHING = $20 68 | CONST DECEL_SMOOTHING = $10 69 | 70 | '' ======================================================================== '' 71 | '' Other variables and temporaries. '' 72 | '' ======================================================================== '' 73 | DIM I ' Used as a loop index everywhere 74 | DIM K ' Temporary used in HandleInput 75 | DIM #V ' Temporary used in velocity update 76 | 77 | '' ======================================================================== '' 78 | '' Initialize the world. '' 79 | '' ======================================================================== '' 80 | WAIT 81 | MODE 0, 0, 0, 0, 0 ' Black screen, color-stack 82 | WAIT 83 | SEL = 0 84 | AX = 0 85 | AY = 0 86 | FOR I = 0 TO 7 87 | ' Middle of the screen 88 | #PX(I) = 80 * 256 89 | #PY(I) = 48 * 256 90 | 91 | ' Moving random directions away from center, slowly. 92 | VX(I) = RANDOM(16) - 8 93 | VY(I) = RANDOM(16) - 8 94 | NEXT I 95 | GOSUB UpdateObjects ' Establish an object baseline 96 | 97 | '' ======================================================================== '' 98 | '' Main loop. '' 99 | '' ======================================================================== '' 100 | MainLoop: 101 | WAIT 102 | GOSUB HandleInput 103 | GOSUB UpdatePhysics 104 | GOSUB UpdateObjects 105 | GOTO MainLoop 106 | 107 | '' ======================================================================== '' 108 | '' HandleInput '' 109 | '' '' 110 | '' Keypad 1 - 8 selects an object 0 - 7. '' 111 | '' DISC accelerates the object in the requested direction. '' 112 | '' Action buttons decelerate the object. '' 113 | '' ======================================================================== '' 114 | HandleInput: PROCEDURE 115 | I = CONT 116 | K = CONT.KEY 117 | 118 | ' No input at all: Coast. 119 | IF I = 0 THEN 120 | AX = 0 121 | AY = 0 122 | RETURN 123 | END IF 124 | 125 | ' If keypad pressed, change object selection, and coast. 126 | IF K < 12 THEN 127 | IF K > 0 AND K < 9 THEN SEL = K - 1 128 | AX = 0 129 | AY = 0 130 | RETURN 131 | END IF 132 | 133 | ' If action button pressed, decelerate current object. 134 | IF HasAction(I / $20) THEN 135 | #V = -VX(SEL) 136 | #V = #V + ((DECEL_SMOOTHING - 1) XOR 2*(#V < 0)) ' Round away from 0 137 | AX = #V / DECEL_SMOOTHING 138 | 139 | #V = -VY(SEL) 140 | #V = #V + ((DECEL_SMOOTHING - 1) XOR 2*(#V < 0)) ' Round away from 0 141 | AY = #V / DECEL_SMOOTHING 142 | RETURN 143 | END IF 144 | 145 | ' Try to interpret the input as a DISC input. If the disc is pressed, 146 | ' pick an acceleration that will eventually cause velocity to match the 147 | ' direction pushed. 148 | IF I < $20 AND DiscOK(I) THEN 149 | #V = DiscX(I) - VX(SEL) 150 | #V = #V + ((ACCEL_SMOOTHING - 1) XOR 2*(#V < 0)) ' Round away from 0 151 | AX = #V / ACCEL_SMOOTHING 152 | 153 | #V = DiscY(I) - VY(SEL) 154 | #V = #V + ((ACCEL_SMOOTHING - 1) XOR 2*(#V < 0)) ' Round away from 0 155 | AY = #V / ACCEL_SMOOTHING 156 | END IF 157 | END 158 | 159 | ' HasAction should be indexed by the upper 3 bits of CONT. Returns 1 if 160 | ' the bit-pattern corresponds to one or more action buttons being pressed. 161 | HasAction: DATA 0, 0, 0, 1, 0, 1, 1, 1 162 | 163 | ' DiscOK returns 1 if the corresponding bit pattern is a valid disc input. 164 | ' DiscX and DiscY are signed 8 bit acceleration values, scaled to the signed 165 | ' range (-127, 127). 166 | DiscOK: DATA 0,1,1,1,1,0,1,0,1,1,0,0,1,0,0,0,0,1,1,1,1,0,1,0,1,1,0,0,1,0,0,0 167 | 168 | DiscX: DATA $0000, $0000, $007F, $0030, $0000, $0000, $0075, $0000 169 | DATA $FF81, $FF8B, $0000, $0000, $FFD0, $0000, $0000, $0000 170 | DATA $0000, $FFD0, $0075, $0059, $0030, $0000, $0059, $0000 171 | DATA $FF8B, $FFA7, $0000, $0000, $FFA7, $0000, $0000, $0000 172 | DiscY: DATA $0000, $007F, $0000, $0075, $FF81, $0000, $FFD0, $0000 173 | DATA $0000, $0030, $0000, $0000, $FF8B, $0000, $0000, $0000 174 | DATA $0000, $0075, $0030, $0059, $FF8B, $0000, $FFA7, $0000 175 | DATA $FFD0, $0059, $0000, $0000, $FFA7, $0000, $0000, $0000 176 | 177 | '' ======================================================================== '' 178 | '' UpdatePhysics '' 179 | '' '' 180 | '' This computes the new position and velocity given the current velocity '' 181 | '' and acceleration. '' 182 | '' '' 183 | '' AX, AY give the new acceleration input for the selected object. '' 184 | '' The acceleration inputs are zero for all other objects. '' 185 | '' ======================================================================== '' 186 | UpdatePhysics: PROCEDURE 187 | ' Compute new velocity for selected object. 188 | #V = VX(SEL) + AX 189 | IF #V > 127 THEN #V = 127 190 | IF #V < -127 THEN #V = -127 191 | VX(SEL) = #V 192 | 193 | #V = VY(SEL) + AY 194 | IF #V > 127 THEN #V = 127 195 | IF #V < -127 THEN #V = -127 196 | VY(SEL) = #V 197 | 198 | ' Compute new position for all 8 objects. 199 | FOR I = 0 to 7 200 | #V = VX(I) * 4 201 | #PX(I) = #V + #PX(I) 202 | ' Stay on visible display by keeping X in [0, 168]. 203 | IF #PX(I) >= 168*256 THEN #PX(I) = (168*256 XOR (#V > 0)) + #PX(I) 204 | 205 | #V = VY(I) * 4 206 | #PY(I) = #V + #PY(I) 207 | ' Stay on visible display by keeping Y in [0, 104]. 208 | IF #PY(I) >= 104*256 THEN #PY(I) = (104*256 XOR (#V > 0)) + #PY(I) 209 | NEXT I 210 | END 211 | 212 | '' ======================================================================== '' 213 | '' UpdateObjects '' 214 | '' ======================================================================== '' 215 | UpdateObjects: PROCEDURE 216 | SPRITE 0, #PX(0) / 256 + $200, #PY(0) / 256 + $100, 10*8 + $1000 217 | SPRITE 1, #PX(1) / 256 + $200, #PY(1) / 256 + $100, 10*8 + 1 218 | SPRITE 2, #PX(2) / 256 + $200, #PY(2) / 256 + $100, 10*8 + 2 219 | SPRITE 3, #PX(3) / 256 + $200, #PY(3) / 256 + $100, 10*8 + 3 220 | SPRITE 4, #PX(4) / 256 + $200, #PY(4) / 256 + $100, 10*8 + 4 221 | SPRITE 5, #PX(5) / 256 + $200, #PY(5) / 256 + $100, 10*8 + 5 222 | SPRITE 6, #PX(6) / 256 + $200, #PY(6) / 256 + $100, 10*8 + 6 223 | SPRITE 7, #PX(7) / 256 + $200, #PY(7) / 256 + $100, 10*8 + $1007 224 | 225 | ' Blink the color for the selected object. 226 | ' Force it to white approximately twice per second. 227 | IF FRAME AND 16 THEN 228 | SPRITE SEL, #PX(SEL) / 256 + $200, #PY(SEL) / 256 + $100, 10*8 + 7 229 | END IF 230 | END 231 | -------------------------------------------------------------------------------- /contrib/hello.bas: -------------------------------------------------------------------------------- 1 | REM ************************************************************************* 2 | REM IntyBASIC Project: HELLO 3 | REM 4 | REM This is an IntyBASIC version of the classic "Hello World" program. 5 | REM All it does is clear the screen and display a simple message. You 6 | REM can use this program as a "baseline" to make sure your tools and 7 | REM workflows are working as expected. 8 | REM ************************************************************************* 9 | REM Programmer: DZ-Jay 10 | REM Created: Tue 07/07/2015 11 | REM Updated: Tue 07/07/2015 12 | REM 13 | REM Project automatically generated by INTYNEW. 14 | REM ************************************************************************* 15 | 16 | REM Include useful predefined constants 17 | INCLUDE "constants.bas" 18 | 19 | REM ********************** 20 | REM INITIALIZATION 21 | REM ********************** 22 | REM Initialize the screen to use Color Stack 23 | REM Set the stack colors and load the graphic 24 | MODE SCREEN_CS, STACK_WHITE, STACK_WHITE, STACK_WHITE, STACK_WHITE 25 | DEFINE DEF00,1,graphics 26 | WAIT 27 | 28 | REM ********************** 29 | REM MAIN 30 | REM ********************** 31 | REM Clear the screen a display a message 32 | CLS 33 | PRINT AT SCREENPOS(4, 5) COLOR CS_BLUE, "Hello World!" 34 | 35 | REM Display the IntyBASIC SDK logo icon 36 | PRINT AT SCREENPOS(9, 7), SPR00 + CS_BLACK 37 | 38 | loop: 39 | REM Loop forever! 40 | GOTO loop 41 | 42 | graphics: 43 | REM SDK Logo 44 | BITMAP "..#.#..." 45 | BITMAP ".#####.." 46 | BITMAP ".#.##.#." 47 | BITMAP ".####.#." 48 | BITMAP "###.##.#" 49 | BITMAP "###.##.#" 50 | BITMAP ".#.#####" 51 | BITMAP "...#####" 52 | -------------------------------------------------------------------------------- /contrib/intbas.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # ------------------------------------------------------------------- 4 | # PROGRAM: intbas.pl 5 | # AUTHOR: James Pujals (a.k.a. DZ-Jay) 6 | # DESCRIPTION: Compiles a BASIC source file using IntvBasic compiler 7 | # and then assembles it using AS-1600 assembler. 8 | # LAST UPDATED: 2014-10-24 9 | # 10 | # LICENSE: This crappy "program" has been released to the public 11 | # domain by the author. No claims of ownership are 12 | # made. In fact, I regret putting my name on it. ;) 13 | # ------------------------------------------------------------------- 14 | 15 | use Cwd; 16 | 17 | my $PROLOGUE = 'intybasic_prologue.asm'; 18 | my $EPILOGUE = 'intybasic_epilogue.asm'; # MAKE SURE TO CONFIGURE THESE: 19 | my $SDK_PATH = $ENV{'INTV_SDK_PATH' }; # Base path to the SDK-1600 installation. 20 | my $BAS_PATH = $ENV{'INTV_BASIC_PATH'}; # Base path to the IntyBasic installation. 21 | my $LIB_PATH = $ENV{'INTV_BASIC_PATH'} . "/lib"; # Location of prologue and epilogue files. 22 | 23 | # ------------------------------------------------------------------- 24 | # PROCESS INPUT 25 | # ------------------------------------------------------------------- 26 | my $src_path = shift(@ARGV) or usage(); 27 | my ($path, 28 | $fullname, 29 | $name, 30 | $ext) = ($src_path =~ m/^(.+\/)?(([^\/]+)\.([\w]+))$/i); 31 | my $asm_dir = $path . "asm"; 32 | my $bin_dir = $path . "bin"; 33 | my $asm_file = "${ name }.asm"; 34 | 35 | # ------------------------------------------------------------------- 36 | # VALIDATE INPUT 37 | # ------------------------------------------------------------------- 38 | usage('Bad extension' ) unless ($ext eq 'bas'); 39 | usage('Bad file path' ) unless ($fullname); 40 | usage('file not found') unless (!$path || -e $path); 41 | 42 | usage("Prologue not found in library path \"${ LIB_PATH }\"") unless (-e "${ LIB_PATH }/${ PROLOGUE }"); 43 | usage("Epilogue not found in library path \"${ LIB_PATH }\"") unless (-e "${ LIB_PATH }/${ EPILOGUE }"); 44 | check_dirs($asm_dir, $bin_dir); 45 | 46 | # ------------------------------------------------------------------- 47 | # COMPILE BASIC PROGRAM SOURCE 48 | # ------------------------------------------------------------------- 49 | { 50 | # IntyBASIC now accepts a library path for the 51 | # Prologue and Epilogue modules, so we don't 52 | # need to make symbolic links anymore! YAY! 53 | # check_lib($path); 54 | 55 | my $intybasic = $BAS_PATH . '/bin/intybasic'; 56 | my $cmd_line = "${ intybasic } ${ fullname } asm/${ asm_file } ${ LIB_PATH }"; 57 | my $curr_dir = cwd(); 58 | 59 | # Go to the source directory 60 | if ($path) 61 | { 62 | chdir "${ path }" or usage($!); 63 | } 64 | 65 | $result = `${ cmd_line }`; # Compile..! 66 | 67 | # Return to whence we came 68 | if ($path) 69 | { 70 | chdir "${ curr_dir }" or usage($!); 71 | } 72 | } 73 | 74 | # ------------------------------------------------------------------- 75 | # ASSEMBLE ROM BINARY 76 | # ------------------------------------------------------------------- 77 | { 78 | my $as1600 = $SDK_PATH . '/bin/as1600'; 79 | my $cmd_line = "${ as1600 } -o ${ bin_dir }/${ name } -l ${ bin_dir }/${ name }.ls -s ${ bin_dir }/${ name }.sym -j ${ bin_dir }/${ name }.map ${ asm_dir }/${ asm_file }"; 80 | 81 | $result = `${ cmd_line }`; 82 | } 83 | 84 | print "Done.\n"; 85 | exit; 86 | 87 | # ------------------------------------------------------------------- 88 | # SUBROUTINES 89 | # ------------------------------------------------------------------- 90 | 91 | sub usage 92 | { 93 | my $err = shift(@_); 94 | 95 | print "ERROR: ${ err }\n" if ($err); 96 | 97 | my ($prog) = ($0 =~ /.*\/(.+)/); 98 | die("Usage: $prog source.bas\n"); 99 | } 100 | 101 | # O HAI! I HAS NOT NEEDED ANIMOAR! 102 | # KTHXBYE NANOCHESS! 103 | sub check_lib 104 | { 105 | my $path = shift(@_); 106 | 107 | # Silly IntyBasic, it expects the prologue and epilogue 108 | # library files to be in the current working directory. 109 | # We get around this by making symbolic links to the 110 | # library files in the Basic source directory and then 111 | # CHDIR to it prior to compilation. 112 | 113 | # Ensure we have a symbolic link to the prologue 114 | unless (-e "${ path }${ PROLOGUE }") 115 | { 116 | my $result = `ln -s ${ LIB_PATH }/${ PROLOGUE } ${ path }${ PROLOGUE }` 117 | } 118 | 119 | # Ensure we have a symbolic link to the epilogue 120 | unless (-e "${ path }${ EPILOGUE }") 121 | { 122 | my $result = `ln -s ${ LIB_PATH }/${ EPILOGUE } ${ path }${ EPILOGUE }` 123 | } 124 | } 125 | 126 | sub check_dirs 127 | { 128 | my ($asm, $bin) = @_; 129 | 130 | # Ensure we have an "asm" directory 131 | unless (-e $asm) 132 | { 133 | mkdir($asm) or usage($!); 134 | } 135 | 136 | # Ensure we have a "bin" directory 137 | unless (-e $bin) 138 | { 139 | mkdir($bin) or usage($!); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /contrib/keypad.bas: -------------------------------------------------------------------------------- 1 | REM Module: KEYPAD.BAS 2 | REM 3 | REM Description: Raw keypad demonstration - A demo for IntyBASIC. 4 | REM Author: Mark Ball 5 | REM Date: 01/01/16 6 | REM Version: 1.03F 7 | REM 8 | REM HISTORY 9 | REM ------- 10 | REM 1.00F 13/07/15 - First release 11 | REM 1.01F 13/07/15 - Modified instruction text. 12 | REM 1.02F 13/07/15 - Added side buttons. 13 | REM 1.03F 01/01/16 - Added pause buttons. 14 | REM 15 | 16 | ' We need some important constants. 17 | include "constants.bas" 18 | 19 | cls ' Clear the screen. 20 | 21 | ' Display some instructions. 22 | print at screenpos(0,0), "Press buttons on a" 23 | print at screenpos(0,1), "controller's keypad" 24 | print at screenpos(0,4), "Button ..." 25 | print at screenpos(0,5), "Value ...." 26 | 27 | loop: 28 | wait ' Wait for the vertical blank. 29 | keypad=cont ' Get the raw hand controller value at this instant. 30 | 31 | print at screenpos(11,5), <3>keypad ' Display the controller response. 32 | 33 | ' Check if a keypad button is down, 34 | if keypad=0 then print at screenpos(11,4), " ": goto loop 35 | 36 | ' A keypad button is down, so display what it is. 37 | if keypad=KEYPAD_0 then print at screenpos(11,4), "0" 38 | if keypad=KEYPAD_1 then print at screenpos(11,4), "1" 39 | if keypad=KEYPAD_2 then print at screenpos(11,4), "2" 40 | if keypad=KEYPAD_3 then print at screenpos(11,4), "3" 41 | if keypad=KEYPAD_4 then print at screenpos(11,4), "4" 42 | if keypad=KEYPAD_5 then print at screenpos(11,4), "5" 43 | if keypad=KEYPAD_6 then print at screenpos(11,4), "6" 44 | if keypad=KEYPAD_7 then print at screenpos(11,4), "7" 45 | if keypad=KEYPAD_8 then print at screenpos(11,4), "8" 46 | if keypad=KEYPAD_9 then print at screenpos(11,4), "9" 47 | if keypad=KEYPAD_ENTER then print at screenpos(11,4), "enter" 48 | if keypad=KEYPAD_CLEAR then print at screenpos(11,4), "clear" 49 | if keypad=KEYPAD_PAUSE then print at screenpos(11,4), "pause" 50 | if keypad=BUTTON_1 then print at screenpos(11,4), "top" 51 | if keypad=BUTTON_2 then print at screenpos(11,4), "b-left" 52 | if keypad=BUTTON_3 then print at screenpos(11,4), "b-right" 53 | 54 | 55 | ' Keep checking for keypad buttons. 56 | goto loop -------------------------------------------------------------------------------- /contrib/tcg.bas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nanochess/IntyBASIC/606e128a7bb794c8a02e7650742dd60ca8e31434/contrib/tcg.bas -------------------------------------------------------------------------------- /global.h: -------------------------------------------------------------------------------- 1 | // 2 | // global.h 3 | // intybasic 4 | // 5 | // Created by Oscar Toledo on 07/01/16. 6 | // Copyright (c) 2016 Oscar Toledo. All rights reserved. 7 | // 8 | 9 | #ifndef _intybasic_global_h_ 10 | #define _intybasic_global_h_ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | using namespace std; 18 | 19 | extern const string LABEL_PREFIX; // Prefix for BASIC labels 20 | extern const string TEMP_PREFIX; // Prefix for temporal labels 21 | extern const string VAR_PREFIX; // Prefix for BASIC variables 22 | extern const string FUNC_PREFIX; // Prefix for USR functions 23 | 24 | extern map name_mangling; // Map from label number to name 25 | extern map name_mangling_var; // Map from label number to name 26 | 27 | extern void mangle(string); 28 | extern void mangle_label(string, int); 29 | 30 | extern class code *output; 31 | 32 | extern int next_local; 33 | 34 | extern ofstream asm_output; // IntyBASIC.cpp 35 | 36 | extern bool optimized; // Indicates if expression for IF statement jump was optimized 37 | extern bool jlp_used; // Indicates if JLP is used 38 | extern bool fastmult_used; // Indicates if fast multiplication is used 39 | extern bool fastdiv_used; // Indicates if fast division/remainder is used 40 | extern bool music_used; // Indicates if music used 41 | extern int err_code; 42 | 43 | // Lexical components mixed with expression tree node types 44 | enum lexical_component {C_END, C_NAME, C_NAME_R, C_NAME_RO, 45 | C_STRING, C_LABEL, C_NUM, 46 | C_OR, C_XOR, C_AND, C_NOT, C_NEG, C_PEEK, C_ABS, C_SGN, 47 | C_READ, C_VAR, C_USR, C_RAND, C_RANDOM, C_EXTEND, 48 | C_ASSIGN, 49 | C_EQUAL, C_NOTEQUAL, C_LESS, C_LESSEQUAL, C_GREATER, C_GREATEREQUAL, 50 | C_PLUS, C_MINUS, C_PLUSF, C_MINUSF, C_MUL, C_DIV, C_MOD, 51 | C_LPAREN, C_RPAREN, C_COLON, C_PERIOD, C_COMMA, 52 | C_ERR}; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /microcode.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // microcode.cpp 3 | // This module keeps assembler instructions generated... 4 | // ...by IntyBASIC in a list ready to be output. 5 | // 6 | // Created by Oscar Toledo on 07/01/16. 7 | // Copyright (c) 2016 Oscar Toledo. All rights reserved. 8 | // 9 | 10 | #include 11 | 12 | using namespace std; 13 | 14 | #include "global.h" 15 | #include "microcode.h" 16 | 17 | static const char *opcode_list[] = { 18 | "ADCR", "ADD", "ADD@", "ADDI", "ADDR", "AND", "AND@", "ANDI", "ANDR", 19 | "B", "BC", "BEQ", "BGE", "BGT", "BLE", "BLT", "BMI", "BNC", "BNE", "BPL", 20 | "CALL", "CLRC", "CLRR", "CMP", "CMP@", "CMPI", "CMPR", "COMR", "DECLE", "DECR", 21 | "INCR", "MOVR", "MVI", "MVI@", "MVII", "MVO", "MVO@", "MULT", "NEGR", "NOP", 22 | "PSHR", "PULR", "RRC", "RETURN", "RSWD", 23 | "SARC", "SLL", "SLR", "SUB", "SUB@", "SUBI", "SUBR", "SWAP", 24 | "TSTR", "XOR", "XOR@", "XORI", "XORR", 25 | }; 26 | 27 | // 28 | // Saves microcode 29 | // 30 | microcode::microcode(enum microcode_style style, int type, int r1, int r2, string prefix, int value, int offset) 31 | { 32 | this->style = style; 33 | this->type = type; 34 | this->r1 = r1; 35 | this->r2 = r2; 36 | this->prefix = prefix; 37 | this->value = value; 38 | this->offset = offset; 39 | } 40 | 41 | // 42 | // Get type of microcode 43 | // 44 | int microcode::get_type(void) 45 | { 46 | return this->type; 47 | } 48 | 49 | // 50 | // Get register 1 51 | // 52 | int microcode::get_r1(void) 53 | { 54 | return this->r1; 55 | } 56 | 57 | // 58 | // Get register 2 59 | // 60 | int microcode::get_r2(void) 61 | { 62 | return this->r2; 63 | } 64 | 65 | // 66 | // Get prefix 67 | // 68 | string microcode::get_prefix(void) 69 | { 70 | return this->prefix; 71 | } 72 | 73 | // 74 | // Get value 75 | // 76 | int microcode::get_value(void) 77 | { 78 | return this->value; 79 | } 80 | 81 | // 82 | // Generate assembler code for a microcode 83 | // 84 | void microcode::dump(void) { 85 | switch (this->style) { 86 | case M_SINGLE: // Single opcode: NOP 87 | asm_output << "\t" << opcode_list[this->type]; 88 | break; 89 | case M_R: // Single register: CLRR R0 90 | asm_output << "\t" << opcode_list[this->type] << " R" << this->r1; 91 | break; 92 | case M_RR: // Double register: MOVR R0,R1 93 | asm_output << "\t" << opcode_list[this->type] << " R" << this->r1 << ","; 94 | if (this->r2 == 7) 95 | asm_output << "PC"; 96 | else 97 | asm_output << "R" << this->r2; 98 | break; 99 | case M_NR: // Constant: MVII #5,R0 100 | asm_output << "\t" << opcode_list[this->type] << " #"; 101 | if (this->prefix == "") 102 | asm_output << (this->value & 0xffff); 103 | else 104 | mangle_label(this->prefix, this->value); 105 | if (this->offset && (this->offset & 0x8000) == 0) 106 | asm_output << "+" << this->offset; 107 | else if ((this->offset & 0x8000) != 0) 108 | asm_output << "-" << (0x10000 - this->offset); 109 | asm_output << ",R" << this->r1; 110 | break; 111 | case M_NNR: // Constant: ADDI #label-label,R0 112 | asm_output << "\t" << opcode_list[this->type] << " #("; 113 | mangle_label(this->prefix, this->value); 114 | asm_output << "-"; 115 | mangle_label(this->prefix, this->r2); 116 | if (this->offset && (this->offset & 0x8000) == 0) 117 | asm_output << "+" << this->offset; 118 | else if ((this->offset & 0x8000) != 0) 119 | asm_output << "-" << (0x10000 - this->offset); 120 | asm_output << ") AND $FFFF,R" << this->r1; 121 | // Note how the AND in expression solves a bug when subtraction creates a big negative 122 | // number, triggering an error in as1600 123 | break; 124 | case M_LR: // Label and register: MVI V2,R0 125 | asm_output << "\t" << opcode_list[this->type] << " "; 126 | if (this->prefix == "") { 127 | asm_output << this->value; 128 | } else if (this->value == -1) { 129 | asm_output << this->prefix; 130 | } else { 131 | mangle_label(this->prefix, this->value); 132 | } 133 | if (this->offset) 134 | asm_output << "+" << this->offset; 135 | asm_output << ",R" << this->r1; 136 | break; 137 | case M_RL: // Register and label: MVO R0,V2 138 | asm_output << "\t" << opcode_list[this->type] << " R" << this->r1 << ","; 139 | if (this->prefix == "") 140 | asm_output << this->value; 141 | else if (this->value == -1) 142 | asm_output << this->prefix; 143 | else 144 | mangle_label(this->prefix, this->value); 145 | if (this->offset && (this->offset & 0x8000) == 0) 146 | asm_output << "+" << this->offset; 147 | else if ((this->offset & 0x8000) != 0) 148 | asm_output << "-" << (0x10000 - this->offset); 149 | break; 150 | case M_A: // Address (jumps): CALL CLRSCR 151 | asm_output << "\t" << opcode_list[this->type] << " "; 152 | if (this->prefix == "") 153 | asm_output << "$+" << this->value; 154 | else if (this->value == -1) 155 | asm_output << this->prefix; 156 | else 157 | mangle_label(this->prefix, this->value); 158 | break; 159 | case M_S: // Shifts: SLL R0,1 160 | asm_output << "\t" << opcode_list[this->type] << " R" << this->r1 << "," << this->value; 161 | break; 162 | case M_M: // Multiply (macro): MULT R0,R4,5 163 | asm_output << "\t" << opcode_list[this->type] << " R" << this->r1 << ",R" << this->r2 << "," << this->value; 164 | break; 165 | case M_L: // Label 166 | mangle_label(this->prefix, this->value); 167 | asm_output << ":"; 168 | break; 169 | case M_D: // Single word of data 170 | asm_output << "\t" << opcode_list[this->type] << " " << (this->r1 & 0xffff); 171 | break; 172 | case M_D2: // Double word of data 173 | asm_output << "\t" << opcode_list[this->type] << " " << (this->r1 & 0xffff) << "," << (this->r2 & 0xffff); 174 | break; 175 | case M_DL: // Label as data 176 | asm_output << "\t" << opcode_list[this->type] << " "; 177 | if (this->value == -1) 178 | asm_output << this->prefix; 179 | else 180 | mangle_label(this->prefix, this->value); 181 | if (this->offset) 182 | asm_output << "+" << this->offset; 183 | break; 184 | case M_LITERAL: // Literal assembler code 185 | asm_output << this->prefix; 186 | break; 187 | } 188 | asm_output << "\n"; 189 | } 190 | -------------------------------------------------------------------------------- /microcode.h: -------------------------------------------------------------------------------- 1 | // 2 | // microcode.h 3 | // intybasic 4 | // 5 | // Created by Oscar Toledo on 07/01/16. 6 | // Copyright (c) 2016 Oscar Toledo. All rights reserved. 7 | // 8 | 9 | #ifndef _intybasic_microcode_ 10 | #define _intybasic_microcode_ 11 | 12 | enum opcode { 13 | N_ADCR, N_ADD, N_ADDA, N_ADDI, N_ADDR, N_AND, N_ANDA, N_ANDI, N_ANDR, 14 | N_B, N_BC, N_BEQ, N_BGE, N_BGT, N_BLE, N_BLT, N_BMI, N_BNC, N_BNE, N_BPL, 15 | N_CALL, N_CLRC, N_CLRR, N_CMP, N_CMPA, N_CMPI, N_CMPR, N_COMR, N_DECLE, N_DECR, 16 | N_INCR, N_MOVR, N_MVI, N_MVIA, N_MVII, N_MVO, N_MVOA, N_MULT, N_NEGR, N_NOP, 17 | N_PSHR, N_PULR, N_RRC, N_RETURN, N_RSWD, 18 | N_SARC, N_SLL, N_SLR, N_SUB, N_SUBA, N_SUBI, N_SUBR, N_SWAP, 19 | N_TSTR, N_XOR, N_XORA, N_XORI, N_XORR 20 | }; 21 | 22 | enum microcode_style { 23 | M_SINGLE, M_R, M_RR, M_NR, M_NNR, M_LR, M_RL, 24 | M_A, M_S, M_M, M_L, M_D, M_D2, M_DL, M_LITERAL 25 | }; 26 | 27 | // 28 | // Microcode structure and output to assembler 29 | // 30 | class microcode { 31 | enum microcode_style style; 32 | int type; 33 | int r1; 34 | int r2; 35 | string prefix; 36 | int value; 37 | int offset; 38 | 39 | public: 40 | microcode(enum microcode_style style, int type, int r1, int r2, string prefix, int value, int offset); 41 | int get_type(void); 42 | int get_r1(void); 43 | int get_r2(void); 44 | string get_prefix(void); 45 | int get_value(void); 46 | void dump(void); 47 | }; 48 | 49 | #endif /* defined(_intybasic_microcode_) */ 50 | -------------------------------------------------------------------------------- /node.h: -------------------------------------------------------------------------------- 1 | // 2 | // node.h 3 | // intybasic 4 | // 5 | // Created by Oscar Toledo on 07/01/16. 6 | // Copyright (c) 2016 Oscar Toledo. All rights reserved. 7 | // 8 | 9 | #ifndef _intybasic_node_ 10 | #define _intybasic_node_ 11 | 12 | // 13 | // Expression tree builder 14 | // 15 | class node { 16 | enum lexical_component type; 17 | int value; 18 | int regs; 19 | class node *left; 20 | class node *right; 21 | 22 | public: 23 | node(enum lexical_component type, int value, class node *left, class node *right); 24 | ~node(); 25 | enum lexical_component node_type(void); 26 | int node_value(void); 27 | class node *node_left(void); 28 | class node *node_right(void); 29 | void set_right(class node *right); 30 | bool valid_array(void); 31 | void annotate_index_for_subexpression(void); 32 | void label(void); 33 | void generate(int reg, int decision); 34 | }; 35 | 36 | #endif /* defined(_intybasic_node_) */ 37 | -------------------------------------------------------------------------------- /samples/banks.bas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Example of program in banks 3 | ' 4 | ' by Oscar Toledo G. 5 | ' https://nanochess.org/ 6 | ' 7 | ' Creation date: Apr/27/2025. 8 | ' 9 | 10 | ' 11 | ' Notice this program only can be generated as .bin+.cfg format, 12 | ' because the ROM format doesn't support bank-switching 13 | ' information. 14 | ' 15 | OPTION MAP 3 16 | 17 | PRINT AT 21,"Main program" 18 | 19 | BANK SELECT 0 20 | 21 | GOSUB subroutine_0 22 | 23 | BANK SELECT 1 24 | 25 | GOSUB subroutine_1 26 | 27 | BANK SELECT 2 28 | 29 | GOSUB subroutine_2 30 | 31 | BANK SELECT 3 32 | 33 | GOSUB subroutine_3 34 | 35 | WHILE 1: WEND 36 | 37 | BANK 0 38 | 39 | subroutine_0: PROCEDURE 40 | PRINT AT 41,"Bank 0" 41 | END 42 | 43 | BANK 1 44 | 45 | subroutine_1: PROCEDURE 46 | PRINT AT 61,"Bank 1" 47 | END 48 | 49 | BANK 2 50 | 51 | subroutine_2: PROCEDURE 52 | PRINT AT 81,"Bank 2" 53 | END 54 | 55 | BANK 3 56 | 57 | subroutine_3: PROCEDURE 58 | PRINT AT 101,"Bank 3" 59 | END 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /samples/bats.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Bats 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Sep/01/2015 6 | REM 7 | 8 | ' Note there is no use of labels, thanks to the use of the structured loops 9 | 10 | include "constants.bas" 11 | 12 | DIM x(8),y(8),f(8),dx(8) 13 | 14 | ' Put in random coordinate each bat 15 | FOR a = 0 TO 7 16 | x(a) = RANDOM(152) + 8 17 | y(a) = RANDOM(48) + 24 18 | f(a) = $2d ' Uses M and W letter ($2d and $37), V for attack ($36) 19 | dx(a) = 1 20 | NEXT a 21 | 22 | bats = 8 23 | 24 | ' Main loop 25 | DO 26 | ' Show bats 27 | FOR a = 0 TO 7 28 | SPRITE a,x(a)+VISIBLE,y(a),f(a)*8+(a AND 1)*3+2 29 | NEXT a 30 | WAIT 31 | ' Move bats 32 | FOR a = 0 TO 7 33 | IF f(a) = $36 THEN ' Attacking? 34 | IF y(a) < 104 THEN y(a) = y(a) + 1:IF y(a) > 103 THEN bats = bats - 1 35 | ELSE 36 | ' Bats goes left to right and back 37 | x(a) = x(a) + dx(a) 38 | IF x(a) = 8 OR x(a) = 160 THEN dx(a) = -dx(a) 39 | ' Vertical movement is random (-2 to +2) 40 | y(a) = y(a) + RANDOM(5) - 2 41 | IF y(a) < 8 THEN y(a) = 8 42 | IF y(a) > 80 THEN y(a) = 80 43 | ' Move wings each 4 frames 44 | IF (FRAME AND 3) = 0 THEN IF f(a) = $2D THEN f(a) = $37 ELSE f(a) = $2d 45 | END IF 46 | NEXT a 47 | IF (FRAME AND 255) = 0 THEN ' Each 256 frames, a bat attacks 48 | FOR a = 0 TO 7 49 | IF f(a) <> $36 THEN f(a) = $36:EXIT FOR 50 | NEXT a 51 | END IF 52 | LOOP UNTIL bats = 0 53 | 54 | WAIT 55 | 56 | FOR a = 0 TO 7 57 | SPRITE a,0 58 | NEXT a 59 | -------------------------------------------------------------------------------- /samples/controller.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Controllers test 3 | REM Demo for IntyBASIC. 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Apr/02/2014 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | CLS 12 | 13 | loop: WAIT 14 | IF cont1.up THEN PRINT AT SCREENPOS(4, 1),"1" ELSE PRINT AT SCREENPOS(4, 1),"0" 15 | IF cont1.left THEN PRINT AT SCREENPOS(3, 2),"1" ELSE PRINT AT SCREENPOS(3, 2),"0" 16 | IF cont1.right THEN PRINT AT SCREENPOS(5, 2),"1" ELSE PRINT AT SCREENPOS(5, 2),"0" 17 | IF cont1.down THEN PRINT AT SCREENPOS(4, 3),"1" ELSE PRINT AT SCREENPOS(4, 3),"0" 18 | IF cont1.b0 THEN PRINT AT SCREENPOS(3, 5),"1" ELSE PRINT AT SCREENPOS(3, 5),"0" 19 | IF cont1.b1 THEN PRINT AT SCREENPOS(4, 5),"1" ELSE PRINT AT SCREENPOS(4, 5),"0" 20 | IF cont1.b2 THEN PRINT AT SCREENPOS(5, 5),"1" ELSE PRINT AT SCREENPOS(5, 5),"0" 21 | 22 | a=cont1 23 | 24 | PRINT AT 183 25 | b=a/16 26 | GOSUB hex 27 | b=a 28 | GOSUB hex 29 | 30 | a=cont1.key 31 | PRINT AT 141,"key " 32 | b=a/16 33 | GOSUB hex 34 | b=a 35 | GOSUB hex 36 | 37 | IF cont2.up THEN PRINT AT SCREENPOS(14, 1),"1" ELSE PRINT AT SCREENPOS(14, 1),"0" 38 | IF cont2.left THEN PRINT AT SCREENPOS(13, 2),"1" ELSE PRINT AT SCREENPOS(13, 2),"0" 39 | IF cont2.right THEN PRINT AT SCREENPOS(15, 2),"1" ELSE PRINT AT SCREENPOS(15, 2),"0" 40 | IF cont2.down THEN PRINT AT SCREENPOS(14, 3),"1" ELSE PRINT AT SCREENPOS(14, 3),"0" 41 | IF cont2.b0 THEN PRINT AT SCREENPOS(13, 5),"1" ELSE PRINT AT SCREENPOS(13, 5),"0" 42 | IF cont2.b1 THEN PRINT AT SCREENPOS(14, 2),"1" ELSE PRINT AT SCREENPOS(14, 2),"0" 43 | IF cont2.b2 THEN PRINT AT SCREENPOS(15, 2),"1" ELSE PRINT AT SCREENPOS(15, 2),"0" 44 | 45 | a=cont2 46 | 47 | PRINT AT SCREENPOS(13, 9) 48 | b=a/16 49 | GOSUB hex 50 | b=a 51 | GOSUB hex 52 | 53 | a=cont2.key 54 | PRINT AT SCREENPOS(11, 7),"key " 55 | b=a/16 56 | GOSUB hex 57 | b=a 58 | GOSUB hex 59 | 60 | GOTO loop 61 | 62 | 63 | hex: PROCEDURE 64 | 65 | b = b and 15 66 | b = b + "0" 67 | if b > "9" then b=b+7 68 | PRINT b*8+7 69 | RETURN 70 | 71 | END 72 | -------------------------------------------------------------------------------- /samples/envelope.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Envelope volume usage 3 | REM by Oscar Toledo G. http://nanochess.org/ 4 | REM Jan/23/2016 5 | REM 6 | 7 | INCLUDE "constants.bas" 8 | 9 | PRINT AT 0,"ENVELOPE TEST" 10 | 11 | PRINT AT 21,"1 - PIANO NOTE" 12 | PRINT AT 41,"2 - SEAWAVES" 13 | PRINT AT 61,"3 - HELICOPTER" 14 | PRINT AT 81,"4 - DRUMS ROLLING" 15 | PRINT AT 101,"5 - SIREN" 16 | 17 | main_loop: 18 | DO 19 | WAIT 20 | LOOP UNTIL cont.key <> 12 21 | 22 | IF cont.key = 1 THEN GOSUB effect1 23 | IF cont.key = 2 THEN GOSUB effect2 24 | IF cont.key = 3 THEN GOSUB effect3 25 | IF cont.key = 4 THEN GOSUB effect4 26 | IF cont.key = 5 THEN GOSUB effect5 27 | 28 | DO 29 | WAIT 30 | LOOP UNTIL cont.key = 12 31 | 32 | GOTO main_loop 33 | 34 | effect1: PROCEDURE 35 | GOSUB reset_sound 36 | FOR A = 1 TO 10 37 | IF A=1 THEN #C=477 38 | IF A=2 THEN #C=379 39 | IF A=3 THEN #C=319 40 | IF A=4 THEN #C=477 41 | IF A=5 THEN #C=379 42 | IF A=6 THEN #C=319 43 | IF A=7 THEN #C=451 44 | IF A=8 THEN #C=358 45 | IF A=9 THEN #C=301 46 | IF A=10 THEN #C=239 47 | SOUND 0,#C,PSG_ENVELOPE_ENABLE 48 | SOUND 1,(#C+1)/2,PSG_ENVELOPE_ENABLE 49 | SOUND 2,#C*2,PSG_ENVELOPE_ENABLE 50 | SOUND 3,6000,PSG_ENVELOPE_SINGLE_SHOT_RAMP_DOWN_AND_OFF ' Slow decay, single shot \______ 51 | FOR C = 1 TO 30:WAIT:NEXT C 52 | NEXT A 53 | RETURN 54 | END 55 | 56 | effect2: PROCEDURE 57 | GOSUB reset_sound 58 | SOUND 1,1,0 59 | SOUND 2,1,0 60 | SOUND 4,31,$31 61 | SOUND 0,2000,PSG_ENVELOPE_ENABLE 62 | SOUND 3,32000,PSG_ENVELOPE_CYCLE_RAMP_DOWN_SAWTOOTH 63 | RETURN 64 | END 65 | 66 | effect3: PROCEDURE 67 | GOSUB reset_sound 68 | SOUND 4,8,$30 69 | SOUND 0,50,PSG_ENVELOPE_ENABLE 70 | SOUND 3,400,PSG_ENVELOPE_CYCLE_RAMP_UP_TRIANGLE 71 | RETURN 72 | END 73 | 74 | effect4: PROCEDURE 75 | GOSUB reset_sound 76 | SOUND 4,10,$31 77 | SOUND 0,2000,PSG_ENVELOPE_ENABLE 78 | SOUND 3,4000,PSG_ENVELOPE_CYCLE_RAMP_UP_TRIANGLE 79 | RETURN 80 | END 81 | 82 | effect5: PROCEDURE 83 | GOSUB reset_sound 84 | SOUND 0,100,PSG_ENVELOPE_ENABLE 85 | SOUND 1,400,PSG_ENVELOPE_ENABLE 86 | SOUND 3,3600,PSG_ENVELOPE_CYCLE_RAMP_UP_SAWTOOTH 87 | RETURN 88 | END 89 | 90 | reset_sound: PROCEDURE 91 | SOUND 0,1,0 92 | SOUND 1,1,0 93 | SOUND 2,1,0 94 | SOUND 4,,$38 95 | RETURN 96 | END 97 | 98 | -------------------------------------------------------------------------------- /samples/flash.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Use of JLP Flash memory 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Aug/21/2015 6 | REM 7 | 8 | DIM #row(96) 9 | 10 | FLASH INIT 11 | 12 | PRINT AT 0, "First row: ",<>FLASH.FIRST 13 | PRINT AT 20, "Last row: ",<>FLASH.LAST 14 | 15 | PRINT AT 60,"Operations:" 16 | PRINT AT 80,"1> Read row" 17 | PRINT AT 100,"2> Write row" 18 | PRINT AT 120,"3> Erase sector" 19 | 20 | main: WAIT 21 | A = CONT.key 22 | IF A = 1 THEN GOSUB read_row 23 | IF A = 2 THEN GOSUB write_row 24 | IF A = 3 THEN GOSUB erase_sector 25 | IF A = 12 THEN GOTO main 26 | 27 | debounce: 28 | WAIT 29 | A = CONT.key 30 | IF A <> 12 THEN GOTO debounce 31 | 32 | GOTO main 33 | 34 | read_row: PROCEDURE 35 | 36 | FLASH READ FLASH.FIRST,VARPTR #row(0) 37 | PRINT AT 140 COLOR 7 38 | FOR c = 0 TO 15 39 | PRINT <>#row(c),"," 40 | NEXT c 41 | 42 | END 43 | 44 | write_row: PROCEDURE 45 | 46 | FOR c = 0 TO 15 47 | #row(c) = RANDOM(10) 48 | NEXT c 49 | PRINT AT 140 COLOR 5 50 | FOR c = 0 TO 15 51 | PRINT <>#row(c),"," 52 | NEXT c 53 | 54 | FLASH WRITE FLASH.FIRST,VARPTR #row(0) 55 | END 56 | 57 | erase_sector: PROCEDURE 58 | 59 | PRINT AT 140 60 | FOR c = 0 to 99 61 | PRINT " " 62 | NEXT c 63 | 64 | FLASH ERASE FLASH.FIRST 65 | 66 | END 67 | 68 | 69 | -------------------------------------------------------------------------------- /samples/frame.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Frame counting 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Jan/25/2015. 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | ON FRAME GOSUB clock 12 | 13 | main: 14 | GOTO main 15 | 16 | clock: PROCEDURE 17 | PRINT AT SCREENPOS(0, 0),<5>frame 18 | RETURN 19 | END 20 | -------------------------------------------------------------------------------- /samples/game1.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Shooting letters game 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Jan/27/2014. 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | X = 10 12 | S = 0 13 | PRINT AT SCREENPOS(0, 11),"--------------------" 14 | GOSUB update_score 15 | 16 | WAVE = 1 17 | STATE = 0 18 | 19 | loop: WAIT 20 | IF BY THEN SOUND 0,200-BY*10,15 ELSE SOUND 0,,0 21 | PRINT AT SCREENPOS(X, 10)," " 22 | IF BY THEN PRINT AT SCREENPOS(BX, BY)," ":BY=BY-1 23 | IF EY THEN PRINT AT SCREENPOS(EX, EY)," " 24 | IF FRAME AND 1 THEN GOSUB move_player 25 | IF FRAME AND 1 THEN GOSUB enemy 26 | PRINT AT SCREENPOS(X, 10) COLOR CS_GREEN,"A" 27 | IF EY THEN PRINT AT SCREENPOS(EX, EY) COLOR CS_TAN,"E" 28 | IF BY THEN PRINT AT SCREENPOS(BX, BY) COLOR CS_WHITE,"^" 29 | IF BY=EY AND BX=EX AND BY<>0 THEN GOSUB add_points 30 | GOTO loop 31 | 32 | update_score: PROCEDURE 33 | PRINT AT SCREENPOS(0, 0),"Score: ",(S/100%10+16)*8+6,(S/10%10+16)*8+6,(S%10+16)*8+6 34 | END 35 | 36 | move_player: PROCEDURE 37 | IF cont1.left THEN IF X>0 THEN X=X-1 38 | IF cont1.right THEN IF X<19 THEN X=X+1 39 | IF cont1.button THEN IF BY=0 THEN BY=10:BX=X 40 | RETURN 41 | END 42 | 43 | enemy: PROCEDURE 44 | IF STATE=1 GOTO move_enemy 45 | EY = (WAVE AND 7) + 1 46 | IF WAVE AND 1 THEN EX=19 ELSE EX=0 47 | STATE=1 48 | RETURN 49 | 50 | move_enemy: 51 | IF WAVE AND 1 THEN IF EX=0 THEN STATE=0:EY=0:WAVE=WAVE+1 ELSE EX=EX-1 52 | IF NOT WAVE AND 1 THEN IF EX=19 THEN STATE=0:EY=0:WAVE=WAVE+1 ELSE EX=EX+1 53 | END 54 | 55 | add_points: PROCEDURE 56 | EY=0:STATE=0:S=S+1:GOSUB update_score 57 | SOUND 1,400,14 58 | WAIT 59 | SOUND 1,300,14 60 | WAIT 61 | SOUND 1,500,14 62 | WAIT 63 | SOUND 1,,0 ' Turn volume to zero 64 | END 65 | 66 | -------------------------------------------------------------------------------- /samples/game2.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Barzack 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Jan/28/2014. 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | WAIT 12 | DEFINE DEF00,4,drawings 13 | restart: 14 | WAIT 15 | room=0 16 | #score=0 17 | load_room: 18 | IF room = 0 THEN RESTORE room0 : #monster = SPR03 + SPR_GREEN 19 | IF room = 1 THEN RESTORE room1 : #monster = SPR00 + SPR_GREEN 20 | 21 | ' Deactivate sprites 22 | SPRITE 0,0,0 23 | SPRITE 1,0,0 24 | SPRITE 2,0,0 25 | SPRITE 3,0,0 26 | SPRITE 4,0,0 27 | WAIT ' Wait to reset collision bits 28 | 29 | ' 30 | ' Clean screen 31 | ' 32 | CLS 33 | 34 | ' 35 | ' Draw current score in vertical 36 | ' 37 | PRINT AT (SCREENPOS(0, 0)),(#score/100%10+16)*8+6 38 | PRINT AT (SCREENPOS(0, 1)),(#score/10%10+16)*8+6 39 | PRINT AT (SCREENPOS(0, 2)),(#score%10+16)*8+6 40 | PRINT COLOR CS_BLUE 41 | 42 | ' 43 | ' Draw room line per line 44 | ' Extract bit per bit of value to signal labyrinth value 45 | ' 46 | FOR y = 0 TO 11 47 | READ #line 48 | FOR x = 0 TO 15 49 | IF #line AND $8000 THEN PRINT AT y*20+x+2,"\95" 50 | #line = #line * 2 51 | NEXT x 52 | NEXT y 53 | 54 | ' 55 | ' Setup some random barzacks 56 | ' 57 | y = 1: GOSUB barzack: y2 = y * 8 + 8: x2 = result 58 | y = 4: GOSUB barzack: y3 = y * 8 + 8: x3 = result 59 | y = 7: GOSUB barzack: y4 = y * 8 + 8: x4 = result 60 | y = 10: GOSUB barzack: y5 = y * 8 + 8: x5 = result 61 | 62 | ' 63 | ' Player start 64 | ' 65 | x1 = 32 66 | y1 = 28 67 | 68 | room = room + 1 69 | IF room = 2 THEN room = 0 70 | 71 | loop: 72 | WAIT 73 | 74 | ' 75 | ' Update MOBs 76 | ' 77 | SPRITE 0,X1+HIT+VISIBLE,Y1+ZOOMY2,SPR02 + SPR_RED ' Our hero 78 | SPRITE 1,X2+HIT+VISIBLE,Y2+ZOOMY2,#monster ' Mutant barzack 79 | SPRITE 2,X3+HIT+VISIBLE,Y3+ZOOMY2,#monster ' Mutant barzack 80 | SPRITE 3,X4+HIT+VISIBLE,Y4+ZOOMY2,#monster ' Mutant barzack 81 | SPRITE 4,X5+HIT+VISIBLE,Y5+ZOOMY2,#monster ' Mutant barzack 82 | 83 | ' 84 | ' Check for collision 85 | ' 86 | IF COL0 AND (HIT_SPRITE1+HIT_SPRITE2+HIT_SPRITE3+HIT_SPRITE4+HIT_SPRITE5+HIT_BACKGROUND) THEN GOTO touched 87 | IF COL1 AND HIT_BACKGROUND THEN Y2=0:BLINK=1 88 | IF COL2 AND HIT_BACKGROUND THEN Y3=0:BLINK=1 89 | IF COL3 AND HIT_BACKGROUND THEN Y4=0:BLINK=1 90 | IF COL4 AND HIT_BACKGROUND THEN Y5=0:BLINK=1 91 | 92 | ' Check for movement 93 | IF CONT1.UP THEN IF Y1>0 THEN Y1=Y1-1 94 | IF CONT1.DOWN THEN IF Y1<104 THEN Y1=Y1+1 95 | IF CONT1.LEFT THEN IF X1>0 THEN X1=X1-1 96 | IF CONT1.RIGHT THEN IF X1<168 THEN X1=X1+1 97 | 98 | ' Check for change of room 99 | IF Y1<8 OR X1<24 OR X1>144 OR Y1>96 THEN #score=#score+1:GOTO load_room 100 | 101 | ' Background sound 102 | SOUND 0,2000,FRAME AND 15 103 | IF BLINK THEN SOUND 1,500,15:BLINK=0 ELSE SOUND 1,,0 104 | 105 | ' Barzacks displacement 106 | IF FRAME AND 7 THEN GOTO loop 107 | IF Y2=0 THEN GOTO avoid1 108 | IF X1<>X2 THEN IF X1Y2 THEN IF Y1X3 THEN IF X1Y3 THEN IF Y1X4 THEN IF X1Y4 THEN IF Y1X5 THEN IF X1Y5 THEN IF Y1 12 GOTO wait_title_1 40 | 41 | wait_title_2: 42 | WAIT 43 | IF cont.key < 1 OR cont.key > 4 GOTO wait_title_2 44 | 45 | ' Acceleration increases per difficulty 46 | accel = cont.key * 3 + 5 47 | level = 0 48 | 49 | ' Bring in the moon graphics 50 | WAIT 51 | WAIT 52 | DEFINE DEF00,16,screen_bitmaps_0 53 | WAIT 54 | DEFINE DEF16,16,screen_bitmaps_1 55 | WAIT 56 | DEFINE DEF32,13,screen_bitmaps_2 57 | WAIT 58 | SCREEN screen_cards 59 | ' Define some sprites 60 | DEFINE DEF58,6,sprites 61 | 62 | ' New level 63 | next_level: 64 | level = level + 1 65 | X = RAND % 152 + 8 ' Random location for player 66 | #Y = 8 * 256 67 | #DY = 5 68 | start = 50 69 | #fuel = 1000 - accel * 10 70 | ' Random landing pod 71 | c = RAND % 6 72 | IF c = 0 THEN LX = 80:LY=63 73 | IF c = 1 THEN LX = 88:LY=63 74 | IF c = 2 THEN LX = 54:LY=54 75 | IF c = 3 THEN LX = 32:LY=60 76 | IF c = 4 THEN LX = 106:LY=56 77 | IF c = 5 THEN LX = 148:LY=54 78 | SPRITE 2,LX+8 + VISIBLE + HIT,LY+8 + ZOOMY2,SPR61 + SPR_RED 79 | GOSUB update_score 80 | PLAY SIMPLE 81 | PLAY music_level 82 | IF (level AND 1)=0 THEN AY=32:IF (level AND 2)=0 THEN AX=8:AZ=1 ELSE AX=152:AZ=-1 83 | ' 84 | ' Main loop 85 | ' 86 | main_loop: 87 | PRINT AT SCREENPOS(0, 0) COLOR FG_GREEN,"FUEL:",<>#fuel," " 88 | SPRITE 0,X+8 + VISIBLE + HIT,#Y/256+8 + ZOOMY2,SPR63 + SPR_CYAN 89 | SPRITE 3,0:IF (level AND 1)=0 THEN SPRITE 3,AX+8 + VISIBLE + HIT,AY+8 + ZOOMY2,(SPR58+((FRAME AND 4)/4)*8) + SPR_GREEN:IF start=0 THEN AX=AX+AZ:IF AX=8 OR AX=152 THEN AZ=-AZ 90 | WAIT 91 | ' Check for crashing 92 | IF PEEK(SCREENADDR((X-8+4)/8, (#Y/256)/8)) <> 0 THEN GOTO end_of_mission 93 | c = cont.button 94 | IF (c=$20)+(c=$40)+(c=$80) THEN GOTO avoid_controller 95 | IF cont.left THEN IF X > 0 THEN X = X - 1 96 | IF cont.right THEN IF X < 152 THEN X = X + 1 97 | ' Check for using fuel 98 | SPRITE 1,0:IF c<>0 AND #fuel > 0 AND #DY > -200 THEN #DY = #DY - 35:#fuel = #fuel - 2:SPRITE 1,X+8 + VISIBLE + HIT,#Y/256+8+6 + ZOOMY2,SPR60 + (RAND AND 4) + SPR_RED 99 | avoid_controller: 100 | IF start THEN start = start - 1: GOTO main_loop 101 | ' Landing allowed only if falling speed isn't too high! 102 | IF COL0 AND HIT_SPRITE3 THEN GOTO end_of_mission 103 | IF (COL0 AND HIT_SPRITE2) <> 0 AND #dy < 512 THEN GOTO winning 104 | #Y = #Y + #DY 105 | if #Y < 8*256 THEN #Y = 8*256 106 | #DY = #DY + accel ' Gravity 107 | IF #fuel > 0 THEN #fuel = #fuel - 1 108 | GOTO main_loop 109 | 110 | ' 111 | ' Succesful landing! 112 | ' 113 | winning: 114 | #score = #score + 1 115 | SPRITE 1,0 116 | WHILE COL0 AND $0004 117 | #Y = #Y - 256 118 | SPRITE 0,X+8 + VISIBLE + HIT,#Y/256+8 + ZOOMY2,SPR63 + SPR_CYAN 119 | WAIT 120 | WEND 121 | GOSUB update_score 122 | #Y = #Y + 256 123 | SPRITE 0,X+8 + VISIBLE + HIT,#Y/256+8 + ZOOMY2,SPR63 + SPR_CYAN 124 | PLAY music_victory 125 | FOR c = 0 to 100 126 | WAIT 127 | NEXT c 128 | GOTO next_level 129 | 130 | ' 131 | ' End of mission, lander explosion! 132 | ' 133 | end_of_mission: 134 | PLAY NONE 135 | FOR c = 0 TO 7 136 | #xe(c) = X * 256 137 | #ye(c) = #Y + 8 * 256 138 | #vx(c) = (c - 4) * 256 + 64 139 | IF c = 3 OR c = 4 THEN #vy(c) = -512 ELSE IF c = 2 OR c = 5 THEN #vy(c) = - 440 ELSE IF c = 1 OR c = 6 THEN #vy(c) = - 380 ELSE #vy(c) = - 340 140 | NEXT c 141 | FOR d = 0 to 128 142 | FOR c = 0 to 7 143 | IF #ye(c) THEN #xe(c) = #xe(c) + #vx(c):#ye(c) = #ye(c) + #vy(c):#vy(c) = #vy(c) + 15 144 | IF #vx(c) < 0 THEN #vx(c) = -(-#vx(c) * 12 / 16) ELSE #vx(c) = #vx(c) * 12 / 16 145 | IF #ye(c) > 96 * 256 THEN #xe(c) = -8:#ye(c) = 0 146 | NEXT c 147 | SPRITE 0,#xe(0)/256+8+VISIBLE+HIT,#ye(0)/256+8+ZOOMY2,SPR62+SPR_RED 148 | SPRITE 1,#xe(1)/256+8+VISIBLE+HIT,#ye(1)/256+8+ZOOMY2,SPR62+SPR_RED 149 | SPRITE 2,#xe(2)/256+8+VISIBLE+HIT,#ye(2)/256+8+ZOOMY2,SPR62+SPR_RED 150 | SPRITE 3,#xe(3)/256+8+VISIBLE+HIT,#ye(3)/256+8+ZOOMY2,SPR62+SPR_RED 151 | SPRITE 4,#xe(4)/256+8+VISIBLE+HIT,#ye(4)/256+8+ZOOMY2,SPR62+SPR_RED 152 | SPRITE 5,#xe(5)/256+8+VISIBLE+HIT,#ye(5)/256+8+ZOOMY2,SPR62+SPR_RED 153 | SPRITE 6,#xe(6)/256+8+VISIBLE+HIT,#ye(6)/256+8+ZOOMY2,SPR62+SPR_RED 154 | SPRITE 7,#xe(7)/256+8+VISIBLE+HIT,#ye(7)/256+8+ZOOMY2,SPR62+SPR_RED 155 | SOUND 2,d*16,15-d/16 156 | SOUND 4,d/16+4,$18 157 | WAIT 158 | NEXT d 159 | SOUND 2,1,0 160 | SOUND 4,1,$38 161 | SPRITE 0,0 162 | SPRITE 1,0 163 | SPRITE 2,0 164 | SPRITE 3,0 165 | SPRITE 4,0 166 | SPRITE 5,0 167 | SPRITE 6,0 168 | SPRITE 7,0 169 | end_of_mission_1: 170 | WAIT 171 | IF cont. button <> 0 THEN GOTO end_of_mission_1 172 | end_of_mission_2: 173 | WAIT 174 | IF cont. button = 0 THEN GOTO end_of_mission_2 175 | GOTO title_screen 176 | 177 | ' 178 | ' Update score 179 | ' 180 | update_score: PROCEDURE 181 | PRINT AT SCREENPOS(11, 0) COLOR FG_GREEN,"SCORE:",<>#score 182 | END 183 | 184 | sprites: 185 | ' Alien 1 186 | BITMAP "..####.." 187 | BITMAP "..####.." 188 | BITMAP "##.##.##" 189 | BITMAP ".######." 190 | BITMAP ".##..##." 191 | BITMAP "..####.." 192 | BITMAP ".##..##." 193 | BITMAP ".######." 194 | ' Alien 2 195 | BITMAP "..####.." 196 | BITMAP "#.####.#" 197 | BITMAP ".#.##.#." 198 | BITMAP ".######." 199 | BITMAP ".#....#." 200 | BITMAP "..####.." 201 | BITMAP ".##..##." 202 | BITMAP "###..###" 203 | ' Fire 204 | BITMAP "..####.." 205 | BITMAP "...###.." 206 | BITMAP "....#..." 207 | BITMAP "........" 208 | BITMAP "........" 209 | BITMAP "........" 210 | BITMAP "........" 211 | BITMAP "........" 212 | ' Landing platform 213 | BITMAP "........" 214 | BITMAP "........" 215 | BITMAP "........" 216 | BITMAP "........" 217 | BITMAP "........" 218 | BITMAP "..####.." 219 | BITMAP ".#....#." 220 | BITMAP "###..###" 221 | ' Debris 222 | BITMAP "........" 223 | BITMAP "........" 224 | BITMAP "........" 225 | BITMAP "...#...." 226 | BITMAP "..#.#..." 227 | BITMAP "........" 228 | BITMAP "........" 229 | BITMAP "........" 230 | ' Lunar lander 231 | BITMAP "..####.." 232 | BITMAP ".####.##" 233 | BITMAP ".####.##" 234 | BITMAP ".#.#.#.#" 235 | BITMAP ".####.##" 236 | BITMAP ".####.##" 237 | BITMAP "..#..#.." 238 | BITMAP "..#..#.." 239 | 240 | ' 45 bitmaps 241 | screen_bitmaps_0: 242 | DATA $0000,$0000,$0000,$0300 243 | DATA $0000,$0700,$3F1F,$FFFF 244 | DATA $0000,$0000,$8000,$E0C0 245 | DATA $0000,$0000,$0000,$7F1F 246 | DATA $0000,$0000,$0000,$FFFC 247 | DATA $0000,$0000,$0000,$8000 248 | DATA $0000,$0000,$0000,$0100 249 | DATA $0000,$0000,$0000,$FFFF 250 | DATA $0000,$0101,$0F07,$7F3F 251 | DATA $7F1F,$FFFF,$FFFF,$FFFF 252 | DATA $F8F0,$FFFE,$FFFF,$FFFF 253 | DATA $0000,$8000,$C7BF,$FCF1 254 | DATA $1F0F,$FF3F,$FFFF,$7FFF 255 | DATA $F0E0,$FEFC,$FFFF,$FFFF 256 | DATA $0000,$0000,$F0C0,$FFFE 257 | DATA $0000,$0000,$0000,$FF00 258 | screen_bitmaps_1: 259 | DATA $0000,$0100,$0F03,$FF1F 260 | DATA $7F3F,$FFFF,$FFFF,$FFFF 261 | DATA $F8E0,$FCF8,$FFFE,$FFFF 262 | DATA $0000,$0000,$0000,$C080 263 | DATA $0000,$0000,$0100,$0F07 264 | DATA $0F03,$7F1F,$FFFF,$FFFF 265 | DATA $CF3F,$FCE3,$FFFF,$FFFF 266 | DATA $FFFF,$FFFF,$E31F,$FFFC 267 | DATA $FFFF,$FFFF,$FFFF,$C33F 268 | DATA $FFFF,$FFFF,$FEFF,$C0E0 269 | DATA $FFFF,$FFFF,$00FF,$7F00 270 | DATA $FFFF,$FFFF,$07FF,$8000 271 | DATA $E0E0,$FBF1,$FCF3,$FFFE 272 | DATA $7F1F,$FFFF,$FFFF,$E01F 273 | DATA $FCFF,$FCFC,$FBF8,$FBFB 274 | DATA $0FF0,$FFFF,$007F,$FEFC 275 | screen_bitmaps_2: 276 | DATA $F30F,$FDF9,$19E1,$7EFC 277 | DATA $FFFF,$FEFF,$F9FC,$FFF3 278 | DATA $91C7,$7F3C,$FFFF,$FFFF 279 | DATA $FFFF,$C03F,$BFBF,$7F3F 280 | DATA $F0FC,$3FC7,$CF9F,$E7EF 281 | DATA $7FFF,$9F3F,$F1E7,$FFFD 282 | DATA $FFFE,$FFFF,$FFFF,$FFFF 283 | DATA $FC03,$FFFF,$FFFF,$FFFF 284 | DATA $3FFF,$FFFF,$FFFF,$FFFF 285 | DATA $F7F3,$FFFF,$FFFF,$FFFF 286 | DATA $3F7F,$FFFF,$FFFF,$FFFF 287 | DATA $FF3F,$FFFF,$FFFF,$FFFF 288 | DATA $FF7F,$FFFF,$FFFF,$FFFF 289 | 290 | REM 20x12 cards 291 | screen_cards: 292 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 293 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 294 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 295 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 296 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 297 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 298 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 299 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 300 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 301 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 302 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 303 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 304 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 305 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 306 | DATA $0000,$0807,$080F,$0817,$0000,$0000,$081F,$0827,$082F,$0000 307 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0837,$083F,$083F 308 | DATA $0847,$084F,$2600,$0857,$085F,$0867,$2600,$2600,$086F,$0877 309 | DATA $087F,$087F,$0887,$088F,$0897,$089F,$08A7,$08AF,$2600,$2600 310 | DATA $2600,$2600,$2600,$2600,$2600,$08B7,$08BF,$08C7,$2600,$2600 311 | DATA $2600,$08CF,$08D7,$08DF,$2600,$08E7,$08EF,$2600,$2600,$2600 312 | DATA $2600,$2600,$08F7,$08FF,$0907,$2E28,$2600,$2600,$2600,$2600 313 | DATA $090F,$0917,$091F,$0927,$092F,$2600,$0937,$093F,$0947,$2600 314 | DATA $2600,$2600,$094F,$2600,$0957,$095F,$2600,$2600,$2600,$2600 315 | DATA $2600,$2600,$0967,$2600,$2600,$2600,$2600,$2600,$2600,$2600 316 | 317 | music_level: 318 | DATA 5 319 | MUSIC C4X,-,-,- 320 | MUSIC E4X,-,-,- 321 | MUSIC G4X,-,-,- 322 | MUSIC S,-,-,- 323 | MUSIC S,-,-,- 324 | MUSIC S,-,-,- 325 | MUSIC STOP 326 | 327 | music_victory: 328 | DATA 5 329 | MUSIC F4W,-,-,- 330 | MUSIC F4W,-,-,- 331 | MUSIC F4W,-,-,- 332 | MUSIC S,-,-,- 333 | MUSIC S,-,-,- 334 | MUSIC S,-,-,- 335 | MUSIC STOP 336 | 337 | -------------------------------------------------------------------------------- /samples/landscape.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Horizontal scrolling sample using big image (landscape.bmp) 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Aug/31/2015 6 | REM 7 | 8 | INCLUDE "constants.bas" 9 | 10 | CONST LANDSCAPE_WIDTH = 60 11 | CONST SPEED = 2 ' Can be 1, 2 or 4 12 | 13 | BORDER BORDER_BLACK, 1 14 | MODE 1 15 | WAIT 16 | DEFINE DEF00,16,screen_bitmaps_0 17 | WAIT 18 | DEFINE DEF16,16,screen_bitmaps_1 19 | WAIT 20 | DEFINE DEF32,16,screen_bitmaps_2 21 | WAIT 22 | DEFINE DEF48,6,screen_bitmaps_3 23 | WAIT 24 | DEFINE DEF63,1,spaceship 25 | WAIT 26 | 27 | SCREEN screen_cards, 0, 0, BACKGROUND_COLUMNS, BACKGROUND_ROWS, LANDSCAPE_WIDTH 28 | next_column = 20 29 | offset_x = 0 30 | offset_y = 0 31 | offset_d = 0 32 | x_spaceship = 32 33 | y_spaceship = 32 34 | WAIT 35 | 36 | ' Main loop 37 | main_loop: 38 | ' Pixel scrolling, check if it should displace full screen (move all cards left) 39 | IF offset_x = 0 THEN 40 | offset_d = 2:offset_x = 8 - SPEED 41 | ELSE 42 | offset_x = offset_x - SPEED 43 | END IF 44 | ' Update spaceship sprite (does it after calculating new offset_x) 45 | SPRITE 0, x_spaceship + VISIBLE + ZOOMX2 - offset_x, y_spaceship + ZOOMY2 - offset_y, SPR63 + SPR_WHITE 46 | ' Setup scrolling for next frame 47 | SCROLL offset_x, offset_y, offset_d 48 | WAIT 49 | ' Now is time to update next column for screen if all cards were moved 50 | offset_d = 0 51 | IF offset_x = 8 - SPEED THEN 52 | SCREEN screen_cards, next_column, 19, 1, BACKGROUND_ROWS, LANDSCAPE_WIDTH 53 | next_column = next_column + 1 54 | IF next_column = LANDSCAPE_WIDTH THEN next_column = 0 55 | END IF 56 | ' Displace spaceship 57 | IF cont.up THEN IF y_spaceship > 8 THEN y_spaceship = y_spaceship - 1 58 | IF cont.down THEN IF y_spaceship < 80 THEN y_spaceship = y_spaceship + 1 59 | IF cont.left THEN IF x_spaceship > 8 THEN x_spaceship = x_spaceship - 1 60 | IF cont.right THEN IF x_spaceship < 120 THEN x_spaceship = x_spaceship + 1 61 | GOTO main_loop 62 | 63 | ' Spaceship 64 | spaceship: 65 | BITMAP " " 66 | BITMAP "* " 67 | BITMAP "** " 68 | BITMAP " *** * " 69 | BITMAP "********" 70 | BITMAP " *** " 71 | BITMAP " ** " 72 | BITMAP " " 73 | 74 | ' 54 bitmaps (created with intycolor -b landscape.bmp output.bas) 75 | screen_bitmaps_0: 76 | DATA $0000,$F678,$F9FB,$3E7D 77 | DATA $0000,$0D0D,$FD0D,$FDFD 78 | DATA $0000,$F8F0,$FFFD,$FEFF 79 | DATA $0000,$BF3F,$BFBF,$7E3F 80 | DATA $000E,$0001,$0000,$0000 81 | DATA $007D,$FFFF,$FFFF,$C01F 82 | DATA $43F8,$BFBF,$BEBE,$0EA0 83 | DATA $F8FC,$C0E0,$0000,$0000 84 | DATA $FBFB,$FBFB,$E118,$FFFF 85 | DATA $FEFE,$E0FA,$DF1E,$DFDF 86 | DATA $0000,$0000,$0000,$8000 87 | DATA $0000,$F800,$FFFF,$FFFF 88 | DATA $0000,$0000,$FFF0,$FFFF 89 | DATA $0000,$0000,$0000,$FFF0 90 | DATA $0000,$0000,$0000,$FF00 91 | DATA $0000,$0000,$0000,$FE00 92 | screen_bitmaps_1: 93 | DATA $0000,$0000,$0701,$7F3F 94 | DATA $0000,$0000,$FCC0,$FFFF 95 | DATA $0000,$0000,$0000,$FFFF 96 | DATA $0000,$0000,$0000,$FCC0 97 | DATA $0001,$0303,$0F07,$0F0F 98 | DATA $3FFF,$FD80,$F9FD,$FBFB 99 | DATA $DFDF,$FF00,$FFFF,$FFFF 100 | DATA $0080,$E060,$F0E0,$F0F0 101 | DATA $0000,$0000,$0100,$0F03 102 | DATA $0000,$0F07,$FF3F,$FFFF 103 | DATA $0000,$F000,$FFFF,$FFFF 104 | DATA $0000,$0000,$FFF8,$FFFF 105 | DATA $0000,$0000,$FC00,$FFFF 106 | DATA $0000,$0000,$0000,$FFE0 107 | DATA $0000,$0000,$0000,$0300 108 | DATA $0000,$0000,$0303,$FF7F 109 | screen_bitmaps_2: 110 | DATA $0300,$FF1F,$FFFF,$FFFF 111 | DATA $FF00,$FFFF,$FFFF,$FFFF 112 | DATA $FC00,$FFFF,$FFFF,$FFFF 113 | DATA $0000,$FEE0,$FFFF,$FFFF 114 | DATA $0000,$0000,$C080,$FFFF 115 | DATA $0000,$0000,$0000,$E000 116 | DATA $0000,$0000,$0000,$FF3F 117 | DATA $0000,$0000,$7F1F,$FFFF 118 | DATA $0000,$3F00,$FFFF,$FFFF 119 | DATA $0000,$0000,$FFFF,$FFFF 120 | DATA $0000,$0000,$FEE0,$FFFF 121 | DATA $0000,$0000,$0000,$FF07 122 | DATA $0000,$0100,$7F1F,$FFFF 123 | DATA $0000,$FF3F,$FFFF,$FFFF 124 | DATA $F0C0,$FFFF,$FFFF,$FFFF 125 | DATA $0000,$FFFF,$FFFF,$FFFF 126 | screen_bitmaps_3: 127 | DATA $FF01,$FFFF,$FFFF,$FFFF 128 | DATA $FFF0,$FFFF,$FFFF,$FFFF 129 | DATA $FF03,$FFFF,$FFFF,$FFFF 130 | DATA $FFFC,$FFFF,$FFFF,$FFFF 131 | DATA $0300,$FFFF,$FFFF,$FFFF 132 | DATA $FF7F,$FFFF,$FFFF,$FFFF 133 | 134 | REM 60x12 cards 135 | screen_cards: 136 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 137 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 138 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 139 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 140 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 141 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 142 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 143 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0803,$080B,$0813,$081B,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 144 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0823,$082B,$0833,$083B,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 145 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0843,$084B,$0853,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 146 | DATA $085D,$0865,$086D,$0875,$087D,$0000,$0000,$0000,$0000,$0000,$0000,$0885,$085D,$088D,$0895,$089D,$0000,$0000,$08A3,$08AB,$08B3,$08BB,$0000,$08C5,$08CD,$08D5,$08DD,$08E5,$08ED,$0875,$0875,$0000,$0000,$0000,$0000,$08F5,$08FD,$0905,$090D,$0915,$091D,$0925,$092D,$0000,$0000,$0000,$0000,$08F5,$0935,$093D,$0945,$08D5,$094D,$0955,$08ED,$0855,$0000,$095D,$0965,$096D 147 | DATA $2200,$2200,$2200,$2200,$2200,$2200,$0975,$097D,$097D,$0985,$2200,$2200,$2200,$2200,$2200,$2200,$098D,$090D,$090D,$090D,$090D,$090D,$0995,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$099D,$090D,$097D,$097D,$09A5,$09AD,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200,$2200 148 | -------------------------------------------------------------------------------- /samples/landscape.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nanochess/IntyBASIC/606e128a7bb794c8a02e7650742dd60ca8e31434/samples/landscape.bmp -------------------------------------------------------------------------------- /samples/music.bas: -------------------------------------------------------------------------------- 1 | rem 2 | rem Test of IntyBASIC music player 3 | rem by Oscar Toledo G. http://nanochess.org 4 | rem Aug/26/2014 5 | rem 6 | 7 | REM Include useful predefined constants 8 | INCLUDE "constants.bas" 9 | 10 | main: 11 | V=0 12 | 13 | wait_key: 14 | CLS 15 | wait_loop: 16 | PRINT AT SCREENPOS(2, 2),"Press button" 17 | IF CONT1.B0 THEN GOTO play_1 18 | IF CONT1.B1 THEN GOTO play_2 19 | 20 | GOTO wait_loop 21 | 22 | play_1: 23 | PRINT AT SCREENPOS(2, 2),"Bach Invention 8" 24 | PRINT AT SCREENPOS(5, 3),"(fragment)" 25 | WAIT 26 | PLAY SIMPLE 27 | PLAY tune_1 28 | 29 | ' Sound effect if button touch 30 | repeat: 31 | WAIT 32 | IF CONT1.B1 THEN V=15 33 | IF V>0 THEN SOUND 2,300,V:V=V-1 34 | IF CONT1.B2 THEN PLAY OFF:GOTO WAIT_KEY 35 | GOTO repeat 36 | 37 | play_2: 38 | PRINT AT SCREENPOS(2, 2),"Mecha-8 Level 4 " 39 | PRINT AT SCREENPOS(5, 3),"(fragment)" 40 | WAIT 41 | PLAY FULL 42 | PLAY tune_2 43 | repeat2: 44 | WAIT 45 | IF CONT1.B2 THEN PLAY OFF:GOTO WAIT_KEY 46 | GOTO repeat2 47 | 48 | ' Bach Invention 8 (BWV779) 49 | ' Fragment 50 | tune_1: DATA 7 51 | MUSIC F4,- 52 | MUSIC S,- 53 | MUSIC A4,- 54 | MUSIC S,- 55 | MUSIC F4,- 56 | MUSIC S,- 57 | MUSIC C5,- 58 | MUSIC S,- 59 | MUSIC F4,- 60 | MUSIC S,- 61 | 62 | MUSIC F5,- 63 | MUSIC S,- 64 | MUSIC E5,F3 65 | MUSIC D5,S 66 | MUSIC C5,A3 67 | MUSIC D5,S 68 | MUSIC C5,F3 69 | MUSIC A4#,S 70 | MUSIC A4,C4 71 | MUSIC A4#,S 72 | MUSIC A4,F3 73 | MUSIC G4,S 74 | 75 | MUSIC F4,F4 76 | MUSIC S,S 77 | MUSIC A4,E4 78 | MUSIC S,D4 79 | MUSIC C5,C4 80 | MUSIC S,D4 81 | MUSIC A4,C4 82 | MUSIC S,A3# 83 | MUSIC F5,A3 84 | MUSIC S,A3# 85 | MUSIC C5,A3 86 | MUSIC S,G3 87 | 88 | MUSIC A5,F3 89 | MUSIC C6,S 90 | MUSIC A5#,A3 91 | MUSIC C6,S 92 | MUSIC A5,C4 93 | MUSIC C6,S 94 | MUSIC A5#,A3 95 | MUSIC C6,S 96 | MUSIC A5,F4 97 | MUSIC C6,S 98 | MUSIC A5#,C4 99 | MUSIC C6,S 100 | 101 | MUSIC F5,A3 102 | MUSIC A5,C4 103 | MUSIC G5,A3# 104 | MUSIC A5,C4 105 | MUSIC F5,A3 106 | MUSIC A5,C4 107 | MUSIC G5,A3# 108 | MUSIC A5,C4 109 | MUSIC F5,A3 110 | MUSIC A5,C4 111 | MUSIC G5,A3# 112 | MUSIC A5,C4 113 | 114 | MUSIC D5,F3 115 | MUSIC F5,A3 116 | MUSIC E5,G3 117 | MUSIC F5,A3 118 | MUSIC D5,F3 119 | MUSIC F5,A3 120 | MUSIC E5,G3 121 | MUSIC F5,A3 122 | MUSIC D5,F3 123 | MUSIC F5,A3 124 | MUSIC E5,G3 125 | MUSIC F5,A3 126 | 127 | MUSIC B4,D3 128 | MUSIC S,F3 129 | MUSIC G4,E3 130 | MUSIC S,F3 131 | MUSIC D5,D3 132 | MUSIC S,F3 133 | MUSIC B4,E3 134 | MUSIC S,F3 135 | MUSIC F5,D3 136 | MUSIC S,F3 137 | MUSIC D5,E3 138 | MUSIC S,F3 139 | 140 | MUSIC G5,B3 141 | MUSIC A5,S 142 | MUSIC G5,G3 143 | MUSIC F5,S 144 | MUSIC E5,C4 145 | MUSIC F5,S 146 | MUSIC E5,G3 147 | MUSIC D5,S 148 | MUSIC C5,E4 149 | MUSIC D5,S 150 | MUSIC C5,C4 151 | MUSIC A4#,S 152 | 153 | MUSIC A4,F4 154 | MUSIC S,G4 155 | MUSIC D5,F4 156 | MUSIC C5,E4 157 | MUSIC B4,D4 158 | MUSIC C5,E4 159 | MUSIC B4,D4 160 | MUSIC A4,C4 161 | MUSIC G4,B3 162 | MUSIC A4,C4 163 | MUSIC G4,B3 164 | MUSIC F4,A3 165 | 166 | MUSIC E4,G3 167 | MUSIC F4,S 168 | MUSIC E4,C4 169 | MUSIC D4,B3 170 | MUSIC C4,A3 171 | MUSIC S,B3 172 | MUSIC C5,A3 173 | MUSIC B4,G3 174 | MUSIC C5,F3 175 | MUSIC S,G3 176 | MUSIC E4,F3 177 | MUSIC S,E3 178 | 179 | MUSIC F4,D3 180 | MUSIC S,E3 181 | MUSIC C5,D3 182 | MUSIC S,C3 183 | MUSIC E4,G3 184 | MUSIC S,F3 185 | MUSIC C5,E3 186 | MUSIC S,F3 187 | MUSIC D4,G3 188 | MUSIC S,S 189 | MUSIC B4,G2 190 | MUSIC S,S 191 | 192 | MUSIC C5,C4 193 | MUSIC S,S 194 | MUSIC S,S 195 | MUSIC S,S 196 | MUSIC STOP 197 | 198 | ' Mecha-8 level 5: alone 199 | ' Fragment 200 | tune_2: DATA 5 201 | MUSIC G5#Y,C3#,-,M1 202 | MUSIC S,S,-,M2 203 | MUSIC F5#,G3#,-,M2 204 | MUSIC S,S,-,M2 205 | MUSIC E5,C3#,-,M1 206 | MUSIC S,S,-,M2 207 | MUSIC D5#,G3#,-,M2 208 | MUSIC S,S,-,M2 209 | MUSIC E5,C3#,-,M1 210 | MUSIC S,S,-,M2 211 | MUSIC F5#,G3#,-,M2 212 | MUSIC S,S,-,M2 213 | MUSIC G5#,C3#,-,M1 214 | MUSIC S,S,-,M2 215 | MUSIC S,G3#,-,M2 216 | MUSIC S,S,-,M2 217 | MUSIC S,C3#,-,M1 218 | MUSIC S,S,-,M2 219 | MUSIC C5#,G3#,-,M2 220 | MUSIC -,S,-,M2 221 | MUSIC G5#,C3#,-,M1 222 | MUSIC S,S,-,M2 223 | MUSIC E5,G3#,-,M2 224 | MUSIC -,S,-,M2 225 | MUSIC F5#,B2,-,M1 226 | MUSIC S,S,-,M2 227 | MUSIC S,F3#,-,M2 228 | MUSIC S,S,-,M2 229 | MUSIC S,B2,-,M1 230 | MUSIC S,S,-,M2 231 | MUSIC -,F3#,-,M2 232 | MUSIC -,S,-,M2 233 | MUSIC -,B2,-,M1 234 | MUSIC -,S,-,M2 235 | MUSIC -,F3#,-,M2 236 | MUSIC -,S,-,M2 237 | MUSIC -,B2,-,M1 238 | MUSIC -,S,-,M2 239 | MUSIC -,F3#,-,M1 240 | MUSIC -,S,-,M2 241 | MUSIC C5#,B2,-,M1 242 | MUSIC S,S,-,M2 243 | MUSIC F5#,F3#,-,M1 244 | MUSIC S,S,-,M2 245 | MUSIC C5#,B2,-,M1 246 | MUSIC S,S,-,M2 247 | MUSIC E5,A2,-,M1 248 | MUSIC S,S,-,M2 249 | MUSIC S,E3,-,M1 250 | MUSIC S,S,-,M2 251 | MUSIC S,A2,-,M1 252 | MUSIC S,S,-,M2 253 | MUSIC S,E3,-,M1 254 | MUSIC S,S,-,M2 255 | MUSIC S,A2,-,M1 256 | MUSIC S,S,-,M2 257 | MUSIC S,E3,-,M1 258 | MUSIC S,S,-,M2 259 | MUSIC S,A2,-,M1 260 | MUSIC S,S,-,M2 261 | MUSIC F5#,E3,-,M1 262 | MUSIC S,S,-,M2 263 | MUSIC E5,A2,-,M2 264 | MUSIC S,S,-,M2 265 | MUSIC D5#,E3,-,M1 266 | MUSIC S,S,-,M2 267 | MUSIC S,A2,-,M2 268 | MUSIC S,S,-,M2 269 | MUSIC C5,G2#,-,M1 270 | MUSIC S,S,-,M2 271 | MUSIC S,D3#,-,M2 272 | MUSIC S,S,-,M2 273 | MUSIC S,G2#,-,M1 274 | MUSIC S,S,-,M2 275 | MUSIC S,D3#,-,M2 276 | MUSIC S,S,-,M2 277 | MUSIC S,G2#,-,M1 278 | MUSIC S,S,-,M2 279 | MUSIC -,D3#,-,M2 280 | MUSIC -,S,-,M2 281 | MUSIC -,G2#,-,M1 282 | MUSIC -,S,-,M2 283 | MUSIC -,D3#,-,M2 284 | MUSIC -,S,-,M2 285 | MUSIC -,G2#,-,M1 286 | MUSIC -,S,-,M2 287 | MUSIC -,D3#,-,M1 288 | MUSIC -,S,-,M3 289 | MUSIC -,G2#,-,M1 290 | MUSIC -,S,-,M2 291 | MUSIC -,D3#,-,M1 292 | MUSIC -,S,-,M3 293 | MUSIC -,G2#,-,M1 294 | MUSIC -,S,-,M1 295 | MUSIC -,D3#,-,M1 296 | MUSIC -,S,-,M1 297 | MUSIC REPEAT 298 | -------------------------------------------------------------------------------- /samples/pak.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM IntyPak 3 | REM Game demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Jun/03/2015. 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | CONST max_ghosts = 2 12 | MODE SCREEN_FOREGROUND_BACKGROUND 13 | #record = 50 14 | 15 | ' 16 | ' The awesome title screen 17 | ' 18 | title_screen: 19 | CLS 20 | WAIT 21 | DEFINE DEF00,16,screen_bitmaps_0 22 | WAIT 23 | DEFINE DEF16,16,screen_bitmaps_1 24 | WAIT 25 | DEFINE DEF32,6,screen_bitmaps_2 26 | WAIT 27 | SCREEN screen_cards 28 | 29 | PRINT AT SCREENPOS(3, 6) COLOR CS_GREEN,"RECORD: " 30 | PRINT COLOR CS_TAN,<5>#record,"0" 31 | PRINT AT SCREENPOS(4, 9) COLOR CS_GREEN,"PRESS BUTTON" 32 | title_screen_loop_1: 33 | WAIT 34 | IF cont.button THEN GOTO title_screen_loop_1 35 | title_screen_loop_2: 36 | WAIT 37 | IF cont.button = 0 THEN GOTO title_screen_loop_2 38 | 39 | FOR c = 0 TO 10 40 | WAIT 41 | WAIT 42 | PRINT AT SCREENPOS(4, 9) COLOR CS_GREEN,"PRESS BUTTON" 43 | WAIT 44 | WAIT 45 | PRINT AT SCREENPOS(4, 9) COLOR CS_GREEN," " 46 | NEXT c 47 | 48 | ' 49 | ' Load graphics for level 50 | ' 51 | CLS 52 | DEFINE DEF00,16,bitmaps 53 | WAIT 54 | DEFINE DEF16,3,bitmaps_2 55 | WAIT 56 | level = 0 57 | #score = 0 58 | lives = 2 59 | 60 | DIM x(max_ghosts),y(max_ghosts),d(max_ghosts) 61 | 62 | ' 63 | ' Start next level 64 | ' 65 | next_level: 66 | level = level + 1 67 | SCREEN level1 68 | GOSUB update_lives 69 | GOSUB update_score 70 | PRINT AT SCREENPOS(19, 10) COLOR CS_DARKGREEN,(level/10%10+16)*8+$0003 71 | PRINT AT SCREENPOS(19, 11) COLOR CS_DARKGREEN,(level%10+16)*8+$0003 72 | 73 | ' 74 | ' Count points in screen 75 | ' 76 | points = 0 77 | FOR c = SCREENPOS(0, 0) to SCREENPOS(19, 11) 78 | IF #BACKTAB(c) = BG06 + FG_YELLOW THEN points = points + 1 79 | NEXT c 80 | 81 | restart_level: 82 | ' 83 | ' Changing starting position for ghosts 84 | ' 85 | ON level AND 3 GOTO start_0,start_1,start_2,start_3 86 | 87 | start_0: 88 | x(0) = 8 89 | y(0) = 8 90 | d(0) = 0 91 | x(1) = 136 92 | y(1) = 8 93 | d(1) = 1 94 | GOTO start_4 95 | 96 | start_1: 97 | x(0) = 136 98 | y(0) = 8 99 | d(0) = 1 100 | x(1) = 136 101 | y(1) = 80 102 | d(1) = 1 103 | GOTO start_4 104 | 105 | start_2: 106 | x(0) = 136 107 | y(0) = 80 108 | d(0) = 1 109 | x(1) = 8 110 | y(1) = 80 111 | d(1) = 0 112 | GOTO start_4 113 | 114 | start_3: 115 | x(0) = 8 116 | y(0) = 80 117 | d(0) = 0 118 | x(1) = 8 119 | y(1) = 8 120 | d(1) = 0 121 | start_4: 122 | X1 = 64 123 | Y1 = 56 124 | face = 0 125 | dir = 0 ' 0=right, 1=left, 2=upwards, 3=downwards 126 | next_dir = 0 127 | fine_speed = 0 128 | ping = 0 129 | SPRITE 0, VISIBLE+HIT+8+X1,ZOOMY2+8+Y1,SPR09+SPR_GREEN 130 | SPRITE 1,0 131 | SPRITE 2,0 132 | SPRITE 3,0 133 | SPRITE 4,0 134 | FOR c = 0 TO 63 135 | WAIT 136 | NEXT c 137 | ' 138 | ' Main game loop 139 | ' 140 | loop: 141 | WAIT 142 | ' Eating pill 143 | IF ping THEN SOUND 1,120+ping*4,6+ping/2:ping=ping-1 ELSE SOUND 1,1,0 144 | ' Background arcade-style sound 145 | SOUND 2,wave((frame AND 15)/2),10 146 | ' Collision detection 147 | IF COL0 AND (HIT_SPRITE1+HIT_SPRITE2) THEN GOTO player_touched 148 | WAIT 149 | ' Player 150 | SPRITE 0,HIT+VISIBLE+8+X1,ZOOMY2+8+Y1,GRAM+(8+face*2+(FRAME AND 8)/8)*8+SPR_GREEN 151 | ' Ghost 1 152 | SPRITE 1,HIT+VISIBLE+8+X(0),ZOOMY2+8+Y(0),GRAM+(16+(FRAME AND 8)/8)*8+SPR_RED 153 | ' Ghost 2 154 | SPRITE 2,HIT+VISIBLE+8+X(1),ZOOMY2+8+Y(1),GRAM+(16+(FRAME AND 8)/8)*8+SPR_BLUE 155 | ' Player speed reduces with each level 156 | IF level > 7 THEN c = $49 - 8 ELSE c = $49 - level 157 | ' Fine movement for player 158 | fine_speed = fine_speed + c 159 | WHILE fine_speed >= $40 160 | fine_speed = fine_speed - $40 161 | c = cont.button 162 | IF (c = $20)+(c = $40)+(c = $80) THEN GOTO avoid_controller 163 | IF cont.right THEN next_dir = 0 164 | IF cont.left THEN next_dir = 1 165 | IF cont.up THEN next_dir = 2 166 | IF cont.down THEN next_dir = 3 167 | avoid_controller: 168 | ' Only change direction in card boundary 169 | IF (X1 AND 7)+(Y1 AND 7) THEN GOTO loop_moving 170 | ' Check if pill eaten 171 | IF PEEK(SCREENADDR(X1/8, Y1/8)) = (BG06+FG_YELLOW) THEN ping = 7:PRINT AT (SCREENPOS(X1/8, Y1/8)),0:#score = #score + 1:GOSUB update_score:points = points - 1:IF points = 0 THEN GOTO level_won 172 | dir = next_dir 173 | face = next_dir 174 | ' Check if can move in desired direction 175 | IF dir = 0 THEN #c = PEEK($0201+X1/8+Y1/8*20):IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN dir = 4 176 | IF dir = 1 THEN #c = PEEK($01FF+X1/8+Y1/8*20):IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN dir = 4 177 | IF dir = 2 THEN #c = PEEK($01EC+X1/8+Y1/8*20):IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN dir = 4 178 | IF dir = 3 THEN #c = PEEK($0214+X1/8+Y1/8*20):IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN dir = 4 179 | loop_moving: 180 | IF dir = 0 THEN X1 = X1 + 1 181 | IF dir = 1 THEN X1 = X1 - 1 182 | IF dir = 2 THEN Y1 = Y1 - 1 183 | IF dir = 3 THEN Y1 = Y1 + 1 184 | WEND 185 | ' Ghosts movement 186 | FOR c = 0 TO max_ghosts-1 187 | ' Only change direction in card boundary 188 | IF (x(c) AND 7)+(y(c) AND 7) THEN GOTO loop_moving2 189 | ' Check available directions 190 | #offset = x(c)/8+y(c)/8*20 191 | move = 0 192 | #c = PEEK($0201+#offset) 193 | IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN move = move + 1 194 | #c = PEEK($01ff+#offset) 195 | IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN move = move + 2 196 | #c = PEEK($01EC+#offset) 197 | IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN move = move + 4 198 | #c = PEEK($0214+#offset) 199 | IF #c <> (BG06+FG_YELLOW) AND #c <> 0 THEN move = move + 8 200 | ON d(c) GOTO loop_moving_horiz,loop_moving_horiz,loop_moving_vert,loop_moving_vert 201 | 202 | ' If it was moving horizontally, go now for vertical 203 | loop_moving_horiz: 204 | IF y1 = y(c) AND (move AND 3) = 0 THEN GOTO loop_moving2 205 | IF y1 < y(c) THEN GOTO loop_moving_horiz_1 206 | IF (move AND 8) = 0 THEN d(c) = 3:GOTO loop_moving2 207 | loop_moving_horiz_1: 208 | IF (move AND 4) = 0 THEN d(c) = 2:GOTO loop_moving2 209 | IF (move AND 8) = 0 THEN d(c) = 3 210 | GOTO loop_moving2 211 | 212 | ' If it was moving vertically, go now for horizontal 213 | loop_moving_vert: 214 | IF x1 = x(c) AND (move AND 12) = 0 THEN GOTO loop_moving2 215 | IF x1 < x(c) THEN GOTO loop_moving_vert_1 216 | IF (move AND 1) = 0 THEN d(c) = 0:GOTO loop_moving2 217 | loop_moving_vert_1: 218 | IF (move AND 2) = 0 THEN d(c) = 1:GOTO loop_moving2 219 | IF (move AND 1) = 0 THEN d(c) = 0 220 | GOTO loop_moving2 221 | 222 | ' Displace ghost 223 | loop_moving2: 224 | IF d(c) = 0 THEN x(c) = x(c) + 1 225 | IF d(c) = 1 THEN x(c) = x(c) - 1 226 | IF d(c) = 2 THEN y(c) = y(c) - 1 227 | IF d(c) = 3 THEN y(c) = y(c) + 1 228 | NEXT c 229 | GOTO loop 230 | 231 | ' 232 | ' Level won 233 | ' 234 | level_won: 235 | SOUND 1,1,0 236 | SOUND 2,1,0 237 | SPRITE 0,0 238 | SPRITE 1,0 239 | SPRITE 2,0 240 | SPRITE 3,0 241 | SPRITE 4,0 242 | ' Classic-style flashing 243 | FOR d = 0 to 9 244 | WAIT 245 | WAIT 246 | WAIT 247 | WAIT 248 | WAIT 249 | FOR c = SCREENPOS(0, 0) to SCREENPOS(19, 11) 250 | #BACKTAB(c) = #BACKTAB(c) XOR FG_YELLOW 251 | NEXT c 252 | NEXT d 253 | GOTO next_level 254 | 255 | ' 256 | ' Player touched by ghosts 257 | ' 258 | player_touched: 259 | SOUND 1,1,0 260 | FOR c = 0 to 63 261 | WAIT 262 | SOUND 2,128-c,10 ' Sound effect 263 | SPRITE 0,VISIBLE+HIT+8+X1,ZOOMY2+8+Y1,(10+(c AND 8)/8)*8+(c AND 7) 264 | SPRITE 1,0 265 | SPRITE 2,0 266 | SPRITE 3,0 267 | SPRITE 4,0 268 | NEXT c 269 | SOUND 2,1,0 270 | SPRITE 0,0 271 | FOR c = 0 TO 63 272 | WAIT 273 | NEXT c 274 | IF lives = 0 THEN GOTO game_over 275 | lives = lives - 1 276 | GOSUB update_lives 277 | GOTO restart_level 278 | 279 | game_over: 280 | PRINT AT SCREENPOS(4, 5) COLOR FG_WHITE," GAME OVER " 281 | FOR c = 0 to 200 282 | WAIT 283 | NEXT c 284 | GOTO title_screen 285 | 286 | update_lives: PROCEDURE 287 | c = 0 288 | WHILE c < lives 289 | PRINT AT c * 40 + 19,18*8+$0805 290 | c = c + 1 291 | WEND 292 | WHILE c < 5 293 | PRINT AT c * 40 + 19,0 294 | c = c + 1 295 | WEND 296 | END 297 | 298 | update_score: PROCEDURE 299 | IF #score > #record THEN #record = #score 300 | PRINT AT SCREENPOS(0, 11) COLOR FG_TAN,<5>#score,"0" 301 | END 302 | 303 | ' Background bass sound 304 | wave: 305 | DATA 800,1000,1200,1400,1400,1200,1000,800 306 | 307 | ' Bitmaps for labyrinth 308 | bitmaps: 309 | BITMAP "........" 310 | BITMAP "........" 311 | BITMAP "........" 312 | BITMAP ".....###" 313 | BITMAP "....#..." 314 | BITMAP "...#...." 315 | BITMAP "...#...." 316 | BITMAP "...#...." 317 | 318 | BITMAP "........" 319 | BITMAP "........" 320 | BITMAP "........" 321 | BITMAP "########" 322 | BITMAP "........" 323 | BITMAP "........" 324 | BITMAP "........" 325 | BITMAP "........" 326 | 327 | BITMAP "........" 328 | BITMAP "........" 329 | BITMAP "........" 330 | BITMAP "##......" 331 | BITMAP "..#....." 332 | BITMAP "...#...." 333 | BITMAP "...#...." 334 | BITMAP "...#...." 335 | 336 | BITMAP "...#...." 337 | BITMAP "...#...." 338 | BITMAP "...#...." 339 | BITMAP "...#...." 340 | BITMAP "...#...." 341 | BITMAP "...#...." 342 | BITMAP "...#...." 343 | BITMAP "...#...." 344 | 345 | BITMAP "...#...." 346 | BITMAP "...#...." 347 | BITMAP "....#..." 348 | BITMAP ".....###" 349 | BITMAP "........" 350 | BITMAP "........" 351 | BITMAP "........" 352 | BITMAP "........" 353 | 354 | BITMAP "...#...." 355 | BITMAP "...#...." 356 | BITMAP "..#....." 357 | BITMAP "##......" 358 | BITMAP "........" 359 | BITMAP "........" 360 | BITMAP "........" 361 | BITMAP "........" 362 | 363 | BITMAP "........" 364 | BITMAP "........" 365 | BITMAP "........" 366 | BITMAP "...##..." 367 | BITMAP "...##..." 368 | BITMAP "........" 369 | BITMAP "........" 370 | BITMAP "........" 371 | 372 | BITMAP "........" 373 | BITMAP "........" 374 | BITMAP "...##..." 375 | BITMAP "..####.." 376 | BITMAP "..####.." 377 | BITMAP "...##..." 378 | BITMAP "........" 379 | BITMAP "........" 380 | 381 | ' Card 8 player bitmaps 382 | 383 | BITMAP "..####.." 384 | BITMAP ".######." 385 | BITMAP "####..##" 386 | BITMAP "########" 387 | BITMAP "########" 388 | BITMAP "########" 389 | BITMAP ".######." 390 | BITMAP "..####.." 391 | 392 | BITMAP "..####.." 393 | BITMAP ".######." 394 | BITMAP "####..##" 395 | BITMAP "######.." 396 | BITMAP "####...." 397 | BITMAP "######.." 398 | BITMAP ".######." 399 | BITMAP "..####.." 400 | 401 | BITMAP "..####.." 402 | BITMAP ".######." 403 | BITMAP "##..####" 404 | BITMAP "########" 405 | BITMAP "########" 406 | BITMAP "########" 407 | BITMAP ".######." 408 | BITMAP "..####.." 409 | 410 | BITMAP "..####.." 411 | BITMAP ".######." 412 | BITMAP "##..####" 413 | BITMAP "..######" 414 | BITMAP "....####" 415 | BITMAP "..######" 416 | BITMAP ".######." 417 | BITMAP "..####.." 418 | 419 | BITMAP "..####.." 420 | BITMAP ".######." 421 | BITMAP "##.#####" 422 | BITMAP "##.#####" 423 | BITMAP "########" 424 | BITMAP "########" 425 | BITMAP ".######." 426 | BITMAP "..####.." 427 | 428 | BITMAP "..#....." 429 | BITMAP ".##...#." 430 | BITMAP "##.#.###" 431 | BITMAP "##.#.###" 432 | BITMAP "########" 433 | BITMAP "########" 434 | BITMAP ".######." 435 | BITMAP "..####.." 436 | 437 | BITMAP "..####.." 438 | BITMAP ".######." 439 | BITMAP "########" 440 | BITMAP "########" 441 | BITMAP "#####.##" 442 | BITMAP "#####.##" 443 | BITMAP ".######." 444 | BITMAP "..####.." 445 | 446 | BITMAP "..####.." 447 | BITMAP ".######." 448 | BITMAP "########" 449 | BITMAP "########" 450 | BITMAP "###.#.##" 451 | BITMAP "###.#.##" 452 | BITMAP ".#...##." 453 | BITMAP ".....#.." 454 | 455 | ' Card #6. Ghosts bitmap 456 | bitmaps_2: 457 | BITMAP "..####.." 458 | BITMAP ".######." 459 | BITMAP "##.##.##" 460 | BITMAP "########" 461 | BITMAP "########" 462 | BITMAP "########" 463 | BITMAP "########" 464 | BITMAP "#.#.#.#." 465 | 466 | BITMAP "..####.." 467 | BITMAP ".######." 468 | BITMAP "##.##.##" 469 | BITMAP "########" 470 | BITMAP "########" 471 | BITMAP "########" 472 | BITMAP "########" 473 | BITMAP ".#.#.#.#" 474 | 475 | BITMAP ".#####.." 476 | BITMAP "#######." 477 | BITMAP "#..#..#." 478 | BITMAP "#######." 479 | BITMAP "#.###.#." 480 | BITMAP ".#.#.#.." 481 | BITMAP "..###..." 482 | BITMAP "........" 483 | 484 | ' Labyrinth 485 | level1: 486 | DATA $0801,$0809,$0809,$0809,$0809,$0811,$0801,$0809,$0809,$0809 487 | DATA $0809,$0809,$0811,$0801,$0809,$0809,$0809,$0809,$0811,$0000 488 | 489 | DATA $0819,$0836,$0836,$0836,$0836,$0821,$0829,$0836,$0836,$0836 490 | DATA $0836,$0836,$0821,$0829,$0836,$0836,$0836,$0836,$0819,$0000 491 | 492 | DATA $0819,$0836,$0801,$0811,$0836,$0836,$0836,$0836,$0801,$0809 493 | DATA $0811,$0836,$0836,$0836,$0836,$0801,$0811,$0836,$0819,$0000 494 | 495 | DATA $0819,$0836,$0821,$0829,$0836,$0801,$0811,$0836,$0821,$0809 496 | DATA $0829,$0836,$0801,$0811,$0836,$0821,$0829,$0836,$0819,$0000 497 | 498 | DATA $0819,$0836,$0836,$0836,$0836,$0821,$0829,$0836,$0836,$0836 499 | DATA $0836,$0836,$0821,$0829,$0836,$0836,$0836,$0836,$0819,$0000 500 | 501 | DATA $0821,$0809,$0809,$0811,$0836,$0836,$0836,$0836,$0801,$0809 502 | DATA $0811,$0836,$0836,$0836,$0836,$0801,$0809,$0809,$0829,$0000 503 | 504 | DATA $0801,$0809,$0809,$0829,$0836,$0801,$0811,$0836,$0821,$0809 505 | DATA $0829,$0836,$0801,$0811,$0836,$0821,$0809,$0809,$0811,$0000 506 | 507 | DATA $0819,$0836,$0836,$0836,$0836,$0821,$0829,$0836,$0836,$0836 508 | DATA $0836,$0836,$0821,$0829,$0836,$0836,$0836,$0836,$0819,$0000 509 | 510 | DATA $0819,$0836,$0801,$0811,$0836,$0836,$0836,$0836,$0801,$0809 511 | DATA $0811,$0836,$0836,$0836,$0836,$0801,$0811,$0836,$0819,$0000 512 | 513 | DATA $0819,$0836,$0821,$0829,$0836,$0801,$0811,$0836,$0821,$0809 514 | DATA $0829,$0836,$0801,$0811,$0836,$0821,$0829,$0836,$0819,$0000 515 | 516 | DATA $0819,$0836,$0836,$0836,$0836,$0819,$0819,$0836,$0836,$0836 517 | DATA $0836,$0836,$0819,$0819,$0836,$0836,$0836,$0836,$0819,$0000 518 | 519 | DATA $0821,$0809,$0809,$0809,$0809,$0829,$0821,$0809,$0809,$0809 520 | DATA $0809,$0809,$0829,$0821,$0809,$0809,$0809,$0809,$0829,$0000 521 | 522 | ' Logo 523 | 524 | ' 38 bitmaps 525 | screen_bitmaps_0: 526 | DATA $FFFF,$FFFF,$FFFF,$E0FF 527 | DATA $FFFF,$FFFF,$FFFF,$0FFF 528 | DATA $FFFF,$FFFF,$FCFF,$FCFC 529 | DATA $FFFF,$FFFF,$1F9F,$0F0F 530 | DATA $FFFF,$FCFF,$F0FC,$FFF7 531 | DATA $EFFF,$00E0,$0300,$F3F3 532 | DATA $FFFF,$1F1F,$FF7F,$FBFF 533 | DATA $FFFF,$FFFF,$F3FB,$E3E3 534 | DATA $FEFE,$F9F8,$F3F3,$F3F3 535 | DATA $0000,$FF0F,$FFFF,$FEFF 536 | DATA $070F,$E7E7,$C7E7,$0F87 537 | DATA $FEFE,$FFFE,$FFFF,$FFFF 538 | DATA $0707,$0303,$8103,$8181 539 | DATA $FFFF,$CFCF,$C1C3,$E0C0 540 | DATA $FCF8,$FCFC,$FCFC,$1C7C 541 | DATA $F3F3,$7971,$7979,$7879 542 | screen_bitmaps_1: 543 | DATA $F1F1,$F0F0,$F8F0,$F8F8 544 | DATA $C7E3,$CFC7,$8F8F,$9F8F 545 | DATA $E0F0,$E6E4,$E7E7,$CFCF 546 | DATA $70F8,$0300,$FFFF,$FFFF 547 | DATA $7C3C,$F1F8,$E0F1,$C7E4 548 | DATA $070F,$E387,$23E3,$0303 549 | DATA $C7FF,$C2C3,$C0C0,$C1C7 550 | DATA $FFFF,$1F3F,$FF7F,$FFFF 551 | DATA $C181,$C1C1,$C0C0,$C0C0 552 | DATA $E3E0,$E1E3,$F1F1,$F1F1 553 | DATA $8004,$E0C0,$F0E0,$FFFF 554 | DATA $7878,$7C7C,$FCFC,$FFFF 555 | DATA $FCFC,$FFFE,$FEFF,$FCFE 556 | DATA $3F1F,$3F3F,$7F7F,$7F7F 557 | DATA $CFCF,$CFCF,$FFFF,$FFFF 558 | DATA $C7C7,$8F8F,$DF9F,$FFFF 559 | screen_bitmaps_2: 560 | DATA $E3E3,$E3E3,$EFE7,$FFFF 561 | DATA $8C80,$8F8E,$FF1F,$FFFF 562 | DATA $7F7F,$3F3F,$FFFF,$FFFF 563 | DATA $CFC0,$FFFF,$FFFF,$FFFF 564 | DATA $FFF1,$FFFF,$FFFF,$FFFF 565 | DATA $F8FC,$FFFF,$FFFF,$FFFF 566 | 567 | REM 20x12 cards 568 | screen_cards: 569 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 570 | DATA $0000,$1C00,$1C08,$0000,$0000,$0000,$0000,$0000,$0000,$0000 571 | DATA $0000,$0000,$1C10,$1C18,$0000,$1C20,$1C28,$1C30,$1C38,$0000 572 | DATA $1C40,$1C48,$1C50,$0000,$0000,$0000,$0000,$0000,$0000,$0000 573 | DATA $0000,$0000,$1C58,$1C60,$1C68,$1C70,$1C78,$1C80,$1C88,$0000 574 | DATA $1C90,$1C98,$1CA0,$1CA8,$1CB0,$1CB8,$0000,$0000,$0000,$0000 575 | DATA $0000,$0000,$0000,$1CC0,$1CC8,$1CD0,$1CD8,$1CE0,$1CE8,$0000 576 | DATA $1CF0,$0000,$1CF8,$1D00,$1D08,$1D10,$0000,$0000,$0000,$0000 577 | DATA $0000,$0000,$0000,$1D18,$1D20,$0000,$0000,$1D28,$0000,$0000 578 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 579 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 580 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 581 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 582 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 583 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 584 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 585 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 586 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 587 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 588 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 589 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 590 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 591 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 592 | DATA $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 593 | -------------------------------------------------------------------------------- /samples/rain.bas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Rain 3 | ' Demo for IntyBASIC 4 | ' by Oscar Toledo G. http://nanochess.org/ 5 | ' Apr/10/2017 6 | ' Jan/09/2018 Added more comments and tree animation 7 | ' 8 | 9 | DIM x_tree(8) 10 | 11 | ' 12 | ' It uses the Color Stack mode because it allows fast change of the 13 | ' background color just by changing the parameters to MODE 0 14 | ' 15 | MODE 0,1,1,1,1 16 | CLS 17 | DEFINE 0,8,rain_0_0 18 | DEFINE ALTERNATE 8,4,palm_tree_0 19 | WAIT 20 | 21 | ' 22 | ' Fill the screen with rain 23 | ' 24 | FOR c = 0 TO 19 25 | GOSUB draw_column 26 | NEXT c 27 | 28 | ' 29 | ' Draw palm trees in background (note priority bit in third arg) 30 | ' 31 | FOR c = 0 TO 7 32 | x_tree(c) = c * 20 + RANDOM(8) 33 | SPRITE c,$0708 + x_tree(c),$0288 + RANDOM(20) + 50,$2804+8*8 34 | NEXT c 35 | 36 | ' 37 | ' Main loop 38 | ' 39 | main_loop: 40 | WAIT 41 | WAIT 42 | DEFINE 0,8,rain_0_0 ' Move rain (offset = 0px) 43 | IF lightning = 1 THEN MODE 0,0,0,0,0 ' Black background 44 | WAIT 45 | WAIT 46 | DEFINE 0,8,rain_0_1 ' Move rain (offset = 8px) 47 | IF lightning = 1 THEN MODE 0,7,7,7,7 ' White background 48 | WAIT 49 | WAIT 50 | DEFINE 0,8,rain_0_2 ' Move rain (offset = 16px) 51 | WAIT 52 | WAIT 53 | DEFINE 0,8,rain_0_3 ' Move rain (offset = 24px) 54 | 55 | c = RANDOM(20) 56 | GOSUB draw_column ' Change a rain column 57 | 58 | IF lightning = 1 THEN MODE 0,1,1,1,1:lightning = 0 ' Normal background 59 | 60 | ' Check if it should start a lightning 61 | IF RAND = 0 THEN MODE 0,7,7,7,7:lightning=1 ' White background 62 | 63 | IF RAND AND 64 THEN 64 | FOR c = 0 TO 7 65 | SPRITE c,$0708 + x_tree(c),,$2804+8*8 66 | NEXT c 67 | ELSE 68 | FOR c = 0 TO 7 69 | SPRITE c,$0708 + x_tree(c) + 2,,$2804+10*8 70 | NEXT c 71 | END IF 72 | 73 | GOTO main_loop 74 | 75 | ' 76 | ' Draw a column of rain 77 | ' 78 | draw_column: PROCEDURE 79 | g = RANDOM($1F) ' Generate two numbers in one call 80 | d = g % 12 * 20 + c ' First one is random start row (1 in 4) 81 | f = ((g / 16) AND 1) * 24 ' Select one of two columns bitmaps 82 | 83 | ' After drawing the last row of screen goes back to first row 84 | FOR e = 0 TO 2 85 | PRINT AT d,$1800+f 86 | IF d >= 220 THEN d = d - 220 ELSE d = d + 20 87 | PRINT AT d,$1808+f 88 | IF d >= 220 THEN d = d - 220 ELSE d = d + 20 89 | PRINT AT d,$1810+f 90 | IF d >= 220 THEN d = d - 220 ELSE d = d + 20 91 | PRINT AT d,$1818+f 92 | IF d >= 220 THEN d = d - 220 ELSE d = d + 20 93 | NEXT e 94 | END 95 | 96 | rain_0_0: 97 | BITMAP "10000000" 98 | BITMAP "10000000" 99 | BITMAP "10000000" 100 | BITMAP "10000000" 101 | BITMAP "10000000" 102 | BITMAP "10000000" 103 | BITMAP "10000000" 104 | BITMAP "10000000" 105 | 106 | BITMAP "00000000" 107 | BITMAP "00000000" 108 | BITMAP "00000000" 109 | BITMAP "00000000" 110 | BITMAP "00000000" 111 | BITMAP "00000000" 112 | BITMAP "00000000" 113 | BITMAP "00000000" 114 | 115 | BITMAP "00000000" 116 | BITMAP "00000000" 117 | BITMAP "00000000" 118 | BITMAP "00000000" 119 | BITMAP "00000000" 120 | BITMAP "00000000" 121 | BITMAP "00000000" 122 | BITMAP "00000000" 123 | 124 | BITMAP "00000000" 125 | BITMAP "00000000" 126 | BITMAP "00000000" 127 | BITMAP "00000000" 128 | BITMAP "00000000" 129 | BITMAP "00000000" 130 | BITMAP "00000000" 131 | BITMAP "00000000" 132 | 133 | BITMAP "00000000" 134 | BITMAP "00000000" 135 | BITMAP "00000000" 136 | BITMAP "00000000" 137 | BITMAP "00001000" 138 | BITMAP "00001000" 139 | BITMAP "00001000" 140 | BITMAP "00001000" 141 | 142 | BITMAP "00001000" 143 | BITMAP "00001000" 144 | BITMAP "00001000" 145 | BITMAP "00001000" 146 | BITMAP "00000000" 147 | BITMAP "00000000" 148 | BITMAP "00000000" 149 | BITMAP "00000000" 150 | 151 | BITMAP "00000000" 152 | BITMAP "00000000" 153 | BITMAP "00000000" 154 | BITMAP "00000000" 155 | BITMAP "00000000" 156 | BITMAP "00000000" 157 | BITMAP "00000000" 158 | BITMAP "00000000" 159 | 160 | BITMAP "00000000" 161 | BITMAP "00000000" 162 | BITMAP "00000000" 163 | BITMAP "00000000" 164 | BITMAP "00000000" 165 | BITMAP "00000000" 166 | BITMAP "00000000" 167 | BITMAP "00000000" 168 | 169 | rain_0_1: 170 | BITMAP "00000000" 171 | BITMAP "00000000" 172 | BITMAP "00000000" 173 | BITMAP "00000000" 174 | BITMAP "00000000" 175 | BITMAP "00000000" 176 | BITMAP "00000000" 177 | BITMAP "00000000" 178 | 179 | BITMAP "10000000" 180 | BITMAP "10000000" 181 | BITMAP "10000000" 182 | BITMAP "10000000" 183 | BITMAP "10000000" 184 | BITMAP "10000000" 185 | BITMAP "10000000" 186 | BITMAP "10000000" 187 | 188 | BITMAP "00000000" 189 | BITMAP "00000000" 190 | BITMAP "00000000" 191 | BITMAP "00000000" 192 | BITMAP "00000000" 193 | BITMAP "00000000" 194 | BITMAP "00000000" 195 | BITMAP "00000000" 196 | 197 | BITMAP "00000000" 198 | BITMAP "00000000" 199 | BITMAP "00000000" 200 | BITMAP "00000000" 201 | BITMAP "00000000" 202 | BITMAP "00000000" 203 | BITMAP "00000000" 204 | BITMAP "00000000" 205 | 206 | BITMAP "00000000" 207 | BITMAP "00000000" 208 | BITMAP "00000000" 209 | BITMAP "00000000" 210 | BITMAP "00000000" 211 | BITMAP "00000000" 212 | BITMAP "00000000" 213 | BITMAP "00000000" 214 | 215 | BITMAP "00000000" 216 | BITMAP "00000000" 217 | BITMAP "00000000" 218 | BITMAP "00000000" 219 | BITMAP "00001000" 220 | BITMAP "00001000" 221 | BITMAP "00001000" 222 | BITMAP "00001000" 223 | 224 | BITMAP "00001000" 225 | BITMAP "00001000" 226 | BITMAP "00001000" 227 | BITMAP "00001000" 228 | BITMAP "00000000" 229 | BITMAP "00000000" 230 | BITMAP "00000000" 231 | BITMAP "00000000" 232 | 233 | BITMAP "00000000" 234 | BITMAP "00000000" 235 | BITMAP "00000000" 236 | BITMAP "00000000" 237 | BITMAP "00000000" 238 | BITMAP "00000000" 239 | BITMAP "00000000" 240 | BITMAP "00000000" 241 | 242 | rain_0_2: 243 | BITMAP "00000000" 244 | BITMAP "00000000" 245 | BITMAP "00000000" 246 | BITMAP "00000000" 247 | BITMAP "00000000" 248 | BITMAP "00000000" 249 | BITMAP "00000000" 250 | BITMAP "00000000" 251 | 252 | BITMAP "00000000" 253 | BITMAP "00000000" 254 | BITMAP "00000000" 255 | BITMAP "00000000" 256 | BITMAP "00000000" 257 | BITMAP "00000000" 258 | BITMAP "00000000" 259 | BITMAP "00000000" 260 | 261 | BITMAP "10000000" 262 | BITMAP "10000000" 263 | BITMAP "10000000" 264 | BITMAP "10000000" 265 | BITMAP "10000000" 266 | BITMAP "10000000" 267 | BITMAP "10000000" 268 | BITMAP "10000000" 269 | 270 | BITMAP "00000000" 271 | BITMAP "00000000" 272 | BITMAP "00000000" 273 | BITMAP "00000000" 274 | BITMAP "00000000" 275 | BITMAP "00000000" 276 | BITMAP "00000000" 277 | BITMAP "00000000" 278 | 279 | BITMAP "00000000" 280 | BITMAP "00000000" 281 | BITMAP "00000000" 282 | BITMAP "00000000" 283 | BITMAP "00000000" 284 | BITMAP "00000000" 285 | BITMAP "00000000" 286 | BITMAP "00000000" 287 | 288 | BITMAP "00000000" 289 | BITMAP "00000000" 290 | BITMAP "00000000" 291 | BITMAP "00000000" 292 | BITMAP "00000000" 293 | BITMAP "00000000" 294 | BITMAP "00000000" 295 | BITMAP "00000000" 296 | 297 | BITMAP "00000000" 298 | BITMAP "00000000" 299 | BITMAP "00000000" 300 | BITMAP "00000000" 301 | BITMAP "00001000" 302 | BITMAP "00001000" 303 | BITMAP "00001000" 304 | BITMAP "00001000" 305 | 306 | BITMAP "00001000" 307 | BITMAP "00001000" 308 | BITMAP "00001000" 309 | BITMAP "00001000" 310 | BITMAP "00000000" 311 | BITMAP "00000000" 312 | BITMAP "00000000" 313 | BITMAP "00000000" 314 | 315 | rain_0_3: 316 | BITMAP "00000000" 317 | BITMAP "00000000" 318 | BITMAP "00000000" 319 | BITMAP "00000000" 320 | BITMAP "00000000" 321 | BITMAP "00000000" 322 | BITMAP "00000000" 323 | BITMAP "00000000" 324 | 325 | BITMAP "00000000" 326 | BITMAP "00000000" 327 | BITMAP "00000000" 328 | BITMAP "00000000" 329 | BITMAP "00000000" 330 | BITMAP "00000000" 331 | BITMAP "00000000" 332 | BITMAP "00000000" 333 | 334 | BITMAP "00000000" 335 | BITMAP "00000000" 336 | BITMAP "00000000" 337 | BITMAP "00000000" 338 | BITMAP "00000000" 339 | BITMAP "00000000" 340 | BITMAP "00000000" 341 | BITMAP "00000000" 342 | 343 | BITMAP "10000000" 344 | BITMAP "10000000" 345 | BITMAP "10000000" 346 | BITMAP "10000000" 347 | BITMAP "10000000" 348 | BITMAP "10000000" 349 | BITMAP "10000000" 350 | BITMAP "10000000" 351 | 352 | BITMAP "00001000" 353 | BITMAP "00001000" 354 | BITMAP "00001000" 355 | BITMAP "00001000" 356 | BITMAP "00000000" 357 | BITMAP "00000000" 358 | BITMAP "00000000" 359 | BITMAP "00000000" 360 | 361 | BITMAP "00000000" 362 | BITMAP "00000000" 363 | BITMAP "00000000" 364 | BITMAP "00000000" 365 | BITMAP "00000000" 366 | BITMAP "00000000" 367 | BITMAP "00000000" 368 | BITMAP "00000000" 369 | 370 | BITMAP "00000000" 371 | BITMAP "00000000" 372 | BITMAP "00000000" 373 | BITMAP "00000000" 374 | BITMAP "00000000" 375 | BITMAP "00000000" 376 | BITMAP "00000000" 377 | BITMAP "00000000" 378 | 379 | BITMAP "00000000" 380 | BITMAP "00000000" 381 | BITMAP "00000000" 382 | BITMAP "00000000" 383 | BITMAP "00001000" 384 | BITMAP "00001000" 385 | BITMAP "00001000" 386 | BITMAP "00001000" 387 | 388 | palm_tree_0: 389 | BITMAP "01100000" 390 | BITMAP "00100100" 391 | BITMAP "10101100" 392 | BITMAP "11111011" 393 | BITMAP "10111111" 394 | BITMAP "10101110" 395 | BITMAP "01101011" 396 | BITMAP "01001000" 397 | BITMAP "00011000" 398 | BITMAP "00011000" 399 | BITMAP "00011100" 400 | BITMAP "00011100" 401 | BITMAP "00111000" 402 | BITMAP "00111000" 403 | BITMAP "00111000" 404 | BITMAP "00011100" 405 | 406 | palm_tree_1: 407 | BITMAP "01100000" 408 | BITMAP "00100100" 409 | BITMAP "10101100" 410 | BITMAP "11111011" 411 | BITMAP "10111111" 412 | BITMAP "10101110" 413 | BITMAP "01101011" 414 | BITMAP "01001000" 415 | BITMAP "00110000" 416 | BITMAP "00110000" 417 | BITMAP "00111000" 418 | BITMAP "00111000" 419 | BITMAP "01110000" 420 | BITMAP "01110000" 421 | BITMAP "01110000" 422 | BITMAP "00111000" 423 | 424 | -------------------------------------------------------------------------------- /samples/sample.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nanochess/IntyBASIC/606e128a7bb794c8a02e7650742dd60ca8e31434/samples/sample.bmp -------------------------------------------------------------------------------- /samples/screen.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Mode statement test 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Apr/02/2014 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | loop: WAIT 12 | CLS 13 | MODE SCREEN_COLOR_STACK,STACK_BLACK,STACK_BLUE,STACK_RED,STACK_TAN ' Set color-stack mode 14 | WAIT 15 | PRINT AT SCREENPOS(0, 0) COLOR CS_WHITE,"HELLO COLOR-STACK" 16 | PRINT AT SCREENPOS(0, 1) COLOR SPR_WHITE + CS_ADVANCE,"H" 17 | PRINT COLOR CS_WHITE,"ELLO" 18 | PRINT AT 40 COLOR CS_WHITE + CS_ADVANCE,"H" 19 | PRINT COLOR CS_WHITE,"ELLO" 20 | PRINT AT 60 COLOR CS_WHITE + CS_ADVANCE,"H" 21 | PRINT COLOR CS_WHITE,"ELLO" 22 | 23 | PRINT AT SCREENPOS(0, 5) COLOR CS_WHITE + $0200,"HELLO FOREGROUND" 24 | PRINT AT SCREENPOS(0, 6) COLOR CS_WHITE + $0400,"HELLO" 25 | PRINT AT SCREENPOS(0, 7) COLOR CS_PURPLE,"HELLO" 26 | PRINT AT SCREENPOS(0, 8) COLOR CS_WHITE + CS_ADVANCE,"HELLO" 27 | FOR c = 1 to 60 28 | WAIT 29 | NEXT c 30 | MODE SCREEN_FOREGROUND_BACKGROUND ' Set foreground/background mode 31 | FOR c = 1 to 60 32 | WAIT 33 | NEXT c 34 | 35 | SCREEN my_screen ' Copy a full screen 36 | FOR c = 1 to 60 37 | WAIT 38 | NEXT c 39 | WAIT 40 | SCREEN my_screen,21,38,1,2 ' Copy a fragment of L-shape 41 | FOR c = 1 to 9 42 | WAIT 43 | SCREEN my_screen,0,4+c*21,3,3 ' Copy A plus L-shape 44 | NEXT c ' looks like displacement 45 | FOR c = 1 to 60 46 | WAIT 47 | NEXT c 48 | GOTO loop 49 | 50 | REM a simple screen with a letter A in the upper-left corner 51 | REM a letter B in the bottom-right corner 52 | REM and block L-graphics 53 | my_screen: 54 | data $010f,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 55 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 56 | 57 | data $0007,$2007,$2007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 58 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 59 | 60 | data $0007,$2007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 61 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 62 | 63 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 64 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 65 | 66 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 67 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 68 | 69 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 70 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 71 | 72 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 73 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 74 | 75 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 76 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 77 | 78 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 79 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 80 | 81 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 82 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$1007,$0007 83 | 84 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 85 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$1007,$1007,$0007 86 | 87 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007 88 | data $0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0007,$0117 89 | 90 | -------------------------------------------------------------------------------- /samples/scroll.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Scrolling technical test 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Feb/26/2014 6 | REM Mar/02/2014. Added sprite sample with offset correction. 7 | REM 8 | 9 | REM Include useful predefined constants 10 | INCLUDE "constants.bas" 11 | 12 | WAIT 13 | DEFINE DEF00,3,graphics 14 | WAIT 15 | BORDER BORDER_BLACK, 3 16 | FOR ROW=0 TO 11 17 | GOSUB clear_row 18 | NEXT 19 | 20 | offset_x = 0 21 | offset_y = 0 22 | offset_d = 0 23 | WAIT 24 | 25 | repeat: 26 | REM >>>> Scroll upward 27 | FOR time=1 to 240 28 | IF offset_y=7 THEN offset_d=3:offset_y=0 ELSE offset_y=offset_y+1 29 | SPRITE 0, 64 + VISIBLE + ZOOMX2 - offset_x, 48 + ZOOMY2 - offset_y, SPR02 + SPR_YELLOW 30 | SCROLL offset_x,offset_y,offset_d 31 | WAIT 32 | offset_d=0 33 | IF offset_y=0 THEN ROW=0:GOSUB clear_row:PRINT AT RAND%BACKGROUND_COLUMNS,"\257" 34 | NEXT time 35 | 36 | REM >>>> Scroll to left 37 | FOR time=1 to 240 38 | IF offset_x=7 THEN offset_d=1:offset_x=0 ELSE offset_x=offset_x+1 39 | SPRITE 0,64 + VISIBLE + ZOOMX2 - offset_x, 48 + ZOOMY2 - offset_y, SPR02 + SPR_YELLOW 40 | SCROLL offset_x,offset_y,offset_d 41 | WAIT 42 | offset_d=0 43 | IF offset_x=0 THEN COL=0:GOSUB clear_column:PRINT AT RAND%BACKGROUND_ROWS*BACKGROUND_COLUMNS,"\257" 44 | NEXT time 45 | 46 | REM >>>> Scroll downward 47 | FOR time=1 to 240 48 | IF offset_y=0 THEN offset_d=4:offset_y=7 ELSE offset_y=offset_y-1 49 | SPRITE 0, 64 + VISIBLE + ZOOMX2 - offset_x, 48 + ZOOMY2 - offset_y, SPR02 + SPR_YELLOW 50 | SCROLL offset_x,offset_y,offset_d 51 | WAIT 52 | offset_d=0 53 | IF offset_y=7 THEN ROW=11:GOSUB clear_row:PRINT AT SCREENPOS(RAND%BACKGROUND_COLUMNS, 10),"\257" 54 | NEXT time 55 | 56 | REM >>>> Scroll to right 57 | FOR time=1 to 240 58 | IF offset_x=0 THEN offset_d=2:offset_x=7 ELSE offset_x=offset_x-1 59 | SPRITE 0, 64 + VISIBLE + ZOOMX2 - offset_x, 48 + ZOOMY2 - offset_y, SPR02 + SPR_YELLOW 60 | SCROLL offset_x,offset_y,offset_d 61 | WAIT 62 | offset_d=0 63 | IF offset_x=7 THEN COL=19:GOSUB clear_column:PRINT AT RAND%BACKGROUND_ROWS*BACKGROUND_COLUMNS+19,"\257" 64 | NEXT time 65 | 66 | GOTO repeat 67 | 68 | clear_row: PROCEDURE 69 | PRINT AT ROW*BACKGROUND_COLUMNS 70 | PRINT "\256\256\256\256\256\256\256\256\256\256" 71 | PRINT "\256\256\256\256\256\256\256\256\256\256" 72 | RETURN 73 | END 74 | 75 | clear_column: PROCEDURE 76 | FOR ROW=0 TO 11 77 | PRINT AT SCREENPOS(COL, ROW),"\256" 78 | NEXT 79 | RETURN 80 | END 81 | 82 | graphics: 83 | BITMAP "00001000" 84 | BITMAP "00001000" 85 | BITMAP "00001000" 86 | BITMAP "11111111" 87 | BITMAP "00001000" 88 | BITMAP "00001000" 89 | BITMAP "00001000" 90 | BITMAP "00001000" 91 | 92 | BITMAP "11111111" 93 | BITMAP "10101011" 94 | BITMAP "11010101" 95 | BITMAP "10101011" 96 | BITMAP "11010101" 97 | BITMAP "10101011" 98 | BITMAP "11010101" 99 | BITMAP "11111111" 100 | 101 | BITMAP "00111100" 102 | BITMAP "01111110" 103 | BITMAP "11111111" 104 | BITMAP "11111111" 105 | BITMAP "11111111" 106 | BITMAP "11111111" 107 | BITMAP "01111110" 108 | BITMAP "00111100" 109 | 110 | -------------------------------------------------------------------------------- /samples/segments.bas: -------------------------------------------------------------------------------- 1 | ' 2 | ' Example of program in segments 3 | ' 4 | ' by Oscar Toledo G. 5 | ' https://nanochess.org 6 | ' 7 | ' Creation date: Apr/27/2025. 8 | ' 9 | 10 | OPTION MAP 1 11 | 12 | GOSUB subroutine_1 13 | GOSUB subroutine_2 14 | 15 | PRINT AT 21,"Main segment" 16 | 17 | WHILE 1: WEND 18 | 19 | SEGMENT 1 20 | 21 | subroutine_1: PROCEDURE 22 | PRINT AT 41,"Segment 1" 23 | END 24 | 25 | SEGMENT 2 26 | 27 | subroutine_2: PROCEDURE 28 | PRINT AT 61,"Segment 2" 29 | END 30 | 31 | -------------------------------------------------------------------------------- /samples/sprites.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Example MOBs (sprites) 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Jan/27/2014 6 | REM Jul/12/2015. Added IntyBASIC logo (DZ-Jay) and spaceship now visible (hidden before) 7 | REM Jul/13/2015. Enhanced spaceship graphics. 8 | REM 9 | 10 | REM Include useful predefined constants 11 | INCLUDE "constants.bas" 12 | 13 | WAIT 14 | DEFINE DEF00,5,drawings 15 | WAIT 16 | x1=80 17 | y1=56 18 | 19 | loop: 20 | FOR X=1 TO 80 21 | WAIT 22 | SPRITE 0, ( 40+X) + VISIBLE + ZOOMX2, 20 + ZOOMY2, SPR00 + SPR_WHITE 23 | SPRITE 1, (120-X) + VISIBLE + ZOOMX2, 60 + ZOOMY2, SPR01 + SPR_BLUE 24 | SPRITE 2, 20 + VISIBLE + ZOOMX2, ( 8+X) + ZOOMY2, SPR02 + SPR_RED 25 | SPRITE 3, 140 + VISIBLE + ZOOMX2, (96-X) + ZOOMY2, SPR03 + SPR_TAN 26 | SPRITE 4, X1 + VISIBLE + ZOOMX2, (Y1-8) + ZOOMY4, SPR04 + SPR_GREEN 27 | GOSUB test 28 | NEXT X 29 | 30 | FOR X=80 TO 1 STEP -1 31 | WAIT 32 | SPRITE 0, ( 40+X) + VISIBLE + ZOOMX2, 20 + ZOOMY2, SPR00 + SPR_WHITE 33 | SPRITE 1, (120-X) + VISIBLE + ZOOMX2, 60 + ZOOMY2, SPR01 + SPR_BLUE 34 | SPRITE 2, 20 + VISIBLE + ZOOMX2, ( 8+X) + ZOOMY2, SPR02 + SPR_RED 35 | SPRITE 3, 140 + VISIBLE + ZOOMX2, (96-X) + ZOOMY2, SPR03 + SPR_TAN 36 | SPRITE 4, X1 + VISIBLE + ZOOMX2, (Y1-8) + ZOOMY4, SPR04 + SPR_GREEN 37 | GOSUB test 38 | NEXT X 39 | 40 | GOTO loop 41 | 42 | test: PROCEDURE 43 | IF CONT1.UP THEN IF Y1>0 THEN Y1=Y1-1 44 | IF CONT1.DOWN THEN IF Y1<104 THEN Y1=Y1+1 45 | IF CONT1.LEFT THEN IF X1>0 THEN X1=X1-1 46 | IF CONT1.RIGHT THEN IF X1<168 THEN X1=X1+1 47 | IF CONT1.BUTTON THEN SOUND 0,100,15 ELSE SOUND 0,,0 ' beeper 48 | END 49 | 50 | drawings: 51 | REM Invader 52 | BITMAP "#..##..#" 53 | BITMAP "########" 54 | BITMAP ".#.##.#." 55 | BITMAP ".######." 56 | BITMAP "..####.." 57 | BITMAP "..#..#.." 58 | BITMAP "..#..#.." 59 | BITMAP ".##..##." 60 | 61 | REM Spaceship 62 | BITMAP "...##..." 63 | BITMAP "...##..." 64 | BITMAP "..####.." 65 | BITMAP "..#..#.." 66 | BITMAP "..####.." 67 | BITMAP "..####.." 68 | BITMAP ".######." 69 | BITMAP "##.##.##" 70 | 71 | REM Stickman 72 | BITMAP "...##..." 73 | BITMAP "...##..." 74 | BITMAP ".######." 75 | BITMAP "...##..." 76 | BITMAP "...##..." 77 | BITMAP "..####.." 78 | BITMAP "..#..#.." 79 | BITMAP ".##..##." 80 | 81 | REM Lama 82 | BITMAP ".##....." 83 | BITMAP "###....." 84 | BITMAP ".##....." 85 | BITMAP ".#######" 86 | BITMAP ".######." 87 | BITMAP ".##..##." 88 | BITMAP ".##..##." 89 | BITMAP "###.###." 90 | 91 | REM SDK Logo 92 | BITMAP "..#.#..." 93 | BITMAP ".#####.." 94 | BITMAP ".#.##.#." 95 | BITMAP ".####.#." 96 | BITMAP "###.##.#" 97 | BITMAP "###.##.#" 98 | BITMAP ".#.#####" 99 | BITMAP "...#####" 100 | -------------------------------------------------------------------------------- /samples/test.bas: -------------------------------------------------------------------------------- 1 | rem 2 | rem Test of Intybasic features 3 | rem by Oscar Toledo G. http://nanochess.org 4 | rem Jan/22/2014, last updated Jan/27/2014 5 | rem 6 | 7 | REM Include useful predefined constants 8 | INCLUDE "constants.bas" 9 | 10 | main: 11 | cls 12 | a = 5 13 | b = 9 14 | if not a = $fffa then poke SCREENADDR(0, 0),$10f 15 | if -a = $fffb then poke SCREENADDR(1, 0),$10f 16 | if peek(SCREENADDR(0, 0)) = $010f then poke SCREENADDR(2, 0),$10f 17 | if a+1=6 then poke SCREENADDR(3, 0),$10f 18 | if a+b=14 then poke SCREENADDR(4, 0),$10f 19 | if a+(b+1)=15 then poke SCREENADDR(5, 0),$10f 20 | if a-1=4 then poke SCREENADDR(6, 0),$10f 21 | if a-b=$fffc then poke SCREENADDR(7, 0),$10f 22 | if a-(b+1)=$fffb then poke SCREENADDR(8, 0),$10f 23 | if (a or 2)=7 then poke SCREENADDR(9, 0),$10f 24 | if (a or b)=13 then poke SCREENADDR(10, 0),$10f 25 | if (a or (b+1))=15 then poke SCREENADDR(11, 0),$10f 26 | if (a xor 2)=7 then poke SCREENADDR(12, 0),$10f 27 | if (a xor b)=12 then poke SCREENADDR(13, 0),$10f 28 | if (a xor (b+1))=15 then poke SCREENADDR(14, 0),$10f 29 | if (a and 1)=1 then poke SCREENADDR(15, 0),$10f 30 | if (a and b)=1 then poke SCREENADDR(16, 0),$10f 31 | if (a and (b+1))=0 then poke SCREENADDR(17, 0),$10f 32 | if a=5 then poke SCREENADDR(18, 0),$10f 33 | if a<>b then poke SCREENADDR(19, 0),$10f 34 | if aa then poke SCREENADDR(2, 1),$10f 37 | if b>=a then poke SCREENADDR(3, 1),$10f 38 | if a=4+1 then poke SCREENADDR(4, 1),$10f 39 | if a<>3-1 then poke SCREENADDR(5, 1),$10f 40 | if a<8+1 then poke SCREENADDR(6, 1),$10f 41 | if a<=8+1 then poke SCREENADDR(7, 1),$10f 42 | if a>1-1 then poke SCREENADDR(8, 1),$10f 43 | if a>=1-1 then poke SCREENADDR(9, 1),$10f 44 | if a*2=10 then poke SCREENADDR(10, 1),$10f 45 | if a*4=20 then poke SCREENADDR(11, 1),$10f 46 | if a*b=45 then poke SCREENADDR(12, 1),$10f 47 | if a*(b+1)=50 then poke SCREENADDR(13, 1),$10f 48 | if a/2=2 then poke SCREENADDR(14, 1),$10f 49 | if a/4=1 then poke SCREENADDR(15, 1),$10f 50 | if 20/a=4 then poke SCREENADDR(16, 1),$10f 51 | if b/a=1 then poke SCREENADDR(17, 1),$10f 52 | if a%2=1 then poke SCREENADDR(18, 1),$10f 53 | if a%4=1 then poke SCREENADDR(19, 1),$10f 54 | for a=SCREENPOS(0, 2) to SCREENPOS(19, 11) step 3 55 | poke BACKTAB+a,$002f*8+7 56 | next a 57 | for a=SCREENPOS(19, 11) to SCREENPOS(1, 2) step -3 58 | poke BACKTAB+a,$0034*8+7 59 | next a 60 | for a=SCREENPOS(2, 2) to SCREENPOS(19, 11) step 3 61 | poke BACKTAB+a,$0027*8+7 62 | next a 63 | a = 5 64 | b = 6 65 | a = b 66 | a = a + b 67 | a = a + 5 68 | a = a + b + 5 69 | a = (a + b) + 3 70 | for a=1 to 5 71 | b=b+1 72 | next a 73 | 74 | a = not a 75 | a = -a 76 | a = a = b 77 | a = a <> b 78 | a = a < b 79 | a = a > b 80 | a = a <= b 81 | a = a >= b 82 | if a=b then a=9 else a=11 83 | 84 | restore table 85 | loop: read value 86 | if value=0 then goto end 87 | poke value+512,95*8+7 88 | goto loop 89 | 90 | end: 91 | goto end 92 | 93 | table: 94 | data 5*20+7,5*20+8,5*20+9,5*20+10,5*20+11 95 | data 6*20+7,6*20+11 96 | data 7*20+7 97 | data 7*20+11 98 | data 8*20+7,8*20+8,8*20+9,8*20+10,8*20+11 99 | data 0 100 | 101 | sample: PROCEDURE 102 | asm NOP 103 | asm NOP 104 | END 105 | 106 | -------------------------------------------------------------------------------- /samples/title.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Animated title screen 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Jan/30/2014 6 | REM 7 | 8 | REM Include useful predefined constants 9 | INCLUDE "constants.bas" 10 | 11 | WAIT 12 | DEFINE DEF00,1,bitmaps0 13 | WAIT 14 | CLS 15 | PRINT COLOR CS_YELLOW 16 | PRINT AT SCREENPOS(4, 0),"\256\256\000\000\256\256\256\000\256\256\256" 17 | PRINT AT SCREENPOS(4, 1),"\256\000\256\000\000\256\000\000\256\000\000" 18 | PRINT AT SCREENPOS(4, 2),"\256\256\000\000\000\256\000\000\256\000\256" 19 | PRINT AT SCREENPOS(4, 3),"\256\000\256\000\000\256\000\000\256\000\256" 20 | PRINT AT SCREENPOS(4, 4),"\256\256\000\000\256\256\256\000\256\256\256" 21 | 22 | PRINT AT SCREENPOS(2, 5),"\256\256\256\000\256\256\256\000\256\000\256\000\256\256\256" 23 | PRINT AT SCREENPOS(2, 6),"\256\000\000\000\256\000\256\000\256\256\256\000\256\000\000" 24 | PRINT AT SCREENPOS(2, 7),"\256\000\256\000\256\256\256\000\256\256\256\000\256\256\000" 25 | PRINT AT SCREENPOS(2, 8),"\256\000\256\000\256\000\256\000\256\000\256\000\256\000\000" 26 | PRINT AT SCREENPOS(2, 9),"\256\256\256\000\256\000\256\000\256\000\256\000\256\256\256" 27 | loop: 28 | WAIT 29 | WAIT 30 | DEFINE DEF00,1,bitmaps1 31 | WAIT 32 | WAIT 33 | DEFINE DEF00,1,bitmaps2 34 | WAIT 35 | WAIT 36 | DEFINE DEF00,1,bitmaps3 37 | WAIT 38 | WAIT 39 | DEFINE DEF00,1,bitmaps0 40 | GOTO loop 41 | 42 | bitmaps0: 43 | BITMAP "XXXXXXX_" 44 | BITMAP "XXXXXXX_" 45 | BITMAP "XXXXXXX_" 46 | BITMAP "________" 47 | BITMAP "XXX_XXXX" 48 | BITMAP "XXX_XXXX" 49 | BITMAP "XXX_XXXX" 50 | BITMAP "________" 51 | 52 | bitmaps1: 53 | BITMAP "XXXXXXX_" 54 | BITMAP "________" 55 | BITMAP "XXX_XXXX" 56 | BITMAP "XXX_XXXX" 57 | BITMAP "XXX_XXXX" 58 | BITMAP "________" 59 | BITMAP "XXXXXXX_" 60 | BITMAP "XXXXXXX_" 61 | 62 | bitmaps2: 63 | BITMAP "XXX_XXXX" 64 | BITMAP "XXX_XXXX" 65 | BITMAP "XXX_XXXX" 66 | BITMAP "________" 67 | BITMAP "XXXXXXX_" 68 | BITMAP "XXXXXXX_" 69 | BITMAP "XXXXXXX_" 70 | BITMAP "________" 71 | 72 | bitmaps3: 73 | BITMAP "XXX_XXXX" 74 | BITMAP "________" 75 | BITMAP "XXXXXXX_" 76 | BITMAP "XXXXXXX_" 77 | BITMAP "XXXXXXX_" 78 | BITMAP "________" 79 | BITMAP "XXX_XXXX" 80 | BITMAP "XXX_XXXX" 81 | 82 | -------------------------------------------------------------------------------- /samples/voice.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Voice with Intellivoice 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org 5 | REM Nov/21/2014. 6 | REM Jul/11/2015. Voice improved by DZ-Jay 7 | REM Feb/05/2018. Shows how to stop voice. 8 | REM 9 | 10 | VOICE INIT 11 | 12 | FOR A=1 TO 100 13 | VOICE PLAY coins_detected 14 | FOR B=1 TO 100 15 | #backtab(0) = #backtab(0) + 1 16 | IF CONT.BUTTON THEN VOICE INIT 17 | WAIT 18 | NEXT B 19 | VOICE NUMBER A 20 | NEXT A 21 | 22 | loop: GOTO loop 23 | 24 | coins_detected: 25 | VOICE KK1,OY,NN1,SS,PA1,PA1 26 | VOICE DD2,IH,TT1,EH,KK1,TT1,EH,DD1,PA1,PA2 27 | VOICE IH,NN1,PA1,PA1 28 | VOICE PP,AO,KK2,EH,TT1,PA1,PA2,0 -------------------------------------------------------------------------------- /samples/woman.bas: -------------------------------------------------------------------------------- 1 | REM 2 | REM Scrolling of big image 3 | REM Demo for IntyBASIC 4 | REM by Oscar Toledo G. http://nanochess.org/ 5 | REM Feb/18/2015 6 | REM 7 | REM Woman bitmap is public domain taken for openclipart.org (nicubunu-Woman-silhouette-51) 8 | REM 9 | 10 | REM Include useful predefined constants 11 | INCLUDE "constants.bas" 12 | 13 | MODE SCREEN_FOREGROUND_BACKGROUND 14 | WAIT 15 | BORDER BORDER_BLACK,3 16 | WAIT 17 | DEFINE DEF00,16,screen_bitmaps_0 18 | WAIT 19 | DEFINE DEF16,16,screen_bitmaps_1 20 | WAIT 21 | DEFINE DEF32,16,screen_bitmaps_2 22 | WAIT 23 | DEFINE DEF48,15,screen_bitmaps_3 24 | WAIT 25 | SCREEN screen_cards,0,20,20,11 26 | offset_x = 0 27 | offset_y = 0 28 | offset_d = 0 29 | line=0 30 | WAIT 31 | 32 | loop: 33 | REM >>>> Scroll downward 34 | FOR time=1 to 48 35 | IF offset_y=0 THEN offset_d=4:offset_y=7 ELSE offset_y=offset_y-1 36 | SCROLL offset_x,offset_y,offset_d 37 | WAIT 38 | offset_d=0 39 | IF offset_y=7 THEN line=line+1:SCREEN screen_cards,(line+11)*BACKGROUND_COLUMNS,220,20,1 40 | NEXT time 41 | 42 | REM >>>> Scroll upward 43 | FOR time=1 TO 48 44 | IF offset_y=7 THEN offset_d=3:offset_y=0 ELSE offset_y=offset_y+1 45 | SCROLL offset_x,offset_y,offset_d 46 | WAIT 47 | offset_d=0 48 | IF offset_y=0 THEN line=line-1:SCREEN screen_cards,(line-1)*BACKGROUND_COLUMNS,0,20,1 49 | NEXT time 50 | 51 | GOTO loop 52 | 53 | ' 63 bitmaps 54 | screen_bitmaps_0: 55 | DATA $F8F8,$F0F8,$E0F0,$F0E0 56 | DATA $7FFF,$1F3F,$0F1F,$0707 57 | DATA $FEFF,$F8FC,$E0F0,$E0E0 58 | DATA $0080,$0000,$0000,$0000 59 | DATA $0103,$0000,$0000,$0000 60 | DATA $FFFF,$7FFF,$3F3F,$1F1F 61 | DATA $F0F0,$F8F8,$F8F8,$F8F8 62 | DATA $0707,$0707,$1F1F,$3F3F 63 | DATA $C0C0,$C0C0,$C0C0,$E0C0 64 | DATA $0F0F,$070F,$0307,$0303 65 | DATA $F0F0,$F0F0,$E0E0,$E0E0 66 | DATA $3F3F,$3F3F,$3F3F,$3F3F 67 | DATA $E0E0,$E0E0,$E0E0,$E0E0 68 | DATA $0101,$0001,$0000,$0000 69 | DATA $FFFF,$FFFF,$FFFF,$7F7F 70 | DATA $C0C0,$C0C0,$8080,$8080 71 | screen_bitmaps_1: 72 | DATA $7F7F,$3F3F,$3F3F,$3E3F 73 | DATA $FFFF,$FFFF,$F0FC,$00C0 74 | DATA $C0C0,$0080,$0000,$0000 75 | DATA $073F,$0001,$0000,$0000 76 | DATA $FFFF,$FFFF,$7F7F,$3F3F 77 | DATA $8080,$0000,$0000,$0000 78 | DATA $0030,$0000,$0000,$0000 79 | DATA $0000,$0000,$0000,$1000 80 | DATA $8000,$FFF0,$FFFF,$FFFF 81 | DATA $0000,$FF00,$FFFF,$FFFF 82 | DATA $0700,$FF7F,$FFFF,$FFFF 83 | DATA $F8F0,$F8F8,$F8F8,$F8F8 84 | DATA $F8F8,$F8F8,$F8F8,$F8F8 85 | DATA $3F3F,$3F3F,$1F3F,$1F1F 86 | DATA $FFFF,$FFFF,$FEFF,$F0F8 87 | DATA $F0F8,$C0E0,$0000,$0000 88 | screen_bitmaps_2: 89 | DATA $0000,$0000,$0101,$0101 90 | DATA $E040,$E0E0,$F0E0,$F8F0 91 | DATA $0F1F,$070F,$0707,$0303 92 | DATA $FFFF,$FFFF,$FEFF,$FEFE 93 | DATA $C0E0,$0080,$0000,$0000 94 | DATA $0101,$0301,$1F0F,$3F3F 95 | DATA $FCF8,$FEFC,$FFFF,$FFFF 96 | DATA $0101,$0001,$8000,$E0C0 97 | DATA $FFFF,$FFFF,$7FFF,$0000 98 | DATA $FFFF,$FFFF,$FFFF,$1FFF 99 | DATA $FCFC,$F8F8,$F0F8,$F0F0 100 | DATA $F8F0,$FEFC,$FFFF,$FFFF 101 | DATA $0000,$0003,$F000,$FFFE 102 | DATA $0307,$0303,$1F07,$FF7F 103 | DATA $F0F0,$F0F0,$F0F0,$F0F0 104 | DATA $3F3F,$3F3F,$1F1F,$1F1F 105 | screen_bitmaps_3: 106 | DATA $E0F0,$E0E0,$E0E0,$E0E0 107 | DATA $1F1F,$1F1F,$1F1F,$0F0F 108 | DATA $FCFC,$FEFE,$FFFF,$FFFF 109 | DATA $0000,$0000,$0000,$8000 110 | DATA $8000,$8080,$C080,$C0C0 111 | DATA $0F0F,$0F0F,$0F0F,$0707 112 | DATA $8080,$C080,$C0C0,$E0C0 113 | DATA $E0E0,$F0F0,$F8F0,$FCF8 114 | DATA $E0E0,$E0E0,$F0F0,$F0F0 115 | DATA $FCFC,$FEFE,$7F7F,$FF7F 116 | DATA $0707,$0303,$0303,$0303 117 | DATA $8080,$C0C0,$E0C0,$F0E0 118 | DATA $0103,$0001,$0000,$0000 119 | DATA $E0E0,$E0E0,$F0E0,$F0F0 120 | DATA $7F7F,$3F3F,$1F3F,$1F1F 121 | 122 | REM 20x18 cards 123 | screen_cards: 124 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 125 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 126 | DATA $2600,$2600,$2600,$2600,$0807,$080F,$2600,$0817,$081F,$0827 127 | DATA $082F,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 128 | DATA $2600,$2600,$2600,$2600,$0837,$083F,$2600,$0847,$0000,$0000 129 | DATA $084F,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 130 | DATA $2600,$2600,$2600,$2600,$0857,$085F,$2600,$0867,$0000,$0000 131 | DATA $086F,$0877,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 132 | DATA $2600,$2600,$2600,$2600,$087F,$0887,$088F,$0897,$0000,$0000 133 | DATA $0000,$089F,$08A7,$2600,$2600,$2600,$2600,$2600,$2600,$2600 134 | DATA $2600,$2600,$2600,$2600,$08AF,$08B7,$0000,$08BF,$0000,$0000 135 | DATA $0000,$0000,$085F,$2600,$2600,$2600,$2600,$2600,$2600,$2600 136 | DATA $2600,$2600,$2600,$2600,$08C7,$08CF,$08D7,$08DF,$0000,$0000 137 | DATA $0000,$0000,$085F,$2600,$2600,$2600,$2600,$2600,$2600,$2600 138 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$2600,$08E7,$0000,$0000 139 | DATA $0000,$0000,$08EF,$2600,$2600,$2600,$2600,$2600,$2600,$2600 140 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$08F7,$08FF,$0000,$0000 141 | DATA $0907,$090F,$0917,$2600,$2600,$2600,$2600,$2600,$2600,$2600 142 | DATA $2600,$2600,$2600,$2600,$2600,$091F,$0927,$0000,$0000,$0000 143 | DATA $092F,$0937,$093F,$0947,$094F,$2600,$2600,$2600,$2600,$2600 144 | DATA $2600,$2600,$2600,$2600,$2600,$0957,$0000,$0000,$0000,$0000 145 | DATA $085F,$2600,$095F,$0967,$096F,$2600,$2600,$2600,$2600,$2600 146 | DATA $2600,$2600,$2600,$2600,$2600,$0977,$0000,$0000,$0000,$0000 147 | DATA $097F,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 148 | DATA $2600,$2600,$2600,$2600,$2600,$0987,$0000,$0000,$0000,$0000 149 | DATA $098F,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 150 | DATA $2600,$2600,$2600,$2600,$2600,$0997,$099F,$0000,$09A7,$0000 151 | DATA $09AF,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 152 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$09B7,$0000,$09BF,$0000 153 | DATA $2EE0,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 154 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$09C7,$0000,$09CF,$099F 155 | DATA $09D7,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 156 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$0857,$0000,$2600,$09DF 157 | DATA $09E7,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 158 | DATA $2600,$2600,$2600,$2600,$2600,$2600,$09EF,$0000,$2600,$0837 159 | DATA $0000,$09F7,$2600,$2600,$2600,$2600,$2600,$2600,$2600,$2600 160 | -------------------------------------------------------------------------------- /samples/woman.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nanochess/IntyBASIC/606e128a7bb794c8a02e7650742dd60ca8e31434/samples/woman.bmp --------------------------------------------------------------------------------