Dragon Basic ROM 16K


                    

   $8000-$BFFF (32768-49151)

 Calls and vectors only given in HEX,assume any calls affect
    all registers.

       Hex         Description

      8000-8032    Direct jump table:figures in brackets
                   indicate where the jump is to.
      8000 (BB3C)  Hardware initialize:no parameters.
                   return address must first be stored in Y
                   as stack is not avaliable when called.
      8003 (BB88)  Software initialize:no parameters
      8006 (BBE5)  Keyboard input:Character pressed returned
                   in A ,else zero if no key pressed.
      8009 (BBB5)  CURBLINK routine:flash cursor when 
                   counter ($8F) reaches 0
      800C (BCAB)  Screen output:character to be displayed 
                   in A and stored at address pointed to by
                    $88(current cursor address)
      800F (BD1A)  Printer output:character to be printed
                   in A.Routine will obey printer setups in
                   first page of RAM ie.line printer width,
                   EOL list etc.
      8012 (BD52)  Joystick input:values of POTS returned in
                   memory at $11A
      8015 (BDCF)  Cassette on:turn on motor relay and wait
                   for the delay value in $95:96 (0.5 secs)
      8018 (BDDC)  Cassette off:turn off motor relay,
                   re-enable IRQ and FIRQ
      801B (BE68)  Write leader to cassette:disable IRQ,FIRQ
                   calls cassette on(8015) and outputs a
                   bit sync leader.Number of header bytes at
                   $90:91
      801E (BE12)  Write a byte to cassette:byte to be 
                   stored in A
      8021 (BDE7)  Cassette on for reading:disable IRQ,FIRQ
                   calls cassette on(8015) and usses bit 
                   sync information to get into sync.
      8024 (BDAD)  Read byte from cassette:Returns with byte
                   in A
      8027 (BDA5)  Read a bit from cassette:bit read in 
                   carry bit CC.C
      802A (BE7B)  Serial in:Read byte from serial port into
                   A.D64 only
      802D (BE98)  Serial out:Write byte to serial port.Byte
                   stored in A.D64 only
      8030 (BEA6)  Select serial baud rate:Baud rate in B:
                   0:110,1:300,2:600,3:1200,4:2400,5:4800
                   6:9600.D64 only

      8033-8153    Reserved words token table.
                   (pointed to by $121:122)
      8154-81C9    Dispatch table for reserved keywords
                   (pointed to by $123:124)
      81CA-824F    Reserved functions token table
                   (pointed to by $126:127)
      8250-        Dispatch table for reserved functions
                   (pointed to by $128:129)
      9F           CHRGET routine
      A5           CHRGOT routine
       BASIC commands can be used through machine code by
       placing the commands parameters in memory and 
      pointing CHRGET to the memory:eg.
      LDX $A6  -CHRGET current pointer
      PSHS X   -preserve it
      LDX #parameter  -start of command parameter
      STX $A6  -into CHRGET pointer
      JSR basicommand  -call the command
      PULS X
      STX $A6  -and reset CHRGET

      8344        Generate a BASIC error.Error number should
                  be in B.
      852B        Eqv. to calling 10 IF INKEY$="" THEN 10
      8877        Get location of a BASIC variable & store
                  in loc. 82/83. Equiv to VARPTR command
      8887        Get string from BASIC & store in stringspc
                  Call $8877 to get pointer to string:
                  LDX 82
                  LDB ,X - string length
                  LDX 2,X - start of string (p/o string def)
      89AA        Check next character is a comma (else ?SN)
      89A4        Check next character is a close bracket (
      89A7        Check next character is a open bracket (
      89AC        Check next character is that specified in
                  B register
      8A94        Get VARPTR address of following BASIC
                  variable (not expression?) & stores in 57/
                  58. Variable type stored in locn 6
      8B2D        INTCNV routine.Copy a 16 bit 2s Complement
                  number in the floating point accumulator
                  into D register.X should point to the FAC.
                  If number is outside this range a BASIC 
                  ?FC error is returned.
      8C35        GIVABF routine.Pass a 16 bit number in D
                  accumulator to floating point accumulator
                  (FAC) which X should be pointing to.
      8C36        As $8C35, but returns 8-bit number in B 
                  register
      8CD7        String garbage collection
      8D9F        Delete space used by a variable. X must 
                  point to VARPTR address (via $8887)
      8E51        Read 8 bit unsigned number from BASIC into
                  B register. If exceeds 8-bit ?FC error
      8E83        Read 16 bit unsigned number from BASIC
                  into X. If exceeds 16-bit ?FC error
      90E5        Output a string.String must be pointed to 
                  by X and terminate in a 0 byte
      957A        Output 16-bit number stored in D register
      9C3E        Equivalent to $8C35, but number to be 
                  returned is stored in locations 82/83
      9D3D        IRQ service routine

      A000-A00D   Indirect jump table:figure in brackets is
                  where jump points to)
      A000 (8006) Keyboard input
      A002 (B54A) Character output:general purpose output 
                  character routine.The device number in $6F
                  (DEVNUM) should be set up and character 
                  stored in A
      A004 (8021) Cassette on for reading.
      A006 (B93E) Cassette block in from tape:tape should be 
                  up to speed and in bit sync.Set up through
                  $7C,7D,7E:7F.On exit CC.Z is zero if I/O
                  error occured and $81 holds the source of
                  error.IRQ and FIRQ remain disabled.
      A008 (B999) Cassette block out from tape:Tape should 
                  be up to speed and have a leader written
                  Setup using $7C,7D,7E:7F.
                  IRQ and FIRQ remain disabled.
      A00A (8012) Joystick input
      A00C (801B) Write leader to cassette


      A0E8        Eqv. to 10 IF INKEY$="" THEN 10
                  but also generates a cursor
      B3B4        Reset vector.Depending on the contents
                  of $71,72:73 a warm or cold start occurs:
      B400        Cold start.(If $71<>$55 or $72:73 does not
                  point to a $12(NOP) instr)
      B44F        Warm start.
      B469        FIRQ vector.Auto start cartridge
      BA77        CLS text screen
      BB26        Part of CHRGET vector
      BCF5        Output to printer.Character in A output to
                  printer irrespective of settings in page 0
                  of RAM
      BD41        Select input line for analogue MUX.
                  Seclection store in B:
                   0:DAC,1:Cassette,2:Cartridge.
                  note:this does not enable the multiplexor.
      BF49        GO64 mode (D64 only)
      BFF2-BFFF   ROM MPU vectors mapped onto FFF2-FFFF.