Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.sys.pdp10 > #9945 > unrolled thread

Fizz Buzz

Started byjayjwa <jayjwa@atr2.ath.cx.invalid>
First post2026-07-23 17:39 -0400
Last post2026-08-21 13:27 +0100
Articles 20 on this page of 24 — 10 participants

Back to article view | Back to alt.sys.pdp10


Contents

  Fizz Buzz jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-07-23 17:39 -0400
    Re: Fizz Buzz Rich Alderson <news@alderson.users.panix.com> - 2026-07-23 23:19 -0400
      Re: Fizz Buzz jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-07-25 12:00 -0400
        Re: Fizz Buzz Rich Alderson <news@alderson.users.panix.com> - 2026-07-25 18:05 -0400
          Re: Fizz Buzz jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-07-26 11:12 -0400
        Accumulator naming Rich Alderson <news@alderson.users.panix.com> - 2026-07-29 18:10 -0400
          Re: Accumulator naming scott@slp53.sl.home (Scott Lurndal) - 2026-07-30 15:14 +0000
            Re: old architectures, was Accumulator naming John Levine <johnl@taugh.com> - 2026-07-30 20:40 +0000
            Re: Accumulator naming Rich Alderson <news@alderson.users.panix.com> - 2026-07-30 18:41 -0400
          Re: Accumulator naming jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-07-30 11:24 -0400
            Re: Accumulator naming scott@slp53.sl.home (Scott Lurndal) - 2026-07-30 16:03 +0000
            Re: Accumulator naming Rich Alderson <news@alderson.users.panix.com> - 2026-07-30 18:56 -0400
              Re: Accumulator naming cross@spitfire.i.gajendra.net (Dan Cross) - 2026-07-30 23:48 +0000
                Re: Accumulator naming John Levine <johnl@taugh.com> - 2026-07-31 01:31 +0000
                  Re: Accumulator naming cross@spitfire.i.gajendra.net (Dan Cross) - 2026-07-31 02:52 +0000
                    Re: Accumulator naming John Levine <johnl@taugh.com> - 2026-07-31 03:36 +0000
                    Re: Accumulator naming Lars Brinkhoff <lars.spam@nocrew.org> - 2026-07-31 13:40 +0000
            Re: Accumulator naming Lars Brinkhoff <lars.spam@nocrew.org> - 2026-07-31 13:35 +0000
            the Ten Heavenly Stems (was Re: Accumulator naming) Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-11 16:07 -0300
              Re: the Ten Heavenly Stems (was Re: Accumulator naming) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-14 01:12 +0800
                Re: the Ten Heavenly Stems (was Re: Accumulator naming) Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-14 14:40 -0300
                  Re: the Ten Heavenly Stems (was Re: Accumulator naming) scott@slp53.sl.home (Scott Lurndal) - 2026-09-14 18:09 +0000
                  Re: the Ten Heavenly Stems (was Re: Accumulator naming) quadibloc@invalid.com (John Savard) - 2026-10-26 03:00 +0000
    Re: Fizz Buzz "Kerr-Mudd, John" <admin@127.0.0.1> - 2026-08-21 13:27 +0100

Page 1 of 2  [1] 2  Next page →


#9945 — Fizz Buzz

Fromjayjwa <jayjwa@atr2.ath.cx.invalid>
Date2026-07-23 17:39 -0400
SubjectFizz Buzz
Message-ID<87wlulwflh.fsf@atr2.ath.cx>
As I continue on with MACRO-20, I thought I'd share my Fizz Buzz
solution for TOPS-10 and TOPS-20. I wanted the solution where you stuff
pointers to const char in a buffer, then dump the buffer once at the end
but I couldn't get it working with PSOUT% on T20. Maybe it's not
possible. Oddly, T10 won't take TDNE and branch properly so I had to use
CAIN instead. This works on TOPS-20 (see code and comments). Both
systems are KL.

T20 can .cont if you HALTF% and JRST START. How can I restart the
program in a similar fashion on TOPS-10? I only see EXIT instead of
HALTF%, which doesn't allow .cont restarting.

If other alt.lang.asm'ers want to do Fizz Buzz, don't forget to remove
the pdp10 newsgroup from your reply if it's not about the pdp10.

.dir fizasm.*
FIZASM  REL     2  <057>   23-Jul-99    DSKB:   [30,1,DEV]
FIZASM  EXE     8  <057>   23-Jul-99
FIZASM  MAC     5  <057>   23-Jul-99
  Total of 15 blocks in 3 files on DSKB: [30,1,DEV]

.run fizasm
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
EXIT

@vdir fizasm.*
   DSK1:<PROGRAMMING>
 FIZASM.EXE.2;P777700       2 1024(36)   22-Jul-2026 21:06:10 JAYJWA    
   .MAC.87;P676742          2 2781(7)    22-Jul-2026 21:48:11 JAYJWA    
   .REL.82;P777700          1 166(36)    22-Jul-2026 21:48:15 JAYJWA    

 Total of 5 pages in 3 files

@time fizasm
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
        0.04 real         0.01 user         0.00 sys

C (KCC) "const char pointers to buffer" version runs about the same.
@time fizz
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
        0.04 real         0.01 user         0.00 sys


comment $
Fizz Buzz for PDP-10 TOPS-10
For 1..N, check if each integer is evenly divisible by 3, if so, print
"Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
print the bare number.
$
	title	fizasm
	search	monsym,macsym
	STDAC.					; Labels accums for us

	size==62				; Number of terms to see (50)
						; Only <= 99 is supported
fizz:	asciz	/Fizz /				; Tag for N mod 3 == 0
buzz:	asciz	/Buzz /				; Tag for N mod 5 == 0
fzbz:	asciz	/FizzBuzz /			; Tag for N mod 15 == 0
flags:	0
crlf:	15B6+12B13				; Bit-pack a \r\n

	subttl	Main
start:	setz	cx,				; Zero counter for loop
st.1:	addi	cx,1				; Examine next number
chk15:	move	q1,cx				; Number to examine in Q1
	idivi	q1,17				; Div by 15, rem in ac+1
	jumpn	q2,chk3				; N mod 15 != 0, don't print
	movei	q3,1				; Set bit 35 to indicate that
	iorm	q3,flags			; we've output a word
	outstr	fzbz				; T10 has OUTSTR, not PSOUT%
	jumpa	chkn.1				; to output string to TTY

chk3:	move	q1,cx				; Re-get number to examine, Q1
	idivi	q1,3				; Divide by 3, remainder ac+1
	jumpn	q2,chk5				; N mod 3 != 0, don't print
	movei	q3,1				; Set bit 35 to indicate that
	iorm	q3,flags			; we've output a word already
	outstr	fizz				; Output fizz tag to TTY

chk5:	move	q1,cx				; Reload number because IDIVI
	idivi	q1,5				; in CHK3 blanked it
	jumpn	q2,chknum			; N mod 5 != 0, don't print
	movei	q3,1				; Ready flags setting
	iorm	q3,flags			; Set bit 35, indicating we
	outstr	buzz				; printed a tag to TTY
	jumpa	chkn.1				; Printed at least one tag so
						; skip printing num itself
chknum:	move	q3,flags			; Examine flags
; TOPS-10 won't work correctly with TDNE Q3,1 unlike on TOPS-20. Use CAIN
; instead to avoid printing a tag and its number. No idea why this is.
	cain	q3,1				; If anything set this then
	  jrst	chkn.1				; skip printing the bare num
	move	q1,cx				; Fetch number to convert
	jsr	numout				; Print bare num

chkn.1:	setzm	flags				; Reset flags to zero
	caige	cx,size				; More numbers to check?
	  jrst	st.1				; Yes (increment above)
	outstr	crlf				; No, done, tidy output
	exit
	jrst	start				; Does restart work on T10?


	subttl	Number Out Subroutine
; TOPS-10 has no NOUT% like TOPS-20 does, so convert the system number
; by hand to ASCII printing characters for display on the TTY. Only 
; supports up to double-digit numbers.
; Input: Q1 (Q1, Q2 could be overwritten)
; Output: Prints ASCII char(s) equal to the number to the TTY
numout:	0					; Save return address spc
	idivi	q1,12				; Convert to printable char
	addi	q1,60				; In first position
	caie	q1,60				; Don't print leading zero
	  outchr q1				; Print first character
	addi	q2,60				; Convert second char
	outchr	q2				; And print to TTY
	outchr	[.CHSPC]			; Emit space character
	jrst	@numout				; Return to caller


	lit					; Debugger to expand literals
	end	start				; Assembler is done


And the TOPS-20 version:
comment $
Fizz Buzz for PDP-10 TOPS-20
For 1..N, check if each integer is evenly divisible by 3, if so, print
"Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
print the bare number.
$
        title	fizasm
	search	monsym,macsym
        STDAC.					; Labels accums for us
					        ; cx = iterator for loopage
; Set number of terms you want, in octal. Currently 50 decimal
	size==62				; How far to go with this
fizz:	asciz	/Fizz /				; Tag for N mod 3 == 0
buzz:	asciz	/Buzz /				; Tag for N mod 5 == 0
fzbz:	asciz	/FizzBuzz /			; Tag for N mod 15 == 0
flags:	0					; Bit 35 set if word output
crlf:   15B6+12B13                      	; Bit-pack a \r\n
	                                       
start:	setz	cx,				; Zero counter for loop
st.1:	addi	cx,1				; Examine next number
chk15:	move	q1,cx				; The number to examine in Q1
	idivi	q1,17				; Div by 15, rem in ac+1
	jumpn   q2,chk3                         ; N mod 15 != 0, don't print
	movei   q3,1                            ; Set bit 35 to indicate that
	iorm    q3,flags                        ; we've output a word
	hrroi	t1,fzbz				; Output fzbz tag to TTY
	psout%
	jumpa   chkn.1                          ; No more printing now

chk3:	move	q1,cx				; Re-get number to examine, Q1
	idivi	q1,3				; Divide by 3, remainder ac+1
	jumpn	q2,chk5				; N mod 3 != 0, don't print
	movei	q3,1				; Set bit 35 to indicate that
	iorm	q3,flags			; we've output a word
	hrroi	t1,fizz
	psout%					; Output fizz tag to TTY

chk5:	move	q1,cx				; Reload number because IDIVI
	idivi	q1,5				; in CHK3 blanked it
	jumpn	q2,chknum			; N mod 5 != 0, don't print
	movei   q3,1
	iorm    q3,flags			; Set bit 35, indicate we
	hrroi	t1,buzz				; printed a tag
	psout%					; Output buzz tag to TTY
	jumpa	chkn.1				; Printed at least one tag, so
	                                        ; skip printing the num itself
chknum:	move	q3,flags			; Examine flags
	tdne	q3,^B1				; If anything set this then
	  jrst	chkn.1				; skip printing the bare num
	move	t1,[.priou]			; Else print bare number
	move	t2,cx				; Ready NOUT%'s num
	movei	t3,12				; Base is decimal
	nout%					; Print num to TTY
	  erjmp	[hrroi t1,[asciz /IO error on NOUT%. Exiting./]
		 psout%
		 haltf%]			; Error? Can't continue, exit
	move    t1,[point 7,[asciz / /]]        ; Emit space char, tidy output
	psout%

chkn.1:	setzm	flags				; Reset flags to zero
	caige	cx,size				; More numbers to check?
	  jrst	st.1				; Yes (increment above)
	hrroi	t1,crlf				; No, done, tidy output
	psout%					; with a \r\n
	haltf%					; Exit to monitor
	jrst	start				; Want to see that again?

	lit					; DDT to expand literals
	end	start				; Assembler is done

-- 
PGP Key ID: 781C A3E2 C6ED 70A6 B356  7AF5 B510 542E D460 5CAE
       "The Internet should always be the Wild West!"

[toc] | [next] | [standalone]


#9946

FromRich Alderson <news@alderson.users.panix.com>
Date2026-07-23 23:19 -0400
Message-ID<mdd33x9cbvq.fsf@panix5.panix.com>
In reply to#9945
jayjwa <jayjwa@atr2.ath.cx.invalid> writes:

> As I continue on with MACRO-20, I thought I'd share my Fizz Buzz
> solution for TOPS-10 and TOPS-20. I wanted the solution where you stuff
> pointers to const char in a buffer, then dump the buffer once at the end
> but I couldn't get it working with PSOUT% on T20. Maybe it's not
> possible. Oddly, T10 won't take TDNE and branch properly so I had to use
> CAIN instead. This works on TOPS-20 (see code and comments). Both
> systems are KL.

I call bullshit.

TDNE is a hardware instruction.

Tops-10 is software.

There is no way that a hardware instruction is blocked by the operating system.
You did something else wrong.

> T20 can .cont if you HALTF% and JRST START. How can I restart the
> program in a similar fashion on TOPS-10? I only see EXIT instead of
> HALTF%, which doesn't allow .cont restarting.

You don't read manuals very well, do you?  I find the following in the
Monitor Calls Reference manual:

|   22.46  EXIT [CALLI 12]
|
|   FUNCTION
|
|   Stops job execution and optionally resets the job.
|
|   CALLING SEQUENCE
|
|             EXIT    fcn-code,
|             continue return
|
|   In the calling sequence, the program supplies the following variables:
|
|         o  fcn-code is one of the function codes described below.
|
|            For either code, when you EXIT from a job in an auto-pushed
|            context, you are returned to the superior context and the inferior
|            one is deleted.
|
|         o  continue return is the instruction to be executed if the user
|            issues a valid CONTINUE monitor command.

Notice that the description of the EXIT call includes a function code.  What do
you suppose they might mean for the execution of the instruction?  Oh, here we go.

|   The function codes and their meanings are:
|
|   Code      Function
|
|   0         Performs the following:
|
|             o  Releases all I/O devices, closing files if necessary.
|             o  Unlocks the job from core.
|             o  Sets the user-mode write-protect bit for the high segment.
|             o  Resets APR traps to zero.
|             o  Clears PC flags.
|             o  Performs a RESET and stops the job.
|
|            If timesharing was stopped by a TRPSET monitor call, the monitor
|            resumes timesharing.  A RESET monitor call is executed, and the
|            word EXIT is typed on your terminal, and the terminal is left in
|            monitor mode.  You cannot continue with the CONT or CCONT monitor
|            command.

OK, leaving off a function code is equivalent to coding a 0, right?
Moving on...

|   1         Performs the following:
|
|             o  Clears PC flags.
|             o  Stops the job.
|
|            EXIT is not printed on your terminal, and you can continue program
|            execution with the CONT or CCONT monitor command.  If you use
|            function code 1, you should first RELEASE all devices and
|            channels; a convenient way to do this is to use the RESET monitor
|            call.  The symbol for EXIT 1, is MONRT.

Hmm.  That looks like exactly what you want, doesn't it?

|   2-17      Reserved for use by DIGITAL.

Stingy bastards.

> If other alt.lang.asm'ers want to do Fizz Buzz, don't forget to remove
> the pdp10 newsgroup from your reply if it's not about the pdp10.

> .dir fizasm.*
> FIZASM  REL     2  <057>   23-Jul-99    DSKB:   [30,1,DEV]
> FIZASM  EXE     8  <057>   23-Jul-99
> FIZASM  MAC     5  <057>   23-Jul-99
>   Total of 15 blocks in 3 files on DSKB: [30,1,DEV]

> .run fizasm
> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
> z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
>  41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
> EXIT

> @vdir fizasm.*
>    DSK1:<PROGRAMMING>
>  FIZASM.EXE.2;P777700       2 1024(36)   22-Jul-2026 21:06:10 JAYJWA    
>    .MAC.87;P676742          2 2781(7)    22-Jul-2026 21:48:11 JAYJWA    
>    .REL.82;P777700          1 166(36)    22-Jul-2026 21:48:15 JAYJWA    

>  Total of 5 pages in 3 files

> @time fizasm
> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
> z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
>  41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
>         0.04 real         0.01 user         0.00 sys

> C (KCC) "const char pointers to buffer" version runs about the same.
> @time fizz
> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
> z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
>  41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
>         0.04 real         0.01 user         0.00 sys

comment $
Fizz Buzz for PDP-10 TOPS-10
For 1..N, check if each integer is evenly divisible by 3, if so, print
"Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
print the bare number.
$
|         title   fizasm
|         search  monsym,macsym
|         STDAC.                                  ; Labels accums for us
| 
|         size==62                                ; Number of terms to see (50)
|                                                 ; Only <= 99 is supported
| fizz:   asciz   /Fizz /                         ; Tag for N mod 3 == 0
| buzz:   asciz   /Buzz /                         ; Tag for N mod 5 == 0
| fzbz:   asciz   /FizzBuzz /                     ; Tag for N mod 15 == 0
| flags:  0
| crlf:   15B6+12B13                              ; Bit-pack a \r\n

OK, usually we allow the assembler to do the work:

  CRLF:   BYTE(7) 15,12f

or

  CRLF:   ASCIZ/
  /

|         subttl  Main
| start:  setz    cx,                             ; Zero counter for loop
| st.1:   addi    cx,1                            ; Examine next number
| chk15:  move    q1,cx                           ; Number to examine in Q1
|         idivi   q1,17                           ; Div by 15, rem in ac+1
|         jumpn   q2,chk3                         ; N mod 15 != 0, don't print
|         movei   q3,1                            ; Set bit 35 to indicate that
|         iorm    q3,flags                        ; we've output a word

Can FLAGS have a value other than 0 or 1?  A much better solution in that case
is to use 0 and -1, and the SETO/SETZ instructions.  Here, use

          SETOM   FLAGS

|         outstr  fzbz                            ; T10 has OUTSTR, not PSOUT%
|         jumpa   chkn.1                          ; to output string to TTY
| 
| chk3:   move    q1,cx                           ; Re-get number to examine, Q1
|         idivi   q1,3                            ; Divide by 3, remainder ac+1
|         jumpn   q2,chk5                         ; N mod 3 != 0, don't print
|         movei   q3,1                            ; Set bit 35 to indicate that
|         iorm    q3,flags                        ; we've output a word already
	  SETOM   FLAGS
|         outstr  fizz                            ; Output fizz tag to TTY
| 
| chk5:   move    q1,cx                           ; Reload number because IDIVI
|         idivi   q1,5                            ; in CHK3 blanked it
|         jumpn   q2,chknum                       ; N mod 5 != 0, don't print
|         movei   q3,1                            ; Ready flags setting
|         iorm    q3,flags                        ; Set bit 35, indicating we
	  SETOM   FLAGS
|         outstr  buzz                            ; printed a tag to TTY
|         jumpa   chkn.1                          ; Printed at least one tag so
|                                                 ; skip printing num itself
| chknum: move    q3,flags                        ; Examine flags
| ; TOPS-10 won't work correctly with TDNE Q3,1 unlike on TOPS-20. Use CAIN
| ; instead to avoid printing a tag and its number. No idea why this is.
|         cain    q3,1                            ; If anything set this then
|           jrst  chkn.1                          ; skip printing the bare num

Well, of course TDNE does not work here.  READ THE HARDWARE MANUAL.

The Test Direct instructions compare the contents of the AC to THE CONTENTS OF
THE EFFECTIVE ADDRESS, not to the immediate value in the instruction, unlike
all the other Test instructions.  What you are saying in TDNE Q3,1 is that the
processor should bitwise compare the value you've loaded into Q3 WITH THE VALUE
CURRENTLY IN AC 1.  What would have worked is TDNE Q3,[1] with a literal
containing the value 1.

But even better is using the -1/0 trick from above, and coding

	  SKIPN   FLAGS
	   JRST   CHKN.1

|         move    q1,cx                           ; Fetch number to convert
|         jsr     numout                          ; Print bare num

Worst possible subroutine call choice you can make.  It's the 1980s, for crying
out loud--use a stack and PUSHJ/POPJ.

| chkn.1: setzm   flags                           ; Reset flags to zero
|         caige   cx,size                         ; More numbers to check?
|           jrst  st.1                            ; Yes (increment above)
|         outstr  crlf                            ; No, done, tidy output
|         exit

And as you've now learned, this should be

	  EXIT 1,
or even better
	  MONRT

|         jrst    start                           ; Does restart work on T10?


|         subttl  Number Out Subroutine
| ; TOPS-10 has no NOUT% like TOPS-20 does, so convert the system number
| ; by hand to ASCII printing characters for display on the TTY. Only 
| ; supports up to double-digit numbers.
| ; Input: Q1 (Q1, Q2 could be overwritten)
| ; Output: Prints ASCII char(s) equal to the number to the TTY
| numout: 0                                       ; Save return address spc
|         idivi   q1,12                           ; Convert to printable char
|         addi    q1,60                           ; In first position
|         caie    q1,60                           ; Don't print leading zero
|           outchr q1                             ; Print first character
|         addi    q2,60                           ; Convert second char
|         outchr  q2                              ; And print to TTY
|         outchr  [.CHSPC]                        ; Emit space character
|         jrst    @numout                         ; Return to caller

<hrrk!>

|         lit                                     ; Debugger to expand literals
|         end     start                           ; Assembler is done


| And the TOPS-20 version:
| comment $
| Fizz Buzz for PDP-10 TOPS-20
| For 1..N, check if each integer is evenly divisible by 3, if so, print
| "Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
| print the bare number.
| $
|         title   fizasm
|         search  monsym,macsym
|         STDAC.                                  ; Labels accums for us
|                                                 ; cx = iterator for loopage
| ; Set number of terms you want, in octal. Currently 50 decimal
|         size==62                                ; How far to go with this
| fizz:   asciz   /Fizz /                         ; Tag for N mod 3 == 0
| buzz:   asciz   /Buzz /                         ; Tag for N mod 5 == 0
| fzbz:   asciz   /FizzBuzz /                     ; Tag for N mod 15 == 0
| flags:  0                                       ; Bit 35 set if word output
| crlf:   15B6+12B13                              ; Bit-pack a \r\n

See above.

| start:  setz    cx,                             ; Zero counter for loop
| st.1:   addi    cx,1                            ; Examine next number
| chk15:  move    q1,cx                           ; The number to examine in Q1
|         idivi   q1,17                           ; Div by 15, rem in ac+1
|         jumpn   q2,chk3                         ; N mod 15 != 0, don't print
|         movei   q3,1                            ; Set bit 35 to indicate that
|         iorm    q3,flags                        ; we've output a word

See above.

|         hrroi   t1,fzbz                         ; Output fzbz tag to TTY
|         psout%
|         jumpa   chkn.1                          ; No more printing now

It is preferable always to use JRST rather than JUMPA, because the latter
invokes the comparison hardware even when the intent is to branch unconditionally.

| chk3:   move    q1,cx                           ; Re-get number to examine, Q1
|         idivi   q1,3                            ; Divide by 3, remainder ac+1
|         jumpn   q2,chk5                         ; N mod 3 != 0, don't print
|         movei   q3,1                            ; Set bit 35 to indicate that
|         iorm    q3,flags                        ; we've output a word

See above.

|         hrroi   t1,fizz
|         psout%                                  ; Output fizz tag to TTY
| 
| chk5:   move    q1,cx                           ; Reload number because IDIVI
|         idivi   q1,5                            ; in CHK3 blanked it
|         jumpn   q2,chknum                       ; N mod 5 != 0, don't print
|         movei   q3,1
|         iorm    q3,flags                        ; Set bit 35, indicate we

See above.

|         hrroi   t1,buzz                         ; printed a tag
|         psout%                                  ; Output buzz tag to TTY
|         jumpa   chkn.1                          ; Printed at least one tag, so
|                                                 ; skip printing the num itself
| chknum: move    q3,flags                        ; Examine flags
|         tdne    q3,^B1                          ; If anything set this then
|           jrst  chkn.1                          ; skip printing the bare num

OK, I refuse to believe that this worked, just because you declared that the
integer 1 was a binary value.  Something in AC 1 was ACCIDENTALLY of a shape to
work.  Singlestep it in DDT and look at the values in T1 and Q3.

And the same thing is still true as above in the Tops-10 version.  Use SKIPE/SKIPN
and the 0/-1 values.

|         move    t1,[.priou]                     ; Else print bare number

Usually MOVEI T1,.PRIOU

|         move    t2,cx                           ; Ready NOUT%'s num
|         movei   t3,12                           ; Base is decimal
|         nout%                                   ; Print num to TTY
|           erjmp [hrroi t1,[asciz /IO error on NOUT%. Exiting./]
|                  psout%
|                  haltf%]                        ; Error? Can't continue, exit
|         move    t1,[point 7,[asciz / /]]        ; Emit space char, tidy output
|         psout%
| 
| chkn.1: setzm   flags                           ; Reset flags to zero
|         caige   cx,size                         ; More numbers to check?
|           jrst  st.1                            ; Yes (increment above)
|         hrroi   t1,crlf                         ; No, done, tidy output
|         psout%                                  ; with a \r\n
|         haltf%                                  ; Exit to monitor
|         jrst    start                           ; Want to see that again?
| 
|         lit                                     ; DDT to expand literals
|         end     start                           ; Assembler is done

It's nice tht you want to teach folks PDP-10 assembler programming, but don't
you think you should do that when you know what you're doing?

                                                                Rich

-- 
Rich Alderson					  news@alderson.users.panix.com
      Audendum est, et veritas investiganda; quam etiamsi non assequamur,
	  omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
									--Galen

[toc] | [prev] | [next] | [standalone]


#9947

Fromjayjwa <jayjwa@atr2.ath.cx.invalid>
Date2026-07-25 12:00 -0400
Message-ID<87se579i01.fsf@atr2.ath.cx>
In reply to#9946
Rich Alderson <news@alderson.users.panix.com> writes:

Some of this is personal preference, like the .priou and crlf. I used JSR
so I didn't have to make a stack just for one use. The other stuff I'll
address below.

> TDNE is a hardware instruction.
Noted. It would be easier to see their usage if the accumulators had
names that didn't exactly resemble numbers ( for example: rax, rbx, rcx,
etc) instead of 1, 2, 3, etc. I had misunderstood what that instuction
operated on. 

> You don't read manuals very well, do you?  I find the following in the
> Monitor Calls Reference manual:
Yes, Chef Ramsay. I did search and find MONRT. (with trailing dot) but
it did not work. I spent 50 minutes yesterday bruteforcing any and all
combos involving. Only EXIT 1,  works. Maybe MONRT. isn't in MONSYM or
MACSYM but really it didn't work.

U       000046' 000000000000#                   monrt
MONRT   UNASSIGNED, DEFINED AS IF EXTERNAL

?1 ERROR DETECTED
U       000046' 000000000000#                   MONRT.
MONRT.  UNASSIGNED, DEFINED AS IF EXTERNAL

?1 ERROR DETECTED
U       000046' 000000000000#                   MONRT
MONRT   UNASSIGNED, DEFINED AS IF EXTERNAL

?1 ERROR DETECTED
I also tried EXIT  MONRT and EXIT  MONRT. , with literals and without.

> Can FLAGS have a value other than 0 or 1?  A much better solution in that case
> is to use 0 and -1, and the SETO/SETZ instructions.  Here, use
>
>           SETOM   FLAGS
My orginal design was to set bits for flags if the various tags were
output: one bit for fizz, one for buzz, one for fzbz. Then I realized
it didn't matter what bit was set - only that something was
printed. That condition alone should set the flags. Correction made.

> Well, of course TDNE does not work here.  READ THE HARDWARE MANUAL.
>
> The Test Direct instructions compare the contents of the AC to THE CONTENTS OF
> THE EFFECTIVE ADDRESS, not to the immediate value in the instruction, unlike
> all the other Test instructions.  What you are saying in TDNE Q3,1 is that the
> processor should bitwise compare the value you've loaded into Q3 WITH THE VALUE
> CURRENTLY IN AC 1.  What would have worked is TDNE Q3,[1] with a literal
> containing the value 1.
On TOPS-20, PSOUT% is used for tag output. This requires a pointer in
T1. The logic for checking flags checks that A: is it zero? and B: is it
one? In reality, case "B" is "is it anything other than one"? On
TOPS-20, T1 has stuff in it (the pointer) and was being interpreted as a
flag. TOPS-10 uses OUTSTR, which doesn't involve using T1, so the flags
weren't properly checked. Thus, my code (on TOPS-20) did the right thing
but for the wrong reasons. This is what DDT had to say about the matter.

> But even better is using the -1/0 trick from above, and coding
>
> 	  SKIPN   FLAGS
> 	   JRST   CHKN.1
Corrected. It's SKIPE, since if flags are zero this means we should
output the number. If flags are one we skip number-outputting code.

> It is preferable always to use JRST rather than JUMPA, because the latter
> invokes the comparison hardware even when the intent is to branch
> unconditionally.
Why would it invoke comparision hardware on ALWAYS? And if you're not
supposed to use it, why provide a JUMPA? I'm going to have to have a
talk with these DEC guys...

> OK, I refuse to believe that this worked, just because you declared that the
> integer 1 was a binary value.  Something in AC 1 was ACCIDENTALLY of a
> shape to work.
Yes, the string pointer for PSOUT% on TOPS-20. The TOPS-10 code doesn't
use that printing means and so didn't work. 

> It's nice tht you want to teach folks
You have that turned 'round the wrong way. Look at it from the other
direction.

The revised program for TOPS-10:

comment $
Fizz Buzz for PDP-10 TOPS-10
For 1..N, check if each integer is evenly divisible by 3, if so, print
"Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
print the bare number.
$
	title	fizasm
	search	monsym,macsym
	STDAC.					; Labels accums for us
	
	stksz==2				; Size of stack
	size==62				; Number of terms to see (50)
						; Only <= 99 is supported
fizz:	asciz	/Fizz /				; Tag for N mod 3 == 0
buzz:	asciz	/Buzz /				; Tag for N mod 5 == 0
fzbz:	asciz	/FizzBuzz /			; Tag for N mod 15 == 0
crlf:	asciz	/
/						; This looks weird (\r\n)
flags:	0					; 0 = no tag, 1 = tag output
stack:	block	stksz				; Space for stack

	subttl	Main
start:	move	p,[iowd stksz, stack]		; Setup stack + guard
	setz	cx,				; Zero counter for loop
st.1:	addi	cx,1				; Examine next number
chk15:	move	q1,cx				; Number to examine in Q1
	idivi	q1,17				; Div by 15, rem in ac+1
	jumpn	q2,chk3				; N mod 15 != 0, don't print
	setom	flags				; Indicate we've output a tag
	outstr	fzbz				; T10 has OUTSTR, not PSOUT%
	jrst	chkn.1				; to output string to TTY

chk3:	move	q1,cx				; Re-get number to examine, Q1
	idivi	q1,3				; Divide by 3, remainder ac+1
	jumpn	q2,chk5				; N mod 3 != 0, don't print
	setom	flags				; Indicate we've printed a tag
	outstr	fizz				; Output fizz tag to TTY

chk5:	move	q1,cx				; Reload number because IDIVI
	idivi	q1,5				; in CHK3 blanked it
	jumpn	q2,chknum			; N mod 5 != 0, don't print
	setom	flags				; Indicate that we've
	outstr	buzz				; printed a tag to TTY
	jrst	chkn.1				; Printed at least one tag so
						; skip printing num itself
chknum:	skipe	flags				; Did something set flags?
	  jrst	chkn.1				; Then skip printing num
	move	q1,cx				; Fetch number to convert
	pushj	p,numout			; Print bare num

chkn.1:	setzm	flags				; Reset flags to zero
	caige	cx,size				; More numbers to check?
	  jrst	st.1				; Yes (increment above)
	outstr	crlf				; No, done, tidy output
	exit	1,				; MONRT. does NOT work
	jrst	start				; Restartable program


	subttl	Number Out Subroutine
; TOPS-10 has no NOUT% like TOPS-20 does, so convert the system number
; by hand to ASCII printing characters for display on the TTY. Only 
; supports up to double-digit numbers.
; Input: Number to convert in Q1
; Output: Prints ASCII char(s) equal to the number to the TTY
numout:	idivi	q1,12				; Convert to printable char
	addi	q1,60				; In first position
	caie	q1,60				; Don't print leading zero
	  outchr q1				; Print first character
	addi	q2,60				; Convert second char
	outchr	q2				; And print to TTY
	outchr	[.CHSPC]			; Emit space character
	popj	p,				; Return to caller


	lit					; Debugger to expand literals
	end	start				; Assembler is done


.exec fizasm
LINK:   Loading
[LNKXCT FIZASM execution]
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 

.cont

1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz

-- 
PGP Key ID: 781C A3E2 C6ED 70A6 B356  7AF5 B510 542E D460 5CAE
       "The Internet should always be the Wild West!"

[toc] | [prev] | [next] | [standalone]


#9948

FromRich Alderson <news@alderson.users.panix.com>
Date2026-07-25 18:05 -0400
Message-ID<mddzeze67yk.fsf@panix5.panix.com>
In reply to#9947
jayjwa <jayjwa@atr2.ath.cx.invalid> writes:

> Rich Alderson <news@alderson.users.panix.com> writes:

> Some of this is personal preference, like the .priou and crlf. I used JSR
> so I didn't have to make a stack just for one use. The other stuff I'll
> address below.

>> TDNE is a hardware instruction.

> Noted. It would be easier to see their usage if the accumulators had
> names that didn't exactly resemble numbers ( for example: rax, rbx, rcx,
> etc) instead of 1, 2, 3, etc. I had misunderstood what that instuction
> operated on. 

Read more carefully.

>> You don't read manuals very well, do you?  I find the following in the
>> Monitor Calls Reference manual:

> Yes, Chef Ramsay. I did search and find MONRT. (with trailing dot) but
> it did not work. I spent 50 minutes yesterday bruteforcing any and all
> combos involving. Only EXIT 1,  works. Maybe MONRT. isn't in MONSYM or
> MACSYM but really it didn't work.

MONSYM.UNV is a TOPS-20 file.  It does not contain Tops-10 monitor calls.

Some of the Tops-10 monitor calls, BUT NOT ALL, are predefined in DEC versions
of Macro-10.  In order to get all of them you have to search UUOSYM.  That's
specified in the Tops-10 Monitor Calls Reference Manual.

Remember that Tops-10 and TOPS-20 are entirely separate operating systems WHICH
SHARE NO CODE WHATSOEVER.  You wouldn't complain about a Windows program that
didn't understand a Linux system call, would you?

> U       000046' 000000000000#                   monrt
> MONRT   UNASSIGNED, DEFINED AS IF EXTERNAL

[ snip ]

>> Can FLAGS have a value other than 0 or 1?  A much better solution in that case
>> is to use 0 and -1, and the SETO/SETZ instructions.  Here, use

>>           SETOM   FLAGS

> My orginal design was to set bits for flags if the various tags were
> output: one bit for fizz, one for buzz, one for fzbz. Then I realized
> it didn't matter what bit was set - only that something was
> printed. That condition alone should set the flags. Correction made.

>> Well, of course TDNE does not work here.  READ THE HARDWARE MANUAL.

>> The Test Direct instructions compare the contents of the AC to THE CONTENTS OF
>> THE EFFECTIVE ADDRESS, not to the immediate value in the instruction, unlike
>> all the other Test instructions.  What you are saying in TDNE Q3,1 is that the
>> processor should bitwise compare the value you've loaded into Q3 WITH THE VALUE
>> CURRENTLY IN AC 1.  What would have worked is TDNE Q3,[1] with a literal
>> containing the value 1.

> On TOPS-20, PSOUT% is used for tag output. This requires a pointer in
> T1. The logic for checking flags checks that A: is it zero? and B: is it
> one? In reality, case "B" is "is it anything other than one"? On
> TOPS-20, T1 has stuff in it (the pointer) and was being interpreted as a
> flag. TOPS-10 uses OUTSTR, which doesn't involve using T1, so the flags
> weren't properly checked. Thus, my code (on TOPS-20) did the right thing
> but for the wrong reasons. This is what DDT had to say about the matter.

Yup!

>> But even better is using the -1/0 trick from above, and coding
>>
>> 	  SKIPN   FLAGS
>> 	   JRST   CHKN.1

> Corrected. It's SKIPE, since if flags are zero this means we should
> output the number. If flags are one we skip number-outputting code.

But you got the point.

>> It is preferable always to use JRST rather than JUMPA, because the latter
>> invokes the comparison hardware even when the intent is to branch
>> unconditionally.

> Why would it invoke comparision hardware on ALWAYS? And if you're not
> supposed to use it, why provide a JUMPA? I'm going to have to have a
> talk with these DEC guys...

Because the JUMPx instructions are TEST instructions, just like the SKIPx
instructions.

>> OK, I refuse to believe that this worked, just because you declared that the
>> integer 1 was a binary value.  Something in AC 1 was ACCIDENTALLY of a
>> shape to work.

> Yes, the string pointer for PSOUT% on TOPS-20. The TOPS-10 code doesn't
> use that printing means and so didn't work. 

>> It's nice tht you want to teach folks

> You have that turned 'round the wrong way. Look at it from the other
> direction.

The fact that you are posting to alt.lang.asm leads to the conclusion that you
are doing that.  You should have included that newsgroup on your response to
my Phillipic so that your readers there could see the results.

> The revised program for TOPS-10:

> comment $
> Fizz Buzz for PDP-10 TOPS-10
> For 1..N, check if each integer is evenly divisible by 3, if so, print
> "Fizz". If by 5, print "Buzz". If by both print "FizzBuzz". If neither,
> print the bare number.
> $
>       title   fizasm
>       search  monsym,macsym

s/mon/uuo/

and I'm not sure whether MACSYM.UNV is also on Tops-10, but it probably is.

>       STDAC.                                  ; Labels accums for us
>       
>       stksz==2                                ; Size of stack
>       size==62                                ; Number of terms to see (50)
>                                               ; Only <= 99 is supported
> fizz: asciz   /Fizz /                         ; Tag for N mod 3 == 0
> buzz: asciz   /Buzz /                         ; Tag for N mod 5 == 0
> fzbz: asciz   /FizzBuzz /                     ; Tag for N mod 15 == 0
> crlf: asciz   /
> /                                             ; This looks weird (\r\n)
> flags: 0                                      ; 0 = no tag, 1 = tag output
> stack: block   stksz                          ; Space for stack
> 
>       subttl  Main
> start: move   p,[iowd stksz, stack]           ; Setup stack + guard
>       setz    cx,                             ; Zero counter for loop
> st.1: addi    cx,1                            ; Examine next number
> chk15: move   q1,cx                           ; Number to examine in Q1
>       idivi   q1,17                           ; Div by 15, rem in ac+1
>       jumpn   q2,chk3                         ; N mod 15 != 0, don't print
>       setom   flags                           ; Indicate we've output a tag
>       outstr  fzbz                            ; T10 has OUTSTR, not PSOUT%
>       jrst    chkn.1                          ; to output string to TTY
> 
> chk3: move    q1,cx                           ; Re-get number to examine, Q1
>       idivi   q1,3                            ; Divide by 3, remainder ac+1
>       jumpn   q2,chk5                         ; N mod 3 != 0, don't print
>       setom   flags                           ; Indicate we've printed a tag
>       outstr  fizz                            ; Output fizz tag to TTY
> 
> chk5: move    q1,cx                           ; Reload number because IDIVI
>       idivi   q1,5                            ; in CHK3 blanked it
>       jumpn   q2,chknum                       ; N mod 5 != 0, don't print
>       setom   flags                           ; Indicate that we've
>       outstr  buzz                            ; printed a tag to TTY
>       jrst    chkn.1                          ; Printed at least one tag so
>                                               ; skip printing num itself
> chknum: skipe flags                           ; Did something set flags?
>         jrst  chkn.1                          ; Then skip printing num
>       move    q1,cx                           ; Fetch number to convert
>       pushj   p,numout                        ; Print bare num
> 
> chkn.1: setzm flags                           ; Reset flags to zero
>       caige   cx,size                         ; More numbers to check?
>         jrst  st.1                            ; Yes (increment above)
>       outstr  crlf                            ; No, done, tidy output
>       exit    1,                              ; MONRT. does NOT work
>       jrst    start                           ; Restartable program

>       subttl  Number Out Subroutine
> ; TOPS-10 has no NOUT% like TOPS-20 does, so convert the system number
> ; by hand to ASCII printing characters for display on the TTY. Only 
> ; supports up to double-digit numbers.
> ; Input: Number to convert in Q1
> ; Output: Prints ASCII char(s) equal to the number to the TTY
> numout: idivi q1,12                           ; Convert to printable char
>       addi    q1,60                           ; In first position
>       caie    q1,60                           ; Don't print leading zero
>         outchr q1                             ; Print first character
>       addi    q2,60                           ; Convert second char
>       outchr  q2                              ; And print to TTY
>       outchr  [.CHSPC]                        ; Emit space character
>       popj    p,                              ; Return to caller
> 
> 
>       lit                                     ; Debugger to expand literals
>       end     start                           ; Assembler is done
> 
> 
> .exec fizasm
> LINK:   Loading
> [LNKXCT FIZASM execution]
> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
> z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
>  41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz 
> 
> .cont
> 
> 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fiz
> z 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz
>  41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz

-- 
Rich Alderson                                     news@alderson.users.panix.com
      Audendum est, et veritas investiganda; quam etiamsi non assequamur,
          omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
                                                                        --Galen

[toc] | [prev] | [next] | [standalone]


#9949

Fromjayjwa <jayjwa@atr2.ath.cx.invalid>
Date2026-07-26 11:12 -0400
Message-ID<875x21lr8v.fsf@atr2.ath.cx>
In reply to#9948
Rich Alderson <news@alderson.users.panix.com> writes:

> MONSYM.UNV is a TOPS-20 file.  It does not contain Tops-10 monitor calls.
>
> Some of the Tops-10 monitor calls, BUT NOT ALL, are predefined in DEC versions
> of Macro-10.  In order to get all of them you have to search UUOSYM.  That's
> specified in the Tops-10 Monitor Calls Reference Manual.
There is a MONSYM, on TOPS-10, along with about 2-3 dozen other .UNVs:
.dir unv:

ACTPRM  UNV    15  <055>    1-Sep-88    DSKB:   [5,17]
ACTSYM  UNV    86  <055>    1-Sep-88
...
MACSYM  UNV    69  <055>    1-Sep-88
MACTEN  UNV    30  <055>    1-Sep-88
MONSYM  UNV   273  <055>    1-Sep-88
...
UUOSYM  UNV   104  <055>    1-Sep-88

By the date, that's not something I added to the system. 

> Remember that Tops-10 and TOPS-20 are entirely separate operating systems WHICH
> SHARE NO CODE WHATSOEVER.  You wouldn't complain about a Windows program that
> didn't understand a Linux system call, would you?
Of course not. I have both systems. TOPS-10 wants UUOSYM and MACSYM (for
STDAC.). UUOSYM alone won't get STDAC. .

> The fact that you are posting to alt.lang.asm leads to the conclusion that you
> are doing that.  You should have included that newsgroup on your response to
> my Phillipic so that your readers there could see the results.
I initially included alt.lang.asm because I thought a fizz buzz
challenge might get some other people to post. There's but two people
lately, and the majority of posting is me. Likely most people there
don't have a PDP-10 system or possibly even care much about it. Indeed,
most solutions I've seen for fizz buzz in assembly are x86. The other
guy that posts on alt.lang.asm is using x86 MS-DOS era code.

Until the next question(s), thank you.

-- 
PGP Key ID: 781C A3E2 C6ED 70A6 B356  7AF5 B510 542E D460 5CAE
       "The Internet should always be the Wild West!"

[toc] | [prev] | [next] | [standalone]


#9950 — Accumulator naming

FromRich Alderson <news@alderson.users.panix.com>
Date2026-07-29 18:10 -0400
SubjectAccumulator naming
Message-ID<mddqzklxxa5.fsf_-_@panix5.panix.com>
In reply to#9947
jayjwa <jayjwa@atr2.ath.cx.invalid> writes:

> Rich Alderson <news@alderson.users.panix.com> writes:

>> TDNE is a hardware instruction.

> Noted. It would be easier to see their usage if the accumulators had names
> that didn't exactly resemble numbers ( for example: rax, rbx, rcx, etc)
> instead of 1, 2, 3, etc. I had misunderstood what that instuction operated
> on.

So this has been percolating for a few days.  I finally went off and found a
book on X86/X64 assembly language programming to be certain, because I haven't
looked at the 8080/Z80 architecture in a very very long time.

To begin with, the accumulators in the PDP-6 and the first model of the PDP-10
(the KA-10 processor) were an add-on feature.  If they were not present in the
system, the first 16(10) locations in memory were used in any instruction that
required an accumulator.  When they *are* present, they are treated as part of
the program memory (mapped to locations 0-17(8)) and function the same way.

Why shouldn't they then be referred to by numeric addresses just like the rest
of memory?

Secondly, unlike the named registers in the X86/X64 architecture, there are no
special case uses in the hardware for any accumulator.  As I noted elsewhere,
in older Tops-10 programs, the standard stack pointer is AC 1, including in the
monitor; TENEX and therefore TOPS-20 declared the standard to be AC 17.  Any AC
can be used for any purpose as long as the operating environment is programmed
to expect the assignments used.

Contrast the X86/X64, where the multiplication operation *requires* that the
multiplier be present in REAX, rather than in whichever register might be
convenient to the programmer.

The only accumulator that is special to the hardware is AC 0, which cannot be
used as an index.  This is clearly to be expected because 0000(2) in the index
field of the instruction is the signal to the hardware that no index is in use.
This restricts the programmer to only 15 possible index registers, which is
probably enough for anyone's purposes.  IMAO.

-- 
Rich Alderson					  news@alderson.users.panix.com
      Audendum est, et veritas investiganda; quam etiamsi non assequamur,
	  omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
									--Galen

[toc] | [prev] | [next] | [standalone]


#9951 — Re: Accumulator naming

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-07-30 15:14 +0000
SubjectRe: Accumulator naming
Message-ID<yTJaS.915$bZ8b.769@fx01.iad>
In reply to#9950
Rich Alderson <news@alderson.users.panix.com> writes:
>jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
>
>> Rich Alderson <news@alderson.users.panix.com> writes:
>
>>> TDNE is a hardware instruction.
>
>> Noted. It would be easier to see their usage if the accumulators had names
>> that didn't exactly resemble numbers ( for example: rax, rbx, rcx, etc)
>> instead of 1, 2, 3, etc. I had misunderstood what that instuction operated
>> on.
>
>So this has been percolating for a few days.  I finally went off and found a
>book on X86/X64 assembly language programming to be certain, because I haven't
>looked at the 8080/Z80 architecture in a very very long time.

The 8080 architecture has been obsolete for quite some time;  if you're
looking for architectures contemporaneous with the PDP-6/10/DS20, perhaps
the Burroughs medium systems would be a better comparison.

The B3500 (BCD, variable length operands) also reserved various addresses
in the first page (1000 digits) of the program address space for various
purposes, including three 8-digit index registers (offsets 8, 16 and 24).

To support variable length operands, the length fields in the instruction
could be marked as indirect lengths, which would also map to the
low order digits of memory (two-digit lengths were supported) - overlapping
the index registers (addresses 00 through 39 could be used as indirect
field lengths - typically only addresses zero through eight were used
to avoid conflicts with the index registers.  Various other fields in
the first 100 digits were used by other instructions (e.g. the EDT
(COBOL PIC Clause Edit) instruction insertion characters (such
as the currency symbol and the blanking character) were also
stored in the first 100 digits of the program address space.  The
stack pointer was at address 40.

Modern microprocessor architectures don't generally used reserved
memory addresses as registers.  (exceptions for things like the intel
IOAPIC which lives at an architecturally reserved non-zero address on x86).

[toc] | [prev] | [next] | [standalone]


#9954 — Re: old architectures, was Accumulator naming

FromJohn Levine <johnl@taugh.com>
Date2026-07-30 20:40 +0000
SubjectRe: old architectures, was Accumulator naming
Message-ID<114gcrj$19ct$1@gal.iecc.com>
In reply to#9951
According to Scott Lurndal <slp53@pacbell.net>:
>The 8080 architecture has been obsolete for quite some time;  if you're
>looking for architectures contemporaneous with the PDP-6/10/DS20, perhaps
>the Burroughs medium systems would be a better comparison.

A reasonable choice but I think the Univac 1100 and GE 635 are better peers,
being late 36 bit word addressed architectures sort of resembling the IBM 709x,
and also S/360 which is the only peer I know with 16 uniform registers.

The 635 was single accumulator with 7 index registers like the 7094.  It had very
complicated addressing modes you can read about on Wikipedia.

The Unvac 1100 had 15 index registers and 16 accumulators mapped into low memory
sort of like the -6, except for some reason the index regs were octal 001 to 017
while accumulators were 014 to 033, with ac's 0 to 3 aliased to index 12 to 15.

S/360 had (still has in zSeries) 16 registers of which all but R0 can be used as index
or base registers.  Unlike the -6 or 1100, the registers are separate from memory.  It
has LM and STM instructions to load or store a range of registers, usually used in
function call prolog and epilog.

But anyway, there's nothing odd about registers having numbers.  The x86 scheme where
each register is named and special is quite peculiar but we're used to it because x86
has become so popular.
-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

[toc] | [prev] | [next] | [standalone]


#9955 — Re: Accumulator naming

FromRich Alderson <news@alderson.users.panix.com>
Date2026-07-30 18:41 -0400
SubjectRe: Accumulator naming
Message-ID<mddy0esje1q.fsf@panix5.panix.com>
In reply to#9951
scott@slp53.sl.home (Scott Lurndal) writes:

> Rich Alderson <news@alderson.users.panix.com> writes:

>> jayjwa <jayjwa@atr2.ath.cx.invalid> writes:

>>>  Rich Alderson <news@alderson.users.panix.com> writes:

>>>>  TDNE is a hardware instruction.

>>> Noted. It would be easier to see their usage if the accumulators had names
>>> that didn't exactly resemble numbers ( for example: rax, rbx, rcx, etc)
                                                        ^^^^^^^^^^^^^
>>> instead of 1, 2, 3, etc. I had misunderstood what that instuction operated
>>> on.

>> So this has been percolating for a few days.  I finally went off and found a
>> book on X86/X64 assembly language programming to be certain, because I
>> haven't looked at the 8080/Z80 architecture in a very very long time.

> The 8080 architecture has been obsolete for quite some time;  if you're
> looking for architectures contemporaneous with the PDP-6/10/DS20, perhaps
> the Burroughs medium systems would be a better comparison.

No, Scott, I wasn't looking for contemporaries of the PDP-6, I was speaking to
a programmer who is familiar with the Intel-originated family of microprocessors 
who is teaching himself PDP-10 assembler language programming, and who brought
up the naming convention for Intel etc. processor registers.

-- 
Rich Alderson					  news@alderson.users.panix.com
      Audendum est, et veritas investiganda; quam etiamsi non assequamur,
	  omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
									--Galen

[toc] | [prev] | [next] | [standalone]


#9952 — Re: Accumulator naming

Fromjayjwa <jayjwa@atr2.ath.cx.invalid>
Date2026-07-30 11:24 -0400
SubjectRe: Accumulator naming
Message-ID<87zez8pkku.fsf@atr2.ath.cx>
In reply to#9950
Rich Alderson <news@alderson.users.panix.com> writes:

> Why shouldn't they then be referred to by numeric addresses just like
> the rest of memory?
It's confusing to new students and looks weird. Consider:

        PRINT   (MESS)
        move    1, save                         ; Setting up RDTTY%
        movei   2, 10                           ; for 8 chars
        setz    3,                              ; No reprompter ctrl-r
        rdtty%

2,10? There's integers on both sides of the comma. And the SETZ
instruction looks like someone forgot to type part of the
line. Probably, if you've looked at it for 30+ years it makes sense, and
I am getting used to it by now, but it's the only CPU architecture I
could find going forward that does this.

https://en.wikipedia.org/wiki/PDP-11_architecture  (PDP-11)
https://cybersandeep.gitbook.io/arm64basicguide/chapter-2-understanding-arm64-registers  (ARM64)
https://www.ece.lsu.edu/ee4720/doc/vax-11780-arch-handbook.pdf  (VAX)
(page 3-4 in the PDF itself, not your reader)
https://math.hws.edu/eck/cs220/f22/registers.html  (x86-64)
https://en.wikipedia.org/wiki/MOS_Technology_6502#Registers  (6502)
https://en.wikibooks.org/wiki/68000_Assembly/Registers  (68000)

It's easier, at least for me, to make a "mental map" of where things are
when they have names rather than numbers, even if those names are
short. It's easier to recall "watermellon", "apple", "grape" than 39,
23, 5 even though both sets are decending in magnitude. We can assign
names, but see my next reply...

> Secondly, unlike the named registers in the X86/X64 architecture,
> there are no special case uses in the hardware for any accumulator.
I'm not sure if this is bad or good, but it's a bit like driving in the
city with no road markings. I've been using STDAC. since I found out
about it, and its mere presence indicates there was a need for it, but
people often do as follows (code from an ITS program):

A=1
B=2
T=10
TT=11
Q=16
P=17
...

LITES0: MOVE Q,PC
        POP P,A
        JSP Q,(Q)                       ;Coroutine call.
        MOVEM Q,PC
        DATAO PI,A                      ;Display A on memory indicators.
        SOS TICK
        POPJ P,

That is, assign accums as they see fit.

-- 
PGP Key ID: 781C A3E2 C6ED 70A6 B356  7AF5 B510 542E D460 5CAE
       "The Internet should always be the Wild West!"

[toc] | [prev] | [next] | [standalone]


#9953 — Re: Accumulator naming

Fromscott@slp53.sl.home (Scott Lurndal)
Date2026-07-30 16:03 +0000
SubjectRe: Accumulator naming
Message-ID<8BKaS.4520$UDa8.2634@fx41.iad>
In reply to#9952
jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
>Rich Alderson <news@alderson.users.panix.com> writes:
>
>> Why shouldn't they then be referred to by numeric addresses just like
>> the rest of memory?
>It's confusing to new students and looks weird. Consider:
>
>        PRINT   (MESS)
>        move    1, save                         ; Setting up RDTTY%
>        movei   2, 10                           ; for 8 chars
>        setz    3,                              ; No reprompter ctrl-r
>        rdtty%
>
>2,10? There's integers on both sides of the comma. And the SETZ
>instruction looks like someone forgot to type part of the
>line. Probably, if you've looked at it for 30+ years it makes sense, and
>I am getting used to it by now, but it's the only CPU architecture I
>could find going forward that does this.

1964's B3500:

   MVN (0120) 000001, 000010

Move (numeric) one digit from address 1 to a twenty digit field at address 10
filling with leading zeros.

A common paradigm in the 60s (and earlier machines such as the electrodata 220
and Burroughs 300).

[toc] | [prev] | [next] | [standalone]


#9956 — Re: Accumulator naming

FromRich Alderson <news@alderson.users.panix.com>
Date2026-07-30 18:56 -0400
SubjectRe: Accumulator naming
Message-ID<mddv79wjdc8.fsf@panix5.panix.com>
In reply to#9952
jayjwa <jayjwa@atr2.ath.cx.invalid> writes:

> Rich Alderson <news@alderson.users.panix.com> writes:

>> Why shouldn't they then be referred to by numeric addresses just like
>> the rest of memory?

> It's confusing to new students and looks weird. Consider:

>         PRINT   (MESS)
>         move    1, save                         ; Setting up RDTTY%
>         movei   2, 10                           ; for 8 chars
>         setz    3,                              ; No reprompter ctrl-r
>         rdtty%

> 2,10? There's integers on both sides of the comma. And the SETZ
> instruction looks like someone forgot to type part of the
> line. Probably, if you've looked at it for 30+ years it makes sense, and
> I am getting used to it by now, but it's the only CPU architecture I
> could find going forward that does this.

The IBM System/360 was my first assembler language experience, where as noted
elsewhere in this thread the general registers are numbered 0 to F (I learned
hexadecimal before I learned octal), but are not mapped to memory.[1]  The
floating point registers are number 0, 2, 4, 6, and IIRC 8, but I'm not going
to go look that up right now.

So your experience is actually quite limited.

> https://en.wikipedia.org/wiki/PDP-11_architecture  (PDP-11)
> https://cybersandeep.gitbook.io/arm64basicguide/chapter-2-understanding-arm64-registers  (ARM64)
> https://www.ece.lsu.edu/ee4720/doc/vax-11780-arch-handbook.pdf  (VAX)
> (page 3-4 in the PDF itself, not your reader)
> https://math.hws.edu/eck/cs220/f22/registers.html  (x86-64)
> https://en.wikipedia.org/wiki/MOS_Technology_6502#Registers  (6502)
> https://en.wikibooks.org/wiki/68000_Assembly/Registers  (68000)

All much newer architectures than real iron. ;-)

> It's easier, at least for me, to make a "mental map" of where things are
> when they have names rather than numbers, even if those names are
> short. It's easier to recall "watermellon", "apple", "grape" than 39,
> 23, 5 even though both sets are decending in magnitude. We can assign
> names, but see my next reply...

>> Secondly, unlike the named registers in the X86/X64 architecture,
>> there are no special case uses in the hardware for any accumulator.

> I'm not sure if this is bad or good, but it's a bit like driving in the
> city with no road markings. I've been using STDAC. since I found out
> about it, and its mere presence indicates there was a need for it, but
> people often do as follows (code from an ITS program):

> A=1
> B=2
> T=10
> TT=11
> Q=16
> P=17
> ...

> LITES0: MOVE Q,PC
>         POP P,A
>         JSP Q,(Q)                       ;Coroutine call.
>         MOVEM Q,PC
>         DATAO PI,A                      ;Display A on memory indicators.
>         SOS TICK
>         POPJ P,

> That is, assign accums as they see fit.

The reason for STDAC. is precisely so that programmers do not have to learn
each other's coding preferences, but early on we were in the Wild West.

For example, in the source for Macro-10, we find the following:

AC0==   0
AC1=    AC0+1
AC2=    AC1+1
SDEL=   3                       ;SEARCH INCREMENT
SX=     SDEL+1                  ;SEARCH INDEX
ARG=    5                       ;ARGUMENT
V=      6                       ;VALUE
C=      7                       ;CURRENT CHARACTER
CS=     C+1                     ;CHARACTER STATUS BITS
RC=     11                      ;RELOCATION BITS
MWP=    12                      ;MACRO WRITE POINTER
MRP=    13                      ;MACRO READ POINTER
IO=     14                      ;IO REGISTER (LEFT)
ER==    IO                      ;ERROR REGISTER (RIGHT)
FR=     15                      ;FLAG REGISTER (LEFT)
FRR==   FR                      ;[613] MOVE FLAGS (RIGHT)
MP=     16                      ;MACRO PUSHDOWN POINTER
P=      17                      ;BASIC PUSHDOWN POINTER

In real life, I currently am working on a new release of Macro-20; in order to
do that, I had to drop all expectations for which ACs would be used to do what
(since it began as a PDP-10/Tops-10 program).

With great freedom comes great responsibility, and all that...  

[1] In 360 assembler, they are written in decimal, so 0 to 15.

-- 
Rich Alderson					  news@alderson.users.panix.com
      Audendum est, et veritas investiganda; quam etiamsi non assequamur,
	  omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
									--Galen

[toc] | [prev] | [next] | [standalone]


#9957 — Re: Accumulator naming

Fromcross@spitfire.i.gajendra.net (Dan Cross)
Date2026-07-30 23:48 +0000
SubjectRe: Accumulator naming
Message-ID<114gnt0$pds$1@reader1.panix.com>
In reply to#9956
In article <mddv79wjdc8.fsf@panix5.panix.com>,
Rich Alderson  <news@alderson.users.panix.com> wrote:
>[snip]
>MP=     16                      ;MACRO PUSHDOWN POINTER
>P=      17                      ;BASIC PUSHDOWN POINTER

Just a meta note, not a comment on register naming conventions,
but I the "pushdown" terminology interesting here.  Was this
common then?  When did it become common to call it a "stack" as
we'd typically do these days?

	- Dan C.

[toc] | [prev] | [next] | [standalone]


#9958 — Re: Accumulator naming

FromJohn Levine <johnl@taugh.com>
Date2026-07-31 01:31 +0000
SubjectRe: Accumulator naming
Message-ID<114gtt5$ul5$1@gal.iecc.com>
In reply to#9957
According to Dan Cross <cross@spitfire.i.gajendra.net>:
>In article <mddv79wjdc8.fsf@panix5.panix.com>,
>Rich Alderson  <news@alderson.users.panix.com> wrote:
>>[snip]
>>MP=     16                      ;MACRO PUSHDOWN POINTER
>>P=      17                      ;BASIC PUSHDOWN POINTER
>
>Just a meta note, not a comment on register naming conventions,
>but I the "pushdown" terminology interesting here.  Was this
>common then?  When did it become common to call it a "stack" as
>we'd typically do these days?

It was and is a pushdown stack. The analogy is the stack of dishes in
a cafeteria on a spring loaded tray. As you put more dishes on it the
stack pushed down the spring so there were always just a few visible
on the top, and as you took dishes off, they popped back up.

Here's some pictures of one:

https://www.katom.com/121-401125.html

This was well known when I was in school in the late 1960s and 1970s.
-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

[toc] | [prev] | [next] | [standalone]


#9959 — Re: Accumulator naming

Fromcross@spitfire.i.gajendra.net (Dan Cross)
Date2026-07-31 02:52 +0000
SubjectRe: Accumulator naming
Message-ID<114h2ll$bf6$1@reader1.panix.com>
In reply to#9958
In article <114gtt5$ul5$1@gal.iecc.com>, John Levine  <johnl@taugh.com> wrote:
>According to Dan Cross <cross@spitfire.i.gajendra.net>:
>>In article <mddv79wjdc8.fsf@panix5.panix.com>,
>>Rich Alderson  <news@alderson.users.panix.com> wrote:
>>>[snip]
>>>MP=     16                      ;MACRO PUSHDOWN POINTER
>>>P=      17                      ;BASIC PUSHDOWN POINTER
>>
>>Just a meta note, not a comment on register naming conventions,
>>but I the "pushdown" terminology interesting here.  Was this
>>common then?  When did it become common to call it a "stack" as
>>we'd typically do these days?
>
>It was and is a pushdown stack. The analogy is the stack of dishes in
>a cafeteria on a spring loaded tray. As you put more dishes on it the
>stack pushed down the spring so there were always just a few visible
>on the top, and as you took dishes off, they popped back up.
>
>Here's some pictures of one:
>
>https://www.katom.com/121-401125.html
>
>This was well known when I was in school in the late 1960s and 1970s.

No, I understand that it is a pushdown stack, and I'm familiar
with the dishes analogy (my school cafeterias had similar
contraptions 20 years after yours and I've heard it in this
context before).

My question was specifically about the nomenclature: in the
above examples, the register alias is simply called "P" for
"pushdown", omitting the "stack" part; modern terminology
usually (always?) omits the "pushdown" part and simply calls it
a "stack".  For example, assemblers for many ISAs will
conventionally label a general purpose register the "SP", for
stack pointer (regardless of whether such a register is used
that way by hardware, or simply by software convention).

My question was whether the former convention was common at the
time, and if so, when did it change?

	- Dan C.

[toc] | [prev] | [next] | [standalone]


#9960 — Re: Accumulator naming

FromJohn Levine <johnl@taugh.com>
Date2026-07-31 03:36 +0000
SubjectRe: Accumulator naming
Message-ID<114h57f$25o4$1@gal.iecc.com>
In reply to#9959
According to Dan Cross <cross@spitfire.i.gajendra.net>:
>>It was and is a pushdown stack. ...

>My question was whether the former convention was common at the
>time, and if so, when did it change?

It was close to 60 years ago but my recollection is that we used
the term pushdown, viz. the instructions PUSH and POP and PUSHJ and POPJ.

I couldn't tell you when people switched to stack, but I'd expect it
was different groups at different times.

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

[toc] | [prev] | [next] | [standalone]


#9962 — Re: Accumulator naming

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2026-07-31 13:40 +0000
SubjectRe: Accumulator naming
Message-ID<7wzez7i8fp.fsf@junk.nocrew.org>
In reply to#9959
Dan Cross writes:
> My question was specifically about the nomenclature: in the
> above examples, the register alias is simply called "P" for
> "pushdown", omitting the "stack" part

I associate this with "pushdown list", or "PDL" for short.  This may
possibly be an MIT-ism, but a quick search seems to turn up examples
from DEC manuals.

[toc] | [prev] | [next] | [standalone]


#9961 — Re: Accumulator naming

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2026-07-31 13:35 +0000
SubjectRe: Accumulator naming
Message-ID<7w4ihfjn7v.fsf@junk.nocrew.org>
In reply to#9952
jayjwa wrote:
> often do as follows (code from an ITS program):
>
> A=1
> B=2
> T=10
> TT=11
> Q=16
> P=17

This is my ITS program written recently, so don't put too my stock in
it.  But in my experience this is a common idiom at both MIT and SAIL.
The first few accumulators are named A, B, C, D, etc.  There are often
one or two consecutive temporaries T and TT.  The push-down list pointer
is often called P and is often 17.

The TENEX monitor, on the other hand, mostly uses the numeric accumulator
address.

[toc] | [prev] | [next] | [standalone]


#9997 — the Ten Heavenly Stems (was Re: Accumulator naming)

FromKragen Javier Sitaker <kragen@canonical.org>
Date2026-09-11 16:07 -0300
Subjectthe Ten Heavenly Stems (was Re: Accumulator naming)
Message-ID<87ik4bbo96.fsf_-_@debian>
In reply to#9952
(People reading this may find it sufficiently off the wall as to wonder
if an LLM wrote it, but I assure you that I wrote it entirely with my
organic brain, and Emacs, looking stuff up with Firefox.  I write the em
dashes with the Compose key.)

jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
> It's easier, at least for me, to make a “mental map” of where things are
> when they have names rather than numbers, even if those names are
> short. It's easier to recall “watermellon”, “apple”, “grape” than 39,
> 23, 5 even though both sets are decending in magnitude.  [...]

In English, Hebrew, Greek, etc., the obvious alternative to numbers is
to use letters of the alphabet: register A, register B, register C, etc.
In Chinese, of course, there is no alphabet, but, as I understand it (my
Chinese is mostly limited to reading datasheets), the Ten Heavenly Stems
<https://en.wikipedia.org/wiki/Heavenly_Stems> and Twelve Earthly
Branches <https://en.wikipedia.org/wiki/Earthly_Branches> are used in
much the same way.  This may not be adequate for a processor with many
architectural registers like RISC-V’s 32 (or 31) or MMIX’s 256, but it’s
close enough.

The Ten Heavenly Stems have mostly lost their original meanings over the
last 3000 years and been relegated to mostly only this use.  I have
listed them here with their origins; where they have other current uses,
I have put them in parentheses:

1. 甲 turtle shell (methyl, “armor”)
2. 乙 fish guts (ethyl, “twist”)
3. 丙 fish tail
4. 丁 nail
5. 戊 halberd (Firefox’s translation neural network translates it as “E”)
6. 己 thread on a loom (“self”)
7. 庚 evening star (“age”)
8. 辛 to offend superiors (“spicy”)
9. 壬 burden
10. 癸 four-handled plow

I am amused at the idea of moving a 36-bit quantity from register
Eveningstar to register Fishtail, but I think that might be a bit of a
hard sell.  Of course, in Chinese, the names are just one syllable.

The Twelve Earthly Branches are used, among other things, for two-hour
periods of the day, and they have a conventional correspondence with the
Chinese 12-year zodiac symbols, which I have placed in square brackets.
They were used to name the days of a 12-day week 3000 years ago.  The
zodiac symbols are not the meanings of the characters, which, as with
the Heavenly Stems, have largely lost their meaning over the last few
millennia.

1. 子 child [rat]
2. 丑 ugly, clown [ox]
3. 寅 [tiger]
4. 卯 [rabbit]
5. 辰 day [dragon]
6. 巳 [snake]
7. 午 noon [horse]
8. 未 not yet [goat]
9. 申 to state or explain [monkey]
10. 酉 unitary [rooster]
11. 戌 army [dog]
12. 亥 [pig]

The zodiac symbols seem like they would greatly improve the memorability
of one’s assembly code and calling conventions — it would be much easier
to learn that the stack pointer was the Pig register and the link
register was the Dragon register than to learn which one was r14 and
which one was r15.

Kragen

[toc] | [prev] | [next] | [standalone]


#9998 — Re: the Ten Heavenly Stems (was Re: Accumulator naming)

FromJohann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid>
Date2026-09-14 01:12 +0800
SubjectRe: the Ten Heavenly Stems (was Re: Accumulator naming)
Message-ID<kQApS.136451$3r3.111796@fx13.ams4>
In reply to#9997
On 12/09/2026 3:07 AM, Kragen Javier Sitaker wrote:
> (People reading this may find it sufficiently off the wall as to wonder
> if an LLM wrote it, but I assure you that I wrote it entirely with my
> organic brain, and Emacs, looking stuff up with Firefox.  I write the em
> dashes with the Compose key.)
> 
> jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
>> It's easier, at least for me, to make a “mental map” of where things are
>> when they have names rather than numbers, even if those names are
>> short. It's easier to recall “watermellon”, “apple”, “grape” than 39,
>> 23, 5 even though both sets are decending in magnitude.  [...]
> 
> In English, Hebrew, Greek, etc., the obvious alternative to numbers is
> to use letters of the alphabet: register A, register B, register C, etc.
> In Chinese, of course, there is no alphabet, but, as I understand it (my
> Chinese is mostly limited to reading datasheets), the Ten Heavenly Stems
> <https://en.wikipedia.org/wiki/Heavenly_Stems> and Twelve Earthly
> Branches <https://en.wikipedia.org/wiki/Earthly_Branches> are used in
> much the same way.  This may not be adequate for a processor with many
> architectural registers like RISC-V’s 32 (or 31) or MMIX’s 256, but it’s
> close enough.
> 
> The Ten Heavenly Stems have mostly lost their original meanings over the
> last 3000 years and been relegated to mostly only this use.  I have
> listed them here with their origins; where they have other current uses,
> I have put them in parentheses:
> 
> 1. 甲 turtle shell (methyl, “armor”)
> 2. 乙 fish guts (ethyl, “twist”)
> 3. 丙 fish tail
> 4. 丁 nail
> 5. 戊 halberd (Firefox’s translation neural network translates it as “E”)
> 6. 己 thread on a loom (“self”)
> 7. 庚 evening star (“age”)
> 8. 辛 to offend superiors (“spicy”)
> 9. 壬 burden
> 10. 癸 four-handled plow
> 
> I am amused at the idea of moving a 36-bit quantity from register
> Eveningstar to register Fishtail, but I think that might be a bit of a
> hard sell.  Of course, in Chinese, the names are just one syllable.
> 
> The Twelve Earthly Branches are used, among other things, for two-hour
> periods of the day, and they have a conventional correspondence with the
> Chinese 12-year zodiac symbols, which I have placed in square brackets.
> They were used to name the days of a 12-day week 3000 years ago.  The
> zodiac symbols are not the meanings of the characters, which, as with
> the Heavenly Stems, have largely lost their meaning over the last few
> millennia.
> 
> 1. 子 child [rat]
> 2. 丑 ugly, clown [ox]
> 3. 寅 [tiger]
> 4. 卯 [rabbit]
> 5. 辰 day [dragon]
> 6. 巳 [snake]
> 7. 午 noon [horse]
> 8. 未 not yet [goat]
> 9. 申 to state or explain [monkey]
> 10. 酉 unitary [rooster]
> 11. 戌 army [dog]
> 12. 亥 [pig]
> 
> The zodiac symbols seem like they would greatly improve the memorability
> of one’s assembly code and calling conventions — it would be much easier
> to learn that the stack pointer was the Pig register and the link
> register was the Dragon register than to learn which one was r14 and
> which one was r15.
> 
> Kragen

You can add to this list a few hieroglyphs.  There are a little over se-
ven hundred in the standard /middle egyptian/ and you can see most of
them at the back of Gardiner's book.  Well, probably all of them in the
most recent edition.

They started to get inventive in the new kingdom, and I never learned
any of those.

My hieroglyphs are currently too rusty to suggest any specific one for a
register, but you'll be amused to know the characters stand on /reg-
isters/ in hieroglyphic artwork.  By that I mean the pictures of the
gods and pharaohs.

After some two hundred years, Egyptologists are still arguing about what
some of the ideograms are, and I suspect some of these academic flame
wars are still on-going.

I've added alt.history.ancient-egypt to this discussion.


Happy original research, and participations in ancient academic flame
wars!
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | alt.sys.pdp10


csiph-web