Search found 250 matches

by bogax
Tue Mar 15, 2022 12:49 am
Forum: Programming
Topic: Attention code golfers...
Replies: 16
Views: 4702

Re: Attention code golfers...

you just want to get bit 1 into bit 7?

Code: Select all

  lda ACIA
  and #$02
  adc #$7D
by bogax
Sat Apr 20, 2019 4:53 pm
Forum: General Discussions
Topic: 6502 Telescope Interface
Replies: 15
Views: 2192

Re: 6502 Telescope Interface

Well, the main purpose of anything I would want to build would be informational only. Meaning, I wouldn't want the computer to control the scope. But the other way around. The computer would display what was in the field of view as I moved the scope around (with my hands).

I'm not sure on the ...
by bogax
Sun Aug 19, 2018 9:40 pm
Forum: Programming
Topic: 8-bit random number generator
Replies: 36
Views: 20251

Re: 8-bit random number generator

I like the Batari Basic rand16

It's just a 16 bit LFSR that shifts the two bytes in opposite directions
and XORs them for an 8bit return value

Code: Select all

  lda seedhi
  lsr
  rol seedlo
  bcc noeor
  eor #$B4
noeor
  sta seedhi
  eor seedlo

This is an interesting read hmc-cs-2014-0905.pdf
by bogax
Sun May 28, 2017 4:10 am
Forum: Programming
Topic: Calculating log and trig - algorithms or tables
Replies: 19
Views: 8534

Re: Calculating log and trig - algorithms or tables

Continued from elsewhere :

It seems that CORDIC can be thought of as a binary search. So, the tables needed to support CORDIC are very small - about the size of the number of bits you want in the result, not the size of the number of values you expect to compute. The number of operations needed is ...
by bogax
Sat Feb 06, 2016 3:31 pm
Forum: Programming
Topic: CBM (C64) floating point improvement
Replies: 44
Views: 14725

Re: CBM (C64) floating point improvement

you could precompute some partial products, say M2 x 3 and M2 x 4
and do the addition predicated on two bits per shift
by bogax
Sun Jan 10, 2016 4:17 am
Forum: Programming
Topic: Getting code size even smaller
Replies: 18
Views: 6738

Re: Getting code size even smaller

why not decrement length in the usual way?

Code: Select all

DECLEN
   LDA LENL 
   BNE SKIP
   DEC LENH
SKIP
   DEC LENL
   RTS ;Return to caller
also it looks like it would be useful to have DECLEN
return a zero flag (ie move the zero test to the DECLEN routine)
by bogax
Sun Jul 26, 2015 10:19 pm
Forum: Programmable Logic
Topic: Use GAL as a small eprom
Replies: 51
Views: 10546

Re: Use GAL as a small eprom

if you used the overflow flag as the data in
and one of the interrupts as a clock, you
could use the other interrupt as the jump to
the start of your code.

if you cleared the accumulator for each byte and started
by clocking in a 1 as an end of byte flag (and then your
8 bits of data) the ...
by bogax
Sun Jul 26, 2015 12:14 am
Forum: SBC- Series Projects
Topic: Bootstrapping an SBC
Replies: 25
Views: 57162

Re: Bootstrapping an SBC

With recent posts concerning bootstrapping I was reminded of this thread



ldx #$00
txs
push_byte
pha
wait
cmp data_in
beq wait
lda data_in
bne push_byte
rts


you can't have consecutive bytes the same or a 0 in the code

edit:
oops goofed it
what's the chance that the accumulator will ...
by bogax
Sun May 17, 2015 3:44 pm
Forum: Programming
Topic: Making bytecode interpreter faster (without eating more ROM)
Replies: 12
Views: 3938

Re: Making bytecode interpreter faster (without eating more

Implement [something like] local labels in your byte code interpreter.
by bogax
Sat Apr 04, 2015 8:12 pm
Forum: Hardware
Topic: 65C02 and SCR latch-up
Replies: 8
Views: 1487

Re: 65C02 and SCR latch-up

The external diodes would have to turn on at a lower voltage than the internal ones in order to keep the internal ones from conducting. If the internal ones start turning on at around 0.15V, I don't know how to get anything lower than that externally.

Sorry, I wasn't clear.

What I'm questioning ...
by bogax
Sat Apr 04, 2015 5:37 pm
Forum: Hardware
Topic: 65C02 and SCR latch-up
Replies: 8
Views: 1487

Re: 65C02 and SCR latch-up

The static-protection diodes on the I/O pins are Schottky already (with forward voltages of around a quarter of a volt), so putting more diodes on probably won't help a bit.

Are you sure about that? (cite?)

Thats not my understanding (I'm far from an expert though)

The protection diodes are ...
by bogax
Wed Mar 18, 2015 9:20 am
Forum: Programming
Topic: Dividing by seven
Replies: 22
Views: 5034

Re: Dividing by seven

I haven't tried it out yet, and it looks like it may have potential as a fast MOD ... but CH needs the quotient too, so your routine won't be able to do what he has in mind for unpacking three chars from a cell.

Mike B.

yes, perhaps I should have made that more explicit

but he's already got his ...
by bogax
Wed Mar 18, 2015 2:31 am
Forum: Programming
Topic: Dividing by seven
Replies: 22
Views: 5034

Re: Dividing by seven

Can you explain to us how it works, bogax? It would appear that you're from the same "school of commenting" as dclxvi :wink:

Do you have a rough cycle count estimate for typical inputs?

Mike B.



actually I tend to think of the code as sort of
incidental to the comments else we'd all be ...
by bogax
Tue Mar 17, 2015 2:19 am
Forum: Programming
Topic: Dividing by seven
Replies: 22
Views: 5034

Re: Dividing by seven

I'll have a go

Code: Select all

mod_40
 lda hi
 asl
 asl
 asl
 asl
 clc
 adc lo
 bcc *+4
 adc #$0F
 sta tmp
 lda hi
 and #$F0
 adc tmp
 bcc *+4
 adc #$0F
 sec
div_loop
 sbc #$28
 bcs div_loop
 adc #$28
 rts