im looking for a zoom in routine

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
777
Manic Miner
Posts: 542
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

im looking for a zoom in routine

Post by 777 »

nothing on google. so you can select an area of the screen and zoom into it. or something that could expand a udg. any ideas?
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1

http://zxspeccy.great-site.net/
User avatar
Cheez26
Microbot
Posts: 124
Joined: Sat May 04, 2024 2:36 am
Location: Midwestern United States
Contact:

Re: im looking for a zoom in routine

Post by Cheez26 »

Can you repeat that question with a bit more detail? Because I'm confused by what you mean by "zoom-in routine". Which software are you even using? Forgive me if I'm being blunt.
Chelsea E., a Speccy fan from the U.S.
Also a musician and a beginning games developer.
🏳️‍⚧️ p r i d e 🏳️‍🌈
User avatar
ParadigmShifter
Dynamite Dan
Posts: 1086
Joined: Sat Sep 09, 2023 4:55 am

Re: im looking for a zoom in routine

Post by ParadigmShifter »

If you only have a few size possibilities use a lookup table mapping bits to double/triple/quadruple bits. Then if that also needs shifting, shift each row into a temp buffer. Then draw each line of the buffer for zoom amount of rows.

Slower way is shifting the data out of A register and building the graphics depending on which bit is shifted out into carry flag.
User avatar
777
Manic Miner
Posts: 542
Joined: Fri Jun 26, 2020 11:23 am
Location: sw uk

Re: im looking for a zoom in routine

Post by 777 »

Cheez26 wrote: Sat May 18, 2024 4:54 pm Can you repeat that question with a bit more detail? Because I'm confused by what you mean by "zoom-in routine". Which software are you even using? Forgive me if I'm being blunt.
i mean an assembly language routine
i started programming the spectrum when i was 8 :-

1 plot rnd*255,rnd*175
2 goto 1

http://zxspeccy.great-site.net/
User avatar
Cheez26
Microbot
Posts: 124
Joined: Sat May 04, 2024 2:36 am
Location: Midwestern United States
Contact:

Re: im looking for a zoom in routine

Post by Cheez26 »

777 wrote: Sat May 18, 2024 4:57 pm i mean an assembly language routine
Ah. I get it.

Unfortunately, Z80 assembly is not my strong suit unless if we're talking in-line of Boriel BASIC; even then, I'm still a noob at Boriel BASIC too. So, maybe take ParadigmShifter's advice instead.
Chelsea E., a Speccy fan from the U.S.
Also a musician and a beginning games developer.
🏳️‍⚧️ p r i d e 🏳️‍🌈
sn3j
Manic Miner
Posts: 599
Joined: Mon Oct 31, 2022 12:29 am
Location: Germany

Re: im looking for a zoom in routine

Post by sn3j »

You could use the Plot routine to do that (mentioned a bit earlier here).
You just need to derive from it a new routine that checks the bit at position in DE.
Then you can do this:

Code: Select all

    ld de, 0x0000              ; pixel pos where to check: (0,0) = top-left corner
    ld hl, 0x0080              ; pixel pos where to draw: (0,128)
    ld c, 15                   ; #rows
NextRow:
    ld b, 11                   ; #bits per row
    ld a, e
    add b                      ; advance DE to end of row
    ld e, a
    ld a, l
    add b
    add b                      ; advance HL to end of row
    ld l, a
NextBit:
    dec e                      ; go 1 pixel to the left
    dec l
    dec l                      ; set Draw pos 2 pixels to the left
    push hl
    call CheckBitAtDE
    pop hl                     ; restore Draw position
    call nz PlotSquareAtHL     ; plot a 2x2 square if the bit was set
    djnz NextBit               ; for all bits in row
    inc d                      ; advance DE to next row
    inc h
    inc h                      ; advance HL to next row
    dec c                      ; decrease the row counter
    jr nz NextRow              ; for all rows

Code: Select all

PlotSquareAtHL:
    push de
    ex de hl
    inc e
    call PlotAtDE              ; plot at (y,x+1)
    inc d
    call PlotAtDE              ; plot at (y+1,x+1)
    dec e
    call PlotAtDE              ; plot at (y+1,x)
    dec d
    call PlotAtDE              ; plot at (y,x)
    ex de hl
    pop de                     ; restore DE
    ret
POKE 23614,10: STOP      1..0 hold, SS/m/n colors, b/spc toggle
Dr beep
Manic Miner
Posts: 387
Joined: Mon Oct 01, 2018 8:53 pm

Re: im looking for a zoom in routine

Post by Dr beep »

Post Reply