This code, and the program it generates are freeware, and no fee may be charged for them or any program/package which contains them. You may distrubute, use and edit for personal use as much as you wish, but you may not distrubute a editied copy. I cannot be held responsible for any lose of data or damage to your computer including but not limited to that caused by giant and or normal sized armadillos because of your use. Reading any further, compiling or accessing in any way armadilo.8xp including sending to a calculator or emulator therof implies consent to these terms. Copyright 2001 by Alex Roper Some Rights Reserved.

.nolist
 #include "ti83plus.inc"
 #include "mirage.inc"
 #define tempbyte savesscreen+1
 #define movesleft tempbyte
 #define armasflipped tempbyte+1
 #define armasmadeit armasflipped+2
 #define gamespeed armasmadeit+2
 #define gamediff gamespeed+1
 #define userpos gamediff+1
 #define realspeed userpos+1
	;Matrix rows are numbered 1 (CURROW=7) to 7 (CURROW=1)
 #define row1 realspeed+1
 #define row2 row1+5
 #define row3 row2+5
 #define row4 row3+5
 #define row5 row4+5
 #define row6 row5+5
 #define row7 row6+5
 #define blankrow row7+5
 #define tempword blankrow+5
.list
  .org $9d93        ;Origin
  .db $BB,$6D             ;Compiled AsmPrgm token
  ret                     ;Header Byte 1 -- So TIOS wont run
  .db 1                  ;Header Byte 2 -- Identifies as MirageOS prog
button:                       ;Button - should be a 15x15 graphic
	.db %00000100,%01000000
	.db %00100100,%01001000
	.db %00111011,%10111000
	.db %00001111,%11100000
	.db %00001111,%11100000
	.db %11111111,%11111110
	.db %00011111,%11110000
	.db %00011111,%11110000
	.db %11111111,%11111110
	.db %00001111,%11100000
	.db %00001111,%11100000
	.db %00010011,%10010000
	.db %00100000,%00001000
	.db %00000000,%00000000
	.db %00000000,%00000000
desc:                     ;Description - zero terminated
 .db "Armadillo Invasion!!!!!",0
progstart:
	ld b,100
	ld hl,savesscreen
clearllloop:
	ld (hl),0
	inc hl
	djnz clearllloop
	ld a,1
	ld (gamediff),a
	ld (gamespeed),a
	ld (userpos),a
	ld (tempbyte),a
prefsrfrsh:
	call scnclr
;	ld h,37
;	ld l,19
;	ld d,88
;	ld e,l
	ld hl,$2513
	ld de,$5813
	call FastLineB
;	ld h,37
;	ld l,20
;	ld d,88
;	ld e,l
	ld hl,$2514
	ld de,$5814
	call FastLineB
	ld hl,$251B
	ld de,$581B
	call FastLineB
	ld hl,$251C
	ld de,$581C
	call FastLineB
	ld a,(gamespeed)
	call postogrph
	ld l,16
	ld ix,scrollmarker
	push ix
	call putsprite8
	ld a,(gamediff)
	call postogrph
	ld l,24
	pop ix
	call putsprite8
	call iFastCopy
	ld hl,txt
	bcall(_PutS)
	ld hl,$0103
	ld (currow),hl
	ld hl,txt2
	bcall(_PutS)
 	ld hl,$0104
	ld (currow),hl
	ld hl,txt3
	bcall(_PutS)
	ld hl,$0105
	ld (currow),hl
	ld hl,txt4
	bcall(_PutS)
	call rstdisp
	ld a,(tempbyte)
	inc a
	ld (currow),a
	ld a,$05
	bcall(_PutC)
prefsinvalidkey:
	bcall(_GetKey)
	dec a
	jr z,prefsright
	dec a
	jr z,prefsleft
	dec a
	jr z,prefsup
	dec a
	jr z,prefsdn
	dec a
	jp z,prefsgo
	jr prefsinvalidkey
prefsup:
	ld a,(tempbyte)
	dec a
	or a
	jr z,prefsinvalidkey
	ld (tempbyte),a
	jr prefsrfrshI
prefsdn:
	ld a,(tempbyte)
	cp 4
	jr z,prefsinvalidkey
	inc a
	ld (tempbyte),a
	jr prefsrfrshI
prefsright:
	call prefsisitgo ;Also puts address of current scrollbar into hl
	ld a,5
	cp (hl)
	jr z,prefsinvalidkey
	inc (hl)
prefsrfrshI:
	jp prefsrfrsh
prefsleft:
	call prefsisitgo
	ld a,1
	cp (hl)
	jr z,prefsinvalidkey
	dec (hl)
	jr prefsrfrshI
startgame:
	ld a,(gamespeed)
	ld b,a
	ld a,6
	sub b
	ld (realspeed),a
	bcall(_PutC)
game:
	ld a,(realspeed)
	ld (movesleft),a
rfrshsameturn:
	call scnclr
	ld a,(userpos)
	add a,a
	add a,a
	add a,a
	ld l,0
	ld ix,you
	call putsprite8
	;Now draw the Armadillos
	ld c,64
	ld hl,row1
drawarmalp:
	ld b,5
	ld a,c
	sub 8
	or a
	jr z,donedrawingarmas
	ld c,a
inner_arma_lp:
	ld a,(hl)
	or a
	jr z,continue_inner
	push bc
	push hl
	ld l,c
	dec a
	add a,a
	add a,a
	add a,a
	ld ix,armadillo
	call putsprite8
	pop hl
	pop bc
continue_inner:
	inc hl
	djnz inner_arma_lp
	jr drawarmalp
donedrawingarmas:
	call iFastCopy
getcsclp:
	ld b,75
	ei
loopy:
	bcall(_GetCSC)
	or a
	jp nz,processkey
	halt
	djnz loopy
armadillosturn:
	;Did any Armadillos make it through?
	ld b,5
	ld de,row7
didanymakeitlp:
	ld a,(de)
	or a
	jr z,nosirnone
	ld hl,(armasmadeit)
	inc hl
	ld (armasmadeit),hl
nosirnone:
	inc de
	djnz didanymakeitlp
	;Move them all up one line
	ld hl,row6
	ld de,row7
	ld bc,5
	push bc
	ldir
	pop bc
	ld hl,row5
	ld de,row6
	push bc
	ldir
	pop bc
	ld hl,row4
	ld de,row5
	push bc
	ldir
	pop bc
	ld hl,row3
	ld de,row4
	push bc
	ldir
	pop bc
	ld hl,row2
	ld de,row3
	push bc
	ldir
	pop bc
	ld hl,row1
	ld de,row2
	push bc
	ldir
	pop bc
	ld hl,blankrow
	ld de,row1
	ldir
	;Create new Armadillos
	ld a,(gamediff)
	ld d,0
	ld e,a
doanotherarma:
	call ValidRandom
	ld hl,row1-1
	add hl,de
	ld (hl),a
	dec e
	jp z,game
	jr doanotherarma
ValidRandom:
	push de
	call iRandom
recheckint:
	cp 10
	jr c,intok
	sub 9
	jr recheckint
intok:
	inc a
	pop de
	ret
processkey:
	jp z,loopyI
	cp skLeft
	jp z,moveleft
	cp skRight
	jp z,moveright
	cp sk2nd
	jp z,fire
	cp skDel
	jp nz,loopyI
showscore:
	call scnclr
	ld hl,endtxt
	bcall(_PutS)
	call drstdisp
	ld hl,(armasmadeit)
	push hl
	ex de,hl
	ld hl,(armasflipped)
	push hl
	add hl,de
	bcall(_DispHL)
	call drstdisp
	pop hl
	ld a,1
	ld (currow),a
	bcall(_DispHL)
	call drstdisp
	pop hl
	ld a,2
	ld (currow),a
	bcall(_DispHL)
	call drstdisp
	ld hl,(armasmadeit)
	add hl,hl
	add hl,hl
	push hl
	ld hl,(armasflipped)
	ld a,(gamespeed)
	ld b,a
	ld a,(gamediff)
	add a,b
	add a,a
	ld b,a
	ld c,0
scoreluupy:
	add hl,bc
	djnz scoreluupy
	pop de
	bcall(_CpHLDE)
	jr c,scoreiszero
	sbc hl,de
contasnormal:
	ld a,3
	ld (currow),a
	push hl
	bcall(_DispHL)
	ld hl,(hiscore)
	ld a,4
	ld (currow),a
	ld a,8
	ld (curcol),a
	bcall(_DispHL)
	pop de
	ld hl,(hiscore)
	bcall(_CpHLDE)
	jr c,newhiscore
	bcall(_GetKey)
	jp quittoshell
newhiscore:
	ex de,hl
	ld (hiscore),hl
	ld b,16
	ld a,0
	ld hl,hiscorename
	push hl
wipehiscore:
	ld (hl),a
	inc hl
	djnz wipehiscore
	pop hl
	push hl
	ld a,5
	ld (currow),a
	xor a
	ld (curcol),a
	ld (pencol),a
	bcall(_PutS)
	ld b,16
	pop hl
	call gettext
	jp showscore
scoreiszero:
	ld hl,0
	jr contasnormal
loopyI:
	jp loopy
fire:
	ld a,(userpos)
	inc a
	ld hl,row1
	ld b,35
	ld c,0
searchanddestroylp:
	cp (hl)
	jr nz,contsearch
	ld (hl),c
	ld hl,(armasflipped)
	inc hl
	ld (armasflipped),hl
	jr firegraphic
contsearch:
	inc hl
	djnz searchanddestroylp
firegraphic:
	ld l,8
lupy:
	ld a,(userpos)
	add a,a
	add a,a
	add a,a
	ld ix,AOLame
	push af
	push hl
	push ix
	call putsprite8
	call ifastcopy
	pop ix
	pop hl
	pop af
	push hl
	call putsprite8
	call ifastcopy
	pop hl
	ld a,62
	inc l
	inc l
	cp l
	jr nz,lupy
validmove:
	ld a,(movesleft)
	dec a
	jp z,armadillosturn
	ld (movesleft),a
	jp rfrshsameturn
prefsgo:
	call prefsisitgo
	jp prefsinvalidkey
moveleft:
	ld a,(userpos)
	or a
	dec a
	jp z,getcsclp
	jr completemove
moveright:
	ld a,(userpos)
	inc a
	cp 11
	jp z,getcsclp
completemove:
	ld (userpos),a
	jr validmove
postogrph:
	dec a
	add a,a;\
	ld b,a ; \
	add a,a;  |A=A*10
	add a,a; /
	add a,b;/
	add a,37
	ret
prefsisitgo:
	ld a,(tempbyte)
	ld e,a
	ld d,0
	ld hl,gamespeed-1
	add hl,de
	cp 3
	jr nz,isitgonext
	pop hl
	jp startgame
isitgonext:
	cp 4
	call z,quittoshell
	ret
armadillo:
.db %00101010
.db %00011100
.db %01111111
.db %00111110
.db %01111111
.db %00011100
.db %00100010
.db %00100010
AOLame:
.db %00000000
.db %00011000
.db %00111100
.db %01100110
.db %01100110
.db %00111100
.db %00011000
.db %00000000
you:
.db %00011000
.db %10011000
.db %01111100
.db %00011011
.db %00011000
.db %00100100
.db %00100100
.db %00100100
scrollmarker:
.db %00000000
.db %00111100
.db %01111110
.db %00000000
.db %00000000
.db %01111110
.db %00111100
.db %00000000
scnclr:
	bcall(_ClrLCDFull)
	bcall(_GrBufClr)
rstdisp:
	ld hl,$0000
	ld (currow),hl
	ret
drstdisp:
	call rstdisp
	ld a,11
	ld (curcol),a
	ret
txt:
	.db "Arrows to change"
	.db "settings        "
	.db " SPEED",0
txt2:
	.db "DIFF",0
txt3:
	.db "GO",0
txt4:
	.db "EXIT",0
endtxt:
	.db "Armadillos:     "
	.db "Flipped:        "
	.db "Made It:        "
	.db "Score:          "
	.db "Hi Score      by"
hiscorename:
	.db "Alex Roper      ",0
hiscore:
	.db $01,$00
.end