

HI-TECH SOFTWARE Z80 Macro Assembler: rzsw.as
                                                                                                                          Page   1


   1    0000'                   	psect	data
   2                            	global	_node_addr, _l2_user_info, _l2_info, Copyright
   3                            	global	_L3CALL,_L3DIGI, _L3PORT, _L3_MAXVC, _L3_WI, _L3DELAY
   4                            	global	_L3CSIZ, _L3NSIZ, _NPAroute, _userport
   5                            	global	 _l2parms, _dl2parms, _l3parms, _dl3parms
   6                            	global	_USER_MAXVC, _USER_L3_W, _DNics, _ndnics
   7                            	global	_sumchk, __Lbssck, mycall, mydigi, myaddr
   8                            
   9    0000'                   initdta:
  10    0000' 0A 31 00 00       myaddr:	defb	10,31h,00h,00h,00h,00h,00h	;node address
        0004' 00 00 00          
  11    0007' 0029'             	defw	_l2_info			;dummies message
  12    0009' 0105'             	defw	l2parms				;l2 user config
  13    000B' 0111'             	defw	l3parms				;l3 link config
  14    000D' 0004              	defw	4				;L3 user pkt window
  15    000F' 0005              	defw	5				;L3 user max vc cnt
  16    0011' 000F              	defw	15				;_L3CSIZ, no L3 users
  17    0013        =           initlen	equ	$-initdta
  18    0013' 04 31 00          defdnic: defb	4,31h,00h			;Default DNIC
  19                            
  20    0016' 43 6F 70 79       Copyright: defm	'Copyright 1988 W2VY'
        001A' 72 69 67 68       
        001E' 74 20 31 39       
        0022' 38 38 20 57       
        0026' 32 56 59          
  21    0029' 0000 0000 0033'   _l2_info: defw	0,0,l2rdta,l2wdta,l2eob
        002F' 006E' 006D'       
  22    0033' 52 4F 53 45       l2rdta:	defm	'ROSE X.25 Switch Version 033089 by Thomas A. Moulton, W2VY'
        0037' 20 58 2E 32       
        003B' 35 20 53 77       
        003F' 69 74 63 68       
        0043' 20 56 65 72       
        0047' 73 69 6F 6E       
        004B' 20 30 33 33       
        004F' 30 38 39 20       
        0053' 62 79 20 54       
        0057' 68 6F 6D 61       
  23    006D' 0D                l2eob:	defb	0dh
  24    006E' 00                l2wdta:	defb	0
  25                            
  26    0007        =           AXALEN	equ	7
  27    0001        =           nnodes	equ	1	;1 nodes in default config
  28    0000        =           nusers	equ	0	; No Level 3 users in default config
  29    0018        =           maxl3	equ	24	; My Calls + 15 Node Paths + 8 Users
  30                            
  31                            	GLOBAL	_maxl3dev
  32    006F' 0018              _maxl3dev: defw	maxl3	;Tell rest of world how big it is
  33                            
  34    0071' A4 9E A6 8A       mycall:	defb	0a4h,9eh,0a6h,08ah,040h,40h,06h	;ROSE-3
        0075' 40 40 06          
  35    0078' A4 9E A6 8A       mydigi:	defb	0a4h,9eh,0a6h,08ah,040h,40h,04h	;ROSE-2
        007C' 40 40 04          
  36    007F' 00                myport:	defb	0
  37    0080' 0000              mydelay: defw	0		;900 =15 Mins before retry network link
  38    0082' 14                myvc:	defb	20		;network links can have 20 vc's default


HI-TECH SOFTWARE Z80 Macro Assembler: rzsw.as
                                                                                                                          Page   2


  39    0083' 04                mywi:	defb	4		;default window of 4
  40                            
  41    0084' 0318 0104' 0103'  initab:	defw	FLAG2-BSSCK-1,BSSCK+1,BSSCK	;Length, Dest, Src
  42    008A' 0013 011D' 0000'  	defw	initlen,initbss,initdta
  43    0090' 0007 0130' 0071'  	defw	7*nnodes,_L3CALL,mycall
  44    0096' 0007 01D8' 0078'  	defw	7*nnodes,_L3DIGI,mydigi
  45    009C' 0001 0280' 007F'  	defw	nnodes,_L3PORT,myport
  46    00A2' 0001 02E0' 0082'  	defw	nnodes,_L3_MAXVC,myvc
  47    00A8' 0001 02B0' 0083'  	defw	nnodes,_L3_WI,mywi
  48    00AE' 0002 02F8' 0080'  	defw	nnodes*2,_L3DELAY,mydelay
  49    00B4' 000C 0105' 0000*  	defw	12,l2parms,_dl2parms	;init l2 parms ram table
  50    00BA' 000C 0111' 0000*  	defw	12,l3parms,_dl3parms	;init l3 parms ram table
  51    00C0' 0003 001B' 0013'  initwm:	defw	3,_DNics,defdnic	;Default DNIC (3100)
  52    00C6' 0000              	defw	0
  53                            
  54    0000'                   	psect	text
  55                            	global	__init
  56    0000'                   __init:
  57    0000' 3A 0104'          	ld	a,(FLAG1)	;check flags
  58    0003' FE AA             	cp	0aah
  59    0005' 20 1C             	jp	nz,1f
  60    0007' 3A 041C'          	ld	a,(FLAG2)
  61    000A' FE AA             	cp	0aah
  62    000C' 20 15             	jp	nz,1f
  63    000E' CD 0050'          	call	sumchk		;compute the checksum (xor of bytes)
  64    0011' 47                	ld	b,a
  65    0012' 3A 0103'          	ld	a,(BSSCK)
  66    0015' B8                	cp	b
  67    0016' 20 0B             	jp	nz,1f
  68    0018' 21 0029'          	ld	hl,_l2_info
  69    001B' 22 0124'          	ld	(_l2_user_info),hl	;Only the default message is in rom
  70    001E' 21 00C0'          	ld	hl,initwm		;Warm Start init's
  71    0021' 18 07             	jp	initlp
  72                            
  73    0023' AF                1:	xor	a		;Clear A
  74    0024' 32 0103'          	ld	(BSSCK),a	;IPAGE and MEMSIZ are set elsewhere
  75                            ;
  76    0027' 21 0084'          	ld	hl,initab	;start of init table
  77    002A' 4E                initlp:	ld	c,(hl)
  78    002B' 23                	inc	hl
  79    002C' 46                	ld	b,(hl)
  80    002D' 23                	inc	hl
  81    002E' 78                	ld	a,b
  82    002F' B1                	or	c		;done yet?
  83    0030' 28 0F             	jp	z,initeof	;yes, get out!
  84    0032' 5E                	ld	e,(hl)
  85    0033' 23                	inc	hl
  86    0034' 56                	ld	d,(hl)
  87    0035' 23                	inc	hl
  88    0036' 7E                	ld	a,(hl)
  89    0037' 23                	inc	hl
  90    0038' E5                	push	hl
  91    0039' 66                	ld	h,(hl)
  92    003A' 6F                	ld	l,a
  93    003B' ED B0             	ldir


HI-TECH SOFTWARE Z80 Macro Assembler: rzsw.as
                                                                                                                          Page   3


  94    003D' E1                	pop	hl
  95    003E' 23                	inc	hl
  96    003F' 18 E9             	jp	initlp
  97                            
  98    0041'                   initeof:
  99    0041' 3E AA             	ld	a,0aah
 100    0043' 32 0104'          	ld	(FLAG1),a
 101    0046' 32 041C'          	ld	(FLAG2),a
 102                            
 103                            ;			Now set the checksum value for next time.
 104    0049'                   _sumchk:
 105    0049' CD 0050'          	call	sumchk
 106    004C' 32 0103'          	ld	(BSSCK),a
 107    004F' C9                	ret
 108                            
 109    0050'                   sumchk:
 110    0050' 21 0104'          	ld	hl,FLAG1
 111    0053' 01 0318           	ld	bc,FLAG2-FLAG1
 112    0056' 7E                	ld	a,(hl)
 113    0057' 23                	inc	hl
 114    0058' E5                	push	hl
 115    0059' D1                	pop	de		;source and dest same, the LD is a nop
 116    005A' AE                1:	xor	(hl)
 117    005B' ED A0             	ldi
 118    005D' E0                	ret	po		;until BC = 0
 119    005E' 18 FA             	jp	1b
 120                            
 121                            	COND 0
 122                            	global _COLD, restart, _restart
 123                            restart: ld a,(_COLD)		;Cold Start?
 124                            	or	a		;Well?
 125                            	jp	z,0000h		;Yes, restart (Power Fail!)
 126                            	jp	_restart	;Nope, call C function instead
 127                            	ENDC
 128                            
 129    0000'                   	psect	bssck		;bss with checksum protection
 130                            	global	IPAGE, _MEMSIZ, _HEAPUSD, _HEAPSIZ, _COLD
 131    0000'                   IPAGE:	DEFS	256		;Interrupt pointer table (HDWINT.AS)
 132    0100'                   _MEMSIZ: DEFS	2		;Size of Dynamic RAM (BOOT.AS)
 133    0102'                   _COLD:	defs	1		;Reason for Restart (BOOT.AS)
 134    0103'                   BSSCK:	defs	1
 135    0104'                   FLAG1:	defs	1
 136    0105'                   l2parms: defs 12
 137    0111'                   l3parms: defs 12
 138    011D'                   initbss:
 139    011D'                   _node_addr: defs AXALEN
 140    0124'                   _l2_user_info: defs 2
 141    0126'                   _l2parms: defs 2
 142    0128'                   _l3parms: defs 2
 143    012A'                   _USER_L3_W: defs 2
 144    012C'                   _USER_MAXVC: defs 2
 145    012E'                   _L3CSIZ: defs 2
 146    0130'                   _L3CALL: defs AXALEN*maxl3	;7 * 18 - 16 Nodes and 2 Users (bbs?)
 147    01D8'                   _L3DIGI: defs AXALEN*maxl3
 148    0280'                   _L3PORT: defs 2*maxl3


HI-TECH SOFTWARE Z80 Macro Assembler: rzsw.as
                                                                                                                          Page   4


 149    02B0'                   _L3_WI:  defs 2*maxl3
 150    02E0'                   _L3_MAXVC: defs maxl3
 151    02F8'                   _L3DELAY: defs 2*16	;2 * 16	Nodes only
 152    0318'                   _L3NSIZ: defs 2
 153    031A'                   _NPAroute: defs 256		;16 * 16 Alternatives in routing list
 154    041A'                   _userport: defs 2		;Port number for out-bound User connect requests
 155    041C'                   FLAG2:	defs 1
 156    0000'                   	psect	bss
 157                            	global	_Init_bss, _SAVE, _SAVEA, _taskq, _timerq
 158    0000'                   _Init_bss:
 159    0000'                   _HEAPUSD: defs 2
 160    0002'                   _HEAPSIZ: defs 2
 161    0004'                   _taskq: defs 2
 162    0006'                   _timerq: defs 2
 163    0008'                   _SAVE: defs 2
 164    000A'                   _SAVEA: defs 16
 165    001A'                   _ndnics: defs 1
 166    001B'                   _DNics:	defs 35		; 5 - 7 byte entries


HI-TECH SOFTWARE Z80 Macro Assembler: rzsw.as
                                                                                                                          Page   5



                                                ---------- Symbol Table ----------

        (ABS) 0000#         AXALEN 0007           BSSCK 0103'      Copyright 0016'          FLAG1 0104'          FLAG2 041C'  
        IPAGE 0000'          _COLD 0102'         _DNics 001B'       _HEAPSIZ 0002'       _HEAPUSD 0000'      _Init_bss 0000'  
      _L3CALL 0130'        _L3CSIZ 012E'       _L3DELAY 02F8'        _L3DIGI 01D8'        _L3NSIZ 0318'        _L3PORT 0280'  
    _L3_MAXVC 02E0'         _L3_WI 02B0'        _MEMSIZ 0100'      _NPAroute 031A'          _SAVE 0008'         _SAVEA 000A'  
   _USER_L3_W 012A'    _USER_MAXVC 012C'       __Lbssck 0000*         __init 0000'      _dl2parms 0000*      _dl3parms 0000*  
     _l2_info 0029'  _l2_user_info 0124'       _l2parms 0126'       _l3parms 0128'      _maxl3dev 006F'        _ndnics 001A'  
   _node_addr 011D'        _sumchk 0049'         _taskq 0004'        _timerq 0006'      _userport 041A'            bss 003E#  
        bssck 041D#           data 00C8#        defdnic 0013'         initab 0084'        initbss 011D'        initdta 0000'  
      initeof 0041'        initlen 0013          initlp 002A'         initwm 00C0'          l2eob 006D'        l2parms 0105'  
       l2rdta 0033'         l2wdta 006E'        l3parms 0111'          maxl3 0018          myaddr 0000'         mycall 0071'  
      mydelay 0080'         mydigi 0078'         myport 007F'           myvc 0082'           mywi 0083'         nnodes 0001   
       nusers 0000          sumchk 0050'           text 0060#  

7 jump optimizations
