scrolling text vertically in the opposite direction in basic
scrolling text vertically in the opposite direction in basic
ive been trying to write this in basic but havent got very far. any hints on how i would do this?
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
Code: Select all
10 LET a$="Hello, world"
20 LET b$=" "
30 FOR r=15 to 5 STEP -1
40 PRINT AT r,4;a$
50 PRINT AT r+1,4;b$
60 PAUSE 10
70 NEXT r
If something works, don't touch it !!!! at all !!!
Re: scrolling text vertically in the opposite direction in basic
thank you but i did program something similar myself earlier. i need it to keep adding characters and looping, so it looks like a road for instance.Bubu wrote: ↑Thu Nov 25, 2021 5:07 pmCode: Select all
10 LET a$="Hello, world" 20 LET b$=" " 30 FOR r=15 to 5 STEP -1 40 PRINT AT r,4;a$ 50 PRINT AT r+1,4;b$ 60 PAUSE 10 70 NEXT r
Last edited by 777 on Thu Nov 25, 2021 5:15 pm, edited 1 time in total.
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
yw
If something works, don't touch it !!!! at all !!!
Re: scrolling text vertically in the opposite direction in basic
sorry, just edited that ^
thank you but i did program something similar myself earlier. i need it to keep adding characters and looping, so it looks like a road for instance.
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
My memory of BASIC fades by the year(!) but I'm not sure how you'd do an upwards movement/downwards scroll.
There were tons of early BASIC games and type ins of this sort, Race Track for example, but the player is always moving down the screen.
I guess this is because you can just keep using PRINT to print the the next row of track. Then POKE 23692,255 stops the "Scroll?" message appearing (for a while at least!), so the track will naturally scroll up the screen without you needing to do anything. I don't know how you'd do it if you wanted to go in the opposite direction.
The machine code program that you were looking at in the other thread has to copy 736 character squares up one line:
It's insanely fast in assembly, but I dread to think how insanely slow it'd be in BASIC..!
There were tons of early BASIC games and type ins of this sort, Race Track for example, but the player is always moving down the screen.
I guess this is because you can just keep using PRINT to print the the next row of track. Then POKE 23692,255 stops the "Scroll?" message appearing (for a while at least!), so the track will naturally scroll up the screen without you needing to do anything. I don't know how you'd do it if you wanted to go in the opposite direction.
The machine code program that you were looking at in the other thread has to copy 736 character squares up one line:
Code: Select all
ld hl,23263 ;scroll road
ld de,23295
ld bc,736
lddr
My Speccy site: thirdharmoniser.com
Re: scrolling text vertically in the opposite direction in basic
I think the best solution is to call a small mc routine from BASIC to scroll down, print the new line from BASIC, and so. They are a lot of short mc routines published in magazines handable from BASIC.
Re: scrolling text vertically in the opposite direction in basic
where?
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
Code: Select all
30 GO SUB 100
45 PRINT : POKE 23692,0
50 PRINT AT 21,0;b$'''''':
60 GO TO 30
100 LET r=INT (3*RND): LET a$=("O" AND r<1)+("X" AND r>1): LET r=INT (5*RND): LET b$=(" "+a$ AND r=1)+(" "+a$ AND r=2): LET b$=b$+(" "+a$ AND r=3)+(" "+a$ AND r=4): RETURN
Re: scrolling text vertically in the opposite direction in basic
So that would be like this:
Code: Select all
10 POKE 23692,255
20 LET a$="Hello, world"
30 PRINT AT 21,0;a$
40 FOR i=1 TO 50
50 PRINT
60 NEXT i
Re: scrolling text vertically in the opposite direction in basic
thank you for that...hikoki wrote: ↑Thu Nov 25, 2021 7:39 pmCode: Select all
30 GO SUB 100 45 PRINT : POKE 23692,0 50 PRINT AT 21,0;b$'''''': 60 GO TO 30 100 LET r=INT (3*RND): LET a$=("O" AND r<1)+("X" AND r>1): LET r=INT (5*RND): LET b$=(" "+a$ AND r=1)+(" "+a$ AND r=2): LET b$=b$+(" "+a$ AND r=3)+(" "+a$ AND r=4): RETURN
its still scrolling the wrong way...
and its not drawing me a road
maybe its a typo. btw i didnt want to put all those statements in a single line
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
https://spectrumcomputing.co.uk/entry/8 ... -Supercode
And a lot of other similar packs of routines.
Re: scrolling text vertically in the opposite direction in basic
thank you+3code wrote: ↑Thu Nov 25, 2021 8:10 pmhttps://spectrumcomputing.co.uk/entry/8 ... -Supercode
And a lot of other similar packs of routines.
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
ok+3code wrote: ↑Thu Nov 25, 2021 8:14 pm Break this BASIC game and take a look:
https://spectrumcomputing.co.uk/entry/1 ... lling_Maze
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
unfortunately none of those routines seem to do what i want+3code wrote: ↑Thu Nov 25, 2021 8:10 pmhttps://spectrumcomputing.co.uk/entry/8 ... -Supercode
And a lot of other similar packs of routines.
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
ok, thank you, it works
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
hi res scroll down
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1
Re: scrolling text vertically in the opposite direction in basic
That's cheating!
If something works, don't touch it !!!! at all !!!
Re: scrolling text vertically in the opposite direction in basic
Well, I'm still not really into Spectrum assembler (still find it too difficult), but if I were, I'd probably extract and write down those 99 bytes and create a disassembly to really understand what it does.
Then I'd post the result here.
Then I'd post the result here.
Re: scrolling text vertically in the opposite direction in basic
i was wondering it was possible to change this code so it jumps 8 pixels instead of 1? ive had a go myself to no avail.
Code: Select all
org 64098
ld hl, 22527 ; 64098 33 255 87 10ts
ld b, 3 ; 64101 6 3 7ts
l_fa67: push bc ; 64103 197 11ts
ld b, 8 ; 64104 6 8 7ts
l_fa6a: push bc ; 64106 197 11ts
ld b, 7 ; 64107 6 7 7ts
l_fa6d: push bc ; 64109 197 11ts
ld b, 32 ; 64110 6 32 7ts
l_fa70: push hl ; 64112 229 11ts
ld de, 256 ; 64113 17 0 1 10ts
and a ; 64116 167 4ts
sbc hl, de ; 64117 237 82 15ts
pop de ; 64119 209 10ts
ld a, (hl) ; 64120 126 7ts
ld (de), a ; 64121 18 7ts
ex de, hl ; 64122 235 4ts
dec hl ; 64123 43 6ts
djnz l_fa70 ; 64124 16 242 8/13ts
ld de, 224 ; 64126 17 224 0 10ts
and a ; 64129 167 4ts
sbc hl, de ; 64130 237 82 15ts
pop bc ; 64132 193 10ts
djnz l_fa6d ; 64133 16 230 8/13ts
pop bc ; 64135 193 10ts
ld a, b ; 64136 120 4ts
cp 1 ; 64137 254 1 7ts
jr z, l_faa3 ; 64139 40 22 12/7ts
push bc ; 64141 197 11ts
ld b, 32 ; 64142 6 32 7ts
l_fa90: ld de, 1760 ; 64144 17 224 6 10ts
push hl ; 64147 229 11ts
add hl, de ; 64148 25 11ts
pop de ; 64149 209 10ts
ld a, (hl) ; 64150 126 7ts
ld (de), a ; 64151 18 7ts
ex de, hl ; 64152 235 4ts
dec hl ; 64153 43 6ts
djnz l_fa90 ; 64154 16 244 8/13ts
ld de, 1792 ; 64156 17 0 7 10ts
add hl, de ; 64159 25 11ts
pop bc ; 64160 193 10ts
djnz l_fa6a ; 64161 16 199 8/13ts
l_faa3: pop bc ; 64163 193 10ts
ld a, b ; 64164 120 4ts
cp 1 ; 64165 254 1 7ts
jr z, 64188 ; 64167 40 19 12/7ts
push bc ; 64169 197 11ts
ld b, 32 ; 64170 6 32 7ts
l_faac: ld de, 32 ; 64172 17 32 0 10ts
push hl ; 64175 229 11ts
and a ; 64176 167 4ts
sbc hl, de ; 64177 237 82 15ts
pop de ; 64179 209 10ts
ld a, (hl) ; 64180 126 7ts
ld (de), a ; 64181 18 7ts
ex de, hl ; 64182 235 4ts
dec hl ; 64183 43 6ts
djnz l_faac ; 64184 16 242 8/13ts
pop bc ; 64186 193 10ts
djnz l_fa67 ; 64187 16 170 8/13ts
ld b, 32 ; 64189 6 32 7ts
l_fabf: ld (hl), 0 ; 64191 54 0 10ts
dec hl ; 64193 43 6ts
djnz l_fabf ; 64194 16 251 8/13ts
ret ; 64196 201 10ts
i started programming the spectrum when i was 8 :-
1 plot rnd*255,rnd*175
2 goto 1
1 plot rnd*255,rnd*175
2 goto 1