Search found 712 matches
- Thu Apr 25, 2024 9:58 pm
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
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 but than it is slower than 24ts case. 4*5+10=30. might be useful if HL cannot be destroyed, though. but then we have 18/32 version, which is not much slower, and sometimes faster. still, might be useful for stable timings.
- Thu Apr 25, 2024 2:10 pm
- Forum: Games/Software
- Topic: Coincidence!
- Replies: 45
- Views: 769
- Thu Apr 25, 2024 2:04 pm
- Forum: Games/Software
- Topic: Coincidence!
- Replies: 45
- Views: 769
Re: Coincidence!
Bingo! https://spectrumcomputing.co.uk/SCRtoImage.php?SCR=pub/sinclair/screens/load/t/scr/Trantor-TheLastStormtrooper.scr&border=0 https://spectrumcomputing.co.uk/SCRtoImage.php?SCR=pub/sinclair/screens/load/o/scr/OurLife3.scr&border=0 https://spectrumcomputing.co.uk/SCRtoImage.php?SCR=pub/...
- Thu Apr 25, 2024 1:17 pm
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
Re: jump if signed 16-bit number is >0, <=0, fastest code
Here's another one: ld a, h add a jr c LE_0 or l jr z LE_0 which is 31T for Zero, 20T for negative numbers (50% of all cases) and 26T for the positive numbers. Average should be 23T, depending on how your cases are distributed. nice one! sadly, the compiler cannot use "JRs". but i'll save...
- Thu Apr 25, 2024 1:13 pm
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
Re: jump if signed 16-bit number is >0, <=0, fastest code
sadly, this doesn't work with $8000. that pesky $8000 again! ;-)Antonio Luque wrote: ↑Thu Apr 25, 2024 12:36 pm This takes 26ts, but preserve HL:
Code: Select all
xor a sub l sbc a,a sub h jp m,GreaterThan0
- Thu Apr 25, 2024 1:03 pm
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
Re: jump if signed 16-bit number is >0, <=0, fastest code
yet 16-bit ADD sets only carry flag. and for ADC/SBC you need another free 16-bit register, and they are slower (and you need to reset carry too). even if you have enough free registers, it will be slow. and there is no "CP HL, r16" instruction for non-destructive 16-bit comparisons. so i ...
- Thu Apr 25, 2024 10:09 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
Re: jump if signed 16-bit number is >0, <=0, fastest code
…and i just found another two missing instructions in Z80: "jump if both sign and zero flags are not set", and "jump if either sign, or z flag is set". ;-) so, Z80 is missing 3 useful instructions: "EX SP, SPx", and two jumps. i really have to fix my time machine!
- Thu Apr 25, 2024 9:39 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
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. that's what i did first, just in a slightly different order. ld a, h or a j...
- Thu Apr 25, 2024 8:23 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
- Thu Apr 25, 2024 7:37 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
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. that's why i'm not even planning to support 32-bit numbers natively. if you need 32-bit math in your game, you're doing something wrong. ;-) even 3d engines are ok with 16-bit math. and F8 is designed to write...
- Thu Apr 25, 2024 7:29 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
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. oh. thank you again! i tried to invent something to "fix" zero, but my brain is not as good as it was, so i overcomplicated everything. and trying to read M4 code makes my brain hurts even more. ;-) tbh, i for...
- Thu Apr 25, 2024 5:40 am
- Forum: Programming
- Topic: jump if signed 16-bit number is >0, <=0, fastest code
- Replies: 32
- Views: 363
jump if signed 16-bit number is >0, <=0, fastest code
i need to check if signed 16-bit number (in some register, of course) is >0, and perform a conditional jump. the same for <=0. of course, it can be solved with two JPs (that's what i did), but i maybe i missed some smart trick? ah, i forgot to tell that register contents could be destroyed (and accu...
- Wed Apr 24, 2024 4:49 pm
- Forum: Games/Software
- Topic: Coincidence!
- Replies: 45
- Views: 769
Re: Coincidence!
sure. Super Chopper.
- Sat Apr 20, 2024 10:29 am
- Forum: Programming
- Topic: Goodbye,Z80
- Replies: 30
- Views: 1365
Re: Goodbye,Z80
and they still haven't implemented "EX SP, SP'". what a shame.
- Sat Apr 20, 2024 6:35 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
just to note: nope, the project is not abandoned. trying to write documentation and examples. most complex part, which may take quite some time. ;-)
- Tue Apr 16, 2024 11:42 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
implemented most sprite editor functions i need:
MASSIVE 4mb gif animation of the working editor. of course, i forgot to record pixel drawing. again. ;-)
p.s.: it took me about a hour to implement all those new buttons. Forth power! ;-)
MASSIVE 4mb gif animation of the working editor. of course, i forgot to record pixel drawing. again. ;-)
p.s.: it took me about a hour to implement all those new buttons. Forth power! ;-)
- Mon Apr 15, 2024 12:25 pm
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
That is very rapid development for the speccy ;) thank you! i procrastinated almost 1/2 of the time, tbh. ;-) and most code was lifted from the tile editor (arrow, magified view, hot areas). still, developing in Forth IS that fast: tile editor only took me about 2 days of work (if we remove all pro...
- Mon Apr 15, 2024 10:01 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
and some amimation! huge gif!
yes, it is possible to draw on the magnified sprite area, i simply forgot to record it. ;-) and the sprite keep walking.
yes, it is possible to draw on the magnified sprite area, i simply forgot to record it. ;-) and the sprite keep walking.
- Mon Apr 15, 2024 7:18 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
another thing i definitely don't want to write in assembler:
Spoiler
- Sun Apr 14, 2024 11:47 am
- Forum: Programming
- Topic: Bank switching issue
- Replies: 32
- Views: 1121
Re: Bank switching issue
Will that still work if the +3DOS ROM is paged in? i am cheating by switching to IM1 when calling +3DOS. not that you can do much while +3DOS does its business anyway. Is there actually a guaranteed 257 byte ramp containing FFh at the same addresses in every ROM? it is still there in 48K BASIC, whi...
- Sun Apr 14, 2024 11:13 am
- Forum: Programming
- Topic: Bank switching issue
- Replies: 32
- Views: 1121
- Sun Apr 14, 2024 9:27 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
i tried "OR/AND" sprite printing ("OR" sprites, then erase with inverted "AND" mask)… and it looks surprisingly good, even for overlapping sprites. of course, this mode cannot be used with "print sprite over tiles", but as we have "tile mask" mode, i...
- Sun Apr 14, 2024 12:53 am
- Forum: Programming
- Topic: Bank switching issue
- Replies: 32
- Views: 1121
Re: Bank switching issue
also note that by destroying sysvars you won't be able to use +3DOS. you need to call ROM interrupt handler to eventually turn drive motor off, and it uses some other sysvars too. tbh, i never bothered to get rid of sysvars, and i don't think you need to. ;-) hey, you wasted 257 bytes on interrupt t...
- Sat Apr 13, 2024 11:36 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
…and i just thought that TR-DOS support is completely unnecessary. it will require a custom disk format with non-standard sector sizes, which is hardly supported by TR-DOS emulators on real hardware. it will not use TR-DOS "file system", so various high-level emulators will fail to map For...
- Sat Apr 13, 2024 10:36 am
- Forum: Showcase your work!
- Topic: Abersoft fig-Forth Recompiled
- Replies: 108
- Views: 1923
Re: Abersoft fig-Forth Recompiled
implemented +3DOS support for block i/o. it is possible to open any +3DOS file as block storage with "+3BLK-OPEN", and then all standard Forth block commands will work with it. so it is now possible to use room editor (which stores everything in blocks) on real +3, yay! of course, there is...