A86: Guessing game


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

A86: Guessing game




Can somebody tell me what is wrong here.  What is supposed to happen is a
number is guessed, it says too high or too low, the screen clears, and it
starts over until the right number is guessed.  Please help.

#include "ti86asm.inc"
#include "asm86.h"
#include "ti86abs.inc"
#include "ti86math.inc"
#include "ti86ops.inc"
#include "Ram86.inc"

.org _asm_exec_ram

	call _clrLCD
	ld hl,$0000
	ld (_curRow),hl
	ld hl,string
	ld de,$c324
	call _mov10B

	call _RANDOM
	ld a,100
	call $4617
	call _FPMULT
	call $5577
	ld b,1
	
Guess:
	push bc
	ld a,13
	ld (_ASAP_IND),a
	call $5714
	call $5577
	ld a,l
	pop bc
	cp b
	jr z,random_equal
	jr c,random_greater
	jr nc,random_less

random_equal:
	call _clrLCD
	ld hl,$0000
	ld (_curRow),hl
	ld hl,equal
	call _puts
	ret

random_greater:
	push bc
	call _clrLCD
	ld hl,$0000
	ld (_curRow),hl
	ld hl,greater
	call _puts
	call _getkey
	call _clrLCD
	pop bc
	jr Guess

random_less:
	push bc
	call _clrLCD
	ld hl,$0000
	ld (_curRow),hl
	ld hl,greater
	call _puts
	call _getkey
	call _clrLCD
	pop bc
	jr Guess

string:
	.db "Guess = ",0

equal:
	.db "Nice Guess",0

greater:
	.db "Too high",0

less:
	.db "Too low",0	
			
.end


THANX
Dan


Follow-Ups: