Yesterday I started making a game in asm using ion. Eventually I want it to be sorta like a game in C# from a book I have read (sorry for the size )
Here is my beginning representation:
And here is the code. (MIMAS syntax, btw)
It's not very optimized right now, but I should fix that eventually.
Code:
I hope to complete this eventually. I will need to learn a lot more complex parts of asm before finishing it, though. (Note to self - finish reading "Learn Asm in 28 Days")
Here is my beginning representation:
And here is the code. (MIMAS syntax, btw)
It's not very optimized right now, but I should fix that eventually.
Code:
;#SECTION "MAIN", CODE
storage equ appBackUpScreen
mex equ storage + 1
shotinscreen equ storage + 2
shotx equ storage + 3
shoty equ storage + 4
org userMem - 2
db 0BBh, 6Dh
ret
jr nc, Start
db "Move", 0
Start:
ld a, 0
ld (shotinscreen), a
ld a, 47
ld (shoty), a
B_CALL _ClrLCDFull
B_CALL _GrBufClr
ld a, 48
ld (mex), a
ld b, 8
ld a, 0
ld l, 56
call Quick
ld b, 8
ld a, 8
ld l, 56
call Quick
ld b, 8
ld a, 16
ld l, 56
call Quick
ld b, 8
ld a, 24
ld l, 56
call Quick
ld b, 8
ld a, 32
ld l, 56
call Quick
ld b, 8
ld a, 40
ld l, 56
call Quick
ld b, 8
ld a, 48
ld l, 56
call Quick
ld b, 8
ld a, 56
ld l, a
call Quick
ld b, 8
ld a, 64
ld l, 56
call Quick
ld b, 8
ld a, 72
ld l, 56
call Quick
ld b, 8
ld a, 80
ld l, 56
call Quick
ld b, 8
ld a, 88
ld l, 56
call Quick
ld b, 8
ld a, (mex)
ld l, 48
ld ix, Me
call ionPutSprite
call ionFastCopy
ld b, 8
ld a, (mex)
ld l, 48
ld ix, Me
call ionPutSprite
Game:
ld b, 8
ld a, (mex)
ld l, 48
ld ix, Me
call ionPutSprite
call ionFastCopy
ld b, 8
ld a, (mex)
ld l, 48
ld ix, Me
call ionPutSprite
ld a, (shotinscreen)
cp 1
call z, Shot
call getkd
ld a, b
cp KD_CLEAR
jr z, Exit
cp KD_LEFT
call z, Left
cp KD_RIGHT
call z, Right
cp KD_2ND
call z, Shoot
cp 11101101b
jr z, BL
cp 11101011b
jr z, BR
jr Game
Exit:
B_CALL _GrBufClr
B_CALL _ClrLCDFull
ret
BL:
call Shoot
call Left
jr Game
BR:
call Shoot
call Right
jr Game
Left:
ld a, (mex)
cp 0
ret z
sub 1
ld (mex), a
ret
Right:
ld a, (mex)
cp 88
ret z
add a, 1
ld (mex), a
ret
Shoot:
ld a, (shotinscreen)
cp 1
ret z
ld a, 1
ld (shotinscreen), a
ld b, 8
ld a, (shoty)
ld l, a
ld a, (mex)
ld (shotx), a
ld ix, Sm
call ionPutSprite
ret
Shot:
ld b, 8
ld a, (shoty)
ld l, a
ld a, (shotx)
ld ix, Sm
call ionPutSprite
ld a, (shoty)
cp 0
jr z, Ends
dec a
ld (shoty), a
ld l, a
ld b, 8
ld a, (shotx)
ld ix, Sm
call ionPutSprite
ret
Ends:
ld a, 47
ld (shoty), a
ld a, 0
ld (shotinscreen), a
ret
Quick:
ld ix, block1
call ionPutSprite
ret
block1:
db 11111111b
db 11101110b
db 01010101b
db 10101010b
db 01010101b
db 10101010b
db 01110111b
db 11111111b
Me:
db 00000000b
db 00011000b
db 00011000b
db 00111100b
db 00111100b
db 01111110b
db 01111110b
db 01111110b
Sm:
db 00011000b
db 00011000b
db 00000000b
db 00000000b
db 00000000b
db 00000000b
db 00000000b
db 00000000b
;#IMPORT "GETKEY"
;#IMPORT "IonEqu"
I hope to complete this eventually. I will need to learn a lot more complex parts of asm before finishing it, though. (Note to self - finish reading "Learn Asm in 28 Days")