Search found 57 matches

by BB8
Thu Nov 06, 2025 12:48 pm
Forum: Programming
Topic: [Commodore] Calculate VIC-II byte address of a given point
Replies: 1
Views: 635

Re: [Commodore] Calculate VIC-II byte address of a given poi

This is a Plot function I wrote a few years back.
I didn't compare it to yours yet, I'm just putting it here, but I think there are similarities.


; ************************************************
;
; Plot
;
; input: _X (word 0-319**)
; _Y (byte 0-200**)
; **no boundary check
;
; offset ...
by BB8
Sat Jun 14, 2025 4:47 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

What assembler did you use to translate your file?
That's CBMprgStudio, tailored for Commodores
CMBstudio.jpg

in around 789K cycles!
It's less than that, around 745Kc: the other value came from the cycle count by Vice (the emulator) but the cpu gets stunned by the Video chip while drawing the ...
by BB8
Sat Jun 14, 2025 4:20 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

I did the test already: in the Vice screenshots you can see the memory dump via "m fb fe" and the result is 17 d1 33 f8 (those variable are in little-endian order), and it checks with OP's "$F833D117"
by BB8
Fri Jun 13, 2025 9:13 am
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

@Jeff: this is yours, and it's around 789K cycles*. Good thinking!


CRC0 = $FB
CRC1 = CRC0 + 1
CRC2 = CRC1 + 1
CRC3 = CRC2 + 1

count = $2

CRC_START = $A000
CRC_COUNT = $2000

*=$0810
sei

lda #>CRC_START
ldx #>CRC_COUNT

CalcCRC
; A = Start address high
; X = count
sta readvalue+2
stx ...
by BB8
Thu Jun 12, 2025 9:54 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

The table I published earlier was wrong; I did a CRC0 --> CRC3 shift while it's the opposite:
CRCtable.jpg


CRC0 = $FB
CRC1 = CRC0 + 1
CRC2 = CRC1 + 1
CRC3 = CRC2 + 1

CRC0h = $FB
CRC0l = CRC0h + 1
CRC1h = CRC0l + 1
CRC1l = CRC1h + 1

CRC2h = $61
CRC2l = CRC2h + 1
CRC3h = CRC2l + 1
CRC3l = CRC3h ...
by BB8
Thu Jun 12, 2025 2:32 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

if I didn't make mistakes...:
CRC.jpg
Edit: this table is in fact wrong; I posted a corrected one later in the thread
by BB8
Thu Jun 12, 2025 5:25 am
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

@Jeff: I'll have to review more closely what you're proposing, I haven't analyzed it deeply; I'll find some time later or tomorrow. It appears to me that you'll need to have 4 tables:
- one with current low nibbles in lsb position
- one with current low nibbles in msb position
- one with current ...
by BB8
Wed Jun 11, 2025 4:33 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

@Jeff: I meant something different. With your approach you are still doing a set of 1-bit shifts, while I want to eliminate that too. And you'd need 4 tables for nibbles in low and high positions.

My idea would be to have everything in the low nibble.
There should be 2 tables: one with the low ...
by BB8
Wed Jun 11, 2025 5:00 am
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

Well... having a need for speed and not using ZP is kind of a contradiction! ;)

I don't know which machine you're targeting, anyway, if you have a need for speed you could work with only nibbles: you should double the LUT to have only the lower nibble populated (%0000xxxx), so in your code instead ...
by BB8
Tue Jun 10, 2025 7:39 pm
Forum: Programming
Topic: CRC32 with "nibble" table
Replies: 35
Views: 4907

Re: CRC32 with "nibble" table

On top of what BDD proposed, as you suggested you may use Y for CRC0: each "sta CRC0" and "lda CRC0" could be changed to "TAY" and "TYA"; it should give you 7 cycles per iteration (per byte).
The initial part would be:

[...]
; init CRC with $FFFF FFFF
ldy #$ff
;sty CRC0
sty CRC1
sty CRC2
sty ...
by BB8
Thu Mar 27, 2025 5:39 pm
Forum: Programming
Topic: Neolithic Tiny Basic
Replies: 216
Views: 53621

Re: Neolithic Tiny Basic

USR is usually used as a Right-Hand Side of an expression, like V = USR(dest).
But knowing how is structured your code I see that it would not be easy to have it that way: you have no provision for functions yet.

As for the launch of internal routines, you could have a pointer in ZP that you fill ...
by BB8
Thu Mar 27, 2025 7:37 am
Forum: Programming
Topic: Neolithic Tiny Basic
Replies: 216
Views: 53621

Re: Neolithic Tiny Basic

Well... I don't know if USR was a good idea: now you have to "feed" it! :P
You need to give the user a way to launch their own routines, which have to be put in memory. And unless you want to enter them with an endless string of lines, each one with a "!" (poke) statement, you need two new ...
by BB8
Wed Mar 26, 2025 5:28 pm
Forum: Programming
Topic: Old but Gold: in search for (forgotten) tricks
Replies: 8
Views: 2408

Re: Old but Gold: in search for (forgotten) tricks

; is min <= .A <= max
CLC
ADC #$FF-max
ADC #max-min+1
BCS yes

SEC
SBC #min
SBC #max-min+1
BCC yes

CLC ; by Mike Barry
ADC #$FF-max
CMP #$FF-min+1
BCS yes

CMP #min
BCC LessThanMin
CMP #max+1
BCS MoreThanMax
; here is min <= .A <= max


; .A = M- .A
SEC
EOR #$FF
ADC M

CLC
SBC M
EOR #$FF ...
by BB8
Wed Mar 12, 2025 5:18 pm
Forum: Programming
Topic: Neolithic Tiny Basic
Replies: 216
Views: 53621

Re: Neolithic Tiny Basic

using bmi for an unsigned compare of addresses is not advised in the general case

you're right, that was my mistake, BCC has to be used there:

memmove:
lda mm_size
ora mm_size+1 ; not much point if size is zero
beq mov_done
lda mm_from+1 ; check high bytes
cmp mm_to+1
bne memo_nz
lda mm ...