Tutorial #11

2-19-99

More on Direct Input

Well in tutorial #7 we talked a little on direct input, well actually we talked a lot about direct input, but I think we should practice a little more. I have made a program that is used in my latest BASIC game called Drug Maniac, the game is in BASIC but its a text-based game, and ASM really isn't for making text games. Anyway the program is for the instructions, the only ASM part of the game, it was made in ASM just to refresh my memory on using direct input and displaying text. Its highly commented too. If you have any questions or if I did something wrong e-mail me. Its pretty long, and could be simplified, but I made this a while ago, when I was just starting to learn ASM.

.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST

.org 9327h

	call _clrLCDFull	;Clear the Screen
	ld hl,0020h	;Loads these coords
	ld (PENCOL),hl	;Loads the coords into PENCOL
	ld hl,String	;Loads the string
	call _vputs	;Puts it on the Graph Screen
	ld hl,0602h	;Loads these coords
	ld (PENCOL),hl	;Loads the coords into PENCOL
	ld hl,text1		;Loads the string
	call _vputs	;Puts it on the Graph Screen
	ld hl,1202h	;Loads these coords
	ld (PENCOL),hl	;Loads the coords into PENCOL
	ld hl,text2		;Loads the string
	call _vputs	;Puts it on the Graph Screen
	ld hl,1802h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text3		;Yadda
	call _vputs	;Yadda
	ld hl,2002h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text4		;Yadda
	call _vputs	;Yadda
	ld hl,2602h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text5		;Yadda
	call _vputs	;Yadda
	ld hl,3002h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text6		;Yadda
	call _vputs	;Yadda
	ld hl,3602h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text7`	;Yadda
	call _vputs	;Yadda
	call input		;Yadda
	ret		;Returns to what it was doing

input:
	ld a,0ffh		;Resets the keyport
	out (1),a		;Output I guess?
	ld a,0fdh		;Loads this keyport
	out (1),a		;Output I guess?
	in a,(1)		;Waits for keypress
	cp 191		;Checks to see if the keypressed was Clear
	jp z,quit		;It was? Then goto quit
	cp 254		;Checks to see if the keypressed was Enter
	jp z,nextpage	;It was? Then goto nextpage
	jp input		;No keypressed? Go back to input!
quit:
	ret		;Returns to what it was doing
nextpage:
	call _clrLCDFull	;Clears the Screen
	ld hl,0020h	;You
	ld (PENCOL),hl	;should
	ld hl,String	;know
	call _vputs	;this
	ld hl,0602h	;by
	ld (PENCOL),hl	;now
	ld hl,text8		;.
	call _vputs	;If
	ld hl,1202h	;not
	ld (PENCOL),hl	;then
	ld hl,text9		;go
	call _vputs	;to
	ld hl,1802h	;my
	ld (PENCOL),hl	;eariler
	ld hl,text10	;tutorials
	call _vputs	;.
	ld hl,2002h	;got
	ld (PENCOL),hl	;it?
	ld hl,text11	;good
	call _vputs	;.
	ld hl,2602h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text12	;Yadda
	call _vputs	;Yadda
	ld hl,3002h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text13	;Yadda
	call _vputs	;Yadda
	ld hl,3602h	;Yadda
	ld (PENCOL),hl	;Yadda
	ld hl,text14	;Yadda
	call _vputs	;Yadda
	call input		;Yadda
	ret		;Returns to what it was doing
	
String:
	.db "Drug Maniac             ",0

text1:
	.db "DRUG MANIAC By:    ",0

text2:
	.db "(KSA)Tekken 1999    ",0

text3:
	.db "Your goal is to sell as many",0

text4:
	.db "Drugs as you can and to    ",0

text5:
	.db "And to make $3,500,000      ",0

text6:
	.db "Once you get $3,500,000the",0

text7:
	.db "Game will display how much",0

text8:
	.db "Money you made and how",0

text9:
	.db "Much time it took you to beat",0

text10:
	.db "The more you travel thehigher",0

text11:
	.db "Your time will be at the",0

text12:
	.db "Of the game. Make sure you",0

text13:
	.db "Have enough money totravel.",0

text14:
	.db "Press CLEAR Now...",0

.end
END

Thats about all for now, change some of the commands if you'd like and compile it and send to your calc!!! All the parts that say stuff like 'Yadda' and other junk, thats stuff you should already know, this tutorial was just a review, you shouldn't have learned anything new... Well, that's about it. If you still have any questions e-mail me.

(KSA)Tekken (uncool3@juno.com)