Re: A86: Re: Getting numbers......


[Prev][Next][Index][Thread]

Re: A86: Re: Getting numbers......




People tend to complain about large message bodies, as it is easy to discard
an attachment, but takes time (especially with slow email clients) to open
large messages.  By using an attachment, I can include the entire skeleton
program I used to test a routine (which serves as an example).  I have
included the entire file below for those of you wanted it before.  I
apologize to everyone else.

>I'm sure it is easier for you to send the file as an attachment, but
>those of us who can't view attachments don't get the file :( Could you
>send an additional message where the source is in the message body?

promptnum.asm:

; Assembly Coder's Zenith
; by David Phillips <david@acz.org>
; http://www.acz.org/

#include "ti86asm.inc"

.org _asm_exec_ram

 call _clrWindow
 ld a,'>'
 call _putc
 call PromptNumHL
 call _newline
 jp DispHL

; prompt user for number 0-9999 in HL
PromptNumHL:
 ld hl,0
PromptNumHLl:
 push hl
 call _getkey
 pop hl
 cp kDel
 jr nz,PromptNumHLe
 ld a,h
 or l
 jr z,PromptNumHLl
 call _divHLby10
 ex de,hl
 ld hl,_curCol
 dec (hl)
 ex de,hl
 ld a,' '
 call _putmap
 jr PromptNumHLl
PromptNumHLe:
 cp kEnter
 ret z
 ld e,a
 ld a,39
 cp h
 ret c
 ld a,k9
 cp e
 jr c,PromptNumHLl
 ld a,e
 cp k0
 jr c,PromptNumHLl
 ld d,0
 sub k0
 ld e,a
 add a,'0'
 call _putc
 ld a,e
 call _mulHL10
 add hl,de
 jr PromptNumHLl

; in: a or hl = number to print at current cursor position
; out: value of A or HL printed in large font
; destroyed: AF, DE, HL, OP1  (23 bytes total)
DispA:
 ld l,a
 ld h,0
DispHL:
 ld de,_OP1+5
 sub a
 ld (de),a
DispLoop:
 call _divHLby10
 add a,'0'
 dec de
 ld (de),a
 ld a,h
 or l
 jr nz,DispLoop
 ex de,hl
 jp _puts

.end