A82: Doctor Livingstone I pResume


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

A82: Doctor Livingstone I pResume



In quest for the perfect use of the r register I wrote this program which
seems to get some pretty randome results between 0-61, only I don't know why
it works. Any info would be appreciated. Also in the zShell School Jimmy
Mordell says that the r register can't be odd. In a routine I wrote that did
ld a, r ld l, a ld h,0 I got some od numbers. Why.
ASM PROGRAMMING
#include "ti82.h"
.org (START_ADDR)
.db "Random Integer Test",0
  ROM_CALL(CLEARLCD)
start:
  ld a, r
  and %00111111
  add a, 15
  ld b, a
  ld a, r
  xor $FF
  and %00111111
  xor b
  add a, b
  and %00111111
  ld h, 0
  ld l, a
  ROM_CALL(D_HL_DECI)
  ld b, 155
djnz:
  halt
  djnz djnz
  ld a, %01111101
  out (1), a
  in a, (1)
  bit 6, a
  jr nz, start
  ret
.END