Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not updating the DF CC variable
#1
Hi

In the original ZX spectrum basic when you PRINT something the variable DF CC is updated with the screen position

for example the next program must print 16384 that is the first position of the screen

but the only answer always with every diferent position is 16448

this means that the print routine is not updating the DF CC variable like the original ROM

Is this a bug?

You can try this program and change the coordinates of the first print 0,0

Code:
dim myScreen as uInteger

print at 0,0; 
myScreen = peek (uInteger, 23684)  '' 23684 = DFCC = Must be screen position after every print
print at 10,10; myScreen
Reply
#2
(10-01-2021, 08:46 AM)maeloterkim Wrote: Hi

In the original ZX spectrum basic when you PRINT something the variable DF CC is updated with the screen position

for example the next program must print 16384 that is the first position of the screen

but the only answer always with every diferent position is 16448

this means that the print routine is not updating the DF CC variable like the original ROM

Is this a bug?

You can try this program and change the coordinates of the first print 0,0

Code:
dim myScreen as uInteger

print at 0,0; 
myScreen = peek (uInteger, 23684)  '' 23684 = DFCC = Must be screen position after every print
print at 10,10; myScreen

Yes, it does not update it. I will make to update it. PRINT is not using the ROM, but tries hard to mimic ROMS behavior (at the expense of memory and speed), for compatibility's sake.
I will add this feature. Not sure how this variable works.

Also, I don't see the point of this (other than porting a BASIC program to ZX Basic compiler).
It seems you're using "tricks" and "hacks" to speed up an interpreted BASIC program, and this is not the case. ZX Basic creates machine code binaries, not BASIC programs for ZX Spectrum and they are very different. You should get rid of these tricks to achieve higher speed (i.e. the DEFADD trick I answered in another post).
Reply
#3
(10-01-2021, 09:55 AM)boriel Wrote:
(10-01-2021, 08:46 AM)maeloterkim Wrote: Hi

In the original ZX spectrum basic when you PRINT something the variable DF CC is updated with the screen position

for example the next program must print 16384 that is the first position of the screen

but the only answer always with every diferent position is 16448

this means that the print routine is not updating the DF CC variable like the original ROM

Is this a bug?

You can try this program and change the coordinates of the first print 0,0

Code:
dim myScreen as uInteger

print at 0,0; 
myScreen = peek (uInteger, 23684)  '' 23684 = DFCC = Must be screen position after every print
print at 10,10; myScreen

Yes, it does not update it. I will make to update it. PRINT is not using the ROM, but tries hard to mimic ROMS behavior (at the expense of memory and speed), for compatibility's sake.
I will add this feature. Not sure how this variable works.

Also, I don't see the point of this (other than porting a BASIC program to ZX Basic compiler).
It seems you're using "tricks" and "hacks" to speed up an interpreted BASIC program, and this is not the case. ZX Basic creates machine code binaries, not BASIC programs for ZX Spectrum and they are very different. You should get rid of these tricks to achieve higher speed (i.e. the DEFADD trick I answered in another post).

Yes i know that i can use assembler Smile

I created a subroutine ONLY IN BASIC to calculate the screen to solve this "problem"

The only point to do all the tricks and DONT USE ASSEMBLER is because i'm doing a game for the bytemaniacos competition

the competition is in this link  https://bytemaniacos.com/?page_id=3877

And the rules says that you can use COMPILED BASIC but NOT ASSEMBLER Smile

I CAN'T insert my own assembler although I know how to do it in assembler  Smile

As compensation I am finding and debugging these things that I tell you Smile

You can change the print to update the DFCC variable or not is up to you

if you consider that is better for faster print not to update  Dont update the print
Reply
#4
(10-01-2021, 11:58 AM)maeloterkim Wrote:
(10-01-2021, 09:55 AM)boriel Wrote:
(10-01-2021, 08:46 AM)maeloterkim Wrote: Hi

In the original ZX spectrum basic when you PRINT something the variable DF CC is updated with the screen position

for example the next program must print 16384 that is the first position of the screen

but the only answer always with every diferent position is 16448

this means that the print routine is not updating the DF CC variable like the original ROM

Is this a bug?

You can try this program and change the coordinates of the first print 0,0

Code:
dim myScreen as uInteger

print at 0,0; 
myScreen = peek (uInteger, 23684)  '' 23684 = DFCC = Must be screen position after every print
print at 10,10; myScreen

Yes, it does not update it. I will make to update it. PRINT is not using the ROM, but tries hard to mimic ROMS behavior (at the expense of memory and speed), for compatibility's sake.
I will add this feature. Not sure how this variable works.

Also, I don't see the point of this (other than porting a BASIC program to ZX Basic compiler).
It seems you're using "tricks" and "hacks" to speed up an interpreted BASIC program, and this is not the case. ZX Basic creates machine code binaries, not BASIC programs for ZX Spectrum and they are very different. You should get rid of these tricks to achieve higher speed (i.e. the DEFADD trick I answered in another post).

Yes i know that i can use assembler Smile

I created a subroutine ONLY IN BASIC to calculate the screen to solve this "problem"

The only point to do all the tricks and DONT USE ASSEMBLER is because i'm doing a game for the bytemaniacos competition

the competition is in this link  https://bytemaniacos.com/?page_id=3877

And the rules says that you can use COMPILED BASIC but NOT ASSEMBLER Smile

I CAN'T insert my own assembler although I know how to do it in assembler  Smile

As compensation I am finding and debugging these things that I tell you Smile

You can change the print to update the DFCC variable or not is up to you

if you consider that is better for faster print not to update  Dont update the print

I will anyway Smile
PRINT is supposed to mimic the original one as much as possible and that variable but not sure if it will be on time for the contest!
In the meantime, perhaps you can use PEEK 23688 (SPOSN) which is updated correctly.

You can get the current print position with:

Code:
cursorX = 33 - peek 23688
cursorX = 24 - peek 23689
This will give you the current cursor coordinates, from (0, 0) to (31, 23). You can then compute the screen position from this coordinates.
Does this help? :-)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)