├── .gitignore ├── zPET └── scripts │ ├── setup │ ├── assets.asm │ ├── loadModules.asm │ ├── upstart.asm │ ├── titleLoader.asm │ └── maploader.asm │ ├── vicesnd.ogg │ ├── vicesnd.wav │ ├── lookups │ ├── registers.asm │ ├── zeropage.asm │ ├── enemyData.asm │ ├── labels.asm │ ├── randomNumber.asm │ ├── vic.asm │ ├── monkeyData.asm │ ├── charConvert.asm │ └── charData.asm │ ├── bin │ ├── dkj_PET.prg │ ├── gamePET.prg │ ├── gamePET_BuildLog.txt │ └── gamePET_ViceLog.txt │ ├── ._gamePET copy.textClipping │ ├── gamePET copy.textClipping │ ├── modules │ ├── lives.asm │ ├── sound.asm │ ├── charDrawing.asm │ ├── pineapples.asm │ ├── score.asm │ └── cage.asm │ └── gamePET.asm ├── ._assets ├── ._scripts ├── ._.DS_Store ├── ._.gitignore ├── assets ├── char.bin ├── ._char.bin ├── ._map.bin ├── tiles.bin ├── ._colours.bin ├── ._sprites.bin ├── ._tiles.bin ├── sprites.bin ├── map.bin └── colours.bin ├── scripts ├── ._setup ├── ._lookups ├── ._game.asm ├── ._interrupts ├── lookups │ ├── ._sid.asm │ ├── ._vic.asm │ ├── ._labels.asm │ ├── ._zeropage.asm │ ├── ._registers.asm │ ├── ._spriteData.asm │ ├── ._enemySpriteData.asm │ ├── labels.asm │ ├── registers.asm │ ├── enemySpriteData.asm │ ├── zeropage.asm │ ├── spriteData.asm │ ├── sid.asm │ └── vic.asm ├── setup │ ├── ._assets.asm │ ├── ._macros.asm │ ├── ._maploader.asm │ ├── macros.asm │ ├── assets.asm │ └── maploader.asm ├── interrupts │ ├── ._cage.asm │ ├── ._irq.asm │ ├── ._key.asm │ ├── ._lives.asm │ ├── ._score.asm │ ├── ._enemies.asm │ ├── ._monkey.asm │ ├── ._pineapple.asm │ ├── lives.asm │ ├── score.asm │ ├── pineapple.asm │ ├── irq.asm │ ├── cage.asm │ └── key.asm └── game.asm ├── vic20 ├── assets │ ├── char.bin │ ├── chars.bmp │ ├── chars.png │ ├── charpad.ctm │ ├── ._colours.bin │ ├── title_char.bin │ ├── title_tiles.bin │ ├── colourchanger.xlsx │ ├── map.bin │ ├── title_map.bin │ ├── title_colours.bin │ ├── colours.bin │ └── tiles.bin └── scripts │ ├── bin │ ├── gameVIC.prg │ ├── gameVIC_BuildLog.txt │ └── gameVIC_ViceLog.txt │ ├── lookups │ ├── registers.asm │ ├── zeropage.asm │ ├── enemyData.asm │ ├── labels.asm │ ├── monkeyData.asm │ ├── charConvert.asm │ ├── vic.asm │ └── charData.asm │ ├── setup │ ├── loadModules.asm │ ├── assets.asm │ ├── upstart.asm │ ├── maploader.asm │ └── titleLoader.asm │ ├── modules │ ├── lives.asm │ ├── sound.asm │ ├── charDrawing.asm │ ├── pineapples.asm │ ├── score.asm │ ├── cage.asm │ └── key.asm │ └── gameVIC.asm ├── xPLUS_4 ├── assets │ ├── map.bin │ ├── ._char.bin │ ├── ._map.bin │ ├── char.bin │ ├── chars.bmp │ ├── chars.png │ ├── tiles.bin │ ├── ._tiles.bin │ ├── charpad.ctm │ ├── ._colours.bin │ ├── title_char.bin │ ├── title_tiles.bin │ ├── colourchanger.xlsx │ ├── title_colours.bin │ ├── title_map.bin │ └── colours.bin └── scripts │ ├── bin │ ├── plus4.prg │ ├── plus4_BuildLog.txt │ └── plus4_ViceLog.txt │ ├── lookups │ ├── registers.asm │ ├── zeropage.asm │ ├── enemyData.asm │ ├── labels.asm │ ├── monkeyData.asm │ ├── vic.asm │ ├── charConvert.asm │ └── charData.asm │ ├── setup │ ├── assets.asm │ ├── loadModules.asm │ ├── upstart.asm │ ├── maploader.asm │ └── titleLoader.asm │ ├── modules │ ├── lives.asm │ ├── charDrawing.asm │ ├── pineapples.asm │ ├── score.asm │ ├── sound.asm │ └── cage.asm │ └── plus4.asm └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | scripts/bin/ 3 | -------------------------------------------------------------------------------- /zPET/scripts/setup/assets.asm: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /._assets: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/._assets -------------------------------------------------------------------------------- /._scripts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/._scripts -------------------------------------------------------------------------------- /._.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/._.DS_Store -------------------------------------------------------------------------------- /._.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/._.gitignore -------------------------------------------------------------------------------- /assets/char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/char.bin -------------------------------------------------------------------------------- /scripts/._setup: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/._setup -------------------------------------------------------------------------------- /assets/._char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/._char.bin -------------------------------------------------------------------------------- /assets/._map.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/._map.bin -------------------------------------------------------------------------------- /assets/tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/tiles.bin -------------------------------------------------------------------------------- /scripts/._lookups: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/._lookups -------------------------------------------------------------------------------- /assets/._colours.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/._colours.bin -------------------------------------------------------------------------------- /assets/._sprites.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/._sprites.bin -------------------------------------------------------------------------------- /assets/._tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/._tiles.bin -------------------------------------------------------------------------------- /assets/sprites.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/assets/sprites.bin -------------------------------------------------------------------------------- /scripts/._game.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/._game.asm -------------------------------------------------------------------------------- /scripts/._interrupts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/._interrupts -------------------------------------------------------------------------------- /vic20/assets/char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/char.bin -------------------------------------------------------------------------------- /vic20/assets/chars.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/chars.bmp -------------------------------------------------------------------------------- /vic20/assets/chars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/chars.png -------------------------------------------------------------------------------- /xPLUS_4/assets/map.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/map.bin -------------------------------------------------------------------------------- /scripts/lookups/._sid.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._sid.asm -------------------------------------------------------------------------------- /scripts/lookups/._vic.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._vic.asm -------------------------------------------------------------------------------- /vic20/assets/charpad.ctm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/charpad.ctm -------------------------------------------------------------------------------- /xPLUS_4/assets/._char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/._char.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/._map.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/._map.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/char.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/chars.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/chars.bmp -------------------------------------------------------------------------------- /xPLUS_4/assets/chars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/chars.png -------------------------------------------------------------------------------- /xPLUS_4/assets/tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/tiles.bin -------------------------------------------------------------------------------- /zPET/scripts/vicesnd.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/vicesnd.ogg -------------------------------------------------------------------------------- /zPET/scripts/vicesnd.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/vicesnd.wav -------------------------------------------------------------------------------- /scripts/setup/._assets.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/setup/._assets.asm -------------------------------------------------------------------------------- /scripts/setup/._macros.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/setup/._macros.asm -------------------------------------------------------------------------------- /vic20/assets/._colours.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/._colours.bin -------------------------------------------------------------------------------- /vic20/assets/title_char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/title_char.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/._tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/._tiles.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/charpad.ctm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/charpad.ctm -------------------------------------------------------------------------------- /zPET/scripts/lookups/registers.asm: -------------------------------------------------------------------------------- 1 | REGISTERS:{ 2 | 3 | .label JOY_PORT_1 = $FF08 4 | .label JOY_PORT_2 = $9120 5 | } -------------------------------------------------------------------------------- /scripts/interrupts/._cage.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._cage.asm -------------------------------------------------------------------------------- /scripts/interrupts/._irq.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._irq.asm -------------------------------------------------------------------------------- /scripts/interrupts/._key.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._key.asm -------------------------------------------------------------------------------- /scripts/interrupts/._lives.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._lives.asm -------------------------------------------------------------------------------- /scripts/interrupts/._score.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._score.asm -------------------------------------------------------------------------------- /scripts/lookups/._labels.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._labels.asm -------------------------------------------------------------------------------- /scripts/lookups/._zeropage.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._zeropage.asm -------------------------------------------------------------------------------- /scripts/setup/._maploader.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/setup/._maploader.asm -------------------------------------------------------------------------------- /vic20/assets/title_tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/title_tiles.bin -------------------------------------------------------------------------------- /vic20/scripts/bin/gameVIC.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/scripts/bin/gameVIC.prg -------------------------------------------------------------------------------- /xPLUS_4/assets/._colours.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/._colours.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/title_char.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/title_char.bin -------------------------------------------------------------------------------- /xPLUS_4/assets/title_tiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/title_tiles.bin -------------------------------------------------------------------------------- /xPLUS_4/scripts/bin/plus4.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/scripts/bin/plus4.prg -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/registers.asm: -------------------------------------------------------------------------------- 1 | REGISTERS:{ 2 | 3 | .label JOY_PORT_1 = $FF08 4 | .label JOY_PORT_2 = $9120 5 | } -------------------------------------------------------------------------------- /zPET/scripts/bin/dkj_PET.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/bin/dkj_PET.prg -------------------------------------------------------------------------------- /zPET/scripts/bin/gamePET.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/bin/gamePET.prg -------------------------------------------------------------------------------- /scripts/interrupts/._enemies.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._enemies.asm -------------------------------------------------------------------------------- /scripts/interrupts/._monkey.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._monkey.asm -------------------------------------------------------------------------------- /scripts/lookups/._registers.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._registers.asm -------------------------------------------------------------------------------- /scripts/lookups/._spriteData.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._spriteData.asm -------------------------------------------------------------------------------- /vic20/assets/colourchanger.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/vic20/assets/colourchanger.xlsx -------------------------------------------------------------------------------- /vic20/scripts/lookups/registers.asm: -------------------------------------------------------------------------------- 1 | REGISTERS:{ 2 | 3 | .label JOY_PORT_UDLF = $9111 4 | .label JOY_PORT_RIGHT = $9120 5 | } -------------------------------------------------------------------------------- /scripts/interrupts/._pineapple.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/interrupts/._pineapple.asm -------------------------------------------------------------------------------- /xPLUS_4/assets/colourchanger.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/xPLUS_4/assets/colourchanger.xlsx -------------------------------------------------------------------------------- /scripts/lookups/._enemySpriteData.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/scripts/lookups/._enemySpriteData.asm -------------------------------------------------------------------------------- /vic20/scripts/lookups/zeropage.asm: -------------------------------------------------------------------------------- 1 | 2 | *=$fb "Temp vars zero page" virtual 3 | 4 | VECTOR1: .word $00 5 | VECTOR2: .word $00 6 | 7 | -------------------------------------------------------------------------------- /vic20/assets/map.bin: -------------------------------------------------------------------------------- 1 |  2 |    ! "#$%&'()* + ,,-./ 01203456789:;<=>?@ ABCDBEFGHIJKLMKNOPQMRSTUVTUVTUWX -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/zeropage.asm: -------------------------------------------------------------------------------- 1 | 2 | *=$d0 "Temp vars zero page" virtual 3 | 4 | VECTOR1: .word $00 5 | VECTOR2: .word $00 6 | 7 | -------------------------------------------------------------------------------- /zPET/scripts/._gamePET copy.textClipping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/._gamePET copy.textClipping -------------------------------------------------------------------------------- /zPET/scripts/gamePET copy.textClipping: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1888games/Donkey-Kong-Junior-C64/HEAD/zPET/scripts/gamePET copy.textClipping -------------------------------------------------------------------------------- /vic20/assets/title_map.bin: -------------------------------------------------------------------------------- 1 |  2 |       !"#$%  &'()*+  ,-./01  234567  89:;<=  3 | >?@ABC DEFGGGGGHEI -------------------------------------------------------------------------------- /zPET/scripts/lookups/zeropage.asm: -------------------------------------------------------------------------------- 1 | 2 | *=$d0 "Temp vars zero page" virtual 3 | 4 | VECTOR1: .word $00 5 | VECTOR2: .word $00 6 | VECTOR3: .word $00 7 | 8 | -------------------------------------------------------------------------------- /vic20/assets/title_colours.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /xPLUS_4/assets/title_colours.bin: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /assets/map.bin: -------------------------------------------------------------------------------- 1 |   2 |  3 |  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR 4 | FSTUVWXYZ[\]^_`abcdefghijklmmmmmmmmmmmmmmmm -------------------------------------------------------------------------------- /scripts/setup/macros.asm: -------------------------------------------------------------------------------- 1 | .macro StoreState() { 2 | 3 | pha // A 4 | txa 5 | pha // X 6 | tya 7 | pha // Y 8 | 9 | } 10 | 11 | .macro RestoreState() { 12 | 13 | pla // Y 14 | tay 15 | pla // X 16 | tax 17 | pla // A 18 | 19 | } -------------------------------------------------------------------------------- /vic20/assets/colours.bin: -------------------------------------------------------------------------------- 1 |   2 |   3 | 4 | 5 | 6 |  7 | 8 | 9 | 10 | 11 | 12 | 13 |  14 | 15 | 16 |  17 | 18 | 19 | 20 |    21 | 22 | 23 | 24 |  25 |  -------------------------------------------------------------------------------- /xPLUS_4/assets/title_map.bin: -------------------------------------------------------------------------------- 1 |  2 |  !"#$%&'()*+,-./0123456789:;<=> ?@ABCDEFGGGGHIIIIIIGGGGGFJ -------------------------------------------------------------------------------- /scripts/lookups/labels.asm: -------------------------------------------------------------------------------- 1 | 2 | .label ZERO= 0 3 | .label ALL_ON = 255 4 | .label ONE=1 5 | .label JOY_UP = %00001 6 | .label JOY_DOWN = %00010 7 | .label JOY_LEFT = %00100 8 | .label JOY_RIGHT = %01000 9 | .label JOY_FIRE = %10000 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /scripts/lookups/registers.asm: -------------------------------------------------------------------------------- 1 | REGISTERS:{ 2 | 3 | .label PROCESSOR_PORT = $01 4 | .label RASTER_INTERRUPT_VECTOR = $fffe 5 | .label JOY_PORT_2 = $dc00 6 | 7 | 8 | BankOutKernalAndBasic:{ 9 | 10 | lda REGISTERS.PROCESSOR_PORT 11 | and #%11111000 12 | ora #%00000101 13 | sta REGISTERS.PROCESSOR_PORT 14 | rts 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /vic20/assets/tiles.bin: -------------------------------------------------------------------------------- 1 | :,7++vwuwxydu tKJnL mklDCBA 2 | 5b`i ;!"#$_ajWZXY]^[\V&U'+/><=()< %*dVP/-.g0h0MN1FOHMPiNFSTQRPNFOPQRE@efEV24'34WX>;V6<'i=6V'=>W;=X>5s'GU+@ZYEUU+EZY@r+7dcOPSTPiOPST89<=?M>QR<;QR<=?:;< -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Donkey-Kong-Junior-C64 and VIC20 2 | C64 port of the Game & Watch version of Donkey Kong Junior. 3 | 4 | This is my first game written in Assembler. 5 | 6 | Written in 6502 ASM using KickAssembler with Sublime Text. 7 | CharPad and SpritePad for graphics conversion & export. 8 | 9 | Now includes code for the VIC20, C16, C116 and Plus/4 compatible versions. 10 | 11 | 12 | -------------------------------------------------------------------------------- /xPLUS_4/assets/colours.bin: -------------------------------------------------------------------------------- 1 |   2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |  15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |  24 | 25 | 26 | 27 | 28 | 29 |  30 | 31 | 32 | 33 | 34 |  -------------------------------------------------------------------------------- /vic20/scripts/lookups/enemyData.asm: -------------------------------------------------------------------------------- 1 | ENEMY_SPRITEDATA:{ 2 | 3 | Rows: 4 | .byte 2, 2, 2, 2, 2, 2 5 | .byte 2, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 0, 0, 0, 0, 0, 0 7 | 8 | DeleteUponLanding: 9 | .byte 0, 0, 0, 0, 0, 0 10 | .byte 1, 1, 1, 0, 0, 0, 0, 0 11 | .byte 1, 1, 1, 1, 1, 0, 0 12 | 13 | HitMonkeyCell: 14 | .byte 99, 14, 15, 16, 17, 99 15 | .byte 99, 6, 7, 8, 9, 10, 11, 99 16 | .byte 99, 0, 1, 2, 3, 4, 5 17 | 18 | 19 | 20 | 21 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/enemyData.asm: -------------------------------------------------------------------------------- 1 | ENEMY_SPRITEDATA:{ 2 | 3 | Rows: 4 | .byte 2, 2, 2, 2, 2, 2 5 | .byte 2, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 0, 0, 0, 0, 0, 0 7 | 8 | DeleteUponLanding: 9 | .byte 0, 0, 0, 0, 0, 0 10 | .byte 1, 1, 1, 0, 0, 0, 0, 0 11 | .byte 1, 1, 1, 1, 1, 0, 0 12 | 13 | HitMonkeyCell: 14 | .byte 99, 14, 15, 16, 17, 99 15 | .byte 99, 6, 7, 8, 9, 10, 11, 99 16 | .byte 99, 0, 1, 2, 3, 4, 5 17 | 18 | 19 | 20 | 21 | } -------------------------------------------------------------------------------- /zPET/scripts/lookups/enemyData.asm: -------------------------------------------------------------------------------- 1 | ENEMY_SPRITEDATA:{ 2 | 3 | Rows: 4 | .byte 2, 2, 2, 2, 2, 2 5 | .byte 2, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 0, 0, 0, 0, 0, 0 7 | 8 | DeleteUponLanding: 9 | .byte 0, 0, 0, 0, 0, 0 10 | .byte 1, 1, 1, 0, 0, 0, 0, 0 11 | .byte 1, 1, 1, 1, 1, 0, 0 12 | 13 | HitMonkeyCell: 14 | .byte 99, 14, 15, 16, 17, 99 15 | .byte 99, 6, 7, 8, 9, 10, 11, 99 16 | .byte 99, 0, 1, 2, 3, 4, 5 17 | 18 | 19 | 20 | 21 | } -------------------------------------------------------------------------------- /zPET/scripts/bin/gamePET_BuildLog.txt: -------------------------------------------------------------------------------- 1 | parsing 2 | flex pass 1 3 | flex pass 2 4 | Output pass 5 | Writing prg file: C:\C64\DKJ\zPET\scripts\bin\gamePET.prg 6 | 7 | Memory Map 8 | ---------- 9 | Default-segment: 10 | *$00d0-$00d5 Temp vars zero page 11 | $0400-$042d BASIC Stub 12 | $042e-$0585 Entry 13 | $0600-$1ca6 SCREEN_DATA 14 | $1d00-$20a2 Code1 15 | 16 | Writing Vice symbol file: C:\C64\DKJ\zPET\scripts\bin\gamePET.vs 17 | Writing Symbol file: gamePET.sym 18 | -------------------------------------------------------------------------------- /vic20/scripts/bin/gameVIC_BuildLog.txt: -------------------------------------------------------------------------------- 1 | parsing 2 | flex pass 1 3 | flex pass 2 4 | Output pass 5 | Writing prg file: C:\C64\DKJ\vic20\scripts\bin\gameVIC.prg 6 | 7 | Memory Map 8 | ---------- 9 | Default-segment: 10 | *$00fb-$00fe Temp vars zero page 11 | $1200-$122d BASIC Stub 12 | $122e-$1383 Entry 13 | $1400-$189f Title Charset 14 | $1c00-$1fdf Charset 15 | $2000-$3216 Unnamed 16 | $4000-$448d Screen data 17 | 18 | Writing Vice symbol file: C:\C64\DKJ\vic20\scripts\bin\gameVIC.vs 19 | Writing Symbol file: gameVIC.sym 20 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/bin/plus4_BuildLog.txt: -------------------------------------------------------------------------------- 1 | parsing 2 | flex pass 1 3 | flex pass 2 4 | Output pass 5 | Writing prg file: C:\C64\DKJ\xPLUS_4\scripts\bin\plus4.prg 6 | 7 | Memory Map 8 | ---------- 9 | Default-segment: 10 | *$00d0-$00d3 Temp vars zero page 11 | $1000-$102d BASIC Stub 12 | $102e-$119f Entry 13 | $1200-$176b Code1 14 | $1800-$1c8f Title Charset 15 | $2000-$26ef Charset 16 | $2700-$2db3 Screen data 17 | $2e00-$39bb Unnamed 18 | 19 | Writing Vice symbol file: C:\C64\DKJ\xPLUS_4\scripts\bin\plus4.vs 20 | Writing Symbol file: plus4.sym 21 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/setup/assets.asm: -------------------------------------------------------------------------------- 1 | 2 | * = $2000 "Charset" 3 | CHAR_SET: .import binary "../assets/char.bin" //roll 12! 4 | 5 | * = $2700 "Screen data" 6 | CHAR_COLORS: .import binary "../assets/colours.bin" 7 | MAP_TILES: .import binary "../assets/tiles.bin" 8 | MAP: .import binary "../assets/map.bin" 9 | 10 | TITLE_CHAR_COLORS: .import binary "../assets/title_colours.bin" 11 | TITLE_MAP_TILES: .import binary "../assets/title_tiles.bin" 12 | TITLE_MAP: .import binary "../assets/title_map.bin" 13 | 14 | * = $1800 "Title Charset" 15 | TITLE_CHAR_SET: .import binary "../assets/title_char.bin" 16 | 17 | 18 | 19 | //* = $1400 "Title Charset" 20 | //roll 12! 21 | -------------------------------------------------------------------------------- /vic20/scripts/setup/loadModules.asm: -------------------------------------------------------------------------------- 1 | #import "lookups/charData.asm" 2 | #import "lookups/charConvert.asm" 3 | #import "lookups/labels.asm" 4 | #import "lookups/vic.asm" 5 | #import "lookups/registers.asm" 6 | 7 | // #import "setup/macros.asm" 8 | #import "setup/maploader.asm" 9 | #import "setup/titleloader.asm" 10 | #import "modules/monkey.asm" 11 | #import "lookups/monkeyData.asm" 12 | #import "modules/enemies.asm" 13 | #import "lookups/enemyData.asm" 14 | #import "modules/key.asm" 15 | #import "modules/cage.asm" 16 | #import "modules/pineapples.asm" 17 | #import "modules/score.asm" 18 | #import "modules/lives.asm" 19 | #import "modules/charDrawing.asm" 20 | #import "modules/sound.asm" 21 | 22 | -------------------------------------------------------------------------------- /assets/colours.bin: -------------------------------------------------------------------------------- 1 | 2 |      3 | 4 |  5 | 6 |   7 | 8 | 9 | 10 | 11 | 12 |  13 | 14 | 15 | 16 |  17 |  18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |  27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |    39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |   48 | 49 |  50 |   51 | 52 | 53 |  54 |  55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |   71 | 72 |     73 |   74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |  96 | 97 | 98 | 99 |  -------------------------------------------------------------------------------- /vic20/scripts/setup/assets.asm: -------------------------------------------------------------------------------- 1 | 2 | * = $1C00 "Charset" 3 | CHAR_SET: 4 | .import binary "../assets/char.bin" //roll 12! 5 | 6 | * = $4000 "Screen data" 7 | 8 | CHAR_COLORS: 9 | .import binary "../assets/colours.bin" 10 | 11 | MAP_TILES: 12 | .import binary "../assets/tiles.bin" 13 | 14 | MAP: 15 | .import binary "../assets/map.bin" 16 | 17 | TITLE_CHAR_COLORS: 18 | .import binary "../assets/title_colours.bin" 19 | 20 | TITLE_MAP_TILES: 21 | .import binary "../assets/title_tiles.bin" 22 | 23 | TITLE_MAP: 24 | .import binary "../assets/title_map.bin" 25 | 26 | 27 | 28 | * = $1400 "Title Charset" 29 | TITLE_CHAR_SET: 30 | .import binary "../assets/title_char.bin" //roll 12! 31 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/setup/loadModules.asm: -------------------------------------------------------------------------------- 1 | #import "lookups/charData.asm" 2 | //#import "lookups/charConvert.asm" 3 | #import "lookups/labels.asm" 4 | #import "lookups/vic.asm" 5 | #import "lookups/registers.asm" 6 | 7 | // #import "setup/macros.asm" 8 | #import "setup/maploader.asm" 9 | #import "setup/titleloader.asm" 10 | 11 | 12 | 13 | *= $2e00 14 | 15 | 16 | 17 | #import "modules/monkey.asm" 18 | #import "lookups/monkeyData.asm" 19 | #import "modules/enemies.asm" 20 | #import "lookups/enemyData.asm" 21 | 22 | 23 | 24 | #import "modules/key.asm" 25 | #import "modules/cage.asm" 26 | 27 | 28 | 29 | #import "modules/pineapples.asm" 30 | 31 | 32 | #import "modules/score.asm" 33 | #import "modules/lives.asm" 34 | #import "modules/charDrawing.asm" 35 | #import "modules/sound.asm" 36 | 37 | -------------------------------------------------------------------------------- /zPET/scripts/setup/loadModules.asm: -------------------------------------------------------------------------------- 1 | #import "lookups/charData.asm" 2 | //#import "lookups/charConvert.asm" 3 | 4 | #import "lookups/labels.asm" 5 | #import "lookups/vic.asm" 6 | #import "lookups/registers.asm" 7 | #import "lookups/screenData.asm" 8 | 9 | #import "lookups/randomNumber.asm" 10 | #import "setup/maploader.asm" 11 | #import "setup/titleloader.asm" 12 | 13 | 14 | 15 | #import "modules/monkey.asm" 16 | #import "lookups/monkeyData.asm" 17 | 18 | 19 | 20 | 21 | #import "modules/enemies.asm" 22 | #import "lookups/enemyData.asm" 23 | 24 | 25 | 26 | #import "modules/key.asm" 27 | #import "modules/cage.asm" 28 | 29 | 30 | #import "modules/pineapples.asm" 31 | 32 | 33 | #import "modules/score.asm" 34 | #import "modules/lives.asm" 35 | #import "modules/charDrawing.asm" 36 | #import "modules/sound.asm" 37 | 38 | -------------------------------------------------------------------------------- /vic20/scripts/lookups/labels.asm: -------------------------------------------------------------------------------- 1 | .label ZERO= 0 2 | .label ALL_ON = 255 3 | .label ONE=1 4 | 5 | .label JOY_UP = %00000100 6 | .label JOY_DOWN = %00001000 7 | .label JOY_LEFT = %00010000 8 | .label JOY_RIGHT = %10000000 9 | .label JOY_FIRE = %00100000 10 | 11 | TEMP1: .byte $00 12 | TEMP2: .byte $00 13 | TEMP3: .byte $00 14 | TEMP4: .byte $00 15 | TEMP5: .byte $00 16 | TEMP6: .byte $00 17 | TEMP7: .byte $00 18 | TEMP8: .byte $00 19 | TEMP9: .byte $00 20 | TEMP10: .byte $00 21 | 22 | ZP_COUNTER: .byte $00 23 | ZP_ODD_EVEN: .byte $00 24 | 25 | JOY_ZP1: .byte $00 26 | JOY_ZP2: .byte $00 27 | JOY_RIGHT_LAST: .byte $00 28 | JOY_LEFT_LAST: .byte $00 29 | JOY_DOWN_LAST: .byte $00 30 | JOY_UP_LAST: .byte $00 31 | JOY_FIRE_LAST: .byte $00 32 | JOY_RIGHT_NOW: .byte $00 33 | JOY_LEFT_NOW: .byte $00 34 | JOY_DOWN_NOW: .byte $00 35 | JOY_UP_NOW: .byte $00 36 | JOY_FIRE_NOW: .byte $00 37 | 38 | 39 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/labels.asm: -------------------------------------------------------------------------------- 1 | .label ZERO= 0 2 | .label ALL_ON = 255 3 | .label ONE=1 4 | 5 | .label JOY_UP = %00000001 6 | .label JOY_DOWN = %00000010 7 | .label JOY_LEFT = %00000100 8 | .label JOY_RIGHT = %00001000 9 | .label JOY_FIRE = %01000000 10 | 11 | TEMP1: .byte $00 12 | TEMP2: .byte $00 13 | TEMP3: .byte $00 14 | TEMP4: .byte $00 15 | TEMP5: .byte $00 16 | TEMP6: .byte $00 17 | TEMP7: .byte $00 18 | TEMP8: .byte $00 19 | TEMP9: .byte $00 20 | TEMP10: .byte $00 21 | 22 | ZP_COUNTER: .byte $00 23 | ZP_ODD_EVEN: .byte $00 24 | 25 | JOY_ZP1: .byte $00 26 | JOY_ZP2: .byte $00 27 | JOY_RIGHT_LAST: .byte $00 28 | JOY_LEFT_LAST: .byte $00 29 | JOY_DOWN_LAST: .byte $00 30 | JOY_UP_LAST: .byte $00 31 | JOY_FIRE_LAST: .byte $00 32 | JOY_RIGHT_NOW: .byte $00 33 | JOY_LEFT_NOW: .byte $00 34 | JOY_DOWN_NOW: .byte $00 35 | JOY_UP_NOW: .byte $00 36 | JOY_FIRE_NOW: .byte $00 37 | 38 | 39 | -------------------------------------------------------------------------------- /zPET/scripts/lookups/labels.asm: -------------------------------------------------------------------------------- 1 | .label ZERO= 0 2 | .label ALL_ON = 255 3 | .label ONE=1 4 | 5 | .label JOY_UP = %00000001 6 | .label JOY_DOWN = %00000010 7 | .label JOY_LEFT = %00000100 8 | .label JOY_RIGHT = %00001000 9 | .label JOY_FIRE = %01000000 10 | 11 | TEMP1: .byte $00 12 | TEMP2: .byte $00 13 | TEMP3: .byte $00 14 | TEMP4: .byte $00 15 | TEMP5: .byte $00 16 | TEMP6: .byte $00 17 | TEMP7: .byte $00 18 | TEMP8: .byte $00 19 | TEMP9: .byte $00 20 | TEMP10: .byte $00 21 | 22 | ZP_COUNTER: .byte $00 23 | ZP_ODD_EVEN: .byte $00 24 | 25 | JOY_ZP1: .byte $00 26 | JOY_ZP2: .byte $00 27 | JOY_RIGHT_LAST: .byte $00 28 | JOY_LEFT_LAST: .byte $00 29 | JOY_DOWN_LAST: .byte $00 30 | JOY_UP_LAST: .byte $00 31 | JOY_FIRE_LAST: .byte $00 32 | JOY_RIGHT_NOW: .byte $00 33 | JOY_LEFT_NOW: .byte $00 34 | JOY_DOWN_NOW: .byte $00 35 | JOY_UP_NOW: .byte $00 36 | JOY_FIRE_NOW: .byte $00 37 | JOY_JUMP_KEY: .byte $00 38 | 39 | 40 | -------------------------------------------------------------------------------- /scripts/setup/assets.asm: -------------------------------------------------------------------------------- 1 | /* 2 | $c000 - $c3ff Screen 3 | $c400 - $cfff 48 sprites 4 | $d000 - $efff 128 Sprites 5 | $f000 - $f7ff 1 charset 6 | $f800 - $fffd 15 sprites 7 | */ 8 | 9 | .label SCREEN_RAM = $c000 10 | .label SPRITE_POINTERS = SCREEN_RAM + $3f8 11 | 12 | 13 | 14 | 15 | // * = $c400 "Enemy Sprites" //Start at frame #16 16 | // .import binary "../../assets/sprites/enemy_sprites.bin" 17 | 18 | * = $d000 "Sprites" //Start at frame #64 19 | 20 | SPRITES: 21 | .import binary "../assets/sprites.bin" 22 | 23 | * = $8000 "Screen data" 24 | 25 | MAP_TILES: 26 | .import binary "../assets/tiles.bin" 27 | 28 | CHAR_COLORS: 29 | .import binary "../assets/colours.bin" 30 | 31 | MAP: 32 | .import binary "../assets/map.bin" 33 | 34 | // HUD_DATA: 35 | // .import binary "../../assets/maps/hud.bin" 36 | 37 | * = $f000 "Charset" 38 | CHAR_SET: 39 | .import binary "../assets/char.bin" //roll 12! 40 | 41 | -------------------------------------------------------------------------------- /scripts/lookups/enemySpriteData.asm: -------------------------------------------------------------------------------- 1 | ENEMY_SPRITEDATA:{ 2 | 3 | Rows: 4 | .byte 2, 2, 2, 2, 2, 2 5 | .byte 2, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 0, 0, 0, 0, 0, 0 7 | 8 | DeleteUponLanding: 9 | .byte 0, 0, 0, 0, 0, 0 10 | .byte 1, 1, 1, 0, 0, 0, 0, 0 11 | .byte 1, 1, 1, 1, 1, 0, 0 12 | 13 | HitMonkeyCell: 14 | .byte 99, 14, 15, 16, 17, 99 15 | .byte 99, 6, 7, 8, 9, 10, 11, 99 16 | .byte 99, 0, 1, 2, 3, 4, 5 17 | 18 | Frames: 19 | .byte 96, 98, 97, 99, 59, 66 20 | .byte 82, 81, 80, 65, 69, 50, 68, 51 21 | .byte 67, 36, 37, 20, 83, 63, 6 22 | 23 | XPosMSB: 24 | .byte 0, 0, 0, 0, 0, 1 25 | .byte 0, 0, 0, 0, 0, 0, 0, 1 26 | .byte 0, 0, 0, 0, 0, 0, 1 27 | 28 | XPosLSB: 29 | .byte 108, 134, 170, 212, 246, 25 // row 2 30 | .byte 62, 73, 109, 142, 177, 210, 245, 27 // row 1 31 | .byte 74, 107, 141, 173, 210, 245, 22 // row 0 32 | 33 | YPos: 34 | .byte 140, 140, 140, 140, 140, 143 35 | .byte 144, 171, 169, 177, 177, 174, 171,169 36 | .byte 209, 209, 209, 209, 209, 209, 207 37 | 38 | 39 | 40 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/lives.asm: -------------------------------------------------------------------------------- 1 | LIVES:{ 2 | 3 | 4 | Value: .byte 3, 3 5 | 6 | .label HeartCharacter = 83 7 | .label BlankCharacter = 32 8 | 9 | .label StartCharacterPosition = VIC.SCREEN_RAM + 229 10 | 11 | 12 | Reset:{ 13 | 14 | lda Value + 1 15 | sta Value 16 | 17 | jsr Draw 18 | 19 | rts 20 | } 21 | 22 | 23 | 24 | LoseLife: { 25 | 26 | dec Value 27 | jsr Draw 28 | rts 29 | } 30 | 31 | Draw:{ 32 | 33 | .label LivesLeft = TEMP1 34 | 35 | clc 36 | lda Value 37 | sta LivesLeft 38 | ldx #3 39 | 40 | //sta $d020 41 | 42 | 43 | Loop: 44 | 45 | 46 | clc 47 | cpx LivesLeft 48 | 49 | beq DrawHeart 50 | jmp DrawBlank 51 | 52 | DrawHeart: 53 | 54 | lda #HeartCharacter 55 | sta StartCharacterPosition, x 56 | lda #RED 57 | //sta StartColourPosition, x 58 | dec LivesLeft 59 | jmp EndLoop 60 | 61 | 62 | DrawBlank: 63 | 64 | lda #BlankCharacter 65 | sta StartCharacterPosition, x 66 | //inc $d020 67 | 68 | 69 | EndLoop: 70 | 71 | dex 72 | cpx #ZERO 73 | bne Loop 74 | rts 75 | 76 | 77 | 78 | } 79 | } -------------------------------------------------------------------------------- /scripts/lookups/zeropage.asm: -------------------------------------------------------------------------------- 1 | *=$02 "Temp vars zero page" virtual 2 | 3 | TEMP1: .byte $00 4 | TEMP2: .byte $00 5 | TEMP3: .byte $00 6 | TEMP4: .byte $00 7 | TEMP5: .byte $00 8 | TEMP6: .byte $00 9 | TEMP7: .byte $00 10 | TEMP8: .byte $00 11 | TEMP9: .byte $00 12 | TEMP10: .byte $00 13 | 14 | VECTOR1: .word $00 15 | VECTOR2: .word $00 16 | VECTOR3: .word $00 17 | VECTOR4: .word $00 18 | VECTOR5: .word $00 19 | VECTOR6: .word $00 20 | 21 | IRQ_ADDRESS: .word $00 22 | 23 | IRQ_TEMP1: .byte $00 24 | 25 | 26 | COLLISION_X1: .byte $00 27 | COLLISION_X2: .byte $00 28 | COLLISION_Y1: .byte $00 29 | COLLISION_Y2: .byte $00 30 | 31 | ZP_COUNTER: .byte $00 32 | 33 | 34 | JOY_ZP1: .byte $00 35 | JOY_ZP2: .byte $00 36 | JOY_RIGHT_LAST: .byte $00 37 | JOY_LEFT_LAST: .byte $00 38 | JOY_DOWN_LAST: .byte $00 39 | JOY_UP_LAST: .byte $00 40 | JOY_FIRE_LAST: .byte $00 41 | JOY_RIGHT_NOW: .byte $00 42 | JOY_LEFT_NOW: .byte $00 43 | JOY_DOWN_NOW: .byte $00 44 | JOY_UP_NOW: .byte $00 45 | JOY_FIRE_NOW: .byte $00 46 | 47 | 48 | .label MAX_SPRITES = 8 49 | SPRITE_SCREEN_ROW: .fill MAX_SPRITES * 2, $00 50 | SPRITE_SCREEN_X: .fill MAX_SPRITES, $00 51 | -------------------------------------------------------------------------------- /scripts/interrupts/lives.asm: -------------------------------------------------------------------------------- 1 | LIVES:{ 2 | 3 | 4 | Value: .byte 3, 3 5 | 6 | .label HeartCharacter = 249 7 | .label BlankCharacter = 0 8 | 9 | .label StartCharacterPosition = SCREEN_RAM + 142 10 | .label StartColourPosition = VIC.COLOR_RAM + 142 11 | 12 | 13 | 14 | 15 | 16 | Reset:{ 17 | 18 | lda Value + 1 19 | sta Value 20 | 21 | jsr Draw 22 | 23 | rts 24 | } 25 | 26 | 27 | 28 | LoseLife: { 29 | 30 | dec Value 31 | jsr Draw 32 | rts 33 | } 34 | 35 | Draw:{ 36 | 37 | .label LivesLeft = TEMP1 38 | 39 | clc 40 | lda Value 41 | sta LivesLeft 42 | ldx #3 43 | 44 | //sta $d020 45 | 46 | 47 | Loop: 48 | 49 | 50 | clc 51 | cpx LivesLeft 52 | 53 | beq DrawHeart 54 | jmp DrawBlank 55 | 56 | DrawHeart: 57 | 58 | lda #HeartCharacter 59 | sta StartCharacterPosition, x 60 | lda #RED 61 | sta StartColourPosition, x 62 | dec LivesLeft 63 | jmp EndLoop 64 | 65 | 66 | DrawBlank: 67 | 68 | lda #BlankCharacter 69 | sta StartCharacterPosition, x 70 | //inc $d020 71 | 72 | 73 | EndLoop: 74 | 75 | dex 76 | cpx #ZERO 77 | bne Loop 78 | rts 79 | 80 | 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/lives.asm: -------------------------------------------------------------------------------- 1 | LIVES:{ 2 | 3 | 4 | Value: .byte 3, 3 5 | 6 | .label HeartCharacter = 111 7 | .label BlankCharacter = 0 8 | 9 | .label StartCharacterPosition = VIC.SCREEN_RAM + 61 10 | .label StartColourPosition = VIC.COLOR_RAM + 61 11 | 12 | 13 | 14 | 15 | 16 | Reset:{ 17 | 18 | lda Value + 1 19 | sta Value 20 | 21 | jsr Draw 22 | 23 | rts 24 | } 25 | 26 | 27 | 28 | LoseLife: { 29 | 30 | dec Value 31 | jsr Draw 32 | rts 33 | } 34 | 35 | Draw:{ 36 | 37 | .label LivesLeft = TEMP1 38 | 39 | clc 40 | lda Value 41 | sta LivesLeft 42 | ldx #3 43 | 44 | //sta $d020 45 | 46 | 47 | Loop: 48 | 49 | 50 | clc 51 | cpx LivesLeft 52 | 53 | beq DrawHeart 54 | jmp DrawBlank 55 | 56 | DrawHeart: 57 | 58 | lda #HeartCharacter 59 | sta StartCharacterPosition, x 60 | lda #RED 61 | sta StartColourPosition, x 62 | dec LivesLeft 63 | jmp EndLoop 64 | 65 | 66 | DrawBlank: 67 | 68 | lda #BlankCharacter 69 | sta StartCharacterPosition, x 70 | //inc $d020 71 | 72 | 73 | EndLoop: 74 | 75 | dex 76 | cpx #ZERO 77 | bne Loop 78 | rts 79 | 80 | 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/lives.asm: -------------------------------------------------------------------------------- 1 | LIVES:{ 2 | 3 | 4 | Value: .byte 3, 3 5 | 6 | .label HeartCharacter = 79 7 | .label BlankCharacter = 0 8 | 9 | .label StartCharacterPosition = VIC.SCREEN_RAM + 229 10 | .label StartColourPosition = VIC.COLOR_RAM + 229 11 | 12 | 13 | 14 | 15 | 16 | Reset:{ 17 | 18 | lda Value + 1 19 | sta Value 20 | 21 | jsr Draw 22 | 23 | rts 24 | } 25 | 26 | 27 | 28 | LoseLife: { 29 | 30 | dec Value 31 | jsr Draw 32 | rts 33 | } 34 | 35 | Draw:{ 36 | 37 | .label LivesLeft = TEMP1 38 | 39 | clc 40 | lda Value 41 | sta LivesLeft 42 | ldx #3 43 | 44 | //sta $d020 45 | 46 | 47 | Loop: 48 | 49 | 50 | clc 51 | cpx LivesLeft 52 | 53 | beq DrawHeart 54 | jmp DrawBlank 55 | 56 | DrawHeart: 57 | 58 | lda #HeartCharacter 59 | sta StartCharacterPosition, x 60 | lda #RED 61 | sta StartColourPosition, x 62 | dec LivesLeft 63 | jmp EndLoop 64 | 65 | 66 | DrawBlank: 67 | 68 | lda #BlankCharacter 69 | sta StartCharacterPosition, x 70 | //inc $d020 71 | 72 | 73 | EndLoop: 74 | 75 | dex 76 | cpx #ZERO 77 | bne Loop 78 | rts 79 | 80 | 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /zPET/scripts/lookups/randomNumber.asm: -------------------------------------------------------------------------------- 1 | RANDOM_NUMBER: { 2 | 3 | CurrentIndex: .byte 0 4 | Sequence: .byte 29,61,10,138,52,207,52,178,0,168,192,236,42,44,36,42,224,37,39,68,183,60,168,188,246,67,24,18,159,56,24,238,172,103,212,17,24,170,202,50,118,95,33,219,36,169,99,26,242,79,85,138,61,118,50,210,128,110,61,53,44,70,183,212, 101,45,118,124,5,34,212,173,193,83,57,153,200,102,68,40,157,118,59,231,7,237,98,205,14,247,121,19,133,40,20,97,121,133,76,210,247,136,112,54,252,122,253,25,58,148,46,39,58,186,125,173,250,229,251,93,85,39,74,89,104,215,180,173,126,245,197,53,139,110,160,38,242,78,116,189,233,27,37,109,163,11,125,33,114,128,179,129,51,11,67,54,145,7,119,225,186,140,19,169,134,139,227,211,74,254,76,7,206,218,17,224,186,186,137,198,85,103,192,169,142,75,68,194,181,16,66,234,105,193,106,137,86,93,70,244,152,75,22,119,108,154,79,250,239,9,203,191,35,16,249,72,193,122,236,64,244,160,3,235,60,143,8,58,208,155,53,97,206,193,232,183,28,179,121,21,33,59,173,224,249,8,141,215,250,87,204,240,137,119,143,182 5 | 6 | Get: { 7 | 8 | .label RandomNumber = TEMP7 9 | txa 10 | pha 11 | 12 | ldx CurrentIndex 13 | lda Sequence, x 14 | sta RandomNumber 15 | inx 16 | stx CurrentIndex 17 | 18 | pla 19 | tax 20 | lda RandomNumber 21 | 22 | 23 | rts 24 | } 25 | } -------------------------------------------------------------------------------- /zPET/scripts/lookups/vic.asm: -------------------------------------------------------------------------------- 1 | VIC: { 2 | 3 | .label SCREEN_RAM = $8000 4 | .label SCREEN_DATA_LOCATION = $600 5 | .label RASTER_LINE = $E840 6 | .label RASTER_MASK= %00100000 7 | 8 | ScreenRowLSB: 9 | .fill 25, <[SCREEN_RAM + i * 40] 10 | ScreenRowMSB: 11 | .fill 25, >[SCREEN_RAM + i * 40] 12 | 13 | GameScreenRowLSB: 14 | .fill 25, <[SCREEN_DATA_LOCATION + i * 40] 15 | GameScreenRowMSB: 16 | .fill 25, >[SCREEN_DATA_LOCATION + i * 40] 17 | 18 | 19 | 20 | Setup:{ 21 | 22 | 23 | 24 | rts 25 | 26 | } 27 | 28 | 29 | 30 | 31 | ColourMyBorder: { 32 | 33 | txa 34 | pha 35 | 36 | 37 | ldx #0 38 | 39 | Loop: 40 | 41 | lda #86 42 | sta SCREEN_RAM, x 43 | sta SCREEN_RAM + 920, x 44 | cpx #79 45 | beq EndLoop 46 | inx 47 | jmp Loop 48 | 49 | 50 | EndLoop: 51 | 52 | pla 53 | tax 54 | 55 | rts 56 | } 57 | 58 | 59 | RestoreBorder: { 60 | 61 | txa 62 | pha 63 | 64 | ldx #0 65 | 66 | Loop: 67 | 68 | lda SCREEN_DATA.Game, x 69 | sta SCREEN_RAM, x 70 | lda SCREEN_DATA.Game + 920, x 71 | sta SCREEN_RAM + 920, x 72 | cpx #79 73 | beq EndLoop 74 | inx 75 | jmp Loop 76 | 77 | 78 | EndLoop: 79 | 80 | pla 81 | tax 82 | 83 | rts 84 | 85 | 86 | 87 | 88 | } 89 | 90 | 91 | } -------------------------------------------------------------------------------- /vic20/scripts/setup/upstart.asm: -------------------------------------------------------------------------------- 1 | // VIC-20 BASIC stub generator macro (KickAssembler) 2 | // Copyright (C) 2014 3 | 4 | // Expansion: 0,3,8 (Unexpanded, 3K at $0400, 8K+ at $1200) 5 | // ListMessage: string to display if program is LISTed 6 | .macro BASICStub(Expansion,Entry) 7 | { 8 | .if (Expansion == 0) // Determine BASIC start address 9 | { 10 | .pc = $1000 "BASIC Stub" // Unexpanded VIC - BASIC starts at 4096 11 | } 12 | else .if (Expansion == 3) 13 | { 14 | .pc = $0400 "BASIC Stub" // 3K Expanded VIC - BASIC starts at 1024 15 | } 16 | else 17 | { 18 | .pc = $1200 "BASIC Stub" // 8K+ Expanded VIC - BASIC starts at 4608 19 | } 20 | 21 | .byte 0 // Start of BASIC program 22 | .word nextline // Pointer to next BASIC line (Lo/Hi) 23 | .word 0 // Line number 24 | .byte $9e // 'SYS' 25 | .fill 4, toIntString(begin,4).charAt(i) // Address of 'begin' as numeric string 26 | .word $8f3a // Colon and 'REM' 27 | .fill 13,$14 // {DEL} control characters to hide start of BASIC line 28 | .text "Donkey Kong Junior" // Message for LIST 29 | .byte 0 // End of BASIC line 30 | nextline: .word 0 // End of BASIC program 31 | begin: .pc = * "Entry" // Start of 6502 code 32 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/setup/upstart.asm: -------------------------------------------------------------------------------- 1 | // VIC-20 BASIC stub generator macro (KickAssembler) 2 | // Copyright (C) 2014 3 | 4 | // Expansion: 0,3,8 (Unexpanded, 3K at $0400, 8K+ at $1200) 5 | // ListMessage: string to display if program is LISTed 6 | .macro BASICStub(Expansion,Entry) 7 | { 8 | .if (Expansion == 0) // Determine BASIC start address 9 | { 10 | .pc = $1000 "BASIC Stub" // Unexpanded VIC - BASIC starts at 4096 11 | } 12 | else .if (Expansion == 3) 13 | { 14 | .pc = $0400 "BASIC Stub" // 3K Expanded VIC - BASIC starts at 1024 15 | } 16 | else 17 | { 18 | .pc = $1200 "BASIC Stub" // 8K+ Expanded VIC - BASIC starts at 4608 19 | } 20 | 21 | .byte 0 // Start of BASIC program 22 | .word nextline // Pointer to next BASIC line (Lo/Hi) 23 | .word 0 // Line number 24 | .byte $9e // 'SYS' 25 | .fill 4, toIntString(begin,4).charAt(i) // Address of 'begin' as numeric string 26 | .word $8f3a // Colon and 'REM' 27 | .fill 13,$14 // {DEL} control characters to hide start of BASIC line 28 | .text "Donkey Kong Junior" // Message for LIST 29 | .byte 0 // End of BASIC line 30 | nextline: .word 0 // End of BASIC program 31 | begin: .pc = * "Entry" // Start of 6502 code 32 | } -------------------------------------------------------------------------------- /zPET/scripts/setup/upstart.asm: -------------------------------------------------------------------------------- 1 | // VIC-20 BASIC stub generator macro (KickAssembler) 2 | // Copyright (C) 2014 3 | 4 | // Expansion: 0,3,8 (Unexpanded, 3K at $0400, 8K+ at $1200) 5 | // ListMessage: string to display if program is LISTed 6 | .macro BASICStub(Expansion,Entry) 7 | { 8 | .if (Expansion == 0) // Determine BASIC start address 9 | { 10 | .pc = $0400 "BASIC Stub" // Unexpanded VIC - BASIC starts at 4096 11 | } 12 | else .if (Expansion == 3) 13 | { 14 | .pc = $0400 "BASIC Stub" // 3K Expanded VIC - BASIC starts at 1024 15 | } 16 | else 17 | { 18 | .pc = $1200 "BASIC Stub" // 8K+ Expanded VIC - BASIC starts at 4608 19 | } 20 | 21 | .byte 0 // Start of BASIC program 22 | .word nextline // Pointer to next BASIC line (Lo/Hi) 23 | .word 0 // Line number 24 | .byte $9e // 'SYS' 25 | .fill 4, toIntString(begin,4).charAt(i) // Address of 'begin' as numeric string 26 | .word $8f3a // Colon and 'REM' 27 | .fill 13,$14 // {DEL} control characters to hide start of BASIC line 28 | .text "Donkey Kong Junior" // Message for LIST 29 | .byte 0 // End of BASIC line 30 | nextline: .word 0 // End of BASIC program 31 | begin: .pc = * "Entry" // Start of 6502 code 32 | } -------------------------------------------------------------------------------- /vic20/scripts/lookups/monkeyData.asm: -------------------------------------------------------------------------------- 1 | MONKEYDATA:{ 2 | Row: 3 | .byte 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 4 | 5 | Column: 6 | .byte 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 7 | 8 | ReplacementObjectID: 9 | .byte 99, 99, 99, 99, 99, 99 10 | .byte 11 | 12 | WillFall: 13 | .byte 0, 0, 0, 0, 0, 0 14 | .byte 0, 1, 0, 0, 1, 0 15 | .byte 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 1, 1, 0, 0 17 | 18 | OnVine: 19 | .byte 0, 0, 0, 0, 0, 0 20 | .byte 1, 0, 1, 1, 0, 1 21 | .byte 0, 0, 0, 0, 0, 0 22 | .byte 0, 0, 0, 0, 1, 0 23 | 24 | CanJump: 25 | .byte 1, 1, 1, 1, 1, 1 26 | .byte 0, 0, 0, 0, 0, 0 27 | .byte 0, 1, 1, 1, 1, 0 28 | .byte 0, 0, 0, 0, 0, 0 29 | 30 | SwingOverEnemyID: 31 | .byte 0, 0, 0, 0, 0, 0 32 | .byte 16, 0, 0, 0, 19, 0 33 | .byte 0, 0, 0, 0, 0, 0 34 | .byte 0, 0, 0, 0, 0, 0 35 | 36 | 37 | CanMoveRight: 38 | .byte 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 39 | 40 | CheckWhenMovingRight: 41 | .byte 15, 16, 17, 18, 19, 20 42 | .byte 98, 98, 98, 98, 98, 98 43 | .byte 98, 98, 98, 98, 98, 98 44 | .byte 98, 98, 98, 98, 98, 98 45 | 46 | CheckWhenMovingLeft: 47 | .byte 98, 98, 98, 98, 98, 98 48 | .byte 98, 8, 9, 10, 11, 12 49 | .byte 98, 98, 1,2,3,4 50 | .byte 98, 98, 98, 98, 98, 98 51 | 52 | 53 | 54 | 55 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/monkeyData.asm: -------------------------------------------------------------------------------- 1 | MONKEYDATA:{ 2 | Row: 3 | .byte 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 4 | 5 | Column: 6 | .byte 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 7 | 8 | ReplacementObjectID: 9 | .byte 99, 99, 99, 99, 99, 99 10 | .byte 11 | 12 | WillFall: 13 | .byte 0, 0, 0, 0, 0, 0 14 | .byte 0, 1, 0, 0, 1, 0 15 | .byte 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 1, 1, 0, 0 17 | 18 | OnVine: 19 | .byte 0, 0, 0, 0, 0, 0 20 | .byte 1, 0, 1, 1, 0, 1 21 | .byte 0, 0, 0, 0, 0, 0 22 | .byte 0, 0, 0, 0, 1, 0 23 | 24 | CanJump: 25 | .byte 1, 1, 1, 1, 1, 1 26 | .byte 0, 0, 0, 0, 0, 0 27 | .byte 0, 1, 1, 1, 1, 0 28 | .byte 0, 0, 0, 0, 0, 0 29 | 30 | SwingOverEnemyID: 31 | .byte 0, 0, 0, 0, 0, 0 32 | .byte 16, 0, 0, 0, 19, 0 33 | .byte 0, 0, 0, 0, 0, 0 34 | .byte 0, 0, 0, 0, 0, 0 35 | 36 | 37 | CanMoveRight: 38 | .byte 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 39 | 40 | CheckWhenMovingRight: 41 | .byte 15, 16, 17, 18, 19, 20 42 | .byte 98, 98, 98, 98, 98, 98 43 | .byte 98, 98, 98, 98, 98, 98 44 | .byte 98, 98, 98, 98, 98, 98 45 | 46 | CheckWhenMovingLeft: 47 | .byte 98, 98, 98, 98, 98, 98 48 | .byte 98, 8, 9, 10, 11, 12 49 | .byte 98, 98, 1,2,3,4 50 | .byte 98, 98, 98, 98, 98, 98 51 | 52 | 53 | 54 | 55 | } -------------------------------------------------------------------------------- /zPET/scripts/lookups/monkeyData.asm: -------------------------------------------------------------------------------- 1 | MONKEYDATA:{ 2 | Row: 3 | .byte 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 4 | 5 | Column: 6 | .byte 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 7 | 8 | ReplacementObjectID: 9 | .byte 99, 99, 99, 99, 99, 99 10 | .byte 11 | 12 | WillFall: 13 | .byte 0, 0, 0, 0, 0, 0 14 | .byte 0, 1, 0, 0, 1, 0 15 | .byte 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 1, 1, 0, 0 17 | 18 | OnVine: 19 | .byte 0, 0, 0, 0, 0, 0 20 | .byte 1, 0, 1, 1, 0, 1 21 | .byte 0, 0, 0, 0, 0, 0 22 | .byte 0, 0, 0, 0, 1, 0 23 | 24 | CanJump: 25 | .byte 1, 1, 1, 1, 1, 1 26 | .byte 0, 0, 0, 0, 0, 0 27 | .byte 0, 1, 1, 1, 1, 0 28 | .byte 0, 0, 0, 0, 0, 0 29 | 30 | SwingOverEnemyID: 31 | .byte 0, 0, 0, 0, 0, 0 32 | .byte 16, 0, 0, 0, 19, 0 33 | .byte 0, 0, 0, 0, 0, 0 34 | .byte 0, 0, 0, 0, 0, 0 35 | 36 | 37 | CanMoveRight: 38 | .byte 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 39 | 40 | CheckWhenMovingRight: 41 | .byte 15, 16, 17, 18, 19, 20 42 | .byte 98, 98, 98, 98, 98, 98 43 | .byte 98, 98, 98, 98, 98, 98 44 | .byte 98, 98, 98, 98, 98, 98 45 | 46 | CheckWhenMovingLeft: 47 | .byte 98, 98, 98, 98, 98, 98 48 | .byte 98, 8, 9, 10, 11, 12 49 | .byte 98, 98, 1,2,3,4 50 | .byte 98, 98, 98, 98, 98, 98 51 | 52 | 53 | 54 | 55 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/vic.asm: -------------------------------------------------------------------------------- 1 | VIC: { 2 | 3 | .label SCREEN_RAM = $0C00 4 | .label COLOR_RAM = $0800 5 | .label BORDER_BACKGROUND = $900f 6 | .label BACKGROUND_COLOUR = $ff15 7 | .label BORDER_COLOUR = $ff19 8 | .label CHAR_RAM = $9005 9 | .label RASTER_LINE = $FF1D 10 | .label RAM_CHAR_MODE = $FF12 11 | .label RAM_CHAR_ADDRESS = $FF13 12 | .label SCREEN_MODE = $ff07 13 | .label ROWS_ETC = $ff06 14 | 15 | .label MULTICOLOUR_1 = $ff16 16 | .label MULTICOLOUR_2 = $ff17 17 | 18 | ScreenRowLSB: 19 | .fill 25, <[SCREEN_RAM + i * 40] 20 | ScreenRowMSB: 21 | .fill 25, >[SCREEN_RAM + i * 40] 22 | 23 | ColorRowLSB: 24 | .fill 25, <[COLOR_RAM + i * 40] 25 | ColorRowMSB: 26 | .fill 25, >[COLOR_RAM + i * 40] 27 | 28 | 29 | 30 | Setup:{ 31 | 32 | lda ROWS_ETC 33 | and #%11110000 34 | ora #%00000111 35 | sta ROWS_ETC // set to 24 row mode 36 | 37 | lda #%01011101 38 | sta BACKGROUND_COLOUR // background colour light blue 39 | 40 | lda #%11000110 41 | sta BORDER_COLOUR // border colour 42 | 43 | 44 | lda SCREEN_MODE // screen setup 45 | ora #%10010000 // set 256-char mode and multicolour mode 46 | sta SCREEN_MODE 47 | 48 | lda RAM_CHAR_MODE 49 | and #%11111011 // set to use ram for characters (bit 2) 50 | sta RAM_CHAR_MODE 51 | 52 | lda RAM_CHAR_ADDRESS 53 | and #%00000011 54 | ora #%00100000 // character ram page 8 $2000/8192 55 | sta RAM_CHAR_ADDRESS 56 | 57 | lda #%01101111 // light green 58 | sta MULTICOLOUR_1 59 | 60 | lda #%00000101 // green 61 | sta MULTICOLOUR_2 62 | 63 | rts 64 | 65 | } 66 | 67 | 68 | 69 | 70 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/sound.asm: -------------------------------------------------------------------------------- 1 | SOUND:{ 2 | 3 | 4 | .label SoundOnOff = $E84B 5 | .label CONTROL = $ff11 6 | .label Octave = $E84A 7 | .label Frequency = $E848 8 | 9 | Countdown: .byte 0 10 | 11 | 12 | Setup:{ 13 | 14 | lda #16 15 | sta SoundOnOff 16 | 17 | rts 18 | 19 | } 20 | 21 | MoveMonkey: { 22 | 23 | lda #15 24 | sta Octave 25 | 26 | lda #150 27 | sta Frequency 28 | 29 | lda #3 30 | sta Countdown 31 | 32 | rts 33 | 34 | 35 | } 36 | 37 | PlayGameOver: { 38 | 39 | 40 | 41 | lda #51 42 | sta Octave 43 | 44 | lda #155 45 | sta Frequency 46 | 47 | lda #255 48 | sta Countdown 49 | 50 | 51 | 52 | rts 53 | 54 | 55 | } 56 | 57 | 58 | DeathSound: { 59 | 60 | 61 | lda #15 62 | sta Octave 63 | 64 | lda #20 65 | sta Frequency 66 | 67 | lda #30 68 | sta Countdown 69 | 70 | rts 71 | 72 | } 73 | 74 | ScoreSound: { 75 | 76 | lda #85 77 | sta Octave 78 | 79 | lda #200 80 | sta Frequency 81 | 82 | lda #1 83 | sta Countdown 84 | 85 | 86 | 87 | rts 88 | } 89 | 90 | PlayTick: { 91 | 92 | 93 | lda #85 94 | sta Octave 95 | 96 | lda #65 97 | sta Frequency 98 | 99 | lda #1 100 | sta Countdown 101 | 102 | rts 103 | 104 | } 105 | 106 | StopAll: { 107 | 108 | lda #0 109 | sta Frequency 110 | 111 | rts 112 | 113 | 114 | } 115 | 116 | Update: { 117 | 118 | ldx #0 119 | 120 | Loop: 121 | 122 | ldy Countdown, x 123 | beq StopChannel 124 | 125 | dey 126 | tya 127 | sta Countdown, x 128 | 129 | jmp EndLoop 130 | 131 | StopChannel: 132 | 133 | lda #0 134 | sta Frequency 135 | 136 | EndLoop: 137 | 138 | cpx #0 139 | beq Finish 140 | inx 141 | jmp Loop 142 | 143 | Finish: 144 | 145 | rts 146 | 147 | 148 | } 149 | 150 | 151 | 152 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/sound.asm: -------------------------------------------------------------------------------- 1 | SOUND:{ 2 | 3 | .label Channel1 = $900A 4 | .label Channel2 = $900B 5 | .label Channel3 = $900C 6 | .label Channel4 = $900D 7 | 8 | Countdown: .byte 0, 0, 0 9 | Channels: .word Channel1, Channel2, Channel3 10 | 11 | Channel: .byte 0 12 | 13 | 14 | 15 | PlayTick: { 16 | 17 | 18 | lda #%11101111 19 | sta Channel3 20 | 21 | lda #3 22 | ldx #2 23 | sta Countdown, x 24 | 25 | rts 26 | 27 | 28 | } 29 | 30 | PlayGameOver: { 31 | 32 | 33 | lda #%11101111 34 | sta Channel2 35 | 36 | lda #2 37 | ldx #120 38 | sta Countdown, x 39 | 40 | rts 41 | 42 | 43 | } 44 | 45 | 46 | DeathSound: { 47 | 48 | lda #%10110111 49 | sta Channel1 50 | 51 | lda #30 52 | ldx #0 53 | sta Countdown, x 54 | 55 | 56 | } 57 | 58 | ScoreSound: { 59 | 60 | lda #%11110111 61 | sta Channel3 62 | 63 | lda #1 64 | ldx #2 65 | sta Countdown, x 66 | 67 | rts 68 | 69 | } 70 | 71 | MoveMonkey: { 72 | 73 | 74 | lda #%11101111 75 | sta Channel2 76 | 77 | lda #3 78 | ldx #1 79 | sta Countdown, x 80 | 81 | rts 82 | 83 | 84 | } 85 | 86 | StopAll: { 87 | 88 | lda #ZERO 89 | sta Channel1 90 | sta Channel2 91 | sta Channel3 92 | 93 | rts 94 | 95 | 96 | } 97 | 98 | Update: { 99 | 100 | ldx #0 101 | 102 | Loop: 103 | 104 | ldy Countdown, x 105 | beq StopChannel 106 | 107 | dey 108 | tya 109 | sta Countdown, x 110 | 111 | jmp EndLoop 112 | 113 | StopChannel: 114 | 115 | //.break 116 | 117 | //lda #ZERO 118 | //sta Channel1, x 119 | 120 | txa 121 | pha 122 | 123 | 124 | asl 125 | tax 126 | lda Channels, x 127 | sta Address + 1 128 | inx 129 | lda Channels, x 130 | sta Address + 2 131 | 132 | lda #ZERO 133 | 134 | Address: 135 | 136 | sta $BEEF 137 | 138 | pla 139 | tax 140 | 141 | 142 | EndLoop: 143 | 144 | cpx #2 145 | beq Finish 146 | inx 147 | jmp Loop 148 | 149 | Finish: 150 | 151 | rts 152 | 153 | 154 | } 155 | 156 | 157 | 158 | } -------------------------------------------------------------------------------- /zPET/scripts/setup/titleLoader.asm: -------------------------------------------------------------------------------- 1 | TITLELOADER: { 2 | 3 | 4 | DrawMap: { 5 | 6 | .label CHAR_ID = TEMP1 7 | .label BYTE_ID = TEMP2 8 | 9 | ldx #0 10 | 11 | ldy #0 12 | sty CHAR_ID 13 | 14 | lda #ZERO 15 | sta BYTE_ID 16 | 17 | //jmp Nope 18 | 19 | First: { 20 | 21 | Loop2: 22 | 23 | lda SCREEN_DATA.Title, x 24 | sta $8000, x 25 | 26 | CheckNextChar: 27 | inc BYTE_ID 28 | lda BYTE_ID 29 | cmp #8 30 | beq NewChar 31 | jmp EndLoop 32 | 33 | NewChar: 34 | 35 | inc CHAR_ID 36 | lda #0 37 | sta BYTE_ID 38 | 39 | EndLoop: 40 | 41 | cpx #255 42 | beq Finish2 43 | inx 44 | jmp Loop2 45 | 46 | Finish2: 47 | 48 | } 49 | 50 | 51 | ldx #ZERO 52 | 53 | Second: { 54 | 55 | Loop2: 56 | 57 | lda SCREEN_DATA.Title +256, x 58 | sta $8000 + 256, x 59 | 60 | CheckNextChar: 61 | inc BYTE_ID 62 | lda BYTE_ID 63 | cmp #8 64 | beq NewChar 65 | jmp EndLoop 66 | 67 | NewChar: 68 | 69 | inc CHAR_ID 70 | lda #0 71 | sta BYTE_ID 72 | 73 | EndLoop: 74 | 75 | cpx #255 76 | beq Finish2 77 | inx 78 | jmp Loop2 79 | 80 | Finish2: 81 | 82 | } 83 | 84 | ldx #ZERO 85 | 86 | Third: { 87 | 88 | Loop2: 89 | 90 | lda SCREEN_DATA.Title +512, x 91 | sta $8000 + 512, x 92 | CheckNextChar: 93 | inc BYTE_ID 94 | lda BYTE_ID 95 | cmp #8 96 | beq NewChar 97 | jmp EndLoop 98 | 99 | NewChar: 100 | 101 | inc CHAR_ID 102 | lda #0 103 | sta BYTE_ID 104 | 105 | EndLoop: 106 | 107 | cpx #255 108 | beq Finish2 109 | inx 110 | jmp Loop2 111 | 112 | Finish2: 113 | 114 | } 115 | 116 | 117 | ldx #ZERO 118 | 119 | Fourth: { 120 | 121 | Loop2: 122 | 123 | lda SCREEN_DATA.Title +768, x 124 | sta $8000 +768, x 125 | 126 | CheckNextChar: 127 | inc BYTE_ID 128 | lda BYTE_ID 129 | cmp #8 130 | beq NewChar 131 | jmp EndLoop 132 | 133 | NewChar: 134 | 135 | inc CHAR_ID 136 | lda #0 137 | sta BYTE_ID 138 | 139 | EndLoop: 140 | 141 | cpx #255 142 | beq Finish2 143 | inx 144 | jmp Loop2 145 | 146 | Finish2: 147 | 148 | } 149 | 150 | Nope: 151 | rts 152 | 153 | } 154 | 155 | 156 | 157 | } -------------------------------------------------------------------------------- /scripts/interrupts/score.asm: -------------------------------------------------------------------------------- 1 | SCORE:{ 2 | 3 | 4 | KeyScore: .byte 10, 10 5 | UnlockScore: .byte 20 6 | JumpScore: .byte 1 7 | HitScores: .byte 9, 6, 3 8 | Value: .byte 0, 0, 0 // H M L 9 | .label Amount = TEMP1 10 | .label CharacterSetStart = 232 11 | 12 | ScoreToAdd: .byte 0 13 | 14 | 15 | Reset:{ 16 | 17 | lda #ZERO 18 | sta Value 19 | sta Value + 1 20 | sta Value + 2 21 | 22 | jsr Draw 23 | rts 24 | 25 | } 26 | 27 | 28 | 29 | AddToScore:{ 30 | 31 | lda ScoreToAdd 32 | clc 33 | adc Amount 34 | sta ScoreToAdd 35 | rts 36 | 37 | 38 | } 39 | 40 | HitEnemy: { 41 | 42 | // enemy row passed in y 43 | 44 | lda HitScores, y 45 | sta Amount 46 | jsr AddToScore 47 | rts 48 | 49 | } 50 | 51 | JumpEnemy: { 52 | 53 | lda JumpScore 54 | sta Amount 55 | jsr AddToScore 56 | rts 57 | 58 | } 59 | 60 | UnlockSection: { 61 | 62 | lda KeyScore 63 | sta Amount 64 | jsr AddToScore 65 | rts 66 | 67 | } 68 | 69 | UnlockCage:{ 70 | 71 | lda UnlockScore 72 | sta Amount 73 | jsr AddToScore 74 | rts 75 | 76 | } 77 | 78 | 79 | CheckScoreToAdd:{ 80 | 81 | lda ScoreToAdd 82 | beq Finish 83 | 84 | dec ScoreToAdd 85 | lda #ONE 86 | jsr Add 87 | 88 | Finish: 89 | 90 | rts 91 | 92 | 93 | } 94 | 95 | Add: { 96 | 97 | sta Amount 98 | sed 99 | clc 100 | lda Value 101 | adc Amount 102 | sta Value 103 | lda Value+1 104 | adc #ZERO 105 | sta Value+1 106 | lda Value+2 107 | adc #ZERO 108 | sta Value+2 109 | cld 110 | jsr Draw 111 | jsr SID.ScoreSound 112 | rts 113 | 114 | 115 | } 116 | 117 | 118 | Draw:{ 119 | 120 | ldy #5 // screen offset, right most digit 121 | ldx #ZERO // score byte index 122 | 123 | ScoreLoop: 124 | 125 | lda Value,x 126 | pha 127 | and #$0f // keep lower nibble 128 | jsr PlotDigit 129 | pla 130 | lsr 131 | lsr 132 | lsr 133 | lsr // shift right to get higher lower nibble 134 | jsr PlotDigit 135 | inx 136 | cpx #3 137 | bne ScoreLoop 138 | 139 | rts 140 | 141 | PlotDigit: { 142 | 143 | clc 144 | adc #CharacterSetStart 145 | sta SCREEN_RAM + 148, y 146 | dey 147 | rts 148 | 149 | 150 | } 151 | 152 | 153 | 154 | rts 155 | 156 | 157 | } 158 | 159 | 160 | 161 | } -------------------------------------------------------------------------------- /zPET/scripts/setup/maploader.asm: -------------------------------------------------------------------------------- 1 | MAPLOADER: { 2 | 3 | 4 | DrawMap: { 5 | 6 | .label CHAR_ID = TEMP1 7 | .label BYTE_ID = TEMP2 8 | 9 | ldx #0 10 | 11 | ldy #0 12 | sty CHAR_ID 13 | 14 | lda #ZERO 15 | sta BYTE_ID 16 | 17 | //jmp Nope 18 | 19 | First: { 20 | 21 | Loop2: 22 | 23 | lda SCREEN_DATA.Game, x 24 | sta $8000, x 25 | 26 | CheckNextChar: 27 | inc BYTE_ID 28 | lda BYTE_ID 29 | cmp #8 30 | beq NewChar 31 | jmp EndLoop 32 | 33 | NewChar: 34 | 35 | inc CHAR_ID 36 | lda #0 37 | sta BYTE_ID 38 | 39 | EndLoop: 40 | 41 | cpx #255 42 | beq Finish2 43 | inx 44 | jmp Loop2 45 | 46 | Finish2: 47 | 48 | } 49 | 50 | 51 | ldx #ZERO 52 | 53 | Second: { 54 | 55 | Loop2: 56 | 57 | lda SCREEN_DATA.Game +256, x 58 | sta $8000 + 256, x 59 | 60 | CheckNextChar: 61 | inc BYTE_ID 62 | lda BYTE_ID 63 | cmp #8 64 | beq NewChar 65 | jmp EndLoop 66 | 67 | NewChar: 68 | 69 | inc CHAR_ID 70 | lda #0 71 | sta BYTE_ID 72 | 73 | EndLoop: 74 | 75 | cpx #255 76 | beq Finish2 77 | inx 78 | jmp Loop2 79 | 80 | Finish2: 81 | 82 | } 83 | 84 | ldx #ZERO 85 | 86 | Third: { 87 | 88 | Loop2: 89 | 90 | lda SCREEN_DATA.Game +512, x 91 | sta $8000 + 512, x 92 | CheckNextChar: 93 | inc BYTE_ID 94 | lda BYTE_ID 95 | cmp #8 96 | beq NewChar 97 | jmp EndLoop 98 | 99 | NewChar: 100 | 101 | inc CHAR_ID 102 | lda #0 103 | sta BYTE_ID 104 | 105 | EndLoop: 106 | 107 | cpx #255 108 | beq Finish2 109 | inx 110 | jmp Loop2 111 | 112 | Finish2: 113 | 114 | } 115 | 116 | 117 | ldx #ZERO 118 | 119 | Fourth: { 120 | 121 | Loop2: 122 | 123 | lda SCREEN_DATA.Game +768, x 124 | sta $8000 +768, x 125 | 126 | CheckNextChar: 127 | inc BYTE_ID 128 | lda BYTE_ID 129 | cmp #8 130 | beq NewChar 131 | jmp EndLoop 132 | 133 | NewChar: 134 | 135 | inc CHAR_ID 136 | lda #0 137 | sta BYTE_ID 138 | 139 | EndLoop: 140 | 141 | cpx #255 142 | beq Finish2 143 | inx 144 | jmp Loop2 145 | 146 | Finish2: 147 | 148 | } 149 | 150 | Nope: 151 | rts 152 | 153 | 154 | 155 | 156 | } 157 | 158 | 159 | 160 | 161 | } -------------------------------------------------------------------------------- /scripts/lookups/spriteData.asm: -------------------------------------------------------------------------------- 1 | SPRITEDATA:{ 2 | 3 | Row: 4 | .byte 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 5 | 6 | Column: 7 | .byte 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 8 | 9 | WillFall: 10 | .byte 0, 0, 0, 0, 0, 0 11 | .byte 0, 1, 0, 0, 1, 0 12 | .byte 0, 0, 0, 0, 0, 0 13 | .byte 0, 0, 1, 1, 0, 0 14 | 15 | OnVine: 16 | .byte 0, 0, 0, 0, 0, 0 17 | .byte 1, 0, 1, 1, 0, 1 18 | .byte 0, 0, 0, 0, 0, 0 19 | .byte 0, 0, 0, 0, 1, 0 20 | 21 | CanJump: 22 | .byte 1, 1, 1, 1, 1, 1 23 | .byte 0, 0, 0, 0, 0, 0 24 | .byte 0, 1, 1, 1, 1, 0 25 | .byte 0, 0, 0, 0, 0, 0 26 | 27 | XPosMSB: 28 | .byte 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 29 | 30 | XPosLSB: 31 | .byte 78, 111, 142, 180, 216, 252 // row 0 32 | .byte 80, 111, 144 , 182, 216, 252 // row 1 33 | .byte 68, 92, 142, 180, 216, 252 // row 2 34 | .byte 96, 120, 142, 180, 216, 65, 96 // row 3 35 | 36 | YPos: 37 | .byte 176, 176, 176, 176, 176, 176 38 | .byte 152, 152, 152, 152, 152, 152 39 | .byte 132, 102, 120, 120, 120, 120 40 | .byte 66, 90, 96, 86, 96, 170, 66 41 | 42 | CanMoveRight: 43 | .byte 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 44 | 45 | CheckWhenMovingRight: 46 | .byte 15, 16, 17, 18, 19, 20 47 | .byte 98, 98, 98, 98, 98, 98 48 | .byte 98, 98, 98, 98, 98, 98 49 | .byte 98, 98, 98, 98, 98, 98 50 | 51 | CheckWhenMovingLeft: 52 | .byte 98, 98, 98, 98, 98, 98 53 | .byte 98, 8, 9, 10, 11, 12 54 | .byte 98, 98, 1,2,3,4 55 | .byte 98, 98, 98, 98, 98, 98 56 | 57 | 58 | TopLeftFrame: 59 | .byte 99, 62, 99, 99, 99, 99 // 0-5 60 | .byte 99, 32, 99, 64, 99, 52 // 6-11 61 | .byte 99, 02, 99, 99, 99, 99 // 12-17 62 | .byte 00, 04, 99, 99, 99, 94, 84 // 18-23 63 | 64 | TopRightFrame: 65 | .byte 99, 99, 99, 99, 99, 99 66 | .byte 99, 33, 99, 99, 07, 53 67 | .byte 95, 03, 21, 99, 99, 46 68 | .byte 01, 05, 99, 99, 99, 99, 99 69 | 70 | BottomLeftFrame: 71 | .byte 56, 70, 76, 74, 78, 86 72 | .byte 24, 40, 44, 72, 14, 60 73 | .byte 48, 10, 28, 34, 42, 54 74 | .byte 08, 12, 26, 18, 16, 91, 92 75 | 76 | BottomRightFrame: 77 | .byte 57, 71, 77, 75, 79, 87 78 | .byte 25, 41, 45, 73, 15, 61 79 | .byte 47, 11, 29, 35, 43, 55 80 | .byte 09, 13, 27, 19, 17, 99, 93 81 | 82 | 83 | Frames: 84 | .byte TopLeftFrame, TopRightFrame, BottomLeftFrame, BottomRightFrame 85 | 86 | TurnOff: 87 | .byte %11111110, %11111101, %11111011, %11110111 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/charDrawing.asm: -------------------------------------------------------------------------------- 1 | CHAR_DRAWING:{ 2 | 3 | 4 | .label ObjectID = TEMP1 5 | .label StartAddress = VECTOR1 6 | .label BytesToRead = TEMP2 7 | .label Row = TEMP3 8 | .label Column = TEMP4 9 | .label ByteID = TEMP5 10 | .label SCREEN_RAM = VIC.SCREEN_RAM 11 | 12 | LoopID: .byte 0 13 | Colour: .byte 0 14 | 15 | .label COLOR_ADDRESS = VECTOR2 16 | 17 | .label TotalObjects = 57 18 | 19 | 20 | CalculateAddresses:{ 21 | 22 | //get row for this position 23 | ldy Row 24 | 25 | lda VIC.ColorRowLSB, y 26 | clc 27 | adc Column 28 | sta COLOR_ADDRESS 29 | 30 | lda VIC.ColorRowMSB, y 31 | adc #$00 32 | sta COLOR_ADDRESS + 1 33 | 34 | 35 | 36 | rts 37 | 38 | } 39 | 40 | 41 | ClearAll:{ 42 | 43 | 44 | ldx #ZERO 45 | 46 | //.break 47 | 48 | Loop: 49 | 50 | clc 51 | ldy #ZERO 52 | stx LoopID 53 | jsr ColourObject 54 | 55 | ldx LoopID 56 | //cpx #ONE 57 | cpx #TotalObjects 58 | beq Finish 59 | inx 60 | jmp Loop 61 | 62 | 63 | Finish: 64 | 65 | rts 66 | 67 | 68 | } 69 | 70 | 71 | GetColour:{ 72 | 73 | ldy CHAR_DATA.ObjectType, x 74 | lda CHAR_DATA.TypeColours, y 75 | tay 76 | sty Colour 77 | 78 | rts 79 | 80 | } 81 | 82 | ColourObject:{ 83 | 84 | stx ObjectID 85 | 86 | .label ColourRequest = TEMP4 87 | sty ColourRequest 88 | 89 | cpx #99 90 | beq Finish 91 | 92 | cpy #ZERO 93 | beq Hide 94 | jsr GetColour 95 | jmp ColourObject 96 | 97 | Hide: 98 | 99 | ldy #CYAN 100 | sty Colour 101 | 102 | ColourObject: 103 | 104 | lda CHAR_DATA.Sizes, x 105 | sta BytesToRead 106 | 107 | 108 | lda ObjectID 109 | asl 110 | tax 111 | 112 | lda CHAR_DATA.DataStart, x 113 | sta StartAddress 114 | inx 115 | lda CHAR_DATA.DataStart, x 116 | sta StartAddress + 1 117 | 118 | ldy #ZERO 119 | 120 | Loop: 121 | 122 | lda (StartAddress), y 123 | sta Column 124 | 125 | iny 126 | lda (StartAddress), y 127 | sta Row 128 | 129 | sty ByteID 130 | 131 | jsr CalculateAddresses 132 | 133 | lda Colour 134 | 135 | ColourChar: 136 | 137 | ldy #ZERO 138 | 139 | sta (COLOR_ADDRESS), y 140 | 141 | ldy ByteID 142 | 143 | iny 144 | cpy BytesToRead 145 | beq Finish 146 | jmp Loop 147 | 148 | 149 | Finish: 150 | 151 | ldx ObjectID 152 | ldy ColourRequest 153 | 154 | rts 155 | 156 | 157 | 158 | } 159 | 160 | 161 | 162 | 163 | 164 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/charDrawing.asm: -------------------------------------------------------------------------------- 1 | CHAR_DRAWING:{ 2 | 3 | 4 | .label ObjectID = TEMP1 5 | .label StartAddress = VECTOR1 6 | .label BytesToRead = TEMP2 7 | .label Row = TEMP3 8 | .label Column = TEMP4 9 | .label ByteID = TEMP5 10 | .label SCREEN_RAM = VIC.SCREEN_RAM 11 | 12 | LoopID: .byte 0 13 | Colour: .byte 0 14 | 15 | .label COLOR_ADDRESS = VECTOR2 16 | 17 | .label TotalObjects = 57 18 | 19 | CurrentColour: .byte 0 20 | 21 | 22 | CalculateAddresses:{ 23 | 24 | //get row for this position 25 | ldy Row 26 | 27 | lda VIC.ColorRowLSB, y 28 | clc 29 | adc Column 30 | sta COLOR_ADDRESS 31 | 32 | lda VIC.ColorRowMSB, y 33 | adc #$00 34 | sta COLOR_ADDRESS + 1 35 | 36 | 37 | 38 | rts 39 | 40 | } 41 | 42 | 43 | ClearAll:{ 44 | 45 | 46 | ldx #ZERO 47 | 48 | //.break 49 | 50 | Loop: 51 | 52 | clc 53 | ldy #ZERO 54 | stx LoopID 55 | jsr ColourObject 56 | 57 | ldx LoopID 58 | //cpx #ONE 59 | cpx #TotalObjects 60 | beq Finish 61 | inx 62 | jmp Loop 63 | 64 | 65 | Finish: 66 | 67 | rts 68 | 69 | 70 | } 71 | 72 | 73 | GetColour:{ 74 | 75 | ldy CHAR_DATA.ObjectType, x 76 | lda CHAR_DATA.TypeColours, y 77 | tay 78 | sty Colour 79 | 80 | rts 81 | 82 | } 83 | 84 | ColourObject:{ 85 | 86 | stx ObjectID 87 | 88 | .label ColourRequest = TEMP4 89 | sty ColourRequest 90 | 91 | cpx #99 92 | beq Finish 93 | 94 | cpy #ZERO 95 | beq Hide 96 | jsr GetColour 97 | jmp ColourObject 98 | 99 | Hide: 100 | 101 | ldy CurrentColour 102 | ldy #%01010011 103 | sty Colour 104 | 105 | ColourObject: 106 | 107 | lda CHAR_DATA.Sizes, x 108 | sta BytesToRead 109 | 110 | 111 | lda ObjectID 112 | asl 113 | tax 114 | 115 | lda CHAR_DATA.DataStart, x 116 | sta StartAddress 117 | inx 118 | lda CHAR_DATA.DataStart, x 119 | sta StartAddress + 1 120 | 121 | ldy #ZERO 122 | 123 | Loop: 124 | 125 | lda (StartAddress), y 126 | sta Column 127 | 128 | iny 129 | lda (StartAddress), y 130 | sta Row 131 | 132 | sty ByteID 133 | 134 | jsr CalculateAddresses 135 | 136 | lda Colour 137 | 138 | ColourChar: 139 | 140 | ldy #ZERO 141 | 142 | sta (COLOR_ADDRESS), y 143 | 144 | ldy ByteID 145 | 146 | iny 147 | cpy BytesToRead 148 | beq Finish 149 | jmp Loop 150 | 151 | 152 | Finish: 153 | 154 | ldx ObjectID 155 | ldy ColourRequest 156 | 157 | rts 158 | 159 | 160 | 161 | } 162 | 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/charDrawing.asm: -------------------------------------------------------------------------------- 1 | CHAR_DRAWING:{ 2 | 3 | 4 | .label ObjectID = TEMP1 5 | .label StartAddress = VECTOR1 6 | .label BytesToRead = TEMP2 7 | .label Row = TEMP3 8 | .label Column = TEMP4 9 | .label ByteID = TEMP5 10 | .label SCREEN_RAM = VIC.SCREEN_RAM 11 | .label SCREEN_ADDRESS = VECTOR2 12 | .label BUFFER_ADDRESS = VECTOR3 13 | 14 | LoopID: .byte 0 15 | Colour: .byte 0 16 | 17 | 18 | .label TotalObjects = 57 19 | 20 | CurrentColour: .byte 0 21 | 22 | .label BlankCharacter = 96 23 | 24 | 25 | CalculateAddresses:{ 26 | 27 | //get row for this position 28 | ldy Row 29 | 30 | lda VIC.ScreenRowLSB, y 31 | clc 32 | adc Column 33 | sta SCREEN_ADDRESS 34 | 35 | lda VIC.ScreenRowMSB, y 36 | adc #$00 37 | sta SCREEN_ADDRESS + 1 38 | 39 | lda VIC.GameScreenRowLSB, y 40 | clc 41 | adc Column 42 | sta BUFFER_ADDRESS 43 | 44 | lda VIC.GameScreenRowMSB, y 45 | adc #$00 46 | sta BUFFER_ADDRESS + 1 47 | 48 | 49 | 50 | rts 51 | 52 | } 53 | 54 | 55 | ClearAll:{ 56 | 57 | 58 | ldx #ZERO 59 | 60 | //.break 61 | 62 | Loop: 63 | 64 | clc 65 | ldy #ZERO 66 | stx LoopID 67 | jsr ColourObject 68 | 69 | ldx LoopID 70 | //cpx #ONE 71 | cpx #TotalObjects 72 | beq Finish 73 | inx 74 | jmp Loop 75 | 76 | 77 | Finish: 78 | 79 | rts 80 | 81 | 82 | } 83 | 84 | 85 | GetColour:{ 86 | 87 | ldy CHAR_DATA.ObjectType, x 88 | lda CHAR_DATA.TypeColours, y 89 | tay 90 | sty Colour 91 | 92 | rts 93 | 94 | } 95 | 96 | ColourObject:{ 97 | 98 | stx ObjectID 99 | 100 | .label ColourRequest = TEMP4 101 | sty ColourRequest 102 | 103 | cpx #99 104 | beq Finish 105 | 106 | cpy #ZERO 107 | beq Hide 108 | jsr GetColour 109 | jmp ColourObject 110 | 111 | Hide: 112 | 113 | ldy CurrentColour 114 | ldy #BlankCharacter 115 | sty Colour 116 | 117 | ColourObject: 118 | 119 | lda CHAR_DATA.Sizes, x 120 | sta BytesToRead 121 | 122 | 123 | lda ObjectID 124 | asl 125 | tax 126 | 127 | lda CHAR_DATA.DataStart, x 128 | sta StartAddress 129 | inx 130 | lda CHAR_DATA.DataStart, x 131 | sta StartAddress + 1 132 | 133 | ldy #ZERO 134 | 135 | Loop: 136 | 137 | lda (StartAddress), y 138 | sta Column 139 | 140 | iny 141 | lda (StartAddress), y 142 | sta Row 143 | 144 | sty ByteID 145 | 146 | jsr CalculateAddresses 147 | 148 | lda Colour 149 | 150 | ColourChar: 151 | 152 | ldy #ZERO 153 | cmp #BlankCharacter 154 | 155 | beq DrawBlank 156 | 157 | lda (BUFFER_ADDRESS), y 158 | 159 | DrawBlank: 160 | 161 | sta (SCREEN_ADDRESS), y 162 | 163 | ldy ByteID 164 | 165 | iny 166 | cpy BytesToRead 167 | beq Finish 168 | jmp Loop 169 | 170 | 171 | Finish: 172 | 173 | ldx ObjectID 174 | ldy ColourRequest 175 | 176 | rts 177 | 178 | 179 | 180 | } 181 | 182 | 183 | 184 | 185 | 186 | } -------------------------------------------------------------------------------- /zPET/scripts/bin/gamePET_ViceLog.txt: -------------------------------------------------------------------------------- 1 | 2 | *** VICE Version 3.3, rev 37130M *** 3 | 4 | Welcome to x64, the free portable PET Emulator. 5 | 6 | Current VICE team members: 7 | Marco van den Heuvel, Fabrizio Gennari, Groepaz, Errol Smith, Olaf Seibert, 8 | Marcus Sutton, Kajtar Zsolt, AreaScout, Bas Wassink, Michael C. Martin, 9 | David Hogan. 10 | 11 | This is free software with ABSOLUTELY NO WARRANTY. 12 | See the "About VICE" command for more info. 13 | 14 | Loading system file `C:\C64\Tools\Vice\PET\chargen'. 15 | Loading system file `C:\C64\Tools\Vice\PET\basic4'. 16 | Loading system file `C:\C64\Tools\Vice\PET\kernal4'. 17 | PETMEM: Identified Kernal 4 ROM by checksum. 18 | Loading system file `C:\C64\Tools\Vice\PET\edit4g40'. 19 | PETMEM: Identified 40 columns editor by checksum. 20 | PETMEM: ROM screen width is 40. 21 | PET: Initializing IEEE488 bus... 22 | Loading system file `C:\C64\Tools\Vice\PRINTER\mps803'. 23 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\mps803.vpl'. 24 | Loading system file `C:\C64\Tools\Vice\PRINTER\nl10-cbm'. 25 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\nl10.vpl'. 26 | NL10: Printer driver initialized. 27 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\1520.vpl'. 28 | using GTK3 backend: OpenGL 29 | Creating GtkGlArea widget. 30 | Warning - GTKGL: OpenGL version 3.2 not supported in this context 31 | GdkGlkContext is in legacy (OpenGL 1.1) mode. 32 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos2031'. 33 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos2040'. 34 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos3040'. 35 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos4040'. 36 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1001'. 37 | Drive: Finished loading ROM images. 38 | Sound: Available sound devices: dx wmm dummy fs dump wav voc iff aiff flac ogg soundmovie 39 | Keyboard: Loading keymap `C:\C64\Tools\Vice\PET\gtk3_grus_sym.vkm'. 40 | Keyboard: Warning - gtk3_grus_sym.vkm: !LCBM !VCBM !LCTRL !VCTRL !SHIFTLnot defined. 41 | AUTOSTART: Autodetecting image type of `bin/gamePET.prg'. 42 | Filesystem Image Probe: Error - Import GCR: Unknown GCR image version 49. 43 | Filesystem Image: Unknown disk image `bin/gamePET.prg'. 44 | Tape: Error - Cannot open file `bin/gamePET.prg' 45 | AUTOSTART: Loading PRG file `bin/gamePET.prg' with direct RAM injection. 46 | AUTOSTART: Resetting the machine to autostart '*' 47 | AUTOSTART: `bin/gamePET.prg' recognized as program/p00 file. 48 | Main CPU: starting at ($FFFC). 49 | Main CPU: RESET. 50 | Drive 8: RESET. 51 | RS232DEV: rs232dev_set_status: rts:off dtr:off 52 | RS232DEV: rs232dev_set_bps: bps: 10 53 | Drive 8: RESET. 54 | Sound: Opened device `dx', speed 44100Hz, fragment size fms, buffer size 101ms 55 | reSID: MOS6581, filter on, sampling rate 44100Hz - resampling, pass to 19845Hz 56 | PET: cycles per frame set to 20042, refresh to 49.895Hz 57 | PET: cycles per frame set to 20050, refresh to 49.875Hz 58 | AUTOSTART: Injecting program data at $0400 (size $1ca3) 59 | AUTOSTART: Ready 60 | AUTOSTART: Starting program. 61 | AUTOSTART: Done. 62 | Writing configuration file `C:\Users\Nick\AppData\Roaming\vice\vice.ini'. 63 | 64 | Exiting... 65 | Sound: Closing device `dx' 66 | -------------------------------------------------------------------------------- /scripts/setup/maploader.asm: -------------------------------------------------------------------------------- 1 | MAPLOADER: { 2 | 3 | TileScreenLocations: 4 | .byte 0,1,40,41 5 | 6 | Column: 7 | .byte 0 8 | 9 | Row: 10 | .byte 0 11 | 12 | DrawMap: { 13 | 14 | // load first char address into first FEED 15 | lda #SCREEN_RAM 18 | sta Screen + 2 19 | 20 | // load first colour address into second FEED 21 | lda #VIC.COLOR_RAM 24 | sta Colour + 2 25 | 26 | lda #MAP 29 | sta Tile + 2 30 | 31 | lda #ZERO 32 | sta Row 33 | 34 | TileRowLoop: 35 | 36 | lda #ZERO 37 | sta Column 38 | 39 | TileColumnLoop: 40 | 41 | ldy #ZERO 42 | 43 | lda #ZERO 44 | sta TileLookup+1 45 | sta TileLookup+2 46 | 47 | Tile: 48 | 49 | lda $FEED 50 | sta TileLookup + 1 51 | asl TileLookup + 1 52 | rol TileLookup + 2 53 | asl TileLookup + 1 54 | rol TileLookup + 2 55 | 56 | clc 57 | lda #MAP_TILES 61 | adc TileLookup + 2 62 | sta TileLookup + 2 63 | 64 | 65 | !FourTileLoop: 66 | 67 | TileLookup: 68 | // load the map tile at position, offset 69 | lda $FEED,y 70 | ldx TileScreenLocations,y 71 | 72 | Screen: 73 | sta $FEED, x 74 | 75 | // load the character colour for same position 76 | tax 77 | lda CHAR_COLORS, x 78 | ldx TileScreenLocations, y 79 | 80 | Colour: 81 | sta $FEED, x 82 | 83 | //check whether all tiles loaded 84 | iny 85 | cpy #4 86 | bne !FourTileLoop- 87 | 88 | // FourTileLoop 89 | 90 | jsr NextColumn 91 | cpx #20 92 | bne TileColumnLoop 93 | 94 | // TileColumnLoop 95 | 96 | jsr NextRow 97 | 98 | 99 | cpx #12 100 | bne TileRowLoop 101 | 102 | // TileRowLoop 103 | 104 | 105 | rts 106 | 107 | NextColumn: 108 | 109 | clc 110 | lda Tile + 1 111 | adc #ONE 112 | sta Tile + 1 113 | lda Tile + 2 114 | adc #ZERO 115 | sta Tile + 2 116 | 117 | clc 118 | lda Screen + 1 119 | adc #2 120 | sta Screen + 1 121 | lda Screen + 2 122 | adc #0 123 | sta Screen + 2 124 | 125 | // move to the next screen row start address 126 | lda Colour + 1 127 | adc #2 128 | sta Colour + 1 129 | lda Colour + 2 130 | adc #0 131 | sta Colour + 2 132 | 133 | inc Column 134 | ldx Column 135 | rts 136 | 137 | 138 | NextRow: 139 | // move to the next screen row start address 140 | clc 141 | lda Screen + 1 142 | adc #40 143 | sta Screen + 1 144 | lda Screen + 2 145 | adc #0 146 | sta Screen + 2 147 | 148 | // move to the next screen row startaddress 149 | lda Colour + 1 150 | adc #40 151 | sta Colour + 1 152 | lda Colour + 2 153 | adc #0 154 | sta Colour + 2 155 | 156 | inc Row 157 | ldx Row 158 | 159 | rts 160 | 161 | 162 | } 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /vic20/scripts/lookups/charConvert.asm: -------------------------------------------------------------------------------- 1 | CharLookup: .byte %00000000,%00000011,%00000001,%00000010,%00001100,%00001111,%00001101,%00001110,%00000100,%00000111,%00000101,%00000110,%00001000,%00001011,%00001001,%00001010,%00110000,%00110011,%00110001,%00110010,%00111100,%00111111,%00111101,%00111110,%00110100,%00110111,%00110101,%00110110,%00111000,%00111011,%00111001,%00111010,%00010000,%00010011,%00010001,%00010010,%00011100,%00011111,%00011101,%00011110,%00010100,%00010111,%00010101,%00010110,%00011000,%00011011,%00011001,%00011010,%00100000,%00100011,%00100001,%00100010,%00101100,%00101111,%00101101,%00101110,%00100100,%00100111,%00100101,%00100110,%00101000,%00101011,%00101001,%00101010,%11000000,%11000011,%11000001,%11000010,%11001100,%11001111,%11001101,%11001110,%11000100,%11000111,%11000101,%11000110,%11001000,%11001011,%11001001,%11001010,%11110000,%11110011,%11110001,%11110010,%11111100,%11111111,%11111101,%11111110,%11110100,%11110111,%11110101,%11110110,%11111000,%11111011,%11111001,%11111010,%11010000,%11010011,%11010001,%11010010,%11011100,%11011111,%11011101,%11011110,%11010100,%11010111,%11010101,%11010110,%11011000,%11011011,%11011001,%11011010,%11100000,%11100011,%11100001,%11100010,%11101100,%11101111,%11101101,%11101110,%11100100,%11100111,%11100101,%11100110,%11101000,%11101011,%11101001,%11101010,%01000000,%01000011,%01000001,%01000010,%01001100,%01001111,%01001101,%01001110,%01000100,%01000111,%01000101,%01000110,%01001000,%01001011,%01001001,%01001010,%01110000,%01110011,%01110001,%01110010,%01111100,%01111111,%01111101,%01111110,%01110100,%01110111,%01110101,%01110110,%01111000,%01111011,%01111001,%01111010,%01010000,%01010011,%01010001,%01010010,%01011100,%01011111,%01011101,%01011110,%01010100,%01010111,%01010101,%01010110,%01011000,%01011011,%01011001,%01011010,%01100000,%01100011,%01100001,%01100010,%01101100,%01101111,%01101101,%01101110,%01100100,%01100111,%01100101,%01100110,%01101000,%01101011,%01101001,%01101010,%10000000,%10000011,%10000001,%10000010,%10001100,%10001111,%10001101,%10001110,%10000100,%10000111,%10000101,%10000110,%10001000,%10001011,%10001001,%10001010,%10110000,%10110011,%10110001,%10110010,%10111100,%10111111,%10111101,%10111110,%10110100,%10110111,%10110101,%10110110,%10111000,%10111011,%10111001,%10111010,%10010000,%10010011,%10010001,%10010010,%10011100,%10011111,%10011101,%10011110,%10010100,%10010111,%10010101,%10010110,%10011000,%10011011,%10011001,%10011010,%10100000,%10100011,%10100001,%10100010,%10101100,%10101111,%10101101,%10101110,%10100100,%10100111,%10100101,%10100110,%10101000,%10101011,%10101001,%10101010 2 | 3 | IsMulti: .byte 0, 0, 1, 1, 1, 1, 1, 0 4 | .byte 0, 1, 1, 1, 0, 0, 1, 1 5 | .byte 1, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 1, 0, 1, 1, 1, 1, 1 7 | .byte 1, 1, 1, 1, 1, 0, 1, 1 8 | .byte 1, 1, 0, 1, 1, 1, 1, 1 9 | .byte 1, 1, 1, 1, 1, 1, 1, 1 10 | .byte 1, 1, 1, 1, 1, 1, 1, 0 11 | .byte 0, 0, 0, 0, 0, 0, 0, 0 12 | .byte 0, 0, 0, 0, 0, 0, 0, 0 13 | .byte 0, 0, 0, 0, 0, 0, 0, 0 14 | .byte 0, 0, 0, 0, 0, 0, 0, 0 15 | .byte 0, 0, 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 0, 0, 0, 0, 0, 0 17 | .byte 1, 1, 0, 0, 0, 0, 0, 0 18 | .byte 0, 0 19 | 20 | -------------------------------------------------------------------------------- /zPET/scripts/lookups/charConvert.asm: -------------------------------------------------------------------------------- 1 | CharLookup: .byte %00000000,%00000011,%00000001,%00000010,%00001100,%00001111,%00001101,%00001110,%00000100,%00000111,%00000101,%00000110,%00001000,%00001011,%00001001,%00001010,%00110000,%00110011,%00110001,%00110010,%00111100,%00111111,%00111101,%00111110,%00110100,%00110111,%00110101,%00110110,%00111000,%00111011,%00111001,%00111010,%00010000,%00010011,%00010001,%00010010,%00011100,%00011111,%00011101,%00011110,%00010100,%00010111,%00010101,%00010110,%00011000,%00011011,%00011001,%00011010,%00100000,%00100011,%00100001,%00100010,%00101100,%00101111,%00101101,%00101110,%00100100,%00100111,%00100101,%00100110,%00101000,%00101011,%00101001,%00101010,%11000000,%11000011,%11000001,%11000010,%11001100,%11001111,%11001101,%11001110,%11000100,%11000111,%11000101,%11000110,%11001000,%11001011,%11001001,%11001010,%11110000,%11110011,%11110001,%11110010,%11111100,%11111111,%11111101,%11111110,%11110100,%11110111,%11110101,%11110110,%11111000,%11111011,%11111001,%11111010,%11010000,%11010011,%11010001,%11010010,%11011100,%11011111,%11011101,%11011110,%11010100,%11010111,%11010101,%11010110,%11011000,%11011011,%11011001,%11011010,%11100000,%11100011,%11100001,%11100010,%11101100,%11101111,%11101101,%11101110,%11100100,%11100111,%11100101,%11100110,%11101000,%11101011,%11101001,%11101010,%01000000,%01000011,%01000001,%01000010,%01001100,%01001111,%01001101,%01001110,%01000100,%01000111,%01000101,%01000110,%01001000,%01001011,%01001001,%01001010,%01110000,%01110011,%01110001,%01110010,%01111100,%01111111,%01111101,%01111110,%01110100,%01110111,%01110101,%01110110,%01111000,%01111011,%01111001,%01111010,%01010000,%01010011,%01010001,%01010010,%01011100,%01011111,%01011101,%01011110,%01010100,%01010111,%01010101,%01010110,%01011000,%01011011,%01011001,%01011010,%01100000,%01100011,%01100001,%01100010,%01101100,%01101111,%01101101,%01101110,%01100100,%01100111,%01100101,%01100110,%01101000,%01101011,%01101001,%01101010,%10000000,%10000011,%10000001,%10000010,%10001100,%10001111,%10001101,%10001110,%10000100,%10000111,%10000101,%10000110,%10001000,%10001011,%10001001,%10001010,%10110000,%10110011,%10110001,%10110010,%10111100,%10111111,%10111101,%10111110,%10110100,%10110111,%10110101,%10110110,%10111000,%10111011,%10111001,%10111010,%10010000,%10010011,%10010001,%10010010,%10011100,%10011111,%10011101,%10011110,%10010100,%10010111,%10010101,%10010110,%10011000,%10011011,%10011001,%10011010,%10100000,%10100011,%10100001,%10100010,%10101100,%10101111,%10101101,%10101110,%10100100,%10100111,%10100101,%10100110,%10101000,%10101011,%10101001,%10101010 2 | 3 | IsMulti: .byte 0, 0, 1, 1, 1, 1, 1, 0 4 | .byte 0, 1, 1, 1, 0, 0, 1, 1 5 | .byte 1, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 1, 0, 1, 1, 1, 1, 1 7 | .byte 1, 1, 1, 1, 1, 0, 1, 1 8 | .byte 1, 1, 0, 1, 1, 1, 1, 1 9 | .byte 1, 1, 1, 1, 1, 1, 1, 1 10 | .byte 1, 1, 1, 1, 1, 1, 1, 0 11 | .byte 0, 0, 0, 0, 0, 0, 0, 0 12 | .byte 0, 0, 0, 0, 0, 0, 0, 0 13 | .byte 0, 0, 0, 0, 0, 0, 0, 0 14 | .byte 0, 0, 0, 0, 0, 0, 0, 0 15 | .byte 0, 0, 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 0, 0, 0, 0, 0, 0 17 | .byte 1, 1, 0, 0, 0, 0, 0, 0 18 | .byte 0, 0 19 | 20 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/charConvert.asm: -------------------------------------------------------------------------------- 1 | CharLookup: .byte %00000000,%00000011,%00000001,%00000010,%00001100,%00001111,%00001101,%00001110,%00000100,%00000111,%00000101,%00000110,%00001000,%00001011,%00001001,%00001010,%00110000,%00110011,%00110001,%00110010,%00111100,%00111111,%00111101,%00111110,%00110100,%00110111,%00110101,%00110110,%00111000,%00111011,%00111001,%00111010,%00010000,%00010011,%00010001,%00010010,%00011100,%00011111,%00011101,%00011110,%00010100,%00010111,%00010101,%00010110,%00011000,%00011011,%00011001,%00011010,%00100000,%00100011,%00100001,%00100010,%00101100,%00101111,%00101101,%00101110,%00100100,%00100111,%00100101,%00100110,%00101000,%00101011,%00101001,%00101010,%11000000,%11000011,%11000001,%11000010,%11001100,%11001111,%11001101,%11001110,%11000100,%11000111,%11000101,%11000110,%11001000,%11001011,%11001001,%11001010,%11110000,%11110011,%11110001,%11110010,%11111100,%11111111,%11111101,%11111110,%11110100,%11110111,%11110101,%11110110,%11111000,%11111011,%11111001,%11111010,%11010000,%11010011,%11010001,%11010010,%11011100,%11011111,%11011101,%11011110,%11010100,%11010111,%11010101,%11010110,%11011000,%11011011,%11011001,%11011010,%11100000,%11100011,%11100001,%11100010,%11101100,%11101111,%11101101,%11101110,%11100100,%11100111,%11100101,%11100110,%11101000,%11101011,%11101001,%11101010,%01000000,%01000011,%01000001,%01000010,%01001100,%01001111,%01001101,%01001110,%01000100,%01000111,%01000101,%01000110,%01001000,%01001011,%01001001,%01001010,%01110000,%01110011,%01110001,%01110010,%01111100,%01111111,%01111101,%01111110,%01110100,%01110111,%01110101,%01110110,%01111000,%01111011,%01111001,%01111010,%01010000,%01010011,%01010001,%01010010,%01011100,%01011111,%01011101,%01011110,%01010100,%01010111,%01010101,%01010110,%01011000,%01011011,%01011001,%01011010,%01100000,%01100011,%01100001,%01100010,%01101100,%01101111,%01101101,%01101110,%01100100,%01100111,%01100101,%01100110,%01101000,%01101011,%01101001,%01101010,%10000000,%10000011,%10000001,%10000010,%10001100,%10001111,%10001101,%10001110,%10000100,%10000111,%10000101,%10000110,%10001000,%10001011,%10001001,%10001010,%10110000,%10110011,%10110001,%10110010,%10111100,%10111111,%10111101,%10111110,%10110100,%10110111,%10110101,%10110110,%10111000,%10111011,%10111001,%10111010,%10010000,%10010011,%10010001,%10010010,%10011100,%10011111,%10011101,%10011110,%10010100,%10010111,%10010101,%10010110,%10011000,%10011011,%10011001,%10011010,%10100000,%10100011,%10100001,%10100010,%10101100,%10101111,%10101101,%10101110,%10100100,%10100111,%10100101,%10100110,%10101000,%10101011,%10101001,%10101010 2 | 3 | IsMulti: .byte 0, 0, 1, 1, 1, 1, 1, 0 4 | .byte 0, 1, 1, 1, 0, 0, 1, 1 5 | .byte 1, 1, 1, 1, 1, 1, 1, 1 6 | .byte 0, 1, 0, 1, 1, 1, 1, 1 7 | .byte 1, 1, 1, 1, 1, 0, 1, 1 8 | .byte 1, 1, 0, 1, 1, 1, 1, 1 9 | .byte 1, 1, 1, 1, 1, 1, 1, 1 10 | .byte 1, 1, 1, 1, 1, 1, 1, 0 11 | .byte 0, 0, 0, 0, 0, 0, 0, 0 12 | .byte 0, 0, 0, 0, 0, 0, 0, 0 13 | .byte 0, 0, 0, 0, 0, 0, 0, 0 14 | .byte 0, 0, 0, 0, 0, 0, 0, 0 15 | .byte 0, 0, 0, 0, 0, 0, 0, 0 16 | .byte 0, 0, 0, 0, 0, 0, 0, 0 17 | .byte 1, 1, 0, 0, 0, 0, 0, 0 18 | .byte 0, 0 19 | 20 | -------------------------------------------------------------------------------- /vic20/scripts/setup/maploader.asm: -------------------------------------------------------------------------------- 1 | MAPLOADER: { 2 | 3 | TileScreenLocations: 4 | .byte 0,1,22,23 5 | 6 | Column: 7 | .byte 0 8 | 9 | Row: 10 | .byte 0 11 | 12 | DrawMap: { 13 | 14 | // load first char address into first FEED 15 | lda #VIC.SCREEN_RAM 18 | sta Screen + 2 19 | 20 | // load first colour address into second FEED 21 | lda #VIC.COLOR_RAM 24 | sta Colour + 2 25 | 26 | lda #MAP 29 | sta Tile + 2 30 | 31 | lda #ZERO 32 | sta Row 33 | 34 | TileRowLoop: 35 | 36 | lda #ZERO 37 | sta Column 38 | 39 | TileColumnLoop: 40 | 41 | ldy #ZERO 42 | 43 | lda #ZERO 44 | sta TileLookup+1 45 | sta TileLookup+2 46 | 47 | Tile: 48 | 49 | lda $FEED 50 | sta TileLookup + 1 51 | asl TileLookup + 1 52 | rol TileLookup + 2 53 | asl TileLookup + 1 54 | rol TileLookup + 2 55 | 56 | clc 57 | lda #MAP_TILES 61 | adc TileLookup + 2 62 | sta TileLookup + 2 63 | 64 | 65 | !FourTileLoop: 66 | 67 | TileLookup: 68 | // load the map tile at position, offset 69 | lda $FEED,y 70 | ldx TileScreenLocations,y 71 | 72 | Screen: 73 | sta $FEED, x 74 | 75 | // load the character colour for same position 76 | tax 77 | lda CHAR_COLORS, x 78 | ldx TileScreenLocations, y 79 | 80 | Colour: 81 | sta $FEED, x 82 | 83 | //check whether all tiles loaded 84 | iny 85 | cpy #4 86 | bne !FourTileLoop- 87 | 88 | // FourTileLoop 89 | 90 | jsr NextColumn 91 | cpx #11 92 | bne TileColumnLoop 93 | 94 | // TileColumnLoop 95 | 96 | jsr NextRow 97 | 98 | 99 | cpx #11 100 | bne TileRowLoop 101 | 102 | // TileRowLoop 103 | 104 | 105 | rts 106 | 107 | NextColumn: 108 | 109 | clc 110 | lda Tile + 1 111 | adc #ONE 112 | sta Tile + 1 113 | lda Tile + 2 114 | adc #ZERO 115 | sta Tile + 2 116 | 117 | clc 118 | lda Screen + 1 119 | adc #2 120 | sta Screen + 1 121 | lda Screen + 2 122 | adc #0 123 | sta Screen + 2 124 | 125 | // move to the next screen row start address 126 | lda Colour + 1 127 | adc #2 128 | sta Colour + 1 129 | lda Colour + 2 130 | adc #0 131 | sta Colour + 2 132 | 133 | inc Column 134 | ldx Column 135 | rts 136 | 137 | 138 | NextRow: 139 | // move to the next screen row start address 140 | clc 141 | lda Screen + 1 142 | adc #22 143 | sta Screen + 1 144 | lda Screen + 2 145 | adc #0 146 | sta Screen + 2 147 | 148 | // move to the next screen row startaddress 149 | lda Colour + 1 150 | adc #22 151 | sta Colour + 1 152 | lda Colour + 2 153 | adc #0 154 | sta Colour + 2 155 | 156 | inc Row 157 | ldx Row 158 | 159 | rts 160 | 161 | 162 | } 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/pineapples.asm: -------------------------------------------------------------------------------- 1 | PINEAPPLE: { 2 | 3 | 4 | Position: .byte 0 5 | Positions: .byte 50, 51, 52, 53 6 | FallCountdown: .byte 0, 14 7 | EnemyHitPositions: .byte 98, 2, 10, 17 8 | EnemyKillPosition: .byte 0 9 | 10 | IsFalling: .byte 0 11 | 12 | .label GameTickAddOnHit = 15 13 | .label FirstCharacter = 105 14 | .label BlankCharacter = 0 15 | .label Column = 11 16 | .label NewPosition = TEMP1 17 | 18 | 19 | Reset:{ 20 | 21 | lda #ZERO 22 | sta Position 23 | sta IsFalling 24 | jsr Draw 25 | 26 | rts 27 | 28 | } 29 | 30 | 31 | StartFall:{ 32 | 33 | lda IsFalling 34 | bne Finish 35 | 36 | lda Position 37 | bne Finish 38 | 39 | lda #ONE 40 | sta IsFalling 41 | 42 | lda FallCountdown + 1 43 | sta FallCountdown 44 | 45 | 46 | Finish: 47 | 48 | rts 49 | 50 | } 51 | 52 | 53 | 54 | Update: { 55 | 56 | lda IsFalling 57 | beq Finish 58 | 59 | lda FallCountdown 60 | beq ReachedNextPosition 61 | 62 | dec FallCountdown 63 | jmp Finish 64 | 65 | 66 | ReachedNextPosition: 67 | 68 | jsr CheckPineappleHitEnemy 69 | jsr Delete 70 | inc Position 71 | lda Position 72 | cmp #4 73 | bcc StillFalling 74 | 75 | jmp EndFall 76 | 77 | StillFalling: 78 | jsr Draw 79 | jsr CheckPineappleHitEnemy 80 | 81 | lda FallCountdown + 1 82 | sta FallCountdown 83 | jmp Finish 84 | 85 | 86 | EndFall: 87 | 88 | lda #ZERO 89 | sta IsFalling 90 | 91 | Finish: 92 | 93 | rts 94 | 95 | 96 | 97 | } 98 | 99 | 100 | 101 | CheckPineappleHitEnemy: { 102 | 103 | ldy Position 104 | lda EnemyHitPositions, y 105 | sta EnemyKillPosition 106 | ldx #ZERO 107 | 108 | .label EnemyID = TEMP9 109 | 110 | EnemyLoop: 111 | 112 | stx EnemyID 113 | 114 | lda ENEMIES.Positions, x 115 | cmp EnemyKillPosition 116 | beq HitEnemy 117 | jmp EndLoop 118 | 119 | HitEnemy: 120 | 121 | lda MAIN.GameCounter 122 | adc #GameTickAddOnHit 123 | sta MAIN.GameCounter 124 | lda FallCountdown 125 | adc #GameTickAddOnHit 126 | sta FallCountdown 127 | 128 | lda ENEMIES.Positions, y 129 | tay 130 | lda ENEMY_SPRITEDATA.Rows, y 131 | tay 132 | 133 | jsr SCORE.HitEnemy 134 | lda #ZERO 135 | sta MONKEY.JumpedOverEnemy 136 | 137 | ldx EnemyID 138 | jsr ENEMIES.DespawnEnemy 139 | 140 | 141 | jmp Finish 142 | 143 | EndLoop: 144 | 145 | inx 146 | cpx #ENEMIES.MaxEnemies 147 | beq Finish 148 | 149 | jmp EnemyLoop 150 | 151 | Finish: 152 | 153 | rts 154 | } 155 | 156 | Draw:{ 157 | 158 | // Get screen address 159 | ldy Position 160 | lda Positions, y 161 | tax 162 | ldy #ONE 163 | jsr CHAR_DRAWING.ColourObject 164 | 165 | rts 166 | } 167 | 168 | 169 | Delete:{ 170 | 171 | // Get screen address 172 | ldy Position 173 | lda Positions, y 174 | tax 175 | ldy #ZERO 176 | jsr CHAR_DRAWING.ColourObject 177 | 178 | rts 179 | 180 | } 181 | 182 | 183 | 184 | 185 | 186 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/setup/maploader.asm: -------------------------------------------------------------------------------- 1 | MAPLOADER: { 2 | 3 | TileScreenLocations: 4 | .byte 0,1,40,41 5 | 6 | Column: 7 | .byte 0 8 | 9 | Row: 10 | .byte 0 11 | 12 | DrawMap: { 13 | 14 | // load first char address into first FEED 15 | lda #VIC.SCREEN_RAM 18 | sta Screen + 2 19 | 20 | // load first colour address into second FEED 21 | lda #VIC.COLOR_RAM 24 | sta Colour + 2 25 | 26 | lda #MAP 29 | sta Tile + 2 30 | 31 | lda #ZERO 32 | sta Row 33 | 34 | TileRowLoop: 35 | 36 | lda #ZERO 37 | sta Column 38 | 39 | TileColumnLoop: 40 | 41 | ldy #ZERO 42 | 43 | lda #ZERO 44 | sta TileLookup+1 45 | sta TileLookup+2 46 | 47 | Tile: 48 | 49 | lda $FEED 50 | sta TileLookup + 1 51 | asl TileLookup + 1 52 | rol TileLookup + 2 53 | asl TileLookup + 1 54 | rol TileLookup + 2 55 | 56 | clc 57 | lda #MAP_TILES 61 | adc TileLookup + 2 62 | sta TileLookup + 2 63 | 64 | 65 | !FourTileLoop: 66 | 67 | TileLookup: 68 | // load the map tile at position, offset 69 | lda $FEED,y 70 | ldx TileScreenLocations,y 71 | 72 | Screen: 73 | sta $FEED, x 74 | 75 | // load the character colour for same position 76 | tax 77 | lda CHAR_COLORS, x 78 | ldx TileScreenLocations, y 79 | 80 | Colour: 81 | sta $FEED, x 82 | 83 | //check whether all tiles loaded 84 | iny 85 | cpy #4 86 | bne !FourTileLoop- 87 | 88 | // FourTileLoop 89 | 90 | jsr NextColumn 91 | cpx #20 92 | bne TileColumnLoop 93 | 94 | // TileColumnLoop 95 | 96 | jsr NextRow 97 | 98 | 99 | cpx #12 100 | bne TileRowLoop 101 | 102 | // TileRowLoop 103 | 104 | 105 | rts 106 | 107 | NextColumn: 108 | 109 | clc 110 | lda Tile + 1 111 | adc #ONE 112 | sta Tile + 1 113 | lda Tile + 2 114 | adc #ZERO 115 | sta Tile + 2 116 | 117 | clc 118 | lda Screen + 1 119 | adc #2 120 | sta Screen + 1 121 | lda Screen + 2 122 | adc #0 123 | sta Screen + 2 124 | 125 | // move to the next screen row start address 126 | lda Colour + 1 127 | adc #2 128 | sta Colour + 1 129 | lda Colour + 2 130 | adc #0 131 | sta Colour + 2 132 | 133 | inc Column 134 | ldx Column 135 | rts 136 | 137 | 138 | NextRow: 139 | // move to the next screen row start address 140 | clc 141 | lda Screen + 1 142 | adc #40 143 | sta Screen + 1 144 | lda Screen + 2 145 | adc #0 146 | sta Screen + 2 147 | 148 | // move to the next screen row startaddress 149 | lda Colour + 1 150 | adc #40 151 | sta Colour + 1 152 | lda Colour + 2 153 | adc #0 154 | sta Colour + 2 155 | 156 | inc Row 157 | ldx Row 158 | 159 | rts 160 | 161 | 162 | } 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/pineapples.asm: -------------------------------------------------------------------------------- 1 | PINEAPPLE: { 2 | 3 | 4 | Position: .byte 0 5 | Positions: .byte 50, 51, 52, 53 6 | FallCountdown: .byte 0, 14 7 | EnemyHitPositions: .byte 98, 2, 10, 17 8 | EnemyKillPosition: .byte 0 9 | 10 | IsFalling: .byte 0 11 | 12 | .label GameTickAddOnHit = 15 13 | .label FirstCharacter = 105 14 | .label BlankCharacter = 0 15 | .label Column = 11 16 | .label NewPosition = TEMP1 17 | 18 | 19 | Reset:{ 20 | 21 | lda #ZERO 22 | sta Position 23 | sta IsFalling 24 | jsr Draw 25 | 26 | rts 27 | 28 | } 29 | 30 | 31 | StartFall:{ 32 | 33 | lda IsFalling 34 | bne Finish 35 | 36 | lda Position 37 | bne Finish 38 | 39 | lda #ONE 40 | sta IsFalling 41 | 42 | lda FallCountdown + 1 43 | sta FallCountdown 44 | 45 | 46 | Finish: 47 | 48 | rts 49 | 50 | } 51 | 52 | 53 | 54 | Update: { 55 | 56 | lda IsFalling 57 | beq Finish 58 | 59 | lda FallCountdown 60 | beq ReachedNextPosition 61 | 62 | dec FallCountdown 63 | jmp Finish 64 | 65 | 66 | ReachedNextPosition: 67 | 68 | jsr CheckPineappleHitEnemy 69 | jsr Delete 70 | inc Position 71 | lda Position 72 | cmp #4 73 | bcc StillFalling 74 | 75 | jmp EndFall 76 | 77 | StillFalling: 78 | jsr Draw 79 | jsr CheckPineappleHitEnemy 80 | 81 | lda FallCountdown + 1 82 | sta FallCountdown 83 | jmp Finish 84 | 85 | 86 | EndFall: 87 | 88 | lda #ZERO 89 | sta IsFalling 90 | 91 | Finish: 92 | 93 | rts 94 | 95 | 96 | 97 | } 98 | 99 | 100 | 101 | CheckPineappleHitEnemy: { 102 | 103 | ldy Position 104 | lda EnemyHitPositions, y 105 | sta EnemyKillPosition 106 | ldx #ZERO 107 | 108 | .label EnemyID = TEMP9 109 | 110 | EnemyLoop: 111 | 112 | stx EnemyID 113 | 114 | lda ENEMIES.Positions, x 115 | cmp EnemyKillPosition 116 | beq HitEnemy 117 | jmp EndLoop 118 | 119 | HitEnemy: 120 | 121 | lda MAIN.GameCounter 122 | adc #GameTickAddOnHit 123 | sta MAIN.GameCounter 124 | lda FallCountdown 125 | adc #GameTickAddOnHit 126 | sta FallCountdown 127 | 128 | lda ENEMIES.Positions, y 129 | tay 130 | lda ENEMY_SPRITEDATA.Rows, y 131 | tay 132 | 133 | jsr SCORE.HitEnemy 134 | lda #ZERO 135 | sta MONKEY.JumpedOverEnemy 136 | 137 | ldx EnemyID 138 | jsr ENEMIES.DespawnEnemy 139 | 140 | 141 | jmp Finish 142 | 143 | EndLoop: 144 | 145 | inx 146 | cpx #ENEMIES.MaxEnemies 147 | beq Finish 148 | 149 | jmp EnemyLoop 150 | 151 | Finish: 152 | 153 | rts 154 | } 155 | 156 | Draw:{ 157 | 158 | // Get screen address 159 | ldy Position 160 | lda Positions, y 161 | tax 162 | ldy #ONE 163 | jsr CHAR_DRAWING.ColourObject 164 | 165 | rts 166 | } 167 | 168 | 169 | Delete:{ 170 | 171 | // Get screen address 172 | ldy Position 173 | lda Positions, y 174 | tax 175 | ldy #ZERO 176 | jsr CHAR_DRAWING.ColourObject 177 | 178 | rts 179 | 180 | } 181 | 182 | 183 | 184 | 185 | 186 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/pineapples.asm: -------------------------------------------------------------------------------- 1 | PINEAPPLE: { 2 | 3 | 4 | Position: .byte 0 5 | Positions: .byte 50, 51, 52, 53 6 | FallCountdown: .byte 0, 14 7 | EnemyHitPositions: .byte 98, 2, 10, 17 8 | EnemyKillPosition: .byte 0 9 | 10 | IsFalling: .byte 0 11 | 12 | .label GameTickAddOnHit = 15 13 | .label FirstCharacter = 105 14 | .label BlankCharacter = 0 15 | .label Column = 11 16 | .label NewPosition = TEMP1 17 | 18 | 19 | Reset:{ 20 | 21 | lda #ZERO 22 | sta Position 23 | sta IsFalling 24 | jsr Draw 25 | 26 | rts 27 | 28 | } 29 | 30 | 31 | StartFall:{ 32 | 33 | lda IsFalling 34 | bne Finish 35 | 36 | lda Position 37 | bne Finish 38 | 39 | lda #ONE 40 | sta IsFalling 41 | 42 | lda FallCountdown + 1 43 | sta FallCountdown 44 | 45 | 46 | Finish: 47 | 48 | rts 49 | 50 | } 51 | 52 | 53 | 54 | Update: { 55 | 56 | lda IsFalling 57 | beq Finish 58 | 59 | lda FallCountdown 60 | beq ReachedNextPosition 61 | 62 | dec FallCountdown 63 | jmp Finish 64 | 65 | 66 | ReachedNextPosition: 67 | 68 | jsr CheckPineappleHitEnemy 69 | jsr Delete 70 | inc Position 71 | lda Position 72 | cmp #4 73 | bcc StillFalling 74 | 75 | jmp EndFall 76 | 77 | StillFalling: 78 | jsr Draw 79 | jsr CheckPineappleHitEnemy 80 | 81 | lda FallCountdown + 1 82 | sta FallCountdown 83 | jmp Finish 84 | 85 | 86 | EndFall: 87 | 88 | lda #ZERO 89 | sta IsFalling 90 | 91 | Finish: 92 | 93 | rts 94 | 95 | 96 | 97 | } 98 | 99 | 100 | 101 | CheckPineappleHitEnemy: { 102 | 103 | ldy Position 104 | lda EnemyHitPositions, y 105 | sta EnemyKillPosition 106 | ldx #ZERO 107 | 108 | .label EnemyID = TEMP9 109 | 110 | EnemyLoop: 111 | 112 | stx EnemyID 113 | 114 | lda ENEMIES.Positions, x 115 | cmp EnemyKillPosition 116 | beq HitEnemy 117 | jmp EndLoop 118 | 119 | HitEnemy: 120 | 121 | lda MAIN.GameCounter 122 | adc #GameTickAddOnHit 123 | sta MAIN.GameCounter 124 | lda FallCountdown 125 | adc #GameTickAddOnHit 126 | sta FallCountdown 127 | 128 | lda ENEMIES.Positions, y 129 | tay 130 | lda ENEMY_SPRITEDATA.Rows, y 131 | tay 132 | 133 | 134 | 135 | jsr SCORE.HitEnemy 136 | lda #ZERO 137 | sta MONKEY.JumpedOverEnemy 138 | 139 | ldx EnemyID 140 | jsr ENEMIES.DespawnEnemy 141 | 142 | 143 | jmp Finish 144 | 145 | EndLoop: 146 | 147 | inx 148 | cpx #ENEMIES.MaxEnemies 149 | beq Finish 150 | 151 | jmp EnemyLoop 152 | 153 | Finish: 154 | 155 | rts 156 | } 157 | 158 | Draw:{ 159 | 160 | // Get screen address 161 | ldy Position 162 | lda Positions, y 163 | tax 164 | ldy #ONE 165 | jsr CHAR_DRAWING.ColourObject 166 | 167 | rts 168 | } 169 | 170 | 171 | Delete:{ 172 | 173 | // Get screen address 174 | ldy Position 175 | lda Positions, y 176 | tax 177 | ldy #ZERO 178 | jsr CHAR_DRAWING.ColourObject 179 | 180 | rts 181 | 182 | } 183 | 184 | 185 | 186 | 187 | 188 | } -------------------------------------------------------------------------------- /vic20/scripts/setup/titleLoader.asm: -------------------------------------------------------------------------------- 1 | TITLELOADER: { 2 | 3 | TileScreenLocations: 4 | .byte 0,1,22,23 5 | 6 | Column: 7 | .byte 0 8 | 9 | Row: 10 | .byte 0 11 | 12 | DrawMap: { 13 | 14 | // load first char address into first FEED 15 | lda #VIC.SCREEN_RAM 18 | sta Screen + 2 19 | 20 | // load first colour address into second FEED 21 | lda #VIC.COLOR_RAM 24 | sta Colour + 2 25 | 26 | lda #TITLE_MAP 29 | sta Tile + 2 30 | 31 | lda #ZERO 32 | sta Row 33 | 34 | TileRowLoop: 35 | 36 | lda #ZERO 37 | sta Column 38 | 39 | TileColumnLoop: 40 | 41 | ldy #ZERO 42 | 43 | lda #ZERO 44 | sta TileLookup+1 45 | sta TileLookup+2 46 | 47 | Tile: 48 | 49 | lda $FEED 50 | sta TileLookup + 1 51 | asl TileLookup + 1 52 | rol TileLookup + 2 53 | asl TileLookup + 1 54 | rol TileLookup + 2 55 | 56 | clc 57 | lda #TITLE_MAP_TILES 61 | adc TileLookup + 2 62 | sta TileLookup + 2 63 | 64 | 65 | !FourTileLoop: 66 | 67 | TileLookup: 68 | // load the map tile at position, offset 69 | lda $FEED,y 70 | ldx TileScreenLocations,y 71 | 72 | Screen: 73 | sta $FEED, x 74 | 75 | // load the character colour for same position 76 | tax 77 | lda TITLE_CHAR_COLORS, x 78 | ldx TileScreenLocations, y 79 | 80 | Colour: 81 | sta $FEED, x 82 | 83 | //check whether all tiles loaded 84 | iny 85 | cpy #4 86 | bne !FourTileLoop- 87 | 88 | // FourTileLoop 89 | 90 | jsr NextColumn 91 | cpx #11 92 | bne TileColumnLoop 93 | 94 | // TileColumnLoop 95 | 96 | jsr NextRow 97 | 98 | 99 | cpx #11 100 | bne TileRowLoop 101 | 102 | // TileRowLoop 103 | 104 | 105 | rts 106 | 107 | NextColumn: 108 | 109 | clc 110 | lda Tile + 1 111 | adc #ONE 112 | sta Tile + 1 113 | lda Tile + 2 114 | adc #ZERO 115 | sta Tile + 2 116 | 117 | clc 118 | lda Screen + 1 119 | adc #2 120 | sta Screen + 1 121 | lda Screen + 2 122 | adc #0 123 | sta Screen + 2 124 | 125 | // move to the next screen row start address 126 | lda Colour + 1 127 | adc #2 128 | sta Colour + 1 129 | lda Colour + 2 130 | adc #0 131 | sta Colour + 2 132 | 133 | inc Column 134 | ldx Column 135 | rts 136 | 137 | 138 | NextRow: 139 | // move to the next screen row start address 140 | clc 141 | lda Screen + 1 142 | adc #22 143 | sta Screen + 1 144 | lda Screen + 2 145 | adc #0 146 | sta Screen + 2 147 | 148 | // move to the next screen row startaddress 149 | lda Colour + 1 150 | adc #22 151 | sta Colour + 1 152 | lda Colour + 2 153 | adc #0 154 | sta Colour + 2 155 | 156 | inc Row 157 | ldx Row 158 | 159 | rts 160 | 161 | 162 | } 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/setup/titleLoader.asm: -------------------------------------------------------------------------------- 1 | TITLELOADER: { 2 | 3 | TileScreenLocations: 4 | .byte 0,1,40,41 5 | 6 | Column: 7 | .byte 0 8 | 9 | Row: 10 | .byte 0 11 | 12 | DrawMap: { 13 | 14 | // load first char address into first FEED 15 | lda #VIC.SCREEN_RAM 18 | sta Screen + 2 19 | 20 | // load first colour address into second FEED 21 | lda #VIC.COLOR_RAM 24 | sta Colour + 2 25 | 26 | lda #TITLE_MAP 29 | sta Tile + 2 30 | 31 | lda #ZERO 32 | sta Row 33 | 34 | TileRowLoop: 35 | 36 | lda #ZERO 37 | sta Column 38 | 39 | TileColumnLoop: 40 | 41 | ldy #ZERO 42 | 43 | lda #ZERO 44 | sta TileLookup+1 45 | sta TileLookup+2 46 | 47 | Tile: 48 | 49 | lda $FEED 50 | sta TileLookup + 1 51 | asl TileLookup + 1 52 | rol TileLookup + 2 53 | asl TileLookup + 1 54 | rol TileLookup + 2 55 | 56 | clc 57 | lda #TITLE_MAP_TILES 61 | adc TileLookup + 2 62 | sta TileLookup + 2 63 | 64 | 65 | !FourTileLoop: 66 | 67 | TileLookup: 68 | // load the map tile at position, offset 69 | lda $FEED,y 70 | ldx TileScreenLocations,y 71 | 72 | Screen: 73 | sta $FEED, x 74 | 75 | // load the character colour for same position 76 | tax 77 | lda TITLE_CHAR_COLORS, x 78 | ldx TileScreenLocations, y 79 | 80 | Colour: 81 | sta $FEED, x 82 | 83 | //check whether all tiles loaded 84 | iny 85 | cpy #4 86 | bne !FourTileLoop- 87 | 88 | // FourTileLoop 89 | 90 | jsr NextColumn 91 | cpx #20 92 | bne TileColumnLoop 93 | 94 | // TileColumnLoop 95 | 96 | jsr NextRow 97 | 98 | 99 | cpx #12 100 | bne TileRowLoop 101 | 102 | // TileRowLoop 103 | 104 | 105 | rts 106 | 107 | NextColumn: 108 | 109 | clc 110 | lda Tile + 1 111 | adc #ONE 112 | sta Tile + 1 113 | lda Tile + 2 114 | adc #ZERO 115 | sta Tile + 2 116 | 117 | clc 118 | lda Screen + 1 119 | adc #2 120 | sta Screen + 1 121 | lda Screen + 2 122 | adc #0 123 | sta Screen + 2 124 | 125 | // move to the next screen row start address 126 | lda Colour + 1 127 | adc #2 128 | sta Colour + 1 129 | lda Colour + 2 130 | adc #0 131 | sta Colour + 2 132 | 133 | inc Column 134 | ldx Column 135 | rts 136 | 137 | 138 | NextRow: 139 | // move to the next screen row start address 140 | clc 141 | lda Screen + 1 142 | adc #40 143 | sta Screen + 1 144 | lda Screen + 2 145 | adc #0 146 | sta Screen + 2 147 | 148 | // move to the next screen row startaddress 149 | lda Colour + 1 150 | adc #40 151 | sta Colour + 1 152 | lda Colour + 2 153 | adc #0 154 | sta Colour + 2 155 | 156 | inc Row 157 | ldx Row 158 | 159 | rts 160 | 161 | 162 | } 163 | 164 | 165 | 166 | 167 | } -------------------------------------------------------------------------------- /scripts/lookups/sid.asm: -------------------------------------------------------------------------------- 1 | SID:{ 2 | 3 | .label VOICE_1_FREQUENCY = $d400 // & $d401 4 | .label VOICE_1_PULSE_WIDTH = $d402 // & $d403 5 | .label VOICE_1_CONTROL = $d404 // Noise, Rect, Saw, Tri, Reset, Ring, Sync, On/off 6 | .label VOICE_1_ATTDEC = $d405 // Attack 4-bits Decay 4-bits 7 | .label VOICE_1_SUSTAIN = $d406 // Volume 4-bits Release 4-bits 8 | .label VOLUME_FILTER = $d418 9 | 10 | .label VOICE_2_FREQUENCY = $d407 // & $d401 11 | .label VOICE_2_PULSE_WIDTH = $d409 // & $d403 12 | .label VOICE_2_CONTROL = $d40b // Noise, Rect, Saw, Tri, Reset, Ring, Sync, On/off 13 | .label VOICE_2_ATTDEC = $d40c // Attack 4-bits Decay 4-bits 14 | .label VOICE_2_SUSTAIN = $d40d // Volume 4-bits Release 4-bits 15 | 16 | .label VOICE_3_FREQUENCY = $d40e // & $d401 17 | .label VOICE_3_PULSE_WIDTH = $d410 // & $d403 18 | .label VOICE_3_CONTROL = $d412 // Noise, Rect, Saw, Tri, Reset, Ring, Sync, On/off 19 | .label VOICE_3_ATTDEC = $d413 // Attack 4-bits Decay 4-bits 20 | .label VOICE_3_SUSTAIN = $d414 // Volume 4-bits Release 4-bits 21 | 22 | 23 | Initialise:{ 24 | 25 | 26 | 27 | ldx #$00 28 | lda #$00 29 | clearsidloop: 30 | // SID registers start at $d400 31 | sta $d400 32 | inc clearsidloop+1 33 | inx 34 | cpx #$29 // and there are 29 of them 35 | bne clearsidloop 36 | 37 | // set master volume and turn filter off 38 | 39 | 40 | lda #%00001111 41 | sta VOLUME_FILTER 42 | 43 | 44 | lda #%00000111 45 | sta VOICE_1_FREQUENCY 46 | lda #%00111111 47 | sta VOICE_1_FREQUENCY + 1 48 | 49 | lda #%11111111 50 | sta VOICE_2_FREQUENCY 51 | lda #%11111111 52 | sta VOICE_2_FREQUENCY + 1 53 | 54 | lda #%00000111 55 | sta VOICE_3_FREQUENCY 56 | lda #%00001111 57 | sta VOICE_3_FREQUENCY + 1 58 | 59 | } 60 | 61 | ScoreSound:{ 62 | 63 | lda #%00000111 64 | sta VOICE_1_FREQUENCY 65 | lda #%11111111 66 | sta VOICE_1_FREQUENCY + 1 67 | 68 | jsr PlayChannel_1 69 | 70 | rts 71 | 72 | 73 | } 74 | 75 | DieSound:{ 76 | 77 | 78 | lda #%00100001 79 | sta VOICE_3_CONTROL 80 | 81 | lda #%00000000 82 | sta VOICE_3_ATTDEC 83 | 84 | lda #%00000100 85 | sta VOICE_3_SUSTAIN 86 | 87 | nop 88 | nop 89 | nop 90 | 91 | lda #%00100000 92 | sta VOICE_3_CONTROL 93 | 94 | rts 95 | } 96 | 97 | TickSound:{ 98 | 99 | lda #%01000001 100 | sta VOICE_2_CONTROL 101 | 102 | lda #%00000000 103 | sta VOICE_2_ATTDEC 104 | 105 | lda #%00000001 106 | sta VOICE_2_SUSTAIN 107 | 108 | lda #%00100000 109 | sta VOICE_2_CONTROL 110 | 111 | rts 112 | 113 | 114 | } 115 | 116 | 117 | PlayChannel_1:{ 118 | 119 | lda #%00100001 120 | sta VOICE_1_CONTROL 121 | 122 | lda #%00000000 123 | sta VOICE_1_ATTDEC 124 | 125 | lda #%00000100 126 | sta VOICE_1_SUSTAIN 127 | 128 | lda #%00001111 129 | sta VOLUME_FILTER 130 | 131 | 132 | lda #%00100000 133 | sta VOICE_1_CONTROL 134 | 135 | rts 136 | 137 | } 138 | 139 | MoveMonkey:{ 140 | 141 | lda #%00000111 142 | sta VOICE_1_FREQUENCY 143 | lda #%00111111 144 | sta VOICE_1_FREQUENCY + 1 145 | 146 | jsr PlayChannel_1 147 | 148 | 149 | 150 | rts 151 | 152 | } 153 | 154 | 155 | 156 | 157 | } -------------------------------------------------------------------------------- /scripts/lookups/vic.asm: -------------------------------------------------------------------------------- 1 | VIC: { 2 | 3 | ScreenRowLSB: 4 | .fill 25, <[SCREEN_RAM + i * $28] 5 | ScreenRowMSB: 6 | .fill 25, >[SCREEN_RAM + i * $28] 7 | 8 | .label SPRITE_0_X = $d000 9 | .label SPRITE_0_Y = $d001 10 | 11 | .label SPRITE_1_X = $d002 12 | .label SPRITE_1_Y = $d003 13 | 14 | .label SPRITE_2_X = $d004 15 | .label SPRITE_2_Y = $d005 16 | 17 | .label SPRITE_3_X = $d006 18 | .label SPRITE_3_Y = $d007 19 | 20 | .label SPRITE_4_X = $d008 21 | .label SPRITE_4_Y = $d009 22 | 23 | .label SPRITE_5_X = $d00a 24 | .label SPRITE_5_Y = $d00b 25 | 26 | .label SPRITE_6_X = $d00c 27 | .label SPRITE_6_Y = $d00d 28 | 29 | .label SPRITE_7_X = $d00e 30 | .label SPRITE_7_Y = $d00f 31 | 32 | .label SPRITE_MSB = $d010 33 | 34 | .label RASTER_Y = $d012 35 | 36 | .label SPRITE_ENABLE = $d015 37 | .label SCREEN_CONTROL_2 = $d016 38 | 39 | .label VIC_BANK_SELECT = $dd00 40 | 41 | .label SCREEN_CONTROL = $d011 42 | .label MEMORY_SETUP = $d018 43 | 44 | .label INTERRUPT_CONTROL = $d01a 45 | .label INTERRUPT_STATUS = $d019 46 | 47 | .label SPRITE_MULTICOLOR = $d01c 48 | 49 | .label BORDER_COLOR = $d020 50 | .label BACKGROUND_COLOR = $d021 51 | .label EXTENDED_BG_COLOR_1 = $d022 52 | .label EXTENDED_BG_COLOR_2 = $d023 53 | 54 | .label SPRITE_MULTICOLOR_1 = $d025 55 | .label SPRITE_MULTICOLOR_2 = $d026 56 | 57 | .label SPRITE_COLOR_0 = $d027 58 | .label SPRITE_COLOR_1 = $d028 59 | .label SPRITE_COLOR_2 = $d029 60 | .label SPRITE_COLOR_3 = $d02a 61 | .label SPRITE_COLOR_4 = $d02b 62 | .label SPRITE_COLOR_5 = $d02c 63 | .label SPRITE_COLOR_6 = $d02d 64 | .label SPRITE_COLOR_7 = $d02e 65 | 66 | .label COLOR_RAM = $d800 67 | 68 | 69 | 70 | SetupRegisters: { 71 | 72 | lda #ALL_ON 73 | sta SPRITE_ENABLE 74 | //sta VIC.SPRITE_MULTICOLOR 75 | 76 | //Set VIC BANK 3, last two bits = 00 77 | lda VIC_BANK_SELECT 78 | and #%11111100 79 | sta VIC_BANK_SELECT 80 | 81 | //Set screen and character memory 82 | lda #%00001100 83 | sta MEMORY_SETUP 84 | 85 | // multicolour mode on 86 | lda SCREEN_CONTROL_2 87 | and #%11101111 88 | ora #%00010000 89 | sta SCREEN_CONTROL_2 90 | 91 | rts 92 | 93 | } 94 | 95 | ColourLastRow: { 96 | 97 | 98 | 99 | .label COLOR_ADDRESS = VECTOR4 100 | .label SCREEN_ADDRESS = VECTOR5 101 | 102 | ldy #24 103 | lda ScreenRowLSB, y 104 | clc 105 | adc #ZERO 106 | sta SCREEN_ADDRESS 107 | sta $d020 108 | sta COLOR_ADDRESS 109 | 110 | lda ScreenRowMSB, y 111 | adc #ZERO 112 | sta SCREEN_ADDRESS + 1 113 | 114 | // Calculate colour ram address 115 | adc #>[COLOR_RAM-SCREEN_RAM] 116 | sta COLOR_ADDRESS +1 117 | 118 | ldy #ZERO 119 | 120 | Loop: 121 | 122 | lda #5 123 | sta (SCREEN_ADDRESS), y 124 | lda #0 125 | sta (COLOR_ADDRESS), y 126 | 127 | cpy #39 128 | beq Finish 129 | iny 130 | jmp Loop 131 | 132 | Finish: 133 | 134 | rts 135 | 136 | } 137 | 138 | SetupColours: 139 | 140 | lda #CYAN 141 | sta VIC.BACKGROUND_COLOR 142 | lda #BLACK 143 | sta VIC.BORDER_COLOR 144 | 145 | lda #LIGHT_GREEN 146 | sta VIC.EXTENDED_BG_COLOR_1 147 | lda #GREEN 148 | sta VIC.EXTENDED_BG_COLOR_2 149 | 150 | 151 | rts 152 | 153 | } 154 | 155 | 156 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/bin/plus4_ViceLog.txt: -------------------------------------------------------------------------------- 1 | 2 | *** VICE Version 3.3, rev 37130M *** 3 | 4 | Welcome to x64, the free portable PLUS4 Emulator. 5 | 6 | Current VICE team members: 7 | Marco van den Heuvel, Fabrizio Gennari, Groepaz, Errol Smith, Olaf Seibert, 8 | Marcus Sutton, Kajtar Zsolt, AreaScout, Bas Wassink, Michael C. Martin, 9 | David Hogan. 10 | 11 | This is free software with ABSOLUTELY NO WARRANTY. 12 | See the "About VICE" command for more info. 13 | 14 | Loading system file `C:\C64\Tools\Vice\PLUS4\kernal'. 15 | Loading system file `C:\C64\Tools\Vice\PLUS4\basic'. 16 | Loading system file `C:\C64\Tools\Vice\PRINTER\mps803'. 17 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\mps803.vpl'. 18 | Loading system file `C:\C64\Tools\Vice\PRINTER\nl10-cbm'. 19 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\nl10.vpl'. 20 | NL10: Printer driver initialized. 21 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\1520.vpl'. 22 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1540'. 23 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1541'. 24 | Loading system file `C:\C64\Tools\Vice\DRIVES\d1541II'. 25 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1570'. 26 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1571'. 27 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1581'. 28 | DriveROM: Error - 2000 ROM image not found. Hardware-level 2000 emulation is not available. 29 | DriveROM: Error - 4000 ROM image not found. Hardware-level 4000 emulation is not available. 30 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1551'. 31 | Drive: Finished loading ROM images. 32 | Sound: Available sound devices: dx wmm dummy fs dump wav voc iff aiff flac ogg soundmovie 33 | using GTK3 backend: OpenGL 34 | Creating GtkGlArea widget. 35 | Warning - GTKGL: OpenGL version 3.2 not supported in this context 36 | GdkGlkContext is in legacy (OpenGL 1.1) mode. 37 | Palette: Loading palette `C:\C64\Tools\Vice\PLUS4\colodore_ted.vpl'. 38 | Keyboard: Loading keymap `C:\C64\Tools\Vice\PLUS4\gtk3_sym.vkm'. 39 | Keyboard: Warning - gtk3_sym.vkm:144: !RSHIFT defined but key does not use SHIFT flag 40 | Keyboard: Warning - gtk3_sym.vkm:145: !RSHIFT defined but key does not use SHIFT flag 41 | Keyboard: Warning - gtk3_sym.vkm:233: !RSHIFT defined but key does not use SHIFT flag 42 | Keyboard: Warning - gtk3_sym.vkm:235: !RSHIFT defined but key does not use SHIFT flag 43 | Keyboard: Warning - gtk3_sym.vkm: !LCBM !VCBM !LCTRL !VCTRL !SHIFTLnot defined. 44 | AUTOSTART: Autodetecting image type of `bin/plus4.prg'. 45 | Filesystem Image Probe: Error - Import GCR: Unknown GCR image version 52. 46 | Filesystem Image: Unknown disk image `bin/plus4.prg'. 47 | Tape: Error - Cannot open file `bin/plus4.prg' 48 | AUTOSTART: Loading PRG file `bin/plus4.prg' with direct RAM injection. 49 | AUTOSTART: Resetting the machine to autostart '*' 50 | Sound: Opened device `dx', speed 44100Hz, fragment size fms, buffer size 101ms 51 | reSID: MOS6581, filter on, sampling rate 44100Hz - resampling, pass to 19845Hz 52 | AUTOSTART: Turning Warp mode on 53 | AUTOSTART: `bin/plus4.prg' recognized as program/p00 file. 54 | Main CPU: starting at ($FFFC). 55 | Main CPU: RESET. 56 | RS232DEV: rs232dev_set_status: rts:off dtr:off 57 | RS232DEV: rs232dev_set_bps: bps: 10 58 | Drive 8: RESET. 59 | AUTOSTART: Injecting program data at $1000 (size $29bc) 60 | AUTOSTART: Ready 61 | AUTOSTART: Turning Warp mode off 62 | AUTOSTART: Starting program. 63 | Skip line 312 312 64 | AUTOSTART: Done. 65 | Writing configuration file `C:\Users\Nick\AppData\Roaming\vice\vice.ini'. 66 | 67 | Exiting... 68 | Sound: Closing device `dx' 69 | -------------------------------------------------------------------------------- /vic20/scripts/bin/gameVIC_ViceLog.txt: -------------------------------------------------------------------------------- 1 | 2 | *** VICE Version 3.3, rev 37130M *** 3 | 4 | Welcome to x64, the free portable VIC20 Emulator. 5 | 6 | Current VICE team members: 7 | Marco van den Heuvel, Fabrizio Gennari, Groepaz, Errol Smith, Olaf Seibert, 8 | Marcus Sutton, Kajtar Zsolt, AreaScout, Bas Wassink, Michael C. Martin, 9 | David Hogan. 10 | 11 | This is free software with ABSOLUTELY NO WARRANTY. 12 | See the "About VICE" command for more info. 13 | 14 | Loading system file `C:\C64\Tools\Vice\VIC20\kernal'. 15 | Loading system file `C:\C64\Tools\Vice\VIC20\basic'. 16 | Loading system file `C:\C64\Tools\Vice\VIC20\chargen'. 17 | VIC20 kernal patched to 901486-07. 18 | Loading system file `C:\C64\Tools\Vice\PRINTER\mps803'. 19 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\mps803.vpl'. 20 | Loading system file `C:\C64\Tools\Vice\PRINTER\nl10-cbm'. 21 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\nl10.vpl'. 22 | NL10: Printer driver initialized. 23 | Palette: Loading palette `C:\C64\Tools\Vice\PRINTER\1520.vpl'. 24 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1540'. 25 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1541'. 26 | Loading system file `C:\C64\Tools\Vice\DRIVES\d1541II'. 27 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1570'. 28 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1571'. 29 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1581'. 30 | DriveROM: Error - 2000 ROM image not found. Hardware-level 2000 emulation is not available. 31 | DriveROM: Error - 4000 ROM image not found. Hardware-level 4000 emulation is not available. 32 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos2031'. 33 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos2040'. 34 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos3040'. 35 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos4040'. 36 | Loading system file `C:\C64\Tools\Vice\DRIVES\dos1001'. 37 | Drive: Finished loading ROM images. 38 | using GTK3 backend: OpenGL 39 | Creating GtkGlArea widget. 40 | Warning - GTKGL: OpenGL version 3.2 not supported in this context 41 | GdkGlkContext is in legacy (OpenGL 1.1) mode. 42 | Palette: Loading palette `C:\C64\Tools\Vice\VIC20\colodore_vic.vpl'. 43 | Sound: Available sound devices: dx wmm dummy fs dump wav voc iff aiff flac ogg soundmovie 44 | EthernetARCH: LoadLibrary WPCAP.DLL failed! 45 | Keyboard: Loading keymap `C:\C64\Tools\Vice\VIC20\gtk3_sym.vkm'. 46 | Keyboard: Warning - gtk3_sym.vkm: !LCBM !VCBM !LCTRL !VCTRL !SHIFTLnot defined. 47 | AUTOSTART: Autodetecting image type of `bin/gameVIC.prg'. 48 | Filesystem Image Probe: Error - Import GCR: Unknown GCR image version 52. 49 | Filesystem Image: Unknown disk image `bin/gameVIC.prg'. 50 | Tape: Error - Cannot open file `bin/gameVIC.prg' 51 | AUTOSTART: Loading PRG file `bin/gameVIC.prg' with direct RAM injection. 52 | AUTOSTART: Resetting the machine to autostart '*' 53 | AUTOSTART: Turning Warp mode on 54 | AUTOSTART: `bin/gameVIC.prg' recognized as program/p00 file. 55 | Main CPU: starting at ($FFFC). 56 | Main CPU: RESET. 57 | Drive 8: RESET. 58 | Palette: Loading palette `C:\C64\Tools\Vice\VIC20\colodore_vic.vpl'. 59 | Drive 8: RESET. 60 | Sound: Opened device `dx', speed 44100Hz, fragment size fms, buffer size 101ms 61 | reSID: MOS6581, filter on, sampling rate 44100Hz - resampling, pass to 19845Hz 62 | AUTOSTART: Injecting program data at $1200 (size $328e) 63 | AUTOSTART: Ready 64 | AUTOSTART: Turning Warp mode off 65 | AUTOSTART: Starting program. 66 | AUTOSTART: Done. 67 | Writing configuration file `C:\Users\Nick\AppData\Roaming\vice\vice.ini'. 68 | 69 | Exiting... 70 | Sound: Closing device `dx' 71 | -------------------------------------------------------------------------------- /scripts/interrupts/pineapple.asm: -------------------------------------------------------------------------------- 1 | PINEAPPLE: { 2 | 3 | 4 | Position: .byte 0 5 | Rows: .byte 7, 11, 15, 19 6 | FallCountdown: .byte 0, 18 7 | EnemyHitPositions: .byte 98, 2, 10, 17 8 | EnemyKillPosition: .byte 0 9 | 10 | .label GameTickAddOnHit = 15 11 | .label FirstCharacter = 251 12 | .label BlankCharacter = 0 13 | .label Column = 20 14 | .label SCREEN_ADDRESS = VECTOR4 15 | .label COLOR_ADDRESS = VECTOR5 16 | .label NewPosition = TEMP1 17 | 18 | 19 | Reset:{ 20 | 21 | ldx #ZERO 22 | stx Position 23 | jsr Draw 24 | rts 25 | 26 | } 27 | 28 | Update:{ 29 | 30 | //c $d020 31 | 32 | lda FallCountdown 33 | beq Finish 34 | 35 | dec FallCountdown 36 | bne Finish 37 | 38 | jsr Delete 39 | 40 | inx 41 | cpx #4 42 | beq HitGround 43 | 44 | jsr StartFall 45 | jsr MovePineapple 46 | 47 | 48 | HitGround: 49 | 50 | 51 | Finish: 52 | rts 53 | 54 | } 55 | 56 | 57 | StartFall:{ 58 | 59 | lda Position 60 | cmp #4 61 | beq NoFall 62 | 63 | lda FallCountdown + 1 64 | sta FallCountdown 65 | 66 | NoFall: 67 | 68 | rts 69 | 70 | } 71 | 72 | CalculateAddresses:{ 73 | 74 | //get row for this position 75 | ldy Rows, x 76 | 77 | // Get CharAddress 78 | lda VIC.ScreenRowLSB, y 79 | clc 80 | adc #Column 81 | sta SCREEN_ADDRESS 82 | sta COLOR_ADDRESS 83 | 84 | lda VIC.ScreenRowMSB, y 85 | adc #$00 86 | sta SCREEN_ADDRESS + 1 87 | 88 | // Calculate colour ram address 89 | adc #>[VIC.COLOR_RAM-SCREEN_RAM] 90 | sta COLOR_ADDRESS +1 91 | 92 | rts 93 | 94 | } 95 | 96 | MovePineapple:{ 97 | 98 | stx NewPosition 99 | cpx Position 100 | 101 | beq DontDelete 102 | 103 | jsr Delete 104 | 105 | DontDelete: 106 | 107 | ldx NewPosition 108 | stx Position 109 | jsr Draw 110 | jsr CheckPineappleHitEnemy 111 | rts 112 | 113 | } 114 | 115 | 116 | CheckPineappleHitEnemy: { 117 | 118 | ldy Position 119 | lda EnemyHitPositions, y 120 | sta EnemyKillPosition 121 | ldx #ZERO 122 | 123 | EnemyLoop: 124 | 125 | lda ENEMIES.Positions, x 126 | cmp EnemyKillPosition 127 | beq HitEnemy 128 | jmp EndLoop 129 | 130 | HitEnemy: 131 | 132 | lda MAIN.GameCounter 133 | adc #GameTickAddOnHit 134 | sta MAIN.GameCounter 135 | lda FallCountdown 136 | adc #GameTickAddOnHit 137 | sta FallCountdown 138 | 139 | jsr ENEMIES.DespawnEnemy 140 | 141 | txa 142 | tay 143 | ldx ENEMIES.Positions, y 144 | tya 145 | ldy ENEMY_SPRITEDATA.Rows, x 146 | tax 147 | 148 | jsr SCORE.HitEnemy 149 | clc 150 | 151 | jmp Finish 152 | 153 | EndLoop: 154 | 155 | inx 156 | cpx #ENEMIES.MaxEnemies 157 | beq Finish 158 | 159 | jmp EnemyLoop 160 | 161 | Finish: 162 | 163 | rts 164 | } 165 | 166 | Draw:{ 167 | 168 | // Get screen address 169 | ldx Position 170 | jsr CalculateAddresses 171 | 172 | // store character at address 173 | lda #FirstCharacter 174 | adc Position 175 | ldy #ZERO 176 | sta (SCREEN_ADDRESS), y 177 | 178 | lda #PURPLE 179 | sta (COLOR_ADDRESS), y 180 | 181 | rts 182 | } 183 | 184 | 185 | Delete:{ 186 | 187 | // Get screen position 188 | ldx Position 189 | jsr CalculateAddresses 190 | 191 | lda #BlankCharacter 192 | ldy #ZERO 193 | sta (SCREEN_ADDRESS), y 194 | 195 | rts 196 | 197 | } 198 | 199 | 200 | 201 | 202 | 203 | } -------------------------------------------------------------------------------- /scripts/interrupts/irq.asm: -------------------------------------------------------------------------------- 1 | 2 | IRQ: { 3 | 4 | .label IRQControlRegister1 = $dc0d 5 | .label IRQControlRegister2 = $dd0d 6 | 7 | .label Snapper1RasterLine = 130 8 | .label BirdRasterLine = 160 9 | .label Snapper2RasterLine = 197 10 | 11 | 12 | 13 | 14 | DisableCIA: { 15 | 16 | // prevent CIA interrupts now the kernal is banked out 17 | lda #$7f 18 | sta IRQControlRegister1 19 | sta IRQControlRegister2 20 | 21 | rts 22 | 23 | } 24 | 25 | 26 | SetupInterrupts: { 27 | 28 | sei // disable interrupt flag 29 | lda VIC.INTERRUPT_CONTROL 30 | ora #%00000001 // turn on raster interrupts 31 | sta VIC.INTERRUPT_CONTROL 32 | 33 | lda #KeyCageMonkeyIRQ 35 | ldy #1 36 | jsr SetNextInterrupt 37 | 38 | asl VIC.INTERRUPT_STATUS 39 | cli 40 | 41 | rts 42 | 43 | 44 | } 45 | 46 | 47 | 48 | SetNextInterrupt: { 49 | 50 | sta REGISTERS.RASTER_INTERRUPT_VECTOR 51 | stx REGISTERS.RASTER_INTERRUPT_VECTOR + 1 52 | sty VIC.RASTER_Y 53 | lda VIC.SCREEN_CONTROL 54 | and #%01111111 // don't use 255+ 55 | sta VIC.SCREEN_CONTROL 56 | 57 | rts 58 | } 59 | 60 | 61 | 62 | Snapper1IRQ: { 63 | 64 | 65 | 66 | :StoreState() 67 | 68 | //dec $d020 69 | 70 | ldy #2 71 | jsr ENEMIES.DrawEnemiesForRow 72 | 73 | clc 74 | dec MAIN.GameCounter 75 | bne NotYet 76 | 77 | lda MAIN.GameCounter + 1 78 | sta MAIN.GameCounter 79 | asl 80 | sta MONKEY.DropTime 81 | lda #ONE 82 | sta MAIN.GameTickFlag 83 | 84 | NotYet: 85 | 86 | asl VIC.INTERRUPT_STATUS 87 | 88 | lda #BirdIRQ 90 | ldy #BirdRasterLine 91 | jsr SetNextInterrupt 92 | 93 | //sta $d020 94 | 95 | :RestoreState() 96 | 97 | 98 | 99 | 100 | rti 101 | 102 | } 103 | 104 | BirdIRQ:{ 105 | 106 | :StoreState() 107 | 108 | //dec $d020 109 | 110 | ldy #ONE 111 | jsr ENEMIES.DrawEnemiesForRow 112 | 113 | 114 | 115 | asl VIC.INTERRUPT_STATUS 116 | 117 | lda #Snapper2IRQ 119 | ldy #Snapper2RasterLine 120 | jsr SetNextInterrupt 121 | 122 | //inc $d020 123 | 124 | :RestoreState() 125 | 126 | 127 | rti 128 | 129 | 130 | } 131 | 132 | 133 | Snapper2IRQ:{ 134 | 135 | :StoreState() 136 | 137 | //dec $d020 138 | 139 | ldy #ZERO 140 | jsr ENEMIES.DrawEnemiesForRow 141 | 142 | asl VIC.INTERRUPT_STATUS 143 | 144 | 145 | lda #KeyCageMonkeyIRQ 147 | ldy #1 148 | jsr SetNextInterrupt 149 | 150 | //inc $d020 151 | 152 | :RestoreState() 153 | 154 | 155 | 156 | 157 | rti 158 | 159 | 160 | } 161 | 162 | 163 | MonkeyIRQ: { 164 | 165 | 166 | :StoreState() 167 | 168 | //dec $d020 169 | 170 | jsr MONKEY.Control 171 | jsr MONKEY.Draw 172 | 173 | asl VIC.INTERRUPT_STATUS 174 | 175 | 176 | lda #Snapper1IRQ 178 | ldy #Snapper1RasterLine 179 | jsr SetNextInterrupt 180 | 181 | //inc $d020 182 | 183 | :RestoreState() 184 | 185 | rti 186 | 187 | } 188 | 189 | KeyCageMonkeyIRQ:{ 190 | 191 | :StoreState() 192 | 193 | //dec $d020 194 | 195 | lda #ONE 196 | sta MAIN.PerformFrameCodeFlag 197 | jsr CAGE.Draw 198 | jsr KEY.DrawKey 199 | 200 | asl VIC.INTERRUPT_STATUS 201 | 202 | 203 | 204 | lda #MonkeyIRQ 206 | ldy #88 207 | jsr SetNextInterrupt 208 | 209 | //inc $d020 210 | 211 | :RestoreState() 212 | 213 | rti 214 | 215 | 216 | } 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | } -------------------------------------------------------------------------------- /vic20/scripts/lookups/vic.asm: -------------------------------------------------------------------------------- 1 | VIC: { 2 | 3 | .label SCREEN_RAM = $1000 4 | .label COLOR_RAM = $9400 5 | .label BORDER_BACKGROUND = $900f 6 | .label CHAR_RAM = $9005 7 | .label ROWS_AND_8v16 = $9003 8 | .label AUX_COLOR_AND_VOl = $900E 9 | .label RASTER_LINE = $9004 10 | 11 | ScreenRowLSB: 12 | .fill 23, <[SCREEN_RAM + i * 22] 13 | ScreenRowMSB: 14 | .fill 23, >[SCREEN_RAM + i * 22] 15 | 16 | ColorRowLSB: 17 | .fill 23, <[COLOR_RAM + i * 22] 18 | ColorRowMSB: 19 | .fill 23, >[COLOR_RAM + i * 22] 20 | 21 | 22 | 23 | Setup:{ 24 | 25 | 26 | 27 | lda #%00111101 28 | sta BORDER_BACKGROUND 29 | 30 | lda CHAR_RAM 31 | ora #%00001111 // $1C00 32 | //sta CHAR_RAM 33 | 34 | lda ROWS_AND_8v16 35 | and #%00101101 36 | sta ROWS_AND_8v16 37 | 38 | lda #223 39 | sta AUX_COLOR_AND_VOl 40 | 41 | 42 | rts 43 | 44 | } 45 | 46 | 47 | ConvertCharacterSet: { 48 | 49 | .label CHAR_ID = TEMP1 50 | .label BYTE_ID = TEMP2 51 | 52 | ldx #0 53 | 54 | ldy #0 55 | sty CHAR_ID 56 | 57 | lda #ZERO 58 | sta BYTE_ID 59 | 60 | //sjmp Nope 61 | 62 | First: { 63 | 64 | Loop2: 65 | 66 | //.break 67 | 68 | ldy CHAR_ID 69 | 70 | lda IsMulti, y 71 | // lda #ZERO 72 | beq CheckNextChar 73 | 74 | lda CHAR_SET, x 75 | tay 76 | 77 | lda CharLookup, y 78 | sta CHAR_SET, x 79 | 80 | CheckNextChar: 81 | inc BYTE_ID 82 | lda BYTE_ID 83 | cmp #8 84 | beq NewChar 85 | jmp EndLoop 86 | 87 | NewChar: 88 | 89 | inc CHAR_ID 90 | lda #0 91 | sta BYTE_ID 92 | 93 | EndLoop: 94 | 95 | cpx #255 96 | beq Finish2 97 | inx 98 | jmp Loop2 99 | 100 | Finish2: 101 | 102 | } 103 | 104 | lda CHAR_ID 105 | 106 | ldx #0 107 | 108 | //jmp Nope 109 | 110 | Second: { 111 | 112 | Loop2: 113 | 114 | //.break 115 | 116 | ldy CHAR_ID 117 | lda IsMulti, y 118 | beq CheckNextChar 119 | 120 | lda CHAR_SET + 256, x 121 | tay 122 | 123 | lda CharLookup, y 124 | sta CHAR_SET + 256, x 125 | 126 | CheckNextChar: 127 | inc BYTE_ID 128 | lda BYTE_ID 129 | cmp #8 130 | beq NewChar 131 | jmp EndLoop 132 | 133 | NewChar: 134 | 135 | inc CHAR_ID 136 | lda #0 137 | sta BYTE_ID 138 | 139 | EndLoop: 140 | 141 | cpx #255 142 | beq Finish2 143 | inx 144 | jmp Loop2 145 | 146 | Finish2: 147 | 148 | } 149 | 150 | Third: { 151 | 152 | Loop2: 153 | 154 | //.break 155 | 156 | ldy CHAR_ID 157 | lda IsMulti, y 158 | beq CheckNextChar 159 | 160 | lda CHAR_SET + 256, x 161 | tay 162 | 163 | lda CharLookup, y 164 | sta CHAR_SET + 256, x 165 | 166 | CheckNextChar: 167 | inc BYTE_ID 168 | lda BYTE_ID 169 | cmp #8 170 | beq NewChar 171 | jmp EndLoop 172 | 173 | NewChar: 174 | 175 | inc CHAR_ID 176 | lda #0 177 | sta BYTE_ID 178 | 179 | EndLoop: 180 | 181 | cpx #255 182 | beq Finish2 183 | inx 184 | jmp Loop2 185 | 186 | Finish2: 187 | 188 | } 189 | 190 | Fourth: { 191 | 192 | Loop2: 193 | 194 | //.break 195 | 196 | ldy CHAR_ID 197 | lda IsMulti, y 198 | beq CheckNextChar 199 | 200 | lda CHAR_SET +256, x 201 | tay 202 | 203 | lda CharLookup, y 204 | sta CHAR_SET + 256, x 205 | 206 | CheckNextChar: 207 | inc BYTE_ID 208 | lda BYTE_ID 209 | cmp #8 210 | beq NewChar 211 | jmp EndLoop 212 | 213 | NewChar: 214 | 215 | inc CHAR_ID 216 | lda #0 217 | sta BYTE_ID 218 | 219 | EndLoop: 220 | 221 | cpx #255 222 | beq Finish2 223 | inx 224 | jmp Loop2 225 | 226 | Finish2: 227 | 228 | } 229 | 230 | 231 | 232 | 233 | } 234 | 235 | rts 236 | 237 | 238 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/score.asm: -------------------------------------------------------------------------------- 1 | SCORE:{ 2 | 3 | 4 | KeyScore: .byte 10, 10 5 | UnlockScore: .byte 20 6 | JumpScore: .byte 1 7 | HitScores: .byte 9, 6, 3, 0 8 | Value: .byte 0, 0, 0 // H M L 9 | .label Amount = TEMP1 10 | .label CharacterSetStart = 176 11 | 12 | Best: .byte 0, 0, 0 13 | 14 | ScoreToAdd: .byte 0 15 | 16 | 17 | Reset:{ 18 | 19 | lda #ZERO 20 | sta Value 21 | sta Value + 1 22 | sta Value + 2 23 | 24 | 25 | 26 | jsr Draw 27 | jsr DrawBest 28 | 29 | 30 | 31 | rts 32 | 33 | } 34 | 35 | 36 | 37 | AddToScore:{ 38 | 39 | lda ScoreToAdd 40 | clc 41 | adc Amount 42 | sta ScoreToAdd 43 | rts 44 | 45 | 46 | } 47 | 48 | HitEnemy: { 49 | 50 | // enemy row passed in y 51 | 52 | lda HitScores, y 53 | sta Amount 54 | jsr AddToScore 55 | rts 56 | 57 | } 58 | 59 | JumpEnemy: { 60 | 61 | lda JumpScore 62 | sta Amount 63 | jsr AddToScore 64 | rts 65 | 66 | } 67 | 68 | UnlockSection: { 69 | 70 | lda KeyScore 71 | sta Amount 72 | jsr AddToScore 73 | rts 74 | 75 | } 76 | 77 | UnlockCage:{ 78 | 79 | lda UnlockScore 80 | sta Amount 81 | jsr AddToScore 82 | rts 83 | 84 | } 85 | 86 | 87 | CheckScoreToAdd:{ 88 | 89 | lda ScoreToAdd 90 | beq Finish 91 | 92 | dec ScoreToAdd 93 | lda #ONE 94 | jsr Add 95 | 96 | Finish: 97 | 98 | rts 99 | 100 | 101 | } 102 | 103 | Add: { 104 | 105 | sta Amount 106 | sed 107 | clc 108 | lda Value 109 | adc Amount 110 | sta Value 111 | lda Value+1 112 | adc #ZERO 113 | sta Value+1 114 | lda Value+2 115 | adc #ZERO 116 | sta Value+2 117 | 118 | cld 119 | 120 | cmp Best + 2 121 | bcs BetterOrEqualHigh 122 | 123 | jmp NoNewBest 124 | 125 | BetterOrEqualHigh: 126 | 127 | beq CheckMiddle 128 | 129 | jmp SetNewBest 130 | 131 | CheckMiddle: 132 | 133 | lda Value + 1 134 | cmp Best + 1 135 | bcs BetterOrEqualMiddle 136 | 137 | jmp NoNewBest 138 | 139 | BetterOrEqualMiddle: 140 | 141 | beq CheckLow 142 | 143 | jmp SetNewBest 144 | 145 | CheckLow: 146 | 147 | lda Value 148 | cmp Best 149 | bcc NoNewBest 150 | 151 | SetNewBest: 152 | 153 | lda Value + 2 154 | sta Best + 2 155 | lda Value + 1 156 | sta Best + 1 157 | lda Value + 0 158 | sta Best + 0 159 | 160 | jsr DrawBest 161 | 162 | 163 | NoNewBest: 164 | 165 | 166 | jsr Draw 167 | jsr SOUND.ScoreSound 168 | rts 169 | 170 | 171 | } 172 | 173 | DrawBest:{ 174 | 175 | ldy #5 // screen offset, right most digit 176 | ldx #ZERO // score byte index 177 | 178 | ScoreLoop: 179 | 180 | lda Best,x 181 | pha 182 | and #$0f // keep lower nibble 183 | jsr PlotDigit 184 | pla 185 | lsr 186 | lsr 187 | lsr 188 | lsr // shift right to get higher lower nibble 189 | jsr PlotDigit 190 | inx 191 | cpx #3 192 | bne ScoreLoop 193 | 194 | rts 195 | 196 | PlotDigit: { 197 | 198 | clc 199 | adc #CharacterSetStart 200 | sta VIC.SCREEN_RAM + 103, y 201 | dey 202 | rts 203 | 204 | 205 | } 206 | } 207 | 208 | 209 | Draw:{ 210 | 211 | ldy #5 // screen offset, right most digit 212 | ldx #ZERO // score byte index 213 | 214 | ScoreLoop: 215 | 216 | lda Value,x 217 | pha 218 | and #$0f // keep lower nibble 219 | jsr PlotDigit 220 | pla 221 | lsr 222 | lsr 223 | lsr 224 | lsr // shift right to get higher lower nibble 225 | jsr PlotDigit 226 | inx 227 | cpx #3 228 | bne ScoreLoop 229 | 230 | rts 231 | 232 | PlotDigit: { 233 | 234 | clc 235 | adc #CharacterSetStart 236 | sta VIC.SCREEN_RAM + 81, y 237 | dey 238 | rts 239 | 240 | 241 | } 242 | 243 | 244 | 245 | rts 246 | 247 | 248 | } 249 | 250 | 251 | 252 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/score.asm: -------------------------------------------------------------------------------- 1 | SCORE:{ 2 | 3 | 4 | KeyScore: .byte 10, 10 5 | UnlockScore: .byte 20 6 | JumpScore: .byte 1 7 | HitScores: .byte 9, 6, 3, 0 8 | Value: .byte 0, 0, 0 // H M L 9 | .label Amount = TEMP1 10 | .label CharacterSetStart = 212 11 | 12 | Best: .byte 0, 0, 0 13 | 14 | ScoreToAdd: .byte 0 15 | 16 | 17 | Reset:{ 18 | 19 | lda #ZERO 20 | sta Value 21 | sta Value + 1 22 | sta Value + 2 23 | 24 | 25 | 26 | jsr Draw 27 | jsr DrawBest 28 | 29 | 30 | 31 | rts 32 | 33 | } 34 | 35 | 36 | 37 | AddToScore:{ 38 | 39 | lda ScoreToAdd 40 | clc 41 | adc Amount 42 | sta ScoreToAdd 43 | rts 44 | 45 | 46 | } 47 | 48 | HitEnemy: { 49 | 50 | // enemy row passed in y 51 | 52 | lda HitScores, y 53 | sta Amount 54 | jsr AddToScore 55 | rts 56 | 57 | } 58 | 59 | JumpEnemy: { 60 | 61 | lda JumpScore 62 | sta Amount 63 | jsr AddToScore 64 | rts 65 | 66 | } 67 | 68 | UnlockSection: { 69 | 70 | lda KeyScore 71 | sta Amount 72 | jsr AddToScore 73 | rts 74 | 75 | } 76 | 77 | UnlockCage:{ 78 | 79 | lda UnlockScore 80 | sta Amount 81 | jsr AddToScore 82 | rts 83 | 84 | } 85 | 86 | 87 | CheckScoreToAdd:{ 88 | 89 | lda ScoreToAdd 90 | beq Finish 91 | 92 | dec ScoreToAdd 93 | lda #ONE 94 | jsr Add 95 | 96 | Finish: 97 | 98 | rts 99 | 100 | 101 | } 102 | 103 | Add: { 104 | 105 | sta Amount 106 | sed 107 | clc 108 | lda Value 109 | adc Amount 110 | sta Value 111 | lda Value+1 112 | adc #ZERO 113 | sta Value+1 114 | lda Value+2 115 | adc #ZERO 116 | sta Value+2 117 | 118 | cld 119 | 120 | cmp Best + 2 121 | bcs BetterOrEqualHigh 122 | 123 | jmp NoNewBest 124 | 125 | BetterOrEqualHigh: 126 | 127 | beq CheckMiddle 128 | 129 | jmp SetNewBest 130 | 131 | CheckMiddle: 132 | 133 | lda Value + 1 134 | cmp Best + 1 135 | bcs BetterOrEqualMiddle 136 | 137 | jmp NoNewBest 138 | 139 | BetterOrEqualMiddle: 140 | 141 | beq CheckLow 142 | 143 | jmp SetNewBest 144 | 145 | CheckLow: 146 | 147 | lda Value 148 | cmp Best 149 | bcc NoNewBest 150 | 151 | SetNewBest: 152 | 153 | lda Value + 2 154 | sta Best + 2 155 | lda Value + 1 156 | sta Best + 1 157 | lda Value + 0 158 | sta Best + 0 159 | 160 | jsr DrawBest 161 | 162 | 163 | NoNewBest: 164 | 165 | 166 | jsr Draw 167 | jsr SOUND.ScoreSound 168 | rts 169 | 170 | 171 | } 172 | 173 | DrawBest:{ 174 | 175 | ldy #5 // screen offset, right most digit 176 | ldx #ZERO // score byte index 177 | 178 | ScoreLoop: 179 | 180 | lda Best,x 181 | pha 182 | and #$0f // keep lower nibble 183 | jsr PlotDigit 184 | pla 185 | lsr 186 | lsr 187 | lsr 188 | lsr // shift right to get higher lower nibble 189 | jsr PlotDigit 190 | inx 191 | cpx #3 192 | bne ScoreLoop 193 | 194 | rts 195 | 196 | PlotDigit: { 197 | 198 | clc 199 | adc #CharacterSetStart 200 | sta VIC.SCREEN_RAM + 187, y 201 | dey 202 | rts 203 | 204 | 205 | } 206 | } 207 | 208 | 209 | Draw:{ 210 | 211 | ldy #5 // screen offset, right most digit 212 | ldx #ZERO // score byte index 213 | 214 | ScoreLoop: 215 | 216 | lda Value,x 217 | pha 218 | and #$0f // keep lower nibble 219 | jsr PlotDigit 220 | pla 221 | lsr 222 | lsr 223 | lsr 224 | lsr // shift right to get higher lower nibble 225 | jsr PlotDigit 226 | inx 227 | cpx #3 228 | bne ScoreLoop 229 | 230 | rts 231 | 232 | PlotDigit: { 233 | 234 | clc 235 | adc #CharacterSetStart 236 | sta VIC.SCREEN_RAM + 147, y 237 | dey 238 | rts 239 | 240 | 241 | } 242 | 243 | 244 | 245 | rts 246 | 247 | 248 | } 249 | 250 | 251 | 252 | } -------------------------------------------------------------------------------- /scripts/interrupts/cage.asm: -------------------------------------------------------------------------------- 1 | CAGE:{ 2 | 3 | Frames: .byte 88, 85, 89, 90 4 | XPos: .byte 82, 62, 62, 85 5 | YPos: .byte 65, 65, 88, 88 6 | Pointers: .byte 0, 5, 6 , 7 7 | PointerOne: .byte 0, 4 8 | 9 | SectionsUnlocked: .byte 0 10 | ShowUnlockedSections: .byte 0 11 | FlashCounter: .byte 2, 2 12 | SectionUnlocked: .byte 0,0,0,0 13 | 14 | .label MouthCharacterID = 167 15 | .label SmileCharacter = 250 16 | .label SadCharacter = 18 17 | .label NumberOfSections = 4 18 | 19 | LockCage: { 20 | 21 | lda #ZERO 22 | sta SectionUnlocked 23 | sta SectionUnlocked + 1 24 | sta SectionUnlocked + 2 25 | sta SectionUnlocked + 3 26 | 27 | lda #ZERO 28 | sta SectionsUnlocked 29 | jsr Sad 30 | } 31 | 32 | 33 | 34 | Reset:{ 35 | 36 | 37 | lda #ZERO 38 | sta ShowUnlockedSections 39 | sta Pointers 40 | ldx #ZERO 41 | lda FlashCounter + 1 42 | sta FlashCounter 43 | 44 | rts 45 | 46 | } 47 | 48 | 49 | SetupSprites:{ 50 | 51 | lda VIC.SPRITE_ENABLE 52 | ora #%11110000 53 | sta VIC.SPRITE_ENABLE 54 | 55 | lda VIC.SPRITE_MSB 56 | and #%00001111 57 | sta VIC.SPRITE_MSB 58 | 59 | lda MONKEY.GoingForKey 60 | beq NotGoingForKey 61 | 62 | rts 63 | 64 | NotGoingForKey: 65 | 66 | lda VIC.SPRITE_ENABLE 67 | ora #%11100001 68 | sta VIC.SPRITE_ENABLE 69 | rts 70 | 71 | } 72 | 73 | // runs every frame 74 | Draw:{ 75 | 76 | ldx #NumberOfSections - 1 77 | jsr SetupSprites 78 | 79 | // if going for key don't draw 80 | lda MONKEY.GoingForKey 81 | bne EndLoop 82 | 83 | Loop: 84 | 85 | // turn off if all sections unlocked 86 | lda SectionsUnlocked 87 | cmp #NumberOfSections 88 | beq TurnOff 89 | 90 | // always show if not unlocked 91 | lda SectionUnlocked, x 92 | beq TurnOn 93 | 94 | // flash unlocked cage sections 95 | lda ShowUnlockedSections 96 | bne TurnOn 97 | 98 | TurnOff: 99 | 100 | // hide sprites off screen 101 | lda Pointers, x 102 | rol 103 | tay 104 | lda #ZERO 105 | sta VIC.SPRITE_0_X, y 106 | jmp FinishSection 107 | 108 | 109 | TurnOn: 110 | 111 | // get pointer and set frame 112 | ldy Pointers, x 113 | lda Frames, x 114 | clc 115 | adc #64 116 | sta SPRITE_POINTERS, y 117 | 118 | // set cage to black 119 | lda #BLACK 120 | sta VIC.SPRITE_COLOR_0, y 121 | 122 | // Get offset for X & Y registers, store new position 123 | lda Pointers, x 124 | rol 125 | tay 126 | lda XPos, x 127 | sta VIC.SPRITE_0_X, y 128 | lda YPos, x 129 | sta VIC.SPRITE_0_Y, y 130 | 131 | 132 | FinishSection: 133 | 134 | // increment and loop back round 135 | cpx #ZERO 136 | beq EndLoop 137 | dex 138 | jmp Loop 139 | 140 | 141 | EndLoop: 142 | 143 | rts 144 | 145 | } 146 | 147 | // runs on game tick, not every frame 148 | Update:{ 149 | 150 | // check whether to switch flashing flag 151 | dec FlashCounter 152 | beq Switch 153 | jmp CheckMonkeyPosition 154 | 155 | Switch: 156 | 157 | lda FlashCounter + 1 158 | sta FlashCounter 159 | 160 | lda ShowUnlockedSections 161 | beq TurnOn 162 | 163 | // turn off flag 164 | dec ShowUnlockedSections 165 | jmp CheckMonkeyPosition 166 | 167 | TurnOn: 168 | 169 | inc ShowUnlockedSections 170 | 171 | // change pointers between key/monkey1 depending if at cage 172 | CheckMonkeyPosition: 173 | ldx MONKEY.AtCage 174 | lda PointerOne, x 175 | sta Pointers 176 | lda ShowUnlockedSections 177 | 178 | rts 179 | 180 | } 181 | 182 | 183 | Sad:{ 184 | 185 | lda #SadCharacter 186 | ldx #MouthCharacterID 187 | sta SCREEN_RAM, x 188 | rts 189 | 190 | } 191 | 192 | Smile:{ 193 | 194 | lda #SmileCharacter 195 | ldx #MouthCharacterID 196 | sta SCREEN_RAM, x 197 | rts 198 | 199 | } 200 | 201 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/score.asm: -------------------------------------------------------------------------------- 1 | SCORE:{ 2 | 3 | 4 | KeyScore: .byte 10, 10 5 | UnlockScore: .byte 20 6 | JumpScore: .byte 1 7 | HitScores: .byte 9, 6, 3, 0 8 | Value: .byte 0, 0, 0 // H M L 9 | .label Amount = TEMP1 10 | .label CharacterSetStart = 48 11 | 12 | Best: .byte 0, 0, 0 13 | 14 | ScoreToAdd: .byte 0 15 | 16 | 17 | Reset:{ 18 | 19 | lda #ZERO 20 | sta Value 21 | sta Value + 1 22 | sta Value + 2 23 | 24 | 25 | 26 | jsr Draw 27 | jsr DrawBest 28 | 29 | 30 | 31 | rts 32 | 33 | } 34 | 35 | 36 | 37 | AddToScore:{ 38 | 39 | lda ScoreToAdd 40 | clc 41 | adc Amount 42 | sta ScoreToAdd 43 | rts 44 | 45 | 46 | } 47 | 48 | HitEnemy: { 49 | 50 | // enemy row passed in y 51 | 52 | 53 | 54 | lda HitScores, y 55 | and #%00001111 56 | sta Amount 57 | jsr AddToScore 58 | rts 59 | 60 | } 61 | 62 | JumpEnemy: { 63 | 64 | lda JumpScore 65 | sta Amount 66 | jsr AddToScore 67 | rts 68 | 69 | } 70 | 71 | UnlockSection: { 72 | 73 | lda KeyScore 74 | sta Amount 75 | jsr AddToScore 76 | rts 77 | 78 | } 79 | 80 | UnlockCage:{ 81 | 82 | lda UnlockScore 83 | sta Amount 84 | jsr AddToScore 85 | rts 86 | 87 | } 88 | 89 | 90 | CheckScoreToAdd:{ 91 | 92 | lda ScoreToAdd 93 | beq Finish 94 | 95 | dec ScoreToAdd 96 | lda #ONE 97 | jsr Add 98 | 99 | Finish: 100 | 101 | rts 102 | 103 | 104 | } 105 | 106 | Add: { 107 | 108 | sta Amount 109 | sed 110 | clc 111 | lda Value 112 | adc Amount 113 | sta Value 114 | lda Value+1 115 | adc #ZERO 116 | sta Value+1 117 | lda Value+2 118 | adc #ZERO 119 | sta Value+2 120 | 121 | cld 122 | 123 | cmp Best + 2 124 | bcs BetterOrEqualHigh 125 | 126 | jmp NoNewBest 127 | 128 | BetterOrEqualHigh: 129 | 130 | beq CheckMiddle 131 | 132 | jmp SetNewBest 133 | 134 | CheckMiddle: 135 | 136 | lda Value + 1 137 | cmp Best + 1 138 | bcs BetterOrEqualMiddle 139 | 140 | jmp NoNewBest 141 | 142 | BetterOrEqualMiddle: 143 | 144 | beq CheckLow 145 | 146 | jmp SetNewBest 147 | 148 | CheckLow: 149 | 150 | lda Value 151 | cmp Best 152 | bcc NoNewBest 153 | 154 | SetNewBest: 155 | 156 | lda Value + 2 157 | sta Best + 2 158 | lda Value + 1 159 | sta Best + 1 160 | lda Value + 0 161 | sta Best + 0 162 | 163 | jsr DrawBest 164 | 165 | 166 | NoNewBest: 167 | 168 | 169 | jsr Draw 170 | jsr SOUND.ScoreSound 171 | rts 172 | 173 | 174 | } 175 | 176 | DrawBest:{ 177 | 178 | ldy #5 // screen offset, right most digit 179 | ldx #ZERO // score byte index 180 | 181 | ScoreLoop: 182 | 183 | lda Best,x 184 | pha 185 | and #$0f // keep lower nibble 186 | jsr PlotDigit 187 | pla 188 | lsr 189 | lsr 190 | lsr 191 | lsr // shift right to get higher lower nibble 192 | jsr PlotDigit 193 | inx 194 | cpx #3 195 | bne ScoreLoop 196 | 197 | rts 198 | 199 | PlotDigit: { 200 | 201 | clc 202 | adc #CharacterSetStart 203 | sta VIC.SCREEN_RAM + 187, y 204 | dey 205 | rts 206 | 207 | 208 | } 209 | } 210 | 211 | 212 | Draw:{ 213 | 214 | ldy #5 // screen offset, right most digit 215 | ldx #ZERO // score byte index 216 | 217 | ScoreLoop: 218 | 219 | lda Value,x 220 | pha 221 | and #$0f // keep lower nibble 222 | jsr PlotDigit 223 | pla 224 | lsr 225 | lsr 226 | lsr 227 | lsr // shift right to get higher lower nibble 228 | jsr PlotDigit 229 | inx 230 | cpx #3 231 | bne ScoreLoop 232 | 233 | rts 234 | 235 | PlotDigit: { 236 | 237 | clc 238 | adc #CharacterSetStart 239 | sta VIC.SCREEN_RAM + 147, y 240 | dey 241 | rts 242 | 243 | 244 | } 245 | 246 | 247 | 248 | rts 249 | 250 | 251 | } 252 | 253 | 254 | 255 | } -------------------------------------------------------------------------------- /vic20/scripts/lookups/charData.asm: -------------------------------------------------------------------------------- 1 | CHAR_DATA:{ 2 | 3 | 4 | DataStart: 5 | 6 | .word Monkey_0, Monkey_1, Monkey_2, Monkey_3, Monkey_4, Monkey_5 7 | .word Monkey_6, Monkey_7, Monkey_8, Monkey_9, Monkey_10, Monkey_11 8 | .word Monkey_12, Monkey_13, Monkey_14, Monkey_15, Monkey_16, Monkey_17 9 | .word Monkey_18, Monkey_19, Monkey_20, Monkey_21, Monkey_22, Monkey_23, Monkey_24 10 | .word Snapper_0, Snapper_1, Snapper_2, Snapper_3, Snapper_4, Snapper_5 11 | .word Bird_0, Bird_1, Bird_2, Bird_3, Bird_4, Bird_5, Bird_6, Bird_7 12 | .word Snapper_12, Snapper_11, Snapper_10, Snapper_9, Snapper_8, Snapper_7, Snapper_6 13 | .word Key_0, Key_1, Key_2, Key_3, Pineapple_0, Pineapple_1, Pineapple_2, Pineapple_3 14 | .word Cage_1, Cage_2, Cage_3, Cage_4 15 | 16 | ObjectType: 17 | .fill 25, 0 // monkey 18 | .fill 21, 1 // enemy 19 | .fill 4, 2 // key 20 | .fill 4, 3 // pineapple 21 | .fill 4, 4 // cage 22 | 23 | TypeColours: 24 | .byte 2, 0, 0, 4, 0 25 | 26 | Sizes: { 27 | 28 | 29 | // MONKEY 30 | .byte 8, 8, 8, 8, 8, 8 // 0-5 31 | .byte 4, 8, 4, 4, 8, 4 // 6-11 32 | .byte 8, 10, 8, 8, 8, 8 // 12-17 33 | .byte 4, 10, 8, 8, 4, 2, 10 // 18-24 34 | 35 | // ENEMIES 36 | .byte 2, 2, 2, 2, 2, 2 // 25-30 37 | .byte 2, 2, 2, 2, 2, 2, 2, 2 // 31 - 38 38 | .byte 2, 2, 2, 2, 2, 2, 2 // 39 - 45 39 | 40 | // KEYS 41 | .byte 2, 2, 2, 2 // 46 - 49 42 | 43 | // PINEAPPLE 44 | 45 | .byte 2, 2, 2, 2 // 50 - 53 46 | 47 | // CAGE 48 | .byte 4, 4, 4, 6 // 54-57 49 | 50 | // KONG 51 | 52 | 53 | } 54 | 55 | Monkey_0: .byte 3, 19, 4, 19, 3, 20, 4, 20 56 | Monkey_1: .byte 6, 19, 7, 19, 6, 20, 7, 20 57 | Monkey_2: .byte 9, 19, 10, 19, 9, 20, 10, 20 58 | Monkey_3: .byte 12, 19, 13, 19, 12, 20, 13, 20 59 | Monkey_4: .byte 15, 19, 16, 19, 15, 20, 16, 20 60 | Monkey_5: .byte 18, 19, 19, 19, 18, 20, 19, 20 61 | 62 | 63 | Monkey_6: .byte 3, 15, 3, 16 64 | Monkey_7: .byte 6, 15, 6, 16, 7, 15, 7, 16 65 | Monkey_8: .byte 9, 15, 9, 16 66 | Monkey_9: .byte 12, 15, 12, 16 67 | Monkey_10: .byte 15, 15, 15, 16, 16, 15, 16, 16 68 | Monkey_11: .byte 18, 15, 18, 16 69 | 70 | Monkey_12: .byte 1, 13, 2, 13, 1, 14, 2, 14 71 | Monkey_13: .byte 4, 11, 5, 11, 4, 12, 5, 12, 5, 10 72 | Monkey_14: .byte 9, 12, 10, 12, 9, 13, 10, 13 73 | Monkey_15: .byte 12, 12, 13, 12, 12, 13, 13, 13 74 | Monkey_16: .byte 15, 12, 16, 12, 15, 13, 16, 13 75 | Monkey_17: .byte 18, 12, 19, 12, 18, 13, 19, 13 76 | 77 | Monkey_18: .byte 0, 18, 0, 19 78 | Monkey_19: .byte 6, 7, 7, 7, 6, 8, 7, 8, 7, 9 79 | Monkey_20: .byte 9, 8, 10, 8, 9, 9, 10, 9 80 | Monkey_21: .byte 12, 8, 13, 8, 12, 9, 13, 9 81 | Monkey_22: .byte 15, 8, 15, 9 82 | Monkey_23: .byte 99, 99 83 | Monkey_24: .byte 3, 4, 4, 4, 4, 5, 5, 5, 4, 3 84 | 85 | Snapper_0: .byte 5, 13 // 26 86 | Snapper_1: .byte 8, 13 87 | Snapper_2: .byte 11, 13 88 | Snapper_3: .byte 14, 13 89 | Snapper_4: .byte 17, 13 90 | Snapper_5: .byte 20, 15 91 | 92 | Bird_0: .byte 0, 14 93 | Bird_1: .byte 2, 15 94 | Bird_2: .byte 5, 16 95 | Bird_3: .byte 8, 16 96 | Bird_4: .byte 11, 16 97 | Bird_5: .byte 14, 16 98 | Bird_6: .byte 17, 16 99 | Bird_7: .byte 21, 12 100 | 101 | Snapper_12: .byte 2, 20 102 | Snapper_11: .byte 5, 20 103 | Snapper_10: .byte 8, 20 104 | Snapper_9: .byte 11, 20 105 | Snapper_8: .byte 14, 20 106 | Snapper_7: .byte 17, 20 107 | Snapper_6: .byte 20, 20 108 | 109 | Key_0: .byte 6, 5 110 | Key_1: .byte 7, 5 111 | Key_2: .byte 8, 5 112 | Key_3: .byte 9, 5 113 | 114 | Pineapple_0: .byte 11, 7 115 | Pineapple_1: .byte 11, 12 116 | Pineapple_2: .byte 11, 15 117 | Pineapple_3: .byte 11, 19 118 | 119 | Cage_1: .byte 0, 5, 0, 4 120 | Cage_2: .byte 0, 3, 0, 2 121 | Cage_3: .byte 1, 2, 2, 2 122 | Cage_4: .byte 3, 2, 3, 3 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | } 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /scripts/game.asm: -------------------------------------------------------------------------------- 1 | MAIN: { 2 | 3 | #import "lookups/zeropage.asm" 4 | 5 | BasicUpstart2(Entry) 6 | 7 | #import "lookups/labels.asm" 8 | #import "lookups/vic.asm" 9 | #import "lookups/sid.asm" 10 | #import "lookups/registers.asm" 11 | #import "interrupts/irq.asm" 12 | #import "setup/macros.asm" 13 | #import "setup/maploader.asm" 14 | #import "interrupts/monkey.asm" 15 | #import "interrupts/key.asm" 16 | #import "interrupts/cage.asm" 17 | #import "interrupts/score.asm" 18 | #import "interrupts/lives.asm" 19 | #import "interrupts/enemies.asm" 20 | #import "interrupts/pineapple.asm" 21 | 22 | 23 | PerformFrameCodeFlag: .byte $00 24 | // current, currentMax, startValue 25 | GameCounter: .byte 24, 24, 27 26 | GameTickFlag: .byte $00 27 | SpeedIncreaseCounter: .byte 48, 48 28 | .label MaxSpeed = 13 29 | 30 | Entry: 31 | 32 | 33 | jsr IRQ.DisableCIA 34 | jsr REGISTERS.BankOutKernalAndBasic 35 | jsr VIC.SetupRegisters 36 | jsr VIC.SetupColours 37 | jsr SID.Initialise 38 | jsr MAPLOADER.DrawMap 39 | jsr KEY.Initialise 40 | jsr MONKEY.Initialise 41 | jsr IRQ.SetupInterrupts 42 | jsr Random.init 43 | 44 | jsr VIC.ColourLastRow 45 | 46 | 47 | 48 | jsr NewGame 49 | jmp MainLoop 50 | 51 | NewGame: { 52 | 53 | jsr SCORE.Reset 54 | jsr LIVES.Reset 55 | jsr ENEMIES.Reset 56 | jsr CAGE.LockCage 57 | 58 | ldx #0 59 | jsr PINEAPPLE.MovePineapple 60 | 61 | lda GameCounter + 2 62 | sta GameCounter + 1 63 | sta GameCounter 64 | //jsr PINEAPPLE.StartFall 65 | 66 | rts 67 | 68 | } 69 | 70 | 71 | MainLoop: { 72 | 73 | lda PerformFrameCodeFlag 74 | beq GameTick 75 | dec PerformFrameCodeFlag 76 | jmp FrameCode 77 | } 78 | 79 | CheckWhetherToUpdateScore: { 80 | 81 | lda ZP_COUNTER 82 | and #3 83 | bne NoScoreAdd 84 | 85 | jsr SCORE.CheckScoreToAdd 86 | 87 | NoScoreAdd: 88 | jmp MainLoop 89 | } 90 | 91 | 92 | FrameCode: { 93 | 94 | inc ZP_COUNTER 95 | 96 | jsr PINEAPPLE.Update 97 | jsr CheckWhetherToUpdateScore 98 | 99 | 100 | 101 | } 102 | 103 | 104 | CheckGameSpeed:{ 105 | 106 | dec SpeedIncreaseCounter 107 | bne NoSpeedIncrease 108 | 109 | lda SpeedIncreaseCounter + 1 110 | sta SpeedIncreaseCounter 111 | 112 | lda GameCounter + 1 113 | cmp #MaxSpeed 114 | beq NoSpeedIncrease 115 | 116 | dec GameCounter + 1 117 | dec GameCounter +1 118 | 119 | NoSpeedIncrease: 120 | 121 | rts 122 | } 123 | 124 | 125 | CheckSpawn:{ 126 | 127 | 128 | jsr Random 129 | cmp #45 130 | bcc DoZero 131 | cmp #210 132 | bcs Finish 133 | 134 | ldy #ONE 135 | jsr ENEMIES.Spawn 136 | jmp Finish 137 | 138 | DoZero: 139 | ldy #ZERO 140 | jsr ENEMIES.Spawn 141 | 142 | Finish: 143 | 144 | rts 145 | } 146 | 147 | GameTick: { 148 | 149 | 150 | lda GameTickFlag 151 | beq MainLoop 152 | dec GameTickFlag 153 | 154 | jsr KEY.Update 155 | jsr CAGE.Update 156 | jsr ENEMIES.Update 157 | 158 | lda KEY.Active 159 | beq Finish 160 | 161 | jsr CheckGameSpeed 162 | jsr CheckSpawn 163 | 164 | Finish: 165 | 166 | lda MONKEY.DisableControl 167 | bne MainLoop 168 | 169 | jsr SID.TickSound 170 | jmp MainLoop 171 | } 172 | 173 | 174 | Random: { 175 | lda seed 176 | beq doEor 177 | asl 178 | beq noEor 179 | bcc noEor 180 | doEor: 181 | eor #$1d 182 | eor $dc04 183 | eor $dd04 184 | noEor: 185 | sta seed 186 | rts 187 | seed: 188 | .byte $62 189 | 190 | 191 | init: 192 | lda #$ff 193 | sta $dc05 194 | sta $dd05 195 | lda #$7f 196 | sta $dc04 197 | lda #$37 198 | sta $dd04 199 | 200 | lda #$91 201 | sta $dc0e 202 | sta $dd0e 203 | rts 204 | } 205 | 206 | 207 | #import "setup/assets.asm" 208 | 209 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/sound.asm: -------------------------------------------------------------------------------- 1 | SOUND:{ 2 | 3 | .label Channel1_LSB = $ff0e 4 | .label Channel2_LSB = $ff0f 5 | .label Channel1_MSB = $ff10 6 | .label Channel2_MSB = $ff12 7 | .label CONTROL = $ff11 8 | 9 | ChannelOn: .byte %00010000, %00100000 10 | ChannelOff: .byte %11101111,%11011111 11 | 12 | 13 | 14 | Countdown: .byte 0, 0 15 | Channels: .word Channel1_LSB, Channel1_MSB, Channel2_LSB, Channel2_MSB 16 | 17 | Channel: .byte 0 18 | 19 | // $ff0e : This reg is the first sound-source's frq-value's lowmost 8 bit. 20 | // More 2 bits are in $ff10's 0. and 1. places. 21 | // $ff0f : 2nd. source, lowmost 8 bits. More 2 bits in $ff12, 0. and 1. 22 | // places. 23 | // The soundregister-value can be calculated as 24 | // reg=1024-(111860.781/frq[Hz]) (NTSC) 25 | // reg=1024-(111840.45 /frq[Hz]) (PAL) 26 | // $ff10 : 1st. sound-source, higmost 2 bits. 2-7 bits are unused. 27 | // $ff11 : Sound control register. 28 | // Bit 0-3 : Volume. Maximum value is 8. 29 | // Bit 4 : Sound #1 on/off. 30 | // Bit 5 : Sound #2 squarewave on/off. 31 | // Bit 6 : Sound #2 noise on/off. If You set both, the square 32 | // will sound. 33 | 34 | 35 | 36 | Setup:{ 37 | 38 | 39 | lda CONTROL 40 | ora #%00000011 41 | sta CONTROL 42 | 43 | rts 44 | 45 | } 46 | 47 | MoveMonkey: { 48 | 49 | 50 | 51 | lda #%11111111 52 | sta Channel2_LSB 53 | 54 | lda Channel2_MSB 55 | and #%11111100 56 | ora #%00000011 57 | sta Channel2_MSB 58 | 59 | lda #2 60 | ldx #1 61 | sta Countdown, x 62 | 63 | lda CONTROL 64 | ora ChannelOn, x 65 | sta CONTROL 66 | 67 | 68 | 69 | 70 | rts 71 | 72 | 73 | } 74 | 75 | PlayGameOver: { 76 | 77 | 78 | lda #%01111111 79 | sta Channel1_LSB 80 | 81 | lda Channel1_MSB 82 | and #%11111100 83 | //ora #%00000011 84 | sta Channel1_MSB 85 | 86 | lda #60 87 | ldx #0 88 | sta Countdown, x 89 | 90 | lda CONTROL 91 | ora ChannelOn, x 92 | sta CONTROL 93 | 94 | 95 | rts 96 | 97 | 98 | } 99 | 100 | 101 | DeathSound: { 102 | 103 | 104 | lda #%11111111 105 | sta Channel1_LSB 106 | 107 | lda Channel1_MSB 108 | and #%11111100 109 | ora #%00000011 110 | sta Channel1_MSB 111 | 112 | lda #20 113 | ldx #0 114 | sta Countdown, x 115 | 116 | lda CONTROL 117 | ora ChannelOn, x 118 | sta CONTROL 119 | 120 | 121 | 122 | 123 | 124 | 125 | } 126 | 127 | ScoreSound: { 128 | 129 | lda #%10011111 130 | sta Channel2_LSB 131 | 132 | lda Channel2_MSB 133 | and #%11111100 134 | ora #%00000011 135 | sta Channel2_MSB 136 | 137 | lda #1 138 | ldx #1 139 | 140 | sta Countdown, x 141 | 142 | lda CONTROL 143 | ora ChannelOn, x 144 | sta CONTROL 145 | 146 | rts 147 | 148 | } 149 | 150 | PlayTick: { 151 | 152 | 153 | lda #%01111111 154 | sta Channel1_LSB 155 | 156 | lda Channel1_MSB 157 | and #%11111111 158 | ora #%00000011 159 | sta Channel1_MSB 160 | 161 | lda #1 162 | ldx #0 163 | 164 | sta Countdown, x 165 | 166 | lda CONTROL 167 | ora ChannelOn, x 168 | sta CONTROL 169 | 170 | 171 | rts 172 | 173 | 174 | } 175 | 176 | StopAll: { 177 | 178 | lda CONTROL 179 | and #%11001111 180 | sta CONTROL 181 | 182 | rts 183 | 184 | 185 | } 186 | 187 | Update: { 188 | 189 | ldx #0 190 | 191 | Loop: 192 | 193 | ldy Countdown, x 194 | beq StopChannel 195 | 196 | dey 197 | tya 198 | sta Countdown, x 199 | 200 | jmp EndLoop 201 | 202 | StopChannel: 203 | 204 | //.break 205 | 206 | //lda #ZERO 207 | //sta Channel1, x 208 | 209 | //txa 210 | //pha 211 | 212 | 213 | lda CONTROL 214 | and ChannelOff, x 215 | sta CONTROL 216 | 217 | //lda #ZERO 218 | 219 | Address: 220 | 221 | ///sta $BEEF 222 | 223 | //pla 224 | //tax 225 | 226 | 227 | EndLoop: 228 | 229 | cpx #1 230 | beq Finish 231 | inx 232 | jmp Loop 233 | 234 | Finish: 235 | 236 | rts 237 | 238 | 239 | } 240 | 241 | 242 | 243 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/cage.asm: -------------------------------------------------------------------------------- 1 | CAGE:{ 2 | 3 | 4 | 5 | MonkeyLockID: .byte 110 6 | FinalPieceID: .byte 121 7 | 8 | ObjectIDs: .byte 54, 55, 56, 57 9 | 10 | HappyFace: .byte 123,122 11 | SadFace: .byte 12, 74 12 | FacePosition: .byte 89, 90 13 | 14 | 15 | SectionsUnlocked: .byte 0 16 | ShowUnlockedSections: .byte 0 17 | FlashCounter: .byte 2, 2 18 | SectionUnlocked: .byte 0,0,0,0 19 | 20 | 21 | .label MouthCharacterID = 167 22 | .label SmileCharacter = 250 23 | .label SadCharacter = 18 24 | .label NumberOfSections =4 25 | 26 | LockCage: { 27 | 28 | lda #ZERO 29 | sta SectionUnlocked 30 | sta SectionUnlocked + 1 31 | sta SectionUnlocked + 2 32 | sta SectionUnlocked + 3 33 | 34 | lda #ZERO 35 | sta SectionsUnlocked 36 | jsr Sad 37 | 38 | lda SadFace 39 | ldx FacePosition 40 | sta VIC.SCREEN_RAM, x 41 | 42 | lda SadFace + 1 43 | inx 44 | sta VIC.SCREEN_RAM, x 45 | 46 | rts 47 | } 48 | 49 | 50 | UnlockCage: { 51 | 52 | lda HappyFace 53 | ldx FacePosition 54 | sta VIC.SCREEN_RAM, x 55 | 56 | lda HappyFace + 1 57 | inx 58 | sta VIC.SCREEN_RAM, x 59 | 60 | rts 61 | } 62 | 63 | 64 | Reset:{ 65 | 66 | 67 | lda #ZERO 68 | sta ShowUnlockedSections 69 | ldx #ZERO 70 | lda FlashCounter + 1 71 | sta FlashCounter 72 | 73 | rts 74 | 75 | } 76 | 77 | 78 | 79 | // runs every frame 80 | Draw:{ 81 | 82 | ldx #NumberOfSections 83 | dex 84 | 85 | // if going for key don't draw 86 | lda MONKEY.GoingForKey 87 | bne EndLoop 88 | 89 | .label SectionID = TEMP10 90 | 91 | Loop: 92 | 93 | 94 | stx SectionID 95 | 96 | // turn off if all sections unlocked 97 | lda SectionsUnlocked 98 | cmp #NumberOfSections 99 | beq TurnOff 100 | 101 | // always show if not unlocked 102 | lda SectionUnlocked, x 103 | beq TurnOn 104 | 105 | // flash unlocked cage sections 106 | lda ShowUnlockedSections 107 | bne TurnOn 108 | 109 | TurnOff: 110 | 111 | lda ObjectIDs, x 112 | tax 113 | ldy #ZERO 114 | jsr CHAR_DRAWING.ColourObject 115 | jmp FinishSection 116 | 117 | ldx SectionID 118 | cpx #3 119 | bne FinishSection 120 | 121 | lda MONKEY.AtCage 122 | bne FinishSection 123 | 124 | lda FinalPieceID 125 | ldx #91 126 | sta VIC.SCREEN_RAM, x 127 | 128 | lda #3 129 | sta VIC.COLOR_RAM, x 130 | 131 | 132 | TurnOn: 133 | 134 | 135 | lda ObjectIDs, x 136 | tax 137 | ldy #ONE 138 | jsr CHAR_DRAWING.ColourObject 139 | 140 | ldx SectionID 141 | cpx #3 142 | bne FinishSection 143 | 144 | lda MONKEY.AtCage 145 | bne FinishSection 146 | 147 | jsr PutBackPiece 148 | 149 | 150 | // get pointer and set frame 151 | 152 | 153 | FinishSection: 154 | 155 | ldx SectionID 156 | // increment and loop back round 157 | cpx #ZERO 158 | beq EndLoop 159 | dex 160 | jmp Loop 161 | 162 | 163 | EndLoop: 164 | 165 | lda MONKEY.AtCage 166 | beq NoMonkey 167 | 168 | 169 | 170 | lda MonkeyLockID 171 | ldx #91 172 | sta VIC.SCREEN_RAM, x 173 | 174 | lda #2 175 | sta VIC.COLOR_RAM, x 176 | 177 | NoMonkey: 178 | 179 | 180 | rts 181 | 182 | } 183 | 184 | PutBackPiece:{ 185 | 186 | lda FinalPieceID 187 | ldx #91 188 | sta VIC.SCREEN_RAM, x 189 | 190 | lda #0 191 | sta VIC.COLOR_RAM, x 192 | 193 | rts 194 | 195 | } 196 | 197 | TurnOffMonkey:{ 198 | 199 | lda MonkeyLockID 200 | ldx #91 201 | sta VIC.SCREEN_RAM, x 202 | 203 | lda #3 204 | sta VIC.COLOR_RAM, x 205 | 206 | rts 207 | 208 | } 209 | 210 | // runs on game tick, not every frame 211 | Update:{ 212 | 213 | // check whether to switch flashing flag 214 | dec FlashCounter 215 | beq Switch 216 | jmp CheckMonkeyPosition 217 | 218 | Switch: 219 | 220 | lda FlashCounter + 1 221 | sta FlashCounter 222 | 223 | lda ShowUnlockedSections 224 | beq TurnOn 225 | 226 | // turn off flag 227 | dec ShowUnlockedSections 228 | jmp CheckMonkeyPosition 229 | 230 | TurnOn: 231 | 232 | inc ShowUnlockedSections 233 | 234 | // change pointers between key/monkey1 depending if at cage 235 | CheckMonkeyPosition: 236 | ldx MONKEY.AtCage 237 | lda ShowUnlockedSections 238 | 239 | rts 240 | 241 | } 242 | 243 | 244 | Sad:{ 245 | 246 | lda #SadCharacter 247 | ldx #MouthCharacterID 248 | //sta SCREEN_RAM, x 249 | rts 250 | 251 | } 252 | 253 | Smile:{ 254 | 255 | lda #SmileCharacter 256 | ldx #MouthCharacterID 257 | //sta SCREEN_RAM, x 258 | rts 259 | 260 | } 261 | 262 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/modules/cage.asm: -------------------------------------------------------------------------------- 1 | CAGE:{ 2 | 3 | 4 | 5 | MonkeyLockID: .byte 110 6 | FinalPieceID: .byte 121 7 | 8 | ObjectIDs: .byte 54, 55, 56, 57 9 | 10 | HappyFace: .byte 80 11 | SadFace: .byte 11 12 | FacePosition: .byte 167 13 | 14 | 15 | SectionsUnlocked: .byte 0 16 | ShowUnlockedSections: .byte 0 17 | FlashCounter: .byte 2, 2 18 | SectionUnlocked: .byte 0,0,0,0 19 | 20 | 21 | .label MouthCharacterID = 167 22 | .label SmileCharacter = 250 23 | .label SadCharacter = 18 24 | .label NumberOfSections =4 25 | 26 | LockCage: { 27 | 28 | lda #ZERO 29 | sta SectionUnlocked 30 | sta SectionUnlocked + 1 31 | sta SectionUnlocked + 2 32 | sta SectionUnlocked + 3 33 | 34 | lda #ZERO 35 | sta SectionsUnlocked 36 | jsr Sad 37 | 38 | lda SadFace 39 | ldx FacePosition 40 | sta VIC.SCREEN_RAM, x 41 | 42 | //lda SadFace + 1 43 | //inx 44 | //sta VIC.SCREEN_RAM, x 45 | 46 | rts 47 | } 48 | 49 | 50 | UnlockCage: { 51 | 52 | lda HappyFace 53 | ldx FacePosition 54 | sta VIC.SCREEN_RAM, x 55 | 56 | //lda HappyFace + 1 57 | //inx 58 | //sta VIC.SCREEN_RAM, x 59 | 60 | rts 61 | } 62 | 63 | 64 | Reset:{ 65 | 66 | 67 | lda #ZERO 68 | sta ShowUnlockedSections 69 | ldx #ZERO 70 | lda FlashCounter + 1 71 | sta FlashCounter 72 | 73 | rts 74 | 75 | } 76 | 77 | 78 | 79 | // runs every frame 80 | Draw:{ 81 | 82 | ldx #NumberOfSections 83 | dex 84 | 85 | // if going for key don't draw 86 | lda MONKEY.GoingForKey 87 | bne EndLoop 88 | 89 | .label SectionID = TEMP10 90 | 91 | Loop: 92 | 93 | 94 | stx SectionID 95 | 96 | // turn off if all sections unlocked 97 | lda SectionsUnlocked 98 | cmp #NumberOfSections 99 | beq TurnOff 100 | 101 | // always show if not unlocked 102 | lda SectionUnlocked, x 103 | beq TurnOn 104 | 105 | // flash unlocked cage sections 106 | lda ShowUnlockedSections 107 | bne TurnOn 108 | 109 | TurnOff: 110 | 111 | lda ObjectIDs, x 112 | tax 113 | ldy #ZERO 114 | jsr CHAR_DRAWING.ColourObject 115 | jmp FinishSection 116 | 117 | ldx SectionID 118 | cpx #3 119 | bne FinishSection 120 | 121 | lda MONKEY.AtCage 122 | bne FinishSection 123 | 124 | //lda FinalPieceID 125 | //ldx #91 126 | //sta VIC.SCREEN_RAM, x 127 | 128 | //lda #3 129 | //sta VIC.COLOR_RAM, x 130 | 131 | 132 | TurnOn: 133 | 134 | 135 | lda ObjectIDs, x 136 | tax 137 | ldy #ONE 138 | jsr CHAR_DRAWING.ColourObject 139 | 140 | ldx SectionID 141 | cpx #3 142 | bne FinishSection 143 | 144 | lda MONKEY.AtCage 145 | bne FinishSection 146 | 147 | //jsr PutBackPiece 148 | 149 | 150 | // get pointer and set frame 151 | 152 | 153 | FinishSection: 154 | 155 | ldx SectionID 156 | // increment and loop back round 157 | cpx #ZERO 158 | beq EndLoop 159 | dex 160 | jmp Loop 161 | 162 | 163 | EndLoop: 164 | 165 | lda MONKEY.AtCage 166 | beq NoMonkey 167 | 168 | 169 | 170 | //lda MonkeyLockID 171 | //ldx #91 172 | //sta VIC.SCREEN_RAM, x 173 | 174 | //lda #2 175 | //sta VIC.COLOR_RAM, x 176 | 177 | NoMonkey: 178 | 179 | 180 | rts 181 | 182 | } 183 | 184 | PutBackPiece:{ 185 | 186 | lda FinalPieceID 187 | ldx #91 188 | sta VIC.SCREEN_RAM, x 189 | 190 | lda #0 191 | sta VIC.COLOR_RAM, x 192 | 193 | rts 194 | 195 | } 196 | 197 | TurnOffMonkey:{ 198 | 199 | //lda MonkeyLockID 200 | //ldx #91 201 | //sta VIC.SCREEN_RAM, x 202 | 203 | //lda #3 204 | //sta VIC.COLOR_RAM, x 205 | 206 | rts 207 | 208 | } 209 | 210 | // runs on game tick, not every frame 211 | Update:{ 212 | 213 | // check whether to switch flashing flag 214 | dec FlashCounter 215 | beq Switch 216 | jmp CheckMonkeyPosition 217 | 218 | Switch: 219 | 220 | lda FlashCounter + 1 221 | sta FlashCounter 222 | 223 | lda ShowUnlockedSections 224 | beq TurnOn 225 | 226 | // turn off flag 227 | dec ShowUnlockedSections 228 | jmp CheckMonkeyPosition 229 | 230 | TurnOn: 231 | 232 | inc ShowUnlockedSections 233 | 234 | // change pointers between key/monkey1 depending if at cage 235 | CheckMonkeyPosition: 236 | ldx MONKEY.AtCage 237 | lda ShowUnlockedSections 238 | 239 | rts 240 | 241 | } 242 | 243 | 244 | Sad:{ 245 | 246 | lda #SadCharacter 247 | ldx #MouthCharacterID 248 | //sta SCREEN_RAM, x 249 | rts 250 | 251 | } 252 | 253 | Smile:{ 254 | 255 | lda #SmileCharacter 256 | ldx #MouthCharacterID 257 | //sta SCREEN_RAM, x 258 | rts 259 | 260 | } 261 | 262 | } -------------------------------------------------------------------------------- /zPET/scripts/modules/cage.asm: -------------------------------------------------------------------------------- 1 | CAGE:{ 2 | 3 | 4 | 5 | MonkeyLockID: .byte 110 6 | FinalPieceID: .byte 121 7 | 8 | ObjectIDs: .byte 54, 55, 56, 57 9 | 10 | HappyFace: .byte 22 11 | SadFace: .byte 214 12 | FacePosition: .byte 127 13 | 14 | 15 | SectionsUnlocked: .byte 0 16 | ShowUnlockedSections: .byte 0 17 | FlashCounter: .byte 2, 2 18 | SectionUnlocked: .byte 0,0,0,0 19 | 20 | 21 | .label MouthCharacterID = 167 22 | .label SmileCharacter = 250 23 | .label SadCharacter = 18 24 | .label NumberOfSections =4 25 | 26 | LockCage: { 27 | 28 | lda #ZERO 29 | sta SectionUnlocked 30 | sta SectionUnlocked + 1 31 | sta SectionUnlocked + 2 32 | sta SectionUnlocked + 3 33 | 34 | lda #ZERO 35 | sta SectionsUnlocked 36 | jsr Sad 37 | 38 | lda SadFace 39 | ldx FacePosition 40 | sta VIC.SCREEN_RAM, x 41 | 42 | //lda SadFace + 1 43 | //inx 44 | //sta VIC.SCREEN_RAM, x 45 | 46 | rts 47 | } 48 | 49 | 50 | UnlockCage: { 51 | 52 | lda HappyFace 53 | ldx FacePosition 54 | sta VIC.SCREEN_RAM, x 55 | 56 | //lda HappyFace + 1 57 | //inx 58 | //sta VIC.SCREEN_RAM, x 59 | 60 | rts 61 | } 62 | 63 | 64 | Reset:{ 65 | 66 | 67 | lda #ZERO 68 | sta ShowUnlockedSections 69 | ldx #ZERO 70 | lda FlashCounter + 1 71 | sta FlashCounter 72 | 73 | rts 74 | 75 | } 76 | 77 | 78 | 79 | // runs every frame 80 | Draw:{ 81 | 82 | ldx #NumberOfSections 83 | dex 84 | 85 | // if going for key don't draw 86 | lda MONKEY.GoingForKey 87 | bne EndLoop 88 | 89 | .label SectionID = TEMP10 90 | 91 | Loop: 92 | 93 | 94 | stx SectionID 95 | 96 | // turn off if all sections unlocked 97 | lda SectionsUnlocked 98 | cmp #NumberOfSections 99 | beq TurnOff 100 | 101 | // always show if not unlocked 102 | lda SectionUnlocked, x 103 | beq TurnOn 104 | 105 | // flash unlocked cage sections 106 | lda ShowUnlockedSections 107 | bne TurnOn 108 | 109 | TurnOff: 110 | 111 | lda ObjectIDs, x 112 | tax 113 | ldy #ZERO 114 | jsr CHAR_DRAWING.ColourObject 115 | jmp FinishSection 116 | 117 | ldx SectionID 118 | cpx #3 119 | bne FinishSection 120 | 121 | lda MONKEY.AtCage 122 | bne FinishSection 123 | 124 | //lda FinalPieceID 125 | //ldx #91 126 | //sta VIC.SCREEN_RAM, x 127 | 128 | //lda #3 129 | //sta VIC.COLOR_RAM, x 130 | 131 | 132 | TurnOn: 133 | 134 | 135 | lda ObjectIDs, x 136 | tax 137 | ldy #ONE 138 | jsr CHAR_DRAWING.ColourObject 139 | 140 | ldx SectionID 141 | cpx #3 142 | bne FinishSection 143 | 144 | lda MONKEY.AtCage 145 | bne FinishSection 146 | 147 | //jsr PutBackPiece 148 | 149 | 150 | // get pointer and set frame 151 | 152 | 153 | FinishSection: 154 | 155 | ldx SectionID 156 | // increment and loop back round 157 | cpx #ZERO 158 | beq EndLoop 159 | dex 160 | jmp Loop 161 | 162 | 163 | EndLoop: 164 | 165 | lda MONKEY.AtCage 166 | beq NoMonkey 167 | 168 | 169 | 170 | //lda MonkeyLockID 171 | //ldx #91 172 | //sta VIC.SCREEN_RAM, x 173 | 174 | //lda #2 175 | //sta VIC.COLOR_RAM, x 176 | 177 | NoMonkey: 178 | 179 | 180 | rts 181 | 182 | } 183 | 184 | PutBackPiece:{ 185 | 186 | lda FinalPieceID 187 | ldx #91 188 | //sta VIC.SCREEN_RAM, x 189 | 190 | lda #0 191 | //sta VIC.COLOR_RAM, x 192 | 193 | rts 194 | 195 | } 196 | 197 | TurnOffMonkey:{ 198 | 199 | //lda MonkeyLockID 200 | //ldx #91 201 | //sta VIC.SCREEN_RAM, x 202 | 203 | //lda #3 204 | //sta VIC.COLOR_RAM, x 205 | 206 | rts 207 | 208 | } 209 | 210 | // runs on game tick, not every frame 211 | Update:{ 212 | 213 | // check whether to switch flashing flag 214 | dec FlashCounter 215 | beq Switch 216 | jmp CheckMonkeyPosition 217 | 218 | Switch: 219 | 220 | lda FlashCounter + 1 221 | sta FlashCounter 222 | 223 | lda ShowUnlockedSections 224 | beq TurnOn 225 | 226 | // turn off flag 227 | dec ShowUnlockedSections 228 | jmp CheckMonkeyPosition 229 | 230 | TurnOn: 231 | 232 | inc ShowUnlockedSections 233 | 234 | // change pointers between key/monkey1 depending if at cage 235 | CheckMonkeyPosition: 236 | ldx MONKEY.AtCage 237 | lda ShowUnlockedSections 238 | 239 | rts 240 | 241 | } 242 | 243 | 244 | Sad:{ 245 | 246 | lda #SadCharacter 247 | ldx #MouthCharacterID 248 | //sta SCREEN_RAM, x 249 | rts 250 | 251 | } 252 | 253 | Smile:{ 254 | 255 | lda #SmileCharacter 256 | ldx #MouthCharacterID 257 | //sta SCREEN_RAM, x 258 | rts 259 | 260 | } 261 | 262 | } -------------------------------------------------------------------------------- /xPLUS_4/scripts/lookups/charData.asm: -------------------------------------------------------------------------------- 1 | CHAR_DATA:{ 2 | 3 | 4 | DataStart: 5 | 6 | .word Monkey_0, Monkey_1, Monkey_2, Monkey_3, Monkey_4, Monkey_5 7 | .word Monkey_6, Monkey_7, Monkey_8, Monkey_9, Monkey_10, Monkey_11 8 | .word Monkey_12, Monkey_13, Monkey_14, Monkey_15, Monkey_16, Monkey_17 9 | .word Monkey_18, Monkey_19, Monkey_20, Monkey_21, Monkey_22, Monkey_23, Monkey_24 10 | .word Snapper_0, Snapper_1, Snapper_2, Snapper_3, Snapper_4, Snapper_5 11 | .word Bird_0, Bird_1, Bird_2, Bird_3, Bird_4, Bird_5, Bird_6, Bird_7 12 | .word Snapper_12, Snapper_11, Snapper_10, Snapper_9, Snapper_8, Snapper_7, Snapper_6 13 | .word Key_0, Key_1, Key_2, Key_3, Pineapple_0, Pineapple_1, Pineapple_2, Pineapple_3 14 | .word Cage_1, Cage_2, Cage_3, Cage_4 15 | 16 | ObjectType: 17 | .fill 25, 0 // monkey 18 | .fill 21, 1 // enemy 19 | .fill 4, 2 // key 20 | .fill 4, 3 // pineapple 21 | .fill 4, 4 // cage 22 | 23 | TypeColours: 24 | .byte 2, 0, 0, 4, 0 25 | 26 | Sizes: { 27 | 28 | 29 | // MONKEY 30 | .byte 18, 18, 18, 18, 18, 18 // 0-5 31 | .byte 18, 18, 18, 18, 18, 18 // 6-11 32 | .byte 18, 18, 18, 18, 18, 18 // 12-17 33 | .byte 14, 18, 18, 18, 18, 2, 20 // 18-24 34 | 35 | 36 | // ENEMIES 37 | .byte 2, 2, 2, 2, 2, 2 // 25-30 38 | .byte 2, 2, 2, 2, 2, 2, 2, 2 // 31 - 38 39 | .byte 2, 2, 2, 2, 2, 2, 2 // 39 - 45 40 | 41 | // KEYS 42 | .byte 2, 2, 2, 2 // 46 - 49 43 | 44 | // PINEAPPLE 45 | 46 | .byte 2, 2, 2, 2 // 50 - 53 47 | 48 | // CAGE- 49 | .byte 6, 8, 6, 6 // 54-57 50 | 51 | // KONG 52 | 53 | 54 | 55 | 56 | } 57 | 58 | Monkey_0: .byte 8, 18, 9, 18, 10, 18, 8, 19, 9, 19, 10, 19, 8, 20, 9, 20, 10, 20 59 | Monkey_1: .byte 13, 18, 14, 18, 15, 18, 13, 19, 14, 19, 15, 19, 13, 20, 14, 20, 15, 20 60 | Monkey_2: .byte 17, 18, 18, 18, 19, 18, 17, 19, 18, 19, 19, 19, 17, 20, 18, 20, 19, 20 61 | Monkey_3: .byte 22, 18, 23, 18, 24, 18, 22, 19, 23, 19, 24, 19, 22, 20, 23, 20, 24, 20 62 | Monkey_4: .byte 27, 18, 28, 18, 29, 18, 27, 19, 28, 19, 29, 19, 27, 20, 28, 20, 29, 20 63 | Monkey_5: .byte 31, 18, 32, 18, 33, 18, 31, 19, 32, 19, 33, 19, 31, 20, 32, 20, 33, 20 64 | 65 | 66 | Monkey_6: .byte 8, 14, 9, 14, 10, 14, 8, 15, 9, 15, 10, 15, 8, 16, 9, 16, 10, 16 67 | Monkey_7: .byte 13, 15, 14, 15, 15, 15, 13, 16, 14, 16, 15, 16, 13, 17, 14, 17, 15, 17 68 | Monkey_8: .byte 17, 15, 18, 15, 19, 15, 17, 16, 18, 16, 19, 16, 17, 17, 18, 17, 19, 17 69 | Monkey_9: .byte 22, 15, 23, 15, 24, 15, 22, 16, 23, 16, 24, 16, 22, 17, 23, 17, 24, 17 70 | Monkey_10: .byte 27, 15, 28, 15, 29, 15, 27, 16, 28, 16, 29, 16, 27, 17, 28, 17, 29, 17 71 | Monkey_11: .byte 31, 15, 32, 15, 33, 15, 31, 16, 32, 16, 33, 16, 31, 17, 32, 17, 33, 17 72 | 73 | Monkey_12: .byte 11, 10, 12, 10, 13, 10, 11, 11, 12, 11, 13, 11, 11, 12, 12, 12, 13, 12 74 | Monkey_13: .byte 10, 7, 11, 7, 12, 7, 10, 8, 11, 8, 12, 8, 10, 9, 11, 9, 12, 9 75 | Monkey_14: .byte 17, 11, 18, 11, 19, 11, 17, 12, 18, 12, 19, 12, 17, 13, 18, 13, 19, 13 76 | Monkey_15: .byte 22, 11, 23, 11, 24, 11, 22, 12, 23, 12, 24, 12, 22, 13, 23, 13, 24, 13 77 | Monkey_16: .byte 26, 11, 27, 11, 28, 11, 26, 12, 27, 12, 28, 12, 26, 13, 27, 13, 28, 13 78 | Monkey_17: .byte 30, 11, 31, 11, 32, 11, 30, 12, 31, 12, 32, 12, 30, 13, 31, 13, 32, 13 79 | 80 | Monkey_18: .byte 5, 17, 5, 18, 6, 18, 7, 18, 5, 19, 6, 19, 7, 19 81 | Monkey_19: .byte 14, 7, 14, 8, 15, 8, 16, 8, 14, 9, 15, 9, 16, 9, 15, 10, 16, 10 82 | Monkey_20: .byte 17, 8, 18, 8, 19, 8, 17, 9, 18, 9, 19, 9, 17, 10, 18, 10, 19, 10 83 | Monkey_21: .byte 22, 8, 23, 8, 24, 8, 22, 9, 23, 9, 24, 9, 22, 10, 23, 10, 24, 10 84 | Monkey_22: .byte 26, 8, 27, 8, 28, 8, 26, 9, 27, 9, 28, 9, 26, 10, 27, 10, 28, 10 85 | Monkey_23: .byte 99, 99 86 | Monkey_24: .byte 11, 3, 10, 4, 11, 4, 12, 4, 10, 5, 11, 5, 12, 5, 10, 6, 11, 6, 12, 6 87 | 88 | Snapper_0: .byte 12, 13 // 26 89 | Snapper_1: .byte 16, 13 90 | Snapper_2: .byte 21, 13 91 | Snapper_3: .byte 25, 13 92 | Snapper_4: .byte 29, 13 93 | Snapper_5: .byte 34, 15 94 | 95 | Bird_0: .byte 5, 14 96 | Bird_1: .byte 7, 15 97 | Bird_2: .byte 12, 16 98 | Bird_3: .byte 16, 16 99 | Bird_4: .byte 21, 16 100 | Bird_5: .byte 26, 16 101 | Bird_6: .byte 30, 16 102 | Bird_7: .byte 34, 13 103 | 104 | Snapper_12: .byte 7, 20 105 | Snapper_11: .byte 12, 20 106 | Snapper_10: .byte 16, 20 107 | Snapper_9: .byte 21, 20 108 | Snapper_8: .byte 25, 20 109 | Snapper_7: .byte 30, 20 110 | Snapper_6: .byte 34, 20 111 | 112 | Key_0: .byte 14, 5 113 | Key_1: .byte 15, 5 114 | Key_2: .byte 16, 5 115 | Key_3: .byte 17, 5 116 | 117 | Pineapple_0: .byte 21, 7 118 | Pineapple_1: .byte 21, 12 119 | Pineapple_2: .byte 21, 15 120 | Pineapple_3: .byte 21, 19 121 | 122 | Cage_1: .byte 5, 6, 5, 5, 5, 4 123 | Cage_2: .byte 5, 3, 5, 2, 6, 2, 7, 2 124 | Cage_3: .byte 8, 2, 9, 2, 9, 3 125 | Cage_4: .byte 9, 4, 9, 5, 9, 6 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | } 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /zPET/scripts/lookups/charData.asm: -------------------------------------------------------------------------------- 1 | CHAR_DATA:{ 2 | 3 | 4 | DataStart: 5 | 6 | .word Monkey_0, Monkey_1, Monkey_2, Monkey_3, Monkey_4, Monkey_5 7 | .word Monkey_6, Monkey_7, Monkey_8, Monkey_9, Monkey_10, Monkey_11 8 | .word Monkey_12, Monkey_13, Monkey_14, Monkey_15, Monkey_16, Monkey_17 9 | .word Monkey_18, Monkey_19, Monkey_20, Monkey_21, Monkey_22, Monkey_23, Monkey_24 10 | .word Snapper_0, Snapper_1, Snapper_2, Snapper_3, Snapper_4, Snapper_5 11 | .word Bird_0, Bird_1, Bird_2, Bird_3, Bird_4, Bird_5, Bird_6, Bird_7 12 | .word Snapper_12, Snapper_11, Snapper_10, Snapper_9, Snapper_8, Snapper_7, Snapper_6 13 | .word Key_0, Key_1, Key_2, Key_3, Pineapple_0, Pineapple_1, Pineapple_2, Pineapple_3 14 | .word Cage_1, Cage_2, Cage_3, Cage_4 15 | 16 | ObjectType: 17 | .fill 25, 0 // monkey 18 | .fill 21, 1 // enemy 19 | .fill 4, 2 // key 20 | .fill 4, 3 // pineapple 21 | .fill 4, 4 // cage 22 | 23 | TypeColours: 24 | .byte 2, 0, 0, 4, 0 25 | 26 | Sizes: { 27 | 28 | 29 | // MONKEY 30 | .byte 18, 18, 18, 18, 18, 18 // 0-5 31 | .byte 18, 18, 18, 18, 18, 18 // 6-11 32 | .byte 20, 18, 18, 18, 18, 18 // 12-17 33 | .byte 8, 18, 18, 18, 18, 2, 20 // 18-24 34 | 35 | 36 | // ENEMIES 37 | .byte 2, 2, 2, 2, 2, 2 // 25-30 38 | .byte 2, 2, 2, 2, 2, 2, 2, 2 // 31 - 38 39 | .byte 2, 2, 2, 2, 2, 2, 2 // 39 - 45 40 | 41 | // KEYS 42 | .byte 4, 4, 4, 4 // 46 - 49 43 | 44 | // PINEAPPLE 45 | 46 | .byte 2, 2, 2, 2 // 50 - 53 47 | 48 | // CAGE- 49 | .byte 6, 8, 6, 6 // 54-57 50 | 51 | // KONG 52 | 53 | 54 | 55 | 56 | } 57 | 58 | Monkey_0: .byte 8, 21, 9, 21, 10, 21, 8, 19, 9, 19, 10, 19, 8, 20, 9, 20, 10, 20 59 | Monkey_1: .byte 13, 21, 14,21, 15, 21, 13, 19, 14, 19, 15, 19, 13, 20, 14, 20, 15, 20 60 | Monkey_2: .byte 17, 21, 18, 21, 19, 21, 17, 19, 18, 19, 19, 19, 17, 20, 18, 20, 19, 20 61 | Monkey_3: .byte 22, 21, 23, 21, 24, 21, 22, 19, 23, 19, 24, 19, 22, 20, 23, 20, 24, 20 62 | Monkey_4: .byte 27, 21, 28, 21, 29, 21, 27, 19, 28, 19, 29, 19, 27, 20, 28, 20, 29, 20 63 | Monkey_5: .byte 31, 21, 32, 21, 33, 21, 31, 19, 32, 19, 33, 19, 31, 20, 32, 20, 33, 20 64 | 65 | 66 | Monkey_6: .byte 8, 18, 9, 18, 10, 18, 8, 16, 9, 16, 10, 16, 8, 17, 9, 17, 10, 17 67 | Monkey_7: .byte 13, 18, 14, 18, 15, 18, 13, 16, 14, 16, 15, 16, 13, 17, 14, 17, 15, 17 68 | Monkey_8: .byte 17, 18, 18, 18, 19, 18, 17, 16, 18, 16, 19, 16, 17, 17, 18, 17, 19, 17 69 | Monkey_9: .byte 22, 18, 23, 18, 24, 18, 22, 16, 23, 16, 24, 16, 22, 17, 23, 17, 24, 17 70 | Monkey_10: .byte 27, 18, 28, 18, 29, 18, 27, 16, 28, 16, 29, 16, 27, 17, 28, 17, 29, 17 71 | Monkey_11: .byte 31, 18, 32, 18, 33, 18, 31, 16, 32, 16, 33, 16, 31, 17, 32, 17, 33, 17 72 | 73 | Monkey_12: .byte 11, 10, 12, 10, 13, 10, 11, 11, 12, 11, 13, 11, 11, 12, 12, 12, 13, 12, 11, 13 74 | Monkey_13: .byte 11, 7, 12, 7, 13, 7, 11, 8, 12, 8, 13, 8, 11, 9, 12, 9, 13, 9 75 | Monkey_14: .byte 17, 14, 18, 14, 19, 14, 17, 12, 18, 12, 19, 12, 17, 13, 18, 13, 19, 13 76 | Monkey_15: .byte 22, 14, 23, 14, 24, 14, 22, 12, 23, 12, 24, 12, 22, 13, 23, 13, 24, 13 77 | Monkey_16: .byte 26, 14, 27, 14, 28, 14, 26, 12, 27, 12, 28, 12, 26, 13, 27, 13, 28, 13 78 | Monkey_17: .byte 30, 14, 31, 14, 32, 14, 30, 12, 31, 12, 32, 12, 30, 13, 31, 13, 32, 13 79 | 80 | Monkey_18: .byte 5, 19, 6, 19, 7, 19, 6, 20 81 | Monkey_19: .byte 14, 8, 15, 9, 16, 9, 14, 10, 15, 10, 16, 10, 15, 11, 14, 9 82 | Monkey_20: .byte 17, 11, 18, 11, 19, 11, 17, 9, 18, 9, 19, 9, 17, 10, 18, 10, 19, 10 83 | Monkey_21: .byte 22, 11, 23, 11, 24, 11, 22, 9, 23, 9, 24, 9, 22, 10, 23, 10, 24, 10 84 | Monkey_22: .byte 26, 11, 27, 11, 28, 11, 26, 9, 27, 9, 28, 9, 26, 10, 27, 10, 28, 10 85 | Monkey_23: .byte 99, 99 86 | Monkey_24: .byte 11, 3, 10, 4, 11, 4, 12, 4, 10, 5, 11, 5, 12, 5, 10, 6, 11, 6, 12, 6 87 | 88 | Snapper_0: .byte 12, 14 // 26 89 | Snapper_1: .byte 16, 14 90 | Snapper_2: .byte 21, 14 91 | Snapper_3: .byte 25, 14 92 | Snapper_4: .byte 29, 14 93 | Snapper_5: .byte 34, 16 94 | 95 | Bird_0: .byte 5, 16 96 | Bird_1: .byte 7, 17 97 | Bird_2: .byte 12, 17 98 | Bird_3: .byte 16, 17 99 | Bird_4: .byte 21, 17 100 | Bird_5: .byte 26, 17 101 | Bird_6: .byte 30, 17 102 | Bird_7: .byte 34, 14 103 | 104 | Snapper_12: .byte 7, 21 105 | Snapper_11: .byte 12, 21 106 | Snapper_10: .byte 16, 21 107 | Snapper_9: .byte 21, 21 108 | Snapper_8: .byte 25, 21 109 | Snapper_7: .byte 30, 21 110 | Snapper_6: .byte 34, 21 111 | 112 | Key_0: .byte 14, 5, 13, 6 113 | Key_1: .byte 15, 5, 15, 6 114 | Key_2: .byte 16, 5, 17, 6 115 | Key_3: .byte 17, 5, 18, 5 116 | 117 | Pineapple_0: .byte 21, 8 118 | Pineapple_1: .byte 21, 13 119 | Pineapple_2: .byte 21, 16 120 | Pineapple_3: .byte 21, 20 121 | 122 | Cage_1: .byte 5, 6, 5, 5, 5, 4 123 | Cage_2: .byte 5, 3, 5, 2, 6, 2, 7, 2 124 | Cage_3: .byte 8, 2, 9, 2, 9, 3 125 | Cage_4: .byte 9, 4, 9, 5, 9, 6 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | } 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /vic20/scripts/gameVIC.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MAIN: { 5 | 6 | #import "lookups/zeropage.asm" 7 | 8 | * = $2000 9 | #import "setup/upstart.asm" 10 | #import "setup/loadModules.asm" 11 | 12 | GameCounter: .byte 32, 32, 32 13 | SpeedIncreaseCounter: .byte 48, 48 14 | FrameSwitch: .byte 0 15 | TitleCooldown: .byte 30, 30 16 | 17 | BASICStub(8,"Entry") 18 | 19 | 20 | .label MaxSpeed = 13 21 | 22 | Entry: 23 | // 0-2 Border 4-7 Background 3 Invert 24 | 25 | sei 26 | 27 | jsr VIC.Setup 28 | jsr VIC.ConvertCharacterSet 29 | 30 | jmp TitleScreen 31 | 32 | 33 | 34 | TitleScreen: { 35 | 36 | jsr SOUND.StopAll 37 | 38 | lda VIC.CHAR_RAM 39 | and #%11110000 40 | ora #%00001101 // $1C00 41 | sta VIC.CHAR_RAM 42 | 43 | DrawMap: 44 | 45 | jsr TITLELOADER.DrawMap 46 | 47 | lda #%01111000 48 | sta VIC.BORDER_BACKGROUND 49 | 50 | lda TitleCooldown + 1 51 | sta TitleCooldown 52 | 53 | jmp TitleLoop 54 | 55 | } 56 | 57 | 58 | 59 | 60 | TitleLoop: { 61 | 62 | lda TitleCooldown 63 | beq CheckFire 64 | 65 | dec TitleCooldown 66 | jmp TitleLoop 67 | 68 | CheckFire: 69 | 70 | sta $9113 71 | lda #127 72 | sta $9122 73 | 74 | lda REGISTERS.JOY_PORT_UDLF 75 | and #JOY_FIRE 76 | bne TitleLoop 77 | 78 | lda #2 79 | sta TitleCooldown 80 | 81 | Loop: 82 | 83 | lda TitleCooldown 84 | beq NewGame 85 | dec TitleCooldown 86 | ldx #1 87 | jsr WaitForRasterLine 88 | jmp Loop 89 | 90 | 91 | } 92 | 93 | 94 | 95 | NewGame:{ 96 | 97 | lda VIC.CHAR_RAM 98 | ora #%00001111 // $1C00 99 | sta VIC.CHAR_RAM 100 | 101 | lda #%00111101 102 | sta VIC.BORDER_BACKGROUND 103 | 104 | 105 | jsr MAPLOADER.DrawMap 106 | 107 | lda GameCounter + 2 108 | sta GameCounter + 1 109 | sta GameCounter 110 | 111 | jsr CHAR_DRAWING.ClearAll 112 | jsr MONKEY.Reset 113 | jsr SCORE.Reset 114 | jsr KEY.Reset 115 | jsr LIVES.Reset 116 | jsr PINEAPPLE.Reset 117 | jsr CAGE.Reset 118 | jsr CAGE.LockCage 119 | jsr ENEMIES.Reset 120 | 121 | 122 | 123 | 124 | 125 | jmp MainLoop 126 | 127 | } 128 | 129 | 130 | 131 | WaitForRasterLine: { 132 | 133 | .label RasterTarget = TEMP1 134 | stx RasterTarget 135 | 136 | Loop: 137 | 138 | lda VIC.RASTER_LINE 139 | cmp RasterTarget 140 | bne Loop 141 | 142 | rts 143 | 144 | } 145 | 146 | 147 | 148 | CheckWhetherToUpdateScore: { 149 | 150 | lda ZP_COUNTER 151 | and #3 152 | bne NoScoreAdd 153 | 154 | jsr SCORE.CheckScoreToAdd 155 | 156 | NoScoreAdd: 157 | 158 | rts 159 | } 160 | 161 | 162 | CheckSpawn:{ 163 | 164 | 165 | 166 | jsr Random 167 | 168 | adc #128 169 | cmp #45 170 | bcc DoZero 171 | cmp #210 172 | bcs Finish 173 | 174 | ldy #ONE 175 | jsr ENEMIES.Spawn 176 | jmp Finish 177 | 178 | DoZero: 179 | ldy #ZERO 180 | jsr ENEMIES.Spawn 181 | 182 | Finish: 183 | 184 | rts 185 | } 186 | 187 | CheckGameSpeed:{ 188 | 189 | dec SpeedIncreaseCounter 190 | bne NoSpeedIncrease 191 | 192 | lda SpeedIncreaseCounter + 1 193 | sta SpeedIncreaseCounter 194 | 195 | lda GameCounter + 1 196 | cmp #MaxSpeed 197 | bcc NoSpeedIncrease 198 | 199 | dec GameCounter + 1 200 | dec GameCounter + 1 201 | 202 | NoSpeedIncrease: 203 | 204 | rts 205 | } 206 | 207 | 208 | 209 | GameTick: { 210 | 211 | inc ZP_COUNTER 212 | 213 | lda GameCounter 214 | cmp #ONE 215 | bcc PerformTick 216 | 217 | dec GameCounter 218 | rts 219 | 220 | PerformTick: 221 | 222 | lda FrameSwitch 223 | beq FlipOn 224 | 225 | lda #ZERO 226 | sta FrameSwitch 227 | 228 | jmp RestoreCounter 229 | 230 | FlipOn: 231 | 232 | lda #ONE 233 | sta FrameSwitch 234 | 235 | RestoreCounter: 236 | 237 | lda GameCounter + 1 238 | sta GameCounter 239 | 240 | asl 241 | sta MONKEY.DropTime 242 | 243 | jsr ENEMIES.Update 244 | jsr KEY.Update 245 | jsr KEY.DrawKey 246 | jsr CAGE.Update 247 | jsr CAGE.Draw 248 | 249 | 250 | lda KEY.Active 251 | beq Finish 252 | 253 | jsr CheckGameSpeed 254 | jsr CheckSpawn 255 | 256 | Finish: 257 | 258 | lda MONKEY.DisableControl 259 | bne NoSound 260 | 261 | jsr SOUND.PlayTick 262 | 263 | NoSound: 264 | rts 265 | } 266 | 267 | 268 | MainLoop: 269 | 270 | ldx #1 271 | jsr WaitForRasterLine 272 | jmp MonkeyIRQ 273 | 274 | 275 | MonkeyIRQ: { 276 | 277 | 278 | 279 | 280 | jsr MONKEY.Delete 281 | jsr MONKEY.Control 282 | jsr MONKEY.Draw 283 | jsr SOUND.Update 284 | jsr GameTick 285 | jsr CheckWhetherToUpdateScore 286 | jsr PINEAPPLE.Update 287 | 288 | ldx #150 289 | jsr WaitForRasterLine 290 | 291 | jmp MainLoop 292 | 293 | 294 | 295 | } 296 | 297 | 298 | Random: { 299 | 300 | //Random subroutine 301 | lda #$01 302 | asl 303 | bcc Skip 304 | eor #$4d 305 | 306 | Skip: 307 | sta Random+1 308 | eor $9124 309 | 310 | 311 | rts 312 | 313 | } 314 | 315 | #import "setup/assets.asm" 316 | 317 | } 318 | -------------------------------------------------------------------------------- /zPET/scripts/gamePET.asm: -------------------------------------------------------------------------------- 1 | 2 | MAIN: { 3 | 4 | #import "lookups/zeropage.asm" 5 | 6 | * = $1d00 "Code1" 7 | #import "setup/upstart.asm" 8 | #import "setup/loadModules.asm" 9 | 10 | GameCounter: .byte 32, 32, 32 11 | SpeedIncreaseCounter: .byte 48, 48 12 | FrameSwitch: .byte 0 13 | TitleCooldown: .byte 30, 255 14 | 15 | BASICStub(0,"Entry") 16 | 17 | .label MaxSpeed = 13 18 | 19 | Entry: 20 | 21 | //exomizer sfx sys -t 64 -x "inc $d020" -o yakf.exo yakf.prg 22 | 23 | //sei 24 | 25 | jsr VIC.Setup 26 | jsr SOUND.Setup 27 | 28 | jmp TitleScreen 29 | 30 | 31 | 32 | Loop: 33 | 34 | 35 | jmp Loop 36 | 37 | 38 | TitleScreen: { 39 | 40 | jsr SOUND.StopAll 41 | 42 | 43 | DrawMap: 44 | 45 | jsr TITLELOADER.DrawMap 46 | 47 | 48 | lda TitleCooldown + 1 49 | sta TitleCooldown 50 | 51 | jmp TitleLoop 52 | 53 | } 54 | 55 | 56 | 57 | 58 | TitleLoop: { 59 | 60 | lda TitleCooldown 61 | beq GetJoystick 62 | 63 | dec TitleCooldown 64 | jmp TitleLoop 65 | 66 | GetJoystick: 67 | 68 | 69 | jsr $FFE4 70 | bne Loop 71 | 72 | jmp GetJoystick 73 | 74 | Loop: 75 | 76 | lda TitleCooldown 77 | beq NewGame 78 | dec TitleCooldown 79 | ldx #1 80 | jsr WaitForRasterLine 81 | jmp Loop 82 | 83 | 84 | 85 | 86 | } 87 | 88 | 89 | 90 | NewGame:{ 91 | 92 | jsr MAPLOADER.DrawMap 93 | 94 | lda GameCounter + 2 95 | sta GameCounter + 1 96 | sta GameCounter 97 | 98 | jsr CHAR_DRAWING.ClearAll 99 | jsr MONKEY.Reset 100 | jsr SCORE.Reset 101 | jsr KEY.Reset 102 | jsr LIVES.Reset 103 | jsr PINEAPPLE.Reset 104 | jsr CAGE.Reset 105 | jsr CAGE.LockCage 106 | jsr ENEMIES.Reset 107 | 108 | jmp MainLoop 109 | 110 | } 111 | 112 | TestLoop: { 113 | 114 | 115 | 116 | jmp TestLoop 117 | } 118 | 119 | 120 | 121 | WaitForRasterLine: { 122 | 123 | 124 | ldx #ZERO 125 | ldy #ZERO 126 | 127 | xLoop: 128 | 129 | inx 130 | cpx #240 131 | beq EndxLoop 132 | 133 | jmp xLoop 134 | 135 | EndxLoop: 136 | 137 | ldx #ZERO 138 | iny 139 | cpy #9 140 | 141 | beq Finish 142 | jmp xLoop 143 | 144 | Finish: 145 | 146 | rts 147 | 148 | 149 | 150 | .label RasterTarget = TEMP1 151 | 152 | Loop: 153 | 154 | lda VIC.RASTER_LINE 155 | eor VIC.RASTER_MASK 156 | and VIC.RASTER_MASK 157 | bne Loop 158 | 159 | rts 160 | 161 | } 162 | 163 | 164 | 165 | CheckWhetherToUpdateScore: { 166 | 167 | lda ZP_COUNTER 168 | and #3 169 | bne NoScoreAdd 170 | 171 | jsr SCORE.CheckScoreToAdd 172 | 173 | NoScoreAdd: 174 | 175 | rts 176 | } 177 | 178 | 179 | CheckSpawn:{ 180 | 181 | 182 | 183 | jsr Random 184 | 185 | adc #128 186 | cmp #45 187 | bcc DoZero 188 | cmp #210 189 | bcs Finish 190 | 191 | ldy #ONE 192 | jsr ENEMIES.Spawn 193 | jmp Finish 194 | 195 | DoZero: 196 | ldy #ZERO 197 | jsr ENEMIES.Spawn 198 | 199 | Finish: 200 | 201 | rts 202 | } 203 | 204 | CheckGameSpeed:{ 205 | 206 | dec SpeedIncreaseCounter 207 | bne NoSpeedIncrease 208 | 209 | lda SpeedIncreaseCounter + 1 210 | sta SpeedIncreaseCounter 211 | 212 | lda GameCounter + 1 213 | cmp #MaxSpeed 214 | bcc NoSpeedIncrease 215 | 216 | dec GameCounter + 1 217 | dec GameCounter + 1 218 | 219 | NoSpeedIncrease: 220 | 221 | rts 222 | } 223 | 224 | 225 | TestByte: .byte 0 226 | 227 | 228 | 229 | 230 | 231 | 232 | GameTick: { 233 | 234 | inc ZP_COUNTER 235 | 236 | lda GameCounter 237 | cmp #ONE 238 | bcc PerformTick 239 | 240 | dec GameCounter 241 | rts 242 | 243 | PerformTick: 244 | 245 | lda FrameSwitch 246 | beq FlipOn 247 | 248 | lda #ZERO 249 | sta FrameSwitch 250 | 251 | jmp RestoreCounter 252 | 253 | FlipOn: 254 | 255 | lda #ONE 256 | sta FrameSwitch 257 | 258 | RestoreCounter: 259 | 260 | lda GameCounter + 1 261 | sta GameCounter 262 | 263 | asl 264 | sta MONKEY.DropTime 265 | 266 | jsr ENEMIES.Update 267 | jsr KEY.Update 268 | jsr KEY.DrawKey 269 | jsr CAGE.Update 270 | jsr CAGE.Draw 271 | 272 | 273 | lda KEY.Active 274 | beq Finish 275 | 276 | jsr CheckGameSpeed 277 | jsr CheckSpawn 278 | 279 | Finish: 280 | 281 | lda MONKEY.DisableControl 282 | bne NoSound 283 | 284 | jsr SOUND.PlayTick 285 | 286 | NoSound: 287 | rts 288 | } 289 | 290 | 291 | 292 | MainLoop: 293 | 294 | //.break 295 | 296 | 297 | 298 | ldx #1 299 | jsr WaitForRasterLine 300 | jmp MonkeyIRQ 301 | 302 | 303 | PreviousCellID: .byte 0 304 | 305 | 306 | MonkeyIRQ: { 307 | 308 | 309 | 310 | jsr MONKEY.Control 311 | jsr MONKEY.Update 312 | 313 | lda MONKEY.CellID 314 | cmp PreviousCellID 315 | 316 | bne MoveMonkey 317 | 318 | jmp NoMove 319 | 320 | MoveMonkey: 321 | 322 | ldx PreviousCellID 323 | jsr MONKEY.Delete 324 | jsr MONKEY.Draw 325 | 326 | lda MONKEY.CellID 327 | 328 | 329 | NoMove: 330 | 331 | lda MONKEY.CellID 332 | sta PreviousCellID 333 | 334 | jsr SOUND.Update 335 | jsr GameTick 336 | jsr CheckWhetherToUpdateScore 337 | jsr PINEAPPLE.Update 338 | 339 | jmp MainLoop 340 | 341 | 342 | 343 | } 344 | 345 | 346 | Random: { 347 | 348 | jsr RANDOM_NUMBER.Get 349 | 350 | 351 | 352 | rts 353 | 354 | } 355 | #import "setup/assets.asm" 356 | 357 | } 358 | -------------------------------------------------------------------------------- /xPLUS_4/scripts/plus4.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | MAIN: { 4 | 5 | #import "lookups/zeropage.asm" 6 | 7 | * = $1200 "Code1" 8 | #import "setup/upstart.asm" 9 | #import "setup/loadModules.asm" 10 | 11 | GameCounter: .byte 32, 32, 32 12 | SpeedIncreaseCounter: .byte 48, 48 13 | FrameSwitch: .byte 0 14 | TitleCooldown: .byte 30, 30 15 | 16 | BASICStub(0,"Entry") 17 | 18 | .label MaxSpeed = 13 19 | 20 | Entry: 21 | 22 | //exomizer sfx sys -t 64 -x "inc $d020" -o yakf.exo yakf.prg 23 | 24 | sei 25 | 26 | jsr VIC.Setup 27 | jsr SOUND.Setup 28 | 29 | jmp TitleScreen 30 | 31 | 32 | 33 | Loop: 34 | 35 | 36 | jmp Loop 37 | 38 | 39 | TitleScreen: { 40 | 41 | jsr SOUND.StopAll 42 | 43 | lda VIC.RAM_CHAR_ADDRESS 44 | and #%00000011 45 | ora #%00011000 // character ram page 8 $2000/8192 46 | sta VIC.RAM_CHAR_ADDRESS 47 | 48 | lda #%01100111 49 | sta VIC.BACKGROUND_COLOUR // background colour light blue 50 | 51 | lda #%10000000 52 | sta VIC.BORDER_COLOUR // border colour 53 | 54 | DrawMap: 55 | 56 | jsr TITLELOADER.DrawMap 57 | 58 | 59 | lda TitleCooldown + 1 60 | sta TitleCooldown 61 | 62 | jmp TitleLoop 63 | 64 | } 65 | 66 | 67 | 68 | 69 | TitleLoop: { 70 | 71 | lda TitleCooldown 72 | beq GetJoystick 73 | 74 | dec TitleCooldown 75 | jmp TitleLoop 76 | 77 | .label temp = TEMP1 78 | .label JOYSTICKSELECT1 = %00000010 79 | 80 | GetJoystick: 81 | 82 | jsr gatherJoystick1 83 | sta temp 84 | jmp gatherJoystick2 85 | 86 | gatherJoystick1: 87 | lda #$ff 88 | sta $fd30 89 | lda #JOYSTICKSELECT1 90 | sta $ff08 91 | lda $ff08 92 | 93 | rts 94 | 95 | gatherJoystick2: 96 | 97 | jsr gatherJoystick1 98 | cmp temp 99 | bne GetJoystick 100 | 101 | and #JOY_FIRE 102 | bne GetJoystick 103 | 104 | lda #2 105 | sta TitleCooldown 106 | 107 | Loop: 108 | 109 | lda TitleCooldown 110 | beq NewGame 111 | dec TitleCooldown 112 | ldx #1 113 | jsr WaitForRasterLine 114 | jmp Loop 115 | 116 | 117 | } 118 | 119 | 120 | 121 | NewGame:{ 122 | 123 | lda VIC.RAM_CHAR_ADDRESS 124 | and #%00000011 125 | ora #%00100000 // character ram page 8 $2000/8192 126 | sta VIC.RAM_CHAR_ADDRESS 127 | 128 | lda #%01010011 129 | sta VIC.BACKGROUND_COLOUR // background colour light blue 130 | 131 | lda #%10000000 132 | sta VIC.BORDER_COLOUR // border colour 133 | 134 | jsr MAPLOADER.DrawMap 135 | 136 | lda GameCounter + 2 137 | sta GameCounter + 1 138 | sta GameCounter 139 | 140 | jsr CHAR_DRAWING.ClearAll 141 | jsr MONKEY.Reset 142 | jsr SCORE.Reset 143 | jsr KEY.Reset 144 | jsr LIVES.Reset 145 | jsr PINEAPPLE.Reset 146 | jsr CAGE.Reset 147 | jsr CAGE.LockCage 148 | jsr ENEMIES.Reset 149 | 150 | jmp MainLoop 151 | 152 | } 153 | 154 | TestLoop: { 155 | 156 | 157 | 158 | jmp TestLoop 159 | } 160 | 161 | 162 | 163 | WaitForRasterLine: { 164 | 165 | .label RasterTarget = TEMP1 166 | stx RasterTarget 167 | 168 | Loop: 169 | 170 | lda VIC.RASTER_LINE 171 | cmp RasterTarget 172 | bne Loop 173 | 174 | rts 175 | 176 | } 177 | 178 | 179 | 180 | CheckWhetherToUpdateScore: { 181 | 182 | lda ZP_COUNTER 183 | and #3 184 | bne NoScoreAdd 185 | 186 | jsr SCORE.CheckScoreToAdd 187 | 188 | NoScoreAdd: 189 | 190 | rts 191 | } 192 | 193 | 194 | CheckSpawn:{ 195 | 196 | 197 | 198 | jsr Random 199 | 200 | adc #128 201 | cmp #45 202 | bcc DoZero 203 | cmp #210 204 | bcs Finish 205 | 206 | ldy #ONE 207 | jsr ENEMIES.Spawn 208 | jmp Finish 209 | 210 | DoZero: 211 | ldy #ZERO 212 | jsr ENEMIES.Spawn 213 | 214 | Finish: 215 | 216 | rts 217 | } 218 | 219 | CheckGameSpeed:{ 220 | 221 | dec SpeedIncreaseCounter 222 | bne NoSpeedIncrease 223 | 224 | lda SpeedIncreaseCounter + 1 225 | sta SpeedIncreaseCounter 226 | 227 | lda GameCounter + 1 228 | cmp #MaxSpeed 229 | bcc NoSpeedIncrease 230 | 231 | dec GameCounter + 1 232 | dec GameCounter + 1 233 | 234 | NoSpeedIncrease: 235 | 236 | rts 237 | } 238 | 239 | 240 | 241 | GameTick: { 242 | 243 | inc ZP_COUNTER 244 | 245 | lda GameCounter 246 | cmp #ONE 247 | bcc PerformTick 248 | 249 | dec GameCounter 250 | rts 251 | 252 | PerformTick: 253 | 254 | lda FrameSwitch 255 | beq FlipOn 256 | 257 | lda #ZERO 258 | sta FrameSwitch 259 | 260 | jmp RestoreCounter 261 | 262 | FlipOn: 263 | 264 | lda #ONE 265 | sta FrameSwitch 266 | 267 | RestoreCounter: 268 | 269 | lda GameCounter + 1 270 | sta GameCounter 271 | 272 | asl 273 | sta MONKEY.DropTime 274 | 275 | jsr ENEMIES.Update 276 | jsr KEY.Update 277 | jsr KEY.DrawKey 278 | jsr CAGE.Update 279 | jsr CAGE.Draw 280 | 281 | 282 | lda KEY.Active 283 | beq Finish 284 | 285 | jsr CheckGameSpeed 286 | jsr CheckSpawn 287 | 288 | Finish: 289 | 290 | lda MONKEY.DisableControl 291 | bne NoSound 292 | 293 | jsr SOUND.PlayTick 294 | 295 | NoSound: 296 | rts 297 | } 298 | 299 | 300 | MainLoop: 301 | 302 | //.break 303 | 304 | ldx #1 305 | jsr WaitForRasterLine 306 | jmp MonkeyIRQ 307 | 308 | 309 | MonkeyIRQ: { 310 | 311 | 312 | 313 | 314 | jsr MONKEY.Delete 315 | jsr MONKEY.Control 316 | jsr MONKEY.Draw 317 | jsr SOUND.Update 318 | jsr GameTick 319 | jsr CheckWhetherToUpdateScore 320 | jsr PINEAPPLE.Update 321 | 322 | ldx #150 323 | jsr WaitForRasterLine 324 | 325 | jmp MainLoop 326 | 327 | 328 | 329 | } 330 | 331 | 332 | Random: { 333 | 334 | lda $ff1e 335 | 336 | 337 | rts 338 | 339 | } 340 | #import "setup/assets.asm" 341 | 342 | } 343 | 344 | 345 | 346 | 347 | -------------------------------------------------------------------------------- /scripts/interrupts/key.asm: -------------------------------------------------------------------------------- 1 | KEY:{ 2 | 3 | Frames: .byte 23, 22, 39, 38 4 | Positions: .byte 0, 0, 1, 2, 3, 2, 1 5 | Position: .byte 0 6 | XPos: .byte 150, 146, 138, 125 7 | YPos: .byte 80, 81, 82, 82 8 | WillCatch: .byte 0, 0, 0, 1, 1, 0, 0 9 | Active: .byte 1 10 | ForceKey: .byte 0 11 | 12 | .label CaughtKeyFrame = 18 13 | .label MissedKeyFrame = 12 14 | .label InDitchFrame = 23 15 | .label OpenLockFrame = 24 16 | .label FallGracefullyFrame = 13 17 | .label TicksWhileUnlocking = 4 18 | .label TicksWhileFalling = 2 19 | 20 | Initialise: { 21 | 22 | jsr Reset 23 | rts 24 | 25 | } 26 | 27 | 28 | Reset:{ 29 | 30 | lda #BLACK 31 | sta VIC.SPRITE_COLOR_4 32 | sta ForceKey 33 | lda #ONE 34 | sta Active 35 | 36 | rts 37 | 38 | } 39 | 40 | GoingForKey: { 41 | 42 | 43 | dec MONKEY.GoingForKey 44 | lda MONKEY.GoingForKey 45 | bne Wait 46 | 47 | ldy Position 48 | lda WillCatch, y 49 | beq MissedKey 50 | 51 | CaughtKey: 52 | 53 | lda #CaughtKeyFrame 54 | sta MONKEY.CellID 55 | jsr SID.MoveMonkey 56 | 57 | lda #ONE 58 | sta MONKEY.GotKey 59 | sta MONKEY.AtCage 60 | 61 | ldx CAGE.SectionsUnlocked 62 | inc CAGE.SectionsUnlocked 63 | lda #ONE 64 | sta CAGE.SectionUnlocked, x 65 | 66 | jmp Complete 67 | 68 | 69 | MissedKey: 70 | 71 | lda #MissedKeyFrame 72 | sta MONKEY.CellID 73 | 74 | lda #TicksWhileFalling 75 | sta MONKEY.MissedKey 76 | 77 | Complete: 78 | 79 | lda #ZERO 80 | sta Active 81 | lda #ONE 82 | //sta ForceKey 83 | 84 | Wait: 85 | rts 86 | 87 | } 88 | 89 | 90 | 91 | MissedKey: { 92 | 93 | //lda #ZERO 94 | //sta Active 95 | 96 | lda #InDitchFrame 97 | sta MONKEY.CellID 98 | lda #TicksWhileFalling 99 | sta MONKEY.InDitch 100 | dec MONKEY.MissedKey 101 | 102 | rts 103 | 104 | } 105 | 106 | 107 | GotKey:{ 108 | 109 | //dec $d020 110 | 111 | //lda #ZERO 112 | //sta Active 113 | 114 | lda #OpenLockFrame 115 | sta MONKEY.CellID 116 | lda #TicksWhileUnlocking 117 | sta MONKEY.Unlocking 118 | jsr SCORE.UnlockSection 119 | dec MONKEY.GotKey 120 | 121 | lda CAGE.SectionsUnlocked 122 | cmp #4 123 | bne Complete 124 | 125 | jsr SCORE.UnlockCage 126 | jsr CAGE.Smile 127 | 128 | Complete: 129 | 130 | rts 131 | 132 | } 133 | 134 | 135 | 136 | DrawKey2: 137 | jsr DrawKey 138 | rts 139 | 140 | 141 | LoseLife: { 142 | 143 | jsr LIVES.LoseLife 144 | jsr SID.MoveMonkey 145 | jsr MONKEY.Reset 146 | jsr Reset 147 | jsr CAGE.Reset 148 | jsr ENEMIES.RemoveClose 149 | 150 | lda LIVES.Value 151 | beq GameOver 152 | rts 153 | } 154 | 155 | 156 | InDitch:{ 157 | 158 | 159 | dec MONKEY.InDitch 160 | lda MONKEY.InDitch 161 | bne Wait 162 | 163 | jsr LoseLife 164 | 165 | Wait: 166 | 167 | jsr SID.DieSound 168 | rts 169 | 170 | 171 | 172 | } 173 | 174 | GoingForKey2: 175 | jmp GoingForKey 176 | 177 | 178 | GameOver:{ 179 | 180 | jsr MAIN.NewGame 181 | rts 182 | 183 | } 184 | 185 | GotKey2: 186 | jmp GotKey 187 | 188 | MissedKey2: 189 | jmp MissedKey 190 | 191 | 192 | 193 | Unlocking:{ 194 | 195 | dec MONKEY.Unlocking 196 | lda MONKEY.Unlocking 197 | bne Wait 198 | 199 | // lda SCORE.KeyScore 200 | 201 | 202 | lda #TicksWhileFalling 203 | sta MONKEY.FallGracefully 204 | lda #FallGracefullyFrame 205 | sta MONKEY.CellID 206 | jsr SID.MoveMonkey 207 | 208 | 209 | 210 | Wait: 211 | 212 | rts 213 | 214 | } 215 | 216 | InDitch2: 217 | jmp InDitch 218 | 219 | 220 | FallGracefully: { 221 | 222 | dec MONKEY.FallGracefully 223 | lda MONKEY.FallGracefully 224 | bne Wait 225 | 226 | jsr SID.MoveMonkey 227 | jsr MONKEY.Reset 228 | jsr Reset 229 | jsr CAGE.Reset 230 | jsr ENEMIES.RemoveClose 231 | 232 | lda CAGE.SectionsUnlocked 233 | cmp #4 234 | bne Wait 235 | 236 | jsr CAGE.LockCage 237 | 238 | Wait: 239 | 240 | rts 241 | 242 | 243 | } 244 | 245 | 246 | Unlocking2: { 247 | 248 | jmp Unlocking 249 | } 250 | 251 | HitByEnemy: { 252 | 253 | lda #ZERO 254 | sta Active 255 | 256 | dec MONKEY.HitByEnemy 257 | lda MONKEY.HitByEnemy 258 | 259 | bne Wait 260 | 261 | jsr LoseLife 262 | rts 263 | 264 | Wait: 265 | 266 | jsr SID.DieSound 267 | rts 268 | 269 | 270 | } 271 | 272 | Update: { 273 | 274 | 275 | 276 | lda MONKEY.GoingForKey 277 | bne GoingForKey2 278 | 279 | lda MONKEY.GotKey 280 | bne GotKey2 281 | 282 | lda MONKEY.MissedKey 283 | bne MissedKey2 284 | 285 | lda MONKEY.InDitch 286 | bne InDitch2 287 | 288 | lda MONKEY.Unlocking 289 | bne Unlocking2 290 | 291 | lda MONKEY.FallGracefully 292 | bne FallGracefully 293 | 294 | lda MONKEY.HitByEnemy 295 | bne HitByEnemy 296 | 297 | lda Active 298 | beq NoKey 299 | 300 | MoveKey: 301 | 302 | inc Position 303 | lda Position 304 | cmp #7 305 | bne NoKey 306 | 307 | lda #ZERO 308 | sta Position 309 | 310 | 311 | NoKey: 312 | rts 313 | 314 | 315 | } 316 | 317 | DrawKey: { 318 | 319 | lda ForceKey 320 | bne SkipCheck 321 | 322 | lda #ZERO 323 | sta ForceKey 324 | 325 | lda Active 326 | beq NoKey 327 | 328 | SkipCheck: 329 | 330 | clc 331 | ldy Position 332 | ldx Positions, y 333 | lda Frames, x 334 | adc #64 335 | sta SPRITE_POINTERS + 4 336 | lda XPos, x 337 | sta VIC.SPRITE_4_X 338 | lda YPos, x 339 | sta VIC.SPRITE_4_Y 340 | 341 | lda VIC.SPRITE_MSB 342 | and #%11101111 343 | sta VIC.SPRITE_MSB 344 | 345 | //lda VIC.SPRITE_ENABLE 346 | //ora #%00010000 347 | //sta VIC.SPRITE_ENABLE 348 | 349 | NoKey: 350 | 351 | rts 352 | 353 | } 354 | 355 | 356 | 357 | } -------------------------------------------------------------------------------- /vic20/scripts/modules/key.asm: -------------------------------------------------------------------------------- 1 | KEY:{ 2 | 3 | ObjectIDs: .byte 49, 48, 47, 46 4 | Positions: .byte 0, 0, 1, 2, 3, 2, 1 5 | Position: .byte 0 6 | WillCatch: .byte 0, 0, 0, 1, 1, 0, 0 7 | Active: .byte 1 8 | ForceKey: .byte 0 9 | 10 | .label CaughtKeyFrame = 24 11 | .label MissedKeyFrame = 12 12 | .label InDitchFrame = 18 13 | .label OpenLockFrame = 24 14 | .label FallGracefullyFrame = 13 15 | .label TicksWhileUnlocking = 4 16 | .label TicksWhileFalling = 2 17 | 18 | Initialise: { 19 | 20 | jsr Reset 21 | rts 22 | 23 | } 24 | 25 | 26 | Reset:{ 27 | 28 | sta ForceKey 29 | lda #ONE 30 | sta Active 31 | 32 | rts 33 | 34 | } 35 | 36 | GoingForKey: { 37 | 38 | 39 | dec MONKEY.GoingForKey 40 | lda MONKEY.GoingForKey 41 | bne Wait 42 | 43 | ldy Position 44 | lda WillCatch, y 45 | beq MissedKey 46 | 47 | CaughtKey: 48 | 49 | jsr MONKEY.Delete 50 | lda #CaughtKeyFrame 51 | sta MONKEY.CellID 52 | jsr SOUND.MoveMonkey 53 | 54 | lda #ONE 55 | sta MONKEY.GotKey 56 | sta MONKEY.AtCage 57 | 58 | ldx CAGE.SectionsUnlocked 59 | inc CAGE.SectionsUnlocked 60 | lda #ONE 61 | sta CAGE.SectionUnlocked, x 62 | 63 | jmp Complete 64 | 65 | 66 | MissedKey: 67 | jsr MONKEY.Delete 68 | lda #MissedKeyFrame 69 | sta MONKEY.CellID 70 | 71 | lda #TicksWhileFalling 72 | sta MONKEY.MissedKey 73 | 74 | Complete: 75 | 76 | lda #ZERO 77 | sta Active 78 | lda #ONE 79 | //sta ForceKey 80 | 81 | Wait: 82 | rts 83 | 84 | } 85 | 86 | 87 | 88 | MissedKey: { 89 | 90 | //lda #ZERO 91 | //sta Active 92 | jsr MONKEY.Delete 93 | lda #InDitchFrame 94 | sta MONKEY.CellID 95 | lda #TicksWhileFalling 96 | sta MONKEY.InDitch 97 | dec MONKEY.MissedKey 98 | 99 | rts 100 | 101 | } 102 | 103 | 104 | GotKey:{ 105 | 106 | //dec $d020 107 | 108 | //lda #ZERO 109 | //sta Active 110 | 111 | jsr MONKEY.Delete 112 | lda #OpenLockFrame 113 | 114 | 115 | sta MONKEY.CellID 116 | lda #TicksWhileUnlocking 117 | sta MONKEY.Unlocking 118 | jsr SCORE.UnlockSection 119 | dec MONKEY.GotKey 120 | 121 | lda CAGE.SectionsUnlocked 122 | cmp #4 123 | bne Complete 124 | 125 | jsr SCORE.UnlockCage 126 | jsr CAGE.UnlockCage 127 | 128 | 129 | 130 | Complete: 131 | 132 | rts 133 | 134 | } 135 | 136 | 137 | 138 | DrawKey2: 139 | jsr DrawKey 140 | rts 141 | 142 | 143 | LoseLife: { 144 | 145 | jsr LIVES.LoseLife 146 | 147 | jsr MONKEY.Reset 148 | jsr Reset 149 | jsr CAGE.Reset 150 | jsr ENEMIES.RemoveClose 151 | 152 | jsr SOUND.MoveMonkey 153 | 154 | lda LIVES.Value 155 | beq GameOver 156 | rts 157 | } 158 | 159 | 160 | InDitch:{ 161 | 162 | 163 | dec MONKEY.InDitch 164 | lda MONKEY.InDitch 165 | bne Wait 166 | 167 | jsr LoseLife 168 | 169 | Wait: 170 | 171 | jsr SOUND.DeathSound 172 | rts 173 | 174 | 175 | 176 | } 177 | 178 | GoingForKey2: 179 | jmp GoingForKey 180 | 181 | 182 | GameOver:{ 183 | 184 | jmp MAIN.TitleScreen 185 | 186 | } 187 | 188 | GotKey2: 189 | jmp GotKey 190 | 191 | MissedKey2: 192 | jmp MissedKey 193 | 194 | 195 | 196 | Unlocking:{ 197 | 198 | dec MONKEY.Unlocking 199 | lda MONKEY.Unlocking 200 | bne Wait 201 | 202 | // lda SCORE.KeyScore 203 | 204 | 205 | lda #TicksWhileFalling 206 | sta MONKEY.FallGracefully 207 | 208 | jsr CAGE.TurnOffMonkey 209 | 210 | lda #ZERO 211 | sta MONKEY.AtCage 212 | 213 | jsr MONKEY.Delete 214 | lda #FallGracefullyFrame 215 | sta MONKEY.CellID 216 | jsr SOUND.MoveMonkey 217 | 218 | 219 | 220 | Wait: 221 | 222 | rts 223 | 224 | } 225 | 226 | InDitch2: 227 | jmp InDitch 228 | 229 | 230 | FallGracefully: { 231 | 232 | dec MONKEY.FallGracefully 233 | lda MONKEY.FallGracefully 234 | bne Wait 235 | 236 | jsr SOUND.MoveMonkey 237 | jsr MONKEY.Reset 238 | jsr Reset 239 | jsr CAGE.Reset 240 | jsr ENEMIES.RemoveClose 241 | 242 | lda CAGE.SectionsUnlocked 243 | cmp #4 244 | bne Wait 245 | 246 | jsr CAGE.LockCage 247 | 248 | Wait: 249 | 250 | rts 251 | 252 | 253 | } 254 | 255 | 256 | Unlocking2: { 257 | 258 | jmp Unlocking 259 | } 260 | 261 | HitByEnemy: { 262 | 263 | 264 | lda #ZERO 265 | sta Active 266 | 267 | dec MONKEY.HitByEnemy 268 | lda MONKEY.HitByEnemy 269 | 270 | bne Wait 271 | 272 | jsr LoseLife 273 | rts 274 | 275 | Wait: 276 | 277 | //jsr SID.DieSound 278 | rts 279 | 280 | 281 | } 282 | 283 | Update: { 284 | 285 | 286 | ldx Position 287 | ldy Positions, x 288 | ldx ObjectIDs, y 289 | 290 | ldy #ZERO 291 | jsr CHAR_DRAWING.ColourObject 292 | 293 | lda MONKEY.GoingForKey 294 | beq NotGoingForKey 295 | 296 | jmp GoingForKey 297 | 298 | NotGoingForKey: 299 | 300 | lda MONKEY.GotKey 301 | bne GotKey2 302 | 303 | lda MONKEY.MissedKey 304 | bne MissedKey2 305 | 306 | lda MONKEY.InDitch 307 | bne InDitch2 308 | 309 | lda MONKEY.Unlocking 310 | bne Unlocking2 311 | 312 | lda MONKEY.FallGracefully 313 | bne FallGracefully 314 | 315 | lda MONKEY.HitByEnemy 316 | bne HitByEnemy 317 | 318 | lda Active 319 | beq NoKey 320 | 321 | MoveKey: 322 | 323 | 324 | inc Position 325 | lda Position 326 | cmp #7 327 | bne NoKey 328 | 329 | lda #ZERO 330 | sta Position 331 | 332 | 333 | NoKey: 334 | rts 335 | 336 | 337 | } 338 | 339 | DrawKey: { 340 | 341 | lda MONKEY.AtCage 342 | bne NoKey 343 | 344 | 345 | lda ForceKey 346 | bne SkipCheck 347 | 348 | lda #ZERO 349 | sta ForceKey 350 | 351 | lda Active 352 | beq NoKey 353 | 354 | SkipCheck: 355 | 356 | clc 357 | ldx Position 358 | ldy Positions, x 359 | ldx ObjectIDs, y 360 | ldy #ONE 361 | jsr CHAR_DRAWING.ColourObject 362 | 363 | 364 | NoKey: 365 | 366 | rts 367 | 368 | } 369 | 370 | 371 | 372 | } --------------------------------------------------------------------------------