News:

  • April 17, 2025, 08:08:04 PM

Login with username, password and session length

Author Topic: DL260 for next programming with indirect addressing  (Read 2212 times)

alectek

  • Jr. Member
  • **
  • Posts: 12
DL260 for next programming with indirect addressing
« on: December 10, 2018, 01:00:29 PM »
Hello,

I have a range of BCD value from V2500 to V2577, and I would like to store as BIN to memory from V2600 to V2677. How can I use a for next loop to finish this work?

don't like to do it one by one:
LD V2500
BIN
OUT V2600

Thanks!

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3742
    • Host Engineering
Re: DL260 for next programming with indirect addressing
« Reply #1 on: December 10, 2018, 01:27:08 PM »
Use Pointers, which are just V addresses that contain a V address.

Let's use V3000 and V3001 as the two pointers, one for SRC, one for DEST.
LDA O2500  // Load Address instruction; yes, that is a leading O for Octal, not 0
OUT V3000
LDA O2600  // ditto
OUT V3001

So LD V3000 loads the value in V3000, but LD P3000 (note the P instead of a V) loads the value of the V address in V3000, so it loads the value of V2500.
Similarly, OUT V3001 will write the current accumulator to V3001, but OUT P3001 will write the accumulator value to the V address in V3001, so it writes to V2600.

You have 64 elements in your "array", so do a FOR/NEXT loop 64 times
Code: [Select]
// intiailize the pointers
LDA O2500  // yes, that is a leading O for Octal, not 0
OUT V3000
LDA O2600  // ditto
OUT V3001

FOR K64
  LD P3000  // use V3000 as a pointer
  BIN  // convert accumulator from BCD to BIN
  OUT P3001  // use V3001 as a pointer
  // increment the pointers
  INCB V3000
  INCB V3001
NEXT

*** EDIT *** use INCB, not INC (need BINARY increment on the pointer, not BCD, doh!)
« Last Edit: December 10, 2018, 01:30:16 PM by franji1 »

alectek

  • Jr. Member
  • **
  • Posts: 12
Re: DL260 for next programming with indirect addressing
« Reply #2 on: December 10, 2018, 01:42:31 PM »
It works great.

Thank you!