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.
CIRCLE not full screen!
Re: CIRCLE not full screen!
Interesting! I knew for sure that 99 is the max. radius, but never asked myself 'why?'
Re: CIRCLE not full screen!
Never noticed either, other that the fact that the CIRCLE does not support clipping and is not particularly fast
Re: CIRCLE not full screen!
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:
This is what the Y coordinate looks like for radius 100 and 99:
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:
Re: CIRCLE not full screen!
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):
(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!)
Re: CIRCLE not full screen!
Great, @rax!
Let's push things more further!
Here is real CIRCLE100,1 drawn by ROM routine:
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
Re: CIRCLE not full screen!
Thanks for the amazing replies and complete analysis
Sometimes I'm sad I forgot all I painfully learnt in mathematics.
Sometimes I'm sad I forgot all I painfully learnt in mathematics.