home *** CD-ROM | disk | FTP | other *** search
- e
- _*********************************************************
- _* *
- _* module name : RELOC.ASM *
- _* *
- _* Maintenance log *
- _* --------------- *
- _* *
- _* date time action *
- _* ---- ---- ------ *
- _* 24/02/89 01:00 initial coding *
- _* 28/03/89 22:45 fix bugs, update logic, tidy *
- _* 03/04/89 23:50 added oldend, fixed ass bugs *
- _* 06/04/89 23:20 moved zero page definitions *
- _* 03/05/89 17:40 fix DEY bug *
- _* 31/09/89 16:00 fix getlen bug & end check bug *
- _*********************************************************
-
-
-
- _*********************************************************
- _* *
- _* routine : RELOC *
- _* *
- _* entry *
- _* ----- *
- _* OLDADD - Old start address of program *
- _* OLDEND - old end address of program *
- _* NEWSTART - new start address of program *
- _* NEWEND - new end address of program *
- _* NEWRAM - configuration of new program to relocate *
- _* EXECADD - old execute address *
- _*.......................................................*
- _* used *
- _* ---- *
- _* A,Y *
- _*.......................................................*
- _* exit *
- _* ---- *
- _* NEWEXEC - new execute address *
- _* NEWEND - new end address of the program *
- _* never updated and used outside *
- _*********************************************************
-
-
- _ start of the code
- _ calculate the actual program start address and sets the
- _ relocate pointer to start from that point.
-
- reloc equ *
- ¥ execadd
- ¼
- ½ oldadd
- » newexec
- ¥ execadd+1
- ½ oldadd+1
- » newexec+1
- ¥ newexec
- ì
- Ç newstart
- » newexec
- » progptr
- ¥ newexec+1
- Ç newstart+1
- » newexec+1
- » progptr+1
-
- _ setup LDAFAR and STAFAR with progptr as zero page address
-
- ¥ #progptr
- » ldaset
- » staset
-
- relloop1 equ *
- ƒ #0
- ₧ newram _ get ram block of program
- £ ldafar _ get machine code command
- £ getlen _ get length of command
- æ #3 _ if 3 then command has an address
- à addrcmd
- ¢ moveon
-
-
- _ 3 byte command so get the address following
-
- addrcmd equ *
- Ü
- £ ldafar
- » curradd
- Ü
- £ ldafar
- » curradd+1
-
- _ address got, so see if it is in range of the start and end addresses
-
- £ checklim _ doesn't affect Y register
- â moveon3
-
- _ calculate newadd = curradd - oldadd + newstart
-
- ¥ curradd
- ¼
- ½ oldadd
- » curradd
- ¥ curradd+1
- ½ oldadd+1
- » curradd+1
- ¥ curradd
- ì
- Ç newstart
- » curradd
- ¥ curradd+1
- Ç newstart+1
- £ stafar _ save curradd+1 in the program being rel'ed
- û
- ¥ curradd
- £ stafar
- moveon3 equ *
- ¥ #3
- ¢ moveon
-
-
- _ move onto next command A = length of last command already
-
- moveon equ *
- £ incpt
- â relloop1
-
- relend equ *
- ¬
-
- _ Move the program pointer on a distance based on A.
- _ this routine also checks for end of program area.
-
- incpt equ *
- ì
- Ç progptr
- » progptr
- ¥ progptr+1
- Ç #0
- » progptr+1
-
- _ now check for end of program area
-
- æ newend+1
- â exitinc1 _ not in top range yet, return c clear
- à checkrst _ same top address so check bottom
- ä exitinc1 _ we are well past it, so carry set
- checkrst equ *
- ¥ progptr
- æ newend
-
- _ if progptr >= edadd then c=1 so we return c=1 to indicate overflow
-
- exitinc1 equ *
- ¬
-
- _ find the length of the command
-
- getlen equ *
- » neumonic
- ü #15 _ get bottom 4 bits
- æ #$0c
- à byte3
- æ #$0d
- à byte3
- æ #$0e
- à byte3
- æ #$0a
- à byte1
- æ #8
- à byte1
- æ #9
- ê byte2
- ¥ neumonic
- ü #%00010000
- ê byte3 _ top nibble is odd if value from and returned
-
- _ falls through to be 2 bytes
-
- byte2 equ *
- ¥ #2
- db $2c
- byte1 ¥ #1
- db $2c
- byte3 ¥ #3
- ¬
-
- neumonic db 0
-
- _ check curradd to see if it is >=stadd and <=edadd
- _ c=0 means not in range
-
- checklim equ *
- ¥ curradd+1
- æ oldadd+1
- â notin
- à possibly
- ä above
- possibly equ *
- ¥ curradd
- æ oldadd
- â notin
-
- _ definitely above the lower limit
-
- above equ *
- ¥ oldend+1
- æ curradd+1
- â notin
- à maybe
- ä yesin
- maybe equ *
- ¥ oldend
- æ curradd _ if c=0 here, not in range
-
- yesin equ *
- notin equ *
- ¬
-
- IEND
-
-
-