Search found 711 matches

by ketmar
Thu Apr 25, 2024 2:10 pm
Forum: Games/Software
Topic: Coincidence!
Replies: 35
Views: 584

Re: Coincidence!

Lee P wrote: Thu Apr 25, 2024 2:07 pm I assume CGC entries don't count?
it would be too easy, i believe.

but you reminded me that i wanted to steal Starquake hero sprite! thank you! ;-)
by ketmar
Thu Apr 25, 2024 2:04 pm
Forum: Games/Software
Topic: Coincidence!
Replies: 35
Views: 584

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/...
by ketmar
Thu Apr 25, 2024 1:17 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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...
by ketmar
Thu Apr 25, 2024 1:13 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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

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
sadly, this doesn't work with $8000. that pesky $8000 again! ;-)
by ketmar
Thu Apr 25, 2024 1:03 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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 ...
by ketmar
Thu Apr 25, 2024 10:09 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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!
by ketmar
Thu Apr 25, 2024 9:39 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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...
by ketmar
Thu Apr 25, 2024 8:23 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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

_dw wrote: Thu Apr 25, 2024 7:45 am It is best to check it in M4. .))
no wai. i can read Forth, but M4 is far beyond my cognitive abilities. ;-)
by ketmar
Thu Apr 25, 2024 7:37 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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...
by ketmar
Thu Apr 25, 2024 7:29 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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...
by ketmar
Thu Apr 25, 2024 5:40 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 26
Views: 209

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...
by ketmar
Wed Apr 24, 2024 4:49 pm
Forum: Games/Software
Topic: Coincidence!
Replies: 35
Views: 584

Re: Coincidence!

by ketmar
Sat Apr 20, 2024 10:29 am
Forum: Programming
Topic: Goodbye,Z80
Replies: 30
Views: 1357

Re: Goodbye,Z80

and they still haven't implemented "EX SP, SP'". what a shame.
by ketmar
Sat Apr 20, 2024 6:35 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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. ;-)
by ketmar
Tue Apr 16, 2024 11:42 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

Re: Abersoft fig-Forth Recompiled

implemented most sprite editor functions i need:
Image

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! ;-)
by ketmar
Mon Apr 15, 2024 12:25 pm
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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...
by ketmar
Mon Apr 15, 2024 10:01 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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.
by ketmar
Mon Apr 15, 2024 7:18 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

Re: Abersoft fig-Forth Recompiled

another thing i definitely don't want to write in assembler:
Spoiler
Image
by ketmar
Sun Apr 14, 2024 11:47 am
Forum: Programming
Topic: Bank switching issue
Replies: 32
Views: 1110

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...
by ketmar
Sun Apr 14, 2024 11:13 am
Forum: Programming
Topic: Bank switching issue
Replies: 32
Views: 1110

Re: Bank switching issue

goodboy wrote: Sun Apr 14, 2024 10:51 am on the 128k machine you can use im1 for your code subroutine
but only if you have 128K ROM paged in, otherwise SWAP is not called.
by ketmar
Sun Apr 14, 2024 9:27 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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...
by ketmar
Sun Apr 14, 2024 12:53 am
Forum: Programming
Topic: Bank switching issue
Replies: 32
Views: 1110

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...
by ketmar
Sat Apr 13, 2024 11:36 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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...
by ketmar
Sat Apr 13, 2024 10:36 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

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...
by ketmar
Sat Apr 13, 2024 5:14 am
Forum: Showcase your work!
Topic: Abersoft fig-Forth Recompiled
Replies: 108
Views: 1903

Re: Abersoft fig-Forth Recompiled

ok, cross-copiler can create +3DOS .DSK image now. and the system even starts from it! ;-) the writer supports all 4 kinds of disks, and uses 720K disk by default. now i have to write +3DOS interface code.