Category : Assembly Language Source Code
Archive   : ASPIC.ZIP
Filename : CLOPS.ASM

 
Output of file : CLOPS.ASM contained in archive : ASPIC.ZIP
***************************************************************
* COMMAND LINE OPTION DEMONSTRATON *
***************************************************************
* Command line args are put into parms clop_? where ? is a *
* single character option specified on the command line (-?). *
* *
* L,S,X,I, and @ are reserved for use by the assembler *
* (They also define the appropriate variable (eg. clop_l) *
*= Examples ==================================================*
* Command line Variable Value Environment *
* -r clop_r 1 *
* -r=4 clop_r 4 *
* -r=$400/2 clop_r 512 *
* -r=3*X *error (X not defined at start of compile) *
* -r:3*X clop_r -1 CLOP_R=3*X *
*=============================================================*
* try these options: : Will result in: *
* ASPIC CLOPS.ASM -r=100 - RATE = 100 *
* ASPIC CLOPS.ASM - RATE = 127 (default) *
* ASPIC CLOPS.ASM -r=2*X/3 - RATE = 84 (2/3 * 127) *
* : *
***************************************************************

X = 127 ;RATE CONSTANT
x = 127 ;(so upper or lower-case works)
DEFAULT_RATE = X ;Default value for -r option

***************************************************************
* FUNCTION TO CONVERT BINARY VALUE TO BCD *
* Usage: *
* (Label) = BCD(expression) *
***************************************************************
BCD( .MACRO *n) ;convert value to BCD
(n%10000/1000*$1000+(n%1000/100*$100)+(n%100/10*$10)+(n%10))
.ENDM

***************************************************************
* MACRO TO PRINT A MESSAGE AND A VALUE *
* Usage: *
* ECHODV Message,value ;(decimal value) *
* ECHOV Message,value ;(HEX value) *
* ECHO$V Message,(value) ;is used by both *
***************************************************************

ECHO$V .MACRO *[1],[2] ;print [1] [2]
.IF '[2.1.1]'==':' ;If forward reference, strip ':$'
.MXP ON ;Put expanded line into listing
.ECHO [1] [2.2]
.MXP OFF
.ELSE ;No forward reference... strip '$'
.MXP ON ;Put expanded line into listing
.ECHO [1] [2.1]
.MXP OFF
.ENDIF
.ENDM

ECHOV .MACRO *name,value ;Print name and value (HEX)
ECHO$V name,(value) ;Convert value to HEX
.ENDM

ECHODV .MACRO *name,value ;Print name and value (DECIMAL)
ECHO$V name,(BCD(value)) ;Convert value to HEX of BCD
.ENDM

***************************************************************
* Check command line parms *
* -T .......... Test mode *
* -R= ... Specify RATE *
* -R: ... Specify RATE as an expression (n*X) *
***************************************************************
.IF clop_t ;Defined if -t option provided
TEST = 1
.ECHO Test Mode
.ELSE
TEST = 0
.ENDIF

.IF ISDEF(clop_r) ;See if -r option specified
.IF clop_r=-1 ;defined in environment (via r:)
RATE = ENV(CLOP_R) ;Evaluate from environment
.ELSE
RATE = clop_r ;Set rate specified on command line
.ENDIF
.ELSE
RATE = DEFAULT_RATE ;Use default
.ENDIF

ECHODV Rate is set to,(RATE)
.END

.IF clop_x ;show that we know about assembler options too
.ECHO X-REF is ON
.ENDIF


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASPIC.ZIP
Filename : CLOPS.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/