MA     JOB   MODIFY ADDRESS DIAGNOSTICS
       ORG   500
COL1   EQU   230
COL2   EQU   245
COL3   EQU   260
START  CS    332
       CS
       MLCWA @MODIFY ADDRESS DIAGNOSTICS@,250
       W
       CS    299
       W
       MLCWA @--A-FIELD--@,COL1
       MLCWA @--B-FIELD--@,COL2
       MLCWA @--RESULT---@,COL3
       H
       MLC   @999@,ADATA
       MLC   @001@,BDATA
       B     WRT
       MLC   @Z00@,ADATA
       MLC   @099@,BDATA
       B     WRT
       MLC   @001@,ADATA
       MLC   @Z99@,BDATA
       B     WRT
       MLC   @I99@,ADATA
       MLC   @001@,BDATA
       B     WRT
       MLC   @I99@,ADATA
       MLC   @Ø01@,BDATA
       B     WRT
       MLC   @I9I@,ADATA
       MLC   @001@,BDATA
       B     WRT
       MLC   @?01@,ADATA
       MLC   @Ø01@,BDATA
       B     WRT
*
       MLCWA @END OF MA TESTS@,260
       W
       CS    299
       H     *-3
*
* SUBROUTINE TO ADD TWO ADDRESSES AND PRINT THE RESULT
*
WRT    SBR   WRTR+3
       SBR   PLOC,COL1
       MLC   ADATA,ADDR
       B     CADDR
       B     PADDR
       SBR   PLOC,COL2
       MLC   BDATA,ADDR
       B     CADDR
       B     PADDR
       MA    ADATA,ADDR
       SBR   PLOC,COL3
       B     CADDR
       B     PADDR
       W
       CS    299
WRTR   B     0
*
* TEST THE ADDRESS CONVERSION ROUTINE 
*
TESTP  SBR   TESTPR+3
       MLCWA @TEST OF PRINTOUT ROUTINE@,260
       W     
       CS    299
       MLC   @270@,PLOC
       MLC   @001@,ADDR
       B     TWR
       MLC   @999@,ADDR
       B     TWR
       MLC   @Ø00@,ADDR
       B     TWR
       MLC   @J59@,ADDR
       B     TWR
       MLC   @00Ø@,ADDR
       B     TWR
       MLC   @E0E@,ADDR
       B     TWR
       MLC   @/1K@,ADDR
       B     TWR
TESTPR B     0
*
TWR    SBR   TWRR+3
       B     CADDR
       B     PADDR
       W
       CS    299
TWRR   B     0
*
* SUBROUTINE TO MOVE THE ADDRESS AND ITS NUMERIC VALUE TO THE ADDRESS WHICH
* IS STORED IN PLOC
*
PADDR  SBR   PADDRR+3
       NOP   0
PLOC   EQU   *-1
       MLCWA @)@
       MLCWA ADDRD
       MLCWA @ (@
       MLCWA ADDR
PADDRR B     0
*
* SUBROUTINE TO CONVERT THE CONTENTS OF 'ADDR' IN DECIMAL.
* RESULT IS LEFT IN  ADDRD
*
ADDR   DCW   #3
ADDRD  DCW   #5
*
CADDR  SBR   CADDRR+3
       MLNS  ADDR,ADDRD
       MLNS
       MLNS
       MLC   @00@
       BWZ   ZNH,ADDR-2,2
       BWZ   Z12H,ADDR-2,B
       BWZ   Z11H,ADDR-2,K
* MUST BE ZERO ZONE
       A     @1000@,ADDRD
       B     ZNH
Z11H   A     @2000@,ADDRD
       B     ZNH
Z12H   A     @3000@,ADDRD
ZNH    BWZ   ZNU,ADDR,2
       BWZ   Z11U,ADDR,K
       BWZ   Z12U,ADDR,B
* MUST BE 0-ZONE
       A     @4000@,ADDRD
       B     ZNU
Z11U   A     @8000@,ADDRD
       B     ZNU
Z12U   A     @12000@,ADDRD
ZNU    EQU   *
CADDRR B     0
*
ADATA  DCW   #3
BDATA  DCW   #3
       END   START
