home *** CD-ROM | disk | FTP | other *** search
- e
- _*********************************************************
- _* *
- _* module name : TAB.ASM *
- _* *
- _* Maintenance log *
- _* --------------- *
- _* *
- _* date time action *
- _* ---- ---- ------ *
- _* 24/02/89 21:55 initial coding *
- _* 28/03/89 16:25 change location addresses *
- _* 05/04/89 18:30 fix table bug and RTS bit *
- _* 06/04/89 23:00 Move zero page definition *
- _* 29/04/89 9:30 changed the brackets *
- _* 05/05/89 17:40 corrected endadd length bug *
- _* 19/05/89 18:00 added nextloc logic and fixed *
- _* locname bug *
- _* 18/06/89 18:45 remove register area *
- _* 04/07/89 18:45 added ram areas for page 0 & 1 *
- _*********************************************************
-
-
- _Table Definition
-
- flag = 0 _ Mode of entry in table
- name = flag + 1 _ Program name
- ramprg = name + maxlen _ program ram block ( 0 or 1 )
- strtadd = ramprg + 1 _ program start address
- endadd = strtadd +2 _ program end address
- zeroram = endadd + 2 _ ram of zero page
- zerooff = zeroram + 1 _ address of zero page
- oneram = zerooff + 1 _ ram of page one
- oneoff = oneram + 1 _ address of page one
- priority = oneoff + 1 _ program priority
- regsp = priority + 1 _ Stack pointer
- tablen = regsp + 1
-
- _ flag modes
-
- noprog = 0 _ free entry
- prgnorun = 1 _ program but not running
- prgrun = 2 _ program running
-
-
- _ locations used
-
-
- prgname res 16 _ program name
- namelen db 0 _ name length
-
- _ To allow for more programs, you have to increase the amount of reserved
- _ area and define an exact table end value as shown below.
-
- table res 256 _ enough for 8 programs
- tabend = table + tablen*8
-
- _*********************************************************
- _* *
- _* routine : SETTAB - initialise program table *
- _* *
- _* entry *
- _* ----- *
- _* none *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A,X *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* none *
- _*********************************************************
-
-
- settab equ *
- £ inittab _ initialise table scan
-
- _ set all flags in table to zero
-
- ƒ #flag
- initlop1 equ *
- ¥ #noprog
- » [tabpntr],y
- £ incloc _ point to next entry
- £ checkend
- â initlop1
- ¬
-
-
- _*********************************************************
- _* *
- _* routine : INITTAB - initialise table pointers *
- _* to start of the table *
- _* entry *
- _* ----- *
- _* none *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* TABPNTR *
- _*********************************************************
-
- inittab equ *
- ¥ #>table
- » tabpntr
- ¥ #<table
- » tabpntr+1
- ¬
-
- _*********************************************************
- _* *
- _* routine : CHECKEND - check for end of table in *
- _* table pointers *
- _* entry *
- _* ----- *
- _* TABPNTR (2 bytes) *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* c 0 = no end, 1 = end *
- _*********************************************************
-
-
- checkend equ *
-
- ¥ tabpntr+1
- æ #<tabend
- â exitchck
- ¥ tabpntr
- æ #>tabend
- exitchck equ *
- ¬
-
- _*********************************************************
- _* *
- _* routine : INCLOC - increment the table pointers *
- _* *
- _* entry *
- _* ----- *
- _* TABPNTR *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* TABPNTR *
- _*********************************************************
-
-
- incloc equ *
- ¥ tabpntr
- ì
- Ç #tablen
- » tabpntr
- ¥ tabpntr+1
- Ç #0
- » tabpntr+1
- ¬
-
- _*********************************************************
- _* *
- _* routine : LOCNAME - locate an entry in the table*
- _* based on name *
- _* entry *
- _* ----- *
- _* PRGNAME - name of program *
- _* NAMELEN - length of the name in PRGNAME *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A,X,Y *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* c 0=not found, 1=found *
- _*********************************************************
-
- locname equ *
- £ inittab
- locloop2 equ *
- ₧ #0
- ƒ #flag _ see if entry in table.
- ¥ [tabpntr],y
- æ #noprog
- à notit
- ƒ #name
- locloop1 equ *
- ¥ [tabpntr],y
- æ prgname,x
- ê notit
- Æ namelen
- ä fndit
- Ü
- Ö
- ê locloop1
- fndit equ *
- ¼ _ c=1 means found it
- ¬
-
- notit equ *
- £ incloc
- £ checkend
- â locloop2
-
- notfnd equ *
- ì _ c=0, name not found
- ¬
-
-
- _*********************************************************
- _* *
- _* routine : LOCFREE - locate a free entry in the *
- _* table *
- _* entry *
- _* ----- *
- _* None *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A,X,Y *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* c 0=found, 1=not found *
- _*********************************************************
-
- locfree equ *
- £ inittab
- ƒ #flag
- freloop1 equ *
- ¥ [tabpntr],y
- æ #noprog
- ê notfree
-
- ì _ c=0 means found it
- ¬
-
- notfree equ *
- £ incloc
- £ checkend
- â freloop1
-
- ¬ _ c=1 here
-
-
- _*********************************************************
- _* *
- _* routine : LOCNEXT - locate the next program to *
- _* to run. This routine must always an *
- _* entry. The routine will loop if *
- _* called when no progs are running. *
- _* entry *
- _* ----- *
- _* CURRENT - Current program that was running *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A,Y *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* CURRENT - next program that will run. *
- _*********************************************************
-
-
-
- _ locate the next program to run. This routine must always return
- _ an entry. The routine must never be run if no programs are running
-
- locnext equ *
-
- _ point to next entry in the table
-
- ¥ current
- ì
- Ç #tablen
- » tabpntr
- ¥ current+1
- Ç #0
- » tabpntr+1
-
- loccont equ *
-
- £ checkend _ see if we must start at the top again
- â nochange
-
- _ point to start of table again
-
- £ inittab
-
- nochange equ *
-
- ƒ #flag _ get flag entry and see if program is running
- ¥ [tabpntr],y
- æ #prgrun
- ê notloc
- ¥ tabpntr
- » current
- ¥ tabpntr+1
- » current+1
- ¬
-
- notloc equ *
- £ incloc _ point to next entry
- ¢ loccont
-
-
-
-
- IEND
-
-