Home » CEEFAX disks » telesoftware9.adl » 26-09-88/T\SWR12

26-09-88/T\SWR12

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » CEEFAX disks » telesoftware9.adl
Filename: 26-09-88/T\SWR12
Read OK:
File size: 3D64 bytes
Load address: 0000
Exec address: FFFFFFFF
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
Mastering Sideways ROM & RAM - Module 12 - Absolute workspace
-------------------------------------------------------------

  Private workspace is exclusive to the rom claiming it. Absolute
workspace can also be claimed by paged roms. Absolute workspace,
unlike private workspace, is a single block of memory which is shared
between all the roms but is only allocated to one rom at a time.

  Absolute workspace can be claimed in user memory when it runs from
&E00 to the highest address asked for by any of the roms. The Master
computer can also claim the alternative paged memory absolute
workspace. Claiming and using paged memory absolute workspace will be
explained after dealing with user memory absolute workspace.

  In order to claim absolute workspace your SWR interpreter has to
intercept the absolute workspace service call. To demonstrate the
absolute workspace service call load the object code generated by the
program TRACE into SWR and press the Break key (Ctrl+Break on the
Master). A list of service calls similar to the one in figure 12.1
will be printed on the screen. Unless you use a BBC B with an Acorn
6502 Second Processor, Acorn DNFS and sideways ram in socket &0F your
trace will be different from the one in figure 12.1, but in all BBC
computers you will find service call 1, the absolute workspace claim,
somewhere in the list.




 A=19 X=0F Y=FF SPOOL/EXEC file closure
 A=0F X=0F Y=FF Vectors claimed
 A=FF X=0F Y=FF Tube system main init.
 A=01 X=0F Y=0E Abs. workspace claim
 A=02 X=0F Y=17 Private workspace claim
 A=FE X=0F Y=FF Tube system post init.
 A=11 X=0F Y=1F Font implode/explode

Acorn TUBE 6502 64K

 A=03 X=0F Y=08 Auto-boot
Acorn DFS

 A=10 X=0F Y=EE SPOOL/EXEC file closure
 A=0F X=0F Y=30 Vectors claimed
 A=0A X=0F Y=D4 Claim static workspace
BASIC

>

Figure 12.1  Service call trace after Break
-------------------------------------------



  In figure 12.1 you can see that the absolute workspace claim,
service call 1, is made with Y=&0E. This indicates that no absolute
workspace has yet been claimed. If the trace is run from a lower
priority rom than the Acorn DFS rom then service call 1 is made with
Y=&17 indicating that 9 pages of absolute workspace are claimed by the
DFS.

  When service call 1 is made the Y register contains the current
upper limit of the absolute workspace. This starts at &0E and each rom
should compare the value in the Y register with the upper limit of
absolute workspace required by the rom and, if necessary, increase it
to the level required by the rom. Your software must never decrement
the Y register when it intercepts either service call 1 or 2.

  In order to use the absolute workspace effectively it is necessary
for your SWR program to claim private workspace as well. One reason
for this is that your rom will need to keep a flag indicating whether
or not it has control of the absolute workspace. This flag should be
located in private workspace. It is also a good idea to keep a copy of
any vital data from absolute workspace in private workspace where you
can be sure that it will not be corrupted. If you intend to write SWR
software that uses absolute workspace you should think of the absolute
workspace as a temporary extension to the private workspace and not as
a substitute for private workspace.

  When you want your rom to use the absolute workspace it has to issue
service call &0A to inform the other roms of its intention. Service
call &0A is issued by calling Osbyte &8F with X = service type and
Y = argument for service. In this case make X=&0A and Y=&FF. The rom
is then free to use the absolute workspace and the zero page locations
from &B0 to &CF until its interpreter intercepts a service call &0A
issued by another rom. The interpreter must intercept service call &0A
which instructs it to release the absolute workspace to the rom
issuing the call, usually the DFS.

  I have not written an example program which uses absolute workspace
but I have included a outline program, ABSOL, which includes all the
coding you need to write your own.

  ABSOL intercepts service call 1 to claim absolute workspace, service
call 2 to claim private workspace, sevice call &0A to release absolute
workspace, and service call 4 to recognise the new * command *STATIC.
It uses the one-command interpreter (lines 570-780) used in the
earlier modules of the course.

  The example program ABSOL ensures that at least one page of absolute
workspace is available (lines 300-360) and claims one page of private
workspace (lines 410-450). These are the minimum meaningful amounts if
the program is to use absolute workspace.

  The program recognises service call &0A (lines 470-500). After
recognising service call &0A the program would have to copy any vital
data from absolute to private workspace and adjust a flag kept in
private workspace to indicate that it no longer had control of the
absolute workspace.

  When the interpreter recognises the new command *STATIC it issues
service call &0A (lines 800-830) to inform the other roms that it
intends to use the absolute workspace. When it has control of the
absolute workspace it can also use the zero page locations from &B0 to
&CF, but it must be prepared to give up control of both these zero
page locations and the absolute workspace when the interpreter
intercepts a service call &0A issued by another rom.

  Although using absolute workspace is fairly straightforward if you
use this outline program, it is an unnecessary complication if you
really don't need it. You will probably only need to use it if your
program uses large amounts of data for a short time.





   10 REM: ABSOL
   20 MODE7
   30 HIMEM=&3C00
   40 DIM save 50
   50 diff=&8000-HIMEM
   60 address=&70
   70 comvec=&F2
   80 romnumber=&F4
   90 workspace=&DF0
  100 gsread=&FFC5
  110 osbyte=&FFF4
  120 oscli=&FFF7
  130 FOR pass = 0 TO 2 STEP 2
  140 P%=HIMEM
  150 [       OPT pass
  160         BRK
  170         BRK
  180         BRK
  190         JMP service+diff
  200         OPT FNequb(&82)
  210         OPT FNequb((copyright+diff) MOD 256)
  220         BRK
  230 .title
  240         OPT FNequs("STATIC")
  250 .copyright
  260         BRK
  270         OPT FNequs("(C) Gordon Horsington 1987")
  280         BRK
  290 .service
  300         CMP #1
  310         BNE trytwo
  320         CPY #&0F
  330         BCS carryon
  340         INY           \ claim 1 page of abs. workspace
  350 .carryon
  360         RTS
  370 .trytwo
  380         PHA
  390         CMP #2
  400         BNE tryten
  410         TYA
  420         STA workspace,X
  430         INY           \ 256 bytes of private workspace
  440         PLA
  450         RTS
  460 .tryten
  470         CMP #&0A
  480         BNE tryfour
  490                       \ Prepare to release
  500                       \ absolute workspace
  510 .enough
  520         PLA
  530         RTS
  540 .tryfour
  550         CMP #4
  560         BNE enough
  570         TXA
  580         PHA
  590         TYA
  600         PHA
  610         LDX #&FF
  620 .comloop
  630         INX
  640         LDA title+diff,X
  650         BEQ found
  660         LDA (comvec),Y
  670         INY
  680         CMP #ASC(".")
  690         BEQ found
  700         AND #&DF
  710         CMP title+diff,X
  720         BEQ comloop
  730         PLA
  740         TAY
  750         PLA
  760         TAX
  770         PLA
  780         RTS
  790 .found
  800         LDA #&8F
  810         LDX #&0A      \ service call &0A
  820         LDY #&FF
  830         JSR osbyte    \ Claim absolute workspace
  840                       \ Use zero page from &B0 to &CF
  850                       \ and absolute workspace as well
  860                       \ as private workspace.
  870         PLA
  880         PLA
  890         PLA
  900         LDA #0
  910         RTS
  920 .lastbyte
  930 ]
  940 NEXT
  950 INPUT'"Save filename? : "filename$
  960 IF filename$="" END
  970 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las
      tbyte)+" FFFF8000 FFFF8000"
  980 X%=save MOD 256
  990 Y%=save DIV 256
 1000 *OPT1,2
 1010 CALL oscli
 1020 *OPT1,0
 1030 END
 1040 DEFFNequb(byte)
 1050 ?P%=byte
 1060 P%=P%+1
 1070 =pass
 1080 DEFFNequw(word)
 1090 ?P%=word MOD 256
 1100 P%?1=word DIV 256
 1110 P%=P%+2
 1120 =pass
 1130 DEFFNequd(double)
 1140 !P%=double
 1150 P%=P%+4
 1160 =pass
 1170 DEFFNequs(string$)
 1180 $P%=string$
 1190 P%=P%+LEN(string$)
 1200 =pass



  In order to use the alternative paged memory absolute workspace on
the Master computer it is necessary to intercept service call &23
instead of service call 1. Your program must not claim user memory
absolute workspace as well as paged memory absolute workspace.

  Paged memory absolute workspace in the Master starts at &C000 and
has an upper limit of &DBFF. The upper limit of the absolute workspace
must not exceed &DBFF under any circumstances.

  If you intend to use paged memory absolute workspace the outline
program ABSOL will need to be modified. The interpreter will no longer
need to intercept service calls 1 and 2 but it will need to intercept
service call &23 to claim paged memory absolute workspace and service
calls &24 and &22 to claim paged memory private workspace. Suitable
modifications for ABSOL are shown in figure 12.2



.service
        CMP #&23      \ paged absolute workspace claim?
        BNE try24     \ branch if no
        CPY #&C1      \ is 1 page already available?
        BCS carryon   \ branch if yes
        INY           \ claim 1 page of absolute workspace
.carryon
        RTS
.try24
        CMP #&24      \ paged private workspace claim?
        BNE try22     \ branch if no
        INY           \ request 1 page of private workspace
        RTS
.try22
        CMP #&22      \ paged private workspace claim?
        BNE try10     \ branch if no
        PHA           \ store accumulator
        TYA           \ most sig. byte of start address
        STA &DF0,X    \ store start of private workspace
        PLA           \ restore accumulator
        RTS
.try10


Figure 12.2 Modificatins needed for the Master
----------------------------------------------


  In Module 11 I explained how to switch the paged workspace memory in
and out of the main memory map. It is necessary to use the same
techniques described in Module 11 when using paged memory absolute
workspace.

  Before attempting to read or write the contents of the paged memory
absolute workspace, the SWR program must first set bit 3 of the paged
memory select register at &FE34 to switch the paged memory into the
main memory map. To set bit 3 of &FE34 load the accumulator with &08
(0000 1000 binary), OR the accumulator with the contents of &FE34 and
store the accumulator in &FE34.

  To switch the paged memory absolute workspace out of the main memory
map it is necessary to clear bit 3 of the paged memory select
register. To clear bit 3 of &FE34 load the accumulator with &F7 (1111
0111 binary), AND the accumulator with the contents of &FE34 and store
the accumulator in &FE34. If you use the subroutines illustrated in
figure 12.3 the paged memory can be switched in and out of the main
memory map without altering any of the other bits in the paged memory
select register.




         JSR pagein      \ switch paged workspace in
         LDA &C000       \ Read first byte of absolute workspace
         JSR pageout     \ switch paged workspace out
          .
          .
          .
.pagein
         PHA
         LDA #8          \ 0000 1000 binary
         ORA &FE34
         STA &FE34       \ set bit 3 of &FE34
         PLA             \ restore accumulator
         RTS
.pageout
         PHA
         LDA #&F7        \ 1111 0111 binary
         AND &FE34
         STA &FE34       \ clear bit 3 of &FE34
         PLA             \ restore accumulator
         RTS


Figure 12.3  Reading paged absolute workspace on the Master.
-----------------------------------------------------------

  Figure 12.3 illustrates how the two subroutines, pagein and pageout,
should be used to switch the paged memory in and out of the main
memory map when reading the contents of the paged memory absolute
workspace in the Master series computers. Unlike private workspace,
absolute workspace always has a fixed start address and can be
addressed directly.

  After switching the paged memory into the main memory map you must
be very careful about using MOS subroutines because the bottom 7.25k
of the MOS has been replaced with the paged memory. You would be wise
not to use the MOS at all until it has been restored by calling
pageout.

  The "legal" use of service call 1 has been explained above but a
much more common "illegal" use is also made of this service call.

  Look again at figure 12.1, the list of service calls issued after
pressing the Break key. Some of these calls, including service call 1,
are always issued on the BBC B when the Break key is pressed and also
when the computer is switched on. (Service call 1 is only issued on
Ctrl-Break on the Master but service call &FE can be used instead
because it is always issued when the Break key is pressed on the
Master computer). Service call 1 or service call &FE can be
intercepted to carry out almost any function required at reset if, and
only if, all the registers are preserved.

  Imagine, for example, that you want the video interlace to stay
switched off. Your SWR interpreter could intercept service call 1 (or
&FE), push all the registers on the stack, switch off the interlace,
pull all the registers back off the stack and return control to the
MOS. This idea has been implemented in the program INTLACE.

  Load the object code generated by INTLACE into SWR, press the Break
key and select Mode 6. The interlace will remain switched off until
you select Mode 7 or press Ctrl+Break. It will switch back off when
you next select one of the modes 0-6.

  This type of illegal use of service call 1 (or &FE) will be used
again in Module 22 when designing the software for auto-booting rom
cartridges is covered. It will be used then to ensure that the rom
cartridge is always the language booted after a soft reset.



   10 REM: INTLACE
   20 MODE7
   30 HIMEM=&3C00
   40 DIM save 50
   50 diff=&8000-HIMEM
   60 osbyte=&FFF4
   70 oscli=&FFF7
   80 FOR pass = 0 TO 2 STEP 2
   90 P%=HIMEM
  100 [       OPT pass
  110         BRK
  120         BRK
  130         BRK
  140         JMP service+diff
  150         OPT FNequb(&82)
  160         OPT FNequb((copyright+diff) MOD 256)
  170         BRK
  180         OPT FNequs("INTERLACE")
  190 .copyright
  200         BRK
  210         OPT FNequs("(C) Gordon Horsington 1987")
  220         BRK
  230 .service
  240         CMP #&FE
  250         BEQ autoboot
  260         RTS
  270 .autoboot
  280         PHA
  290         TXA
  300         PHA
  310         TYA
  320         PHA
  330         LDA #&90
  340         LDX #&FF
  350         LDY #1
  360         JSR osbyte    \ *TV255,1
  370         PLA
  380         TAY
  390         PLA
  400         TAX
  410         PLA
  420         RTS
  430 .lastbyte
  440 ]
  450 NEXT
  460 INPUT'"Save filename = "filename$
  470 IF filename$="" END
  480 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las
      tbyte)+" FFFF8000 FFFF8000"
  490 X%=save MOD 256
  500 Y%=save DIV 256
  510 *OPT1,2
  520 CALL oscli
  530 *OPT1,0
  540 END
  550 DEFFNequb(byte)
  560 ?P%=byte
  570 P%=P%+1
  580 =pass
  590 DEFFNequw(word)
  600 ?P%=word MOD 256
  610 P%?1=word DIV 256
  620 P%=P%+2
  630 =pass
  640 DEFFNequd(double)
  650 !P%=double
  660 P%=P%+4
  670 =pass
  680 DEFFNequs(string$)
  690 $P%=string$
  700 P%=P%+LEN(string$)
  710 =pass
00000000  4d 61 73 74 65 72 69 6e  67 20 53 69 64 65 77 61  |Mastering Sidewa|
00000010  79 73 20 52 4f 4d 20 26  20 52 41 4d 20 2d 20 4d  |ys ROM & RAM - M|
00000020  6f 64 75 6c 65 20 31 32  20 2d 20 41 62 73 6f 6c  |odule 12 - Absol|
00000030  75 74 65 20 77 6f 72 6b  73 70 61 63 65 0d 2d 2d  |ute workspace.--|
00000040  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000070  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 0d 20 20 50  |-----------..  P|
00000080  72 69 76 61 74 65 20 77  6f 72 6b 73 70 61 63 65  |rivate workspace|
00000090  20 69 73 20 65 78 63 6c  75 73 69 76 65 20 74 6f  | is exclusive to|
000000a0  20 74 68 65 20 72 6f 6d  20 63 6c 61 69 6d 69 6e  | the rom claimin|
000000b0  67 20 69 74 2e 20 41 62  73 6f 6c 75 74 65 0d 77  |g it. Absolute.w|
000000c0  6f 72 6b 73 70 61 63 65  20 63 61 6e 20 61 6c 73  |orkspace can als|
000000d0  6f 20 62 65 20 63 6c 61  69 6d 65 64 20 62 79 20  |o be claimed by |
000000e0  70 61 67 65 64 20 72 6f  6d 73 2e 20 41 62 73 6f  |paged roms. Abso|
000000f0  6c 75 74 65 20 77 6f 72  6b 73 70 61 63 65 2c 0d  |lute workspace,.|
00000100  75 6e 6c 69 6b 65 20 70  72 69 76 61 74 65 20 77  |unlike private w|
00000110  6f 72 6b 73 70 61 63 65  2c 20 69 73 20 61 20 73  |orkspace, is a s|
00000120  69 6e 67 6c 65 20 62 6c  6f 63 6b 20 6f 66 20 6d  |ingle block of m|
00000130  65 6d 6f 72 79 20 77 68  69 63 68 20 69 73 20 73  |emory which is s|
00000140  68 61 72 65 64 0d 62 65  74 77 65 65 6e 20 61 6c  |hared.between al|
00000150  6c 20 74 68 65 20 72 6f  6d 73 20 62 75 74 20 69  |l the roms but i|
00000160  73 20 6f 6e 6c 79 20 61  6c 6c 6f 63 61 74 65 64  |s only allocated|
00000170  20 74 6f 20 6f 6e 65 20  72 6f 6d 20 61 74 20 61  | to one rom at a|
00000180  20 74 69 6d 65 2e 0d 0d  20 20 41 62 73 6f 6c 75  | time...  Absolu|
00000190  74 65 20 77 6f 72 6b 73  70 61 63 65 20 63 61 6e  |te workspace can|
000001a0  20 62 65 20 63 6c 61 69  6d 65 64 20 69 6e 20 75  | be claimed in u|
000001b0  73 65 72 20 6d 65 6d 6f  72 79 20 77 68 65 6e 20  |ser memory when |
000001c0  69 74 20 72 75 6e 73 20  66 72 6f 6d 0d 26 45 30  |it runs from.&E0|
000001d0  30 20 74 6f 20 74 68 65  20 68 69 67 68 65 73 74  |0 to the highest|
000001e0  20 61 64 64 72 65 73 73  20 61 73 6b 65 64 20 66  | address asked f|
000001f0  6f 72 20 62 79 20 61 6e  79 20 6f 66 20 74 68 65  |or by any of the|
00000200  20 72 6f 6d 73 2e 20 54  68 65 20 4d 61 73 74 65  | roms. The Maste|
00000210  72 0d 63 6f 6d 70 75 74  65 72 20 63 61 6e 20 61  |r.computer can a|
00000220  6c 73 6f 20 63 6c 61 69  6d 20 74 68 65 20 61 6c  |lso claim the al|
00000230  74 65 72 6e 61 74 69 76  65 20 70 61 67 65 64 20  |ternative paged |
00000240  6d 65 6d 6f 72 79 20 61  62 73 6f 6c 75 74 65 0d  |memory absolute.|
00000250  77 6f 72 6b 73 70 61 63  65 2e 20 43 6c 61 69 6d  |workspace. Claim|
00000260  69 6e 67 20 61 6e 64 20  75 73 69 6e 67 20 70 61  |ing and using pa|
00000270  67 65 64 20 6d 65 6d 6f  72 79 20 61 62 73 6f 6c  |ged memory absol|
00000280  75 74 65 20 77 6f 72 6b  73 70 61 63 65 20 77 69  |ute workspace wi|
00000290  6c 6c 20 62 65 0d 65 78  70 6c 61 69 6e 65 64 20  |ll be.explained |
000002a0  61 66 74 65 72 20 64 65  61 6c 69 6e 67 20 77 69  |after dealing wi|
000002b0  74 68 20 75 73 65 72 20  6d 65 6d 6f 72 79 20 61  |th user memory a|
000002c0  62 73 6f 6c 75 74 65 20  77 6f 72 6b 73 70 61 63  |bsolute workspac|
000002d0  65 2e 0d 0d 20 20 49 6e  20 6f 72 64 65 72 20 74  |e...  In order t|
000002e0  6f 20 63 6c 61 69 6d 20  61 62 73 6f 6c 75 74 65  |o claim absolute|
000002f0  20 77 6f 72 6b 73 70 61  63 65 20 79 6f 75 72 20  | workspace your |
00000300  53 57 52 20 69 6e 74 65  72 70 72 65 74 65 72 20  |SWR interpreter |
00000310  68 61 73 20 74 6f 0d 69  6e 74 65 72 63 65 70 74  |has to.intercept|
00000320  20 74 68 65 20 61 62 73  6f 6c 75 74 65 20 77 6f  | the absolute wo|
00000330  72 6b 73 70 61 63 65 20  73 65 72 76 69 63 65 20  |rkspace service |
00000340  63 61 6c 6c 2e 20 54 6f  20 64 65 6d 6f 6e 73 74  |call. To demonst|
00000350  72 61 74 65 20 74 68 65  0d 61 62 73 6f 6c 75 74  |rate the.absolut|
00000360  65 20 77 6f 72 6b 73 70  61 63 65 20 73 65 72 76  |e workspace serv|
00000370  69 63 65 20 63 61 6c 6c  20 6c 6f 61 64 20 74 68  |ice call load th|
00000380  65 20 6f 62 6a 65 63 74  20 63 6f 64 65 20 67 65  |e object code ge|
00000390  6e 65 72 61 74 65 64 20  62 79 20 74 68 65 0d 70  |nerated by the.p|
000003a0  72 6f 67 72 61 6d 20 54  52 41 43 45 20 69 6e 74  |rogram TRACE int|
000003b0  6f 20 53 57 52 20 61 6e  64 20 70 72 65 73 73 20  |o SWR and press |
000003c0  74 68 65 20 42 72 65 61  6b 20 6b 65 79 20 28 43  |the Break key (C|
000003d0  74 72 6c 2b 42 72 65 61  6b 20 6f 6e 20 74 68 65  |trl+Break on the|
000003e0  0d 4d 61 73 74 65 72 29  2e 20 41 20 6c 69 73 74  |.Master). A list|
000003f0  20 6f 66 20 73 65 72 76  69 63 65 20 63 61 6c 6c  | of service call|
00000400  73 20 73 69 6d 69 6c 61  72 20 74 6f 20 74 68 65  |s similar to the|
00000410  20 6f 6e 65 20 69 6e 20  66 69 67 75 72 65 20 31  | one in figure 1|
00000420  32 2e 31 0d 77 69 6c 6c  20 62 65 20 70 72 69 6e  |2.1.will be prin|
00000430  74 65 64 20 6f 6e 20 74  68 65 20 73 63 72 65 65  |ted on the scree|
00000440  6e 2e 20 55 6e 6c 65 73  73 20 79 6f 75 20 75 73  |n. Unless you us|
00000450  65 20 61 20 42 42 43 20  42 20 77 69 74 68 20 61  |e a BBC B with a|
00000460  6e 20 41 63 6f 72 6e 0d  36 35 30 32 20 53 65 63  |n Acorn.6502 Sec|
00000470  6f 6e 64 20 50 72 6f 63  65 73 73 6f 72 2c 20 41  |ond Processor, A|
00000480  63 6f 72 6e 20 44 4e 46  53 20 61 6e 64 20 73 69  |corn DNFS and si|
00000490  64 65 77 61 79 73 20 72  61 6d 20 69 6e 20 73 6f  |deways ram in so|
000004a0  63 6b 65 74 20 26 30 46  20 79 6f 75 72 0d 74 72  |cket &0F your.tr|
000004b0  61 63 65 20 77 69 6c 6c  20 62 65 20 64 69 66 66  |ace will be diff|
000004c0  65 72 65 6e 74 20 66 72  6f 6d 20 74 68 65 20 6f  |erent from the o|
000004d0  6e 65 20 69 6e 20 66 69  67 75 72 65 20 31 32 2e  |ne in figure 12.|
000004e0  31 2c 20 62 75 74 20 69  6e 20 61 6c 6c 20 42 42  |1, but in all BB|
000004f0  43 0d 63 6f 6d 70 75 74  65 72 73 20 79 6f 75 20  |C.computers you |
00000500  77 69 6c 6c 20 66 69 6e  64 20 73 65 72 76 69 63  |will find servic|
00000510  65 20 63 61 6c 6c 20 31  2c 20 74 68 65 20 61 62  |e call 1, the ab|
00000520  73 6f 6c 75 74 65 20 77  6f 72 6b 73 70 61 63 65  |solute workspace|
00000530  20 63 6c 61 69 6d 2c 0d  73 6f 6d 65 77 68 65 72  | claim,.somewher|
00000540  65 20 69 6e 20 74 68 65  20 6c 69 73 74 2e 0d 0d  |e in the list...|
00000550  0d 0d 0d 20 41 3d 31 39  20 58 3d 30 46 20 59 3d  |... A=19 X=0F Y=|
00000560  46 46 20 53 50 4f 4f 4c  2f 45 58 45 43 20 66 69  |FF SPOOL/EXEC fi|
00000570  6c 65 20 63 6c 6f 73 75  72 65 0d 20 41 3d 30 46  |le closure. A=0F|
00000580  20 58 3d 30 46 20 59 3d  46 46 20 56 65 63 74 6f  | X=0F Y=FF Vecto|
00000590  72 73 20 63 6c 61 69 6d  65 64 0d 20 41 3d 46 46  |rs claimed. A=FF|
000005a0  20 58 3d 30 46 20 59 3d  46 46 20 54 75 62 65 20  | X=0F Y=FF Tube |
000005b0  73 79 73 74 65 6d 20 6d  61 69 6e 20 69 6e 69 74  |system main init|
000005c0  2e 0d 20 41 3d 30 31 20  58 3d 30 46 20 59 3d 30  |.. A=01 X=0F Y=0|
000005d0  45 20 41 62 73 2e 20 77  6f 72 6b 73 70 61 63 65  |E Abs. workspace|
000005e0  20 63 6c 61 69 6d 0d 20  41 3d 30 32 20 58 3d 30  | claim. A=02 X=0|
000005f0  46 20 59 3d 31 37 20 50  72 69 76 61 74 65 20 77  |F Y=17 Private w|
00000600  6f 72 6b 73 70 61 63 65  20 63 6c 61 69 6d 0d 20  |orkspace claim. |
00000610  41 3d 46 45 20 58 3d 30  46 20 59 3d 46 46 20 54  |A=FE X=0F Y=FF T|
00000620  75 62 65 20 73 79 73 74  65 6d 20 70 6f 73 74 20  |ube system post |
00000630  69 6e 69 74 2e 0d 20 41  3d 31 31 20 58 3d 30 46  |init.. A=11 X=0F|
00000640  20 59 3d 31 46 20 46 6f  6e 74 20 69 6d 70 6c 6f  | Y=1F Font implo|
00000650  64 65 2f 65 78 70 6c 6f  64 65 0d 0d 41 63 6f 72  |de/explode..Acor|
00000660  6e 20 54 55 42 45 20 36  35 30 32 20 36 34 4b 0d  |n TUBE 6502 64K.|
00000670  0d 20 41 3d 30 33 20 58  3d 30 46 20 59 3d 30 38  |. A=03 X=0F Y=08|
00000680  20 41 75 74 6f 2d 62 6f  6f 74 0d 41 63 6f 72 6e  | Auto-boot.Acorn|
00000690  20 44 46 53 0d 0d 20 41  3d 31 30 20 58 3d 30 46  | DFS.. A=10 X=0F|
000006a0  20 59 3d 45 45 20 53 50  4f 4f 4c 2f 45 58 45 43  | Y=EE SPOOL/EXEC|
000006b0  20 66 69 6c 65 20 63 6c  6f 73 75 72 65 0d 20 41  | file closure. A|
000006c0  3d 30 46 20 58 3d 30 46  20 59 3d 33 30 20 56 65  |=0F X=0F Y=30 Ve|
000006d0  63 74 6f 72 73 20 63 6c  61 69 6d 65 64 0d 20 41  |ctors claimed. A|
000006e0  3d 30 41 20 58 3d 30 46  20 59 3d 44 34 20 43 6c  |=0A X=0F Y=D4 Cl|
000006f0  61 69 6d 20 73 74 61 74  69 63 20 77 6f 72 6b 73  |aim static works|
00000700  70 61 63 65 0d 42 41 53  49 43 0d 0d 3e 0d 0d 46  |pace.BASIC..>..F|
00000710  69 67 75 72 65 20 31 32  2e 31 20 20 53 65 72 76  |igure 12.1  Serv|
00000720  69 63 65 20 63 61 6c 6c  20 74 72 61 63 65 20 61  |ice call trace a|
00000730  66 74 65 72 20 42 72 65  61 6b 0d 2d 2d 2d 2d 2d  |fter Break.-----|
00000740  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000760  2d 2d 2d 2d 2d 2d 0d 0d  0d 0d 20 20 49 6e 20 66  |------....  In f|
00000770  69 67 75 72 65 20 31 32  2e 31 20 79 6f 75 20 63  |igure 12.1 you c|
00000780  61 6e 20 73 65 65 20 74  68 61 74 20 74 68 65 20  |an see that the |
00000790  61 62 73 6f 6c 75 74 65  20 77 6f 72 6b 73 70 61  |absolute workspa|
000007a0  63 65 20 63 6c 61 69 6d  2c 0d 73 65 72 76 69 63  |ce claim,.servic|
000007b0  65 20 63 61 6c 6c 20 31  2c 20 69 73 20 6d 61 64  |e call 1, is mad|
000007c0  65 20 77 69 74 68 20 59  3d 26 30 45 2e 20 54 68  |e with Y=&0E. Th|
000007d0  69 73 20 69 6e 64 69 63  61 74 65 73 20 74 68 61  |is indicates tha|
000007e0  74 20 6e 6f 20 61 62 73  6f 6c 75 74 65 0d 77 6f  |t no absolute.wo|
000007f0  72 6b 73 70 61 63 65 20  68 61 73 20 79 65 74 20  |rkspace has yet |
00000800  62 65 65 6e 20 63 6c 61  69 6d 65 64 2e 20 49 66  |been claimed. If|
00000810  20 74 68 65 20 74 72 61  63 65 20 69 73 20 72 75  | the trace is ru|
00000820  6e 20 66 72 6f 6d 20 61  20 6c 6f 77 65 72 0d 70  |n from a lower.p|
00000830  72 69 6f 72 69 74 79 20  72 6f 6d 20 74 68 61 6e  |riority rom than|
00000840  20 74 68 65 20 41 63 6f  72 6e 20 44 46 53 20 72  | the Acorn DFS r|
00000850  6f 6d 20 74 68 65 6e 20  73 65 72 76 69 63 65 20  |om then service |
00000860  63 61 6c 6c 20 31 20 69  73 20 6d 61 64 65 20 77  |call 1 is made w|
00000870  69 74 68 0d 59 3d 26 31  37 20 69 6e 64 69 63 61  |ith.Y=&17 indica|
00000880  74 69 6e 67 20 74 68 61  74 20 39 20 70 61 67 65  |ting that 9 page|
00000890  73 20 6f 66 20 61 62 73  6f 6c 75 74 65 20 77 6f  |s of absolute wo|
000008a0  72 6b 73 70 61 63 65 20  61 72 65 20 63 6c 61 69  |rkspace are clai|
000008b0  6d 65 64 20 62 79 20 74  68 65 0d 44 46 53 2e 0d  |med by the.DFS..|
000008c0  0d 20 20 57 68 65 6e 20  73 65 72 76 69 63 65 20  |.  When service |
000008d0  63 61 6c 6c 20 31 20 69  73 20 6d 61 64 65 20 74  |call 1 is made t|
000008e0  68 65 20 59 20 72 65 67  69 73 74 65 72 20 63 6f  |he Y register co|
000008f0  6e 74 61 69 6e 73 20 74  68 65 20 63 75 72 72 65  |ntains the curre|
00000900  6e 74 0d 75 70 70 65 72  20 6c 69 6d 69 74 20 6f  |nt.upper limit o|
00000910  66 20 74 68 65 20 61 62  73 6f 6c 75 74 65 20 77  |f the absolute w|
00000920  6f 72 6b 73 70 61 63 65  2e 20 54 68 69 73 20 73  |orkspace. This s|
00000930  74 61 72 74 73 20 61 74  20 26 30 45 20 61 6e 64  |tarts at &0E and|
00000940  20 65 61 63 68 20 72 6f  6d 0d 73 68 6f 75 6c 64  | each rom.should|
00000950  20 63 6f 6d 70 61 72 65  20 74 68 65 20 76 61 6c  | compare the val|
00000960  75 65 20 69 6e 20 74 68  65 20 59 20 72 65 67 69  |ue in the Y regi|
00000970  73 74 65 72 20 77 69 74  68 20 74 68 65 20 75 70  |ster with the up|
00000980  70 65 72 20 6c 69 6d 69  74 20 6f 66 0d 61 62 73  |per limit of.abs|
00000990  6f 6c 75 74 65 20 77 6f  72 6b 73 70 61 63 65 20  |olute workspace |
000009a0  72 65 71 75 69 72 65 64  20 62 79 20 74 68 65 20  |required by the |
000009b0  72 6f 6d 20 61 6e 64 2c  20 69 66 20 6e 65 63 65  |rom and, if nece|
000009c0  73 73 61 72 79 2c 20 69  6e 63 72 65 61 73 65 20  |ssary, increase |
000009d0  69 74 0d 74 6f 20 74 68  65 20 6c 65 76 65 6c 20  |it.to the level |
000009e0  72 65 71 75 69 72 65 64  20 62 79 20 74 68 65 20  |required by the |
000009f0  72 6f 6d 2e 20 59 6f 75  72 20 73 6f 66 74 77 61  |rom. Your softwa|
00000a00  72 65 20 6d 75 73 74 20  6e 65 76 65 72 20 64 65  |re must never de|
00000a10  63 72 65 6d 65 6e 74 0d  74 68 65 20 59 20 72 65  |crement.the Y re|
00000a20  67 69 73 74 65 72 20 77  68 65 6e 20 69 74 20 69  |gister when it i|
00000a30  6e 74 65 72 63 65 70 74  73 20 65 69 74 68 65 72  |ntercepts either|
00000a40  20 73 65 72 76 69 63 65  20 63 61 6c 6c 20 31 20  | service call 1 |
00000a50  6f 72 20 32 2e 0d 0d 20  20 49 6e 20 6f 72 64 65  |or 2...  In orde|
00000a60  72 20 74 6f 20 75 73 65  20 74 68 65 20 61 62 73  |r to use the abs|
00000a70  6f 6c 75 74 65 20 77 6f  72 6b 73 70 61 63 65 20  |olute workspace |
00000a80  65 66 66 65 63 74 69 76  65 6c 79 20 69 74 20 69  |effectively it i|
00000a90  73 20 6e 65 63 65 73 73  61 72 79 0d 66 6f 72 20  |s necessary.for |
00000aa0  79 6f 75 72 20 53 57 52  20 70 72 6f 67 72 61 6d  |your SWR program|
00000ab0  20 74 6f 20 63 6c 61 69  6d 20 70 72 69 76 61 74  | to claim privat|
00000ac0  65 20 77 6f 72 6b 73 70  61 63 65 20 61 73 20 77  |e workspace as w|
00000ad0  65 6c 6c 2e 20 4f 6e 65  20 72 65 61 73 6f 6e 0d  |ell. One reason.|
00000ae0  66 6f 72 20 74 68 69 73  20 69 73 20 74 68 61 74  |for this is that|
00000af0  20 79 6f 75 72 20 72 6f  6d 20 77 69 6c 6c 20 6e  | your rom will n|
00000b00  65 65 64 20 74 6f 20 6b  65 65 70 20 61 20 66 6c  |eed to keep a fl|
00000b10  61 67 20 69 6e 64 69 63  61 74 69 6e 67 20 77 68  |ag indicating wh|
00000b20  65 74 68 65 72 0d 6f 72  20 6e 6f 74 20 69 74 20  |ether.or not it |
00000b30  68 61 73 20 63 6f 6e 74  72 6f 6c 20 6f 66 20 74  |has control of t|
00000b40  68 65 20 61 62 73 6f 6c  75 74 65 20 77 6f 72 6b  |he absolute work|
00000b50  73 70 61 63 65 2e 20 54  68 69 73 20 66 6c 61 67  |space. This flag|
00000b60  20 73 68 6f 75 6c 64 20  62 65 0d 6c 6f 63 61 74  | should be.locat|
00000b70  65 64 20 69 6e 20 70 72  69 76 61 74 65 20 77 6f  |ed in private wo|
00000b80  72 6b 73 70 61 63 65 2e  20 49 74 20 69 73 20 61  |rkspace. It is a|
00000b90  6c 73 6f 20 61 20 67 6f  6f 64 20 69 64 65 61 20  |lso a good idea |
00000ba0  74 6f 20 6b 65 65 70 20  61 20 63 6f 70 79 20 6f  |to keep a copy o|
00000bb0  66 0d 61 6e 79 20 76 69  74 61 6c 20 64 61 74 61  |f.any vital data|
00000bc0  20 66 72 6f 6d 20 61 62  73 6f 6c 75 74 65 20 77  | from absolute w|
00000bd0  6f 72 6b 73 70 61 63 65  20 69 6e 20 70 72 69 76  |orkspace in priv|
00000be0  61 74 65 20 77 6f 72 6b  73 70 61 63 65 20 77 68  |ate workspace wh|
00000bf0  65 72 65 20 79 6f 75 0d  63 61 6e 20 62 65 20 73  |ere you.can be s|
00000c00  75 72 65 20 74 68 61 74  20 69 74 20 77 69 6c 6c  |ure that it will|
00000c10  20 6e 6f 74 20 62 65 20  63 6f 72 72 75 70 74 65  | not be corrupte|
00000c20  64 2e 20 49 66 20 79 6f  75 20 69 6e 74 65 6e 64  |d. If you intend|
00000c30  20 74 6f 20 77 72 69 74  65 20 53 57 52 0d 73 6f  | to write SWR.so|
00000c40  66 74 77 61 72 65 20 74  68 61 74 20 75 73 65 73  |ftware that uses|
00000c50  20 61 62 73 6f 6c 75 74  65 20 77 6f 72 6b 73 70  | absolute worksp|
00000c60  61 63 65 20 79 6f 75 20  73 68 6f 75 6c 64 20 74  |ace you should t|
00000c70  68 69 6e 6b 20 6f 66 20  74 68 65 20 61 62 73 6f  |hink of the abso|
00000c80  6c 75 74 65 0d 77 6f 72  6b 73 70 61 63 65 20 61  |lute.workspace a|
00000c90  73 20 61 20 74 65 6d 70  6f 72 61 72 79 20 65 78  |s a temporary ex|
00000ca0  74 65 6e 73 69 6f 6e 20  74 6f 20 74 68 65 20 70  |tension to the p|
00000cb0  72 69 76 61 74 65 20 77  6f 72 6b 73 70 61 63 65  |rivate workspace|
00000cc0  20 61 6e 64 20 6e 6f 74  20 61 73 0d 61 20 73 75  | and not as.a su|
00000cd0  62 73 74 69 74 75 74 65  20 66 6f 72 20 70 72 69  |bstitute for pri|
00000ce0  76 61 74 65 20 77 6f 72  6b 73 70 61 63 65 2e 0d  |vate workspace..|
00000cf0  0d 20 20 57 68 65 6e 20  79 6f 75 20 77 61 6e 74  |.  When you want|
00000d00  20 79 6f 75 72 20 72 6f  6d 20 74 6f 20 75 73 65  | your rom to use|
00000d10  20 74 68 65 20 61 62 73  6f 6c 75 74 65 20 77 6f  | the absolute wo|
00000d20  72 6b 73 70 61 63 65 20  69 74 20 68 61 73 20 74  |rkspace it has t|
00000d30  6f 20 69 73 73 75 65 0d  73 65 72 76 69 63 65 20  |o issue.service |
00000d40  63 61 6c 6c 20 26 30 41  20 74 6f 20 69 6e 66 6f  |call &0A to info|
00000d50  72 6d 20 74 68 65 20 6f  74 68 65 72 20 72 6f 6d  |rm the other rom|
00000d60  73 20 6f 66 20 69 74 73  20 69 6e 74 65 6e 74 69  |s of its intenti|
00000d70  6f 6e 2e 20 53 65 72 76  69 63 65 0d 63 61 6c 6c  |on. Service.call|
00000d80  20 26 30 41 20 69 73 20  69 73 73 75 65 64 20 62  | &0A is issued b|
00000d90  79 20 63 61 6c 6c 69 6e  67 20 4f 73 62 79 74 65  |y calling Osbyte|
00000da0  20 26 38 46 20 77 69 74  68 20 58 20 3d 20 73 65  | &8F with X = se|
00000db0  72 76 69 63 65 20 74 79  70 65 20 61 6e 64 0d 59  |rvice type and.Y|
00000dc0  20 3d 20 61 72 67 75 6d  65 6e 74 20 66 6f 72 20  | = argument for |
00000dd0  73 65 72 76 69 63 65 2e  20 49 6e 20 74 68 69 73  |service. In this|
00000de0  20 63 61 73 65 20 6d 61  6b 65 20 58 3d 26 30 41  | case make X=&0A|
00000df0  20 61 6e 64 20 59 3d 26  46 46 2e 20 54 68 65 20  | and Y=&FF. The |
00000e00  72 6f 6d 0d 69 73 20 74  68 65 6e 20 66 72 65 65  |rom.is then free|
00000e10  20 74 6f 20 75 73 65 20  74 68 65 20 61 62 73 6f  | to use the abso|
00000e20  6c 75 74 65 20 77 6f 72  6b 73 70 61 63 65 20 61  |lute workspace a|
00000e30  6e 64 20 74 68 65 20 7a  65 72 6f 20 70 61 67 65  |nd the zero page|
00000e40  20 6c 6f 63 61 74 69 6f  6e 73 0d 66 72 6f 6d 20  | locations.from |
00000e50  26 42 30 20 74 6f 20 26  43 46 20 75 6e 74 69 6c  |&B0 to &CF until|
00000e60  20 69 74 73 20 69 6e 74  65 72 70 72 65 74 65 72  | its interpreter|
00000e70  20 69 6e 74 65 72 63 65  70 74 73 20 61 20 73 65  | intercepts a se|
00000e80  72 76 69 63 65 20 63 61  6c 6c 20 26 30 41 0d 69  |rvice call &0A.i|
00000e90  73 73 75 65 64 20 62 79  20 61 6e 6f 74 68 65 72  |ssued by another|
00000ea0  20 72 6f 6d 2e 20 54 68  65 20 69 6e 74 65 72 70  | rom. The interp|
00000eb0  72 65 74 65 72 20 6d 75  73 74 20 69 6e 74 65 72  |reter must inter|
00000ec0  63 65 70 74 20 73 65 72  76 69 63 65 20 63 61 6c  |cept service cal|
00000ed0  6c 20 26 30 41 0d 77 68  69 63 68 20 69 6e 73 74  |l &0A.which inst|
00000ee0  72 75 63 74 73 20 69 74  20 74 6f 20 72 65 6c 65  |ructs it to rele|
00000ef0  61 73 65 20 74 68 65 20  61 62 73 6f 6c 75 74 65  |ase the absolute|
00000f00  20 77 6f 72 6b 73 70 61  63 65 20 74 6f 20 74 68  | workspace to th|
00000f10  65 20 72 6f 6d 0d 69 73  73 75 69 6e 67 20 74 68  |e rom.issuing th|
00000f20  65 20 63 61 6c 6c 2c 20  75 73 75 61 6c 6c 79 20  |e call, usually |
00000f30  74 68 65 20 44 46 53 2e  0d 0d 20 20 49 20 68 61  |the DFS...  I ha|
00000f40  76 65 20 6e 6f 74 20 77  72 69 74 74 65 6e 20 61  |ve not written a|
00000f50  6e 20 65 78 61 6d 70 6c  65 20 70 72 6f 67 72 61  |n example progra|
00000f60  6d 20 77 68 69 63 68 20  75 73 65 73 20 61 62 73  |m which uses abs|
00000f70  6f 6c 75 74 65 20 77 6f  72 6b 73 70 61 63 65 0d  |olute workspace.|
00000f80  62 75 74 20 49 20 68 61  76 65 20 69 6e 63 6c 75  |but I have inclu|
00000f90  64 65 64 20 61 20 6f 75  74 6c 69 6e 65 20 70 72  |ded a outline pr|
00000fa0  6f 67 72 61 6d 2c 20 41  42 53 4f 4c 2c 20 77 68  |ogram, ABSOL, wh|
00000fb0  69 63 68 20 69 6e 63 6c  75 64 65 73 20 61 6c 6c  |ich includes all|
00000fc0  20 74 68 65 0d 63 6f 64  69 6e 67 20 79 6f 75 20  | the.coding you |
00000fd0  6e 65 65 64 20 74 6f 20  77 72 69 74 65 20 79 6f  |need to write yo|
00000fe0  75 72 20 6f 77 6e 2e 0d  0d 20 20 41 42 53 4f 4c  |ur own...  ABSOL|
00000ff0  20 69 6e 74 65 72 63 65  70 74 73 20 73 65 72 76  | intercepts serv|
00001000  69 63 65 20 63 61 6c 6c  20 31 20 74 6f 20 63 6c  |ice call 1 to cl|
00001010  61 69 6d 20 61 62 73 6f  6c 75 74 65 20 77 6f 72  |aim absolute wor|
00001020  6b 73 70 61 63 65 2c 20  73 65 72 76 69 63 65 0d  |kspace, service.|
00001030  63 61 6c 6c 20 32 20 74  6f 20 63 6c 61 69 6d 20  |call 2 to claim |
00001040  70 72 69 76 61 74 65 20  77 6f 72 6b 73 70 61 63  |private workspac|
00001050  65 2c 20 73 65 76 69 63  65 20 63 61 6c 6c 20 26  |e, sevice call &|
00001060  30 41 20 74 6f 20 72 65  6c 65 61 73 65 20 61 62  |0A to release ab|
00001070  73 6f 6c 75 74 65 0d 77  6f 72 6b 73 70 61 63 65  |solute.workspace|
00001080  2c 20 61 6e 64 20 73 65  72 76 69 63 65 20 63 61  |, and service ca|
00001090  6c 6c 20 34 20 74 6f 20  72 65 63 6f 67 6e 69 73  |ll 4 to recognis|
000010a0  65 20 74 68 65 20 6e 65  77 20 2a 20 63 6f 6d 6d  |e the new * comm|
000010b0  61 6e 64 20 2a 53 54 41  54 49 43 2e 0d 49 74 20  |and *STATIC..It |
000010c0  75 73 65 73 20 74 68 65  20 6f 6e 65 2d 63 6f 6d  |uses the one-com|
000010d0  6d 61 6e 64 20 69 6e 74  65 72 70 72 65 74 65 72  |mand interpreter|
000010e0  20 28 6c 69 6e 65 73 20  35 37 30 2d 37 38 30 29  | (lines 570-780)|
000010f0  20 75 73 65 64 20 69 6e  20 74 68 65 0d 65 61 72  | used in the.ear|
00001100  6c 69 65 72 20 6d 6f 64  75 6c 65 73 20 6f 66 20  |lier modules of |
00001110  74 68 65 20 63 6f 75 72  73 65 2e 0d 0d 20 20 54  |the course...  T|
00001120  68 65 20 65 78 61 6d 70  6c 65 20 70 72 6f 67 72  |he example progr|
00001130  61 6d 20 41 42 53 4f 4c  20 65 6e 73 75 72 65 73  |am ABSOL ensures|
00001140  20 74 68 61 74 20 61 74  20 6c 65 61 73 74 20 6f  | that at least o|
00001150  6e 65 20 70 61 67 65 20  6f 66 20 61 62 73 6f 6c  |ne page of absol|
00001160  75 74 65 0d 77 6f 72 6b  73 70 61 63 65 20 69 73  |ute.workspace is|
00001170  20 61 76 61 69 6c 61 62  6c 65 20 28 6c 69 6e 65  | available (line|
00001180  73 20 33 30 30 2d 33 36  30 29 20 61 6e 64 20 63  |s 300-360) and c|
00001190  6c 61 69 6d 73 20 6f 6e  65 20 70 61 67 65 20 6f  |laims one page o|
000011a0  66 20 70 72 69 76 61 74  65 0d 77 6f 72 6b 73 70  |f private.worksp|
000011b0  61 63 65 20 28 6c 69 6e  65 73 20 34 31 30 2d 34  |ace (lines 410-4|
000011c0  35 30 29 2e 20 54 68 65  73 65 20 61 72 65 20 74  |50). These are t|
000011d0  68 65 20 6d 69 6e 69 6d  75 6d 20 6d 65 61 6e 69  |he minimum meani|
000011e0  6e 67 66 75 6c 20 61 6d  6f 75 6e 74 73 20 69 66  |ngful amounts if|
000011f0  0d 74 68 65 20 70 72 6f  67 72 61 6d 20 69 73 20  |.the program is |
00001200  74 6f 20 75 73 65 20 61  62 73 6f 6c 75 74 65 20  |to use absolute |
00001210  77 6f 72 6b 73 70 61 63  65 2e 0d 0d 20 20 54 68  |workspace...  Th|
00001220  65 20 70 72 6f 67 72 61  6d 20 72 65 63 6f 67 6e  |e program recogn|
00001230  69 73 65 73 20 73 65 72  76 69 63 65 20 63 61 6c  |ises service cal|
00001240  6c 20 26 30 41 20 28 6c  69 6e 65 73 20 34 37 30  |l &0A (lines 470|
00001250  2d 35 30 30 29 2e 20 41  66 74 65 72 0d 72 65 63  |-500). After.rec|
00001260  6f 67 6e 69 73 69 6e 67  20 73 65 72 76 69 63 65  |ognising service|
00001270  20 63 61 6c 6c 20 26 30  41 20 74 68 65 20 70 72  | call &0A the pr|
00001280  6f 67 72 61 6d 20 77 6f  75 6c 64 20 68 61 76 65  |ogram would have|
00001290  20 74 6f 20 63 6f 70 79  20 61 6e 79 20 76 69 74  | to copy any vit|
000012a0  61 6c 0d 64 61 74 61 20  66 72 6f 6d 20 61 62 73  |al.data from abs|
000012b0  6f 6c 75 74 65 20 74 6f  20 70 72 69 76 61 74 65  |olute to private|
000012c0  20 77 6f 72 6b 73 70 61  63 65 20 61 6e 64 20 61  | workspace and a|
000012d0  64 6a 75 73 74 20 61 20  66 6c 61 67 20 6b 65 70  |djust a flag kep|
000012e0  74 20 69 6e 0d 70 72 69  76 61 74 65 20 77 6f 72  |t in.private wor|
000012f0  6b 73 70 61 63 65 20 74  6f 20 69 6e 64 69 63 61  |kspace to indica|
00001300  74 65 20 74 68 61 74 20  69 74 20 6e 6f 20 6c 6f  |te that it no lo|
00001310  6e 67 65 72 20 68 61 64  20 63 6f 6e 74 72 6f 6c  |nger had control|
00001320  20 6f 66 20 74 68 65 0d  61 62 73 6f 6c 75 74 65  | of the.absolute|
00001330  20 77 6f 72 6b 73 70 61  63 65 2e 0d 0d 20 20 57  | workspace...  W|
00001340  68 65 6e 20 74 68 65 20  69 6e 74 65 72 70 72 65  |hen the interpre|
00001350  74 65 72 20 72 65 63 6f  67 6e 69 73 65 73 20 74  |ter recognises t|
00001360  68 65 20 6e 65 77 20 63  6f 6d 6d 61 6e 64 20 2a  |he new command *|
00001370  53 54 41 54 49 43 20 69  74 20 69 73 73 75 65 73  |STATIC it issues|
00001380  0d 73 65 72 76 69 63 65  20 63 61 6c 6c 20 26 30  |.service call &0|
00001390  41 20 28 6c 69 6e 65 73  20 38 30 30 2d 38 33 30  |A (lines 800-830|
000013a0  29 20 74 6f 20 69 6e 66  6f 72 6d 20 74 68 65 20  |) to inform the |
000013b0  6f 74 68 65 72 20 72 6f  6d 73 20 74 68 61 74 20  |other roms that |
000013c0  69 74 0d 69 6e 74 65 6e  64 73 20 74 6f 20 75 73  |it.intends to us|
000013d0  65 20 74 68 65 20 61 62  73 6f 6c 75 74 65 20 77  |e the absolute w|
000013e0  6f 72 6b 73 70 61 63 65  2e 20 57 68 65 6e 20 69  |orkspace. When i|
000013f0  74 20 68 61 73 20 63 6f  6e 74 72 6f 6c 20 6f 66  |t has control of|
00001400  20 74 68 65 0d 61 62 73  6f 6c 75 74 65 20 77 6f  | the.absolute wo|
00001410  72 6b 73 70 61 63 65 20  69 74 20 63 61 6e 20 61  |rkspace it can a|
00001420  6c 73 6f 20 75 73 65 20  74 68 65 20 7a 65 72 6f  |lso use the zero|
00001430  20 70 61 67 65 20 6c 6f  63 61 74 69 6f 6e 73 20  | page locations |
00001440  66 72 6f 6d 20 26 42 30  20 74 6f 0d 26 43 46 2c  |from &B0 to.&CF,|
00001450  20 62 75 74 20 69 74 20  6d 75 73 74 20 62 65 20  | but it must be |
00001460  70 72 65 70 61 72 65 64  20 74 6f 20 67 69 76 65  |prepared to give|
00001470  20 75 70 20 63 6f 6e 74  72 6f 6c 20 6f 66 20 62  | up control of b|
00001480  6f 74 68 20 74 68 65 73  65 20 7a 65 72 6f 0d 70  |oth these zero.p|
00001490  61 67 65 20 6c 6f 63 61  74 69 6f 6e 73 20 61 6e  |age locations an|
000014a0  64 20 74 68 65 20 61 62  73 6f 6c 75 74 65 20 77  |d the absolute w|
000014b0  6f 72 6b 73 70 61 63 65  20 77 68 65 6e 20 74 68  |orkspace when th|
000014c0  65 20 69 6e 74 65 72 70  72 65 74 65 72 0d 69 6e  |e interpreter.in|
000014d0  74 65 72 63 65 70 74 73  20 61 20 73 65 72 76 69  |tercepts a servi|
000014e0  63 65 20 63 61 6c 6c 20  26 30 41 20 69 73 73 75  |ce call &0A issu|
000014f0  65 64 20 62 79 20 61 6e  6f 74 68 65 72 20 72 6f  |ed by another ro|
00001500  6d 2e 0d 0d 20 20 41 6c  74 68 6f 75 67 68 20 75  |m...  Although u|
00001510  73 69 6e 67 20 61 62 73  6f 6c 75 74 65 20 77 6f  |sing absolute wo|
00001520  72 6b 73 70 61 63 65 20  69 73 20 66 61 69 72 6c  |rkspace is fairl|
00001530  79 20 73 74 72 61 69 67  68 74 66 6f 72 77 61 72  |y straightforwar|
00001540  64 20 69 66 20 79 6f 75  0d 75 73 65 20 74 68 69  |d if you.use thi|
00001550  73 20 6f 75 74 6c 69 6e  65 20 70 72 6f 67 72 61  |s outline progra|
00001560  6d 2c 20 69 74 20 69 73  20 61 6e 20 75 6e 6e 65  |m, it is an unne|
00001570  63 65 73 73 61 72 79 20  63 6f 6d 70 6c 69 63 61  |cessary complica|
00001580  74 69 6f 6e 20 69 66 20  79 6f 75 0d 72 65 61 6c  |tion if you.real|
00001590  6c 79 20 64 6f 6e 27 74  20 6e 65 65 64 20 69 74  |ly don't need it|
000015a0  2e 20 59 6f 75 20 77 69  6c 6c 20 70 72 6f 62 61  |. You will proba|
000015b0  62 6c 79 20 6f 6e 6c 79  20 6e 65 65 64 20 74 6f  |bly only need to|
000015c0  20 75 73 65 20 69 74 20  69 66 20 79 6f 75 72 0d  | use it if your.|
000015d0  70 72 6f 67 72 61 6d 20  75 73 65 73 20 6c 61 72  |program uses lar|
000015e0  67 65 20 61 6d 6f 75 6e  74 73 20 6f 66 20 64 61  |ge amounts of da|
000015f0  74 61 20 66 6f 72 20 61  20 73 68 6f 72 74 20 74  |ta for a short t|
00001600  69 6d 65 2e 0d 0d 0d 0d  0d 0d 20 20 20 31 30 20  |ime.......   10 |
00001610  52 45 4d 3a 20 41 42 53  4f 4c 0d 20 20 20 32 30  |REM: ABSOL.   20|
00001620  20 4d 4f 44 45 37 0d 20  20 20 33 30 20 48 49 4d  | MODE7.   30 HIM|
00001630  45 4d 3d 26 33 43 30 30  0d 20 20 20 34 30 20 44  |EM=&3C00.   40 D|
00001640  49 4d 20 73 61 76 65 20  35 30 0d 20 20 20 35 30  |IM save 50.   50|
00001650  20 64 69 66 66 3d 26 38  30 30 30 2d 48 49 4d 45  | diff=&8000-HIME|
00001660  4d 0d 20 20 20 36 30 20  61 64 64 72 65 73 73 3d  |M.   60 address=|
00001670  26 37 30 0d 20 20 20 37  30 20 63 6f 6d 76 65 63  |&70.   70 comvec|
00001680  3d 26 46 32 0d 20 20 20  38 30 20 72 6f 6d 6e 75  |=&F2.   80 romnu|
00001690  6d 62 65 72 3d 26 46 34  0d 20 20 20 39 30 20 77  |mber=&F4.   90 w|
000016a0  6f 72 6b 73 70 61 63 65  3d 26 44 46 30 0d 20 20  |orkspace=&DF0.  |
000016b0  31 30 30 20 67 73 72 65  61 64 3d 26 46 46 43 35  |100 gsread=&FFC5|
000016c0  0d 20 20 31 31 30 20 6f  73 62 79 74 65 3d 26 46  |.  110 osbyte=&F|
000016d0  46 46 34 0d 20 20 31 32  30 20 6f 73 63 6c 69 3d  |FF4.  120 oscli=|
000016e0  26 46 46 46 37 0d 20 20  31 33 30 20 46 4f 52 20  |&FFF7.  130 FOR |
000016f0  70 61 73 73 20 3d 20 30  20 54 4f 20 32 20 53 54  |pass = 0 TO 2 ST|
00001700  45 50 20 32 0d 20 20 31  34 30 20 50 25 3d 48 49  |EP 2.  140 P%=HI|
00001710  4d 45 4d 0d 20 20 31 35  30 20 5b 20 20 20 20 20  |MEM.  150 [     |
00001720  20 20 4f 50 54 20 70 61  73 73 0d 20 20 31 36 30  |  OPT pass.  160|
00001730  20 20 20 20 20 20 20 20  20 42 52 4b 0d 20 20 31  |         BRK.  1|
00001740  37 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |70         BRK. |
00001750  20 31 38 30 20 20 20 20  20 20 20 20 20 42 52 4b  | 180         BRK|
00001760  0d 20 20 31 39 30 20 20  20 20 20 20 20 20 20 4a  |.  190         J|
00001770  4d 50 20 73 65 72 76 69  63 65 2b 64 69 66 66 0d  |MP service+diff.|
00001780  20 20 32 30 30 20 20 20  20 20 20 20 20 20 4f 50  |  200         OP|
00001790  54 20 46 4e 65 71 75 62  28 26 38 32 29 0d 20 20  |T FNequb(&82).  |
000017a0  32 31 30 20 20 20 20 20  20 20 20 20 4f 50 54 20  |210         OPT |
000017b0  46 4e 65 71 75 62 28 28  63 6f 70 79 72 69 67 68  |FNequb((copyrigh|
000017c0  74 2b 64 69 66 66 29 20  4d 4f 44 20 32 35 36 29  |t+diff) MOD 256)|
000017d0  0d 20 20 32 32 30 20 20  20 20 20 20 20 20 20 42  |.  220         B|
000017e0  52 4b 0d 20 20 32 33 30  20 2e 74 69 74 6c 65 0d  |RK.  230 .title.|
000017f0  20 20 32 34 30 20 20 20  20 20 20 20 20 20 4f 50  |  240         OP|
00001800  54 20 46 4e 65 71 75 73  28 22 53 54 41 54 49 43  |T FNequs("STATIC|
00001810  22 29 0d 20 20 32 35 30  20 2e 63 6f 70 79 72 69  |").  250 .copyri|
00001820  67 68 74 0d 20 20 32 36  30 20 20 20 20 20 20 20  |ght.  260       |
00001830  20 20 42 52 4b 0d 20 20  32 37 30 20 20 20 20 20  |  BRK.  270     |
00001840  20 20 20 20 4f 50 54 20  46 4e 65 71 75 73 28 22  |    OPT FNequs("|
00001850  28 43 29 20 47 6f 72 64  6f 6e 20 48 6f 72 73 69  |(C) Gordon Horsi|
00001860  6e 67 74 6f 6e 20 31 39  38 37 22 29 0d 20 20 32  |ngton 1987").  2|
00001870  38 30 20 20 20 20 20 20  20 20 20 42 52 4b 0d 20  |80         BRK. |
00001880  20 32 39 30 20 2e 73 65  72 76 69 63 65 0d 20 20  | 290 .service.  |
00001890  33 30 30 20 20 20 20 20  20 20 20 20 43 4d 50 20  |300         CMP |
000018a0  23 31 0d 20 20 33 31 30  20 20 20 20 20 20 20 20  |#1.  310        |
000018b0  20 42 4e 45 20 74 72 79  74 77 6f 0d 20 20 33 32  | BNE trytwo.  32|
000018c0  30 20 20 20 20 20 20 20  20 20 43 50 59 20 23 26  |0         CPY #&|
000018d0  30 46 0d 20 20 33 33 30  20 20 20 20 20 20 20 20  |0F.  330        |
000018e0  20 42 43 53 20 63 61 72  72 79 6f 6e 0d 20 20 33  | BCS carryon.  3|
000018f0  34 30 20 20 20 20 20 20  20 20 20 49 4e 59 20 20  |40         INY  |
00001900  20 20 20 20 20 20 20 20  20 5c 20 63 6c 61 69 6d  |         \ claim|
00001910  20 31 20 70 61 67 65 20  6f 66 20 61 62 73 2e 20  | 1 page of abs. |
00001920  77 6f 72 6b 73 70 61 63  65 0d 20 20 33 35 30 20  |workspace.  350 |
00001930  2e 63 61 72 72 79 6f 6e  0d 20 20 33 36 30 20 20  |.carryon.  360  |
00001940  20 20 20 20 20 20 20 52  54 53 0d 20 20 33 37 30  |       RTS.  370|
00001950  20 2e 74 72 79 74 77 6f  0d 20 20 33 38 30 20 20  | .trytwo.  380  |
00001960  20 20 20 20 20 20 20 50  48 41 0d 20 20 33 39 30  |       PHA.  390|
00001970  20 20 20 20 20 20 20 20  20 43 4d 50 20 23 32 0d  |         CMP #2.|
00001980  20 20 34 30 30 20 20 20  20 20 20 20 20 20 42 4e  |  400         BN|
00001990  45 20 74 72 79 74 65 6e  0d 20 20 34 31 30 20 20  |E tryten.  410  |
000019a0  20 20 20 20 20 20 20 54  59 41 0d 20 20 34 32 30  |       TYA.  420|
000019b0  20 20 20 20 20 20 20 20  20 53 54 41 20 77 6f 72  |         STA wor|
000019c0  6b 73 70 61 63 65 2c 58  0d 20 20 34 33 30 20 20  |kspace,X.  430  |
000019d0  20 20 20 20 20 20 20 49  4e 59 20 20 20 20 20 20  |       INY      |
000019e0  20 20 20 20 20 5c 20 32  35 36 20 62 79 74 65 73  |     \ 256 bytes|
000019f0  20 6f 66 20 70 72 69 76  61 74 65 20 77 6f 72 6b  | of private work|
00001a00  73 70 61 63 65 0d 20 20  34 34 30 20 20 20 20 20  |space.  440     |
00001a10  20 20 20 20 50 4c 41 0d  20 20 34 35 30 20 20 20  |    PLA.  450   |
00001a20  20 20 20 20 20 20 52 54  53 0d 20 20 34 36 30 20  |      RTS.  460 |
00001a30  2e 74 72 79 74 65 6e 0d  20 20 34 37 30 20 20 20  |.tryten.  470   |
00001a40  20 20 20 20 20 20 43 4d  50 20 23 26 30 41 0d 20  |      CMP #&0A. |
00001a50  20 34 38 30 20 20 20 20  20 20 20 20 20 42 4e 45  | 480         BNE|
00001a60  20 74 72 79 66 6f 75 72  0d 20 20 34 39 30 20 20  | tryfour.  490  |
00001a70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001a80  20 20 20 20 20 5c 20 50  72 65 70 61 72 65 20 74  |     \ Prepare t|
00001a90  6f 20 72 65 6c 65 61 73  65 0d 20 20 35 30 30 20  |o release.  500 |
00001aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001ab0  20 20 20 20 20 20 5c 20  61 62 73 6f 6c 75 74 65  |      \ absolute|
00001ac0  20 77 6f 72 6b 73 70 61  63 65 0d 20 20 35 31 30  | workspace.  510|
00001ad0  20 2e 65 6e 6f 75 67 68  0d 20 20 35 32 30 20 20  | .enough.  520  |
00001ae0  20 20 20 20 20 20 20 50  4c 41 0d 20 20 35 33 30  |       PLA.  530|
00001af0  20 20 20 20 20 20 20 20  20 52 54 53 0d 20 20 35  |         RTS.  5|
00001b00  34 30 20 2e 74 72 79 66  6f 75 72 0d 20 20 35 35  |40 .tryfour.  55|
00001b10  30 20 20 20 20 20 20 20  20 20 43 4d 50 20 23 34  |0         CMP #4|
00001b20  0d 20 20 35 36 30 20 20  20 20 20 20 20 20 20 42  |.  560         B|
00001b30  4e 45 20 65 6e 6f 75 67  68 0d 20 20 35 37 30 20  |NE enough.  570 |
00001b40  20 20 20 20 20 20 20 20  54 58 41 0d 20 20 35 38  |        TXA.  58|
00001b50  30 20 20 20 20 20 20 20  20 20 50 48 41 0d 20 20  |0         PHA.  |
00001b60  35 39 30 20 20 20 20 20  20 20 20 20 54 59 41 0d  |590         TYA.|
00001b70  20 20 36 30 30 20 20 20  20 20 20 20 20 20 50 48  |  600         PH|
00001b80  41 0d 20 20 36 31 30 20  20 20 20 20 20 20 20 20  |A.  610         |
00001b90  4c 44 58 20 23 26 46 46  0d 20 20 36 32 30 20 2e  |LDX #&FF.  620 .|
00001ba0  63 6f 6d 6c 6f 6f 70 0d  20 20 36 33 30 20 20 20  |comloop.  630   |
00001bb0  20 20 20 20 20 20 49 4e  58 0d 20 20 36 34 30 20  |      INX.  640 |
00001bc0  20 20 20 20 20 20 20 20  4c 44 41 20 74 69 74 6c  |        LDA titl|
00001bd0  65 2b 64 69 66 66 2c 58  0d 20 20 36 35 30 20 20  |e+diff,X.  650  |
00001be0  20 20 20 20 20 20 20 42  45 51 20 66 6f 75 6e 64  |       BEQ found|
00001bf0  0d 20 20 36 36 30 20 20  20 20 20 20 20 20 20 4c  |.  660         L|
00001c00  44 41 20 28 63 6f 6d 76  65 63 29 2c 59 0d 20 20  |DA (comvec),Y.  |
00001c10  36 37 30 20 20 20 20 20  20 20 20 20 49 4e 59 0d  |670         INY.|
00001c20  20 20 36 38 30 20 20 20  20 20 20 20 20 20 43 4d  |  680         CM|
00001c30  50 20 23 41 53 43 28 22  2e 22 29 0d 20 20 36 39  |P #ASC(".").  69|
00001c40  30 20 20 20 20 20 20 20  20 20 42 45 51 20 66 6f  |0         BEQ fo|
00001c50  75 6e 64 0d 20 20 37 30  30 20 20 20 20 20 20 20  |und.  700       |
00001c60  20 20 41 4e 44 20 23 26  44 46 0d 20 20 37 31 30  |  AND #&DF.  710|
00001c70  20 20 20 20 20 20 20 20  20 43 4d 50 20 74 69 74  |         CMP tit|
00001c80  6c 65 2b 64 69 66 66 2c  58 0d 20 20 37 32 30 20  |le+diff,X.  720 |
00001c90  20 20 20 20 20 20 20 20  42 45 51 20 63 6f 6d 6c  |        BEQ coml|
00001ca0  6f 6f 70 0d 20 20 37 33  30 20 20 20 20 20 20 20  |oop.  730       |
00001cb0  20 20 50 4c 41 0d 20 20  37 34 30 20 20 20 20 20  |  PLA.  740     |
00001cc0  20 20 20 20 54 41 59 0d  20 20 37 35 30 20 20 20  |    TAY.  750   |
00001cd0  20 20 20 20 20 20 50 4c  41 0d 20 20 37 36 30 20  |      PLA.  760 |
00001ce0  20 20 20 20 20 20 20 20  54 41 58 0d 20 20 37 37  |        TAX.  77|
00001cf0  30 20 20 20 20 20 20 20  20 20 50 4c 41 0d 20 20  |0         PLA.  |
00001d00  37 38 30 20 20 20 20 20  20 20 20 20 52 54 53 0d  |780         RTS.|
00001d10  20 20 37 39 30 20 2e 66  6f 75 6e 64 0d 20 20 38  |  790 .found.  8|
00001d20  30 30 20 20 20 20 20 20  20 20 20 4c 44 41 20 23  |00         LDA #|
00001d30  26 38 46 0d 20 20 38 31  30 20 20 20 20 20 20 20  |&8F.  810       |
00001d40  20 20 4c 44 58 20 23 26  30 41 20 20 20 20 20 20  |  LDX #&0A      |
00001d50  5c 20 73 65 72 76 69 63  65 20 63 61 6c 6c 20 26  |\ service call &|
00001d60  30 41 0d 20 20 38 32 30  20 20 20 20 20 20 20 20  |0A.  820        |
00001d70  20 4c 44 59 20 23 26 46  46 0d 20 20 38 33 30 20  | LDY #&FF.  830 |
00001d80  20 20 20 20 20 20 20 20  4a 53 52 20 6f 73 62 79  |        JSR osby|
00001d90  74 65 20 20 20 20 5c 20  43 6c 61 69 6d 20 61 62  |te    \ Claim ab|
00001da0  73 6f 6c 75 74 65 20 77  6f 72 6b 73 70 61 63 65  |solute workspace|
00001db0  0d 20 20 38 34 30 20 20  20 20 20 20 20 20 20 20  |.  840          |
00001dc0  20 20 20 20 20 20 20 20  20 20 20 20 20 5c 20 55  |             \ U|
00001dd0  73 65 20 7a 65 72 6f 20  70 61 67 65 20 66 72 6f  |se zero page fro|
00001de0  6d 20 26 42 30 20 74 6f  20 26 43 46 0d 20 20 38  |m &B0 to &CF.  8|
00001df0  35 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |50              |
00001e00  20 20 20 20 20 20 20 20  20 5c 20 61 6e 64 20 61  |         \ and a|
00001e10  62 73 6f 6c 75 74 65 20  77 6f 72 6b 73 70 61 63  |bsolute workspac|
00001e20  65 20 61 73 20 77 65 6c  6c 0d 20 20 38 36 30 20  |e as well.  860 |
00001e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001e40  20 20 20 20 20 20 5c 20  61 73 20 70 72 69 76 61  |      \ as priva|
00001e50  74 65 20 77 6f 72 6b 73  70 61 63 65 2e 0d 20 20  |te workspace..  |
00001e60  38 37 30 20 20 20 20 20  20 20 20 20 50 4c 41 0d  |870         PLA.|
00001e70  20 20 38 38 30 20 20 20  20 20 20 20 20 20 50 4c  |  880         PL|
00001e80  41 0d 20 20 38 39 30 20  20 20 20 20 20 20 20 20  |A.  890         |
00001e90  50 4c 41 0d 20 20 39 30  30 20 20 20 20 20 20 20  |PLA.  900       |
00001ea0  20 20 4c 44 41 20 23 30  0d 20 20 39 31 30 20 20  |  LDA #0.  910  |
00001eb0  20 20 20 20 20 20 20 52  54 53 0d 20 20 39 32 30  |       RTS.  920|
00001ec0  20 2e 6c 61 73 74 62 79  74 65 0d 20 20 39 33 30  | .lastbyte.  930|
00001ed0  20 5d 0d 20 20 39 34 30  20 4e 45 58 54 0d 20 20  | ].  940 NEXT.  |
00001ee0  39 35 30 20 49 4e 50 55  54 27 22 53 61 76 65 20  |950 INPUT'"Save |
00001ef0  66 69 6c 65 6e 61 6d 65  3f 20 3a 20 22 66 69 6c  |filename? : "fil|
00001f00  65 6e 61 6d 65 24 0d 20  20 39 36 30 20 49 46 20  |ename$.  960 IF |
00001f10  66 69 6c 65 6e 61 6d 65  24 3d 22 22 20 45 4e 44  |filename$="" END|
00001f20  0d 20 20 39 37 30 20 24  73 61 76 65 3d 22 53 41  |.  970 $save="SA|
00001f30  56 45 20 22 2b 66 69 6c  65 6e 61 6d 65 24 2b 22  |VE "+filename$+"|
00001f40  20 22 2b 53 54 52 24 7e  28 48 49 4d 45 4d 29 2b  | "+STR$~(HIMEM)+|
00001f50  22 20 22 2b 53 54 52 24  7e 28 6c 61 73 0d 20 20  |" "+STR$~(las.  |
00001f60  20 20 20 20 74 62 79 74  65 29 2b 22 20 46 46 46  |    tbyte)+" FFF|
00001f70  46 38 30 30 30 20 46 46  46 46 38 30 30 30 22 0d  |F8000 FFFF8000".|
00001f80  20 20 39 38 30 20 58 25  3d 73 61 76 65 20 4d 4f  |  980 X%=save MO|
00001f90  44 20 32 35 36 0d 20 20  39 39 30 20 59 25 3d 73  |D 256.  990 Y%=s|
00001fa0  61 76 65 20 44 49 56 20  32 35 36 0d 20 31 30 30  |ave DIV 256. 100|
00001fb0  30 20 2a 4f 50 54 31 2c  32 0d 20 31 30 31 30 20  |0 *OPT1,2. 1010 |
00001fc0  43 41 4c 4c 20 6f 73 63  6c 69 0d 20 31 30 32 30  |CALL oscli. 1020|
00001fd0  20 2a 4f 50 54 31 2c 30  0d 20 31 30 33 30 20 45  | *OPT1,0. 1030 E|
00001fe0  4e 44 0d 20 31 30 34 30  20 44 45 46 46 4e 65 71  |ND. 1040 DEFFNeq|
00001ff0  75 62 28 62 79 74 65 29  0d 20 31 30 35 30 20 3f  |ub(byte). 1050 ?|
00002000  50 25 3d 62 79 74 65 0d  20 31 30 36 30 20 50 25  |P%=byte. 1060 P%|
00002010  3d 50 25 2b 31 0d 20 31  30 37 30 20 3d 70 61 73  |=P%+1. 1070 =pas|
00002020  73 0d 20 31 30 38 30 20  44 45 46 46 4e 65 71 75  |s. 1080 DEFFNequ|
00002030  77 28 77 6f 72 64 29 0d  20 31 30 39 30 20 3f 50  |w(word). 1090 ?P|
00002040  25 3d 77 6f 72 64 20 4d  4f 44 20 32 35 36 0d 20  |%=word MOD 256. |
00002050  31 31 30 30 20 50 25 3f  31 3d 77 6f 72 64 20 44  |1100 P%?1=word D|
00002060  49 56 20 32 35 36 0d 20  31 31 31 30 20 50 25 3d  |IV 256. 1110 P%=|
00002070  50 25 2b 32 0d 20 31 31  32 30 20 3d 70 61 73 73  |P%+2. 1120 =pass|
00002080  0d 20 31 31 33 30 20 44  45 46 46 4e 65 71 75 64  |. 1130 DEFFNequd|
00002090  28 64 6f 75 62 6c 65 29  0d 20 31 31 34 30 20 21  |(double). 1140 !|
000020a0  50 25 3d 64 6f 75 62 6c  65 0d 20 31 31 35 30 20  |P%=double. 1150 |
000020b0  50 25 3d 50 25 2b 34 0d  20 31 31 36 30 20 3d 70  |P%=P%+4. 1160 =p|
000020c0  61 73 73 0d 20 31 31 37  30 20 44 45 46 46 4e 65  |ass. 1170 DEFFNe|
000020d0  71 75 73 28 73 74 72 69  6e 67 24 29 0d 20 31 31  |qus(string$). 11|
000020e0  38 30 20 24 50 25 3d 73  74 72 69 6e 67 24 0d 20  |80 $P%=string$. |
000020f0  31 31 39 30 20 50 25 3d  50 25 2b 4c 45 4e 28 73  |1190 P%=P%+LEN(s|
00002100  74 72 69 6e 67 24 29 0d  20 31 32 30 30 20 3d 70  |tring$). 1200 =p|
00002110  61 73 73 0d 0d 0d 0d 20  20 49 6e 20 6f 72 64 65  |ass....  In orde|
00002120  72 20 74 6f 20 75 73 65  20 74 68 65 20 61 6c 74  |r to use the alt|
00002130  65 72 6e 61 74 69 76 65  20 70 61 67 65 64 20 6d  |ernative paged m|
00002140  65 6d 6f 72 79 20 61 62  73 6f 6c 75 74 65 20 77  |emory absolute w|
00002150  6f 72 6b 73 70 61 63 65  20 6f 6e 0d 74 68 65 20  |orkspace on.the |
00002160  4d 61 73 74 65 72 20 63  6f 6d 70 75 74 65 72 20  |Master computer |
00002170  69 74 20 69 73 20 6e 65  63 65 73 73 61 72 79 20  |it is necessary |
00002180  74 6f 20 69 6e 74 65 72  63 65 70 74 20 73 65 72  |to intercept ser|
00002190  76 69 63 65 20 63 61 6c  6c 20 26 32 33 0d 69 6e  |vice call &23.in|
000021a0  73 74 65 61 64 20 6f 66  20 73 65 72 76 69 63 65  |stead of service|
000021b0  20 63 61 6c 6c 20 31 2e  20 59 6f 75 72 20 70 72  | call 1. Your pr|
000021c0  6f 67 72 61 6d 20 6d 75  73 74 20 6e 6f 74 20 63  |ogram must not c|
000021d0  6c 61 69 6d 20 75 73 65  72 20 6d 65 6d 6f 72 79  |laim user memory|
000021e0  0d 61 62 73 6f 6c 75 74  65 20 77 6f 72 6b 73 70  |.absolute worksp|
000021f0  61 63 65 20 61 73 20 77  65 6c 6c 20 61 73 20 70  |ace as well as p|
00002200  61 67 65 64 20 6d 65 6d  6f 72 79 20 61 62 73 6f  |aged memory abso|
00002210  6c 75 74 65 20 77 6f 72  6b 73 70 61 63 65 2e 0d  |lute workspace..|
00002220  0d 20 20 50 61 67 65 64  20 6d 65 6d 6f 72 79 20  |.  Paged memory |
00002230  61 62 73 6f 6c 75 74 65  20 77 6f 72 6b 73 70 61  |absolute workspa|
00002240  63 65 20 69 6e 20 74 68  65 20 4d 61 73 74 65 72  |ce in the Master|
00002250  20 73 74 61 72 74 73 20  61 74 20 26 43 30 30 30  | starts at &C000|
00002260  20 61 6e 64 0d 68 61 73  20 61 6e 20 75 70 70 65  | and.has an uppe|
00002270  72 20 6c 69 6d 69 74 20  6f 66 20 26 44 42 46 46  |r limit of &DBFF|
00002280  2e 20 54 68 65 20 75 70  70 65 72 20 6c 69 6d 69  |. The upper limi|
00002290  74 20 6f 66 20 74 68 65  20 61 62 73 6f 6c 75 74  |t of the absolut|
000022a0  65 20 77 6f 72 6b 73 70  61 63 65 0d 6d 75 73 74  |e workspace.must|
000022b0  20 6e 6f 74 20 65 78 63  65 65 64 20 26 44 42 46  | not exceed &DBF|
000022c0  46 20 75 6e 64 65 72 20  61 6e 79 20 63 69 72 63  |F under any circ|
000022d0  75 6d 73 74 61 6e 63 65  73 2e 0d 0d 20 20 49 66  |umstances...  If|
000022e0  20 79 6f 75 20 69 6e 74  65 6e 64 20 74 6f 20 75  | you intend to u|
000022f0  73 65 20 70 61 67 65 64  20 6d 65 6d 6f 72 79 20  |se paged memory |
00002300  61 62 73 6f 6c 75 74 65  20 77 6f 72 6b 73 70 61  |absolute workspa|
00002310  63 65 20 74 68 65 20 6f  75 74 6c 69 6e 65 0d 70  |ce the outline.p|
00002320  72 6f 67 72 61 6d 20 41  42 53 4f 4c 20 77 69 6c  |rogram ABSOL wil|
00002330  6c 20 6e 65 65 64 20 74  6f 20 62 65 20 6d 6f 64  |l need to be mod|
00002340  69 66 69 65 64 2e 20 54  68 65 20 69 6e 74 65 72  |ified. The inter|
00002350  70 72 65 74 65 72 20 77  69 6c 6c 20 6e 6f 20 6c  |preter will no l|
00002360  6f 6e 67 65 72 0d 6e 65  65 64 20 74 6f 20 69 6e  |onger.need to in|
00002370  74 65 72 63 65 70 74 20  73 65 72 76 69 63 65 20  |tercept service |
00002380  63 61 6c 6c 73 20 31 20  61 6e 64 20 32 20 62 75  |calls 1 and 2 bu|
00002390  74 20 69 74 20 77 69 6c  6c 20 6e 65 65 64 20 74  |t it will need t|
000023a0  6f 20 69 6e 74 65 72 63  65 70 74 0d 73 65 72 76  |o intercept.serv|
000023b0  69 63 65 20 63 61 6c 6c  20 26 32 33 20 74 6f 20  |ice call &23 to |
000023c0  63 6c 61 69 6d 20 70 61  67 65 64 20 6d 65 6d 6f  |claim paged memo|
000023d0  72 79 20 61 62 73 6f 6c  75 74 65 20 77 6f 72 6b  |ry absolute work|
000023e0  73 70 61 63 65 20 61 6e  64 20 73 65 72 76 69 63  |space and servic|
000023f0  65 0d 63 61 6c 6c 73 20  26 32 34 20 61 6e 64 20  |e.calls &24 and |
00002400  26 32 32 20 74 6f 20 63  6c 61 69 6d 20 70 61 67  |&22 to claim pag|
00002410  65 64 20 6d 65 6d 6f 72  79 20 70 72 69 76 61 74  |ed memory privat|
00002420  65 20 77 6f 72 6b 73 70  61 63 65 2e 20 53 75 69  |e workspace. Sui|
00002430  74 61 62 6c 65 0d 6d 6f  64 69 66 69 63 61 74 69  |table.modificati|
00002440  6f 6e 73 20 66 6f 72 20  41 42 53 4f 4c 20 61 72  |ons for ABSOL ar|
00002450  65 20 73 68 6f 77 6e 20  69 6e 20 66 69 67 75 72  |e shown in figur|
00002460  65 20 31 32 2e 32 0d 0d  0d 0d 2e 73 65 72 76 69  |e 12.2.....servi|
00002470  63 65 0d 20 20 20 20 20  20 20 20 43 4d 50 20 23  |ce.        CMP #|
00002480  26 32 33 20 20 20 20 20  20 5c 20 70 61 67 65 64  |&23      \ paged|
00002490  20 61 62 73 6f 6c 75 74  65 20 77 6f 72 6b 73 70  | absolute worksp|
000024a0  61 63 65 20 63 6c 61 69  6d 3f 0d 20 20 20 20 20  |ace claim?.     |
000024b0  20 20 20 42 4e 45 20 74  72 79 32 34 20 20 20 20  |   BNE try24    |
000024c0  20 5c 20 62 72 61 6e 63  68 20 69 66 20 6e 6f 0d  | \ branch if no.|
000024d0  20 20 20 20 20 20 20 20  43 50 59 20 23 26 43 31  |        CPY #&C1|
000024e0  20 20 20 20 20 20 5c 20  69 73 20 31 20 70 61 67  |      \ is 1 pag|
000024f0  65 20 61 6c 72 65 61 64  79 20 61 76 61 69 6c 61  |e already availa|
00002500  62 6c 65 3f 0d 20 20 20  20 20 20 20 20 42 43 53  |ble?.        BCS|
00002510  20 63 61 72 72 79 6f 6e  20 20 20 5c 20 62 72 61  | carryon   \ bra|
00002520  6e 63 68 20 69 66 20 79  65 73 0d 20 20 20 20 20  |nch if yes.     |
00002530  20 20 20 49 4e 59 20 20  20 20 20 20 20 20 20 20  |   INY          |
00002540  20 5c 20 63 6c 61 69 6d  20 31 20 70 61 67 65 20  | \ claim 1 page |
00002550  6f 66 20 61 62 73 6f 6c  75 74 65 20 77 6f 72 6b  |of absolute work|
00002560  73 70 61 63 65 0d 2e 63  61 72 72 79 6f 6e 0d 20  |space..carryon. |
00002570  20 20 20 20 20 20 20 52  54 53 0d 2e 74 72 79 32  |       RTS..try2|
00002580  34 0d 20 20 20 20 20 20  20 20 43 4d 50 20 23 26  |4.        CMP #&|
00002590  32 34 20 20 20 20 20 20  5c 20 70 61 67 65 64 20  |24      \ paged |
000025a0  70 72 69 76 61 74 65 20  77 6f 72 6b 73 70 61 63  |private workspac|
000025b0  65 20 63 6c 61 69 6d 3f  0d 20 20 20 20 20 20 20  |e claim?.       |
000025c0  20 42 4e 45 20 74 72 79  32 32 20 20 20 20 20 5c  | BNE try22     \|
000025d0  20 62 72 61 6e 63 68 20  69 66 20 6e 6f 0d 20 20  | branch if no.  |
000025e0  20 20 20 20 20 20 49 4e  59 20 20 20 20 20 20 20  |      INY       |
000025f0  20 20 20 20 5c 20 72 65  71 75 65 73 74 20 31 20  |    \ request 1 |
00002600  70 61 67 65 20 6f 66 20  70 72 69 76 61 74 65 20  |page of private |
00002610  77 6f 72 6b 73 70 61 63  65 0d 20 20 20 20 20 20  |workspace.      |
00002620  20 20 52 54 53 0d 2e 74  72 79 32 32 0d 20 20 20  |  RTS..try22.   |
00002630  20 20 20 20 20 43 4d 50  20 23 26 32 32 20 20 20  |     CMP #&22   |
00002640  20 20 20 5c 20 70 61 67  65 64 20 70 72 69 76 61  |   \ paged priva|
00002650  74 65 20 77 6f 72 6b 73  70 61 63 65 20 63 6c 61  |te workspace cla|
00002660  69 6d 3f 0d 20 20 20 20  20 20 20 20 42 4e 45 20  |im?.        BNE |
00002670  74 72 79 31 30 20 20 20  20 20 5c 20 62 72 61 6e  |try10     \ bran|
00002680  63 68 20 69 66 20 6e 6f  0d 20 20 20 20 20 20 20  |ch if no.       |
00002690  20 50 48 41 20 20 20 20  20 20 20 20 20 20 20 5c  | PHA           \|
000026a0  20 73 74 6f 72 65 20 61  63 63 75 6d 75 6c 61 74  | store accumulat|
000026b0  6f 72 0d 20 20 20 20 20  20 20 20 54 59 41 20 20  |or.        TYA  |
000026c0  20 20 20 20 20 20 20 20  20 5c 20 6d 6f 73 74 20  |         \ most |
000026d0  73 69 67 2e 20 62 79 74  65 20 6f 66 20 73 74 61  |sig. byte of sta|
000026e0  72 74 20 61 64 64 72 65  73 73 0d 20 20 20 20 20  |rt address.     |
000026f0  20 20 20 53 54 41 20 26  44 46 30 2c 58 20 20 20  |   STA &DF0,X   |
00002700  20 5c 20 73 74 6f 72 65  20 73 74 61 72 74 20 6f  | \ store start o|
00002710  66 20 70 72 69 76 61 74  65 20 77 6f 72 6b 73 70  |f private worksp|
00002720  61 63 65 0d 20 20 20 20  20 20 20 20 50 4c 41 20  |ace.        PLA |
00002730  20 20 20 20 20 20 20 20  20 20 5c 20 72 65 73 74  |          \ rest|
00002740  6f 72 65 20 61 63 63 75  6d 75 6c 61 74 6f 72 0d  |ore accumulator.|
00002750  20 20 20 20 20 20 20 20  52 54 53 0d 2e 74 72 79  |        RTS..try|
00002760  31 30 0d 0d 0d 46 69 67  75 72 65 20 31 32 2e 32  |10...Figure 12.2|
00002770  20 4d 6f 64 69 66 69 63  61 74 69 6e 73 20 6e 65  | Modificatins ne|
00002780  65 64 65 64 20 66 6f 72  20 74 68 65 20 4d 61 73  |eded for the Mas|
00002790  74 65 72 0d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ter.------------|
000027a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000027c0  2d 2d 0d 0d 0d 20 20 49  6e 20 4d 6f 64 75 6c 65  |--...  In Module|
000027d0  20 31 31 20 49 20 65 78  70 6c 61 69 6e 65 64 20  | 11 I explained |
000027e0  68 6f 77 20 74 6f 20 73  77 69 74 63 68 20 74 68  |how to switch th|
000027f0  65 20 70 61 67 65 64 20  77 6f 72 6b 73 70 61 63  |e paged workspac|
00002800  65 20 6d 65 6d 6f 72 79  20 69 6e 0d 61 6e 64 20  |e memory in.and |
00002810  6f 75 74 20 6f 66 20 74  68 65 20 6d 61 69 6e 20  |out of the main |
00002820  6d 65 6d 6f 72 79 20 6d  61 70 2e 20 49 74 20 69  |memory map. It i|
00002830  73 20 6e 65 63 65 73 73  61 72 79 20 74 6f 20 75  |s necessary to u|
00002840  73 65 20 74 68 65 20 73  61 6d 65 0d 74 65 63 68  |se the same.tech|
00002850  6e 69 71 75 65 73 20 64  65 73 63 72 69 62 65 64  |niques described|
00002860  20 69 6e 20 4d 6f 64 75  6c 65 20 31 31 20 77 68  | in Module 11 wh|
00002870  65 6e 20 75 73 69 6e 67  20 70 61 67 65 64 20 6d  |en using paged m|
00002880  65 6d 6f 72 79 20 61 62  73 6f 6c 75 74 65 0d 77  |emory absolute.w|
00002890  6f 72 6b 73 70 61 63 65  2e 0d 0d 20 20 42 65 66  |orkspace...  Bef|
000028a0  6f 72 65 20 61 74 74 65  6d 70 74 69 6e 67 20 74  |ore attempting t|
000028b0  6f 20 72 65 61 64 20 6f  72 20 77 72 69 74 65 20  |o read or write |
000028c0  74 68 65 20 63 6f 6e 74  65 6e 74 73 20 6f 66 20  |the contents of |
000028d0  74 68 65 20 70 61 67 65  64 20 6d 65 6d 6f 72 79  |the paged memory|
000028e0  0d 61 62 73 6f 6c 75 74  65 20 77 6f 72 6b 73 70  |.absolute worksp|
000028f0  61 63 65 2c 20 74 68 65  20 53 57 52 20 70 72 6f  |ace, the SWR pro|
00002900  67 72 61 6d 20 6d 75 73  74 20 66 69 72 73 74 20  |gram must first |
00002910  73 65 74 20 62 69 74 20  33 20 6f 66 20 74 68 65  |set bit 3 of the|
00002920  20 70 61 67 65 64 0d 6d  65 6d 6f 72 79 20 73 65  | paged.memory se|
00002930  6c 65 63 74 20 72 65 67  69 73 74 65 72 20 61 74  |lect register at|
00002940  20 26 46 45 33 34 20 74  6f 20 73 77 69 74 63 68  | &FE34 to switch|
00002950  20 74 68 65 20 70 61 67  65 64 20 6d 65 6d 6f 72  | the paged memor|
00002960  79 20 69 6e 74 6f 20 74  68 65 0d 6d 61 69 6e 20  |y into the.main |
00002970  6d 65 6d 6f 72 79 20 6d  61 70 2e 20 54 6f 20 73  |memory map. To s|
00002980  65 74 20 62 69 74 20 33  20 6f 66 20 26 46 45 33  |et bit 3 of &FE3|
00002990  34 20 6c 6f 61 64 20 74  68 65 20 61 63 63 75 6d  |4 load the accum|
000029a0  75 6c 61 74 6f 72 20 77  69 74 68 20 26 30 38 0d  |ulator with &08.|
000029b0  28 30 30 30 30 20 31 30  30 30 20 62 69 6e 61 72  |(0000 1000 binar|
000029c0  79 29 2c 20 4f 52 20 74  68 65 20 61 63 63 75 6d  |y), OR the accum|
000029d0  75 6c 61 74 6f 72 20 77  69 74 68 20 74 68 65 20  |ulator with the |
000029e0  63 6f 6e 74 65 6e 74 73  20 6f 66 20 26 46 45 33  |contents of &FE3|
000029f0  34 20 61 6e 64 0d 73 74  6f 72 65 20 74 68 65 20  |4 and.store the |
00002a00  61 63 63 75 6d 75 6c 61  74 6f 72 20 69 6e 20 26  |accumulator in &|
00002a10  46 45 33 34 2e 0d 0d 20  20 54 6f 20 73 77 69 74  |FE34...  To swit|
00002a20  63 68 20 74 68 65 20 70  61 67 65 64 20 6d 65 6d  |ch the paged mem|
00002a30  6f 72 79 20 61 62 73 6f  6c 75 74 65 20 77 6f 72  |ory absolute wor|
00002a40  6b 73 70 61 63 65 20 6f  75 74 20 6f 66 20 74 68  |kspace out of th|
00002a50  65 20 6d 61 69 6e 20 6d  65 6d 6f 72 79 0d 6d 61  |e main memory.ma|
00002a60  70 20 69 74 20 69 73 20  6e 65 63 65 73 73 61 72  |p it is necessar|
00002a70  79 20 74 6f 20 63 6c 65  61 72 20 62 69 74 20 33  |y to clear bit 3|
00002a80  20 6f 66 20 74 68 65 20  70 61 67 65 64 20 6d 65  | of the paged me|
00002a90  6d 6f 72 79 20 73 65 6c  65 63 74 0d 72 65 67 69  |mory select.regi|
00002aa0  73 74 65 72 2e 20 54 6f  20 63 6c 65 61 72 20 62  |ster. To clear b|
00002ab0  69 74 20 33 20 6f 66 20  26 46 45 33 34 20 6c 6f  |it 3 of &FE34 lo|
00002ac0  61 64 20 74 68 65 20 61  63 63 75 6d 75 6c 61 74  |ad the accumulat|
00002ad0  6f 72 20 77 69 74 68 20  26 46 37 20 28 31 31 31  |or with &F7 (111|
00002ae0  31 0d 30 31 31 31 20 62  69 6e 61 72 79 29 2c 20  |1.0111 binary), |
00002af0  41 4e 44 20 74 68 65 20  61 63 63 75 6d 75 6c 61  |AND the accumula|
00002b00  74 6f 72 20 77 69 74 68  20 74 68 65 20 63 6f 6e  |tor with the con|
00002b10  74 65 6e 74 73 20 6f 66  20 26 46 45 33 34 20 61  |tents of &FE34 a|
00002b20  6e 64 20 73 74 6f 72 65  0d 74 68 65 20 61 63 63  |nd store.the acc|
00002b30  75 6d 75 6c 61 74 6f 72  20 69 6e 20 26 46 45 33  |umulator in &FE3|
00002b40  34 2e 20 49 66 20 79 6f  75 20 75 73 65 20 74 68  |4. If you use th|
00002b50  65 20 73 75 62 72 6f 75  74 69 6e 65 73 20 69 6c  |e subroutines il|
00002b60  6c 75 73 74 72 61 74 65  64 20 69 6e 0d 66 69 67  |lustrated in.fig|
00002b70  75 72 65 20 31 32 2e 33  20 74 68 65 20 70 61 67  |ure 12.3 the pag|
00002b80  65 64 20 6d 65 6d 6f 72  79 20 63 61 6e 20 62 65  |ed memory can be|
00002b90  20 73 77 69 74 63 68 65  64 20 69 6e 20 61 6e 64  | switched in and|
00002ba0  20 6f 75 74 20 6f 66 20  74 68 65 20 6d 61 69 6e  | out of the main|
00002bb0  0d 6d 65 6d 6f 72 79 20  6d 61 70 20 77 69 74 68  |.memory map with|
00002bc0  6f 75 74 20 61 6c 74 65  72 69 6e 67 20 61 6e 79  |out altering any|
00002bd0  20 6f 66 20 74 68 65 20  6f 74 68 65 72 20 62 69  | of the other bi|
00002be0  74 73 20 69 6e 20 74 68  65 20 70 61 67 65 64 20  |ts in the paged |
00002bf0  6d 65 6d 6f 72 79 0d 73  65 6c 65 63 74 20 72 65  |memory.select re|
00002c00  67 69 73 74 65 72 2e 0d  0d 0d 0d 0d 20 20 20 20  |gister......    |
00002c10  20 20 20 20 20 4a 53 52  20 70 61 67 65 69 6e 20  |     JSR pagein |
00002c20  20 20 20 20 20 5c 20 73  77 69 74 63 68 20 70 61  |     \ switch pa|
00002c30  67 65 64 20 77 6f 72 6b  73 70 61 63 65 20 69 6e  |ged workspace in|
00002c40  0d 20 20 20 20 20 20 20  20 20 4c 44 41 20 26 43  |.         LDA &C|
00002c50  30 30 30 20 20 20 20 20  20 20 5c 20 52 65 61 64  |000       \ Read|
00002c60  20 66 69 72 73 74 20 62  79 74 65 20 6f 66 20 61  | first byte of a|
00002c70  62 73 6f 6c 75 74 65 20  77 6f 72 6b 73 70 61 63  |bsolute workspac|
00002c80  65 0d 20 20 20 20 20 20  20 20 20 4a 53 52 20 70  |e.         JSR p|
00002c90  61 67 65 6f 75 74 20 20  20 20 20 5c 20 73 77 69  |ageout     \ swi|
00002ca0  74 63 68 20 70 61 67 65  64 20 77 6f 72 6b 73 70  |tch paged worksp|
00002cb0  61 63 65 20 6f 75 74 0d  20 20 20 20 20 20 20 20  |ace out.        |
00002cc0  20 20 2e 0d 20 20 20 20  20 20 20 20 20 20 2e 0d  |  ..          ..|
00002cd0  20 20 20 20 20 20 20 20  20 20 2e 0d 2e 70 61 67  |          ...pag|
00002ce0  65 69 6e 0d 20 20 20 20  20 20 20 20 20 50 48 41  |ein.         PHA|
00002cf0  0d 20 20 20 20 20 20 20  20 20 4c 44 41 20 23 38  |.         LDA #8|
00002d00  20 20 20 20 20 20 20 20  20 20 5c 20 30 30 30 30  |          \ 0000|
00002d10  20 31 30 30 30 20 62 69  6e 61 72 79 0d 20 20 20  | 1000 binary.   |
00002d20  20 20 20 20 20 20 4f 52  41 20 26 46 45 33 34 0d  |      ORA &FE34.|
00002d30  20 20 20 20 20 20 20 20  20 53 54 41 20 26 46 45  |         STA &FE|
00002d40  33 34 20 20 20 20 20 20  20 5c 20 73 65 74 20 62  |34       \ set b|
00002d50  69 74 20 33 20 6f 66 20  26 46 45 33 34 0d 20 20  |it 3 of &FE34.  |
00002d60  20 20 20 20 20 20 20 50  4c 41 20 20 20 20 20 20  |       PLA      |
00002d70  20 20 20 20 20 20 20 5c  20 72 65 73 74 6f 72 65  |       \ restore|
00002d80  20 61 63 63 75 6d 75 6c  61 74 6f 72 0d 20 20 20  | accumulator.   |
00002d90  20 20 20 20 20 20 52 54  53 0d 2e 70 61 67 65 6f  |      RTS..pageo|
00002da0  75 74 0d 20 20 20 20 20  20 20 20 20 50 48 41 0d  |ut.         PHA.|
00002db0  20 20 20 20 20 20 20 20  20 4c 44 41 20 23 26 46  |         LDA #&F|
00002dc0  37 20 20 20 20 20 20 20  20 5c 20 31 31 31 31 20  |7        \ 1111 |
00002dd0  30 31 31 31 20 62 69 6e  61 72 79 0d 20 20 20 20  |0111 binary.    |
00002de0  20 20 20 20 20 41 4e 44  20 26 46 45 33 34 0d 20  |     AND &FE34. |
00002df0  20 20 20 20 20 20 20 20  53 54 41 20 26 46 45 33  |        STA &FE3|
00002e00  34 20 20 20 20 20 20 20  5c 20 63 6c 65 61 72 20  |4       \ clear |
00002e10  62 69 74 20 33 20 6f 66  20 26 46 45 33 34 0d 20  |bit 3 of &FE34. |
00002e20  20 20 20 20 20 20 20 20  50 4c 41 20 20 20 20 20  |        PLA     |
00002e30  20 20 20 20 20 20 20 20  5c 20 72 65 73 74 6f 72  |        \ restor|
00002e40  65 20 61 63 63 75 6d 75  6c 61 74 6f 72 0d 20 20  |e accumulator.  |
00002e50  20 20 20 20 20 20 20 52  54 53 0d 0d 0d 46 69 67  |       RTS...Fig|
00002e60  75 72 65 20 31 32 2e 33  20 20 52 65 61 64 69 6e  |ure 12.3  Readin|
00002e70  67 20 70 61 67 65 64 20  61 62 73 6f 6c 75 74 65  |g paged absolute|
00002e80  20 77 6f 72 6b 73 70 61  63 65 20 6f 6e 20 74 68  | workspace on th|
00002e90  65 20 4d 61 73 74 65 72  2e 0d 2d 2d 2d 2d 2d 2d  |e Master..------|
00002ea0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002ed0  2d 2d 2d 2d 2d 0d 0d 20  20 46 69 67 75 72 65 20  |-----..  Figure |
00002ee0  31 32 2e 33 20 69 6c 6c  75 73 74 72 61 74 65 73  |12.3 illustrates|
00002ef0  20 68 6f 77 20 74 68 65  20 74 77 6f 20 73 75 62  | how the two sub|
00002f00  72 6f 75 74 69 6e 65 73  2c 20 70 61 67 65 69 6e  |routines, pagein|
00002f10  20 61 6e 64 20 70 61 67  65 6f 75 74 2c 0d 73 68  | and pageout,.sh|
00002f20  6f 75 6c 64 20 62 65 20  75 73 65 64 20 74 6f 20  |ould be used to |
00002f30  73 77 69 74 63 68 20 74  68 65 20 70 61 67 65 64  |switch the paged|
00002f40  20 6d 65 6d 6f 72 79 20  69 6e 20 61 6e 64 20 6f  | memory in and o|
00002f50  75 74 20 6f 66 20 74 68  65 20 6d 61 69 6e 0d 6d  |ut of the main.m|
00002f60  65 6d 6f 72 79 20 6d 61  70 20 77 68 65 6e 20 72  |emory map when r|
00002f70  65 61 64 69 6e 67 20 74  68 65 20 63 6f 6e 74 65  |eading the conte|
00002f80  6e 74 73 20 6f 66 20 74  68 65 20 70 61 67 65 64  |nts of the paged|
00002f90  20 6d 65 6d 6f 72 79 20  61 62 73 6f 6c 75 74 65  | memory absolute|
00002fa0  0d 77 6f 72 6b 73 70 61  63 65 20 69 6e 20 74 68  |.workspace in th|
00002fb0  65 20 4d 61 73 74 65 72  20 73 65 72 69 65 73 20  |e Master series |
00002fc0  63 6f 6d 70 75 74 65 72  73 2e 20 55 6e 6c 69 6b  |computers. Unlik|
00002fd0  65 20 70 72 69 76 61 74  65 20 77 6f 72 6b 73 70  |e private worksp|
00002fe0  61 63 65 2c 0d 61 62 73  6f 6c 75 74 65 20 77 6f  |ace,.absolute wo|
00002ff0  72 6b 73 70 61 63 65 20  61 6c 77 61 79 73 20 68  |rkspace always h|
00003000  61 73 20 61 20 66 69 78  65 64 20 73 74 61 72 74  |as a fixed start|
00003010  20 61 64 64 72 65 73 73  20 61 6e 64 20 63 61 6e  | address and can|
00003020  20 62 65 0d 61 64 64 72  65 73 73 65 64 20 64 69  | be.addressed di|
00003030  72 65 63 74 6c 79 2e 0d  0d 20 20 41 66 74 65 72  |rectly...  After|
00003040  20 73 77 69 74 63 68 69  6e 67 20 74 68 65 20 70  | switching the p|
00003050  61 67 65 64 20 6d 65 6d  6f 72 79 20 69 6e 74 6f  |aged memory into|
00003060  20 74 68 65 20 6d 61 69  6e 20 6d 65 6d 6f 72 79  | the main memory|
00003070  20 6d 61 70 20 79 6f 75  20 6d 75 73 74 0d 62 65  | map you must.be|
00003080  20 76 65 72 79 20 63 61  72 65 66 75 6c 20 61 62  | very careful ab|
00003090  6f 75 74 20 75 73 69 6e  67 20 4d 4f 53 20 73 75  |out using MOS su|
000030a0  62 72 6f 75 74 69 6e 65  73 20 62 65 63 61 75 73  |broutines becaus|
000030b0  65 20 74 68 65 20 62 6f  74 74 6f 6d 20 37 2e 32  |e the bottom 7.2|
000030c0  35 6b 0d 6f 66 20 74 68  65 20 4d 4f 53 20 68 61  |5k.of the MOS ha|
000030d0  73 20 62 65 65 6e 20 72  65 70 6c 61 63 65 64 20  |s been replaced |
000030e0  77 69 74 68 20 74 68 65  20 70 61 67 65 64 20 6d  |with the paged m|
000030f0  65 6d 6f 72 79 2e 20 59  6f 75 20 77 6f 75 6c 64  |emory. You would|
00003100  20 62 65 20 77 69 73 65  0d 6e 6f 74 20 74 6f 20  | be wise.not to |
00003110  75 73 65 20 74 68 65 20  4d 4f 53 20 61 74 20 61  |use the MOS at a|
00003120  6c 6c 20 75 6e 74 69 6c  20 69 74 20 68 61 73 20  |ll until it has |
00003130  62 65 65 6e 20 72 65 73  74 6f 72 65 64 20 62 79  |been restored by|
00003140  20 63 61 6c 6c 69 6e 67  0d 70 61 67 65 6f 75 74  | calling.pageout|
00003150  2e 0d 0d 20 20 54 68 65  20 22 6c 65 67 61 6c 22  |...  The "legal"|
00003160  20 75 73 65 20 6f 66 20  73 65 72 76 69 63 65 20  | use of service |
00003170  63 61 6c 6c 20 31 20 68  61 73 20 62 65 65 6e 20  |call 1 has been |
00003180  65 78 70 6c 61 69 6e 65  64 20 61 62 6f 76 65 20  |explained above |
00003190  62 75 74 20 61 0d 6d 75  63 68 20 6d 6f 72 65 20  |but a.much more |
000031a0  63 6f 6d 6d 6f 6e 20 22  69 6c 6c 65 67 61 6c 22  |common "illegal"|
000031b0  20 75 73 65 20 69 73 20  61 6c 73 6f 20 6d 61 64  | use is also mad|
000031c0  65 20 6f 66 20 74 68 69  73 20 73 65 72 76 69 63  |e of this servic|
000031d0  65 20 63 61 6c 6c 2e 0d  0d 20 20 4c 6f 6f 6b 20  |e call...  Look |
000031e0  61 67 61 69 6e 20 61 74  20 66 69 67 75 72 65 20  |again at figure |
000031f0  31 32 2e 31 2c 20 74 68  65 20 6c 69 73 74 20 6f  |12.1, the list o|
00003200  66 20 73 65 72 76 69 63  65 20 63 61 6c 6c 73 20  |f service calls |
00003210  69 73 73 75 65 64 20 61  66 74 65 72 0d 70 72 65  |issued after.pre|
00003220  73 73 69 6e 67 20 74 68  65 20 42 72 65 61 6b 20  |ssing the Break |
00003230  6b 65 79 2e 20 53 6f 6d  65 20 6f 66 20 74 68 65  |key. Some of the|
00003240  73 65 20 63 61 6c 6c 73  2c 20 69 6e 63 6c 75 64  |se calls, includ|
00003250  69 6e 67 20 73 65 72 76  69 63 65 20 63 61 6c 6c  |ing service call|
00003260  20 31 2c 0d 61 72 65 20  61 6c 77 61 79 73 20 69  | 1,.are always i|
00003270  73 73 75 65 64 20 6f 6e  20 74 68 65 20 42 42 43  |ssued on the BBC|
00003280  20 42 20 77 68 65 6e 20  74 68 65 20 42 72 65 61  | B when the Brea|
00003290  6b 20 6b 65 79 20 69 73  20 70 72 65 73 73 65 64  |k key is pressed|
000032a0  20 61 6e 64 20 61 6c 73  6f 0d 77 68 65 6e 20 74  | and also.when t|
000032b0  68 65 20 63 6f 6d 70 75  74 65 72 20 69 73 20 73  |he computer is s|
000032c0  77 69 74 63 68 65 64 20  6f 6e 2e 20 28 53 65 72  |witched on. (Ser|
000032d0  76 69 63 65 20 63 61 6c  6c 20 31 20 69 73 20 6f  |vice call 1 is o|
000032e0  6e 6c 79 20 69 73 73 75  65 64 20 6f 6e 0d 43 74  |nly issued on.Ct|
000032f0  72 6c 2d 42 72 65 61 6b  20 6f 6e 20 74 68 65 20  |rl-Break on the |
00003300  4d 61 73 74 65 72 20 62  75 74 20 73 65 72 76 69  |Master but servi|
00003310  63 65 20 63 61 6c 6c 20  26 46 45 20 63 61 6e 20  |ce call &FE can |
00003320  62 65 20 75 73 65 64 20  69 6e 73 74 65 61 64 0d  |be used instead.|
00003330  62 65 63 61 75 73 65 20  69 74 20 69 73 20 61 6c  |because it is al|
00003340  77 61 79 73 20 69 73 73  75 65 64 20 77 68 65 6e  |ways issued when|
00003350  20 74 68 65 20 42 72 65  61 6b 20 6b 65 79 20 69  | the Break key i|
00003360  73 20 70 72 65 73 73 65  64 20 6f 6e 20 74 68 65  |s pressed on the|
00003370  0d 4d 61 73 74 65 72 20  63 6f 6d 70 75 74 65 72  |.Master computer|
00003380  29 2e 20 53 65 72 76 69  63 65 20 63 61 6c 6c 20  |). Service call |
00003390  31 20 6f 72 20 73 65 72  76 69 63 65 20 63 61 6c  |1 or service cal|
000033a0  6c 20 26 46 45 20 63 61  6e 20 62 65 0d 69 6e 74  |l &FE can be.int|
000033b0  65 72 63 65 70 74 65 64  20 74 6f 20 63 61 72 72  |ercepted to carr|
000033c0  79 20 6f 75 74 20 61 6c  6d 6f 73 74 20 61 6e 79  |y out almost any|
000033d0  20 66 75 6e 63 74 69 6f  6e 20 72 65 71 75 69 72  | function requir|
000033e0  65 64 20 61 74 20 72 65  73 65 74 20 69 66 2c 20  |ed at reset if, |
000033f0  61 6e 64 0d 6f 6e 6c 79  20 69 66 2c 20 61 6c 6c  |and.only if, all|
00003400  20 74 68 65 20 72 65 67  69 73 74 65 72 73 20 61  | the registers a|
00003410  72 65 20 70 72 65 73 65  72 76 65 64 2e 0d 0d 20  |re preserved... |
00003420  20 49 6d 61 67 69 6e 65  2c 20 66 6f 72 20 65 78  | Imagine, for ex|
00003430  61 6d 70 6c 65 2c 20 74  68 61 74 20 79 6f 75 20  |ample, that you |
00003440  77 61 6e 74 20 74 68 65  20 76 69 64 65 6f 20 69  |want the video i|
00003450  6e 74 65 72 6c 61 63 65  20 74 6f 20 73 74 61 79  |nterlace to stay|
00003460  0d 73 77 69 74 63 68 65  64 20 6f 66 66 2e 20 59  |.switched off. Y|
00003470  6f 75 72 20 53 57 52 20  69 6e 74 65 72 70 72 65  |our SWR interpre|
00003480  74 65 72 20 63 6f 75 6c  64 20 69 6e 74 65 72 63  |ter could interc|
00003490  65 70 74 20 73 65 72 76  69 63 65 20 63 61 6c 6c  |ept service call|
000034a0  20 31 20 28 6f 72 0d 26  46 45 29 2c 20 70 75 73  | 1 (or.&FE), pus|
000034b0  68 20 61 6c 6c 20 74 68  65 20 72 65 67 69 73 74  |h all the regist|
000034c0  65 72 73 20 6f 6e 20 74  68 65 20 73 74 61 63 6b  |ers on the stack|
000034d0  2c 20 73 77 69 74 63 68  20 6f 66 66 20 74 68 65  |, switch off the|
000034e0  20 69 6e 74 65 72 6c 61  63 65 2c 0d 70 75 6c 6c  | interlace,.pull|
000034f0  20 61 6c 6c 20 74 68 65  20 72 65 67 69 73 74 65  | all the registe|
00003500  72 73 20 62 61 63 6b 20  6f 66 66 20 74 68 65 20  |rs back off the |
00003510  73 74 61 63 6b 20 61 6e  64 20 72 65 74 75 72 6e  |stack and return|
00003520  20 63 6f 6e 74 72 6f 6c  20 74 6f 20 74 68 65 0d  | control to the.|
00003530  4d 4f 53 2e 20 54 68 69  73 20 69 64 65 61 20 68  |MOS. This idea h|
00003540  61 73 20 62 65 65 6e 20  69 6d 70 6c 65 6d 65 6e  |as been implemen|
00003550  74 65 64 20 69 6e 20 74  68 65 20 70 72 6f 67 72  |ted in the progr|
00003560  61 6d 20 49 4e 54 4c 41  43 45 2e 0d 0d 20 20 4c  |am INTLACE...  L|
00003570  6f 61 64 20 74 68 65 20  6f 62 6a 65 63 74 20 63  |oad the object c|
00003580  6f 64 65 20 67 65 6e 65  72 61 74 65 64 20 62 79  |ode generated by|
00003590  20 49 4e 54 4c 41 43 45  20 69 6e 74 6f 20 53 57  | INTLACE into SW|
000035a0  52 2c 20 70 72 65 73 73  20 74 68 65 20 42 72 65  |R, press the Bre|
000035b0  61 6b 0d 6b 65 79 20 61  6e 64 20 73 65 6c 65 63  |ak.key and selec|
000035c0  74 20 4d 6f 64 65 20 36  2e 20 54 68 65 20 69 6e  |t Mode 6. The in|
000035d0  74 65 72 6c 61 63 65 20  77 69 6c 6c 20 72 65 6d  |terlace will rem|
000035e0  61 69 6e 20 73 77 69 74  63 68 65 64 20 6f 66 66  |ain switched off|
000035f0  20 75 6e 74 69 6c 0d 79  6f 75 20 73 65 6c 65 63  | until.you selec|
00003600  74 20 4d 6f 64 65 20 37  20 6f 72 20 70 72 65 73  |t Mode 7 or pres|
00003610  73 20 43 74 72 6c 2b 42  72 65 61 6b 2e 20 49 74  |s Ctrl+Break. It|
00003620  20 77 69 6c 6c 20 73 77  69 74 63 68 20 62 61 63  | will switch bac|
00003630  6b 20 6f 66 66 20 77 68  65 6e 0d 79 6f 75 20 6e  |k off when.you n|
00003640  65 78 74 20 73 65 6c 65  63 74 20 6f 6e 65 20 6f  |ext select one o|
00003650  66 20 74 68 65 20 6d 6f  64 65 73 20 30 2d 36 2e  |f the modes 0-6.|
00003660  0d 0d 20 20 54 68 69 73  20 74 79 70 65 20 6f 66  |..  This type of|
00003670  20 69 6c 6c 65 67 61 6c  20 75 73 65 20 6f 66 20  | illegal use of |
00003680  73 65 72 76 69 63 65 20  63 61 6c 6c 20 31 20 28  |service call 1 (|
00003690  6f 72 20 26 46 45 29 20  77 69 6c 6c 20 62 65 20  |or &FE) will be |
000036a0  75 73 65 64 0d 61 67 61  69 6e 20 69 6e 20 4d 6f  |used.again in Mo|
000036b0  64 75 6c 65 20 32 32 20  77 68 65 6e 20 64 65 73  |dule 22 when des|
000036c0  69 67 6e 69 6e 67 20 74  68 65 20 73 6f 66 74 77  |igning the softw|
000036d0  61 72 65 20 66 6f 72 20  61 75 74 6f 2d 62 6f 6f  |are for auto-boo|
000036e0  74 69 6e 67 20 72 6f 6d  0d 63 61 72 74 72 69 64  |ting rom.cartrid|
000036f0  67 65 73 20 69 73 20 63  6f 76 65 72 65 64 2e 20  |ges is covered. |
00003700  49 74 20 77 69 6c 6c 20  62 65 20 75 73 65 64 20  |It will be used |
00003710  74 68 65 6e 20 74 6f 20  65 6e 73 75 72 65 20 74  |then to ensure t|
00003720  68 61 74 20 74 68 65 20  72 6f 6d 0d 63 61 72 74  |hat the rom.cart|
00003730  72 69 64 67 65 20 69 73  20 61 6c 77 61 79 73 20  |ridge is always |
00003740  74 68 65 20 6c 61 6e 67  75 61 67 65 20 62 6f 6f  |the language boo|
00003750  74 65 64 20 61 66 74 65  72 20 61 20 73 6f 66 74  |ted after a soft|
00003760  20 72 65 73 65 74 2e 0d  0d 0d 0d 20 20 20 31 30  | reset.....   10|
00003770  20 52 45 4d 3a 20 49 4e  54 4c 41 43 45 0d 20 20  | REM: INTLACE.  |
00003780  20 32 30 20 4d 4f 44 45  37 0d 20 20 20 33 30 20  | 20 MODE7.   30 |
00003790  48 49 4d 45 4d 3d 26 33  43 30 30 0d 20 20 20 34  |HIMEM=&3C00.   4|
000037a0  30 20 44 49 4d 20 73 61  76 65 20 35 30 0d 20 20  |0 DIM save 50.  |
000037b0  20 35 30 20 64 69 66 66  3d 26 38 30 30 30 2d 48  | 50 diff=&8000-H|
000037c0  49 4d 45 4d 0d 20 20 20  36 30 20 6f 73 62 79 74  |IMEM.   60 osbyt|
000037d0  65 3d 26 46 46 46 34 0d  20 20 20 37 30 20 6f 73  |e=&FFF4.   70 os|
000037e0  63 6c 69 3d 26 46 46 46  37 0d 20 20 20 38 30 20  |cli=&FFF7.   80 |
000037f0  46 4f 52 20 70 61 73 73  20 3d 20 30 20 54 4f 20  |FOR pass = 0 TO |
00003800  32 20 53 54 45 50 20 32  0d 20 20 20 39 30 20 50  |2 STEP 2.   90 P|
00003810  25 3d 48 49 4d 45 4d 0d  20 20 31 30 30 20 5b 20  |%=HIMEM.  100 [ |
00003820  20 20 20 20 20 20 4f 50  54 20 70 61 73 73 0d 20  |      OPT pass. |
00003830  20 31 31 30 20 20 20 20  20 20 20 20 20 42 52 4b  | 110         BRK|
00003840  0d 20 20 31 32 30 20 20  20 20 20 20 20 20 20 42  |.  120         B|
00003850  52 4b 0d 20 20 31 33 30  20 20 20 20 20 20 20 20  |RK.  130        |
00003860  20 42 52 4b 0d 20 20 31  34 30 20 20 20 20 20 20  | BRK.  140      |
00003870  20 20 20 4a 4d 50 20 73  65 72 76 69 63 65 2b 64  |   JMP service+d|
00003880  69 66 66 0d 20 20 31 35  30 20 20 20 20 20 20 20  |iff.  150       |
00003890  20 20 4f 50 54 20 46 4e  65 71 75 62 28 26 38 32  |  OPT FNequb(&82|
000038a0  29 0d 20 20 31 36 30 20  20 20 20 20 20 20 20 20  |).  160         |
000038b0  4f 50 54 20 46 4e 65 71  75 62 28 28 63 6f 70 79  |OPT FNequb((copy|
000038c0  72 69 67 68 74 2b 64 69  66 66 29 20 4d 4f 44 20  |right+diff) MOD |
000038d0  32 35 36 29 0d 20 20 31  37 30 20 20 20 20 20 20  |256).  170      |
000038e0  20 20 20 42 52 4b 0d 20  20 31 38 30 20 20 20 20  |   BRK.  180    |
000038f0  20 20 20 20 20 4f 50 54  20 46 4e 65 71 75 73 28  |     OPT FNequs(|
00003900  22 49 4e 54 45 52 4c 41  43 45 22 29 0d 20 20 31  |"INTERLACE").  1|
00003910  39 30 20 2e 63 6f 70 79  72 69 67 68 74 0d 20 20  |90 .copyright.  |
00003920  32 30 30 20 20 20 20 20  20 20 20 20 42 52 4b 0d  |200         BRK.|
00003930  20 20 32 31 30 20 20 20  20 20 20 20 20 20 4f 50  |  210         OP|
00003940  54 20 46 4e 65 71 75 73  28 22 28 43 29 20 47 6f  |T FNequs("(C) Go|
00003950  72 64 6f 6e 20 48 6f 72  73 69 6e 67 74 6f 6e 20  |rdon Horsington |
00003960  31 39 38 37 22 29 0d 20  20 32 32 30 20 20 20 20  |1987").  220    |
00003970  20 20 20 20 20 42 52 4b  0d 20 20 32 33 30 20 2e  |     BRK.  230 .|
00003980  73 65 72 76 69 63 65 0d  20 20 32 34 30 20 20 20  |service.  240   |
00003990  20 20 20 20 20 20 43 4d  50 20 23 26 46 45 0d 20  |      CMP #&FE. |
000039a0  20 32 35 30 20 20 20 20  20 20 20 20 20 42 45 51  | 250         BEQ|
000039b0  20 61 75 74 6f 62 6f 6f  74 0d 20 20 32 36 30 20  | autoboot.  260 |
000039c0  20 20 20 20 20 20 20 20  52 54 53 0d 20 20 32 37  |        RTS.  27|
000039d0  30 20 2e 61 75 74 6f 62  6f 6f 74 0d 20 20 32 38  |0 .autoboot.  28|
000039e0  30 20 20 20 20 20 20 20  20 20 50 48 41 0d 20 20  |0         PHA.  |
000039f0  32 39 30 20 20 20 20 20  20 20 20 20 54 58 41 0d  |290         TXA.|
00003a00  20 20 33 30 30 20 20 20  20 20 20 20 20 20 50 48  |  300         PH|
00003a10  41 0d 20 20 33 31 30 20  20 20 20 20 20 20 20 20  |A.  310         |
00003a20  54 59 41 0d 20 20 33 32  30 20 20 20 20 20 20 20  |TYA.  320       |
00003a30  20 20 50 48 41 0d 20 20  33 33 30 20 20 20 20 20  |  PHA.  330     |
00003a40  20 20 20 20 4c 44 41 20  23 26 39 30 0d 20 20 33  |    LDA #&90.  3|
00003a50  34 30 20 20 20 20 20 20  20 20 20 4c 44 58 20 23  |40         LDX #|
00003a60  26 46 46 0d 20 20 33 35  30 20 20 20 20 20 20 20  |&FF.  350       |
00003a70  20 20 4c 44 59 20 23 31  0d 20 20 33 36 30 20 20  |  LDY #1.  360  |
00003a80  20 20 20 20 20 20 20 4a  53 52 20 6f 73 62 79 74  |       JSR osbyt|
00003a90  65 20 20 20 20 5c 20 2a  54 56 32 35 35 2c 31 0d  |e    \ *TV255,1.|
00003aa0  20 20 33 37 30 20 20 20  20 20 20 20 20 20 50 4c  |  370         PL|
00003ab0  41 0d 20 20 33 38 30 20  20 20 20 20 20 20 20 20  |A.  380         |
00003ac0  54 41 59 0d 20 20 33 39  30 20 20 20 20 20 20 20  |TAY.  390       |
00003ad0  20 20 50 4c 41 0d 20 20  34 30 30 20 20 20 20 20  |  PLA.  400     |
00003ae0  20 20 20 20 54 41 58 0d  20 20 34 31 30 20 20 20  |    TAX.  410   |
00003af0  20 20 20 20 20 20 50 4c  41 0d 20 20 34 32 30 20  |      PLA.  420 |
00003b00  20 20 20 20 20 20 20 20  52 54 53 0d 20 20 34 33  |        RTS.  43|
00003b10  30 20 2e 6c 61 73 74 62  79 74 65 0d 20 20 34 34  |0 .lastbyte.  44|
00003b20  30 20 5d 0d 20 20 34 35  30 20 4e 45 58 54 0d 20  |0 ].  450 NEXT. |
00003b30  20 34 36 30 20 49 4e 50  55 54 27 22 53 61 76 65  | 460 INPUT'"Save|
00003b40  20 66 69 6c 65 6e 61 6d  65 20 3d 20 22 66 69 6c  | filename = "fil|
00003b50  65 6e 61 6d 65 24 0d 20  20 34 37 30 20 49 46 20  |ename$.  470 IF |
00003b60  66 69 6c 65 6e 61 6d 65  24 3d 22 22 20 45 4e 44  |filename$="" END|
00003b70  0d 20 20 34 38 30 20 24  73 61 76 65 3d 22 53 41  |.  480 $save="SA|
00003b80  56 45 20 22 2b 66 69 6c  65 6e 61 6d 65 24 2b 22  |VE "+filename$+"|
00003b90  20 22 2b 53 54 52 24 7e  28 48 49 4d 45 4d 29 2b  | "+STR$~(HIMEM)+|
00003ba0  22 20 22 2b 53 54 52 24  7e 28 6c 61 73 0d 20 20  |" "+STR$~(las.  |
00003bb0  20 20 20 20 74 62 79 74  65 29 2b 22 20 46 46 46  |    tbyte)+" FFF|
00003bc0  46 38 30 30 30 20 46 46  46 46 38 30 30 30 22 0d  |F8000 FFFF8000".|
00003bd0  20 20 34 39 30 20 58 25  3d 73 61 76 65 20 4d 4f  |  490 X%=save MO|
00003be0  44 20 32 35 36 0d 20 20  35 30 30 20 59 25 3d 73  |D 256.  500 Y%=s|
00003bf0  61 76 65 20 44 49 56 20  32 35 36 0d 20 20 35 31  |ave DIV 256.  51|
00003c00  30 20 2a 4f 50 54 31 2c  32 0d 20 20 35 32 30 20  |0 *OPT1,2.  520 |
00003c10  43 41 4c 4c 20 6f 73 63  6c 69 0d 20 20 35 33 30  |CALL oscli.  530|
00003c20  20 2a 4f 50 54 31 2c 30  0d 20 20 35 34 30 20 45  | *OPT1,0.  540 E|
00003c30  4e 44 0d 20 20 35 35 30  20 44 45 46 46 4e 65 71  |ND.  550 DEFFNeq|
00003c40  75 62 28 62 79 74 65 29  0d 20 20 35 36 30 20 3f  |ub(byte).  560 ?|
00003c50  50 25 3d 62 79 74 65 0d  20 20 35 37 30 20 50 25  |P%=byte.  570 P%|
00003c60  3d 50 25 2b 31 0d 20 20  35 38 30 20 3d 70 61 73  |=P%+1.  580 =pas|
00003c70  73 0d 20 20 35 39 30 20  44 45 46 46 4e 65 71 75  |s.  590 DEFFNequ|
00003c80  77 28 77 6f 72 64 29 0d  20 20 36 30 30 20 3f 50  |w(word).  600 ?P|
00003c90  25 3d 77 6f 72 64 20 4d  4f 44 20 32 35 36 0d 20  |%=word MOD 256. |
00003ca0  20 36 31 30 20 50 25 3f  31 3d 77 6f 72 64 20 44  | 610 P%?1=word D|
00003cb0  49 56 20 32 35 36 0d 20  20 36 32 30 20 50 25 3d  |IV 256.  620 P%=|
00003cc0  50 25 2b 32 0d 20 20 36  33 30 20 3d 70 61 73 73  |P%+2.  630 =pass|
00003cd0  0d 20 20 36 34 30 20 44  45 46 46 4e 65 71 75 64  |.  640 DEFFNequd|
00003ce0  28 64 6f 75 62 6c 65 29  0d 20 20 36 35 30 20 21  |(double).  650 !|
00003cf0  50 25 3d 64 6f 75 62 6c  65 0d 20 20 36 36 30 20  |P%=double.  660 |
00003d00  50 25 3d 50 25 2b 34 0d  20 20 36 37 30 20 3d 70  |P%=P%+4.  670 =p|
00003d10  61 73 73 0d 20 20 36 38  30 20 44 45 46 46 4e 65  |ass.  680 DEFFNe|
00003d20  71 75 73 28 73 74 72 69  6e 67 24 29 0d 20 20 36  |qus(string$).  6|
00003d30  39 30 20 24 50 25 3d 73  74 72 69 6e 67 24 0d 20  |90 $P%=string$. |
00003d40  20 37 30 30 20 50 25 3d  50 25 2b 4c 45 4e 28 73  | 700 P%=P%+LEN(s|
00003d50  74 72 69 6e 67 24 29 0d  20 20 37 31 30 20 3d 70  |tring$).  710 =p|
00003d60  61 73 73 0d                                       |ass.|
00003d64
26-09-88/T\SWR12.m0
26-09-88/T\SWR12.m1
26-09-88/T\SWR12.m2
26-09-88/T\SWR12.m4
26-09-88/T\SWR12.m5