Posts: 47
Threads: 22
Joined: Mar 2019
Reputation:
0
10-01-2021, 08:46 AM
(This post was last modified: 10-01-2021, 09:52 AM by boriel.)
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
Posts: 1,789
Threads: 56
Joined: Aug 2019
Reputation:
25
10-01-2021, 09:55 AM
(This post was last modified: 10-01-2021, 10:28 AM by boriel.)
(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).
Posts: 47
Threads: 22
Joined: Mar 2019
Reputation:
0
(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
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
I CAN'T insert my own assembler although I know how to do it in assembler
As compensation I am finding and debugging these things that I tell you
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
Posts: 1,789
Threads: 56
Joined: Aug 2019
Reputation:
25
10-01-2021, 09:38 PM
(This post was last modified: 10-02-2021, 05:56 AM by boriel.)
(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
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
I CAN'T insert my own assembler although I know how to do it in assembler
As compensation I am finding and debugging these things that I tell you
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
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? :-)
|