Search found 500 matches

by sn3j
Fri Apr 26, 2024 7:27 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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

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? Argh - right, this is not working with positive high-bytes... too bad. :| Id...
by sn3j
Thu Apr 25, 2024 10:13 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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

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. Yes, and maybe A is already 0 from a previous operation which would allow us...
by sn3j
Thu Apr 25, 2024 9:19 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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
ketmar wrote: Thu Apr 25, 2024 1:13 pm sadly, this doesn't work with $8000. that pesky $8000 again! ;-)
This could be fixed by:

Code: Select all

xor a
sub l
sbc a,a
cpl
or h
jp m,LessOrEqual0
by sn3j
Thu Apr 25, 2024 3:12 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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

Yet another one:

Code: Select all

ld a, h
add a
jp c LE_0
jp nz GT_0
; deal with cases 0..255 here
or l
jp z LE_0
Average would be something along 23.05 T.
by sn3j
Thu Apr 25, 2024 1:12 pm
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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

Here's another one:

Code: Select all

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

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

_dw wrote: Thu Apr 25, 2024 9:28 am the first one is identical, but the second code does something different than you expect. Because 0x8000 will underflow into positive numbers.
yes this is not right, I'll remove it from my post... thank you
by sn3j
Thu Apr 25, 2024 9:06 am
Forum: Programming
Topic: jump if signed 16-bit number is >0, <=0, fastest code
Replies: 34
Views: 474

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 -

Code: Select all

ld a h
dec hl
or h 
jp m LE_0
and add an INC HL before jumping if you need the original value.
by sn3j
Tue Apr 23, 2024 8:53 pm
Forum: ZXDB Fixes
Topic: HELP WANTED: Magazine type-in page numbers!
Replies: 17
Views: 320

Re: HELP WANTED: Magazine type-in page numbers!

Music Entertainer - Homecomputer 1984/12 p 35
Can't verify though as no PDF for that issue is available.

Loading screen from the TZX:
Image
by sn3j
Tue Apr 23, 2024 7:52 pm
Forum: ZXDB Fixes
Topic: HELP WANTED: Magazine type-in page numbers!
Replies: 17
Views: 320

Re: HELP WANTED: Magazine type-in page numbers!

Ops, this magazine was duplicated by mistake! This is the correct link, including these type-ins: https://spectrumcomputing.co.uk/issue/10463/Happy_Computer/1 EDIT: It seems Happy Computer was originally called "Hobby Computer" in the first issue only. ok I've found the issue number for 8...
by sn3j
Tue Apr 23, 2024 5:49 pm
Forum: ZXDB Fixes
Topic: HELP WANTED: Magazine type-in page numbers!
Replies: 17
Views: 320

Re: HELP WANTED: Magazine type-in page numbers!

PS: Regarding German titles, do you know where to find these? https://spectrumcomputing.co.uk/list?group_id=1055&lang=german No idea. I've found a full scan of Hobby-Computer 1983/11 in my download folder, it's not in your database. https://drive.google.com/file/d/11E_W1lePVps-d3Y1B8Tp13nJOOMWB...
by sn3j
Tue Apr 23, 2024 4:09 pm
Forum: ZXDB Fixes
Topic: HELP WANTED: Magazine type-in page numbers!
Replies: 17
Views: 320

Re: HELP WANTED: Magazine type-in page numbers!

Please mark it as starting at page 17. That's not exactly accurate, but it's the only page reference we have. done Hupschraubär Pilot - Happy-Computer 84/11 p 74 Manic Train - Computer Kontakt 85/03 p 29 Mensch ärgere Dich nicht - Happy-Computer 84/09 p 40 I see that Neil Parsons already did Hunter...
by sn3j
Tue Apr 23, 2024 1:36 pm
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

Prophyt wrote: Tue Apr 23, 2024 10:20 amCastle Master
yes :)

Image
by sn3j
Tue Apr 23, 2024 8:19 am
Forum: ZXDB Fixes
Topic: HELP WANTED: Magazine type-in page numbers!
Replies: 17
Views: 320

Re: HELP WANTED: Magazine type-in page numbers!

Graphik - Heim-Computer 1983/11 p 40 (40 in pdf) Hinterhalt - Heim-Computer 1983/12 p 43 (47 in pdf) Tischdecken - Happy-Computer 1984/07 p 57 (55 in pdf) Der Sagenhafte Schatz des Drachen Mordor: The listing appears to be on a large poster (inside the issue), so no page number. Also, there's no PDF...
by sn3j
Tue Apr 23, 2024 7:55 am
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

No. Zooming...
Image
by sn3j
Mon Apr 22, 2024 6:23 pm
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

not Klax

The game had several big reviews and wasn't mentioned in this thread so far.
by sn3j
Mon Apr 22, 2024 3:31 pm
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

SteveSmith wrote: Mon Apr 22, 2024 3:10 pm Geoff Capes?
nope
by sn3j
Mon Apr 22, 2024 3:03 pm
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

Image

Yay! :dance
Next up. This time it's in-game.
by sn3j
Mon Apr 22, 2024 2:38 pm
Forum: Games/Software
Topic: Guess the screen$
Replies: 7898
Views: 239333

Re: Guess the screen$

by sn3j
Sat Apr 20, 2024 3:51 pm
Forum: Sinclair Miscellaneous
Topic: RIP F David Thorpe
Replies: 31
Views: 1481

Re: RIP F David Thorpe

My Speccy came bundled with Pogo. It reminded me of the drawings by M.C.Escher that we were talking about in the school in arts.
The game took more than 5 minutes to load which was embarassing as it subsequently crashed (turned out my board had an error and needed replacement).
by sn3j
Fri Apr 12, 2024 7:12 am
Forum: Programming
Topic: BASin - How to load code from assembler?
Replies: 4
Views: 223

Re: BASin - How to load code from assembler?

Thank you for commenting Joefish and Timmy . Here's my hacky solution to get a file loaded from code: Set up a 34-byte area with the following data: [0] 3 - this byte tells we're requesting a CODE/SCREEN$ file [1..10] - the name of our file, padded with blanks if less than 10 chars [11..12] - reques...
by sn3j
Wed Apr 10, 2024 12:39 pm
Forum: Programming
Topic: BASin - How to load code from assembler?
Replies: 4
Views: 223

Re: BASin - How to load code from assembler?

There's a 2nd trap in the ROM at $63a (1594), this is where the file name is taken from by BASin for the next LD_BYTES call.
Am I supposed to call this trap from assembler? It's a bit clumsy to mock all up.

Image
by sn3j
Wed Apr 10, 2024 10:40 am
Forum: Programming
Topic: BASin - How to load code from assembler?
Replies: 4
Views: 223

BASin - How to load code from assembler?

I'm trying to load a code block from my assembler routine without the print output to the screen. So I've prepared the 17-byte header in IX and called LD_BYTES at ROM $556. Behind that header I reserved the usual 17-byte space for the header to be received. Address $556 is being trapped by BASin/Bas...
by sn3j
Fri Apr 05, 2024 9:02 pm
Forum: Programming
Topic: Euclidean dist/Sqrt/Multiplication routines 16bit
Replies: 38
Views: 904

Re: Euclidean dist/Sqrt/Multiplication routines 16bit

Could you calculate the square root less often or not at all if you used a different admissible heuristic function? You could presumably use something which is faster to calculate but which meets the criterion of never overestimating the cost of reaching the goal? If the estimation is too far off y...
by sn3j
Wed Apr 03, 2024 10:54 pm
Forum: Programming
Topic: Euclidean dist/Sqrt/Multiplication routines 16bit
Replies: 38
Views: 904

Re: Euclidean dist/Sqrt/Multiplication routines 16bit

A hacky way of getting this distance between two 2d points is this determine largest and smallest values from x,y length = largest + (smallest>>1) gives a worst case 12% error if smallest >= (largest>>3) then length = largest + (smallest>>1) - (largest>>3) gives worst case ~6% error but mostly <2% ...