Listing of Galadriel load program
Previus Credits Index Next

Now there's a listing of the program that contain the instruction to read this format. The fields that depends by the particular game that are loading are removed. Note that the format stores the ending address of the program that will be loaded in this code, while the starting address is always assumed as the default 0801h.
This program is also autostarting (see location 0302h) and the readed file is automatically executed by a RUN instruction.

Program block loaded

02BA  00         BRK
02BB  09
02BC  73
02BD  A4

02BE  A5 2B      LDA  $2B        Pointer: Start of BASIC program
02C0  EA         NOP
02C1  85 26      STA  $26        Real product
02C3  AD 0C 03   LDA  $030C      6502 A register memorization
02C6  85 63      STA  $63        Floating point accumulator #1: Mantissa 
02C8  AD 13 03   LDA  $0313      Not used
02CB  85 62      STA  $62        Floating point accumulator #1: Mantissa
02CD  A5 2C      LDA  $2C        Pointer: BASIC starting programs
02CF  EA         NOP
02D0  85 27      STA  $27        Real product
02D2  20 61 03   JSR  $0361      Routine: Read the program
02D5  20 15 FD   JSR  $FD15      Routine RESTOR of KERNAL
02D8  20 53 E4   JSR  $E453      Routine: Set BASIC vectors (300h..309h)
02DB  20 33 A5   JSR  $A533      BASIC ROM
02DE  A5 62      LDA  $62        Floating point accumulator #1: Mantissa
02E0  A6 63      LDX  $63        Floating point accumulator #1: Mantissa
02E2  85 2D      STA  $2D        Pointer: BASIC starting variables
02E4  86 2E      STX  $2E        Pointer: BASIC starting variables
02E6  A9 52      LDA  #$52       Key: 'R'
02E8  8D 77 02   STA  $0277      Keyboard buffer queue (FIFO)
02EB  A9 D5      LDA  #$D5       Key shortcat of 'UN'
02ED  8D 78 02   STA  $0278      Keyboard buffer queue (FIFO)
02F0  A9 0D      LDA  #$0D       Key: return
02F2  8D 79 02   STA  $0279      Keyboard buffer queue (FIFO)
02F5  A9 03      LDA  #$03
02F7  85 C6      STA  $C6        Number of char in keyboard buffer  
02F9  4C 74 A4   JMP  $A474      Routine: Write READY, start up
02FC  EA         NOP
02FD  EA         NOP
02FE  EA         NOP
02FF  EA         NOP
0300  BE 02      dw $02BE        Vector: Write BASIC error messages
0302  BE 02      dw $02BE        Vector: BASIC start up
0304  7C 01      dw $017C        Vector: BASIC text "tokenized"
0306  14 A7      dw $A714        Vector: BASIC text list
0308  E4 A7      dw $A7E4        Vector: BASIC chars sending
030A  86 AE      dw $AE86        Vector: BASIC "token" valutation
030C  xx         dw xx           Hi address of ending program 
030D  62
030E  00
030F  32
0310  4C 48 B2   JMP  $B248      Routine: Write (ILLEGAL QUANTITY) error
0313  yy         dw yy           Lo address of ending program
0314  2C F9      dw $F92C        Vector: Hardware Interrupt (IRQ)
0316  57 08      dw $0857        Vector: Break Interrupt
0318  E2 FC      dw $FCE2        Vector: Not maskerable Interrupt (NMI)
031A  4A F3      dw $F34A        KERNAL OPEN routine vector
031C  91 F2      dw $F291        KERNAL CLOSE routine vector
031E  0E F2      dw $F20E        KERNAL CHKIN routine vector
0320  50 F2      dw $F250        KERNAL CHKOUT routine vector
0322  33 F3      dw $F333        KERNAL CLRCHN routine vector
0324  FB 03      dw $03FB        KERNAL CHRIN routine vector
0326  FB 03      dw $03FB        KERNAL CHROUT routine vector
0328  B1 F1      dw $F1B1        KERNAL STOP routine vector
032A  FB 03      dw $03FB        KERNAL GETIN routine vector
032C  5E
Header of loaded program

033C  03         dw 03           Header type
033D  BA 02      dw 02BA         Starting address
033F  2C 03      dw 032C         Ending address
0341  20 20 20 20 20 20 20 20    Name of Game
0349  20 20 20 20 20 20 20 20
0351  47 41 4C 41 44 52 49 45    GALADRIEL SW. C.
0359  4C 20 53 57 2E 20 43 2E
                                 Routine: Read the program
0361  AD 11 D0   LDA  $D011      VIC control register
0364  29 EF      AND  #$EF       Fill the screen with border color
0366  8D 11 D0   STA  $D011      VIC control register
0369  A0 00      LDY  #$00
036B  84 C0      STY  $C0        Stop motor of tape
036D  CA         DEX
036E  D0 FD      BNE  $036D      Tape I/O buffer
0370  88         DEY
0371  D0 FA      BNE  $036D      Tape I/O buffer
0373  78         SEI
0374  84 D7      STY  $D7        Last key/checksum/buffer
0376  A9 07      LDA  #$07       Count 107h=263 cycle of ~1Mhz
0378  8D 06 DD   STA  $DD06      Timer B #2: Lo Byte
037B  A2 01      LDX  #$01
037D  20 E5 03   JSR  $03E5      Routine: Read a bit in Carry
0380  26 BD      ROL  $BD        RS-232 output parity/Transient cassette
0382  A5 BD      LDA  $BD        RS-232 output parity/Transient cassette
0384  C9 02      CMP  #$02       Synchronization byte
0386  D0 F5      BNE  $037D      Tape I/O buffer
0388  A0 10      LDY  #$10       Countdown start of sequence
038A  20 D2 03   JSR  $03D2      Routine: Read a byte in A and $BD
038D  C9 02      CMP  #$02       Synchronization byte
038F  F0 F9      BEQ  $038A      Tape I/O buffer
0391  C4 BD      CPY  $BD        RS-232 output parity/Transient cassette
0393  D0 E8      BNE  $037D      Tape I/O buffer
0395  20 D2 03   JSR  $03D2      Routine: Read a byte in A and $BD
0398  88         DEY             Execute  countdown
0399  D0 F6      BNE  $0391      Tape I/O buffer
039B  20 D2 03   JSR  $03D2      Routine: Read a byte in A and $BD
039E  91 26      STA  ($26),Y    Store the readed byte to its position
03A0  D1 26      CMP  ($26),Y    Real product
03A2  F0 02      BEQ  $03A6      Tape I/O buffer
03A4  86 90      STX  $90        Statusbyte ST of I/O KERNAL
03A6  45 D7      EOR  $D7        Last key/checksum/buffer
03A8  85 D7      STA  $D7        Last key/checksum/buffer
03AA  E6 26      INC  $26        Real product
03AC  D0 02      BNE  $03B0      Tape I/O buffer
03AE  E6 27      INC  $27        Real product
03B0  A5 26      LDA  $26        Real product
03B2  C5 62      CMP  $62        Floating point accumulator #1: Mantissa
03B4  A5 27      LDA  $27        Real product
03B6  E5 63      SBC  $63        Floating point accumulator #1: Mantissa
03B8  90 E1      BCC  $039B      Tape I/O buffer
03BA  20 D2 03   JSR  $03D2      Routine: Read a byte in A and $BD
03BD  A0 00      LDY  #$00       The readed byte is the checksum
03BF  CA         DEX
03C0  D0 FD      BNE  $03BF      Tape I/O buffer
03C2  88         DEY
03C3  D0 FA      BNE  $03BF      Tape I/O buffer
03C5  C8         INY
03C6  84 C0      STY  $C0        Stop motor of tape
03C8  58         CLI
03C9  18         CLC
03CA  A9 00      LDA  #$00
03CC  8D A0 02   STA  $02A0      Contain IRQ vector during tape I/O
03CF  4C 93 FC   JMP  $FC93      Routine: Stop motor, disable int.CIA #1
                                 Routine: Read a byte in A and $BD
03D2  A9 08      LDA  #$08
03D4  85 A3      STA  $A3        Serial counter of bits: Flag EOI
03D6  20 E5 03   JSR  $03E5      Routine: Read a bit in Carry
03D9  26 BD      ROL  $BD        RS-232 output parity/Transient cassette
03DB  EA         NOP             The first bit is the hi
03DC  EA         NOP
03DD  EA         NOP
03DE  C6 A3      DEC  $A3        Serial counter of bits: Flag EOI
03E0  D0 F4      BNE  $03D6      Tape I/O buffer
03E2  A5 BD      LDA  $BD        RS-232 output parity/Transient cassette
03E4  60         RTS
                                 Routine: Read a bit in Carry
03E5  A9 10      LDA  #$10
03E7  2C 0D DC   BIT  $DC0D      Interrupt control register CIA #1
03EA  F0 FB      BEQ  $03E7      Jump if read tape value is hi
03EC  AD 0D DD   LDA  $DD0D      Interrupt control register CIA #2
03EF  8E 07 DD   STX  $DD07      Timer B #2: HI Byte
03F2  48         PHA
03F3  A9 19      LDA  #$19       Count 107h=263 cycle of ~1Mhz
03F5  8D 0F DD   STA  $DD0F      Control register B of CIA #2
03F8  68         PLA             Timer B #2 interrupt value is the bit
03F9  4A         LSR A           if 0, the timer countdown is not ended
03FA  4A         LSR A           if 1, the countdown of timer is ended
03FB  60         RTS

 
Top
C= Logo
commodore 64 pc-c64 Logo Tognon Stefano programs