Re: A85: @!#%! Code Part 2


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

Re: A85: @!#%! Code Part 2




why don't you just do this:

 ld b,54		; 9 rows by 6 columns is 54 elements
 ld hl,(ARRAY)
Loop:
 ld (hl),0
 inc hl
 djnz Loop

or if you *had* to do it multi-dimensionally:

 ld hl,(ARRAY)
 ld c,9			; 9 rows
OuterLoop:
 ld b,6			; 6 cols
InnerLoop:
 ld (hl),0
 inc hl
 djnz InnerLoop
 dec c			; one less row
 jr nz,OuterLoop
 
-mike pearce

On Thu, 1 Oct 1998 20:32:10 EDT, you wrote:

>
>Here's more of my seemingly defective source code.  I am trying to initialize
>a portion of memory to use as a 2 dimensional array with all zeros, but it
>crashes the calc all the time.
>
>ARRAY = TEXT_MEM+5
>
> call CLEARLCD
> ld a,1
> ld (CUR_POS),a
>Loop:
> ld b,9
> ld hl,(ARRAY)
> ld a,b
> push bc
> ld b,0
> ld c,a
> add hl,bc
> pop bc
> ld (hl),0
> djnz Loop
>Loop2:
> ld b,6
> ld hl,(ARRAY)
> push bc
> ld b,0
> ld c,9
> add hl,bc
> pop bc
> ld c,b
> push bc
> ld b,0
> add hl,bc
> ld (hl),0
> djnz Loop2 
>
>-Gray
>


References: