Re: A86: Re: box drawing


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

Re: A86: Re: box drawing




no, it wouldn't.  but this would.
i wrote it actually just before the question was posted.  it's probly not
terrible optimized, you have to decode the screen location before you
call it, and it only works with boxes that start and end on a multiple of
8 pixels across.

-josh

; hl->screen start address
; b=rows (not inc top&bottom)
; c=bytes wide
draw_box:
    ld a,$10
    sub c
    ld e,a
    ld d,0                  ; de=width of area outside of box
    ld a,$ff
    push bc
    ld b,c
    call draw_horiz_line
    pop bc
    add hl,de               ; next line
    ld a,c
    dec a
    jr z,draw_box_bytewide
    dec a
    jr z,draw_box_nomiddle
draw_box0:
    ld a,$80
    ld (hl),a
    inc hl
    xor a
    call draw_horiz_line
    ld a,$01
    ld (hl),a
    inc hl
    add hl,de
    djnz draw_box0
    ld a,$ff
    ld b,c
    call draw_horiz_line
    ret
draw_box_bytewide:
    ld a,$81
    inc de
draw_box1:
    ld (hl),a
    add hl,de
    djnz draw_box1
    ld a,$ff
    ld (hl),a
    ret
draw_box_nomiddle:
    ld a,$80
    ld (hl),a
    inc hl
    ld a,$01
    ld (hl),a
    inc hl
    add hl,de
    djnz draw_boxnomiddle
    ld a,$ff
    ld (hl),a
    inc hl
    ld (hl),a
    ret


; hl->screen start address
; b=bytes wide
; a=pattern
draw_horiz_line:
    ld (hl),a
    inc hl
    djnz draw_horiz_line
    ret


On Sun, 24 Oct 1999 18:40:51 -0600 "David Phillips" <david@acz.org>
writes:
>
>But it wouldn't fill the center with white, would it?
>
>Btw, I remembered that the game Jezzball does have horizontal and 
>vertical
>line drawing routines, if you want some code to look at, although 
>it's
>pretty bad (because I looked for a long time for some before writing 
>my
>own...which were on my HD when I reformatted or else I'd post them).
>
>> there has to be a built in routine somewhere to draw a box because 
>it's
>> used for the ZOOM:BOX feature.
>
>
>

___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: http://dl.www.juno.com/dynoget/tagj.