Re: A86: sideways vputs (Req. Help...)


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

Re: A86: sideways vputs (Req. Help...)




here it is.  kinda sloppy...

-josh

_copycharmaps                    equ            56A1h

;this code is not optimized

s_vputs:
        ld a,(hl)
        or a                    ;return on zero
        ret z
        push hl
        call s_vputmap          ;display one char
        pop hl
        inc hl                  ;next char
        jr s_vputs

s_vputmap:
        call _copycharmaps      ;get char map
        ld c,(hl)               ;get width
        ld a,(_penRow)
        cp c                    ;if it'll go over the edge,
        ret c                   ;don't display this char
        inc hl
        push hl
        ld b,6
s_vpm_shifta:                   ;hl points to ram!
        push bc
        ld b,c
        ld a,(hl)
s_vpm_shift:
        rrca                    ;shift to get left aligned
        djnz s_vpm_shift
        ld (hl),a
        inc hl
        pop bc
        djnz s_vpm_shifta       ;shift all 6 rows
        pop hl

        ld b,c                  ;loop across
s_vpm_bigloop:
        push bc
        push hl
        xor a                   ;rotate one byte
        ld b,6
s_vpm_rotate:
        rl (hl)                 ;get bit
        rla                     ;into a
        inc hl
        djnz s_vpm_rotate
        rla                     ;shift into high bits
        rla                     ;align to top of chars
        ld de,(_penCol)         ;get pen pos

        push af                 ;save byte
        ld hl,FP_RLD            ;find byte in vid mem (from findpixel)
        ld (hl),d
        ld a,e          ; a = x/8 (byte offset within row)
        rrca
        rrca
        rrca
        rld
        or $FC
        ld l,(hl)
        ld h,a          ; hl -> byte in vid mem

        ld a,e
        and 7
        ld b,a                  ;it's backwards
        ld a,8
        sub b
        pop bc                  ;get the byte back

        ld de,$03ff             ;mask
        ld c,0
        or a
        jr z,s_vpm_noshift
s_vpm_doshift:
        sla b                   ;shift image
        rl c
        sla d                   ;shift mask
        rl e
        jr nc,s_vpm_masknc
        set 0,d
s_vpm_masknc:
        dec a
        jr nz,s_vpm_doshift

s_vpm_noshift:
        ld a,(hl)               ;get byte from screen
        and e                   ;erase background
        or c                    ;write image
        ld (hl),a
        inc hl
        ld a,(hl)
        and d                   ;erase background
        or b                    ;write image
        ld (hl),a               ;back to screen

        ld hl,_penRow
        dec (hl)                ;next row

        pop hl
        pop bc
        djnz s_vpm_bigloop      ;finish this char

        ret

FP_RLD:  .db $00


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]