CIRCLE not full screen!

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

CIRCLE not full screen!

Post by Symoon »

Hi,

Have you ever noticed that the largest possible CIRCLE in HIRES actually doesn't occupy the full HIRES screen?

On your TEXT screen, set PAPER0 and INK2, then HIRES, then PAPER7 and INK0. Now you can cleearly see the HIRES limits.

CURSET120,99,1:CIRCLE99,1 leaves three blank lines at the bottom
CURSET 120,100,1:CIRCLE99,1 leaves one blank line at the top and two blank lines at the bottom, but doesn't allow CIRCLE100,1 as the Y coordinates go from 0 to 199.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: CIRCLE not full screen!

Post by iss »

Interesting! I knew for sure that 99 is the max. radius, but never asked myself 'why?' ;)
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: CIRCLE not full screen!

Post by Dbug »

Never noticed either, other that the fact that the CIRCLE does not support clipping and is not particularly fast :D
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: CIRCLE not full screen!

Post by rax »

I guess because it goes beyond borders. when I raise the radius by 1, it does not mean that the circle with 1 will increase, because of the rounding, I think so...

At R = 100 it goes off the screen, albeit a single point:

Code: Select all

10 HIRES
15 R=100: X=120: Y=99
20 FOR A = 0 TO 6.26 STEP 0.1
30 CURSET SIN(A)*R +X, COS(A)*R +Y, 1
40 NEXT

This is what the Y coordinate looks like for radius 100 and 99:
screenshot00.jpg
User avatar
rax
Flying Officer
Posts: 193
Joined: Tue Jul 24, 2018 3:16 pm

Re: CIRCLE not full screen!

Post by rax »

Indeed, it turns out that it is possible to place a circle with a radius of 100 on the screen, but checking the ROM is too simple and gives an error.
(y=100) + (R=100) = 200 - this value triggered error.

Here is the test I did for radius 100 in basic version, and direct command test (CURSET 120, 100, 1: CIRCLE 100, 1)

Test:


Debug (CURSET 120, 100, 1: CIRCLE 100, 1):

Code: Select all

// Check that radius is not 0
$F385	AD E1 02                 	LDA   $02E1         //  A = 100  Z=0             	
$F388	F0 38                    	BEQ   $F3C2         //  branch on equal (no)       

// Check that the circle will fit on the screen horizontally.    	
$F38A	AD 19 02                 	LDA   $0219         //  get x; A = 120             	
$F38D	CD E1 02                 	CMP   $02E1         //  compare whit R (100); C = 1                 	
$F390	90 30                    	BCC   $F3C2         //  branch on carry clear (no)                     	
$F392	18                       	CLC                 //  clear carry   C=0
$F393	6D E1 02                 	ADC   $02E1         //  add with carry and R; A=220 ($DC)
$F396	C9 F0                    	CMP   #$F0          //  compare  whit 240 (#F0); C = 0           	
$F398	B0 28                    	BCS   $F3C2         //  branch on carry set (not)  

// Check that the cursor will fit on the screen vertically.      	
$F39A	AD 1A 02                 	LDA   $021A         //  get y; A = 100                   	
$F39D	CD E1 02                 	CMP   $02E1         //  compare whit R (100); C = 1              	
$F3A0	90 20                    	BCC   $F3C2         //  branch on carry clear (no)                 	
$F3A2	18                       	CLC                 //  clear carry; C = 0                   	
$F3A3	6D E1 02                 	ADC   $02E1         //  add with carry and R; A=200 ($C8)                 	
$F3A6	C9 C8                    	CMP   #$C8          //  compare whit 200($C8); C = 1                 	
$F3A8	B0 18                    	BCS   $F3C2         //  branch on carry set (YES!)  
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: CIRCLE not full screen!

Post by iss »

Great, @rax!

Let's push things more further!
Here is real CIRCLE100,1 drawn by ROM routine:


Code: Select all

1DATA#20,#B3,#F3,#AD,#00,#04,#85
2DATA#1B,#AD,#01,#04,#85,#1C,#60
3FORI=2TO15:READA:POKE#400+I,A:NEXT
4DOKE#400,DEEK(#1B):DOKE#1B,#402
5HIRES:CURSET120,100,1:CIRCLE100,1
RUN
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: CIRCLE not full screen!

Post by Symoon »

Thanks for the amazing replies and complete analysis :-)
Sometimes I'm sad I forgot all I painfully learnt in mathematics.
Post Reply