;**TI-86 Sierpinski's Triangle** Version 1.1 ;------------------------------------------------------------ ;I have edited the code to use the system routines _IPoint ;and _RANDOM, so now it's smaller but not quite as fast as ;version 1.0. ; Dan Eble (eble@cis.ohio-state.edu) ;------------------------------------------------------------ ; Version 1.0 by James Yopp (jyopp@pobox.com) ; "eMail me with comments, suggestions, or questions" ;------------------------------------------------------------ #Include "ti86asm.inc" .org _asm_exec_ram call _clrLCD ld hl,$FFF0 ; last line ld de,$FFF1 ld bc,$0F ld (hl),$FF ldir ld bc,$0000 ; b = x, c = y ld de,500 ; draw 7*500 dots Loop: push de push bc call _RANDOM pop bc ld hl,_OP1M ; hl -> OP1 mantissa, 7 bytes of random numbers ld e,7 ; loop 7 times RandLoop: push de ld a,(hl) inc hl cp $33 jr c,HalveAndDraw cp $66 jr nc,XPlus1 Yplus1andXplusHalf: set 6,c ;Same here, with 64. ld a,64 ;But NOT here- We're only adding half the highest add a,b ;Value, so the bit may already be set. ld b,a HalveAndDraw: srl b srl c ld d,1 call _IPoint pop de dec e xor a or e jr nz,RandLoop pop de dec de ld a,d or e jr nz,Loop ld hl,0 ld (_penCol),hl ld hl,DoneStr call _vputs call _getkey call _clrScrn ret XPlus1: set 7,b ; Since bit 7 of B is never set, this is the same ; as adding 128. jr HalveAndDraw ;--------------- DoneStr .db "Done",0 .end