From 29587ce73764688fbd166da67a01446008cc85b8 Mon Sep 17 00:00:00 2001 From: Jali Date: Mon, 4 Aug 2025 17:18:39 +0200 Subject: [PATCH] Add JCL (command line parameters) --- src/SUDOKU.MID | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/SUDOKU.MID b/src/SUDOKU.MID index f8ed85c..abe8d24 100644 --- a/src/SUDOKU.MID +++ b/src/SUDOKU.MID @@ -17,13 +17,27 @@ BPTR==440700 ;Define a byte pointer. CHTTYO==1 ;Define a channel for TTY output. CHTTYI==2 ;Define a channel for TTY input. +JCL: BLOCK 30 ;Reserve space for the command line. +BUF: BLOCK 30 ;A buffer to park the string. + START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. + SETZM JCL ;Zero out the JCL + MOVE A,[JCL,,JCL+30] + BLT A,JCL+30 .OPEN CHTTYO,[.UAO,,'TTY] ;Open an output channel on the TTY. .LOSE %LSFIL ;Gobble up any errors. + PUSHJ P,GETJCL ;Read the command line. MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO. - PUSHJ P,PUTLN ;Print the out string. + PUSHJ P,OUTSTR ;Print the out string. + MOVE A,[BPTR,,JCL] ;Read the parameter. + PUSHJ P,PUTLN ;Print the rest of the line. JRST DONE ;Jump to the end of the program. +;Subroutine to read the JCL from DDT and get the command line parameters. +;Clobbers B. +GETJCL: .BREAK 12,[..RJCL,,JCL] ;Get the JCL + MOVE B,[BPTR,,JCL] ;Byte pointer to JCL + PUSHJ P, ;Return from routine. ;Subroutine to print a string of text on the output. ; Clobbers A and B. OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer. @@ -41,5 +55,5 @@ PUTLN: PUSHJ P,OUTSTR ;Calls the OUTSTR subroutine POPJ P, ;before returning. DONE: .LOGOUT 2, ;Exit point for the program. -HELLO: ASCIZ /HELLO WORLD/ ;Define example string. +HELLO: ASCIZ /HELLO / ;Define example string. END START