Search found 101 matches

by _dw
Fri May 10, 2024 4:31 am
Forum: Games/Software
Topic: Why didn't the Spectrum have an FPS?
Replies: 33
Views: 896

Re: Why didn't the Spectrum have an FPS?

1983
by _dw
Fri May 10, 2024 3:41 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Bradley Ira Fiedel: Terminator 2 theme (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

https://youtu.be/tSWrDnY0-Vk
download: https://codeberg.org/DW0RKiN/M4_FORTH/s ... nator2.tap
by _dw
Wed May 08, 2024 5:57 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Hans Zimmer: Cornfield Chase (Interstellar) (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

https://youtu.be/jGd53Whi3-w
download: https://codeberg.org/DW0RKiN/M4_FORTH/s ... tellar.tap
by _dw
Tue May 07, 2024 2:58 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

いきものがかり: Naruto - Blue Bird (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

download: https://codeberg.org/DW0RKiN/M4_FORTH/s ... e_Bird.tap
by _dw
Sun May 05, 2024 7:48 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Yann Pierre Tiersen: Comptine d'un autre été (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))
[video][/video]
https://codeberg.org/DW0RKiN/M4_FORTH/s ... re_ete.tap
by _dw
Sat May 04, 2024 7:59 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

三好 智己: I Am Setsuna - Path of Redemption (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

https://codeberg.org/DW0RKiN/M4_FORTH/s ... mption.tap
by _dw
Fri May 03, 2024 5:15 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Trevor Jones: Last Mohicans - Kiss (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

https://codeberg.org/DW0RKiN/M4_FORTH/s ... s_Kiss.tap
by _dw
Wed May 01, 2024 8:37 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Kai Rosenkranz: Gothic 3 - Vista point (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered))

https://codeberg.org/DW0RKiN/M4_FORTH/s ... _point.tap
by _dw
Tue Apr 30, 2024 1:41 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

I think that the Bad Apple for the 48 version did not exist yet. 太田 "ZUN" 順也: Bad Apple!! (ZX Spectrum 1 bit beeper cover (Fuse Unfiltered)) https://youtu.be/EUzOJEWme-Y https://codeberg.org/DW0RKiN/M4_FORTH/src/branch/master/Testing/Bad_Apple.tap (this tap has modified sound at the end an...
by _dw
Tue Apr 30, 2024 1:29 am
Forum: Music
Topic: ZX Spectrum 48 beeper music colection
Replies: 29
Views: 2606

Re: ZX Spectrum 48 beeper music colection

Below I am drawing a picture of 3 square waves. Their frequency is the same, but the phase is different. ___---___--- _---___---__ ---___---___ Does this make sense? I thought so. However, I just checked the code again and it seems that phase is actually reset. So, the answer is no. Best forget eve...
by _dw
Tue Apr 30, 2024 1:14 am
Forum: Showcase your work!
Topic: F8 Forth cross-compiler; featuring Succubus, native Z80 code writer
Replies: 2
Views: 193

Re: F8 Forth cross-compiler; featuring Succubus, native Z80 code writer

In fact, in the worst case scenario, compiling with M4 Forth can take hours. Translation(edit:compile) speed was never a priority, only the final product. In certain cases when the best solution is found and by searching the state space, M4 Forth simply starts doing it. And he doesn't care about the...
by _dw
Thu Apr 25, 2024 11:15 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

So I should improve the code in the case of "DUP 0 LE IF". ld A, H ; 1:4 add A, A ; 1:4 jr c, $+6 ; 2:7/12 or L ; 1:4 jr nz, LAB_GT ; 3:10 ; LAB_LE: ; ... LAB_GT: ;[8:20,29/29] price 56.5 old code dnl dnl dnl # ( x1 -- x1 ) dnl # dup 0<= if define({DUP_0LE_IF},{dnl __{}__ADD_TOKEN({__TOKEN...
by _dw
Thu Apr 25, 2024 10:49 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

Save TopOfStack code dworkin@dw-A15:~/Programovani/ZX/Forth/Pasmo_test$ ../check_word.sh 'DUP PUSH(0) GT IF' ;[7:30] dup 0 > if ( x -- x ) flag: x > 0 ld A, H ; 1:4 dup 0 > if save sign dec HL ; 1:6 dup 0 > if zero to negative or H ; 1:4 dup 0 > if inc HL ; 1:6 dup 0 > if jp m, else101 ; 3:10 dup 0 ...
by _dw
Thu Apr 25, 2024 10:40 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

This could be fixed by: xor a sub l sbc a,a cpl or h jp m,LessOrEqual0 test HL = 0x3300 xor A --> a == 0 sub L --> 0x00 - 0x00 --> not carry sbc A,A --> A = 0x00 cpl --> A = 0xFF or H --> fail, because H does not depend and the result will be less than or equal to 0 Do I understand correctly?
by _dw
Thu Apr 25, 2024 11:29 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

I'm sure that 40 years ago the creators of the Z80 (8080?) had it well thought out. It was just forgotten along the way. When you write in assembler, you don't choose a signed number, but you have something easier for a loop. The best ending in zero. Just adjust the problem to something easier. If y...
by _dw
Thu Apr 25, 2024 11:15 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

There is an overflow attribute for signed arithmetic. I ignored PO and PE for a long time before I realized how to use it. And how does the credit actually work at all. It is best to read the "Z80 Family CPU User Manual.pdf" directly. Most sites deal only with carry and zero flag. At the s...
by _dw
Thu Apr 25, 2024 9:48 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

that's what i did first, just in a slightly different order. ld a, h or a jp m, # skip or l jp nz, # dest skip: somewhat faster than checking for 0 first. it is faster for negative numbers (18ts), but slower for 0 (32ts). and if programmer wrote such check, they prolly expect to see 0 quite often. ...
by _dw
Thu Apr 25, 2024 9:41 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

I suspect the easiest way is to check for 0 first, by just ORing the bytes and checking the Z flag. Assuming it's not 0, it's just a single bit test of the relevant sign bit. Should be easily adapted to any size of integer. Whether it's the fastest sort of depends on how you're measuring it, since ...
by _dw
Thu Apr 25, 2024 9:28 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

Maybe if you take the upper part after a DEC and check for bit 7? Something like posted by @_dw above - ld a h dec hl or h jp m LE_0 or dec hl bit 7,h and add an INC HL before jumping if you need the original value. And if you know from the previous operation that A has bit 7 unset you can spare th...
by _dw
Thu Apr 25, 2024 9:19 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

no wai. i can read Forth, but M4 is far beyond my cognitive abilities. ;-) Ah, that's what you meant. I don't expect anyone to understand the M4 source code. (Even if it's not that impossible, it just takes a little practice, most of the code is primitive) I meant that you look at what the assemble...
by _dw
Thu Apr 25, 2024 7:45 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

The completely basic variant is quite easy even for an interpreter. Divide the constants into two sets. The first 0 .. 0x7FFF is close to the number 0x8000 when adding a positive constant smaller than 0x8000 (that constant must be smaller than 0x8000). According to the result, you will know whether ...
by _dw
Thu Apr 25, 2024 7:16 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

You might be interested in the zero and 32 bit comparison. dworkin@dw-A15:~/Programovani/ZX/Forth/Pasmo_test$ ../check_word.sh 'PUSHDOT(0) DGT IF' ;[10:37/23] 0. d> if ( d -- d ) carry: d > 0. ld A, D ; 1:4 0. d> if cp 0x80 ; 2:7 0. d> if not carry if negative jr nc, $+7 ; 2:7/12 0. d> if negative d...
by _dw
Thu Apr 25, 2024 7:12 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

Actually, this is still the easy part. Complexity starts to increase with 32-bit numbers. There I found out that there are some patterns of constants that will simplify the test. But because it started to get too complicated, I just wrote a general function for an n-bit number. Because I have suppor...
by _dw
Thu Apr 25, 2024 7:08 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

I tried to write it optimally for any constant, so if it finds a value that can have a shorter code, it will probably have it. dworkin@dw-A15:~/Programovani/ZX/Forth/Pasmo_test$ ../check_word.sh 'PUSH(255) LE IF' ;[8:35] 255 <= if ( x -- ) ld A, H ; 1:4 255 <= if HL<=255 --> HL-255-1<=0 --> HL+(0x7F...
by _dw
Thu Apr 25, 2024 7:03 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 653

Re: jump if signed 16-bit number is >0, <=0, fastest code

You should download the M4 Forth and test a piece of code in it in the console. dworkin@dw-A15:~/Programovani/ZX/Forth/Pasmo_test$ ../check_word.sh 'PUSH(0) GT IF' ;[8:38] 0 > if ( x -- ) flag: x > 0 ld A, H ; 1:4 0 > if save sign dec HL ; 1:6 0 > if zero to negative or H ; 1:4 0 > if ex DE, HL ; 1:...