Re: A86: can anyone tell me what this does?


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

Re: A86: can anyone tell me what this does?





---JBrett <tbarwick@esn.net> wrote:
>
> 
>  ld b,8                  ;times to loop
> loop1:
>  push bc              ; push bc (times to loop)
>  ld hl,$FC00         ;point to video mem
>  ld b,255               ;times to go through next loop
> loop11:
>  srl (hl)
>  inc hl                   ;hl+1->hl
>  djnz loop11        ;if b is not 0, decrement b and jump to loop11
>  ld b,255               ;times to go through next loop
> loop12:
>  srl (hl)
>  inc hl                    ; hl+1->hl
>  djnz loop12         ; if b is not 0, decrement b and jump to loop12
>  ld b,255                ;times to go through next loop
> loop13:
>  srl (hl)
>  inc hl                     ; hl+1->hl
>  djnz loop13          ; if b is not 0, decrement b and jump to loop13
>  ld b,255                ;times to go through loop
> loop14:
>  srl (hl)
>  inc hl                     ; hl+1->hl
>  djnz loop14           ; if b is not 0, decrement b and jump to loop14
>  ei                            ; enable interrupts
>  ld b,6                     ; times to run through "del_loop"
> del_loop:
>  halt                        ; wait for interrupt to occur
>  djnz del_loop       ; if b is not 0, decrement b and jump to
del_loop (runs
> 6 times)
>  di                            ; disable interrupts
>  pop bc                   ;get number of times to loop (8 on first
loop)
>  djnz loop1             ;if b is not 0, decrement b and jump to loop1
> (beginning)
> 
> This code is 44 bytes/247 cc's
> This code really needs to be optimized... like this: =)
> 
>  ld b,8
>  ld c,5
> Start:
>  push bc
>  ld hl, $fc00
> loop:
>  ld b,255
>  dec c
> shift_loop:
>  srl (hl)
>  inc l
>  djnz shift_loop
>  ld b,c
>  djnz loop
>  ld b,6
>  ld c,5
>  ei
> del_loop:
>  halt
>  djnz del_loop
>  di
>  pop bc
>  djnz Start
> 
> I wrote this pretty fast, but I think it will probably work... 29
bytes/ 150
> cc's

While this DOES make it faster, it also robs it of it's coolest efect.
Now if it was smaller and the SAME SPEED, that would be even better.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com