chapter8/CH8PRG1.SRC:

10 ; RESET THE MEMLO POINTER
20 ;
30 START     =     $600
40 DOSINI    =     $0C
50 MEMLO     =     $2E7
60 NEWMEM    =     $3000 ;THIS IS THE NEW VALUE FOR MEMLO
65 ;
70 ;THIS ROUTINE RESERVES SPACE FOR ASSEMBLY ROUTINES
90 ;BY RESETING THE MEMLO POINTER. IT RUNS AS
0100 ;AN AUTORUN.SYS FILE. IT ALSO RESETS MEMLO ON [RESET].
0120 ;MEMLO IS SET TO THE VALUE OF NEWMEM.
0130 ;
0140 ; THIS PART IS PERMANENT, IE. NEEDS TO BE RESIDENT.
0150 ; THE SYSTEM DOSINI VECTOR HAS BEEN STOLEN
0160 ; AND STORED IN THE ADDRESS PORTION OF THE JSR TROJAN
0170 ; INSTRUCTION. SO WHEN [RESET] IS PRESSED, DOSINI VECTORS
0180 ; TO INITDOS, JSR TROJAN THEN CALLS THE DOS INITIALIZATION
0185 ; ROUTINES, MEMLO IS RESET TO NEW VALUE AND CONTROL
0190 ; RETURNS TO THE MONITOR.
0200      *=  START
0210 INITDOS
0220     JSR TROJAN ; DO DOS INITIALIZATION
0230     LDA #NEWMEM&255
0240     STA MEMLO
0250     LDA #NEWMEM/256
0260     STA MEMLO+1
0270 TROJAN
0280     RTS
0290 ; THIS PART IS EXECUTED AT POWER UP ONLY AND
0300 ; CAN BE DELETED AFTER POWER-UP.
0330 ; THIS ROUTINE STORES THE CONTENTS OF DOSINI INTO THE JSR
0350 ; TROJAN INSTRUCTION. IT THEN REPLACES DOSINI WITH
0370 ; A NEW VALUE, LOCATION INITDOS.
0390 GRABDOSI
0400     LDA DOSINI     ; SAVE DOSINI
0410     STA INITDOS+1
0420     LDA DOSINI+1
0430     STA INITDOS+2
0440     LDA #INITDOS&255 ; SET DOSINI
0450     STA DOSINI
0460     LDA #INITDOS/256
0470     STA DOSINI+1
0480     LDA NEWMEM&255 ; SET MEMLO
0490     STA MEMLO
0500     LDA #NEWMEM/256
0510     STA MEMLO+1
0520     RTS
0530     *=  $2E2
0540     .WORD GRABDOSI      ; SET RUN ADDRESS
0550     .END

Back to previous page