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

 
Output of file : LOOP.ASM contained in archive : ASPIC.ZIP
***************************************************************
* EXAMPLE OF USING A DO... LOOP STRUCTURE. *
* assemble with AS10 LOOP -n= *
***************************************************************

***************************************************************
* 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

***************************************************************
* Demonstration: Print a series of numbers as specified on *
* the command line. (defaults to 10) *
***************************************************************

.if ISDEF(clop_n) ;check if number specified
TIMES = clop_n ;yes... use that number
.else
TIMES = 10 ;no... default to 10
.endif

.DO TIMES ;print n numbers
ECHO$V Loop #,(.._index)
.LOOP

.echo "Done.",$A ;Just to finish off.



  3 Responses to “Category : Assembly Language Source Code
Archive   : ASPIC.ZIP
Filename : LOOP.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/