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


Groups > alt.sys.pdp10 > #9968

Re: Command line parsing and MACRO-20

From jayjwa <jayjwa@atr2.ath.cx.invalid>
Newsgroups alt.sys.pdp10
Subject Re: Command line parsing and MACRO-20
Date 2026-08-29 12:37 -0400
Organization atr2net 2026
Message-ID <87cxv0hohr.fsf@atr2.ath.cx> (permalink)
References <87fqzyjexe.fsf@atr2.ath.cx> <mdd33vxaghq.fsf@panix5.panix.com>

Show all headers | View raw


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

> Besides the RSCAN% and COMND% JSYi, you also need to take a look at PRARG%,
> which is how programs pass commands and data down a chain (as in the COMPILE,
> LOAD, DEBUG, and EXECUTE commands).

I'll look at PRARG% in the future. RSCAN% is what I needed for the time
being. There's someone doing some exercises in x86 asm (under MS-DOS) in
one of the other groups and those programs access the command
line. Hence my need of accessing the command line if I am to attempt
those programs in MACRO-20.

>     The prologue that we have just been through is representative of the
>     complexity of the COMND JSYS itself; [MCRM] takes more than twenty
>     pages
!!!

>> @echo hello
>> hello
>
> The text of the ECHO command in EXEC.EXE reads
>
>     ;ECHO ...LINE TO BE ECHOED BACK...
>     .ECHO:: NOISE (TO THE TERMINAL)
>             LINEX <Text to be echoed>
>              CMERRX			;ERROR
>             CONFIRM
>             HRROI A,ATMBUF		;GET BUFFER POINTER BACK
>             ETYPE <%1M%%>
>             RET
>
> but that's a bunch of hairy macros, isn't it?

Yes, and if they don't work it leaves a novice debugging expert's code
with no idea what's going wrong. This happened in the Longo text with
the Chapter 11 macros for interrupt handling. 2/3 of the examples won't
assemble. Why? I don't know. It could be a difference in TOPS-20
versions, MACRO-20 versions, a printing error, a user copy error, a case
error (it's case-insensitive until it's not) or really anything. Here's
the last program (ex 5) without relying on those macros.

comment $
Write a program that will display the duration of an event. The event will
start when the user presses a key, which should cause a keyboard interrupt
that accesses TIME% . Store the value that is returned in ac 1. Stop
the event when the user presses any key. This difference in the values
of TIME% is the number of milliseconds between keystrokes. 
$
        title	chbu5
	search	monsym, macsym
        lall					; Expand macros
        STDAC.					; Label accums in standard way

define	SPINR	<				; Print a spinner
	movei   t1, .CHCRT
        pbout%
	movei	t1, "|"
	pbout%
	movei	t1, .CHCRT
        pbout%		      
	movei	t1, "/"
        pbout%
        movei   t1, .CHCRT    
        pbout%
        movei	t1, "-"
        pbout%
        movei   t1, .CHCRT    
        pbout%
        movei	t1, "\"
	pbout%
        >
		  
; Channel table as per Monitor Ref Calls manual
chntab:	3,,etimer				; Ch 0, prio 3, routine etimer
	block	chntab+^D36-.			; Fill rest of 36 words

; Table for priority levels
levtab:	0					; No prio 1
	0					; No prio 2
	pc3					; Prio 3
pc3:	0					; PC save point for prio 3
strtim:	0					; Start time of TIMER
endtim:	0					; End time

	subttl	Main
start:	reset
	setzm	strtim				; Zero any last run
	setzm	endtim
        TMSG    (Press any key to begin TIME demo.
)
	move	t1, [.FHSLF]			; Fork, self
	move	t2, [xwd levtab, chntab]	; Set up tables for SIR%
	sir%					; SIR%, you're needed
	eir%					; Enable interrupts
	move	t2, [1B0]			; Turn on chan 0
	aic%					; Activate interrupt chans
	move	t1, [.TICTI,,0]			; Type-in on channel 0
	ati%					; Active it

	pbin%					; Pause to start demo

loop:	SPINR					; Prints a spinner to wait
	jumpa	loop				; Inf loop if not for interp

done:	TMSG	(
Elapsed time in milliseconds: )			; Print heading
	move	t2, endtim			; Calculate run time as
	sub	t2, strtim			; endtim - strtim = MS run
	move	t1, [.priou]			; Ready NOUT%
	movei	t3, 12				; Decimal base
	nout%
	  erjmp	[hrroi t1, [asciz /Error on NOUT%. Exiting/]
		 psout%
		 haltf%]
	haltf%					; Exit to monitor
	jrst	start				; Restart program?

; Elapsed time handler for channel 0, key-in. The first time this is
; called 'strtim' will be zero, indicating to save the begin time. When
; it's not zero, and called again, this indicates to save the end time. 
	subttl	Timer handler
etimer:	move	t1, strtim			; Check if strtim is 0
	skipn	t1		
	  jrst	[time%				; Yes, get start time
		 movem	t1, strtim		; And stash for later
		 jrst	exthdl]			; Exit handler
	time%					; Second time here
	movem	t1, endtim			; Get, save end time

; On the second time here, we need to change the place that we return to.
; This is done by changing the levtab pointer to where the return address
; is stored. 
	movei	t2, done			; Change where we debrk% to
	movem	t2, @levtab+2			; which would be pc3
exthdl:	debrk%					; Return from handler

	lit					; Debugger expands literals
	end	start				; Assembler is done


> You keep wanting TOPS-20 to be Unix.  It isn't.
Not really. I referenced C argc/argv because everyone knows that and I
didn't know how else to get my point across simply and direct. 

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

Back to alt.sys.pdp10 | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Command line parsing and MACRO-20 jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-08-28 14:08 -0400
  Re: Command line parsing and MACRO-20 scott@slp53.sl.home (Scott Lurndal) - 2026-08-28 18:35 +0000
    Re: Command line parsing and MACRO-20 jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-08-29 12:19 -0400
      Re: Command line parsing and MACRO-20 Rich Alderson <news@alderson.users.panix.com> - 2026-08-29 17:51 -0400
  Re: Command line parsing and MACRO-20 Rich Alderson <news@alderson.users.panix.com> - 2026-08-28 20:59 -0400
    Re: Command line parsing and MACRO-20 jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-08-29 12:37 -0400
      Re: Command line parsing and MACRO-20 Rich Alderson <news@alderson.users.panix.com> - 2026-08-29 18:04 -0400
        Re: Command line parsing and MACRO-20 jayjwa <jayjwa@atr2.ath.cx.invalid> - 2026-08-30 11:38 -0400
          Re: Command line parsing and MACRO-20 Rich Alderson <news@alderson.users.panix.com> - 2026-08-30 22:18 -0400

csiph-web