Home
Acorn 6809 User`s manual
Contents
1. 1281 FF D 3F282444 CRTCSU FCB 2F 28 24 44 set up table for s version 68645 crt controller 1282 FF11 1E02191B FCR 1E 02 19 18 13282 FF15 92127012 FCB 902 12 70 12 1284 d 1385 FF19 F283404 CRTCRU FCB 2F 28 24 04 set up table for r version crt controller 1286 FF10 1E0721318 FCB 1E 02 19 1B 1387 FF21 00096809 FCB 00 09 68 US 1288 1389 set up table 1 copied directly to ram at rtabl 1398 1391 FF25 0258 PTABL FDB ISTACK initial stack pointer 1292 FF27 8000 FDS e trace initialy off 1292 FF29 F FCB BSPACE character echoed on rubout 1394 FF2 FF FCB FF echo on line buffer on 1395 FF2B oo FCB e printer oft 1396 FF2C en FCB UF do not send line feeds use cr only to printer 1297 FF2D eecp 4 FOB 265 initial baud rate for cassette is Tae 1398 110 baud use 564 0224 1299 200 baud use 205 00CD 1406 1200 baud use 48 0030 1401 1402 FF2F F956 FD amp DISPLA console output 1402 FF21 FASE FDB GETCHR console input 1404 FFZ3 FD25 FDB MCASOP cassette output 1405 FF25 FOSS FOB MCASIN cassette input 1466 FF27 FaASD FOB PRINT printer routine 1407 FF29 FF F FOB FUNCTS display function table 1408 FFSB FFS1 FOB CMNOS monitor command table 1403 FFS0 FF S FOB UNUSED initial timer 1 routine 1410 FFSF 8600 FOB e no memory interpret 1411 FF4i FF S Foe UNUSED reserved vector 1412 FF42 FFeS FDS UNUSED swi 1413 FF45 FF S FDe UNUSED swi2 1414 FF4 FFOS FDB UNUSES firq 1415 FF49 FEEO FOB
2. 0010 XX _ 8E 04 00 BD FD 53 A7 80 0018 XX 8C 08 00 26 F6 20 F1 This corresponds to the following program 0010 BE 0400 READ LDX ES 400 DISPLAY AREA START 0013 BD FD53 READ2 JSR MCASIN INPUT A FROM CASSETTE 0016 A7 80 STA Xt 0018 8C 0800 CMPX 800 DISPLAY AREA END 0018 26 F6 BNE READ2 001D 20 Fl BRA READ Execute at 10 and adjust the playback level so that a stream of X s appear on the screen 2 3 Store and Load To save a program the S command is used Programs are identified on the tape by a filename consisting of up to 6 letters Thus several programs can be stored on one tape and the load routine will search for the one with the required name For example calling the above program PROG it can be saved with S200 216 PROG where the two numbers are the start and end addresses of the program It can then be loaded with L PROG Load displays the last address of each block loaded Alternatively typing L PROG G200 will load the program and execute it as soon as it is loaded 2 4 User s Registers The contents of the registers are saved in memory when the user s program returns to the monitor these values are loaded into the registers when a program is run using the G command To look at the saved values of the registers type R Registers For example with the above program loaded typing G200 R will display CC A B DP X Y U PC S 04 00 00 00 0217 0000 0000 FBEE 034D PC XX XX XX XX XX
3. CONCHR CRO NTABB DISPCH SEMICA 1v u AMGORY STRING LY 3FF DATA CONCHR BADCMD take out any break point to break address store point to go address store get initial valve point to user pc get address off cc register dummy location for new value point to memory address store get intial value set status zero get input no address given search address table if status 71 or then no change else up one print out address then data set status 1 allow next line and continue save for re use get numbervith error if none is new address set status get input no data found cr else search data table test status if 1 then dec before save new address and exit back doen 1 but if status is 1 then back down 2 then continue save for re use in number should have number store data then check it is ok else tell user 9o up 1 with status 1 then continue get wrong symbol and tell user get hex number from input stream allow leading spaces and stop on first non hex character return number in a with v GETHXS NUMB1 if no number then d and v Put initial zero value get first non blank as hex value wasn t hex move to high nibble rotate into value do 4 times get hex digit from console was hex so use else finish with v clear 0775 erc a7 778 0779 aga 0781 a
4. User s anual b i 1 i eL Ed 2j mn e y red S i TE get Lar Sn I ge E me mti VSN TST E aun Pei NS o ed amet a me t nme TSR tmr Ue tm CE gie e E ACORN 6809 TECHNICAL AND PROGRAMMING MANUAL Chapter 1 Introduction v 2 Monitor Operation 4 3 Summary of Monitor Commands T 4 Monitor Expansion 16 5 Hardware Description 23 6 Software Description 33 7 Instruction Set and Addressing Modes 38 8 Programming Techniques 55 9 Assembly Instructions 67 Appendix Monitor Program Listing TI COPYRIGHT ACORN COMPUTER LTD 1980 ISSUI za p nj EB 1980 1 0 INTRODUCTION The 6809 monitor is designed to operate at two different levels At one level it provides all the commands necessary for the efficient writing and debugging of machine code programs and commands for saving and loading programs to and from cassette tapes At a second level the monitor has been designed with future expansion in mind so that it will form the kernel of a more sophisticated operating system 1 1 Monitor Commands The monitor commands are all single letter mnemonics followed by a number of parameters which are optional and when these parameters are ommitted then default values are assumed Commands are looked up in a table and this table may be supplemented or replaced by external tables supplied by the user Thus user written commands can be linked in with the standard monitor commands to increas
5. cono oF FC os 13 WANNA US GANn ga 20 SF 8269 253040006 18ES 356410FF FFFF 6e217C1 7ho22268 699106 6cea 52020002 21 52020002 SAVS gessi ATOUT ISCIT kx eat BEE eet 24 Lov LEAY BNE LOA BSR TFR BRA LOA LEAY DECB RTS TFR TFR FCB FCB FCB FCB FCB FCB FCB FCE FCS S form length needed SAUZ done all output if lt 256 then SAUS leave alone 255 elsa set to 256 D X form end of block D X U put start end on stack 1 put a data XHEAD header 2 S point to start end 4 two words DATOUT and put start end out D x U get all back modify length OATOUT and send data bytes CHKOUT then checksum SAVE and repeat CONCHR get input SAVZ on cr send eof block w if eof inhibit RTSt then skip x9 LASTC re use input s send eof routine to send header to block header also initialises checksum in uy 2 LY XH1 x es80 CASOPI B A CASOPI loop delag send an x to cassette get type and send data output routine sends b data bytes b zero means 256 bytes aR A Y CASOPI OATOUT get data modify checksum send data repeat until Zero count type in b starting from x x moves up bu b bytes send checksum to tape from y lower byte only YD B A LCASOPAJ checksum to d then get low byte want result FF send check byte drive commands to perform a boot operation d
6. 28 9e o 6 R8N8 04 eF 62 81 iF eg e2 F iF E 84 62 64 06 91 ezceo 2020 0014 62 oF FS esce e 91 91 99 9e WNAWNEH DW WNNNN AUNAWVAHAENYVHA m r m G GNUOQqOQNYNUNOOUOUNeO 960 NONAGOPRUONAQUAGO WNW eo 4 OFFER REH REE ED DIS DIS4 id 255588 L SCRI SETTOP gett Q SERRQEE 289 351 ELD FERTEL BEQ LEAX R Jd TST BEG BMI LOO STD PULS PULS TUE 13 F BRA LR COLs if all columns SIMI net get filled ccol do cr move cursor down 1 line scroll display if required CROW down a row CRON RONS last row yet si if not then done CROW else back up SCROLL and scroll instead SETCUR then set new cursor move cursor back erasing last character BSONE back up cursor eSPACE DISPL then blank las character BSONE and back up again SETCUR then set cursor up back cursor up allowing line and row underflow CCOL left move cursor BS1 no underflow cOLS 1 else set to ccol fight margin CROW ahd up one row BS1 no row underflow CROW cco dispatch routine looks up gt racter in table character in a table eddr Ve table format is first byte number of entries 1 to 255 repeat for each entry character to match with 2 byte offset from start of this table of routine to jump to if characters match flag byte control if no match found posi
7. CWAIT wait 1 bit time 255 COPBIT assume next is zero get next bit MCASO1 do want zero COPBIT else set bit ncaso2 and loop round 1 remove counter CC D X PC and return cwait waits fo 1 bit time destroys x huait waits 172 bit time also destroys x e HWAIT do first half DELCNT get count required 1 decrement HWE while non zero MONDP software asynchronous receiver gets value into a saves all other registers only gets 1 stop bit B 90 rotating counter KIRB wait for MCASI1 oe Start bit HWAIT wait 1 2 bit time KIRB recheck MCAST1 a Start bit CWAIT wait whole bit time KIRB and get input 8 waste time to S match loop delays move bit to carry then into byte MCASI2 repeat for 8 bits CWALT get into stop bit B X PC and done routine gets name from input stream up to characters long no name leaves memory unaltered any mame iz padded to 6 characters with spaces WNANE E CONC HR get a character NAMI nO name SPACE if space NAM2 ignore COMMA NAMI null name 256 6 minus name length B X store a letter and move up NAME done 6 chars exit CONCHR get next letter NAMS on cr pad name SPACE on space NAM4 pad name coma if not comma NAMZ then use SPACE padding B X pad until end of N M4 name buffer CONCHR get next input NAML leave if cr COMMA else NAMI absorb comma LASTC else re use save files on cassette dumps name block data block
8. LOADS KEYON Rrrr GETHO1 BIN2 Ettore MCASOL LBSR LBSR STO LDX LOA BSR Los STB LDe CMPB BEQ CMPA BNE DEC BNE BSR LOA BSR BNE BSR TFR BSR PSHS BSR STA CMPX BLS BSR PULS LBSR TFR Cove BEQ LDX LBSR BRA CMPA LDA STA LBRA LDA STA CMPA LDU CMPA RTS BSR TFR EXG RTS JSR RTS PSHS SEIF PSHS LOB cone NOP BRA cassette file load routine this searches for named file followed by data NAME IN get file name NUMB get offset OFFSET and save NAME e get name file GETHDR header LO D4 ignore others 6 name length TEMP save it CBIN1 get input character a ht and name character v if wildcard LOADL a then matches 1 X else compare LOAD2 wrong name TEMP count name length LOADS repeat for all 6 CBIN1 ignore checksum byte enter here for match without file name check wi get data GETHOR C header LOADS wrong header CBIN2 get start address D X and save while CBIN2 getting end address D put end on stack CBIN1 get data item X amp nd store it 8 if not done LOADE then repeat CBIN1 get checksum byte x get old end address OPXREG show address so far UD check summed in u lower byte only LOAD if ok then repeat LORV else message STRING output KEYON 9 if not x9 then LOAD ignore CBiFLG 80 turn on KIER keyboard OPCRiF then exit get a header from the tape if the expected one the
9. Y LDB Y LDX 7 8 52 7 3 7 5 Indexed Indirect All of the indexing modes with the exception of auto increment decrement by one or a 5 bit offset may have an additional level of indirection specified In indirect addressing the effective address is contained at the location specified by the contents of the index register plus any offset In the example below the A accumulator is loaded indirectly using an effective address calculated from the index register and an offset Before execution A XX anything X SF000 0100 LDA 10 X effective address is F010 F010 SF1 F011 50 F150 is new effective address SF150 SAA Data After execution A SAA X SF000 not changed Some examples of indexed indirect addressing are LDA X LDD 10 5 LDA B Y LDD X 7 3 8 Relative Addressing The byte or bytes following the op code for a branch instruction are treated as a signed offset which is added to the program counter If the branch condition is true the calculated address is loaded into the program counter and program execution will continue at the location indicated by the program counter Short one byte offset and long two byte offset relative addressing modes are available All of the memory space can be reached using long relative addressing as the effective address wraps around between SFFFF and 0000 Some examples of relative addressing are BEQ NEAR short LBGT FAR long 53 7 3 9 Program Counte
10. as required The PC contains 0204 the breakpoint address The third line of the display shows the five memory bytes following the program counter i e the next instruction of the program To continue execution of the program type PL where the optional number after the Proceed command indicates the number of breakpoints to be ignored 1 in this case Alternatively we could type VP The V command without any address cancels the breakpoint Any number of additional breakpoints can be inserted using the M command Suppose the breakpoint inserted at 204 as described above needs to be moved to 207 One way is to type V207 Alternatively the MV command can be used Type MV 0204 BD 0205 F8 0206 EC 0207 39 The breakpoint address is moved to the last address displayed 2 6 Trace Facility An important debugging facility provided by the monitor is the ability to execute a program an instruction at a time displaying the register contents after each instruction To turn the trace facility on type Tl where the parameter 1 indicates how many instructions are to be executed on each trace Then the command will execute just one instruction from the previous halt address and return to the monitor after displaying the registers For example with the example program loaded set a breakpoint at the Start of the program and enable tracing with V200 T1 Then start execution at 200 with G200
11. or exchanged with any other of like size with the EXG instruction These instructions are each two bytes long bits 4 7 of the postbyte specify the source register and bits 0 3 specify the destination register as follows Register D X U B RUE A B CC DP Hex Digit 0 J 2 3 4 5 8 9 A B 47 For example to transfer the contents of A to B TFR A B the postbyte is 89 Note that the instructions TFR Y X and LEAX Y are similar in effect but the TFR instruction does not affect any of the status flags 7 2 7 Synchronize with Interrupt The 6809 s SYNC instruction is used to synchronize software with an external signal The CPU will stop processing instructions when it encounters a SYNC instruction and will wait for an interrupt If the interrupt is non maskable NMI or maskable and enabled the processor will clear the SYNC state and handle the interrupt just as it would normally If the interrupt is maskable and disabled the SYNC state is simply cleared and execution continues without vectoring to the interrupt service routine For example the following routine reads data from an input port on each occurrence of a masked interrupt FAST SYNC Wait for interrupt LDA X Read from port STA Y Put in array DECB All done BNE FAST If not continue 7 2 8 Software Interrupts The 6809 provides 3 software interrupts SWI SWI2 and SWI3 all of which save all the CPU registers on the S stack and vector through an address
12. 0128 9129 6120 0121 0132 0133 0124 0125 0136 0137 9138 0129 0140 9141 0 42 0143 0144 98145 146 9147 9148 0149 0150 e151 0152 0153 0154 0155 0156 0157 98158 0159 0168 0161 9 62 eiez 9164 0165 9166 0167 0168 9165 0170 e1 1 172 0172 9174 0175 8176 177 e178 e179 0180 6181 0182 0183 8184 0185 e196 0187 0188 9185 0190 90191 9192 9132 0258 e250 O35F e268 9261 0262 9263 0263 6267 e269 e268 e260 9371 9372 e275 0377 90279 0278 027D 827F 6281 e382 0285 ese 9389 ezaB e280 0328F 0290 9291 e393 9295 929 6390 BF Q2A1 2A2 BAZ ezns eze ezes BSAA BAC eznE F800 Feeo F302 F304 F807 F80 Feec F80E F8i1 F813 F816 F819 Feic F81E F822 F825 F827 Fa2n Fe2c F820 FO2F F822 F835 Fez F839 F828 F83E FO41 F843 F846 F849 Fe4B F84D F84F F852 F854 iF cE ar ec 26 10DE eeec2 e002 eec eee HETTE EE it eee2 0002 i 90002 eoo eee IPIE eoe 8001 i 9002 eoo 20902 0002 9052 0275 ez BICA an SAV wi 010 ULOLOL C GIO QUNLQ fO C IO GI ON OA GL OON CSSTRT ONLINE LASTE CINST CTRACE USRSTK TEMP BUFFER grer STRT1 STRT2 3 RME 3 3333833333113113331 NMNNNNNNNMNMNNUONSNNMNSNSNMNSO C 38 d33333338383833033033 positon of stack pointer when empty number of instructions to tracesbefore stopping character sent to backspace display keyboard buffer e
13. 1 SIMCHE FUNCTS default is display 1t this is the list of strings used by the monitor Rom CR LF CC B OOP Lara CR LF CR LF CPCI fWhat izis e 24 e fern 7 e this is the set of indirect jumps to redirect the interrupt vector addresses C IRESUJ EL ISMIZ CISWI2 CIFIRQ CILIRG CISWII CINMIJ the following hardware vectors reside in the top 16 bytes of memory when the monitor is in its Standard position srFFFa SE7FO RESUI SWIZI SWIZI FIRGI IRGI SWII NMII RESET 92 command 9 13 in copy command 15 in indexed addressing 52 in indexed addressing 52 S in hexadecimal value 49 in modify command 11 in indexed addressing 52 in modify command 11 in save command 14 in indexed addressing 52 Err error message 10 14 in load command 14 A register 38 ABX instruction 42 Accumulator addressing 49 Accumulator offset indexed addressing 52 Accumulators 38 ACK signal 32 Adding to monitor commands 16 Address RESET 37 Addresses interrupt vector 19 Addressing modes 49 modes instruction set and 38 Addressing modes accumulator 49 accumulator offset indexed 52 auto decrement indexed 52 auto increment indexed 52 constant offset indexed 51 direct 50 extended 49 extended indirect 50 immediate 49 indexed 51 indexed indirect 53 inherent 49 PC relative 54 program counter relative 54 register 50 relative 53 ANDCC instruction 47 Audio cassette
14. B DP X high X low Y high Y low U high U low PC high PC low MV Modify memory starting at breakpoint address The breakpoint address is moved to the address last accessed when the modify command is exited MP Modify memory starting at saved program counter address The next P command will cause execution of the user program to resume at the address last accessed when the modify command is exited Program Execution G address GO Go to address specified Registers are loaded from user register area Will return to the monitor on an RTS or SWI instruction P number PROCEED Proceed after hitting a breakpoint Execution begins at the saved program counter address If a number is entered after the P this number of breakpoints will be ignored by the monitor On hitting a breakpoint the monitor is entered with an automatic R command 12 Program Debugging R REGISTERS Registers prints contents of user registers and contents of the five memory locations pointed to by the saved program counter V address BREAKPOINT Breakpoint insert remove If an address is specified a breakpoint will be inserted at this address Any previous breakpoint is removed The breakpoint will not be inserted until the program is executed using G or Py If no address is specified the breakpoint is cancelled T number TRACE Trace facility The command is followed by a number indicating the number of instr
15. EQU EQU EQU EaU EQU EQU EQU Eau EQU EQU EQU EQU Acorn monitor for 6809 rocessor E ISSUE 1 V49 FEB 1980 This program handles a memory mapped vdu encoded keyboard cassette interface parallel printer and mini floppy bootstrap sreoo normal monitor position at top of memory 0200 256 direct page for monitor 25 number of rows on display 40 number of characters per row 1024 size of display memory in total 0400 location of memory that vdu uses 0800 location of crt controller on vdu card 12 page address register high byte 14 cursor address register high byte 40 drive to bootstrap from other drive is 80 A location of floppy dise controller FLOPY O command register Focc status register FLOPY 1 parameter register FDCP result register FLOPY 2 reset register FLOPY 4 data register 2980 location of versatile intarface adaptor KUIA 0 output register b KORB input ragister b KUIA 1 output register a KORA input register a KVIA 2 data direction register b KUIR data direction register a KUIA 4 timer 1 counter low KUIA 5 timer 1 counter high KVIA 6 timer 1 latch low KUIA 87 timer 1 latch high KUIA 98 timer 2 counter low KUI 9 timer 2 counter high KVIA A shift register KUIA SB auxilliarg control register KUIA SC peripheraal control register KUIA 0 interrupt flag register KULA SE interrupt enable register KVIA F input output register a without handshake 154256
16. FABB FABC FABE FABF FACL FACZ FAC4 FACS FAC Face FACA FACB FACD FACE FADO FADI FADZ FAD4 FADS FAD FADA FADE FADO FADE FAEG FAE1 BF 34 iF 9D iF 80 35 34 44 44 44 8D 6 84 8B 81 23 20 80 86 34 Bi 27 t6 2B A ce E ce E 35 e288 6 91 18 ese 06 10 98 18 ONANAN 82 m NANANNNANHA 30 39 e2 er QNOGONN E8 8 WYNN rae 46 0980 e262 E FC 41 ED 4C EF 4C c e302 UN GN UW UL CI OL GI 30 eespD 0069 20 0072 et 9e7B FAES OQrtee IPAREG HEXOUT HEX2 ee PRINT PWAIT1 PEXIT Zetnt MTABAE MTABB MTABBE STX PULS SETOP PSHS TFR BSR TFR PULS PSHS LSRA LSRA LSRA LSRA BSR LOA ANDA ADDA CMPA BLS BRA BSR LOA BRA SETOP PSHS LDU CMPA BEQ LDB BMI STA LDB STB LDe STB PULS SETDP FCB FCB FDB FCB FOB FCB FDB FCB FDB FCB FDB FCB FOB FCB FOB FCB FDB FCB FOB Eau FCB FCS FOB FCB FDS FCB FOS FCB FOB FCS FDS EQU TAIL set new tail CC x PC MONDP output x register as 4 hex digits to console all registers saved D xX D OPAREG B A OPARSP DPC output a register as 2 hex digits to console all registers saved except a A HEXOUT left nibble S get byte back and 415 do right nibble output a as a single hex digit ve v9 HEX2 A 9 1 CONOUT output and return output a hex digi
17. FEBA FEBC FEBE FECO FEC2 FEC4 FECE FEC8 FECS FECB FECD FECF FED1 FED2 FEDS FED FEDS FEDB FEDD FEDF EC 2B 97 5A 2B 9 85 26 97 iF 1F 8D 96 85 27 96 85 27 39 34 if 96 A 3c 26 35 39 81 FC ea 1E eo 20 F 89 91 F1 iz 31 EZ 10 FA e1 Feo ei 94 FF F 61 ANAN AOON WN NWON NA UNAN ADONG NUN NOON NNNNNNNO ANNEN NANAQ NERWDNAWVNHAUAD Manua Bnawn A BOOT BOOT DERR RNSFR TRN1 ee RSE LOX STX LDA TFR SETDP LDX BSR BSR BSR BSR BSR BSR BSR BSR LOU TFR LDD CMPD BNE BSR LDU LOA LOY LOB BITS BNE STA BSR BNE LBSR BUC LOS LOX LBSR LBSR LBRA L DD TST BMI STA DECB BMI LOA BITA BNE LOA STA BRA TFR TFR BSR LDA BITA BEQ LOA BITA BEQ RTS SEIF LD8 BRA LDA STA CHAI BITB PULS RTS ANRTI set dummy INMI interrupt routine WFLOPV 256 set direct page fA DP to floppy controller FLOPY 256 and tell assembler DISCIT point to tables CMOPAR drive parameters CMOPAR bad tracks CHOPAR mode register CMDPAR drive on DRURDY check ready CMDPAR seek track DRURDY check ready CMOPAR read sector 2 0 put at eo U v and point to it TRNSFR move disc to memory DERR non zero means error SFF42 error FF in case Ver if not FF42 DERR then error no boot present CMDP R start read at sector 2 M4 get address to put at att and number of sectors start of
18. IN HEX SPACE 021E 5A DECB 021F 26 F8 BNE D1 0221 35 24 PULS Y B RESTORE 0223 A6 AO D2 LDA TAF GET BYTE AGAIN 0225 81 20 CMPA 20 ASCII PRINTABLE 0227 25 04 BCS D3 0229 81 7E CMPA ESTE TOO BIG 022B 23 02 BLS D4 022D 86 FF D3 LDA SFF PRINT WHITE BLOCK 022F BD FA21 D4 JSR CONOUT CONSOLE OUTPUT A 0232 5A DECB 0233 26 EE BNE D1 0235 BD F8E9 JSR OPCRLF START NEW LINE 0238 6A E4 DEC PES DECREMENT LINE COUNTER 023A 26 D4 BNE GO 023 735 82 PULS A PC PULL COUNTER RETURN ADDRESSES IN MONITOR FF51 CMNDS EQU SFF51 COMMAND TABLE FB6C NUMB EQU SFB6C INPUT HEX TO D FA75 OPXREG EQU SFA75 OUTPUT HEX FROM X FA97 OPARSP EQU SFA97 OUTPUT HEX FROM A FA21 CONOUT EQU SFA21 PRINT A F8E9 OPCRLF EQU SF8E9 NEW LINE END 17 When the dump program has been entered from the listing in Fig 4 1 it can be executed by typing G207 Any address typed after the Go command will be read by the call to subroutine NUMB and used as the start address of the area to be dumped For example to display the contents of memory starting from SF800 execute with G207 F800 To make the monitor recognize D as the DUMP command the auxiliary command table from 0200 to 0206 is needed The address of this table 0200 should be put at 0371 to replace the address of the monitor s command table FF51 The monitor will then search the auxiliary table first and the D command will be redefined to cause a jump to 0207 The dump command can be s
19. INCA PULS STD RTS LDB BPL CMPA BEQ BSR BEQ TSTS BPL CMPA BNE BSR LDA STX LOB LSLB BPL SETDP TST BEG JSR JMP SETDP LDX CMPX BEQ CMPX BNE LEAX LEAX STX LDA BRA LDX BSR CMPxX BEQ STA STX ANDCC RTS LEAX CMPX LDX RTS set cursor register in crt cont oller CCOFST get cursor address no wrap around LR into x SCURHI point to cursor register put 2 byte value into crt controller value in x high byte register number ina x B get high byte CRTC set register and data move to low byte B get lou byte CRTC set register ani data this routine puts keyboard input into line buffer if no room then ignores character else echoes to display if echo is switched on handles rubout unless line buffer is switched off ECHOF HAVZ buffer off so no rubout RUBCH BSP1 go de rubout PUTCHR put into buffer PUTS no room do not echo if buffer off then no HAUG line feed on cr input CR KBECHO not cr so no KBECHO echo of a line LF feed HEADST move static pointer up put character in a to console ouzput if echo on ECHOF see if echo on need bit 6 PUT1 not on if zero console output routine sends to printer also if switched on e PFLAG if printer off then CANOP 1 i value is zero CPRINTIJ else call printer E COPADRI then console output MONDP HEADDY end of line if at HERDST 1 Start of line PUT1 then nothing to rubout BUFFER do cyclic BSP2 BUFLEN X decremen
20. TRQHAN irq 1416 FF4B FBC FOR SWIHAN swi 1417 FF4D FFOS FOB UNUSED nmi 1418 FF4F B000 FDe 9 initial load offset 1419 1420 FFS1 PTAB2 EQU sd end of tabie 1421 1422 1423 this table contains the standard set of commands 1424 provided by the monitor 1425 1426 FF51 BE CMNDS FCB CMNDZ CMNDS z2 1 number of entries 1427 FFS2 47 FCB G 1428 FFS2 FCBS FDB GOUSER CMNDS go to program 1429 FFSS 40 FCB M 1436 FF56 Fea FOB MEM CMNDS memory examine 1431 FF58 92 FCB R 1422 FF59 F967 FDE EXREG CMNDS examine registers 1422 FFS5B 50 FCB U 1424 FFSC FC6e8 FOB RESUME CMNDS proceed after break 1435 FFSE 4 FCB E 1436 FFSF FOIS FDE TRACEN CMNDS set trace number 142 FF61 92 FCE S 1428 FF62 FESC FDE Seue CHNDS save on cassette 1429 FF64 4C FCS kh 1440 FF65 FDSe Fos LORD CMNDS load from cassette 1441 FFG 56 FCB ou 1442 FF68 FCD2 FOS BREKSET CMNOS set break address 1443 FF6A 44 FCB 3 1444 FF68 F FZ Foe OCT CmNCS dize bootstrap 1445 FFD 42 FCE 5 91 1480 1481 1482 1482 1484 14 5 1486 1487 1486 1489 1490 1491 1492 1492 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1526 1507 1508 1509 1516 1511 1512 1512 1514 1515 1516 1517 1518 1519 FF6E FF70 FF71 FF S FFr4 FF 6 FF FFvS FF A FF C FF7O FF F FFSa FFB1 FFS2 FFe4 FFS6 FFer FF amp 5 FFSA FF8C FFSD FFSF FF92 FF96 FFA FFBA FFBD FFEF FFCZ FFCR FFCE FFCC FFCD FF
21. U adds the signed number in the D register to the number in the U register and stores the result in U Thus LEAX B X is similar to the ABX instruction but whereas LEAX B X treats B as a two s complement signed number between 128 and 127 ABX uses B as a positive offset between 0 and 255 LEAS 10 S can be used to reserve 10 bytes of workspace on the hardware stack This workspace can be addressed indexed using S for example LDA 4 8 or DEC DG Ss 4 he workspace is restored after use with LEAS 10 S The destination and source registers can be different as in LEAX 4 S which loads the X register with a pointer to the 4th byte on the hardware stack LEAX DATA PCR loads the address of DATA into the X register the code for the 42 Mnemonicls And memory with accumulator ASL ASLA ASLB Arithmetic shift of accumulator or memory left ASR ASRA ASRB Arithmetic shift of accumulator or memory right BITA BITB Bit test memory with accumulator CLR CLRA CLRB Clear accumulator or memory location CMPA CMPB Compare memory from accumulator COM COMA COMBiComplement accumulator or memory location Decimal adjust A accumulator DEC DECA DECB Decrement accumulator or memory location increment accumulator or memory location Logical shift left accumulator or memory location Logical shift right accumulator or memory location Unsigned multiply A x B D Or memor
22. U is controlled exclusively by the programmer thus allowing arguments to be passed to and from subroutines with ease Both stack pointers have the same indexed mode addressing capabilities as the X and Y registers but also support push and pull instructions 7 1 5 Program Counter PC The program counter is used by the processor to point to the next instruction to be executed Relative addressing is provided allowing the PC to be used like an index register in some situations 7 1 6 Condition Code Register CC The condition code register defines the state of the processor at any time Bit 0 Carry Flag For add operations the carry is set if and only if the addition causes a carry from the most significant bit For subtract like operations SUB SBC CMP the carry is set if and only if the operation does not cause a carry from the most significant bit Shifts and rotates affect the carry according to the data being shifted The MUL multiply instruction sets the carry if and only if bit 7 of the result is set Bit 1 Overflow Flag Set if and only if the operation causes a signed two s complement overflow Thus N V will give the correct sign even if the sign is not correctly represented in the result 40 Bit 2 Zero Flag Set if and only if the result of the operation was equal to zero Bit 3 Negative Flag Contains the value of the most significant bit of the result of the operation thus a two s complement
23. X PC Note that PSHS A and STA S are similar in effect but PSHS does not affect the status flags Similarly for the two instructions PULS A and LDA S 46 7 2 3 OR AND Condition Code Register To set or clear selected bits in the condition code regsiter the 6809 ORs or ANDs an immediate operand into the register Thus the 6800 s six one byte instructions SEC CLC SEV CLV SEI and CLI hove been replaced by the two two byte instructions ORCC and ANDCC 7 2 4 Multiply The multiply instruction MUL multiplies the unsigned 8 bit binary numbers in A and B and leaves the result in the A and B registers treated as one 16 bit number The MUL instruction can be used as the basis for multiple precision multiplications One common use for a multiply instruction is in the calculation of array subscripts for example to get the element M S1 S2 from an array with dimensions M 100 50 the following code can be used LDY EM Get base address of array LDA S1 First subscript LDB 100 First dimension MUL Multiply D A B ADDD S2 Add second subscript LDA D Y Load value from array element 7 2 5 Sign Extend The sign extend SEX instruction causes all bits in the A register to take on the value of the most significant bit in the B register It is used to convert signed 8 bit numbers to a signed 16 bit number 7 2 6 Exchange Transfer Registers Any register may be transferred to any other of like size with the TFR instruction
24. adding to 16 summary 11 MP command 12 MR command 7 12 MUL instruction 40 47 Multiply instruction 47 MV command 8 12 N flag 41 NAMEIN routine 34 Negative flag 41 NUMB routine 34 Offset load with 14 ONCARD signal 23 ONLINE flag 33 OPAREG routine 35 OPARSP routine 35 OPCRLF routine 35 OPXREG routine 35 ORCC instruction 47 Output cassette 28 device terminal as 21 routines 34 Overflow flag 40 P command 7 12 Parts list 6809 card 68 Passing command 20 PC register 40 PC relative addressing 54 Position independent code 55 Postbyte for EXG TFR 47 3 Power supply 76 PRINT routine 35 Printer interface 32 interface commands 15 Program counter 40 debugging 13 entering a 4 Program counter relative addressing 54 Programming model of 6809 39 re entrant 56 recursive 60 techniques 55 Programs binary to decimal 56 binomial coefficient 60 dump 17 FIRQ service routine 19 illustrating command passing 21 monitor 77 re entrant binary to decimal 58 Pull instruction 46 order 46 Push instruction 46 order 46 R command 7 13 Re entrant binary to decimal program 58 programming 56 Recursive programming 60 Register addressing 50 Registers A 38 B 38 CC 39 40 command 7 13 condition code 40 D 38 DP 38 exchange 47 PC 40 S 38 transfer 47 U 38 user s 7 X 38 Y 38 Relative addressing 53 addressing program counter 54 Relocatable code 55 RESET address 37 Reset entry point 37 signal 26 Resistor colou
25. appear in the top left hand corner of the screen followed by a flashing bar The asterisk is the monitor prompt it indicates that the monitor is in control and is waiting for input The flashing bar is a cursor indicating where the next character will appear on the screen Type in the letters ABCDEF The letters will be echoed on the screen but nothing else will happen Now type return the monitor will reply What is A The convention will be used that what is output by the monitor will be underlined in the examples in this manual The message What is A has been given because the first character of the line A was not recognised by the monitor as a valid command This example illustrates a more important fact the monitor only acts on a command when return is typed Before return is typed the line is just held in memory and it can be changed by typing rubout to erase mistakes In all the examples which follow it is assumed that every line typed in is terminated with return otherwise nothing will happen 2 1 Entering a Program The M Modify command is used to examine and modify the contents of memory All numbers are entered and displayed in hexadecimal In the examples XX indicates that any two hexadecimal digits might be displayed depending on the previous contents of the memory Type in the following M200 0200 XX 30 8D 00 04 0204 XX BD F8 EC 0207 XX 39 0208 XX 08 8D 4F 4B 21 0D 0A 020
26. can be re assembled for the 6809 However the resulting program is unlikely to be optimal and in most cases where size or speed are important it is probably better to rewrite the program to take advantage of the 6809 s more advanced features Many of the 6800 s instructions have direct equivalents on the 6809 The following section lists exceptions to this 6800 Instruction 6809 Equivalent ABA PSHS B ADDA S CBA PSHS B CMPA S CLC ANDCC FE CLI ANDCC SEF CLV ANDCC SFD CPX CMPX P DES LEAS 1 S DEX LEAX 1 X INS LEAS 1 8 INX LEAX Jek LDAA LDA LDAB LDB ORAA ORA ORAB ORB PSHA PSHS A PSHB PSHS B PULA PULS A PULB PULS B SBA PSHS B SUBA S SEC ORCC 01 SE ORCC 10 SEV ORCC 02 STAA STA STAB STB TAB TFR ARAB OTST A TAP TFR A CC TBA TFR B A TST A TPA TFR CC TSX TFR S X TXS TFR X S WAI CWAI SFF 62 8 3 1 Software Incompatibilities Between 6800 and 6809 1 The new stacking order on the 6809 exchanges the order of ACCA and ACCB this allows ACCA to stack as the MS byte of the pair 2 The new stacking order on the 6809 invalidates previous 6800 code which displayed X or PC from the stack 3 Additional stacking length on the 6809 stacks five more bytes for each NMI IRQ or SWI when compared to 6800 4 The 6809 stack pointer points directly at the last item placed on the stack instead of the location before the last item as in 6800 In general this i
27. in page SFF of memory to a service routine In addition SWI disables the FIRQ and IRQ interrupts SWI is used in the Acorn 6809 monitor as a breakpoint and for trace mode The other two software interrupts are useful for operating system calls and memory management 48 7 3 Addressing Modes The 6809 has the most powerful set of addressing modes available on any 8 bit microcomputer it has 59 basic instructions but recognizes 1464 different variations of instructions and addressing modes The new addressing modes support modern programming techniques and some of these have been described in Section 7 The following addressing modes are available on the 6809 7 3 1 Inherent and Accumulator In this addressing mode the op code of the instruction contains all the address information necessary Examples of Inherent Addressing are ABX DAA SWI ASRA and CLRB 7 3 2 Immediate Addressing In Immediate Addressing the effective address of the data is the location immediately following the op code Both 8 and 16 bit immediate values are used depending on the size of argument specified by the op code Examples of instructions with Immediate Addressing are LDA E 20 LDX F000 LDY LEAF Note signifies Immediate Addressing signifies hexadecimal value 7 3 3 Extended Addressing In Extended Addressing the contents of the two bytes immediately following the op code fully specify the 16 bit effective address used by the in
28. interface 15 proceed 7 12 R 7 13 registers 7 13 S 6 13 save 13 store 6 T 9 13 trace 9 13 8 13 Compatability with 6502 65 with 6800 62 Component layout 6809 card 69 CONCHR routine 33 Condition code register 40 Condition code flags CONIN routine 33 CONOUT routine 35 Constant offset indexed addressing 51 Copy command 15 Crystal mounting 73 D command 15 register 38 Debugging program 13 Decoding memory 23 Delayed BA signal 27 Delete character 35 Direct addressing 50 Disk command 15 interface commands 15 routines 36 DISPCH routine 37 DISPLA routine 35 Display 2 DMA 26 Do trace command 9 13 DP register 38 Driver routines 20 DRVRDY routine 36 Dump program 17 E flag 41 signal 29 Entering a program 4 Entire flag 41 Entry point reset 37 Err error message 10 Error messages 10 Error messages Err 10 14 Err 10 I Err 10 19 Rom 10 What is 4 10 Exchange registers 47 EXG instruction 47 Expansion monitor 16 Extended addressing 49 indirect addressing 50 Extra ROM 2732 as 25 ROM 16 25 F command 10 14 Finish command 10 14 FIRQ mask 41 service routine program 19 Flag C 40 carry 40 E 41 entire 41 N 41 negative 41 ONLINE 33 overflow 40 v 40 Z 4l zero 41 Form feed character 35 Format cassette 30 VDU 34 G command 5 12 GETCHR routine 34 GETHEX routine 34 GETHXS routine 34 Go command 5 12 Half carry bit 41 Hardware description 23 Hexadecimal value S
29. occupying memory between F800 and FFFF The Acorn 6809 card can be modified to accomodate a 2732 type EPROM in its place addressed between F000 and FFFF and the present monitor can be copied into the upper 2K of the 4K ROM to provide space for extended facilities on the same card Details of how the extra ROM can be linked in with the present monitor are given in section 4 1 The following modifications are necessary to use a 2732 in the place of IC4 1 Break track from 5v to pin 21 of IC4 2 Link pin 21 of IC4 to Bus All 3 Link pins 9 and 11 of IC11 This will cause the ROM to be enabled for addresses F000 to F7FF in addition to F800 to FFFF 4 Link pins 13 and 14 of IC11 This will include the address space F000 to F7FF in the ONCARD signal 5 4 Bus Buffering The data bus is buffered by an octal tri state bidirectional buffer type 8208 The data bus buffers are disabled when the E signal is low and when the processor is addressing memory space on the 6809 card They will also act correctly when a DMA device accesses memory whether on or off the 6809 card The R W and address lines are buffered by 74LS244 devices and are tri stated to allow other devices to do DMA The R W line is ANDed with the E Signal to give separate NRDS and NWDS signals at the edge connector these are provided so that devices from the 8080 family can easily be interfaced to the 6809 card and the signals are used by some of the other cards in the A
30. printers The following routines all call CONOUT to output characters STRING F8EC Output string pointed to by X terminated by a null Leaves X pointing to nulltl other registers saved OPCRLF F8E9 Outputs CR LF to console Destroys X HEXOUT FA8D Output A as a single hex digit OPARSP FA97 Output A as a single hex digit followed by a space OPAREG FA81 Output A as two hex digits All registers except A are saved OPXREG FA75 Output X register as 4 hex digits All registers are saved 35 6 3 Tape Routines Name Address MCASIN FD53 Software asynchronous receiver Gets value into A with 1 stop bit Saves all other registers MCASOP FD25 Software asynchronous transmitter Outputs value in A as a start bit 8 data bits and two stop bits Rate controlled by DELCNT Saves all registers CBIN1 FDIE Get one byte from tape and update checksum CBIN2 FD13 Gets 2 bytes and forms a 16 bit value in D 6 4 Disk Routines Name Address BOOT FE44 Bootstrap from mini floppy disk TRNSFR FEC9 Transfers data from disk to memory starting at address in U Returns completion code in A when transfer finished or error occurs DRVRDY FEB6 Test if drive ready On entry X points to read drive status command sequence on exit drive is ready and X points to next command sequence CMDPAR FE9F Send one command followed by a variable number of parameters X points to command next byte is number of parameters possibly none X left p
31. program 26 add sector length value FDCS get fdc status and 20 if parameter register fuli BOOT1 n then wait FOCP send number of sectors TRNSFR move data to memory DERR error if non zero NUMB try get number RTS2 got one stay in monitor STACK reset stack and 9 gO to program VDORY query user STRING on display OPAREG with error number OPCRLF newline and exit this routine sends 1 command followed by a variable number of parameters possibly none x points to command next byte is number of parameters x left pointing after last parameter destroys d X get command and number FDCS test status and CP1 Wait if busy Focc send command if no more parameters RTS2 then exit FDCS if parameter 20 1 register full CP4 then wait R get parameter and FOCP send it CP2 then repeat test if drive ready on entry x points to read drive status command sequence on exit drive is ready and x points to next command sequence u ave pointer ux restore pointer CMOPAR ask for drive status Focs wait until 918 result DR ready FOCR get result WDRIUEZ128 60 4 ready bit mask DR2 not ready wait this routine transfers data from disc to memory sta ting at address in u returns completion code in va when transfer finished or error occurs cc save CC while set masks disc is on NMI 04 data available mask TRN2 FDCO get data U and store it sFF wait for interrupt FDCS
32. result will set N if the result was negative Bit 4 IRQ Mask Bit The processor will not recognise interrupts from the IRQ line if this bit is set to a one NMI FIRQ IRQ RESET and SWI all set I to one SWI2 and SWI3 do not affect I Bit 5 Half Carry Bit This bit indicates a carry from bit 3 as a result of an 8 bit addition ADC or ADD The bit is used by the decimal adjust DAA instruction to perform a BCD adjust operation The state of this flag is undefined in all subtract like operations Bit 6 FIRQ Mask Bit The processor will not recognise interrupts from the FIRQ line if this bit is set to a one NMI FIRQ RESET and SWI all set F to a one IRQ SWI2 and SWI3 do not affect F Bit 7 Entire Flag Set to a one if all the registers were stacked as opposed to the PC and CC only after an interrupt The E flag of the stacked CC is used on return from an interrupt RTI to determine the extent of the unstacking 41 7 2 Instruction Set A complete list of the 6809 instruction set is given in Figs 7 2 to 7 6 Some of the more unusual instructions are explained in the following sections 7 2 1 Load Effective Address The load effective address instruction LEA allows all the 6809 s addressing modes to be used to form an address and this address is then loaded into one of the four pointer registers Some uses of this instruction are described LEAX 3 X adds the constant 3 to the X regsiter LEAU D
33. returns here if rts done 2 make room for new return address CC A B DP X V U PC and save all user registers BACK set return address 12 9 amp gairn MONDP B DP BRKOUT remove breakpoints USRSTK save user stack pointer PARSE and resume monitor functions go to user program optional address specified the stack pointer is reset but the register contents are maintained as listed by the e command NBREAK put zero in NBREAK 1 break count STACK get pointer BACK return address U pushed first 11 2 12 registers plus return BS get value and 7M push it 85 9871 9872 0873 0874 0875 8876 0877 9878 9879 0880 essi ess2 0883 0884 ages 0886 oos osass 9989 0899 0891 0892 0893 e 94 0895 8896 0897 6898 0899 6980 e381 e902 eso 0204 e905 a206 09207 e906 6909 0910 6511 0912 0913 6914 9915 216 e917 8918 9919 9928 0921 0922 0923 0924 0925 e926 0927 0928 e929 0930 essi e932 0923 09234 0935 0926 0927 0928 0939 0940 0941 e942 ages 8944 0345 0946 0948 0949 0950 6951 6952 6952 0954 0955 0957 0961 0962 0963 0964 09265 0366 60267 FCi2 FCIS FC15 FC17 Fcig FC1B FCD FCiF FC21 FC22 FC25 FC28 FC2A FC2C FC2D FC2F FC21 FC2S FCS5 FC2 FC28 FCZA FCZD FCZF FC41 FC4Z FC44 FC46 FC4 amp FC4 FC4C FC4E FC4F FCS1 FC52 FCSS FCS FCS9 FCSC FCSF FC61 FC64 FC66 FC67 FC6 9 FCeB Fc o
34. stabilized power supply will be needed this should be capable of supplying at least 1 5 amps 76 0001 e002 eoa 8005 a006 aoar e608 000 e810 0011 Beis e621 ee22 0o23 ea24 0025 eoze6 age 0028 eo29 p020 B031 eo22 B022 0024 0025 B026 eaz ee28 e829 0040 0041 B042 0043 0044 0045 0046 3047 0048 0049 eesi 9052 0052 0054 B055 eese 8057 eese 0059 0061 0062 0062 eecs 2067 8069 90070 0071 0072 0072 0074 9075 0076 0077 0078 2079 0051 ees eose eos 0091 0092 ee92 ees F860 oge vvi e628 8426 9400 egeo agac OBAE Bada eave BABA Gage enel BAGI AOZ oAGS 6986 eosa 0980 essi 0981 6982 e982 0984 0985 0986 9987 0988 0989 essa esa 398C 9380 098E 9898F ereo ea4o 0910 0002 9020 eozr 002A 0097F eer veep 0020 ee2c 0020 0028 0010 0004 0258 0358 ERE ERE MPROM ROWS cOLS PSIZE FAGE CRTC PAGHI CURHI DRIVE FLOPY Fncc FDCS FDCP FDCR FDRST FDCO KUIA KORB KIRB KORA KIRA KDORB KDDRA KTi1CL KT1CH KTILL KT1LH KT2CL KT2CH KSR KACR KPCR KIFR KIER KORAZ INTDEL TLIFLG CBIFLG wk zx 3 a KIER DEFER EF HERE eee EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EaU EQU EQU EQU EQU EQU EQU Eau
35. via a RAM vector to subroutine DISPLA This first checks the character for carriage return linefeed formfeed or delete if none of these the character is written to the next screen location and the cursor is moved on one position Attempting to move the cursor below the bottom line will cause the screen to be scrolled by reprogramming the 6845 CRT controller on the VDU card for a different display start address Before the screen has been scrolled the address corresponding to the leftmost character in the top line is 0400 After scrolling the memory to screen mapping becomes more complicated and the routine CCLOCN should be used to calculate the cursor location 34 The four special characters have the following actions carriage return cursor to start of line linefeed cursor to next line formfeed display RAM cleared screen format reset with cursor off screen delete backspace cursor blank character under cursor When scrolling takes place the bottom line of the screen is cleared 6 2 1 Routines Name Address CONOUT FA21 Console output routine Sends character in A via RAM vector COPADR and to printer via vector PRINTI if PFLAG is non zero DISPLA F95B Default character output routine called by CONOUT Puts character in A to VDU handling CR LF FF and delete All registers saved PRINT FA9D Default printer routine called by CONOUT is PFLAG is non zero This interfaces to Anadex or Centronics parallel interface
36. 00 84 F9 81 0001 0000 FA8B 0001 000A El 98 FA8B 8 1 F F X X COUNT TEMP K10TAB BINDEC LOOP1 LOOP2 NOINC RMB 1 RMB 1 FDB FDB NON RELOCATABLE NON RE ENTRANT 10000 1000 100 10 K10TAB COUNT NOINC COUNT gt X LOOP2 ADDD X TEMP COUNT HEXOUT TEMP K10TAB 8 LOOP1 B A HEXOUT BINARY TO DECIMAL VERSION 1 POINT TO TABLE SUBTRACT POWER OF 10 MAKE POSITIVE IN MONITOR RESTORE D ALL DONE GET REMAINDER LAST DIGIT OF RESULT Original binary to decimal routine 57 0000 0002 0004 0006 0008 0009 000B 000E 0010 0012 0014 0016 0018 001A 001C 001E 0020 0023 0025 0027 0029 002B 002E 0030 34 30 32 6F 20 6c A3 24 E3 A7 A6 BD A6 6D 2A LE BD 32 35 Fig 2710 03E8 0064 000A EE 36 8CF2 FA8B 62 B6 8 2 F F F X K10TAB BINDEC CV CV2 NOINC CV3 FD FD FD FD FC UJ UJ WW UJ PSHS LEAX LEAS CLR BRA NC SUED BCC ADDD STA LDA JSR LDA 10000 1000 100 10 SFF A B X Y K10TAB PCR 2 8 1s NOINC 1s X CV2 X 1 S is HEXOUT 1 8 ix cv B A HEXOUT 2 8 A B X Y PC 58 BINARY TO DECIMAL VERSION 2 RELOCATABLE AND RE ENTRANT ALL REGISTERS PRESERVED END OF TABLE MARKER SAVE REGISTERS POSITION INDEPENDENT GET WORKSPACE ON STACK SUBTRACT POWER OF 10 MAKE POSITIVE AGAIN SAVE A GET COUNT PRINT A I
37. 0280 0281 0282 9282 e284 e285 0286 0287 0288 0289 0290 F857 Fesa Fesc Fe5E F860 F862 F864 F866 F868 F86A F86C F86F F871 F873 F877 F87A F870 F8 F F881 F884 F886 F888 F88A Fesc FesF F890 res2 F894 F896 F898 F89A F89C F89 Feae FeA2 Faas Fence FSA F8AA F8AC Feet Fese F8B4 FEBS B 86 1F SE 27 27 27 1 20 34 10FF BF TF 96 27 81 26 7F 39 8 8 45835988 CEPTETS SRSSRSSRRESR SESRSSBRRURERS eiei es 00023 75 84 41 17 ES 71 0137 E9 0280 0275 883358 RE e t 2 gt 3 8238 RERA S8325855 Bak FF96 ce 91D1i F8 ci eines F8 919D FFBD ceo 1B1 F8 YDAN NWANUA ANA UNANG ANNNNONNA RBARANGVHVA OANWAANO 0267 12 WNHVANNGHWOUWGNWONWNVANGANY MON1 PARSE PARSEC xkkcogRGRGRGR OR 8 i CONCHR ONIN CONS 4 3 Rx REG ms EX1 Ex2 EX2 STA LOA TFR SETDP LOX BEQ LDA BEQ BSR BEQ LOX LBSR BRA SETDP PSHS STS STX CLR BRA LDA TST BEQ BSR CMPA CLR RTS SETDP PSHS LOA TFR Lon BEQ CLR PULS Lox SEQ DECA LDS CLR CLR PULS JSR STX PULS LOX BSR LDU Loe LDA LBSR DECE LbB Lox LBSR DECB LOX LBSR Lou LOX LOB LDA LBSR DECS ONLINE set no cr yet MONDP f DP MONDP LINEPT see if mem input PARSEC if so then QN see if null yet MENO end if is a null CONCHR get input MON prompt on cr CMNDI else co
38. 09 card 73 9 2 Visual Display Unit Card The 6809 card is designed to work with the Acorn VDU Card which will drive a monitor or television The standard output is a 1 volt 75 ohm composite video signal and a 75 ohm coaxial cable connected to this will drive a monitor directly This signal may also be used to drive a UHF modulator to give an interface to a standard television 9 3 Cassette Interface The Acorn cassette interface card is a Computer Users Tape Standard interface which connects to the recorder as shown IC DIN emi oorfoT ro REcokDER DINPINA Ov DIN PINB INPUT FRom R ceQ Def ov BAcK VIEO OF DIN LOG 6 cs CY in CABLE SIDE This recorder output consists of one of two tones 2 4 KHz represents a logic 1 and 1 2 KHz a logic 0 Each bit i e o or 1 lasts for 3 3 mS giving an operating speed of 300 bits second Both recording and playback are crystal controlled giving a low error rate and except on very cheap recorders whose speed may vary no trouble should be experienced in transferring tapes from one machine to another 9 4 Keyboard and Cassette Interface Connections A parallel ASCII keyboard is required to be fitted on the front of C P U card A 5 volt supply for the keyboard is available and the board requires a low for key depressed strobe signal The connections may be soldered to the front of the board as follows 74 top bottom O P NM Q amp Ui Oo 10 OC C MN O0 4 O
39. 20 sets the carry on the 6502 but clears it on the 6809 3 The X and Y registers on the 6809 are each 16 bits wide but only 8 bits wide on the 6502 65 4 The 6502 s instructions INX DEX INY DEY correspond roughly to the 6809 s instructions LEAX 1 X LEAX 1 X LEAY 1 Y and LEAY 1 Y However note that whereas the 6502 s instructions affect both the N and Z flags the 6809 instructions affect only the Z flag 5 The 6502 s indexed indirect addressing mode can be directly replaced by the 6809 s indexed indirect mode LDA TABLE X on the 6502 becomes LDA TABLE X on the 6809 However the 6502 s post indexed indirect mode LDA TABLE Y has no direct equivalent in the 6809 Instead the address can be held in a 16 bit register such as U and the B register can then be used for indexing LDU TABLE LDA B U 6 The 6502 s BIT instruction not only sets the Z flag depending on the result of ANDing the accumulator with the specified memory location but also copies bits 6 and 7 of the location into the N and V flags respectively The 6809 s BIT instruction does not do this but the TST instruction can be used instead 66 9 0 ASSEMBLY INSTRUCTIONS 9 1 6809 Card Before attempting to assemble the 6809 card check that all the components are present and that none have been damaged It is worthwhile taking a few minutes to make sure that all the components can be identified Sometimes components will be substituted in cas
40. 4 FrB56 FBS8 FB5n FBSD FB 8 FB62 FB64 FB66 FBS9 FBeC FrB a FB 2 FB 4 FB 6 FB 7 F878 FB79 FB Fo7e FB D FB F FB82 F884 FB986 17 CE 20 CE 1ent zea DE 23 26 109E CE 208 cE 10RE 17 27 16 21 1F 17 ce 07 26 aN BRETRNEGRBS Bonge SRVBLHS 6168 OAZ ez 9295 C4 3E AA 4A AA ezec 9293 c4 FD 74 FAB FESS e2 21 21 FFS8 84 FF 5 ei Al a9 A2 40 e2 FB21 FB21 FD4B FADZ FE6R e2 oF C4 FB45 ZF 62 a 1A 12 FFF FDeC 21 FF FD16 e1iD es i18 14 a4 6i FS 11 EE FD QI QUOy Q UL UL GI DW Woo VENVEWVHA ANN UNWUN AW WANNA ANANN guauo NOUNS VWNUWOWWROaWND aw WUNWN NNR NN NN WANN ID VADOR GADDR ACORI PADDR RADDR RADDR1 NOTA DeT1 COMMAA SPACEB DATA SEMICB SEMICA MINUSA MINUSB MIND2 NOTB eee SE NUMB4 LBSR LDU BRA LDU LDY BRA LDU LEAU BRA Loy Lou BRA LDU Lov CLRB LBSR BEQ LOX LBRA TSTB BLE LEAY TFR LBSR LDA LBSR LDB STB BRA STA BUS TFR CLRB EQU EQU LBSR SEG LDX LBRA TSTB LEA STY RTS EQU LEAY TSTB LEAY BRA STA Bus STB CMPB BEQ LOX LBSR LEAY LOB BRA LBSR LBRA SETOP CLRA CLRB ASLA CLU BRKOUT WCBREAK ADDR GSAU 0 DATA USRSTK 10 U ADORI USRSTK TEMP DATA MSAU U CONCHR CRA MTABA DISPCH CRA 1 9 YX OPXREG RI OPARSP 1 ONLINE DATA LASTC MERR D Y
41. 522 0522 0524 0525 e526 0527 0529 0520 0531 0532 8522 0534 8525 e526 8337 0538 65239 0540 0541 0542 0543 83544 e5 s5 0546 0547 0546 0549 esse 0551 0552 0553 6554 0555 0556 ezs 0558 0559 0561 S562 e565 e5e7 eses 6569 0570 6571 0572 90572 0574 0575 0576 0577 0579 0580 F9EE F9F1 FOFS F9FS FOF FSFS FOFC F9FD F9FF FAG2 FAG FAGS Faa FAG FAGB FAOD FASF FAIG Fat2 Fe 14 FALG FAIS FALA FAIC FALE FAIF FA21 FA24 FA26 FA2A FAZE FA20 FASZ FAZ4 FAS Faso Fasc FAZE FA4O FA42 FA44 Fh46 FASS FASA FA4C FA4E FASO FA52 FAS FASS FASS FASA FASD FASE FAGO Fhe2 FRE64 FAG FASA FA6C FAGE 24 35 Fo 4C 25 FD 39 ne 2n 81 27 8D 27 5D 2A 81 26 SD 86 oF De 56 25 70 27 6E 9E 9c 27 8c 26 26 20 oF 20 FFes 61 GE NOW 18 esee 04 asad URADNAAN 66 a4 F 22 27 43 as en e6 e4 OU N XGINOINGNONKNGA 87 eo WUNA 0000 0261 7 a4 3 9F e26D 12 Sr 0265 8 eoo 89 87 1E Q2AE es 88 Sz IF 89 5F Ds GQAGUUWVaAW ROA 89 eB BB e6 94 89 FE RVORKsWwona e1 ez exek CESES R E eoo 11 e2 EF 2 0288 e287 F6 ES 84 NONOS WO SETCUR QE xx ETPAR HAVE KBECHO FEEF CONOUT CANOP 1 BSP BSP2 k kkXk x PUTCHR PUTI BUMPU ANRTS eee GETCHR GETCH2 GETCH1 LBSR TFR LDA PSHS PULS STO
42. 59 1160 FUSS FOSS FOZ FDSA FD2C FD2E 3F FD41 FO42 FD45 F O47 FD4S FD4B FD4E FDSe FDS2 FDSZ FOSS FOS FOSA FDSC FOSE F061 FDEZ FOES F068 FD6A FO6D FDe E FDeF F071 FD 2 F075 FD amp FD B F070 FD F FD81 FDe2 Foss Fos7 FD89 FDSA FDSC FUSF F091 F093 FOSS FD9 FD99 FD3D FDSE FDA FDAL FOA4 FORS FDAA FOAC FD D FOAF FDB2 FDB4 FOB6 FDBS FDBB FDBO FOBF FOC1 FOC2 FDC Focs FDCB FDCD SRSRE 4 96 Fe eB 80 F6 28 F6 11AC 58 46 24 35 17 27 81 27 81 27 ce A 27 17 81 27 81 26 A 39 1 27 81 27 9 39 9t 17 RR 17 85 c6 8 ce BREBES E4 esec oD DF EF 20 EE 61 9 MOQG QN PN OW 03263 1F FC ANFON 9002 eo v I e GN ON MN NO UN GFOLN GUI 99 0 o amp FADB ac F6 b e Q GIN OI OUQIONGONGQN GIO QRNOUIN GN QN OITGQOQ OQ NO NNUONNSONOUXvOO O0 MCASOZ MCASI2 NAMS NAM4 NAMI NAME Oe ERE EE PNE SAVE DEC BMI STB BSR ANOB LSRA BCS ORB BRA LEAS PULS SETDP BSR LDX LEAX BNE RTS SETOP PSHS LBA LOB BMI BSK LD8 BNI BSR LOB CMPX CMPS LSLB RORA BCC BSR PULS Lox LBSR BEG CMPA BEQ CMPA BEQ LD8 STA INCB BEQ LBSR BEQ CMPA BEQ CMPA BNE LOA STA INCB BNE RTS LBSR BEQ CMPA BEQ STA RTS LDX LBSR STX LDX LBSR STX LDB LEAX LDX LDO s bits counter MCASOS all done KPCR put out bit
43. A remains high during the null cycle and that all irrelevant bus buffers will be turned off 5 5 System Clock The system clock is derived from a 4 MHz crystal giving a 1 usec instruction cycle time The Q and E signals at the edge connector are therefore 1 MHz 26 DELAYED BA Fig 5 2 Generation of delayed BA signal 2d 5 65 6 Audio Cassette Interface Programs and data say be saved on cassette and loaded from cassette using the interface programs included in the 6809 monitor The 6809 card provides logic level input and output lines and the cassette interface routines transfer data onto these lines in standard serial format The card does not include circuitry for the generation of tones to encode the serial data in a form suitable for storage on an audio tape but the full circuit is given in Fig 5 3 A kit of parts for this circuit with a circuit board is available from Acorn For flexibility the bit rate is determined by a software timing loop in the cassette input and output routines the value of the delay counter can be altered to give different baud rates The default rate initialised on reset is 300 baud but rates of up to 1200 baud are possible The serial input and output routines can also be used to provide interfacing with serial devices such as a terminal or a teletype Output can be vectored to the serial output routine simply by changing a vector address stored in RAM To receive input from a serial
44. AGE current page set CPAGE 1 to start of display memory SETTOP set page in crte chip SETCUR and set cursor in crtc chip clear the display memory to all blanks SPACE 256 SPACE PAGE start of display memory hoe store two blanks PAGE 1024 and repeat CLRS1 until done all page this routine used to put a character to the vdu handling cr l backspace and form feed all registers are saved DP CC D X Y U save registers SMONDOP B DP FUNCTI get function table IRQ stop interrupts since not re entrant DISPCH jump on function table DP CC D X Y U PC then restore and return this routine puts a character on display and moves cursor CCLOCN find location in memory P nd store character CcoL move cursor across cco then done if 03287 8288 02389 0390 9291 e292 8292 8295 0296 0297 eise 0449 0450 9451 8452 0453 0454 9455 9456 6457 8458 94539 0461 0462 9465 0466 9467 0468 0469 9470 0471 e472 9472 9474 9475 9476 0477 e478 0479 e480 e461 9482 8483 F971 F972 F975 F977 F979 F978 F970 F97F F981 F982 F985 F987 F999 F988 F980 F9er F991 F993 F995 F99 F999 F998 F990 F99F FIA Fon2 FoR F966 FIAS Fone FOAC FORE FB0 F961 F9BZ r9es FOB F989 F9BB F9BD F9BF F9C1 F9C2 F9cS F9ca F9Ct F902 F904 F906 F909 F208 F900 F9Ee F9E2 FIES F9E6 FIES F9E F9EC 82 oF 8888 9898228 48888 995 95853
45. CE FFD2 FFDZ FFD FFDB FFDF FFE2 FFE FFEB FFFG FFFG FFF2 FFFS FFF6 FFF8 FFFA FFFC FFFE 6E 6E 6E 6E et SE 6E F023 20 FBec 2c FBec 2 Foie 46 For 1 Fo3e FF F e4 FAGD ga Fors TF Fhae ec Fone FIEA FFSF S26F6D2F eoeneco 42422020 41202042 20445020 20202058 2a 20282059 20202020 55202026 50422626 202052 epenoa eben 504350 ee 57686174 20697 ee 45 20 45727226 eo 9F 9277 SF 0379 SF 637B 9F 0270 SF ez r 9r 8281 SF ZSZ E7FOo FF02 FFO7 FFOB FFOF FFEZ FFE FFEE Fee NNO HD OO CMNDE FUNCTS FUNCTE MARY SCRLF TITLES PCMESS cary TERR SWIG SWI2I FIRGI IRQI SWIT NMIT k 6 Foe FCB FDB FCE Foe FCB FD8 FCB FDB FCB FOB EQU FCB FCE FOR FCB FOS FCB FOR FCR Foe FCB EQU FEC FCB Foc FCC FCB FCE FCC FCE FCC FCE FCC FCC FCC FCE JMP JMP JMP JMP JMP JMP JMP ORG PUT FOR FOB FOB FDE FOB FDE FOG FDE END PCNTL CMNOS copy to printer SPACE fNRTS CMNDS ignore spaces COMMA ANRTS CMNDS ignore commas TRACE CMNDS do trace operation IE LOGA6D CMNDS finish file load 1 BADCMD CMNDS default is query user this table contains the standard functions provided by the vdu control programs FUNCTE FUNCTS 2 1 number of entries CR DOCR FUNCTS carriage return LF DOLF FUNCTS line feed BSPALE DORUB FUNCTS rubout FREED CRICL FUNCTS form feed
46. DU card 74 format 34 scrolling 35 Vector addresses interrupt 19 Vectoring interrupt 19 Verify from cassette 14 VMA signal 26 What is error message 4 10 X register 38 Y register 38 Z flag 41 Zero flag 41 16 bit instructions 44 2732 as extra ROM 25 6502 compatability with 65 6800 compatability with 62 equivalents to 6809 instructions 62 6809 card component layout 69 card parts list 68 instructions 6800 equivalents to 62 programming model of 39 8 bit instructions 43 CEE ERG Y xr 244 i 25 D 5 26 A 25 AZ e An 27 A 28 49 z F R T 3 Block G 32 ov i eh lak o5 OZ 19 7 S Atha 3 Pout og 5 U Alba 7 a O O O2 6 9 6 22 84 23 85 24 wa 25 gesa ye e 27 Waar Z8 cn ome 29 WT Bo Fia 9 AS w j e Caso 2 oy 145 O o O O cff C42 4013 14 C S MC EBOD 522A TALS 244 276 32 24 74L5 244 NS 4208 O ime N 3 PLACES Foe ca 2732 Q cor 7 mack FOR c4 amp 2732 BOARD S SUPPLIED FoR 104 27 6 SV 7ELSE DORN w7le Gwos 200 0 2 JE Crecuir OAgean Coe corrtigar 1380 Acel Co Po refs TD 4 A MARKET FLU Dare CAMMMDEE 2 re 0823 318772 4 2 80 G 809 Feocessoe Caro Acoen COMPUTERS TD C7 ACORN COMPUTER Acorn Compu
47. F XX 08 8D 4F 4B 21 0D 0A 0216 XX 00 This has entered the following simple program which calls a routine in the monitor STRING to output a string of characters to the display 0200 308D 0004 PROG LEAX STR PCR GET STRING ADDRESS 0204 BD F8EC JSR STRING MONITOR ROUTINE 0207 39 RTS RETURN 0208 08 STR FCB 08 8D 4F 4B 21 0D 0A 020E 08 FCB 08 8D 4F 4B 21 0D 0A 0216 00 FCB 00 TERMINATOR To execute the program use the G Go command Type G200 The program will display OK in double height flashing letters and return to the monitor s prompt The program can be re executed by simply typing G since the command remembers the last address used 2 2 Cassette Calibration The next step is to save the program on cassette The playback level of the cassette is quite critical and so it is first necessary to find the optimum playback level for the particular cassette recorder being used First enter the following program which will record a stream of X s on the tape MO 0000 XX 86 58 BD FD 25 20 FB ues This corresponds to the following program 0000 86 58 CALIB LDA X 0002 BD FD25 CALIB2 JSR MCASOP OUTPUT A TO CASSETTE 0005 20 FB BRA CALIB2 LOOP FOR EVER Execute the program by typing GO and record for a minute or so Stop the program by pressing reset then enter the following program which will read characters from the cassette and store them in the display area of memory M10
48. FC6F FC 1 FC S FC S FC FC7A FC D FC F Fce1 Fcez FC8S FC86 rFca88 FC8S FCces8 FC8F FC92 FCSS FCse FC9B FC9E FChe 2A 22 SE SF AF SD 25 8E s0 329 80 2 97 86 Ar 29 gE Sc 27 21 29 325 26 56 A 3 17 27 1 27 97 4F 9 29 9E 1026 17 17 17 1 39 FFFF 84 oF Fe ea A 84 18 x 3 EF E4 E4 eree 9984 FF FFeG FF61 Fce2 3 61 75 FC18 FFC3 FCS FDes FC4E FBE1 FB ORLE NO GA ANAN MARON YUN B G 0 GEN BWA QoxGN NNOOUNULOQqN UO Goog Xo0dddgou Vaenawniy d OESE E E E ECETES BRKSET BRKIN BRK1 BRKTST BRK16 BRKOUT BRK2 TUSER1 TRACE TRACE2 PCNTL POFF PON BABI DECB BPL LEAS LDX BSR STX STX BSR PULS BSR LDX BSR STX RTS BSR BEQ STA LDA STA RTS LDX CMP BEG LOA CMPA RTS PULS BSR BNE LOA STA RTS PULS STX LDA ANDA STA LDD STD PULS LBSR STD RTS LDX BEQ LEAS STX BSR LDX LEAX LBRA LBSR BEQ CMPA BEQ STA CLRA STA RTS LDX LBNE LDX LBSR LBSR LBSR BNE RTS GO1 for all registers 2 U new stack ignore return address GSAU saved address NUMBX change if given GSAV and restore 10 put as user pc BRKIN insert breakpoint CC B DP X Y U PC amp nd begin user program change user breakpoint position BRKOUT ensure old is out SFFFF value for no break NUMBX cha
49. I Oy J O o 5 volts Data Data Data Data Data Data Data E Reset ey strobe bit bit bit bit bit bit bit OrRrNWH UO CASIN CASOUT 0 volts The reset is provided by a simple push button connected to 0 volts This is often available as an extra key on ASCII keyboards If desired a 20 way pcb header can be fitted to the C P U card in which case the keyboard connections are as follows 20 Data 8 Data 6 Data 4 Data 2 Data 0 Data 8 E 6 CASIN 4 CASOUT bit bit bit bit bit bit 5 9 Data bit 6 7 Key strobe 5 Reset 3 Xo 5bevolts 10 volts 75 9 5 Backplane The A side of the edge connector on the 6809 card carries all the essential bus signals and these should be connected to other cards in the system by means of a suitable backplane A piece of 0 1 matrix strip veroboard may be used the cards connecting to the backplane by means of 32 way indirect plugs and sockets Alternatively the Acorn backplane card may be used this will accomodate 64 way indirect connectors thus providing access to the B side connections on the cards The connections between the cassette interface and the 6809 CPU card may be made by connecting the following pins on the backplane connectors CPU card pin A29 to cassette interface pin Bll E clock B19 B12 CASIN i B20 i B13 CASOUT 9 6 Power Supply To power the 6809 card and the VDU card a 5 volt
50. LBRN Branch never BVC LBVC Branch if overflow clear BVS LBVS Branch if overflow set Fig 7 5 Branch instructions O Mnemonic Operation ANDCC ANO condition code register i CWAI AND condition code register then wait for interrupt NOP No operation No operation Return from subroutine SWI SWI2 SWI3 Software interrupt absolute indirect SYNC Synchronize with interrupt line Fig 7 6 Miscellaneous instructions 45 instruction is position independent since it contains the offset of the data from the instruction not the absolute address of the data Note that LEAX X has the same effect as the instruction LDX X 7 2 2 Push Pull The push and pull instructions enable any combination of registers to be saved and restored using either stack The instruction is two bytes long regardless of the number of registers pushed or pulled each bit in the second byte of the instruction corresponds to a register and if the bit is set that register is pushed pulled The order of stacking or restoring is a hardware function irrespective of the order specified in the assembler statement and is shown below 0000 Increasing Address gt FFFF cc A B DP X Y U S PC Thus the CC is pushed last and pulled first if specified Since the PC is pulled last the sequence PULS A B X RTS may be shortened to the identical sequence PULS A B
51. N HEX DIGIT RESTORE A DONE GET REMAINDER PRINT IT RESTORE WORKSPACE RESTORE REGS amp RETURN Improved binary to decimal routine and restored by the instruction LEAS 2 X Finally the contents of the registers used by the routine are saved on the stack on entry to the routine with the instruction PSHS A B X Y and restored on exit from the routine 59 8 2 Recursive Programming The provision of a user stack and the wide variety of addressing modes make the 6809 very suitable for recursive programming Many programming problems can be solved better recursively than by conventional iterative methods and such solutions are often shorter and simpler to understand Typical applications include the writing of high level language compilers and syntax analyzers and algebraic manipulation A recursive routine is a routine whose definition includes a reference to itself As an example of the ease with which the 6809 handles recursive programming a routine to calculate binomial coefficients will be considered The binomial coefficient C gives the number of different combinations of n things taken r at a time Thus the number of different combinations of three things A B and C taken two at a time is C or 3 namely AB AC and BC One possible recursive definition of this function is as follows C n r 1 if n 0 1 if n r C n 1 r C n 1 r 1 otherwise For this definition the function has beed writt
52. O C then exit CORY output query STRING Message CONOUT 4nd character OPCRLF followed by cr 1lf CONCHR get input and BADI if not cr then ignore it then ca ry on 86 esea e969 KED 3971 0972 e973 0974 0975 e976 esr e978 8979 a981 9982 e982 e965 esee ese e988 8989 0990 e991 e992 8993 8935 0996 ess 8998 0999 1000 1001 1002 1003 1004 1085 1006 1007 1008 1009 1010 1011 1012 1813 1014 1015 1016 1017 1018 1019 1820 1021 1022 1822 1024 FCAL FCA4 FCA FCAS FCAC FCAE FCB FCB2 FCB4 FCB6 FCB8 FCB FCBC FCBE FCCe FCC2 FCC4 Fcc FCC8 FCCA FCCC FCCE FCDe FCD2 FCD4 FCD6 FCDS FCDA FCDC FCDE FCEO FCE2 FCES FCE FCES FCEA FCED FCFO FCF2 FCF4 FCF6 FCF8 FCFB FCFE FDee FDe2 FOSS FDO Des FDOB FDeo 2 FDIG FD12 FO1S F015 FD1 FD1S FDib FD1D FD25 FD27 F z9 F eb FO2F FUze FUZ1 8D 26 80 1F 34 A7 22 35 17 iF 52 27 SE 1 81 26 86 B 16 24 86 B 81 26 AL 39 80 1F 1E DZ 29 gt 22 23 E eepi FECS 297 32 42 et 3i 46 8e E4 F8 3E i Fose 298 FFCD FBFC 39 o2 93st FBEB e2 10 eset 1 os FA 11 Ee es 89 es 99 COGO QU GNO X A NON IMNU GG 1 UO QNONNUONO C U MN GN GO OQONOS X NO OCOCNVNONUN S UANNAN oF 26B 12 17 es CF eoo 5 WNHNNANWS eet LOAD Load2 LOAD LOAD LOAD LOADE
53. RS1 Ost x ISPLA SIMCHR LDX LDX STO BEQ LEAX LDA LDB STD DECA 1 STA LOA WSCRLF string address of cr 1f output the string pointed to by OO until a null leaves x pointing to null i other registers intact A X get data 3 0TXT 2C finish if null CONOUT else output STRNG1 and repeat fA PC get back a and return calculate apparent address of cursor without allowing for memory wrap around result in d COLS CROW cco e CPAGE calculate real address of cursor in memory space result returned in x D CCOFST apparent address 8211 wrap around in 1k page PAGE add start of page D X D PC unsave and return initialise versatile interface adapter IKPCR 256 IKIER HVIA point to via KPCR KVIA X peripheral control register KIER KVIA X interrupt enable register OS7F printer output 7 bits plus KDORA KUIA X cassette input on a side KIFR KUIA X cancel any KIFR KVIA X interrupts present initialise crt controller on vdu card r or s version CRTCSU 2 table for v version PAGHI 14 256 SAA test the page register CRTC n Clow byte for read write CRTC 1 ability CRTCI1 if so then v version CRTCRU CRTCSU X else get r table instead M1 setup 12 registers A X get data CRTC and store it in correct register CRTCI2 repeat until all 12 done reset display to a blank page vith cursor at top left of screen CROM row O ccoL column CP
54. Successively typing will step through the program as described 2 7 Error Messages Whenever the monitor reads a character such as X that it cannot understand it prints What is X The rest of the line is ignored An unrecognized interrupt will give the message TEBE For example attempting to execute an SWI2 instruction 10 3F without first redefining the interrupt vector ISWI2 will give this error The only way to exit from this error is by reset When the M command is used to modify memory a check is made that the Stored value is correct If a discrepancy is found the message Rom will be given to warn the user The cassette tape format includes a checksum byte at the end of each block of data The load routine checks this and if an error is found the message XXXX Err is given where XXXX is the last address of the block containing the error The F Finish command can be used to finish loading a tape which contains errors it will load without searching for a filename Finally errors during the disk bootstrap command D are of the form Err XX where XX specifies the error number Err FF means that the disk did not contain a valid boot file other error codes are those generated by the disk controller 10 3 0 SUMMARY OF MONITOR COMMANDS Some commands are followed by optional parameters These will be specified in quotation marks in the following list e g name If any parameters ar
55. The user s program can also be terminated by a SWI instruction 3F in which case the registers will be displayed automatically on return to the monitor The memory area where the user s register values are saved can be accessed automatically by typing MR The first location displayed corresponds to the CC register and the other registers follow in the order displayed in the R command By modifying the contents of these locations the initial contents of the registers can be specified before running a program The program counter or PC is also saved in the register area after a SWI instruction and can be modified with the MR command along with the other registers A program may be executed from the saved PC address by means of the P Proceed command 2 5 Breakpoints The simplest way to debug a program is to examine the contents of the registers at various points during the program s execution This is achieved by inserting a breakpoint at the desired point is a SWI instruction which will cause a return to the monitor a display of the register contents The monitor will insert and remove one breakpoint automatically for example to insert a breakpoint after the first instruction in the above example program V204 Now executing the program with G200 will display CC A B DP X Y U PC S 80 00 00 00 0208 D000 0000 0204 034D PC BD F8 EC 39 08 Note that the X register contains the start address of the string 0208
56. ULS LOA TER SETOP LEAX STX LDX BEG LEAX STX BRA STS TFR RTS LEAS LDX STX TFR STS CLI CLR CLR STX LOB LDA STA D PC gethxs get a hex digit ignoring leading spaces gethex get a hex digit both return value in a with vm else set vel if non hex CONCHR get input GETHS on cr no number SPACE if space GETHXS then ignore GETH2 change to hex CONCHR get input GETHS on cr no number vo GETH1 illegal hex LE GETH number hex VA GETH1 illegal hex wF GETH4 alpha hex COMMA GETHS absorb comma LASTC alse re use bad hex alpha offset vo number offset with v clear MONDP resume user program using stack as stands 2 strip return address NUMB get number or zero NBREAK and set break ignore count BRKIN insert breakpoints CC A B DP X V U PC amp nd pull all user registers off stack software interrupt handler come here on breakpoint either stops and displays registers or traces past breakpoint and resumes MONDP setup 4 DP direct page MONOP tell assembler 18 back up 1 Users 18 S program counter BRKOUT remove breakpoint NBREAK get count RES1 stop if zero else 1 decrement NBREAK and restore TUSER1 trace past break RES2 then resume again USRSTK EXREG display registers BACK and stay in monitor change number in x if one given in input stream destroys d NUMB NUMBX1 no number 0 user program
57. Z flag while LEAS and LEAU do not Thus the User Stack does not exactly emulate the index registers in this respect 64 8 4 Software Compatibility with 6502 Acorn have decided to support both the 6502 and the 6809 because these processors each have advantages for different application areas The 6502 will generally produce shorter faster programs in simple applications such as industrial control where only 8 bit arithmetic is needed and where data is to be moved between pre defined areas of memory For more complicated programming tasks such as the writing of high level language compilers text processors and interpreters the 6809 s more sophisticated addressing modes and 16 bit arithmetic operations will make the 6809 better suited to the task Most programs for the 6502 can be translated fairly directly into instructions for the 6809 but because programs for the 6502 tend to make use of assumptions about the positions of data and variables programs translated directly from 6502 to 6809 will generally be longer and slower The following differences between the two processors should be noted 1 The order of the address bytes on the 6502 is the opposite to that on the 6809 Thus JSR 1234 is 20 34 12 on the 6502 but BD 12 34 on the 6809 2 The SBC and CMP operations on the 6502 set the carry flag if there was no borrow but clear the carry under the same circumstances on the 6809 For example LDA 40 SBC
58. allel handshake interface to a printer is provided on the Acorn 6809 card and printer driving routines are included in the monitor The handshaking signals comprise a BUSY line from the printer which is connected to PA7 of the VIA and a strobe signal from the VIA pin CA2 to the printer When the BUSY signal goes low the printer routine will put a byte on the printer lines PAO PA6 and take the strobe low for 7 usecs Although the ACK line from the printer is connected to CAl of the VIA the existing software does not make use of this signal The outputs to the printer PAO PA6 and CA2 are buffered by an octal buffer device 32 6 0 SOFTWARE DESCRIPTION This section describes the operation of the most useful subroutines contained in the monitor these can all be incorporated into user programs without a full understanding of the monitor being needed 6 1 Input When a key is typed at the keyboard an IRQ interrupt occurs if it has not been masked and the key s value is stored in the next location of the 80 character circular buffer The console input routine CONIN is normally indirected via a RAM vector to the subroutine GETCHR This reads a character from the circular buffer or waits for one to be entered if the buffer is empty CONIN can also be directed to return characters read from an area of memory An alternative character input routine is used by most of the monitor routines this is CONCHR which will only
59. ation PRINTI 036D and set PFLAG 0361 non zero This is achieved by typing M36D FD 25 M361 1 4 6 2 Terminal as only output device instead of VDU card Put CASOUT address FD25 at console output address location COPADR 0365 by typing M365 FD 25 21 4 6 3 Use of serial terminal for input and output In addition to the steps described in section 4 6 2 the monitor s input routine should be replaced by a user written routine to get characters from the terminal through the serial interface and store them in the circular keyboard buffer The monitor automatically links to a ROM located between F000 and SF7FF if present and the replacement input routine can conveniently be contained there 4 6 4 Selection of baud rate The default baud rate for the serial interface is 300 and if other baud rates are required the contents of DELCNT 0363 should be changed as follows 110 baud 0234 300 baud 00CD 1200 baud 0030 22 5 0 HARDWARE DESCRIPTION 5 1 Memory Organization The 6809 card uses part of the first 4K of address space block zero and part of the last 4K of address space block F The complete memory map is shown in Fig 5 1 The map also shows the addresses assigned to memory and devices not on the 6809 card but recognised by the monitor program The 6909 card includes 1K of RAM from 0000 to O3FF and this is contiguous with the 1K of RAM on the VDU card which occupies from 0400 to O7FF The monitor u
60. aved on cassette so that when loaded it will automatically install itself as part of the monitor s command set To do this save it as follows M371 02 00 S200 23D DUMP S371 372 The first save command saves the program in a file named DUMP The minus sign inhibits the save command from writing an end of file marker on the cassette and the second save command writes a block of two bytes to redefine the command table address If the program is now loaded with L DUMP both blocks will be loaded and D will have its new meaning DUMP 18 4 3 Interrupt Vectoring All interrupts are vectored using indirect jumps via addresses held in RAM The RAM locations are assigned as follows 0379 ISWI3 SWI3 vector 037B ISWI2 SWI2 vector 037D IFIRQ FIRQ vector 037F IIRQ IRQ vector 0381 ISWI SWI vector 0383 INMI NMI vector These addresses can be altered to point to user interrupt service routines so that all the interrupts are potentially available for user applications Interrupts IRQ and SWI are used by the monitor the other interrupts are vectored to a routine which will display an error message I Err if an unexpected interrupt occurs The indirect jumps add an overhead of 8 cycles to the servicing of each interrupt 4 3 1 Example The following example illustrates the use of FIRQ in a user program Each time the interrupt occurs an interrupt service routine ISR is called this writes a hex number to the display and increme
61. check data TRN1 available cc get interrupt masks back F CR then get result and return 2 bit accordingly interrupt request handler comes here on irq active Checks for timer 1 or keyboard interrupt if neither then complains to user 90 1250 1551 FEE 86 2 2 IRQHAN LDA MONOP set up 1252 FEE2 iF 88 6 TFR A DP direct page 1252 ogo SETDP MONDP tell assembler 1354 FEE4 9E e980 kA LOX aKVIA point to vie address 1255 FEE AG eo 5 LDA KIFR KVIA X get flag register 1356 FEES 2A 1A 3 BPL UNUSZD not the via 1257 FEEB 84 4e 2 ANDA T1IFLG try timer 1 1258 FEED 27 96 3 BEQ IRQH1 not timer 1 1359 FEEF A7 eb s STA KIFR KUIA X clear the interrupt 1360 FEF1 6E 9F 02723 8 JMP TIRQGRTSI 1361 1262 FEFS A6 eb 5 IRQH1 LOA KIFR KUIB X get flags again 1362 FEF 84 10 2 ANDA aCBlFLG try for keyboard 1264 FEF9 27 en 3 BEQ UNUSED query user if not 1265 FEFB A 0 5 STA KIFR KUIA X clear the interrupt 1266 FEFD AG ee 5 LDA KIRB KUIA X and get a character 1367 FEFF 84 CF 2 ANDA s7F Stripping spare bit 1368 FF01 17 FAFF 9 LBSR HAUCHR put into buffer 1269 FFQ4 Z 1 ANRTI RTI e then Leave irq level 1370 1371 1372 come here 1f unused interrupts are active so 1373 complain to user and stop processor 1274 Since cannot clear an unknown interrupt 1375 1276 FFe5 GE FFCC 2 UNUSED LOX IERR query user t377 FF908 17 FSEL 9 LBSR STRING on display 1273 FFGB 26 FE 2 BRA and stop dead 1279 1286
62. cho control bits 5 don t cares bit 6 echo console input to console output if set bit 7 buffer input lines allow rubout if set me DN printer control flag echo console output to printer if this character not sent to printer non zero delay count for cassette controls baud rate address for console output address for console input address for cassette output address for cassette input amp ddress of printer output routine address of vdu function table address of monitor command table address to go to on timer 1 interrupt address of memory input line O if none address of reserved vector routine address of swi routine address of swi2 routine ad ress of firq routine address of irq routine address of swi routine address of nmi routine cassetta load offset general variables for monitor use static head pointer into line buffer dynamic head pointer into line buffer ail pointer into line buffer stack saved whilst memory interpreting current row of cursor on display current column of cursor on display current start of display page in memory saved address for memory command saved address for go command saved name for cassette input output saved cassette output start address saved cassette output end address flag set to zero when find cr in input line saved last character from input line current address of a breakpoint FFFF if none number of breakpoints to ignore before stopping user user instruct
63. corn range The NWDS bus line is generated from the unbuffered E signal for improved timing The signals Q E BA and BS are buffered but not tri stated 25 5 4 1 Reset The reset line is not buffered The 6809 will come out of reset when RESET is at a level above about 4v Other devices are designed to reset at a lower voltage typically 0 4v so that on power up they will be fully reset before the processor begins execution Power up reset may be provided by connecting a capacitor of about 200 uF between RESET and Ov a space on the board is provided for this 5 4 2 VMA A bus VMA line is provided which is low when the bus buffers are enabled The VMA line is effectively open collector so that any number of devices may be attached to the system using this line and daisy chaining the bus available BA and bus request lines 5 4 3 DMA When a DMA device requests bus control by taking HALT or BREQ low the processor will eventually take BA bus available high The cycle during which this occurs should not be used for a bus transfer i e VMA should be high The DMA device should ensure this When the DMA device relinquishes control of the bus the processor will set BA low Again there is a null cycle while control is transferred On the 6809 card IC12 is used to provide a delayed BA signal which will not go low until the negative transition of E following BA going low The circuit is Shown in Fig 5 2 This ensures that VM
64. delay for single instruction trace is 15 cycles 401000000 interrupt flag position for timer 1 4209018000 interrupt flag position for keyboard input 211101111 initial value for peripheral control register bit e positiue edge printer interrupt on cai but not used in this monitor bits 1 2 output to activate printer normally high bit 4 negative edge keyboard interrupt bits 5 7 cassette output initially set high 411616060 interrupt enable register control bit 4 keyboard interrupt enable bit 6 timer 1 interrupt enable bit set interrupts enabled other enables not altered 100000010 bit postion of printer strobe in pcr 4200100008 bit position that controls cassette output in pcr oF amp software interrupt used for breakpoints 81 1 buffer up to 80 characters from keyboard monitor prompt character F keyboard character that does rubout operation s F character that backspaces vdu also used to do rubout son linefeed character 00 carriage return character 20 blank space character a comma character er a minus character ec character used as clear screen command ui a semicolon 1e 04 definitions of variables on page 2 0258 w stack pointer starts here ram table 1 starts here this table copied from rom on start up 77 eese 0099 eion 9101 0102 01023 0104 0105 0106 0197 0108 0109 01 9 89111 9112 9112 9114 e115 e116 9117 8118 90119 01290 e121 8122 8122 0124 6125 9126 0127
65. device is also possible but requires the provision of specially written routines to put the received data into the keyboard buffer 5 6 1 Cassette Input The software asynchronous receiver gets 1 start bit 8 data bits and 1 stop bit Data is shifted in from PB7 of the VIA lowest bit first The data input is inverted Since keyboard interrupts could upset the cassette timing the keyboard interrupt is disabled during cassette load 5 6 2 Cassette Output The software asynchronous transmitter outputs the byte from the A register as a start bit 8 data bits and 2 stop bits Data is 28 cASOUT To ceQpe int amp Oe Peon R cotveR ootvT 2 y ov T Ov u iok ee ce b H Si CASIN Opt T ov Ic eont Aeka Icu 40138 Sv Tes eoetB ict LM35 X C Nor Fired Fig 5 3 Suggested circuit for a cassette interface The three signals on the right side of the circuit connect to the 6809 card 29 output from CB2 of the VIA lowest bit first The IRQ and FIRQ masks are set during the output of a byte to the cassette output so that the timing will not be upset by servicing interrupts Interrupts are permitted in between bytes 5 6 3 Cassette Format Three types of block are output by the cassette file save routine 1 File Header Block Format D8 30 X X X X X X CK where X is any ASCII character excluding space comma or carriage return and CK is the checksum by
66. e of supply difficulties For instance 0 047 uF capacitors may replace 0 1 uF capacitors shown on the parts list The components substituted will in no way detrimental to the system s operation Also some manufacturers have similar but different type numbers For capacitors note that the value may be expressed in one of two ways 100 nF 0 1 uF 10 nF 0 01 uF 1 nF 1000 pF 0 1 nF 100 pF etc Capacitors supplied with the Acorn cards are usually identified by a 3 digit number the first two digits being the first two digits of the value and the third being the number of following zeroes eg 101 10 and one zero ie 100 pF 103 10 and three zeroe s ie 10000 pf 10 nF 473 47 and three zero s i e 47000 pF 47 nF 0 047 uF If in doubt about the capacitor values count the number of each of type supplied in the kit and then identify them using the parts list quantities The electrolytic capacitors are polarised and the positive end marked must be located as indicated on the circuit card 67 PCB C1 C2 C3 C4 C5 C6 C7 C8 C9 CY CY Ae Gy oO e w N FP o XTAL Rilo R10 Cl 92 C9 T5 6809 C P U Card Parts List Printed Circuit Board 200 012 6809 Microprocessor 6522 Versatile Interface Adapter 74LS244 Buffer 2716 2K monitor ROM 2114 RAM 2114 RAM 74L8244 74L8244 7418244 INS8208 or DP8304 7484770 Bipolar ROM 74LS74 74LS00 74LS00 74LS86 4 MH
67. e omitted then sensible defaults will be assumed All numbers to be input are in hexadecimal and leading zeroes are ignored Numbers may have leading spaces and the number ends on the first non hex character A comma is treated as the last character of the previous number if no spaces intervene A comma or carriage return with no digits will become a default value Note then that 123 is a single number but 123 is two numbers Commands may be strung together on one line and no separators are required unless the line is ambiguous in which case comma or space should be used Ambiguity can only arise with the commands C D and F since these are also hex digits Commands Modify Memory M address MODIFY The contents of the given address will be printed Numbers entered will be Stored at successive memory locations starting at that address The stored result is checked and if different the user will be queried A comma will move up one location and a minus will move down one location A carriage return with no data will also move up one location The M command is exited with a semicolon and the last address accessed will be saved as the default address 11 MG Modify memory starting at the saved Go address The Go address will be changed to the address last accessed when the modify command is exited MR Modify registers The first location opened is the CC register The registers follow in the sequence CC A
68. e the solder has run remove the iron 70 Some of the integrated circuits used in the system employ M O S technology and they can be damaged by static electricity As a general rule if there is no noticable static charge in the area and no nylon clothes or carpets are present all will be well An earthed Soldering iron should be used when soldering on a board containing M O S I C s and the I C s should be kept on the conducting foam on which they are supplied until required The Acorn Printed Circuit cards are double sided through hole plated glass fibre and are manufactured to the highest standards A layer of green solder resist ensures that accidental solder splashes do not stick to the tracks and a clearly marked white silk screen indicates component positions Examine the cards for faults or damage before proceeding It is not necessary to solder through holes which connect one side of a board to the other and do not have a component lead in them and attempting to do so can break the through hole plating and thus the connection All soldering should only be done on the opposite side of the board to the components i e side 1 The cards are each supplied with a full set of integrated circuit Sockets The sockets must be fitted the right way round on the circuit board viewing it from the top pin 1 of an I C is identified as shown The sockets will have either a 45 chamfer for pin 1 ora semi circular cut out as sho
69. e the capabilities of the monitor as desired examples will be given later 1 2 Device Drivers The monitor program includes driver routines for console input output i e keyboard and display cassette input output and printer output The addresses of these routines are held in RAM and all calls to them are made via these addresses thus user written driver routines can be substituted for any of the monitor routines to enable the monitor to be used with different devices 1 3 Keyboard The keyboard in the monitor is interrupt driven making operation of the keyboard independent of the operation of other programs Characters entered at the keyboard are displayed on the screen and buffered in memory even if a user program is running Up to 80 characters may be typed ahead and the console input routine will automatically supply successive characters from the buffer Two modes of operation are provided for in buffered mode the mode in which the monitor normally operates characters cannot be read from the buffer until the line being typed has been terminated by return In this mode of operation mistakes can be erased by typing rubout In the unbuffered mode characters can be read from the buffer as soon as they are typed at the keyboard 1 4 Display The display is driven by software and includes automatic scrolling and a flashing underline cursor The interpretation of control characters is performed by a look up table w
70. en in the form C n r rather than the traditional C The provision of a user stack on the 6809 makes it possible to push and pull the arguments to subroutines without interference from subroutine return addresses In the routine of Fig 7 3 the values of n and r are passed to the routine in the A and B registers respectively and the routine returns the result on the user stack If n has a value other than 0 or r the routine will be entered recursively and the user stack will expand to hold intermediate results 60 RECURSIVE SUBROUTINE TO CALCULATE BINOMIAL COEFFICIENTS RELOCATABLE amp RE ENTRANT Xo3 Ote cB 0000 36 06 NCR PSHU A B 0002 5D TSTB 0003 27 04 BEQ ONE Bep 0005 El C4 CMPB U 0007 26 05 BNE NONE A B 0009 CC 0001 ONE LDD El 000C 20 OD BRA RESULT RETURN 1 000E 4A NONE DECA 000F 8D EF BSR NCR C A 1 B 0011 EC 42 LDD 24U 0013 5A DECB 0014 4A DECA 0015 8D E9 BSR NCR C A 1 B 1 0017 37 06 PULU A B 0019 E3 Cl ADDD LU ADD RESULTS 001B ED C4 RESULT STD U ON USER STACK 001D 39 RTS TEST C 7 3 RESULT SHOULD BE 23 001E CE 0300 TEST LDU 5 0300 USER STACK 0021 CC 0703 LDD E 0703 SET UP A AND B 0024 BD 0000 JSR NCR 0027 37 10 PULU X PRINT RESULT 0029 7E FA75 JMP OPXREG FROM STACK Fig 8 3 Recursive routine to calculate C 61 8 3 Software Compatibility with 6800 The 6809 is source code compatible with the 6800 in other words any assembler program for the 6800
71. hich may be extended or replaced by the user The codes for return line feed rubout and form feed clear Screen which are already implemented can thus be added to by the user The graphics facilities of the VDU can be used with the monitor s routines just like the standard alphanumeric characters 1 5 Command Passing Although the monitor normally reads commands from the keyboard buffer routines are provided so that a line of commands can be passed to the monitor as a text string by a user program It is thus possible for user programs to use the full facilities of the monitor in a very simple manner i 6 Interrupts Interrupts are handled by the monitor in a very flexible manner All interrupts are vectored via addresses held in RAM These addresses can be replaced by the user to redefine some or all of the interrupt service routines Thus all the interrupts are potentially available for user applications with a minimal overhead 1 7 DISK Operating System The Acorn 6809 card is fully supported by a range of memory and interface cards and so may be expanded into a complete computer system With future expansion in mind the 6809 monitor has been provided with all the routines necessary for loading a disk operating system from a minifloppy disk drive thus it will without modification form the basis of a much larger system 2 0 MONITOR OPERATION Connect power and press reset If all is well an asterisk will
72. ically Examples of constant offset indexing are LDA 23 X LDX 2 8 LDY 300 X LDU CAT Y 51 7 3 7 3 Accumulator Offset Indexed This mode is similar to constant offset indexed except that the two s complement value in one of the accumulators A B or D and the contents of one of the pointer registers are added to form the effective address of the operand The contents of both the accumulator and the pointer register are unchanged by the addition The postbyte specifies which accumulator to use as an offset and no additional bytes are required The advantage of an accumulator offset is that the value of the offset can be calculated by a program at run time Some examples are LDA B Y LDX D Y LEAX B X 7 3 7 4 Auto Increment Decrement Indexed In the auto increment addressing mode the pointer register contains the address of the operand Then after the pointer register is used it is incremented by one or two In auto decrement the pointer register is decremented before its use as the address of the data These addressing modes are useful for stepping through tables moving data or for the creation of software stacks the pre decrement post increment nature of these modes makes them behave identically to the U and S stacks The size of the increment decrement can be either one or two to allow for tables of either 8 or 16 bit data to be accessed Some examples of the auto increment decrement addressing modes are LDA X STD
73. igin these bytes in the program would change and so the program is not position independent The first version of the program suffers from two other drawbacks First it is not re entrant In other words it needs some dedicated RAM locations for the variables COUNT and TEMP The routine could not be used by both an interrupt service routine and a main program because one call might overwrite the variables being used by the other call Secondly the program changes the values of some of the registers This is bad practice the routine could not be incorporated into a larger program without some caution The second version of the binary to decimal program in Fig 7 2 removes all three drawbacks it is position independent re entrant and saves the values of all the registers The drawbacks are solved as follows Firstly program counter relative addressing is used to pick up the address of the table The instruction LEAX K10TAB does not change depending on its position in memory The end of the table is detected by testing the value of the power of ten Secondly the two temporary locations are replaced by two stack locations The space is allocated by the instruction LEAS 2 S 56 0000 0001 0002 0004 0006 0008 000A 000D 0010 0012 0015 0017 0019 001B 001E 0021 0024 0027 002A 002C 002E 0031 8E TE 20 IC A3 24 E3 B7 B6 BD B6 8c 26 IF BD 39 Fig 2710 03E8 0064 000A 0002 0000 03 00
74. in 49 HEXOUT routine 35 I Err error message 10 19 I O driver routines 20 routine serial 28 Immediate addressing 49 Index register instructions 44 2 registers 38 Indexed addressing 51 indirect addressing 53 jumps 54 Input cassette 28 routines 33 Instruction set 42 set and addressing modes 38 Instructions ABX 42 ANDCC 47 BIT 65 branch 45 EXG 47 index register 44 LEA 42 load effective address 42 miscellaneous 45 MUL 40 47 multiply 47 ORCC 47 pull 46 push 46 SEX 47 sign extend 47 stack pointer 44 SWI 7 48 SWI2 48 SWI3 48 SYNC 48 synchronize with interrupt 48 TFR 47 6 bit 44 8 bit 43 Interface audio cassette 28 circuit for cassette 29 keyboard 30 printer 32 Interrupt instruction synchronize with 48 keyboard 31 vector addresses 19 vectoring 19 Interrupts 3 software 48 Introduction 1 IRQ mask 41 Jumps indexed 54 Keyboard 1 connections 74 interface 30 interrupt 31 Kit assembly instructions 67 L command 6 14 LEA instruction 42 Line feed character 35 Listing of monitor program 77 Load command 6 14 effective address instruction 42 with offset 14 Long branches 53 M command 4 11 Map memory 24 Mask FIRQ 41 IRQ 41 MCASIN routine 36 MCASOP routine 36 Memory decoding 23 map 24 organization 23 MEMUSE routine 20 37 MG command 12 Miscellaneous instructions 45 routines 37 Modes addressing 49 Modify command 4 11 Monitor expansion 16 operation 4 program 77 return to 12 Monitor commands 1
75. interface 28 Auto decrement indexed addressing 52 increment indexed addressing 52 B register 38 BA signal 26 Backplane connections 76 Baud rate selection 22 INDEX Binary to decimal program 56 program re entrant 58 Binomial coefficient program 60 Bit half carry 41 BIT instruction 65 BLOCKO signal 23 BOOT routine 36 Branch instructions 45 Branches long 53 short 53 Breakpoint cancelling 9 command 8 13 Breakpoints 7 Buffering bus 25 Bus available signal 26 buffering 25 BUSY signal 32 C command 15 flag 40 Calibration cassette 5 Cancelling breakpoint 8 Capacitor values 67 Carriage return character 35 Carry flag 40 CASIN signal 29 CASOUT signal 29 Cassette calibration 5 checksum 30 format 30 input 28 interface interface interface interface interface output 28 verify from 14 CBIN1 routine 36 CBIN2 routine 36 CC register 39 40 CCLOCN routine 37 Character carriage return 35 delete 35 form feed 35 line feed 35 Checksum 10 cassette 30 Circuit for cassette interface 29 Clock system 26 CMDPAR routine 36 Colour code resistor 70 Command passing 2 20 passing program illustrating 21 Commands e gy 13 breakpoint 8 13 audio 28 card 74 circuit for 29 commands 13 connections 74 C I5 cassette interface 13 copy 15 Doors disk 15 disk interface 15 do trace 9 13 F 10 14 G 5 12 go 5 12 L 6 14 load 6 14 M 4 MG 12 modify 4 11 MP 12 MR 7 12 MV 8 12 P 7 12 printer
76. ion at breakpoint address number of instructions left to trace before stopping us saved user stack pointer when user halted temporary storage line input buffer a ee eae ONE m m z MPROM s 908 hardware reset starts at this address MONDP setup A OP direct page MONDP tell assembler PTABI rom table start RTABL ram table start X copy rom gt Ut to ram PThB2 until end RST1 Of table STACK setup stack pointer MPROM 2 check for A55A extra rom STRT1 not there MPROM 41 else call it BACK put monitor return U gt onto stack 12 put dummy A registers STRT2 onto stack USRSTK save stack poin er WBUFFER get start of buffer HEADDY and setup HEADET TAIL pointers CRTCI initialise crt controller vial and via chips LASTC set no saved character BRKOUT remove if exists aSFFrF then set CBREAK RED existing allow interrupts e WPROMPT send prompt INEPT unless be memory input CONT 9194 0195 3196 e197 0198 0199 200 0201 e202 6202 0204 0205 0206 9207 0208 0209 0210 0211 0212 0213 8214 0215 8216 90217 9218 0219 02290 0221 0222 0223 0224 0225 0226 0227 e228 0229 0221 0232 0223 0234 0235 0226 0227 0238 8229 8240 e241 0242 0242 0244 0245 e246 924 0249 0249 0251 0252 0252 90255 0256 0257 9258 0259 9260 0261 0262 9262 9264 6265 e266 0267 0269 0270 0271 0272 0273 0274 0275 0276 0277 6278 0279
77. ling sequence would be LDX COMMD COMMAND LINE ADDRESS JSR MEMUSE TSTA BEQ OK The routine MEMUSE at F871 interprets the command line and exits with A zero if all is well A has the value FF if a null was found before it was expected and the value of any character causing an error 20 4 5 1 Demonstration Program to Illustrate Command Passing The following program DEMO shows how the command line L DUMP can be passed to the monitor as described causing the file DUMP to be loaded from cassette DEMONSTRATION OF COMMAND PASSING 0010 8E 001B DEMO LDX STRING POINT TO COMMAND LINE S 0013 BD F871 JSR MEMUSE 0016 4D TSTA 0017 27 01 BEQ OX 0019 3F ERROR SWI ERROR RETURN 001A 39 OK RTS 001B 4C204445 STRING FCC L DU 001F 4D50 FCC MP 0021 OD00 FCB 0D 0 TERMINATOR 4 6 Use of a Serial Terminal with 6809 Card The Acorn 6809 card is primarily designed for use with an Acorn VDU card and a standard parallel keyboard to form a complete 6809 development System The serial interface normally used to provide data and program Storage on cassette can also be used to interface the card to a serial terminal such as a teletype The terminal may be used as a secondary output device in addition to the VDU as the main output device or for input and output 4 6 1 Terminal as secondary output device e g for hard copy Store the cassette output routine address CASOUT FD25 at the printer indirect address loc
78. mmand table DISPCH Search PARSE enter here for monitor to use memory input line OO is start of line ends with a null multiple input lines are allowed each line ends with a carriage return exits with a zero if all ok else a gt is FF if found null too early else a gt is character causing error e DP MSTACK save stack for return LINEPT save pointer in memory LASTC set none saved MON and call monitor CR assume cr now ONLINE and if found cr then CONI is correct CONIN get input UCR if not cr then CON2 done ONLINE set found cr MONOP console input routine gets character from keyboard buffer or memory if finds null in memory then returns to to caller with error FF DP x MONDOF setup A OP direct page LasTc saved one CONS none saved LasTc not saved anymore DP X PC LINEPT see if mem input CON no use buffer aR get mem value CON4 ok if not nuli set to SFF MSTACK LINEPT clear mem LINEPT 1 oe input DP PC and return to caller CCINADRI get console input LINEPT store new mem pointer DP X PC this routine prints the registers from the stack as pointed to by usrstk then prints usrstk itself also prints 5 bytes starting at ped TITLES headings STRING e printed first USRSTK 4 ie cc e b dp U get data OPARSP Output as 2 hex digits EX1 until all 4 output 4 ie x g u pc Utt get 2 bytes OPXREG s 4 hex digits Ex2 until all output USRST lt then put o
79. n set a zero status else return non zero status initialises the checksum in u to A save character CBIFLG turn off KIER keyboard CBIN1 get from tape X 880 Land if not x then GETHD1 1 try again CBIN1 get next character o setup checksum St and compare with required then return get 2 bytes and form a 16 bit value ind add offset since is address CBIN1 get 1 byte A B and save while CBINI get second AB wrong order swap over OFFSET move by offset get 1 byte from tape modifying checksum to suit CASINAT get byte then A U add to checksum software asynchronous transmitter outputs value ina as start bit 8 data bits 2 stop bits at rate controlled by sount in delcnt saves all registers cc D X keep timing 12 total Length B save on stack IKPCR COPEIT low start bit want data inverted get timing 2 constant 87 1664 1065 1066 1067 1068 1069 1070 FD 1071 1072 107 1074 1075 1676 1677 1678 1673 1680 1081 1082 1682 1684 1685 1986 1087 1668 1685 1690 1891 1692 1893 14094 1095 1096 1097 1098 1899 1108 1101 1102 1102 1104 1165 1166 1107 1109 1169 1118 1111 1112 1112 1114 1115 1116 1117 1118 1119 1120 1121 1122 1122 1124 1125 1126 1127 1128 1129 1120 1121 1122 1123 1124 1125 1126 1137 1128 2139 1140 1141 1142 1142 1144 1145 1146 1147 1148 1149 1150 1151 1152 1152 1154 1155 1156 1157 11358 11
80. n with the character otherwise it will wait for characters to be entered at the keyboard A negative going strobe signal on CB1 of the VIA will generate an interrupt if the IRQ mask is clear and will set bit 4 in the VIA Interrupt Flag Register The IRQ service routine tests this bit to determine whether the interrupt was due to a keyboard interrupt or an interrupt from the VIA timer 1 used in trace mode 5 8 Trace A hardware trace function is provided on the 6809 card to enable programs to be executed one or more instructions at a time The function is controlled by one of the two timers in the VIA timer 1 Timer 1 is addressed as follows Register Address Function 4 0984 Counter low 5 0985 Counter high 6 0986 Latch low ff 0987 Latch high The following sequence is executed to jump to a user program in trace mode 3f 1 Initialize counter to 000F 15 2 Pull all registers from the hardware stack The timer 1 counter will take the IRQ line low after 16 5 E cycles i e on the rising edge of E following 16 instruction cycles By the next falling edge of E after 17 cycles the IRQ will be latched by the processor A delay of at least one bus cycle will then occur before the interrupt is serviced The instruction to pull all the registers from the stack takes 17 cycles and so the interrupt will not be serviced until after the next instruction of the user s program has been executed 5 9 Printer Interface A par
81. nge if given CBREAK and save put breakpoint in if one exists BRKTST see if exists BRK1 already a swi so done CINST else save it SWI PR and insert a sui instead check break required if not does rts twice CBRERK get address sFFFF FFFF means none BRK10 not one mi get instruction SWI see if swi then exit x PC exit twice remove a breakpoint if one present in code BRKTST see if exists BRK2 not swi leave alone CINST gat saved instruction PM and restore in code trace one instruction of user code x get return address IRGRTS and save it 255 IRQ clear irq mask S if user S condition codes INTDEL delay before interrupt KT1CL set timer going CC B DP X V U PC Start user program running set number of instructions to trace on each command NUMB get if no number NTRACE save result trace required number of instructions then display register contents and halt user NTRACE get number to trace TRACE1 ignore command if zero 2 5 strip return address CTRACE save number left TUSER1 trace one instruction CTRACE get number left 1 gt and decrement TRACE2 repeat if required RES1 else show registers and halt user turn printer echo of console output on or off CONCHR get input POFF if cr then off a if plus PON then switch on LASTC re use if not switch off value PFLAG set flag if get bad command query it and ignore rest of line LINEPT if memory input MEN
82. nstruction TFR X Y Transfers X into Y EXG A B Exchanges A and B PSHS A B X Y Push onto S stack Y X B then A PULU Pan Gra D Pull from U stack D X then Y 50 7 3 7 Indexed Addressing In all indexed addressing modex one of the pointer registers X Y U S and PC is used in a calculation of the effective address to be used by the instruction Five basic types of indexing are available and are discussed in the following sections The postbyte of an indexed instruction specifies the basic type and variation of the addressing mode as well as the pointer register to be used 7 3 7 1 Zero Offset Indexed In this mode the selected pointer register contains the effective address of the data to be used by the instruction This is the fastest indexing mode Examples are LDD 0 X LDA S 7 3 7 2 Constant Offset Indexed In this mode a two s complement offset and the contents of one of the pointer registers are added to form the effective address of the operand The pointer register s contents are not changed by the addition Three sizes of offset are available 5 bit 16 to 15 8 bit 128 to 127 16 bit 32768 to 32767 The signed 5 bit offset is included in the postbyte and is therefore most efficient in use of bytes and cycles The 8 bit offset is contained ina single byte following the postbyte The 16 bit offset is in the two bytes following the postbyte If an assembler is being used this will select the optimal size automat
83. nts it The routine SETUP should be executed first to replace the address of the FIRQ indirect vector with the address of the interrupt service routine USE OF FIRQ x INTERRUPT SERVICE ROUTINE x 0100 34 10 ISR PSHS X FIRQ DOESN T STACK REGS 0102 BE 0109 LDX COUNTER 0105 30 01 LEAX rx ADD 1 0107 BD FA75 JSR OPXREG PRINT HEX SAVES REGS 010A BF 0109 STX COUNTER REPLACE IT 010D 35 10 PULS X RESTORE X O10F 3B RT SET UP ROUTINE 0110 8E 0100 SETUP LDX ISR 0113 BF 037D STX IFIRQ 0116 1C BF ANDCC SBF ENABLE FIRQ 0118 39 RTS 0119 0000 COUNT FDB 0 COUNT FROM ZERO 4 4 Driver Routines The monitor calls the input output driver routines indirectly through addresses in RAM and these addresses may be changed by the user to enable the monitor to drive other devices The addresses are assigned as follows 0365 COPADR Console output 0367 CINADR Console input from buffer 0369 CASOPA Cassette output 036B CASINA Cassette input 036D PRINTI Printer output By default these locations contain the following addresses 0375 F95B FDB DISPLA 0377 FASE FDB GETCHR 0379 FD25 FDB MCASOP 037B FD53 FDB MCASIN 037D FA9D FDB PRINT 4 5 Command Passing A command line can be passed as a text string to the monitor by a user program The address of the command line should be stored in X and the line should be terminated by a null byte Multiple input lines are allowed each line terminated with a carriage return A typical cal
84. ointing to last parameter Destroys D 36 6 5 Miscellaneous Name DISPCH CCLOCN RESET MEMUSE Address F9A6 F905 F800 F871 Dispach routine Looks up character in A in a table at X Table format is First byte number of entries 1 to 255 For each entry Character to match 2 byte offset to routine for match Flag byte determines action if no match found 01 next word is offset to default routine 00 return to calling program SFF next word is address of another table Calculate real address of cursor in memory space Result returned in X Reset entry point Pass command to monitor X is start of line which is terminated with a null Multiple input lines are allowed separated by CR Exits with A zero if no error 3 7 0 INSTRUCTION SET AND ADDRESSING MODES 7 1 Programming Model A programming model of the 6809 is shown in Fig 7 1 There are four 16 bit pointer registers the program counter two 8 bit accumulators which can be used as one 16 bit register and two special purpose 8 bit registers 7 1 1 Accumulators A B D The A and B registers are general purpose accumulators which are used for arithmetic and logical operations Most instructions will operate in an identical way with either accumulator Certain instructions are provided which will operate on the A and B registers considered as one 16 bit register referred to as the D register The A register is the most
85. r Relative Addressing The program counter can be used as the pointer register with 8 or 16 bit signed offsets As in relative addressing the offset is added to the current program counter to create the effective address The effective address is then used as the address of the operand or data Program counter relative addressing is used for writing position independent programs tables related to a particular routine will maintain the same relationship to the routine even if the program is moved Examples are LDA TABLE PCR LEAX CONST PCR Since program counter relative addressing is a type of indexing an additional level of indirection is available LDA CAT PCR LDU DOG PCR Note that all the indexed addressing modes are available with the JMP and JSR instructions so that JMP CAT PCR can be used to give the same effect as LBRA CAT 54 8 0 PROGRAMMING TECHNIQUES 8 1 Position Independent Code One particularly powerful feature of the 6809 is its support of position independent code Programs written to be position independent can be loaded anywhere in memory without needing to be re assembled with a different origin The 6809 makes this possible in five ways 1 Position independent transfer of control long and short relative branches are provided 2 Position independent temporary storage workspace may be allocated on the stack rather than using fixed RAM locations 3 Position independent acces
86. r code 70 Return to monitor 12 ROM extra 16 25 Rom error message 10 Routines BOOT 36 CBIN1 36 CBIN2 36 CCLOCN 37 CMDPAR 36 CONCHR 33 CONIN 33 CONOUT 35 disk 36 DISPCH 37 DISPLA 35 driver 20 DRVRDY 36 GETCHR 34 GETHEX 34 GETHXS 34 HEXOUT 35 input 33 MCASIN 36 MCASOP 36 MEMUSE 20 37 miscellaneous 37 NAMEIN 34 NUMB 34 OPAREG 35 OPARSP 35 OPCRLF 35 OPXREG 35 output 34 PRINT 35 serial I O 28 STRING 35 tape 36 TRNSFR 36 using SYNC 48 S command 6 13 register 38 Save command 13 non contiguous blocks 18 Scrolling VDU 35 Serial I O routine 28 terminal 21 Service routine program FIRQ 19 SETDP directive 50 SEX instruction 47 Short branches 53 Sign extend instruction 47 Signals ACK 32 BA 26 BLOCKO 23 bus available 26 BUSY 32 CASIN 29 CASOUT 29 delayed BA 27 E 29 ONCARD 23 reset 26 VMA 26 Software description 33 interrupts 48 Stack depth 23 pointer instructions 44 pointers 38 Store command 6 STRING routine 35 SWI instruction 7 48 SWI2 instruction 48 SWI3 instruction 48 SYNC instruction 48 routine using 48 Synchronize with interrupt instruction 48 System clock 26 T command 9 13 Tape routines 36 Techniques programming 55 Terminal as output device 21 serial 21 TFR instruction 47 Trace command 9 13 facility 9 mode 31 Transfer registers 47 TRNSFR routine 36 U register 38 User stack 60 User s registers 7 V command 8 13 flag 40 V
87. return characters read up to a carriage return Thereafter it will return carriage returns until the flag ONLINE is cleared This ensures that monitor commands such as S that expect several parameters will not cause reading past the end of the line when parameters have been ommitted 6 1 1 Routines Name Address CONIN F890 Console input routine Gets character from input routine via RAM vector CINADR if LINEPT 0 or from memory at address LINEPT If it finds a null in memory it returns to caller with error SFF CONCHR F87F Alternative console input routine reads up to CR calling CONIN and then returns CRs Make ONLINE non zero to clear 33 Name Address GETCHR FASC Default character input routine Gets character from buffer If none then clears interrupt mask and waits All registers saved including CC The following routines call CONCHR to input single characters GETHEX FB95 Get hex digit in A with V 0 else V 1 if non hex GETHXS FB8A As above but ignore leading spaces NUMB FB6C Get hex number with any number of digits from input stream Allow leading spaces and stop on first non hex character Number returned in D with V 0 If no number then D 0 and V 21 NAMEIN FD75 Get name from input stream up to 6 characters long Name Stored at NAME 039D No name leaves memory unaltered any name is padded with spaces to 6 characters 6 2 Output The console output routine CONOUT is normally indirected
88. rez eres eres 0785 0786 8787 0788 e789 e798 0791 0792 0792 0794 0795 0796 0797 0798 0799 esae eset 8862 9902 08905 aoo eses esie e811 e812 99 2 9814 9815 9916 8817 8818 B819 0842 6845 0846 9847 0848 e849 e851 e852 e957 9859 0361 eoe2 ese eses ease eses 0873 FB8 amp FB8A FB8D FB8F FB91 FB9 FB9S FB98 FBSA FBSC FBS FBAG FBAZ FBA4 FBAG FBAS FBAA FBAC FB E FBB1 FRB FBB4 FBB86 FBBS FBB9 F880 FBBF FBCi FBC2 FBCS FBC FBCS FBCB FBCD FBCF F601 FBO FBD FBDS Fe08 FBDE FBE1 FBEZ FBES FEE FBES FREA FREC FREE Feri FBFS FBFS Ferg FBFC Fert FCe1 Foz Fces5 FCO FCA FCec FCE FC 1e 17 27 81 27 20 17 2 81 25 81 23 ei 2 81 23 81 2 B 1A 3 E 8s g E 85 98885 Sg PNE NRBTSA LI 93598 FRES ce 1F 8 E PLES 1C 16 JRRARRIF FCF2 22 20 F FCE 17 39 14 41 46 82 OAZ 82 28855 8 eoo 6A iF 77 1F AS 76 E4 FCD 19 8 e1 7E FF i ez G gt a BRRER UV QU GC P G Io G P2 0 RT GO fo C0 UNUD INN UOOOCNOUQONOOO AN NVUNU aN AVGANANAGNU NUNUA el THXS Rretet GETHEX GETH2 GETH GETHS GETH4 GETHS RENE SHWIHAN PULS LBSR BEQ CMPA BRA LBSR BEQ CMPA BLO CMPA BLS CMPA BLO CMP BLS CMPA REQ STA SEU RTS SUBA RTS SETDP LEAS STD P
89. rive parameter 35 4 90 14 05 SAA drive bed tracks specification 25 4 DRIUE 80 6 10 SFF FF FF mode register setup 2A DRIVE 2 17 load head onto d SZA DRIVE 2 22 sci isc starts motor 28 DRIUE query drive ready 2C DRIUE O seek to track 29 0RIUE 1 00 query drive ready S 2C DRIVE O read sector 2 12 0RIUE 2 60 02 21 read starting at sector 2 124DRIUE 2 00 sez for Shugart drive this routine bootstraps from a mini floppy disc reads sector 2 to find where to put program 89 1254 1255 1256 1257 1238 1259 1268 1261 1262 1263 1264 1265 1266 1267 1268 1269 1278 1271 1272 1273 1274 1275 1276 1277 1278 1279 1298 1281 1282 1283 1284 1285 1286 1287 1266 1289 1290 1291 1292 1292 1294 1295 1296 1297 1298 1299 1208 1301 1302 13023 1304 1205 1206 1207 1208 1209 1310 1311 1312 1212 1214 1215 1316 1317 1218 1219 1220 1321 1222 1223 1224 1325 1326 1327 1228 1229 1228 1331 1222 1222 1324 1335 1326 123 1228 1229 1240 1341 1242 1242 1344 1345 1346 1347 1248 1243 FE44 FE47 FE49 FE4B FEA FESO FES2 FES4 FES6 FESS FESA FESC FESE FE6O FE62 FE6S FE6 FE69 FE6C FEGF FE71 FE73 FE7S FE 7 FE FE C FE E FE80 FES2 FEG4 FES6 Fees FESE FE8D FES1 FE92 FE96 FE99 FESC FEOF FEAL FEA FEAS FEA FEAS FEAR FEAC FEAE FEBO FEB2 FEB4 FEBG FEBS
90. s as required in 256 byte blocks maximum then end file block can also inhibit end of file block CSSTRT modify start address NUMBX CA CSSTRT required CSENO modify end address NUMBX oe ifs CSEND Pequired NAMEIN and get nam e output name XHEAD header 6 name length 6 point to name DATOUT output name CHKOUT than checksum CSSTRT get start address x save start CSEND and get end address 88 1161 1162 1163 1164 1165 1166 1167 1168 1169 11708 1171 E 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1199 1198 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1231 1202 1203 1204 1205 1206 1207 i208 1209 1219 1211 1212 1212 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1223 1224 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1256 1251 1252 1253 F CF FDD1 FDOZ FOD4 F D6 FDDS FODE FOOD FOOF FOEL FDEZ FOES FDE FOES FOEA FOEC FOEE FOFO FDF3 FDFS FDF FDFS FOFB FOFG FEI FEOGZ FEOS FEO FEGI FEOB FE D FEOF FE11 FE12 FE14 FE16 2 FEI FE19 Fete FE1C FE20 FE26 FE2C FE34 FES6 FE29 FE40 108E zi 26 86 80 1F 31 8 26 1F iF 42 1 10 2 eerr 8 8 5 QN NI NXLNLULSNL IN e QU G UN WO M o MO amp CH TO QE
91. s subroutine can be used to reassign the command table addresses and thus add commands to the existing monitor 4 2 Adding to Monitor Commands The following example shows how a user written command can be linked in to the monitor so that it behaves as if it were another monitor command The command described is one to list an area of memory on the screen eight bytes per line both in hexadecimal and in ASCII Thus a typical line would appear 0200 01 44 00 07 FF FD 52 BD D R Showing the eight bytes from 200 to 207 The program lists 24 lines at a time since these fit conveniently on the screen The command is assigned the name D Dump and is followed by the start address of the memory area to be dumped The command calls five routines which are provided in the monitor these handle the input and output of numbers and characters 16 DUMP COMMAND LINKED TO MONITOR COMMAND SET 0200 01 AUXTAB FCB 1 NO OF COMMANDS IN TABLE 0201 44 FCB D COMMAND NAME 0202 0007 FDB DUMP AUXTAB OFFSET TO ROUTINE 0204 FF FCB GO TO NEXT TABLE 0205 FF51 FDB CMNDS MONITOR COMMAND TABLE 0207 BD FB6C DUMP JSR NUMB GET HEX NO IN D 020A 1F 02 TFR D Y PUT IN Y 020C 86 18 LDA 24 NO OF LINES 020E 3402 PSHS A SAVE COUNTER 0210 C608 GO LDB 8 BYTES PER LINE 0212 34 24 PSHS Y B 0214 1F 21 TFR YX X ADDRESS 0216 BD FA75 JSR OPXREG PRINT X IN HEX SPACE 0219 A6 AO D1 LDA rYt GET BYTE 0218 BD FA97 JSR OPARSP PRINT A
92. s in memory different from where it was saved from An offset can also be specified to load a file back into an unused part of the address space to verify that it was saved correctly without destroying the original version in memory The Load will print out the last address of each data block loaded Each data block includes a checksum if an error is found the message Err will be printed after the last address of the block causing the error During loading the keyboard interrupt is disabled to prevent errors caused by typing at the keyboard FINISH Finish loading without searching for a name header block Can be used after an error to load the remainder of the file 14 Printer Interface C tv COPY The printer is switched on to echo all data shown on the VDU If the next character is not a then the printer is switched off Disc Interface D DISK Loads a bootstrap program from a minifloppy disk drive thus entering the disk operating system 15 4 0 MONITOR EXPANSION This section describes how to take advantage of the expandability of the monitor 4 1 Extra Rom The monitor occupies address space between F800 and FFFF A second ROM may be added in the space F000 to F7FF The monitor checks for the presence of the extra ROM and calls it as a subroutine if it is present The extra ROM should contain F7FC SUBR F7FE A55A where SUBR is the address of the subroutine called by the monitor Thi
93. s not a problem since the most usual method of pointing at the stack in the 6800 is to execute a TSX The TSX increments the value during the transfer making X point directly at the last item on the stack The stack pointer may thus be initialized one location higher on the 6809 than in the 6800 similarly comparison values may need to be one location higher Any 6800 program which does all stack manipulation through X i e LDX CAT TXS instead of LDS CAT will have an exactly correct stack translation when assembled for 6809 5 Instruction timings in 6809 will in general be different from other 6800 family processors 6 The 6809 uses the two high order condition code register bits Consequently these will not in general appear as 1 s as on the 6800 63 The 6809 TST instruction does not affect the C flag while 6800 TST does clear the C flag The 6809 right shifts ASR LSR ROR do not affect V the 6800 shifts set V b be The 6809 H flag is not defined as having any particular state after subtract like operations CMP NEG SBC SUB the 6800 clears the H flag under these conditions The 6800 CPX instruction compared MS byte then LS byte consequently only the Z flag was set correctly for branching The 6809 instructions CPX CMPX set all flags correctly 11 The 6809 instruction LEA may or may not affect the Z flag depending upon which register is being loaded LEAX and LEAY do affect the
94. s to constants within the same block of code using program counter relative addressing E g LDA CONST PCR 4 Position independent access to tables within the same block vi code The start address of the table is loaded into X using the load effective address instruction LEAX TABLE PCR the table can then be accessed using indexed addressing 5 Position independent access to constants and variables located in ROM and RAM outside the block of position independent code and whose addresses are not known at the time that the code is assembled This is achieved by providing a table external to the position independent block of code which gives the addresses of all the external variables and the constants needed by the program Before the position independent routine is called a register is pointed to this table e g LDX TABLE The routine can then load constants from the table using indexed addressing as in LDA 2 X and access variables in RAM by indirecting through the addresses in the table e g LDA 5 X or STY 8 X 55 8 1 1 Example The following section takes a simple program to convert a binary number into decimal and shows how to modify it so that it is position independent making use of the features just described The first version of the program Fig 7 1 is not relocatable because the instructions LDX K10TAB and CMPX K10TAB 8 contain absolute addresses If re assembled with a different or
95. ses locations 0359 to O3FF for the storage of variables the user registers and for the line input buffer The monitor uses memory below this address for the hardware stack The stack depth will not normally go below 0300 so the memory from 0000 to 02FF is free for use by user programs 5 2 Memory Decoding Memory decoding is performed by a 256 x 8 bipolar PROM IC11 which divides the 64K of the 6809 s address space into 256 256 byte pages Any of the devices on the Acorn 6809 card may be mapped into any of these pages by providing a suitably programmed ROM As provided the following Signals are produced by the address PROM Signal Address space RAM 0 3FF VIA 900 9FF ROMO F800 FFFF ROM1 F000 F7FF BLOCKO 0 FFF ONCARD 0 3FF 900 9FF F800 FFFF All the signals are active low The ONCARD signal is low whenever any of the on card devices are addressed and this signal controls the data bus buffers The BLOCKO signal is low for addresses in the bottom 4K of memory and is used to enable the VDU card 23 BEBO ACORN 6 04 MONITOR EBOO EBOF lt ROM Ongo Disk PMN onoo CAR PROS 0980 L c PU RENNES o8oo F800 VDO CARD RAM OPTIONAL 0400 _____ __ J 7ELOD LOF Rar ROM O3AE UNE INPUT BUFFER 035B MONITOR VARIABLES 034p SER REG RS Fooo 3 Block o BLock F Fig 5 1 6809 Card Memory Map 24 5 3 Extra ROM The standard 2K monitor is contained in a 2716 type EPROM
96. significant byte of the D register 7 1 2 Direct Page Register DP The direct page register defines which page of memory is to be accessed by direct addressing see section 7 3 5 When peripherals are being accessed the direct page register can be set to the peripheral s page thus speeding up access 7 1 3 Index Registers X Y The index registers are used in the indexed mode of addressing the 16 bit address in the specified register takes part in the calculation of the effective address This address may be used to point to data directly or may be modified by an optional constant or register offset During some indexed modes the contents of the index register are incremented or decremented as a result of the operation All four pointer registers X Y U and S may be used as index registers 7 1 4 Stack Pointers U S The hardware stack pointer S is used automatically by the processor 38 X Index Register Y Index Register Pointer Registers U User Stack Pointer S Hardware Stack Pointer ee Ae NNI NEN eels o Program Counter Accumulators 7 0 Direct Page Register 7 0 ie e ndr NIz vic CC Condition Code Register Carry Overflow Zero Negative IRO Mask Half Carry FIRQ Mask Entire Flag Fig 7 1 Programming model of the 6809 39 during subroutine calls and interrupts The stack pointers point to the top of the stack The user stack pointer
97. struction Note that the address generated by an extended instruction defines an absolute address and is not position independent Examples of Extended Addressing include LDA ACORN STX TREE LDD 2000 49 7 3 4 Extended Indirect As a special case of indexed addressing see Section 8 1 7 one level of indirection may be added to Extended Addressing In Extended Indirect the two bytes following the postbyte of an indexed instruction contain the address of the address of the data Examples are LDA ACORN LDX S FFFE STU TRUNK 7 3 5 Direct Addressing Direct addressing is similar to extended addressing except that only one byte of address follows the op code This byte specifies the lower 8 bits of the address to be used the upper 8 bits are supplied by the direct page register Since only one byte of address is required in direct addressing this mode requires less memory and executes faster than extended addressing Of course only 256 locations one page can be accessed without redefining the contents of the DP register To ensure compatability with the 6800 the DP register is set to 00 on Reset Indirection is not allowed in direct addressing Some examples are LDA 30 SETDP 10 Assembler directive LDB 1030 LDD gt CAT Note gt is an assembler directive forcing direct addressing 7 3 6 Register Addressing Some op codes are followed by a byte that defines a register or set of registers to be used by the i
98. t followed by a space OPAREG SPACE HEX2 printer routine this interfaces to anadex or centronics parallel interface printers e D uU W4KUIR point to via PNEW if spec d symbol then PEXIT do not send KORA2Z KVIA U check if busy PWAITL if so then wait KORA KVIA U store data IKPCR PSTRB then low strobe KPCR KVIA U SIKPZR and high KPCR KUIA U Strobe D U PC MONDP Xhese tables are the decision tables for the memory examine and change function MTABAE MTABAZZ 1 number of entries W UADDR MTABA modify break address and memory a GADDR MTABA modify go address and memory P PADDR MTABA modify proceed address and memory R RADOR MTABA modify register locations SPACE SPACEA MTABA COMMA COMMAA MTABA SEMIC SEMICA NTABA MINUS MINUSA MTABA 1 NOTA MTABA MTABSE MTABB Z 1 SPACE SPACEB MTASB COMMA COMMAB MTABB SEMIC SEMICB MTABB MINUS MINUSB MTABB 1 NOTB MTABB memory examine and change routine 83 e678 6679 ecso 6681 9682 968 66385 ees 0651 0757 0759 0760 e761 e762 e762 9764 e765 8766 6767 e768 e769 0770 e771 9772 0772 0774 FAEZ FACE FAES FAEB FAEE FAF1 FAFZ FAFS FAF7 FAFS FAFC FAFF FBO1 FBO4 FBO Fees FBOB Fee0 FB10 FB12 FB14 FB16 FBi18 FBIA FE1D FB1F FB22 FB24 FB26 FBZ8 FB2A FB2C FB2t FB FB21 FBZ24 FB26 FB29 FB2C FB20 FBZF FB41 FB44 FB45 FB47 F848 FB4n FB4C FE4E FBSO FBS2 FB5
99. t of pointer 1 X HEADDY set new end of line BSECHO and echo a backspace KBECHO put character into buffer 1f room return z 0 else return z 1 HEADOY get pointer BUM U if no room then TAIL pointers equal PUT1 sO done 2 store it and HEADE Y Set new pointer 255 ZERO gclic increment of buffer pointers 1 BUFFER BUFLEN ANRTS BUFFER get character from buffer if none ther clears interrupt mask and waits all registers savet including cc e cE X save and GETCH1 Skip wait 255 IRQ wait for an interrupt TAIL get tail pointer HEADST if equals static heaz GETCH2 1 then no characters BUMPU e else move op x and get it 82 0591 0582 0382 a584 eases 0586 ese 0588 esas 0590 0591 0592 0593 0594 0595 8596 ess 0598 0599 0600 0601 0602 0693 9604 eces 8606 0607 0608 0609 0610 0611 0612 0613 0614 615 8616 e617 0616 2619 0620 0621 0622 0623 e624 0625 0626 627 ec28 ee29 8626 9621 06322 632 GES4 8625 0626 9627 8628 e629 09641 ee42 0643 0644 e645 e646 0647 0648 9649 651 0652 0652 2654 0655 0657 0659 9661 0662 0665 2669 0670 0671 0672 a672 0674 oS S 9676 8677 FA 7 Fa 2 3 FA S Fav FAS FA7B Fa7o FATF F 81 Fags FA84 Fass Fase FAS F 689 Faas FASD Faer FASL FAgZ FASS FAS FASS FASB FASO FASE FAAR2 FAAS FAA FAAS FAAB FAAD FAAF FABI FABS FABS FAB FABS FABS
100. te 2 Data Block Format SD8 31 SH SL EH EL DO Dile D25 455 ih Dn CK where SH and SL are the high and low bytes of the start address respectively EH and EL are the high and low bytes of the end address DO to Dn are the data bytes in binary and CK is the checksum byte The number of data bytes is from 1 to 256 3 Terminator Block Format D8 39 The sum over all bytes after the header pair of bytes and including the checksum is FF in each block 5 7 Keyboard Interface The monitor is designed to receive commands from a parallel keyboard connected to the inputs PBO PB6 with a strobe line to CB1 on the VIA The keyboard should have a negative going strobe signal and non inverted data outputs The edge connections on the 6809 card include connections to the power rails and a 5v keyboard may be powered from these The break key on the keyboard may be wired to the reset line 30 which is also available at the keyboard connector The break signal should provide a negative going signal when pressed The keyboard is interrupt driven making its operation totally independent of external programs data may be typed at the keyboard while the processor is executing a program and it will be echoed on the VDU and buffered in the line buffer Programs may be written to read characters from the line buffer at any time If there are already characters in the line buffer the read character routine will immediately retur
101. ters Ltd 4a Market Hill Cambridge Telephone 0223 312772
102. tiue next word is offset of default routine zero return to calling program negative next word is address of another table to search ak get address of new table 2 8 replace old on stack D X u and begin again DU save registers X get length and move to offset 1 Xx compare characters DIS2 found it else X move own repeat until DIS1 done 1 test flag byte DIS4 zero means return DIS2 search new table else X get offset and 2 S add start of table then 4 Store in stack D X PC restore and go to routine D X U PC return to caller scroll the display up one line leave cursor at same position on screen leave registers intact CPAGE get start of page SROWS COLS 1 then move off end PAGE actual memory address SSPACE 256 SPACE double space aCOLs 2 number to blank F211 wrap around on ik D X amp nd put 2 blanks 2 move up and LVv repeat until SCR1 line done SROMS COLS move to second line now 52491 wrap around and CPAGE 1 Set as new page SETCUR put cursor back in position put page address into crt controller CPAGE get page PAGHI point to page start register SETPAR then enter paraneters do a carriage return by setting column to cCOL 81 dau4 0485 e486 0487 ease 0489 8499 9491 9492 B493 0434 e435 e496 9497 e498 e499 B500 esaet 0562 8582 3584 9505 6506 05907 e5es eses e519 8511 e512 e5123 0514 0515 0516 esi e518 e519 0523 0521 0
103. uctions to be executed on each command If no number is given the trace will be turned off and will be ignored The monitor starts with trace switched off DO TRACE Do Trace The number of instructions set by the T command will be executed and the monitor will return with an automatic R command to display the registers Cassette Interface S start address end address file name SAVE Saves an area of memory between the specified addresses The file name may have up to 6 characters not including space comma or carriage return The name is padded to 6 characters if needed with spaces on the right The file is saved as a name header block followed by data blocks of up to 256 bytes and terminated by a terminator block 13 A minus sign following the filename will inhibit output of a terminator block thus allowing non contiguous blocks of data to be saved as a single file All three parameters of the S command will default to the last values used L file name offset LOAD Load a file into memory from cassette All input data will be ignored until the required header block is found The character in the file name specified will match any character in the input file name e g DATA will match DATAO1 DATAO2 etc The name 7 will match any file name The optional offset will be added to the start and end addresses from the input file thus enabling a file to be relocated to an addres
104. ut stack OPXREG address 16 get user pe value PCMESS send STRING 1 title Li then 5 bytes U OPARSP EXZ output the string cr 1f to console 79 9251 9252 e292 0294 B295 0296 80297 9298 0299 8288 6201 e282 eel 9204 8285 8286 02907 0210 911 0212 02123 e214 e215 0316 831 0318 0219 0220 0221 0222 6323 ez24 225 e226 e227 e228 e229 e226 e2321 0222 0222 0224 e225 0226 237 8228 6248 93241 e242 e242 0244 e245 8246 C247 e248 0249 essi e252 8254 e255 8256 8257 8258 8259 0260 B361 e262 8262 9264 e26 9266 9326 e268 9263 0370 e271 e272 0273 e274 8275 e276 e377 e278 8279 e281 e282 e284 6235 0396 FOES FSEC F8EE FSFO FSF2 rer5 Fer rers FeFB FOFD FOFE F980 F902 F904 F995 F907 F909 F998 FICE F910 F912 F915 F918 F91A F91C F91E FILO F922 F924 F925 F928 F92B FS2E F931 F922 F925 F927 F929 F93C F920 F93F F941 F942 F945 F947 F94A F94D F952 F955 F958 FISA F958 F950 F9SF F961 F963 F963 F967 F969 F968 F96D FOGF BE 24 27 ze z5 SRBRSRR TNFR RF 324 ce iF 1A 35 828 FF92 e2 es 12C 82 FO 62 2400 ei 86 9858983 5271 PONAD ANNs aN WNAaNNN WNHRANUGVUAGYW OU OON UOqou AGP OW DOWOAHAAAH NNGOOGNS OU m 65 STRING STRNG1 OQetee CLOCN VIRI CRTCI CRTCI1 CRTCI2 Dee ee RALL CLRSCN CL
105. wn Note that on the 6809 card ICl and IC2 are the opposite way round to the other sockets nearby Fit the sockets one at a time and ensure that they are pressed fully down with no leads bent under the socket before first soldering two diagonally opposite pins at the corners Check that the socket is the right way round and successfully fitted nefore soldering the rest of the pins There is no need to snip off the excess of the socket pins After the I C sockets the resistors and capacitors are fitted to the circuit cards Identify the component from the component list and fit it to the board Some capacitors will need to be fitted as shown Do not crack the capacitor body when bending the leads The crystal on the C P U card is fitted as shown Again bend the leads away from the component body and lay the Crystal down on the board before soldering Snip off any excess leads under the board The connector is fixed to a card using two 2 5 mm screws and nuts before soldering the pins When all of the components are soldered the integrated circuits may be fitted in their sockets pin 1 is identified by either a semicircle or a dot as shown Pint Pind Identify the I C type from the components list and plug it into the appropriate socket If the leads are splayed out press them all in together until the I C fits easily to the socket Note that ICl and IC2 are the opposite way round to the other ICs on the 68
106. y with accumulator SBCA SBCB j Subtract memory from accumulator with borrow STA STB Store accumulator to memory NOTE A B CC or DP may be pushed to pulled from either stack with PSHS PSHU PULS PULU instructions Fig 7 2 8 bit accumulator and memory instructions 43 Operation Add memory to D accumulator Compare memory from D accumulator Exchange D with X Y S U or PC Load D accumulator from memory Store D accumulator to memory Subtract memory from D accumulator TFRO R Transfer D to X Y S U or PC TFRR D Transfer X Y S U or PC to D Sign Extend B accumulator into A accumulator Fig 7 3 16 bit accumulator and memory instructions Operation CRBS CPU CMPX CMPY Compare memory from index register EXG R1 R2 Exchange D X Y S U or PC with D X Y SSUor PC LEAS LEAU Load effective address into stack pointer Lbs TOU PSHU Push any register s onto user stack except U Pull any register s from hardware stack except S Figs 7 4 Index reqister stack pointer instructions 44 Mnemonics BGE LBGE Branch if greater than or equal signed BGT LBGT Branch if greater signed BHI LBHI Branch if higher unsigned BHS LBHS Branch if higher or same unsigned BLO LBLO BLT L8LT Branch if less than signed BNE LBNE Branch if not equal BPL LBPL Brancn if plus BRA LBRA Branch always BRN
107. z Crystal 3 off 1K resistor 6 off 560R resistor 6 off 3K3 resistor 22uF electrolytic capacitor 5 off 47 or 100 nF capacitor 2 off 24pF capacitors Optional not supplied 68 40 20 24 18 20 14 pin pin pin pin socket socket socket socket socket socket 6809 Card Component Layout lve 9 Fig 69 The resistor colour code is shown here i T band second band first band decade band The first and second bands give the resistor value and the decade band shows the number of zeros following 0 Black 1 Brown 2 Red 3 Orange e g Yellow Violet Orange 4 Yellow is Yellow Violet 4 7 and 5 Green Orange 3 zeros i e 000 6 Blue So the value is 47000 ohms 7 Violet i e 47 kilo ohms or 47K 8 Grey 9 White The tolerance band is red for 2 gold for 5 or silver for 10 Assembling the card will require a considerable amount of soldering and a small electric soldering iron is essential with a diameter at the end of the bit not exceeding 0 1 inches The iron should be rated between 10 and 30 watts and fine 22 guage flux cored solder should be used If you have never soldered before we advise you not try to assemble the card without assistance as Acorn Computer Ltd can not accept responsibility for kits which have beem improperly assembled When soldering make sure the component is well pushed on to the board as shown use a minimum of solder and onc
Download Pdf Manuals
Related Search
Related Contents
User Manual - ADFWeb.com Fujitsu ESPRIMO P400 取扱説明書(総合編) MINAS-BL GVシリーズ 1 - エプソン QuickStart Guide ZiiX 計測器 取説(pdfファイル) Heath Zenith Hardwired Electronic Chime 598-1113-05 User's Manual Service Manual - R6 RU4 Montesecchieta 取扱説明書 - NTTドコモ Copyright © All rights reserved.
Failed to retrieve file