lower border removal in STOS

STOS-related stuff in here please

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

thomas3
Atariator
Atariator
Posts: 28
Joined: Tue Apr 11, 2017 8:57 pm

lower border removal in STOS

Postby thomas3 » Thu Jul 06, 2017 10:11 pm

Hi!

Has anyone had any luck coding a stable lower border removal routine in STOS? (i.e. - no "border removal" extension or machine code calls - obviously I know you can do this, but this is no fun :D ).

I've been fiddling tonight and have managed to pull off a relatively stable routine (running in Steem though - I'm sure it would screw a monitor right up). But it can only display one bitplane (and definitely not on bitplane 1, which jumps about everywhere). And even though I'm burning processor time, if I add any code to each VBL before the switch (which I'm timing by peeking the video address counter medium byte) then it goes all flickery. I don't really understand the video address counter well enough to know why THAT is.

Anyone done any better?

CHEERS!
Tom.

mlynn1974
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 129
Joined: Mon Mar 03, 2008 10:33 pm
Contact:

Re: lower border removal in STOS

Postby mlynn1974 » Thu Aug 03, 2017 11:22 pm

Hi Thomas,
I've done a few experiments without much success.

The first idea I had was to simply to wait for the scanline to occur, in a tight loop.
I know you said not to use assembly but this was just to see what effect the interpreter was having and how much it varied when the program was compiled with the STOS Compiler.

Code: Select all

loop: dbf d0,loop
rts

To call the routine in STOS:

Code: Select all

S15=start(15)+28
dreg(0)=looplength:call S15


Border removal switch:

Code: Select all

FREQ=$FFFF820A
poke FREQ,2:dreg(0)=dreg(0):poke FREQ,0

The effect of the dreg(0)=dreg(0) should be compiled to a move d0,d0 by STOS having no effect but the required delay.

The results show that the loop length has to be 9063 for a stable border removal effect on an 8MHz ST but when compiled the loop length has to be 10324. You can see a bit of graphics memory in the lower border.

Then I had a good idea:
Use the 200Hz timer to get us near scanline 199. We'd get 4 ticks per frame. If we wait until the 4th tick that leaves 75% CPU time free at the start of the frame for code and graphics updates. Surely we would only have to wait a few hundred clock cycles to get to scanline 199? But this was unstable. :lol:

10 hide : key off : mode 0 : curs off : flash off : click off : mouseoff
20 HZ=$FFFF820A
30 KBD=$FFFFFC02
40 THHZ=$4BA
40 S15=start(15)+28

60 rem ** it is crucial to wait for the vbl
70 rem ** and reset the timer as near as possible
80 wait vbl: loke THHZ,1

rem ** main loop
100 doke $FFFF8240,$70
110 gosub 200
120 if peek(KBD)=57 then goto 170
130 wait vbl
140 loke THHZ,1
150 goto 100

200 rem ** wait for the bottom quarter of the screen then the required line
210 while leek(THHZ) mod 4 <> 0 : wend
220 dreg(0)=100:call S15
230 poke HZ,2:dreg(0)=dreg(0):poke HZ,0
240 return

The problem is that the timing in STOS is so vague. This is why you really need to use Timer B interrupts and STOS doesn't have any call back handlers for that sort of thing. Does anyone else have other ideas?
You do not have the required permissions to view the files attached to this post.
Still got, still working: Atari 4Mb STe, 520STFM, 2.5Mb STF.
Hardware: Cumana CSA 354, Ultimate Ripper, Blitz Turbo, Synchro Express II (US and UK Versions).

thomas3
Atariator
Atariator
Posts: 28
Joined: Tue Apr 11, 2017 8:57 pm

Re: lower border removal in STOS

Postby thomas3 » Thu Aug 03, 2017 11:57 pm

OMG, a reply - and it's cogent! Thanks! :)

I've managed a scroll in the bottom border that runs in the interpreter - at least for me, in Steem. Far from perfect though. I've attached it. To what extent does it work on your setup?

Haven't tried compiling it as I'm currently having much fun seeing what is possible *just* in the interpreter. (Christ - talk about a niche interest. In fact, I've very nearly finished an interpreter-only six screen old school megademo. I KID NOT!!! THE SHAME!!!!).
You do not have the required permissions to view the files attached to this post.

User avatar
shoggoth
Nature
Nature
Posts: 854
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: lower border removal in STOS

Postby shoggoth » Fri Aug 04, 2017 9:10 am

Sick s--t!!!
Ain't no space like PeP-space.

distantminds
Atari maniac
Atari maniac
Posts: 94
Joined: Thu Sep 29, 2005 5:03 pm

Re: lower border removal in STOS

Postby distantminds » Fri Aug 04, 2017 9:43 am


User avatar
spiny
Disk Imager Supreme
Disk Imager Supreme
Posts: 2340
Joined: Mon Aug 11, 2003 11:53 pm
Location: just outside bristol
Contact:

Re: lower border removal in STOS

Postby spiny » Fri Aug 04, 2017 9:59 am

brilliant stuff :D

thomas3
Atariator
Atariator
Posts: 28
Joined: Tue Apr 11, 2017 8:57 pm

Re: lower border removal in STOS

Postby thomas3 » Fri Aug 04, 2017 3:37 pm

Hahaha! Thanks for the "appreciation"! Needless to say, this particular hobby is one that's even got my own kids responding like this - :? ...!!

mlynn1974
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 129
Joined: Mon Mar 03, 2008 10:33 pm
Contact:

Re: lower border removal in STOS

Postby mlynn1974 » Fri Aug 04, 2017 11:49 pm

Well done Thomas! That runs well in STOS in the interpreter on Steem 3.2 and good old David Whittaker music as well!

The compiler initially wouldn't compile the program because of the declaration of DIM SX(LEN(T$)),SY(LEN(T$)) in a subroutine, but used earlier in the main. I fixed that by declaring T$ and the arrays at lines 141 and 142 and compiled it, but the lower border doesn't open in the compiled version.

I'm scratching my head at the maths:
There are 313 scanlines in a full screen at 50Hz. If the 200Hz timer ticks 4 times per VBL:
Tick 1=Absolute line 0
Tick 2=78.25
Tick 3=156.5
Tick 4=234.75
So I'd have to wait for 44 scanlines at Tick 3 to reach scanline 199. There is still a lot of jitter because it's STOS.
I don't think the 200Hz timer trick is really an advantage.

It's an interesting problem and I'll keep trying to improve my code.
:cheers:
Still got, still working: Atari 4Mb STe, 520STFM, 2.5Mb STF.
Hardware: Cumana CSA 354, Ultimate Ripper, Blitz Turbo, Synchro Express II (US and UK Versions).

thomas3
Atariator
Atariator
Posts: 28
Joined: Tue Apr 11, 2017 8:57 pm

Re: lower border removal in STOS

Postby thomas3 » Sat Aug 05, 2017 12:13 am

Hi!

I'm pretty sure I can fix mine to run in the compiler... just need to fiddle with some of the really dirty delay tactics in the border opener routine.

This is hilarious, but part of the problem is that Steem won't emulate the Help key on my laptop, which is why I'm not using the compiler at present!! HA! But I'll address this one day.

Think I'll do a open bottom border in the break screen (like a reset demo, but triggered with ctrl-c - cute, eh?) of this interpreter demo I'm working on :lol: (and am spending waaay too much time on, given that this will be of interest to <5 people on the planet)

User avatar
MiggyMog
Atari Super Hero
Atari Super Hero
Posts: 802
Joined: Sun Oct 30, 2005 4:43 pm
Location: Scotland

Re: lower border removal in STOS

Postby MiggyMog » Sat Aug 05, 2017 9:19 pm

Exxos has the border prog on his site to download which may be helpful http://www.exxoshost.co.uk/atari/STOS/E ... /index.htm
('< o o o o |''| STM,2xSTFM,2xSTE+HD,C-Lab Falcon MK2+HD,Satandisk,Ultrasatandisk,Ethernat.

mlynn1974
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 129
Joined: Mon Mar 03, 2008 10:33 pm
Contact:

Re: lower border removal in STOS

Postby mlynn1974 » Sun Aug 06, 2017 12:44 am

Those examples require the border extension. Neil Stewart also wrote an extension to remove the border, improved by Agrajag. I don't know if it was publically released. Maybe it was in PB Disk Maggie. You can pass it a parameter to turn off the upper, lower or both borders. Thomas wants to remove the border in STOS only including the switching code - no extensions!

I think this is a well worn path and most people agree it simply cannot be done with 100% stability in STOS without using ASM extensions. The timing is too flaky and the lanugage is too limited. You simply cannot do proper interrupt service routines in STOS.
Last edited by mlynn1974 on Sun Aug 06, 2017 8:26 pm, edited 1 time in total.
Still got, still working: Atari 4Mb STe, 520STFM, 2.5Mb STF.
Hardware: Cumana CSA 354, Ultimate Ripper, Blitz Turbo, Synchro Express II (US and UK Versions).

thomas3
Atariator
Atariator
Posts: 28
Joined: Tue Apr 11, 2017 8:57 pm

Re: lower border removal in STOS

Postby thomas3 » Sun Aug 06, 2017 7:45 am

@MiggyMog

Just to say, the pointlessness of trying to open the border in STOS without ASM when extensions already exist is not lost on me :wink:

Basically, this has become an obscure intellectual challenge, fueled by nostalgia!

User avatar
MiggyMog
Atari Super Hero
Atari Super Hero
Posts: 802
Joined: Sun Oct 30, 2005 4:43 pm
Location: Scotland

Re: lower border removal in STOS

Postby MiggyMog » Wed Aug 09, 2017 10:11 pm

Hehe. I tried too back in the day when I read sync changing was involved and had some success. But I got the horrid skewing effect as my timings were not as precise as we all now know they need to be. I think I missed getting Neil`s border prog free as I was not in first 100 registered for misty or whatever the rule was
('< o o o o |''| STM,2xSTFM,2xSTE+HD,C-Lab Falcon MK2+HD,Satandisk,Ultrasatandisk,Ethernat.


Social Media

     

Return to “STOS”

Who is online

Users browsing this forum: No registered users and 1 guest