Let's calculate! - renewed arithmetic routines
Re: Let's calculate! - renewed arithmetic routines
Maybe Pokemon could fix that in his ZxMore Master program? He seems to be busy at the moment, but meanwhile a "patch" for running your new ROMs at ZxMore would help? Changing some bytes in the beginning of the ROM should not be too complicated (man POKE )
Siggi
Edit: I have sent a PM to Pokemon
Siggi
Edit: I have sent a PM to Pokemon
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Let's calculate! - renewed arithmetic routines
If that is the only reason: maybe it would be sufficient to leave the "NMI-CONT" routine at its original place? That would not waste time, only some bytes space ...
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Let's calculate! - renewed arithmetic routines
While the NMI routine is shorter and faster, NMI-CONT is (three bytes) longer and also slower. I guess it will be hard for the ZXmaster to check for the number of T states taken by the original or modified NMI-CONT...
Re: Let's calculate! - renewed arithmetic routines
Hi,
This is not so simple:
In the original code (after the 'HALT') the NMI service requires 4+4+10(!)+7+4+10=39 T states, because A'=1 (positive, nonzero).
In case of the patched routine: 4+4+7+4+10=29 T states. So the 'JP IX_to_PC' is necessary for the correct displaying.
Is it possible to see the "master"-code?
Zsolt
This is not so simple:
Code: Select all
; ------------------------------------
; THE 'NON MASKABLE INTERRUPT' ROUTINE
; ------------------------------------
;
; ( It takes 29 clock cycles while incrementing towards zero - it was 32TS).
;; NMI
L0066:
EX AF,AF' ; (4) switch in the NMI's copy of the
; accumulator.
INC A ; (4) increment.
;
; JP M,L006D (10) was removed for faster NMI-service: the user application gets +3TS/NMI
;
JR Z,L006C ; (12) forward to NMI-CONT
; when line count has incremented to zero.
;
;; NMI-RET (7!!!) else
;
EX AF,AF' ; (4) switch out the incremented line counter
; or test result $80
RET ; (10) return to User application for a while.
; ---
; This branch is taken when the 55 (or 31) lines have been drawn.
;; NMI-CONT (its address was L006F)
L006C:
EX AF,AF' ; (4) restore the main accumulator.
PUSH AF ; (11) * Save Main Registers
PUSH BC ; (11) **
PUSH DE ; (11) ***
PUSH HL ; (11) ****
; the next set-up procedure is only really applicable when the top set of
; blank lines have been generated.
LD HL,($400C) ; (16) fetch start of Display File from D_FILE
; points to the HALT at beginning.
SET 7,H ; (8) point to upper 32K 'echo display file'
HALT ; (1) HALT synchronizes with NMI.
; Used with special hardware connected to the
; Z80 HALT and WAIT lines to take 1 clock cycle.
OUT ($FD),A ; (11) Stop the NMI generator.
JP IX_to_PC ; (10) Delay because of the removed 'JP M,...'
IX_to_PC
JP (IX) ; (8) forward to L0281 (after top) or L028F
In case of the patched routine: 4+4+7+4+10=29 T states. So the 'JP IX_to_PC' is necessary for the correct displaying.
Is it possible to see the "master"-code?
Zsolt
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
Re: Let's calculate! - renewed arithmetic routines
Hi Zsolt
My assumption is, that the master code "catches" the NMI and executes it in its own ROM (to check for task switch conditions and for double-shift-keys).
After that is done it probably jumps back to the application ROM to execute the application NMI routine (if necessary). The well known address in the ZX81 ROM is NMI-CONT at L006F.
So maybe moving NMI-CONT from $006C to $006F would solve that problem?
Maybe the display timing would be a little bit distorted (caused by the different runtime in SG81G, which the master software does not expect), but maybe the display would be back again?
Add here some NOPs (which will NOT be executed!) to move NMI-CONT down of $006F ..
Currently I do not have setup an environment to compile (and modify for own tests) your ROM ....
Siggi
Pokemon has not published this code, so currently the answer is NO. But I will ask Pokemon (but he is very busy at the moment).
My assumption is, that the master code "catches" the NMI and executes it in its own ROM (to check for task switch conditions and for double-shift-keys).
After that is done it probably jumps back to the application ROM to execute the application NMI routine (if necessary). The well known address in the ZX81 ROM is NMI-CONT at L006F.
So maybe moving NMI-CONT from $006C to $006F would solve that problem?
Maybe the display timing would be a little bit distorted (caused by the different runtime in SG81G, which the master software does not expect), but maybe the display would be back again?
Code: Select all
;; NMI
L0066:
EX AF,AF' ; (4) switch in the NMI's copy of the
; accumulator.
INC A ; (4) increment.
;
; JP M,L006D (10) was removed for faster NMI-service: the user application gets +3TS/NMI
;
JR Z,L006C ; (12) forward to NMI-CONT
; when line count has incremented to zero.
;
;; NMI-RET (7!!!) else
;
EX AF,AF' ; (4) switch out the incremented line counter
; or test result $80
RET ; (10) return to User application for a while.
; ---
; This branch is taken when the 55 (or 31) lines have been drawn.
Code: Select all
;; NMI-CONT (its address was L006F)
L006C:
EX AF,AF' ; (4) restore the main accumulator.
PUSH AF ; (11) * Save Main Registers
PUSH BC ; (11) **
PUSH DE ; (11) ***
PUSH HL ; (11) ****
; the next set-up procedure is only really applicable when the top set of
; blank lines have been generated.
LD HL,($400C) ; (16) fetch start of Display File from D_FILE
; points to the HALT at beginning.
SET 7,H ; (8) point to upper 32K 'echo display file'
HALT ; (1) HALT synchronizes with NMI.
; Used with special hardware connected to the
; Z80 HALT and WAIT lines to take 1 clock cycle.
OUT ($FD),A ; (11) Stop the NMI generator.
JP IX_to_PC ; (10) Delay because of the removed 'JP M,...'
IX_to_PC
JP (IX) ; (8) forward to L0281 (after top) or L028F
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Let's calculate! - renewed arithmetic routines
HI,
I think I've found a better solution Please help in testing,
Zsolt
I think I've found a better solution Please help in testing,
Zsolt
- Attachments
-
- SG81_G_mod.zip
- (76.23 KiB) Downloaded 291 times
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
Re: Let's calculate! - renewed arithmetic routines
Hi Zsolt,
now the display is working
But it is a little bit disturbed: the first 3 pixel lines are shifted right:
Thus there seems to be a small timing difference.
Siggi
now the display is working
But it is a little bit disturbed: the first 3 pixel lines are shifted right:
Thus there seems to be a small timing difference.
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Let's calculate! - renewed arithmetic routines
ZX81 (8K), ENTERPRISE 128, [ZX SPECTRUM (48K,+,+128K,+2,+2A), TS1000, TS1500, TS2068, Cambridge Z88, PRIMO A64 (red)]
Re: Let's calculate! - renewed arithmetic routines
Using the SGMORE.ROM the display is OK (no shifted pixels).
I think I should use this rom for further math tests, until Pokemon has time to help.
Siggi
I think I should use this rom for further math tests, until Pokemon has time to help.
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Let's calculate! - renewed arithmetic routines
The attached version is Zsolt's latest, with a first try to make the BASIC LOAD and SAVE commands work using USB, even in compatibility mode. In the filename, only A-Z are allowed, and .P is added automatically.
- Attachments
-
- sgmls.zip
- (6.83 KiB) Downloaded 297 times