Re: A86: Re: Asm questions
[Prev][Next][Index][Thread]
Re: A86: Re: Asm questions
Everyone, the best way to learn is from source code. If you want to do it,
then it's almost a sure bet someone else did too and already wrote it for
you. Think of a program or game that does it, download the source code, and
read it!
Here is Jimmy Mardell's routine from ZTetris. Sorry it's so long. I
haven't tested it, so if something doesn't work, read more of the source
code. You will need to include asm86.h and ti86asm.inc for this to work.
BTW, if you use someone else's routine in your program, you need to give
them credit. The easiest way is to put a comment with the routine that has
their name and release the source code. If you use someone else's routine,
you really _need_ to release the source:
ld b,0 ; B = number of letters entered so far
WaK: ; A simple string input routine follows
push hl
push bc ; GET_KEY destroys B. It doesn't on the TI-85 :-/
call GET_KEY
pop bc
cp $02
jr z,BackSpace
cp $09
jr z,NameDone
cp $11
jr nz,CheckLetter
ld a,32
pop hl
jr PutLetter
CheckLetter:
ld hl,Letters
push bc
ld bc,26
cpir
ld d,c
pop bc
pop hl
jr nz,WaK
ld a,65
add a,d
PutLetter:
ld c,a
ld a,b
cp 10
jr z,WaK
ld (hl),c
inc hl
inc b
ld a,c
call _putc
jr WaK
BackSpace:
pop hl
ld a,b
or a
jr z,WaK
dec b
dec hl
push hl
ld (hl),32
ld hl,$C010
dec (hl)
ld a,32
call _putc
dec (hl)
pop hl
jr WaK
NameDone:
pop hl
Letters:
.db $19,$21,$0A,$12,$1A,$22,$0B,$13,$1B,$23,$2B
.db $0C,$14,$1C,$24,$2C,$0D,$15,$1D,$25,$2D,$0E
.db $16,$1E,$26,$2E
-----Original Message-----
From: Bowser797@aol.com <Bowser797@aol.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Monday, November 23, 1998 7:48 PM
Subject: Re: A86: Re: Asm questions
>
>In a message dated 11/23/98 6:25:55 PM US Mountain Standard Time,
>tbarwick@esn.net writes:
>
><< You can make your own input routine, or you can use ti's. Ti's can be
>found
> in the ticalc 86 assembly routines section. >>
>
>How would I go about making my own input routine? I've seen TI's, and I
>really don't understand it very well.
>
>Thanks for the other help.