Search found 11 matches

by lightbeing
Mon Jun 16, 2025 2:20 pm
Forum: Programming
Topic: Comparing 6502 multiply routines
Replies: 51
Views: 26528

Re: Comparing 6502 multiply routines

I have exhaustively tested and compared the performance and memory use of over 60 integer multiplication routines from the internet. (EDIT: Now over 120 routines)

I also explore the algorithms and techniques behind them:

https://github.com/TobyLobster/multiply_test

Impressive job. Thank you so ...
by lightbeing
Wed Jan 31, 2024 10:57 pm
Forum: Emulation and Simulation
Topic: Interrupt behavior during an instruction
Replies: 9
Views: 6310

Re: Interrupt behavior during an instruction

I'm not sure I fully understood a specific mechanism in the interrupt behaviour. Can anyone help me.

Page 131 of the MCS 6500 programming manual dated January 1976 indicates that during cycle 1 of an IRQ, the processor finishes the previous operation.

I also read this here https://www.pagetable ...
by lightbeing
Sat Jan 13, 2024 5:30 pm
Forum: Programming
Topic: JMP(nn) - indirect JMP question
Replies: 14
Views: 7706

Re: JMP(nn) - indirect JMP question

Not sure that I understand your issue but there's a "bug" with the indirect JMP.

It works properly only if the low/high bytes of the pointing adress are on the same page.

JMP ($C0FF) will not fetch the effective jumping adress from $C100 but from $C000.
by lightbeing
Sat Jan 13, 2024 12:57 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Re: Displaying an ASCII spiral in 6502

A table doesn't seem very interesting, that's for sure! Often these challenges have a size limitation, or will score on the basis of size, so that can push solutions towards ingenuity. The smallest code to do the job might be a good challenge, in fact... I don't think it's likely to be slow, in any ...
by lightbeing
Sat Jan 13, 2024 12:28 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Re: Displaying an ASCII spiral in 6502

I think we just need to move left one then down one, then right two and up two, then left three and down three, and so on. One way could be to store a direction vector starting with (-1,0) and rotate it left 90 degrees at each corner by swapping its elements and negating the new first element - so ...
by lightbeing
Fri Jan 12, 2024 2:49 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Re: Displaying an ASCII spiral in 6502

I think there’s an interesting challenge in optimising some 6502 code which makes coordinates for this kind of spiral. I’ve previously seen this spiral as an Ulam Spiral, where each point is used to indicate if a number is prime or not.

That's what I tought. Optimizing the code could be fun.

On ...
by lightbeing
Thu Jan 11, 2024 9:57 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Re: Displaying an ASCII spiral in 6502

BigEd wrote:
OK, so it's a spiral fill pattern, printing whatever (but the usual diagonal "maze" happens to look good)

By spiral fill I mean something like

Code: Select all

16 15 14 13
 5  4  3 12
 6  1  2 11
 7  8  9 10
Exactly.
by lightbeing
Thu Jan 11, 2024 6:44 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Re: Displaying an ASCII spiral in 6502

The FINAL shape of the spiral is a square when the drawing has finished.

But each ASCII output during the drawing on the screen is performed as a rotation (left or right)

Here's how the final shape looks like with 205/206 PETSCII codes.

The facebook group is BASIC language programming:
https ...
by lightbeing
Thu Jan 11, 2024 5:46 pm
Forum: Programming
Topic: Displaying an ASCII spiral in 6502
Replies: 13
Views: 7007

Displaying an ASCII spiral in 6502

A challenge was recently organised on facebook.

The aim was to create a short BASIC program displaying an ASCII code progressively on the screen, following the shape of a spiral which starts at the centre of the screen. The challenge was opened to all computers.

I wrote a code in assembly for the ...
by lightbeing
Sun Oct 15, 2023 5:05 pm
Forum: Programming
Topic: Computing sine and cosine using CORDIC and BCD
Replies: 2
Views: 2927

Re: Computing sine and cosine using CORDIC and BCD

Welcome!
Thank you! :)


Also, in the knowledgebase nearby on this site, we see CORDIC mentioned in
Source Code Repository
(in this case, points to a thread I've already listed above, but worth mentioning the reference section I think.)

Many thanks for the suggestions.

I understand that the ...
by lightbeing
Sun Oct 15, 2023 2:21 pm
Forum: Programming
Topic: Computing sine and cosine using CORDIC and BCD
Replies: 2
Views: 2927

Computing sine and cosine using CORDIC and BCD

Hello there,

I had this idea to implement a very simple 6502 routine to compute step by step in BCD mode, the sine and cosine of a given angle using the CORDIC method and the common formulas Cos(A+B) and Sin(A+B). Values for the angles B would be chosen in such way that Tan(B)=1, 0.5, 0.25, 0.125 ...