diff --git a/.gitignore b/.gitignore
index d822394..452793a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
-/itema.prg
-/itema.sym
-/itema.vs
+/*.prg
+/*.sym
+/*.vs
/bin/
source.txt
.source.txt
@@ -8,3 +8,5 @@ itema.asm
petscii/convert-screens.prg
petscii/convert-screens.mod
petscii/convert-screens.sym
+out
+/_library/
diff --git a/.project b/.project
index 71e845e..f25f73a 100644
--- a/.project
+++ b/.project
@@ -5,7 +5,13 @@
+
+ net.resheim.eclipse.kickassembler.core.kickassemblerBuilder
+
+
+
+ net.resheim.eclipse.kickassembler.core.kickassemblerNature
diff --git a/README.md b/README.md
index 303c251..86e06d1 100644
--- a/README.md
+++ b/README.md
@@ -7,3 +7,4 @@ This game requires a paddle to play. When using the VICE emulator, add the follo
* [Codebase64](https://codebase64.org/doku.php?id=start)
* [Dustlayer](https://dustlayer.com)
* [Kick Assembler User Guide](http://www.theweb.dk/KickAssembler/webhelp/content/cpt_Introduction.html)
+* [KickAssembler syntax for Vim](https://github.com/gryf/kickass-syntax-vim)
diff --git a/itema.asm b/itema.asm
index ca73422..2388472 100644
--- a/itema.asm
+++ b/itema.asm
@@ -1,5 +1,5 @@
/*
- Bouncing ball demo
+ A small Breakout-like game featuring balls with simulated physics
Copyright (c) 2020-2023 Itema AS
@@ -13,7 +13,6 @@
* = $c000 "Main Program"
-// import our sprite library
#import "libSprite.asm"
#import "libInput.asm"
#import "libScreen.asm"
@@ -21,12 +20,11 @@
BasicUpstart2(initialize)
-
.var music = LoadSid("music/Nightshift.sid") //<- Here we load the sid file
.var demo_mode_movement_timer = $0
// Initialize
-initialize:
+initialize:
jsr $e544 // Clear screen
lda #$06 // Set the background color for the game area
@@ -108,8 +106,8 @@ initialize:
lda $d018
ora #%00001110 // Set chars location to $3800 for displaying the custom font
-sta $d018 // Bits 1-3 ($0400 + 512 .bytes * low nibble value) of $D018 sets char location
- // $400 + $200*$0E = $3800
+sta $d018 // Bits 1-3 ($0400 + 512 .bytes * low nibble value) of $D018
+ //sets char location $400 + $200*$0E = $3800
lda $d016 // turn off multicolor for characters
and #%11101111 // by clearing bit #4 of $D016
sta $d016
@@ -119,16 +117,7 @@ sta $d016
*/
jsr init_irq
-/*
- Load the initial screen
- $4500 - intro screen
- $4d00 - level 1
-*/
-lda #$4d
-sta $ff
-lda #$00
-sta $fe
-jsr load_screen
+LOAD_SCREEN(1)
/*
Main loop
@@ -136,22 +125,18 @@ jsr load_screen
loop:
jmp loop
+/*
+ Use this for demo input, it's very stupid and needs improvement
+*/
demo_input:
- lda $d012
- eor $dc04
- sbc $dc05 // Get a pseudo random number from CIA timers
- and #$0F
- cmp #$08
- bcc isSmaller
- sbc #$08
- isSmaller:
- sta temp
- lda SpriteMem+9
- sbc #$06 // Adjust for ball radius
- adc temp
- jsr store_xl // Store the paddle x-position
+ lda SpriteMem+9 // Get the x-position of the ball
+ sbc #$03 // Adjust for ball radius
+ jsr paddle_position
rts
+/*
+ Use this for actual player input
+*/
paddle_input:
lda $dc00 // Load value from CIA#1 Data Port A (pot lines are input)
and #%11111110 // Set bit 0 to input for pot x (paddle 1)
@@ -164,8 +149,8 @@ paddle_input:
lda $d419 // Load value from Paddle X pot
eor #$ff // XOR with 255 to reverse the range
- // Update paddle position unless it is outside the playing area
-
+// Update paddle position unless it is outside the playing area
+ paddle_position:
clc
cmp #$1a // Compare with the minimum value
bcs piNotLess // If carry is set (number >= minValue), branch to piNotLess
@@ -208,9 +193,9 @@ irq_1:
lda #$00
sta SpriteIndex
jsr paddle_input
+ //jsr demo_input
animation_loop:
-
clc
lda SpriteIndex
cmp #$00
diff --git a/font.asm b/library/font.asm
similarity index 100%
rename from font.asm
rename to library/font.asm
diff --git a/libInput.asm b/library/libInput.asm
similarity index 88%
rename from libInput.asm
rename to library/libInput.asm
index 8dbfed8..57e5688 100644
--- a/libInput.asm
+++ b/library/libInput.asm
@@ -11,4 +11,4 @@
{
lda $DC00 // Load joystick 2 state to A
and #portMask // Mask out direction/fire required
-} // Test with bne immediately after the call
\ No newline at end of file
+} // Test with bne immediately after the call
diff --git a/libScreen.asm b/library/libScreen.asm
similarity index 88%
rename from libScreen.asm
rename to library/libScreen.asm
index 183cf7b..2b53a6e 100644
--- a/libScreen.asm
+++ b/library/libScreen.asm
@@ -49,21 +49,40 @@ memcp_nextpage:
memcp_out:
}
+/*
+ For each screen added, specify the pointer to it using the little
+ endian adress.
+*/
+ScreenPointers:
+ .byte $00, $45 // Introduction screen
+ .byte $00, $4d // Level 1
+
+/*
+ Use this to load a screen number.
+*/
+.macro LOAD_SCREEN(number){
+ ldx number
+ lda ScreenPointers+(number*2)
+ sta $fe
+ lda ScreenPointers+(number*2)+1
+ sta $ff
+ jsr load_screen
+}
+
/*
Load a screen from the address prepared in in zeropage
$fe β lowest byte
$ff - highest byte
*/
load_screen:
-
// Start with the characters
lda #$00
sta MEMCP_DSTVECT
- lda $fe // zeropage
+ lda $fe
sta MEMCP_SRCVECT
lda #$04
sta MEMCP_DSTVECT+1
- lda $ff // zeropage
+ lda $ff
sta MEMCP_SRCVECT+1
lda #$00
sta MEMCP_CNTVECT // Initialize low byte of counter
@@ -81,7 +100,7 @@ load_screen:
adc #$03 // Add the MSB for modification
bcc noCarry // Branch if no carry from the first addition
adc #$01 // Add the carry from the first addition
-
+
noCarry:
sta MEMCP_SRCVECT+1
@@ -124,4 +143,4 @@ continue_loop:
end_loop:
-rts
\ No newline at end of file
+rts
diff --git a/libSprite.asm b/library/libSprite.asm
similarity index 99%
rename from libSprite.asm
rename to library/libSprite.asm
index 5946e96..995ae04 100644
--- a/libSprite.asm
+++ b/library/libSprite.asm
@@ -106,7 +106,7 @@ get_sprite_offset:
cpx #$00
beq got_sprite_offset
clc
- adc #$2
+ adc #$02
dex
jmp get_sprite_offset_loop
diff --git a/libSpriteData.asm b/library/libSpriteData.asm
similarity index 98%
rename from libSpriteData.asm
rename to library/libSpriteData.asm
index da31b81..05de16e 100644
--- a/libSpriteData.asm
+++ b/library/libSpriteData.asm
@@ -32,7 +32,7 @@ SpriteMem:
xl xm yl ym xv yv xa ya f
*/
.byte $73, $00, $e0, $00, $00, $00, $00, $00, $00 // Paddle (the player)
- .byte $73, $00, $60, $00, $00, $00, $00, $00, $00 // Ball 1
+ .byte $33, $00, $60, $00, $30, $00, $00, $00, $00 // Ball 1
.byte $73, $00, $70, $00, $00, $00, $00, $00, $00 // Ball 2
.byte $18, $00, $62, $00, $00, $00, $00, $00, $00
.byte $18, $00, $72, $00, $00, $00, $00, $00, $00
diff --git a/petscii/README.md b/petscii/README.md
index f6f0c0f..772c951 100644
--- a/petscii/README.md
+++ b/petscii/README.md
@@ -1,5 +1,11 @@
# Generating level files
+
+**Prerequisites:**
+
+- Kick Assembler
+- `x64sc` in `$PATH`
+
Use http://petscii.krissz.hu/ to design the levels:
1. Load `itemaball.pe` found in this folder
@@ -9,4 +15,3 @@ Use http://petscii.krissz.hu/ to design the levels:
- level screens must be named 'level_.seq'
4. Update 'convert-screens.sh'
5. Run 'convert-screens.sh'
-
diff --git a/petscii/convert-screens.asm b/petscii/convert-screens.asm
index ad9ae79..cb4a032 100644
--- a/petscii/convert-screens.asm
+++ b/petscii/convert-screens.asm
@@ -1,5 +1,5 @@
/*
- This program will read PETSCII commands crom the SEQ file generated by the
+ This program will read PETSCII commands from the SEQ file generated by the
online PETSCII editor at http://petscii.krissz.hu. These files are
basically a sequence of bytes, where each byte is a PETSCII character.
diff --git a/petscii/intro.bin b/petscii/intro.bin
index b25eca9..b116ffc 100644
Binary files a/petscii/intro.bin and b/petscii/intro.bin differ
diff --git a/petscii/intro.seq b/petscii/intro.seq
index 654862b..54757ad 100644
--- a/petscii/intro.seq
+++ b/petscii/intro.seq
@@ -1 +1 @@
-(&&&&&&&&&&&&&&&&&&&&&&&&!) $ %) ITEMA $ %) $ %) HACKATHON $ %) $ %) FR[YA 2023 $ INSERT PADDLE INTOΏΏΏ %) $ %) $ PORT 1 AND PRESS %) $ %) $ ΏΏ FIRE TO PLAY %) $ Ώ %) $ ΏΏ %) $ ΏΏΏ ΏΏ+%) $ ΏΏΏ Ώ ΏΏΏ %) $ Ώ %) $ %) $ %) $ Ώ %) $ %) $ COPYRIGHT 2023 %) $ %) `abcd $ ITEMA AS %) pqrst $ %) ""''''''''''''''''''''''''#)
\ No newline at end of file
+(&&&&&&&&&&&&&&&&&&&&&&&&!) $ %) ITEMA $ %) $ %) HACKATHON $ %) $ %) FR[YA 2023 $ INSERT PADDLE INTO %) $ %) $ PORT 1 AND PRESS %) $ %) $‘‘‘ FIRE TO PLAY %) $ %) $ %) $ %) $ ‘‘‘‘‘ %) $ %) $ %) $ ££ %) $ ££ %) $ %) $ COPYRIGHT 2023 %) $ %) `abcd $ ITEMA AS %) pqrst $ %) ""''''''''''''''''''''''''#)
\ No newline at end of file