Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_10.ADF » ASSEM1

ASSEM1

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 » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_10.ADF
Filename: ASSEM1
Read OK:
File size: 1CAC bytes
Load address: FFFF1D00
Exec address: FFFF8023
File contents
   10MODE3:VDU23,1,1;0;0;0;:VDU14:PRINT''"PRESS <SHIFT> TO SCROLL"'':PROCtext
   20PRINT''"PLEASE PRESS <P> TO PRINT TEXT, <L> TO LOAD PROGRAM, <M> FOR MAIN MENU"
   30REPEAT:UNTIL GET$="P" OR GET$="L" OR GET$="M"
   40IF GET$="M" THEN CHAIN"$.MENU"
   50IF GET$="L" THEN CHAIN"$.ASSEM2"
   60VDU15:VDU2:PROCtext:VDU3
   70CHAIN"$.MENU"
   80END
   90DEF PROCtext
  100PRINT"U S I N G   T H E   A S S E M B L E R   L A N G U A G E - PART SEVEN"'"********************************************************************"'
  110PRINT"Post-Index (full name Post-Indexed Indirect) addressing is one form of"
  120PRINT"assembly addressing,  Page 207 of the handbook has a paragraph devoted  to"
  130PRINT"Post Index.  Looking back at Part Five a line was added to  PROCconstants"
  140PRINT"to declare address &70 as ""temp"" and at line 207 there is  LDA(temp),Y"
  150PRINT"that is a Post-Index statement.  Post-Index may only use a  zero page"
  160PRINT"address and the Y register.   The electron needs to locate a  two byte"
  170PRINT"address, so that it may load data stored at that address into  the"
  180PRINT"accumulator.  Targetting or pointing to an exact location in memory  is"
  190PRINT"""addressing"", ""Him over there"", ""Her as should know better"" are also"
  200PRINT"forms of addressing but the electron not being blessed with human  powers"
  210PRINT"of deduction needs a specific instruction in a predetermined  format."
  220PRINT
  230PRINT"In our orginal program the label ""data"" is an address, if the statement"
  240PRINT"LDA data MOD256:STAtemp were to be written, RUN and then CALLed the low" 
  250PRINT"byte of data would be stored in &70 which had been declared as ""temp"",  if"
  260PRINT"a further statement LDA data DIV256:STAtemp+1 had also recieved the  same"
  270PRINT"treatment the high byte of ""data"" would be stored in &70+1 = &71   the"
  280PRINT"capital Y is of course the Y register."
  290PRINT
  300PRINT"Imagine that ""data"" was the label for address &2000 and that the value in"
  310PRINT"the Y register was four, then  temp (&70) would hold the value &00 and" 
  320PRINT"temp+1 (&71) would hold the value &20 the statement LDA (temp),Y would" 
  330PRINT"load the accumulator with the content of address &2000+4 = &2004.  If  the"
  340PRINT"value in the Y register were to be decimal 12 the content of address" 
  350PRINT"&200C would be loaded into the accumulator."
  360PRINT
  370PRINT"Why not just load the low byte of data into &70 and the high byte into"
  380PRINT"&71 direct and index it to Y.  The post index statement would then be  LDA"
  390PRINT"(&70),Y.  No reason except that zero page locations are in short  supply." 
  400PRINT"To designate two of them as temp and use them only as temporary  storage"
  410PRINT"areas, prevents having to look back over lines of source code  to find a"
  420PRINT"free zero page address.  Why use this method at all?  The  answer to that"
  430PRINT"is ""Our address is on the stack in two bytes"".  The  orginal ""data"" is a"
  440PRINT"label and a label may be indexed with either the X  or Y register.  Using"
  450PRINT"PROCprt a single multi-user print routine, and  jumping to it with JSRprt"
  460PRINT"causes ""data"" to be stored on the stack in  two bytes.  That is ideal for"
  470PRINT"Post-Index just pull the values and store  them in temp and temp+1."
  480PRINT
  490PRINT"Imagine that a program requires blocks of data to be stored or  retrieved." 
  500PRINT"Then a table for storing those addresses is very useful and  in some cases"
  510PRINT"totally necessary."
  520PRINT
  530PRINT"To store the address in the table, the low byte would be placed in temp" 
  540PRINT"and the high byte in temp+1 and in the same way the high and low bytes  of"
  550PRINT"table would need to be stored in two more zero page addresses say  loc and"
  560PRINT"loc+1 (location)"
  570PRINT
  580PRINT"Then the statement LDA(temp),Y:STA(loc),Y:INY:LDA(temp),Y:STA(loc),Y"  
  590PRINT"would place the address into successive bytes in the table.  Consider" 
  600PRINT"that situation, by manipulating the value in the Y register ten  addresses"
  610PRINT"with a common high byte could be stored in eleven bytes  instead of"
  620PRINT"twenty.  The high byte would be stored  at the base of the  table, after"
  630PRINT"retrieving the high byte with Y set to zero Y would then  be set to the"
  640PRINT"offset for the particular low byte required (a value  between two and"
  650PRINT"eleven) and the low byte retrieved."
  660PRINT
  670PRINT"Take that further if the blocks of data were stable and did not move"
  680PRINT"about in memory then the high byte need not be stored at all.  The zero" 
  690PRINT"page temp+1 could be loaded absolute with the high byte" 
  700PRINT"LDA#&20:STAtemp+1.  Not elegant coding but needs must when the devil" 
  710PRINT"wills.  Thirty kilobyte of user RAM is not a lot."
  720PRINT
  730PRINT"To sum up the syntax of LDA(temp),Y activates a routine in the 6502 chip" 
  740PRINT"that adds the low byte of an address to the high byte then adds the" 
  750PRINT"content of the Y register to give a final sixteen bit address."
  760PRINT
  770PRINT"Reverse colour text window?  How did it go? My code is listed below."
  780PRINT"Load the program and alter it to my listing, PROCconstants has been" 
  790PRINT"altered slightly, merely to give us more control of the program. PROCprt"
  800PRINT"no changes."
  810PRINT
  820PRINT"PROCdata has altered the labels indicate the action of the code. Line  380"
  830PRINT"clears the screen with a VDU12.  Colours are reversed at Line 390  where"
  840PRINT"EQUD is introduced, four EQUBs might have been used EQUB17:EQUB0  would"
  850PRINT"have given a black foreground and EQUB17:EQUB129 white  background."
  860PRINT
  870PRINT"Remember the Acorn routine at &FFEE3 reads and understands the control"
  880PRINT"codes (Appendix F of the handbook)."
  890PRINT
  900PRINT"EQUD is neater and saves some typing but both EQUD and EQUW only accept" 
  910PRINT"hexidecimal numbers, worse they insist that the numbers are in reverse" 
  920PRINT"order.  At first sight line 390 is very confusing but divide it into  four"
  930PRINT"bytes, (use a scrap of paper) ""&81""  ""&11"" ""&00"" ""&11"" now ask  your"
  940PRINT"computer PRINT &81 the answer is 129 write it under the &81 do the  same"
  950PRINT"with the others.  Answer ""129"" ""17"" ""0"" ""17"" reading from right to  left"
  960PRINT"(Backwards) ""17"" ""0"" (black foreground) ""17"" ""129"" (white  background)."
  970PRINT
  980PRINT"Line 400 is different, the text window needs five bytes, the last byte  of"
  990PRINT"the EQUD statement is &1C 16+12=28 (VDU28) the next the left hand  edge of"
 1000PRINT"the window ""0"" then the bottom edge ""2""  (0,1,2) 0 is a number  to the"
 1010PRINT"computer so ""2"" gives three lines deep. &27 2x16+7=39 sets the  right hand"
 1020PRINT"edge. Tucked on the end is an EQUB0 which sets the top edge.   410 clears"
 1030PRINT"the screen within the text window.  420 EQUW&081F; &1F  equals 31 (VDU31)"
 1040PRINT"&08 for column eight and the EQUB1 line number 1.  line 440 returns the"
 1050PRINT"colours to standard and 450 window off. 460 tabs  the cursor to column"
 1060PRINT"zero line fifteen and the routine concludes with  &FF."
 1070PRINT
 1080PRINT"EQUB, EQUW and EQUD are all used for inserting numbers into assembly  code"
 1090PRINT"they are basic statements that may only be used in assembly  language"
 1100PRINT"source code.  EQUB inserts a single byte, EQUW a word (two  bytes) and"
 1110PRINT"EQUD inserts a double word (four bytes)."
 1120PRINT
 1130PRINT"Next time start%, base% and scrn1 will be used to save the object code"
 1140PRINT"plus if space permits an OSBYTE call to the operating system."
 1150PRINT"**********************************************************************"
 1160PRINT"PLEASE NOTE: THE LISTING IS SAVED AS A PROGRAM ON THE DISC AS $.ASSEM2"
 1170PRINT"**********************************************************************" 
 1180ENDPROC

>�3:�23,1,1;0;0;0;:�14:�''"PRESS <SHIFT> TO SCROLL"'':�text
O�''"PLEASE PRESS <P> TO PRINT TEXT, <L> TO LOAD PROGRAM, <M> FOR MAIN MENU"
�:� �="P" � �="L" � �="M"
(� �="M" � �"$.MENU"
2� �="L" � �"$.ASSEM2"
<�15:�2:�text:�3
F
�"$.MENU"
P�
Z� �text
d��"U S I N G   T H E   A S S E M B L E R   L A N G U A G E - PART SEVEN"'"********************************************************************"'
nM�"Post-Index (full name Post-Indexed Indirect) addressing is one form of"
xQ�"assembly addressing,  Page 207 of the handbook has a paragraph devoted  to"
�P�"Post Index.  Looking back at Part Five a line was added to  PROCconstants"
�O�"to declare address &70 as ""temp"" and at line 207 there is  LDA(temp),Y"
�L�"that is a Post-Index statement.  Post-Index may only use a  zero page"
�M�"address and the Y register.   The electron needs to locate a  two byte"
�I�"address, so that it may load data stored at that address into  the"
�N�"accumulator.  Targetting or pointing to an exact location in memory  is"
�Q�"""addressing"", ""Him over there"", ""Her as should know better"" are also"
�P�"forms of addressing but the electron not being blessed with human  powers"
�L�"of deduction needs a specific instruction in a predetermined  format."
��
�P�"In our orginal program the label ""data"" is an address, if the statement"
�O�"LDA data MOD256:STAtemp were to be written, RUN and then CALLed the low" 
�S�"byte of data would be stored in &70 which had been declared as ""temp"",  if"
P�"a further statement LDA data DIV256:STAtemp+1 had also recieved the  same"
O�"treatment the high byte of ""data"" would be stored in &70+1 = &71   the"
-�"capital Y is of course the Y register."
"�
,R�"Imagine that ""data"" was the label for address &2000 and that the value in"
6N�"the Y register was four, then  temp (&70) would hold the value &00 and" 
@N�"temp+1 (&71) would hold the value &20 the statement LDA (temp),Y would" 
JQ�"load the accumulator with the content of address &2000+4 = &2004.  If  the"
TL�"value in the Y register were to be decimal 12 the content of address" 
^2�"&200C would be loaded into the accumulator."
h�
rM�"Why not just load the low byte of data into &70 and the high byte into"
|Q�"&71 direct and index it to Y.  The post index statement would then be  LDA"
�Q�"(&70),Y.  No reason except that zero page locations are in short  supply." 
�O�"To designate two of them as temp and use them only as temporary  storage"
�O�"areas, prevents having to look back over lines of source code  to find a"
�P�"free zero page address.  Why use this method at all?  The  answer to that"
�S�"is ""Our address is on the stack in two bytes"".  The  orginal ""data"" is a"
�P�"label and a label may be indexed with either the X  or Y register.  Using"
�P�"PROCprt a single multi-user print routine, and  jumping to it with JSRprt"
�R�"causes ""data"" to be stored on the stack in  two bytes.  That is ideal for"
�J�"Post-Index just pull the values and store  them in temp and temp+1."
��
�R�"Imagine that a program requires blocks of data to be stored or  retrieved." 
�Q�"Then a table for storing those addresses is very useful and  in some cases"
��"totally necessary."
�
O�"To store the address in the table, the low byte would be placed in temp" 
Q�"and the high byte in temp+1 and in the same way the high and low bytes  of"
&Q�"table would need to be stored in two more zero page addresses say  loc and"
0�"loc+1 (location)"
:�
DM�"Then the statement LDA(temp),Y:STA(loc),Y:INY:LDA(temp),Y:STA(loc),Y"  
NM�"would place the address into successive bytes in the table.  Consider" 
XQ�"that situation, by manipulating the value in the Y register ten  addresses"
bJ�"with a common high byte could be stored in eleven bytes  instead of"
lO�"twenty.  The high byte would be stored  at the base of the  table, after"
vN�"retrieving the high byte with Y set to zero Y would then  be set to the"
�L�"offset for the particular low byte required (a value  between two and"
�*�"eleven) and the low byte retrieved."
��
�K�"Take that further if the blocks of data were stable and did not move"
�O�"about in memory then the high byte need not be stored at all.  The zero" 
�?�"page temp+1 could be loaded absolute with the high byte" 
�L�"LDA#&20:STAtemp+1.  Not elegant coding but needs must when the devil" 
�8�"wills.  Thirty kilobyte of user RAM is not a lot."
��
�P�"To sum up the syntax of LDA(temp),Y activates a routine in the 6502 chip" 
�K�"that adds the low byte of an address to the high byte then adds the" 
�E�"content of the Y register to give a final sixteen bit address."
��
K�"Reverse colour text window?  How did it go? My code is listed below."
K�"Load the program and alter it to my listing, PROCconstants has been" 
O�"altered slightly, merely to give us more control of the program. PROCprt"
 �"no changes."
*�
4Q�"PROCdata has altered the labels indicate the action of the code. Line  380"
>O�"clears the screen with a VDU12.  Colours are reversed at Line 390  where"
HN�"EQUD is introduced, four EQUBs might have been used EQUB17:EQUB0  would"
RJ�"have given a black foreground and EQUB17:EQUB129 white  background."
\�
fM�"Remember the Acorn routine at &FFEE3 reads and understands the control"
p*�"codes (Appendix F of the handbook)."
z�
�O�"EQUD is neater and saves some typing but both EQUD and EQUW only accept" 
�N�"hexidecimal numbers, worse they insist that the numbers are in reverse" 
�Q�"order.  At first sight line 390 is very confusing but divide it into  four"
�S�"bytes, (use a scrap of paper) ""&81""  ""&11"" ""&00"" ""&11"" now ask  your"
�O�"computer PRINT &81 the answer is 129 write it under the &81 do the  same"
�W�"with the others.  Answer ""129"" ""17"" ""0"" ""17"" reading from right to  left"
�V�"(Backwards) ""17"" ""0"" (black foreground) ""17"" ""129"" (white  background)."
��
�Q�"Line 400 is different, the text window needs five bytes, the last byte  of"
�Q�"the EQUD statement is &1C 16+12=28 (VDU28) the next the left hand  edge of"
�Q�"the window ""0"" then the bottom edge ""2""  (0,1,2) 0 is a number  to the"
�S�"computer so ""2"" gives three lines deep. &27 2x16+7=39 sets the  right hand"
�P�"edge. Tucked on the end is an EQUB0 which sets the top edge.   410 clears"
P�"the screen within the text window.  420 EQUW&081F; &1F  equals 31 (VDU31)"
N�"&08 for column eight and the EQUB1 line number 1.  line 440 returns the"
M�"colours to standard and 450 window off. 460 tabs  the cursor to column"
$=�"zero line fifteen and the routine concludes with  &FF."
.�
8Q�"EQUB, EQUW and EQUD are all used for inserting numbers into assembly  code"
BL�"they are basic statements that may only be used in assembly  language"
LM�"source code.  EQUB inserts a single byte, EQUW a word (two  bytes) and"
V/�"EQUD inserts a double word (four bytes)."
`�
jM�"Next time start%, base% and scrn1 will be used to save the object code"
tD�"plus if space permits an OSBYTE call to the operating system."
~M�"**********************************************************************"
�M�"PLEASE NOTE: THE LISTING IS SAVED AS A PROGRAM ON THE DISC AS $.ASSEM2"
�N�"**********************************************************************" 
��
�
00000000  0d 00 0a 3e eb 33 3a ef  32 33 2c 31 2c 31 3b 30  |...>.3:.23,1,1;0|
00000010  3b 30 3b 30 3b 3a ef 31  34 3a f1 27 27 22 50 52  |;0;0;:.14:.''"PR|
00000020  45 53 53 20 3c 53 48 49  46 54 3e 20 54 4f 20 53  |ESS <SHIFT> TO S|
00000030  43 52 4f 4c 4c 22 27 27  3a f2 74 65 78 74 0d 00  |CROLL"'':.text..|
00000040  14 4f f1 27 27 22 50 4c  45 41 53 45 20 50 52 45  |.O.''"PLEASE PRE|
00000050  53 53 20 3c 50 3e 20 54  4f 20 50 52 49 4e 54 20  |SS <P> TO PRINT |
00000060  54 45 58 54 2c 20 3c 4c  3e 20 54 4f 20 4c 4f 41  |TEXT, <L> TO LOA|
00000070  44 20 50 52 4f 47 52 41  4d 2c 20 3c 4d 3e 20 46  |D PROGRAM, <M> F|
00000080  4f 52 20 4d 41 49 4e 20  4d 45 4e 55 22 0d 00 1e  |OR MAIN MENU"...|
00000090  1d f5 3a fd 20 be 3d 22  50 22 20 84 20 be 3d 22  |..:. .="P" . .="|
000000a0  4c 22 20 84 20 be 3d 22  4d 22 0d 00 28 17 e7 20  |L" . .="M"..(.. |
000000b0  be 3d 22 4d 22 20 8c 20  d7 22 24 2e 4d 45 4e 55  |.="M" . ."$.MENU|
000000c0  22 0d 00 32 19 e7 20 be  3d 22 4c 22 20 8c 20 d7  |"..2.. .="L" . .|
000000d0  22 24 2e 41 53 53 45 4d  32 22 0d 00 3c 13 ef 31  |"$.ASSEM2"..<..1|
000000e0  35 3a ef 32 3a f2 74 65  78 74 3a ef 33 0d 00 46  |5:.2:.text:.3..F|
000000f0  0d d7 22 24 2e 4d 45 4e  55 22 0d 00 50 05 e0 0d  |.."$.MENU"..P...|
00000100  00 5a 0b dd 20 f2 74 65  78 74 0d 00 64 93 f1 22  |.Z.. .text..d.."|
00000110  55 20 53 20 49 20 4e 20  47 20 20 20 54 20 48 20  |U S I N G   T H |
00000120  45 20 20 20 41 20 53 20  53 20 45 20 4d 20 42 20  |E   A S S E M B |
00000130  4c 20 45 20 52 20 20 20  4c 20 41 20 4e 20 47 20  |L E R   L A N G |
00000140  55 20 41 20 47 20 45 20  2d 20 50 41 52 54 20 53  |U A G E - PART S|
00000150  45 56 45 4e 22 27 22 2a  2a 2a 2a 2a 2a 2a 2a 2a  |EVEN"'"*********|
00000160  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000190  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 22 27 0d 00 6e  |***********"'..n|
000001a0  4d f1 22 50 6f 73 74 2d  49 6e 64 65 78 20 28 66  |M."Post-Index (f|
000001b0  75 6c 6c 20 6e 61 6d 65  20 50 6f 73 74 2d 49 6e  |ull name Post-In|
000001c0  64 65 78 65 64 20 49 6e  64 69 72 65 63 74 29 20  |dexed Indirect) |
000001d0  61 64 64 72 65 73 73 69  6e 67 20 69 73 20 6f 6e  |addressing is on|
000001e0  65 20 66 6f 72 6d 20 6f  66 22 0d 00 78 51 f1 22  |e form of"..xQ."|
000001f0  61 73 73 65 6d 62 6c 79  20 61 64 64 72 65 73 73  |assembly address|
00000200  69 6e 67 2c 20 20 50 61  67 65 20 32 30 37 20 6f  |ing,  Page 207 o|
00000210  66 20 74 68 65 20 68 61  6e 64 62 6f 6f 6b 20 68  |f the handbook h|
00000220  61 73 20 61 20 70 61 72  61 67 72 61 70 68 20 64  |as a paragraph d|
00000230  65 76 6f 74 65 64 20 20  74 6f 22 0d 00 82 50 f1  |evoted  to"...P.|
00000240  22 50 6f 73 74 20 49 6e  64 65 78 2e 20 20 4c 6f  |"Post Index.  Lo|
00000250  6f 6b 69 6e 67 20 62 61  63 6b 20 61 74 20 50 61  |oking back at Pa|
00000260  72 74 20 46 69 76 65 20  61 20 6c 69 6e 65 20 77  |rt Five a line w|
00000270  61 73 20 61 64 64 65 64  20 74 6f 20 20 50 52 4f  |as added to  PRO|
00000280  43 63 6f 6e 73 74 61 6e  74 73 22 0d 00 8c 4f f1  |Cconstants"...O.|
00000290  22 74 6f 20 64 65 63 6c  61 72 65 20 61 64 64 72  |"to declare addr|
000002a0  65 73 73 20 26 37 30 20  61 73 20 22 22 74 65 6d  |ess &70 as ""tem|
000002b0  70 22 22 20 61 6e 64 20  61 74 20 6c 69 6e 65 20  |p"" and at line |
000002c0  32 30 37 20 74 68 65 72  65 20 69 73 20 20 4c 44  |207 there is  LD|
000002d0  41 28 74 65 6d 70 29 2c  59 22 0d 00 96 4c f1 22  |A(temp),Y"...L."|
000002e0  74 68 61 74 20 69 73 20  61 20 50 6f 73 74 2d 49  |that is a Post-I|
000002f0  6e 64 65 78 20 73 74 61  74 65 6d 65 6e 74 2e 20  |ndex statement. |
00000300  20 50 6f 73 74 2d 49 6e  64 65 78 20 6d 61 79 20  | Post-Index may |
00000310  6f 6e 6c 79 20 75 73 65  20 61 20 20 7a 65 72 6f  |only use a  zero|
00000320  20 70 61 67 65 22 0d 00  a0 4d f1 22 61 64 64 72  | page"...M."addr|
00000330  65 73 73 20 61 6e 64 20  74 68 65 20 59 20 72 65  |ess and the Y re|
00000340  67 69 73 74 65 72 2e 20  20 20 54 68 65 20 65 6c  |gister.   The el|
00000350  65 63 74 72 6f 6e 20 6e  65 65 64 73 20 74 6f 20  |ectron needs to |
00000360  6c 6f 63 61 74 65 20 61  20 20 74 77 6f 20 62 79  |locate a  two by|
00000370  74 65 22 0d 00 aa 49 f1  22 61 64 64 72 65 73 73  |te"...I."address|
00000380  2c 20 73 6f 20 74 68 61  74 20 69 74 20 6d 61 79  |, so that it may|
00000390  20 6c 6f 61 64 20 64 61  74 61 20 73 74 6f 72 65  | load data store|
000003a0  64 20 61 74 20 74 68 61  74 20 61 64 64 72 65 73  |d at that addres|
000003b0  73 20 69 6e 74 6f 20 20  74 68 65 22 0d 00 b4 4e  |s into  the"...N|
000003c0  f1 22 61 63 63 75 6d 75  6c 61 74 6f 72 2e 20 20  |."accumulator.  |
000003d0  54 61 72 67 65 74 74 69  6e 67 20 6f 72 20 70 6f  |Targetting or po|
000003e0  69 6e 74 69 6e 67 20 74  6f 20 61 6e 20 65 78 61  |inting to an exa|
000003f0  63 74 20 6c 6f 63 61 74  69 6f 6e 20 69 6e 20 6d  |ct location in m|
00000400  65 6d 6f 72 79 20 20 69  73 22 0d 00 be 51 f1 22  |emory  is"...Q."|
00000410  22 22 61 64 64 72 65 73  73 69 6e 67 22 22 2c 20  |""addressing"", |
00000420  22 22 48 69 6d 20 6f 76  65 72 20 74 68 65 72 65  |""Him over there|
00000430  22 22 2c 20 22 22 48 65  72 20 61 73 20 73 68 6f  |"", ""Her as sho|
00000440  75 6c 64 20 6b 6e 6f 77  20 62 65 74 74 65 72 22  |uld know better"|
00000450  22 20 61 72 65 20 61 6c  73 6f 22 0d 00 c8 50 f1  |" are also"...P.|
00000460  22 66 6f 72 6d 73 20 6f  66 20 61 64 64 72 65 73  |"forms of addres|
00000470  73 69 6e 67 20 62 75 74  20 74 68 65 20 65 6c 65  |sing but the ele|
00000480  63 74 72 6f 6e 20 6e 6f  74 20 62 65 69 6e 67 20  |ctron not being |
00000490  62 6c 65 73 73 65 64 20  77 69 74 68 20 68 75 6d  |blessed with hum|
000004a0  61 6e 20 20 70 6f 77 65  72 73 22 0d 00 d2 4c f1  |an  powers"...L.|
000004b0  22 6f 66 20 64 65 64 75  63 74 69 6f 6e 20 6e 65  |"of deduction ne|
000004c0  65 64 73 20 61 20 73 70  65 63 69 66 69 63 20 69  |eds a specific i|
000004d0  6e 73 74 72 75 63 74 69  6f 6e 20 69 6e 20 61 20  |nstruction in a |
000004e0  70 72 65 64 65 74 65 72  6d 69 6e 65 64 20 20 66  |predetermined  f|
000004f0  6f 72 6d 61 74 2e 22 0d  00 dc 05 f1 0d 00 e6 50  |ormat."........P|
00000500  f1 22 49 6e 20 6f 75 72  20 6f 72 67 69 6e 61 6c  |."In our orginal|
00000510  20 70 72 6f 67 72 61 6d  20 74 68 65 20 6c 61 62  | program the lab|
00000520  65 6c 20 22 22 64 61 74  61 22 22 20 69 73 20 61  |el ""data"" is a|
00000530  6e 20 61 64 64 72 65 73  73 2c 20 69 66 20 74 68  |n address, if th|
00000540  65 20 73 74 61 74 65 6d  65 6e 74 22 0d 00 f0 4f  |e statement"...O|
00000550  f1 22 4c 44 41 20 64 61  74 61 20 4d 4f 44 32 35  |."LDA data MOD25|
00000560  36 3a 53 54 41 74 65 6d  70 20 77 65 72 65 20 74  |6:STAtemp were t|
00000570  6f 20 62 65 20 77 72 69  74 74 65 6e 2c 20 52 55  |o be written, RU|
00000580  4e 20 61 6e 64 20 74 68  65 6e 20 43 41 4c 4c 65  |N and then CALLe|
00000590  64 20 74 68 65 20 6c 6f  77 22 20 0d 00 fa 53 f1  |d the low" ...S.|
000005a0  22 62 79 74 65 20 6f 66  20 64 61 74 61 20 77 6f  |"byte of data wo|
000005b0  75 6c 64 20 62 65 20 73  74 6f 72 65 64 20 69 6e  |uld be stored in|
000005c0  20 26 37 30 20 77 68 69  63 68 20 68 61 64 20 62  | &70 which had b|
000005d0  65 65 6e 20 64 65 63 6c  61 72 65 64 20 61 73 20  |een declared as |
000005e0  22 22 74 65 6d 70 22 22  2c 20 20 69 66 22 0d 01  |""temp"",  if"..|
000005f0  04 50 f1 22 61 20 66 75  72 74 68 65 72 20 73 74  |.P."a further st|
00000600  61 74 65 6d 65 6e 74 20  4c 44 41 20 64 61 74 61  |atement LDA data|
00000610  20 44 49 56 32 35 36 3a  53 54 41 74 65 6d 70 2b  | DIV256:STAtemp+|
00000620  31 20 68 61 64 20 61 6c  73 6f 20 72 65 63 69 65  |1 had also recie|
00000630  76 65 64 20 74 68 65 20  20 73 61 6d 65 22 0d 01  |ved the  same"..|
00000640  0e 4f f1 22 74 72 65 61  74 6d 65 6e 74 20 74 68  |.O."treatment th|
00000650  65 20 68 69 67 68 20 62  79 74 65 20 6f 66 20 22  |e high byte of "|
00000660  22 64 61 74 61 22 22 20  77 6f 75 6c 64 20 62 65  |"data"" would be|
00000670  20 73 74 6f 72 65 64 20  69 6e 20 26 37 30 2b 31  | stored in &70+1|
00000680  20 3d 20 26 37 31 20 20  20 74 68 65 22 0d 01 18  | = &71   the"...|
00000690  2d f1 22 63 61 70 69 74  61 6c 20 59 20 69 73 20  |-."capital Y is |
000006a0  6f 66 20 63 6f 75 72 73  65 20 74 68 65 20 59 20  |of course the Y |
000006b0  72 65 67 69 73 74 65 72  2e 22 0d 01 22 05 f1 0d  |register.".."...|
000006c0  01 2c 52 f1 22 49 6d 61  67 69 6e 65 20 74 68 61  |.,R."Imagine tha|
000006d0  74 20 22 22 64 61 74 61  22 22 20 77 61 73 20 74  |t ""data"" was t|
000006e0  68 65 20 6c 61 62 65 6c  20 66 6f 72 20 61 64 64  |he label for add|
000006f0  72 65 73 73 20 26 32 30  30 30 20 61 6e 64 20 74  |ress &2000 and t|
00000700  68 61 74 20 74 68 65 20  76 61 6c 75 65 20 69 6e  |hat the value in|
00000710  22 0d 01 36 4e f1 22 74  68 65 20 59 20 72 65 67  |"..6N."the Y reg|
00000720  69 73 74 65 72 20 77 61  73 20 66 6f 75 72 2c 20  |ister was four, |
00000730  74 68 65 6e 20 20 74 65  6d 70 20 28 26 37 30 29  |then  temp (&70)|
00000740  20 77 6f 75 6c 64 20 68  6f 6c 64 20 74 68 65 20  | would hold the |
00000750  76 61 6c 75 65 20 26 30  30 20 61 6e 64 22 20 0d  |value &00 and" .|
00000760  01 40 4e f1 22 74 65 6d  70 2b 31 20 28 26 37 31  |.@N."temp+1 (&71|
00000770  29 20 77 6f 75 6c 64 20  68 6f 6c 64 20 74 68 65  |) would hold the|
00000780  20 76 61 6c 75 65 20 26  32 30 20 74 68 65 20 73  | value &20 the s|
00000790  74 61 74 65 6d 65 6e 74  20 4c 44 41 20 28 74 65  |tatement LDA (te|
000007a0  6d 70 29 2c 59 20 77 6f  75 6c 64 22 20 0d 01 4a  |mp),Y would" ..J|
000007b0  51 f1 22 6c 6f 61 64 20  74 68 65 20 61 63 63 75  |Q."load the accu|
000007c0  6d 75 6c 61 74 6f 72 20  77 69 74 68 20 74 68 65  |mulator with the|
000007d0  20 63 6f 6e 74 65 6e 74  20 6f 66 20 61 64 64 72  | content of addr|
000007e0  65 73 73 20 26 32 30 30  30 2b 34 20 3d 20 26 32  |ess &2000+4 = &2|
000007f0  30 30 34 2e 20 20 49 66  20 20 74 68 65 22 0d 01  |004.  If  the"..|
00000800  54 4c f1 22 76 61 6c 75  65 20 69 6e 20 74 68 65  |TL."value in the|
00000810  20 59 20 72 65 67 69 73  74 65 72 20 77 65 72 65  | Y register were|
00000820  20 74 6f 20 62 65 20 64  65 63 69 6d 61 6c 20 31  | to be decimal 1|
00000830  32 20 74 68 65 20 63 6f  6e 74 65 6e 74 20 6f 66  |2 the content of|
00000840  20 61 64 64 72 65 73 73  22 20 0d 01 5e 32 f1 22  | address" ..^2."|
00000850  26 32 30 30 43 20 77 6f  75 6c 64 20 62 65 20 6c  |&200C would be l|
00000860  6f 61 64 65 64 20 69 6e  74 6f 20 74 68 65 20 61  |oaded into the a|
00000870  63 63 75 6d 75 6c 61 74  6f 72 2e 22 0d 01 68 05  |ccumulator."..h.|
00000880  f1 0d 01 72 4d f1 22 57  68 79 20 6e 6f 74 20 6a  |...rM."Why not j|
00000890  75 73 74 20 6c 6f 61 64  20 74 68 65 20 6c 6f 77  |ust load the low|
000008a0  20 62 79 74 65 20 6f 66  20 64 61 74 61 20 69 6e  | byte of data in|
000008b0  74 6f 20 26 37 30 20 61  6e 64 20 74 68 65 20 68  |to &70 and the h|
000008c0  69 67 68 20 62 79 74 65  20 69 6e 74 6f 22 0d 01  |igh byte into"..|
000008d0  7c 51 f1 22 26 37 31 20  64 69 72 65 63 74 20 61  ||Q."&71 direct a|
000008e0  6e 64 20 69 6e 64 65 78  20 69 74 20 74 6f 20 59  |nd index it to Y|
000008f0  2e 20 20 54 68 65 20 70  6f 73 74 20 69 6e 64 65  |.  The post inde|
00000900  78 20 73 74 61 74 65 6d  65 6e 74 20 77 6f 75 6c  |x statement woul|
00000910  64 20 74 68 65 6e 20 62  65 20 20 4c 44 41 22 0d  |d then be  LDA".|
00000920  01 86 51 f1 22 28 26 37  30 29 2c 59 2e 20 20 4e  |..Q."(&70),Y.  N|
00000930  6f 20 72 65 61 73 6f 6e  20 65 78 63 65 70 74 20  |o reason except |
00000940  74 68 61 74 20 7a 65 72  6f 20 70 61 67 65 20 6c  |that zero page l|
00000950  6f 63 61 74 69 6f 6e 73  20 61 72 65 20 69 6e 20  |ocations are in |
00000960  73 68 6f 72 74 20 20 73  75 70 70 6c 79 2e 22 20  |short  supply." |
00000970  0d 01 90 4f f1 22 54 6f  20 64 65 73 69 67 6e 61  |...O."To designa|
00000980  74 65 20 74 77 6f 20 6f  66 20 74 68 65 6d 20 61  |te two of them a|
00000990  73 20 74 65 6d 70 20 61  6e 64 20 75 73 65 20 74  |s temp and use t|
000009a0  68 65 6d 20 6f 6e 6c 79  20 61 73 20 74 65 6d 70  |hem only as temp|
000009b0  6f 72 61 72 79 20 20 73  74 6f 72 61 67 65 22 0d  |orary  storage".|
000009c0  01 9a 4f f1 22 61 72 65  61 73 2c 20 70 72 65 76  |..O."areas, prev|
000009d0  65 6e 74 73 20 68 61 76  69 6e 67 20 74 6f 20 6c  |ents having to l|
000009e0  6f 6f 6b 20 62 61 63 6b  20 6f 76 65 72 20 6c 69  |ook back over li|
000009f0  6e 65 73 20 6f 66 20 73  6f 75 72 63 65 20 63 6f  |nes of source co|
00000a00  64 65 20 20 74 6f 20 66  69 6e 64 20 61 22 0d 01  |de  to find a"..|
00000a10  a4 50 f1 22 66 72 65 65  20 7a 65 72 6f 20 70 61  |.P."free zero pa|
00000a20  67 65 20 61 64 64 72 65  73 73 2e 20 20 57 68 79  |ge address.  Why|
00000a30  20 75 73 65 20 74 68 69  73 20 6d 65 74 68 6f 64  | use this method|
00000a40  20 61 74 20 61 6c 6c 3f  20 20 54 68 65 20 20 61  | at all?  The  a|
00000a50  6e 73 77 65 72 20 74 6f  20 74 68 61 74 22 0d 01  |nswer to that"..|
00000a60  ae 53 f1 22 69 73 20 22  22 4f 75 72 20 61 64 64  |.S."is ""Our add|
00000a70  72 65 73 73 20 69 73 20  6f 6e 20 74 68 65 20 73  |ress is on the s|
00000a80  74 61 63 6b 20 69 6e 20  74 77 6f 20 62 79 74 65  |tack in two byte|
00000a90  73 22 22 2e 20 20 54 68  65 20 20 6f 72 67 69 6e  |s"".  The  orgin|
00000aa0  61 6c 20 22 22 64 61 74  61 22 22 20 69 73 20 61  |al ""data"" is a|
00000ab0  22 0d 01 b8 50 f1 22 6c  61 62 65 6c 20 61 6e 64  |"...P."label and|
00000ac0  20 61 20 6c 61 62 65 6c  20 6d 61 79 20 62 65 20  | a label may be |
00000ad0  69 6e 64 65 78 65 64 20  77 69 74 68 20 65 69 74  |indexed with eit|
00000ae0  68 65 72 20 74 68 65 20  58 20 20 6f 72 20 59 20  |her the X  or Y |
00000af0  72 65 67 69 73 74 65 72  2e 20 20 55 73 69 6e 67  |register.  Using|
00000b00  22 0d 01 c2 50 f1 22 50  52 4f 43 70 72 74 20 61  |"...P."PROCprt a|
00000b10  20 73 69 6e 67 6c 65 20  6d 75 6c 74 69 2d 75 73  | single multi-us|
00000b20  65 72 20 70 72 69 6e 74  20 72 6f 75 74 69 6e 65  |er print routine|
00000b30  2c 20 61 6e 64 20 20 6a  75 6d 70 69 6e 67 20 74  |, and  jumping t|
00000b40  6f 20 69 74 20 77 69 74  68 20 4a 53 52 70 72 74  |o it with JSRprt|
00000b50  22 0d 01 cc 52 f1 22 63  61 75 73 65 73 20 22 22  |"...R."causes ""|
00000b60  64 61 74 61 22 22 20 74  6f 20 62 65 20 73 74 6f  |data"" to be sto|
00000b70  72 65 64 20 6f 6e 20 74  68 65 20 73 74 61 63 6b  |red on the stack|
00000b80  20 69 6e 20 20 74 77 6f  20 62 79 74 65 73 2e 20  | in  two bytes. |
00000b90  20 54 68 61 74 20 69 73  20 69 64 65 61 6c 20 66  | That is ideal f|
00000ba0  6f 72 22 0d 01 d6 4a f1  22 50 6f 73 74 2d 49 6e  |or"...J."Post-In|
00000bb0  64 65 78 20 6a 75 73 74  20 70 75 6c 6c 20 74 68  |dex just pull th|
00000bc0  65 20 76 61 6c 75 65 73  20 61 6e 64 20 73 74 6f  |e values and sto|
00000bd0  72 65 20 20 74 68 65 6d  20 69 6e 20 74 65 6d 70  |re  them in temp|
00000be0  20 61 6e 64 20 74 65 6d  70 2b 31 2e 22 0d 01 e0  | and temp+1."...|
00000bf0  05 f1 0d 01 ea 52 f1 22  49 6d 61 67 69 6e 65 20  |.....R."Imagine |
00000c00  74 68 61 74 20 61 20 70  72 6f 67 72 61 6d 20 72  |that a program r|
00000c10  65 71 75 69 72 65 73 20  62 6c 6f 63 6b 73 20 6f  |equires blocks o|
00000c20  66 20 64 61 74 61 20 74  6f 20 62 65 20 73 74 6f  |f data to be sto|
00000c30  72 65 64 20 6f 72 20 20  72 65 74 72 69 65 76 65  |red or  retrieve|
00000c40  64 2e 22 20 0d 01 f4 51  f1 22 54 68 65 6e 20 61  |d." ...Q."Then a|
00000c50  20 74 61 62 6c 65 20 66  6f 72 20 73 74 6f 72 69  | table for stori|
00000c60  6e 67 20 74 68 6f 73 65  20 61 64 64 72 65 73 73  |ng those address|
00000c70  65 73 20 69 73 20 76 65  72 79 20 75 73 65 66 75  |es is very usefu|
00000c80  6c 20 61 6e 64 20 20 69  6e 20 73 6f 6d 65 20 63  |l and  in some c|
00000c90  61 73 65 73 22 0d 01 fe  19 f1 22 74 6f 74 61 6c  |ases"....."total|
00000ca0  6c 79 20 6e 65 63 65 73  73 61 72 79 2e 22 0d 02  |ly necessary."..|
00000cb0  08 05 f1 0d 02 12 4f f1  22 54 6f 20 73 74 6f 72  |......O."To stor|
00000cc0  65 20 74 68 65 20 61 64  64 72 65 73 73 20 69 6e  |e the address in|
00000cd0  20 74 68 65 20 74 61 62  6c 65 2c 20 74 68 65 20  | the table, the |
00000ce0  6c 6f 77 20 62 79 74 65  20 77 6f 75 6c 64 20 62  |low byte would b|
00000cf0  65 20 70 6c 61 63 65 64  20 69 6e 20 74 65 6d 70  |e placed in temp|
00000d00  22 20 0d 02 1c 51 f1 22  61 6e 64 20 74 68 65 20  |" ...Q."and the |
00000d10  68 69 67 68 20 62 79 74  65 20 69 6e 20 74 65 6d  |high byte in tem|
00000d20  70 2b 31 20 61 6e 64 20  69 6e 20 74 68 65 20 73  |p+1 and in the s|
00000d30  61 6d 65 20 77 61 79 20  74 68 65 20 68 69 67 68  |ame way the high|
00000d40  20 61 6e 64 20 6c 6f 77  20 62 79 74 65 73 20 20  | and low bytes  |
00000d50  6f 66 22 0d 02 26 51 f1  22 74 61 62 6c 65 20 77  |of"..&Q."table w|
00000d60  6f 75 6c 64 20 6e 65 65  64 20 74 6f 20 62 65 20  |ould need to be |
00000d70  73 74 6f 72 65 64 20 69  6e 20 74 77 6f 20 6d 6f  |stored in two mo|
00000d80  72 65 20 7a 65 72 6f 20  70 61 67 65 20 61 64 64  |re zero page add|
00000d90  72 65 73 73 65 73 20 73  61 79 20 20 6c 6f 63 20  |resses say  loc |
00000da0  61 6e 64 22 0d 02 30 17  f1 22 6c 6f 63 2b 31 20  |and"..0.."loc+1 |
00000db0  28 6c 6f 63 61 74 69 6f  6e 29 22 0d 02 3a 05 f1  |(location)"..:..|
00000dc0  0d 02 44 4d f1 22 54 68  65 6e 20 74 68 65 20 73  |..DM."Then the s|
00000dd0  74 61 74 65 6d 65 6e 74  20 4c 44 41 28 74 65 6d  |tatement LDA(tem|
00000de0  70 29 2c 59 3a 53 54 41  28 6c 6f 63 29 2c 59 3a  |p),Y:STA(loc),Y:|
00000df0  49 4e 59 3a 4c 44 41 28  74 65 6d 70 29 2c 59 3a  |INY:LDA(temp),Y:|
00000e00  53 54 41 28 6c 6f 63 29  2c 59 22 20 20 0d 02 4e  |STA(loc),Y"  ..N|
00000e10  4d f1 22 77 6f 75 6c 64  20 70 6c 61 63 65 20 74  |M."would place t|
00000e20  68 65 20 61 64 64 72 65  73 73 20 69 6e 74 6f 20  |he address into |
00000e30  73 75 63 63 65 73 73 69  76 65 20 62 79 74 65 73  |successive bytes|
00000e40  20 69 6e 20 74 68 65 20  74 61 62 6c 65 2e 20 20  | in the table.  |
00000e50  43 6f 6e 73 69 64 65 72  22 20 0d 02 58 51 f1 22  |Consider" ..XQ."|
00000e60  74 68 61 74 20 73 69 74  75 61 74 69 6f 6e 2c 20  |that situation, |
00000e70  62 79 20 6d 61 6e 69 70  75 6c 61 74 69 6e 67 20  |by manipulating |
00000e80  74 68 65 20 76 61 6c 75  65 20 69 6e 20 74 68 65  |the value in the|
00000e90  20 59 20 72 65 67 69 73  74 65 72 20 74 65 6e 20  | Y register ten |
00000ea0  20 61 64 64 72 65 73 73  65 73 22 0d 02 62 4a f1  | addresses"..bJ.|
00000eb0  22 77 69 74 68 20 61 20  63 6f 6d 6d 6f 6e 20 68  |"with a common h|
00000ec0  69 67 68 20 62 79 74 65  20 63 6f 75 6c 64 20 62  |igh byte could b|
00000ed0  65 20 73 74 6f 72 65 64  20 69 6e 20 65 6c 65 76  |e stored in elev|
00000ee0  65 6e 20 62 79 74 65 73  20 20 69 6e 73 74 65 61  |en bytes  instea|
00000ef0  64 20 6f 66 22 0d 02 6c  4f f1 22 74 77 65 6e 74  |d of"..lO."twent|
00000f00  79 2e 20 20 54 68 65 20  68 69 67 68 20 62 79 74  |y.  The high byt|
00000f10  65 20 77 6f 75 6c 64 20  62 65 20 73 74 6f 72 65  |e would be store|
00000f20  64 20 20 61 74 20 74 68  65 20 62 61 73 65 20 6f  |d  at the base o|
00000f30  66 20 74 68 65 20 20 74  61 62 6c 65 2c 20 61 66  |f the  table, af|
00000f40  74 65 72 22 0d 02 76 4e  f1 22 72 65 74 72 69 65  |ter"..vN."retrie|
00000f50  76 69 6e 67 20 74 68 65  20 68 69 67 68 20 62 79  |ving the high by|
00000f60  74 65 20 77 69 74 68 20  59 20 73 65 74 20 74 6f  |te with Y set to|
00000f70  20 7a 65 72 6f 20 59 20  77 6f 75 6c 64 20 74 68  | zero Y would th|
00000f80  65 6e 20 20 62 65 20 73  65 74 20 74 6f 20 74 68  |en  be set to th|
00000f90  65 22 0d 02 80 4c f1 22  6f 66 66 73 65 74 20 66  |e"...L."offset f|
00000fa0  6f 72 20 74 68 65 20 70  61 72 74 69 63 75 6c 61  |or the particula|
00000fb0  72 20 6c 6f 77 20 62 79  74 65 20 72 65 71 75 69  |r low byte requi|
00000fc0  72 65 64 20 28 61 20 76  61 6c 75 65 20 20 62 65  |red (a value  be|
00000fd0  74 77 65 65 6e 20 74 77  6f 20 61 6e 64 22 0d 02  |tween two and"..|
00000fe0  8a 2a f1 22 65 6c 65 76  65 6e 29 20 61 6e 64 20  |.*."eleven) and |
00000ff0  74 68 65 20 6c 6f 77 20  62 79 74 65 20 72 65 74  |the low byte ret|
00001000  72 69 65 76 65 64 2e 22  0d 02 94 05 f1 0d 02 9e  |rieved."........|
00001010  4b f1 22 54 61 6b 65 20  74 68 61 74 20 66 75 72  |K."Take that fur|
00001020  74 68 65 72 20 69 66 20  74 68 65 20 62 6c 6f 63  |ther if the bloc|
00001030  6b 73 20 6f 66 20 64 61  74 61 20 77 65 72 65 20  |ks of data were |
00001040  73 74 61 62 6c 65 20 61  6e 64 20 64 69 64 20 6e  |stable and did n|
00001050  6f 74 20 6d 6f 76 65 22  0d 02 a8 4f f1 22 61 62  |ot move"...O."ab|
00001060  6f 75 74 20 69 6e 20 6d  65 6d 6f 72 79 20 74 68  |out in memory th|
00001070  65 6e 20 74 68 65 20 68  69 67 68 20 62 79 74 65  |en the high byte|
00001080  20 6e 65 65 64 20 6e 6f  74 20 62 65 20 73 74 6f  | need not be sto|
00001090  72 65 64 20 61 74 20 61  6c 6c 2e 20 20 54 68 65  |red at all.  The|
000010a0  20 7a 65 72 6f 22 20 0d  02 b2 3f f1 22 70 61 67  | zero" ...?."pag|
000010b0  65 20 74 65 6d 70 2b 31  20 63 6f 75 6c 64 20 62  |e temp+1 could b|
000010c0  65 20 6c 6f 61 64 65 64  20 61 62 73 6f 6c 75 74  |e loaded absolut|
000010d0  65 20 77 69 74 68 20 74  68 65 20 68 69 67 68 20  |e with the high |
000010e0  62 79 74 65 22 20 0d 02  bc 4c f1 22 4c 44 41 23  |byte" ...L."LDA#|
000010f0  26 32 30 3a 53 54 41 74  65 6d 70 2b 31 2e 20 20  |&20:STAtemp+1.  |
00001100  4e 6f 74 20 65 6c 65 67  61 6e 74 20 63 6f 64 69  |Not elegant codi|
00001110  6e 67 20 62 75 74 20 6e  65 65 64 73 20 6d 75 73  |ng but needs mus|
00001120  74 20 77 68 65 6e 20 74  68 65 20 64 65 76 69 6c  |t when the devil|
00001130  22 20 0d 02 c6 38 f1 22  77 69 6c 6c 73 2e 20 20  |" ...8."wills.  |
00001140  54 68 69 72 74 79 20 6b  69 6c 6f 62 79 74 65 20  |Thirty kilobyte |
00001150  6f 66 20 75 73 65 72 20  52 41 4d 20 69 73 20 6e  |of user RAM is n|
00001160  6f 74 20 61 20 6c 6f 74  2e 22 0d 02 d0 05 f1 0d  |ot a lot."......|
00001170  02 da 50 f1 22 54 6f 20  73 75 6d 20 75 70 20 74  |..P."To sum up t|
00001180  68 65 20 73 79 6e 74 61  78 20 6f 66 20 4c 44 41  |he syntax of LDA|
00001190  28 74 65 6d 70 29 2c 59  20 61 63 74 69 76 61 74  |(temp),Y activat|
000011a0  65 73 20 61 20 72 6f 75  74 69 6e 65 20 69 6e 20  |es a routine in |
000011b0  74 68 65 20 36 35 30 32  20 63 68 69 70 22 20 0d  |the 6502 chip" .|
000011c0  02 e4 4b f1 22 74 68 61  74 20 61 64 64 73 20 74  |..K."that adds t|
000011d0  68 65 20 6c 6f 77 20 62  79 74 65 20 6f 66 20 61  |he low byte of a|
000011e0  6e 20 61 64 64 72 65 73  73 20 74 6f 20 74 68 65  |n address to the|
000011f0  20 68 69 67 68 20 62 79  74 65 20 74 68 65 6e 20  | high byte then |
00001200  61 64 64 73 20 74 68 65  22 20 0d 02 ee 45 f1 22  |adds the" ...E."|
00001210  63 6f 6e 74 65 6e 74 20  6f 66 20 74 68 65 20 59  |content of the Y|
00001220  20 72 65 67 69 73 74 65  72 20 74 6f 20 67 69 76  | register to giv|
00001230  65 20 61 20 66 69 6e 61  6c 20 73 69 78 74 65 65  |e a final sixtee|
00001240  6e 20 62 69 74 20 61 64  64 72 65 73 73 2e 22 0d  |n bit address.".|
00001250  02 f8 05 f1 0d 03 02 4b  f1 22 52 65 76 65 72 73  |.......K."Revers|
00001260  65 20 63 6f 6c 6f 75 72  20 74 65 78 74 20 77 69  |e colour text wi|
00001270  6e 64 6f 77 3f 20 20 48  6f 77 20 64 69 64 20 69  |ndow?  How did i|
00001280  74 20 67 6f 3f 20 4d 79  20 63 6f 64 65 20 69 73  |t go? My code is|
00001290  20 6c 69 73 74 65 64 20  62 65 6c 6f 77 2e 22 0d  | listed below.".|
000012a0  03 0c 4b f1 22 4c 6f 61  64 20 74 68 65 20 70 72  |..K."Load the pr|
000012b0  6f 67 72 61 6d 20 61 6e  64 20 61 6c 74 65 72 20  |ogram and alter |
000012c0  69 74 20 74 6f 20 6d 79  20 6c 69 73 74 69 6e 67  |it to my listing|
000012d0  2c 20 50 52 4f 43 63 6f  6e 73 74 61 6e 74 73 20  |, PROCconstants |
000012e0  68 61 73 20 62 65 65 6e  22 20 0d 03 16 4f f1 22  |has been" ...O."|
000012f0  61 6c 74 65 72 65 64 20  73 6c 69 67 68 74 6c 79  |altered slightly|
00001300  2c 20 6d 65 72 65 6c 79  20 74 6f 20 67 69 76 65  |, merely to give|
00001310  20 75 73 20 6d 6f 72 65  20 63 6f 6e 74 72 6f 6c  | us more control|
00001320  20 6f 66 20 74 68 65 20  70 72 6f 67 72 61 6d 2e  | of the program.|
00001330  20 50 52 4f 43 70 72 74  22 0d 03 20 12 f1 22 6e  | PROCprt".. .."n|
00001340  6f 20 63 68 61 6e 67 65  73 2e 22 0d 03 2a 05 f1  |o changes."..*..|
00001350  0d 03 34 51 f1 22 50 52  4f 43 64 61 74 61 20 68  |..4Q."PROCdata h|
00001360  61 73 20 61 6c 74 65 72  65 64 20 74 68 65 20 6c  |as altered the l|
00001370  61 62 65 6c 73 20 69 6e  64 69 63 61 74 65 20 74  |abels indicate t|
00001380  68 65 20 61 63 74 69 6f  6e 20 6f 66 20 74 68 65  |he action of the|
00001390  20 63 6f 64 65 2e 20 4c  69 6e 65 20 20 33 38 30  | code. Line  380|
000013a0  22 0d 03 3e 4f f1 22 63  6c 65 61 72 73 20 74 68  |"..>O."clears th|
000013b0  65 20 73 63 72 65 65 6e  20 77 69 74 68 20 61 20  |e screen with a |
000013c0  56 44 55 31 32 2e 20 20  43 6f 6c 6f 75 72 73 20  |VDU12.  Colours |
000013d0  61 72 65 20 72 65 76 65  72 73 65 64 20 61 74 20  |are reversed at |
000013e0  4c 69 6e 65 20 33 39 30  20 20 77 68 65 72 65 22  |Line 390  where"|
000013f0  0d 03 48 4e f1 22 45 51  55 44 20 69 73 20 69 6e  |..HN."EQUD is in|
00001400  74 72 6f 64 75 63 65 64  2c 20 66 6f 75 72 20 45  |troduced, four E|
00001410  51 55 42 73 20 6d 69 67  68 74 20 68 61 76 65 20  |QUBs might have |
00001420  62 65 65 6e 20 75 73 65  64 20 45 51 55 42 31 37  |been used EQUB17|
00001430  3a 45 51 55 42 30 20 20  77 6f 75 6c 64 22 0d 03  |:EQUB0  would"..|
00001440  52 4a f1 22 68 61 76 65  20 67 69 76 65 6e 20 61  |RJ."have given a|
00001450  20 62 6c 61 63 6b 20 66  6f 72 65 67 72 6f 75 6e  | black foregroun|
00001460  64 20 61 6e 64 20 45 51  55 42 31 37 3a 45 51 55  |d and EQUB17:EQU|
00001470  42 31 32 39 20 77 68 69  74 65 20 20 62 61 63 6b  |B129 white  back|
00001480  67 72 6f 75 6e 64 2e 22  0d 03 5c 05 f1 0d 03 66  |ground."..\....f|
00001490  4d f1 22 52 65 6d 65 6d  62 65 72 20 74 68 65 20  |M."Remember the |
000014a0  41 63 6f 72 6e 20 72 6f  75 74 69 6e 65 20 61 74  |Acorn routine at|
000014b0  20 26 46 46 45 45 33 20  72 65 61 64 73 20 61 6e  | &FFEE3 reads an|
000014c0  64 20 75 6e 64 65 72 73  74 61 6e 64 73 20 74 68  |d understands th|
000014d0  65 20 63 6f 6e 74 72 6f  6c 22 0d 03 70 2a f1 22  |e control"..p*."|
000014e0  63 6f 64 65 73 20 28 41  70 70 65 6e 64 69 78 20  |codes (Appendix |
000014f0  46 20 6f 66 20 74 68 65  20 68 61 6e 64 62 6f 6f  |F of the handboo|
00001500  6b 29 2e 22 0d 03 7a 05  f1 0d 03 84 4f f1 22 45  |k)."..z.....O."E|
00001510  51 55 44 20 69 73 20 6e  65 61 74 65 72 20 61 6e  |QUD is neater an|
00001520  64 20 73 61 76 65 73 20  73 6f 6d 65 20 74 79 70  |d saves some typ|
00001530  69 6e 67 20 62 75 74 20  62 6f 74 68 20 45 51 55  |ing but both EQU|
00001540  44 20 61 6e 64 20 45 51  55 57 20 6f 6e 6c 79 20  |D and EQUW only |
00001550  61 63 63 65 70 74 22 20  0d 03 8e 4e f1 22 68 65  |accept" ...N."he|
00001560  78 69 64 65 63 69 6d 61  6c 20 6e 75 6d 62 65 72  |xidecimal number|
00001570  73 2c 20 77 6f 72 73 65  20 74 68 65 79 20 69 6e  |s, worse they in|
00001580  73 69 73 74 20 74 68 61  74 20 74 68 65 20 6e 75  |sist that the nu|
00001590  6d 62 65 72 73 20 61 72  65 20 69 6e 20 72 65 76  |mbers are in rev|
000015a0  65 72 73 65 22 20 0d 03  98 51 f1 22 6f 72 64 65  |erse" ...Q."orde|
000015b0  72 2e 20 20 41 74 20 66  69 72 73 74 20 73 69 67  |r.  At first sig|
000015c0  68 74 20 6c 69 6e 65 20  33 39 30 20 69 73 20 76  |ht line 390 is v|
000015d0  65 72 79 20 63 6f 6e 66  75 73 69 6e 67 20 62 75  |ery confusing bu|
000015e0  74 20 64 69 76 69 64 65  20 69 74 20 69 6e 74 6f  |t divide it into|
000015f0  20 20 66 6f 75 72 22 0d  03 a2 53 f1 22 62 79 74  |  four"...S."byt|
00001600  65 73 2c 20 28 75 73 65  20 61 20 73 63 72 61 70  |es, (use a scrap|
00001610  20 6f 66 20 70 61 70 65  72 29 20 22 22 26 38 31  | of paper) ""&81|
00001620  22 22 20 20 22 22 26 31  31 22 22 20 22 22 26 30  |""  ""&11"" ""&0|
00001630  30 22 22 20 22 22 26 31  31 22 22 20 6e 6f 77 20  |0"" ""&11"" now |
00001640  61 73 6b 20 20 79 6f 75  72 22 0d 03 ac 4f f1 22  |ask  your"...O."|
00001650  63 6f 6d 70 75 74 65 72  20 50 52 49 4e 54 20 26  |computer PRINT &|
00001660  38 31 20 74 68 65 20 61  6e 73 77 65 72 20 69 73  |81 the answer is|
00001670  20 31 32 39 20 77 72 69  74 65 20 69 74 20 75 6e  | 129 write it un|
00001680  64 65 72 20 74 68 65 20  26 38 31 20 64 6f 20 74  |der the &81 do t|
00001690  68 65 20 20 73 61 6d 65  22 0d 03 b6 57 f1 22 77  |he  same"...W."w|
000016a0  69 74 68 20 74 68 65 20  6f 74 68 65 72 73 2e 20  |ith the others. |
000016b0  20 41 6e 73 77 65 72 20  22 22 31 32 39 22 22 20  | Answer ""129"" |
000016c0  22 22 31 37 22 22 20 22  22 30 22 22 20 22 22 31  |""17"" ""0"" ""1|
000016d0  37 22 22 20 72 65 61 64  69 6e 67 20 66 72 6f 6d  |7"" reading from|
000016e0  20 72 69 67 68 74 20 74  6f 20 20 6c 65 66 74 22  | right to  left"|
000016f0  0d 03 c0 56 f1 22 28 42  61 63 6b 77 61 72 64 73  |...V."(Backwards|
00001700  29 20 22 22 31 37 22 22  20 22 22 30 22 22 20 28  |) ""17"" ""0"" (|
00001710  62 6c 61 63 6b 20 66 6f  72 65 67 72 6f 75 6e 64  |black foreground|
00001720  29 20 22 22 31 37 22 22  20 22 22 31 32 39 22 22  |) ""17"" ""129""|
00001730  20 28 77 68 69 74 65 20  20 62 61 63 6b 67 72 6f  | (white  backgro|
00001740  75 6e 64 29 2e 22 0d 03  ca 05 f1 0d 03 d4 51 f1  |und)."........Q.|
00001750  22 4c 69 6e 65 20 34 30  30 20 69 73 20 64 69 66  |"Line 400 is dif|
00001760  66 65 72 65 6e 74 2c 20  74 68 65 20 74 65 78 74  |ferent, the text|
00001770  20 77 69 6e 64 6f 77 20  6e 65 65 64 73 20 66 69  | window needs fi|
00001780  76 65 20 62 79 74 65 73  2c 20 74 68 65 20 6c 61  |ve bytes, the la|
00001790  73 74 20 62 79 74 65 20  20 6f 66 22 0d 03 de 51  |st byte  of"...Q|
000017a0  f1 22 74 68 65 20 45 51  55 44 20 73 74 61 74 65  |."the EQUD state|
000017b0  6d 65 6e 74 20 69 73 20  26 31 43 20 31 36 2b 31  |ment is &1C 16+1|
000017c0  32 3d 32 38 20 28 56 44  55 32 38 29 20 74 68 65  |2=28 (VDU28) the|
000017d0  20 6e 65 78 74 20 74 68  65 20 6c 65 66 74 20 68  | next the left h|
000017e0  61 6e 64 20 20 65 64 67  65 20 6f 66 22 0d 03 e8  |and  edge of"...|
000017f0  51 f1 22 74 68 65 20 77  69 6e 64 6f 77 20 22 22  |Q."the window ""|
00001800  30 22 22 20 74 68 65 6e  20 74 68 65 20 62 6f 74  |0"" then the bot|
00001810  74 6f 6d 20 65 64 67 65  20 22 22 32 22 22 20 20  |tom edge ""2""  |
00001820  28 30 2c 31 2c 32 29 20  30 20 69 73 20 61 20 6e  |(0,1,2) 0 is a n|
00001830  75 6d 62 65 72 20 20 74  6f 20 74 68 65 22 0d 03  |umber  to the"..|
00001840  f2 53 f1 22 63 6f 6d 70  75 74 65 72 20 73 6f 20  |.S."computer so |
00001850  22 22 32 22 22 20 67 69  76 65 73 20 74 68 72 65  |""2"" gives thre|
00001860  65 20 6c 69 6e 65 73 20  64 65 65 70 2e 20 26 32  |e lines deep. &2|
00001870  37 20 32 78 31 36 2b 37  3d 33 39 20 73 65 74 73  |7 2x16+7=39 sets|
00001880  20 74 68 65 20 20 72 69  67 68 74 20 68 61 6e 64  | the  right hand|
00001890  22 0d 03 fc 50 f1 22 65  64 67 65 2e 20 54 75 63  |"...P."edge. Tuc|
000018a0  6b 65 64 20 6f 6e 20 74  68 65 20 65 6e 64 20 69  |ked on the end i|
000018b0  73 20 61 6e 20 45 51 55  42 30 20 77 68 69 63 68  |s an EQUB0 which|
000018c0  20 73 65 74 73 20 74 68  65 20 74 6f 70 20 65 64  | sets the top ed|
000018d0  67 65 2e 20 20 20 34 31  30 20 63 6c 65 61 72 73  |ge.   410 clears|
000018e0  22 0d 04 06 50 f1 22 74  68 65 20 73 63 72 65 65  |"...P."the scree|
000018f0  6e 20 77 69 74 68 69 6e  20 74 68 65 20 74 65 78  |n within the tex|
00001900  74 20 77 69 6e 64 6f 77  2e 20 20 34 32 30 20 45  |t window.  420 E|
00001910  51 55 57 26 30 38 31 46  3b 20 26 31 46 20 20 65  |QUW&081F; &1F  e|
00001920  71 75 61 6c 73 20 33 31  20 28 56 44 55 33 31 29  |quals 31 (VDU31)|
00001930  22 0d 04 10 4e f1 22 26  30 38 20 66 6f 72 20 63  |"...N."&08 for c|
00001940  6f 6c 75 6d 6e 20 65 69  67 68 74 20 61 6e 64 20  |olumn eight and |
00001950  74 68 65 20 45 51 55 42  31 20 6c 69 6e 65 20 6e  |the EQUB1 line n|
00001960  75 6d 62 65 72 20 31 2e  20 20 6c 69 6e 65 20 34  |umber 1.  line 4|
00001970  34 30 20 72 65 74 75 72  6e 73 20 74 68 65 22 0d  |40 returns the".|
00001980  04 1a 4d f1 22 63 6f 6c  6f 75 72 73 20 74 6f 20  |..M."colours to |
00001990  73 74 61 6e 64 61 72 64  20 61 6e 64 20 34 35 30  |standard and 450|
000019a0  20 77 69 6e 64 6f 77 20  6f 66 66 2e 20 34 36 30  | window off. 460|
000019b0  20 74 61 62 73 20 20 74  68 65 20 63 75 72 73 6f  | tabs  the curso|
000019c0  72 20 74 6f 20 63 6f 6c  75 6d 6e 22 0d 04 24 3d  |r to column"..$=|
000019d0  f1 22 7a 65 72 6f 20 6c  69 6e 65 20 66 69 66 74  |."zero line fift|
000019e0  65 65 6e 20 61 6e 64 20  74 68 65 20 72 6f 75 74  |een and the rout|
000019f0  69 6e 65 20 63 6f 6e 63  6c 75 64 65 73 20 77 69  |ine concludes wi|
00001a00  74 68 20 20 26 46 46 2e  22 0d 04 2e 05 f1 0d 04  |th  &FF.".......|
00001a10  38 51 f1 22 45 51 55 42  2c 20 45 51 55 57 20 61  |8Q."EQUB, EQUW a|
00001a20  6e 64 20 45 51 55 44 20  61 72 65 20 61 6c 6c 20  |nd EQUD are all |
00001a30  75 73 65 64 20 66 6f 72  20 69 6e 73 65 72 74 69  |used for inserti|
00001a40  6e 67 20 6e 75 6d 62 65  72 73 20 69 6e 74 6f 20  |ng numbers into |
00001a50  61 73 73 65 6d 62 6c 79  20 20 63 6f 64 65 22 0d  |assembly  code".|
00001a60  04 42 4c f1 22 74 68 65  79 20 61 72 65 20 62 61  |.BL."they are ba|
00001a70  73 69 63 20 73 74 61 74  65 6d 65 6e 74 73 20 74  |sic statements t|
00001a80  68 61 74 20 6d 61 79 20  6f 6e 6c 79 20 62 65 20  |hat may only be |
00001a90  75 73 65 64 20 69 6e 20  61 73 73 65 6d 62 6c 79  |used in assembly|
00001aa0  20 20 6c 61 6e 67 75 61  67 65 22 0d 04 4c 4d f1  |  language"..LM.|
00001ab0  22 73 6f 75 72 63 65 20  63 6f 64 65 2e 20 20 45  |"source code.  E|
00001ac0  51 55 42 20 69 6e 73 65  72 74 73 20 61 20 73 69  |QUB inserts a si|
00001ad0  6e 67 6c 65 20 62 79 74  65 2c 20 45 51 55 57 20  |ngle byte, EQUW |
00001ae0  61 20 77 6f 72 64 20 28  74 77 6f 20 20 62 79 74  |a word (two  byt|
00001af0  65 73 29 20 61 6e 64 22  0d 04 56 2f f1 22 45 51  |es) and"..V/."EQ|
00001b00  55 44 20 69 6e 73 65 72  74 73 20 61 20 64 6f 75  |UD inserts a dou|
00001b10  62 6c 65 20 77 6f 72 64  20 28 66 6f 75 72 20 62  |ble word (four b|
00001b20  79 74 65 73 29 2e 22 0d  04 60 05 f1 0d 04 6a 4d  |ytes)."..`....jM|
00001b30  f1 22 4e 65 78 74 20 74  69 6d 65 20 73 74 61 72  |."Next time star|
00001b40  74 25 2c 20 62 61 73 65  25 20 61 6e 64 20 73 63  |t%, base% and sc|
00001b50  72 6e 31 20 77 69 6c 6c  20 62 65 20 75 73 65 64  |rn1 will be used|
00001b60  20 74 6f 20 73 61 76 65  20 74 68 65 20 6f 62 6a  | to save the obj|
00001b70  65 63 74 20 63 6f 64 65  22 0d 04 74 44 f1 22 70  |ect code"..tD."p|
00001b80  6c 75 73 20 69 66 20 73  70 61 63 65 20 70 65 72  |lus if space per|
00001b90  6d 69 74 73 20 61 6e 20  4f 53 42 59 54 45 20 63  |mits an OSBYTE c|
00001ba0  61 6c 6c 20 74 6f 20 74  68 65 20 6f 70 65 72 61  |all to the opera|
00001bb0  74 69 6e 67 20 73 79 73  74 65 6d 2e 22 0d 04 7e  |ting system."..~|
00001bc0  4d f1 22 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |M."*************|
00001bd0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00001c00  2a 2a 2a 2a 2a 2a 2a 2a  2a 22 0d 04 88 4d f1 22  |*********"...M."|
00001c10  50 4c 45 41 53 45 20 4e  4f 54 45 3a 20 54 48 45  |PLEASE NOTE: THE|
00001c20  20 4c 49 53 54 49 4e 47  20 49 53 20 53 41 56 45  | LISTING IS SAVE|
00001c30  44 20 41 53 20 41 20 50  52 4f 47 52 41 4d 20 4f  |D AS A PROGRAM O|
00001c40  4e 20 54 48 45 20 44 49  53 43 20 41 53 20 24 2e  |N THE DISC AS $.|
00001c50  41 53 53 45 4d 32 22 0d  04 92 4e f1 22 2a 2a 2a  |ASSEM2"...N."***|
00001c60  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00001ca0  2a 2a 2a 22 20 0d 04 9c  05 e1 0d ff              |***" .......|
00001cac
ASSEM1.m0
ASSEM1.m1
ASSEM1.m2
ASSEM1.m4
ASSEM1.m5