/[projet1]/public/oric/demos/SlideShowDemo/code/loader.asm
Defence Force logotype

Diff of /public/oric/demos/SlideShowDemo/code/loader.asm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1023 by dbug, Thu Dec 12 20:53:08 2013 UTC revision 1024 by dbug, Sun Dec 15 09:42:42 2013 UTC
# Line 3  Line 3 
3    
4  #define COLOR(color) pha:lda #16+(color&7):sta $bb80+40*27:pla  #define COLOR(color) pha:lda #16+(color&7):sta $bb80+40*27:pla
5  #define STOP(color) pha:lda #16+(color&7):sta $bb80+40*27:jmp *:pla  #define STOP(color) pha:lda #16+(color&7):sta $bb80+40*27:jmp *:pla
 #define INSTALL_HANDLER(address,callback) lda #$4c:sta address:lda #<callback:sta address+1:lda #>callback:sta address+2        ; jmp=$4c  
6    
7          .zero          .zero
8                    
# Line 18  irq_save_a                     .dsb 1      ; To preserve t Line 17  irq_save_a                     .dsb 1      ; To preserve t
17    
18          .text          .text
19    
 ; FFF7-FFF9 - Load File (JMP/LOW/HIGH) - file to load in X register  
 ; FFFA-FFFB - NMI Vector (Usually points to $0247)  
 ; FFFC-FFFD - RESET Vector (Usually points to $F88F)  
 ; FFFE-FFFF - IRQ Vector (Normally points to $0244)  
 ;  
   
20          *=location_loader          *=location_loader
21    
22    
# Line 36  Initialize Line 29  Initialize
29  ; Some local variables we need  ; Some local variables we need
30    
31  StartUp  StartUp
32          ; Set-up a safe irq that does nothing (just contains a RTI instruction)          ;jmp StartUp
         ; This helps avoiding crashes if the user presses RESET for example :)  
         lda #<IrqDoNothing    ; NMI vector  
         sta $fffa  
         sta $fffc  
         lda #>IrqDoNothing        ; RESET vector  
         sta $fffb  
         sta $fffd  
   
         ; Install our API (top of memory function calls)  
     INSTALL_HANDLER($FFF7,LoadData)  
   
33          jsr SetUpIrqHandlers              jsr SetUpIrqHandlers    
34          jsr SoftHiresWithCopyCharset          jsr SoftHiresWithCopyCharset
35    
# Line 67  StartUp Line 49  StartUp
49          ; End of demo - Just stay there doing nothing          ; End of demo - Just stay there doing nothing
50          ;          ;
51          sei          sei
52  .(        loop_forever_demo_finished
53  loop          jmp loop_forever_demo_finished
         jmp loop  
 .)  
54                    
55                    
56  ClearZeroPage  ClearZeroPage
# Line 87  loop Line 67  loop
67                    
68  SetUpIrqHandlers  SetUpIrqHandlers
69          sei          sei
70                            
         ldy #<IrqHandler  
         lda #>IrqHandler  
     sty $fffe  
         sta $ffff  
           
71          ; Make sure the microdisc IRQ is disabled                ; Make sure the microdisc IRQ is disabled      
72          jsr WaitCompletion          jsr WaitCompletion
73                    
# Line 133  from_brk Line 108  from_brk
108          jmp from_brk          jmp from_brk
109    
110    
111                    
112                    
113  HexData .byt "0123456789ABCDEF"  ; X=File index
114            ; A=Low
115            ; Y=High
116    SetLoadAddress
117            sta FileLoadAdressLow,x
118            tya
119            sta FileLoadAdressHigh,x
120            rts
121    
122    
123  ; X=File index  ; X=File index
124  LoadData  LoadData
125          sei          sei
# Line 301  r2_wait_completion Line 284  r2_wait_completion
284          rts          rts
285    
286  #ifdef LOADER_SHOW_DEBUGINFO      #ifdef LOADER_SHOW_DEBUGINFO    
287    HexData .byt "0123456789ABCDEF"
288    
289  DisplayPosition  DisplayPosition
290          .(          .(
291          lda current_side                  lda current_side        
# Line 409  hm_02 Line 394  hm_02
394          bne hm_04          bne hm_04
395          rts          rts
396    
397    _EndLoaderCode
398    
399    ;
400    ; This is free memory that can be used, when it reaches zero then the loader start address should be changed
401    ;
402    
403            .dsb $FFF4 - _EndLoaderCode
404    
405    _Vectors
406    
407    #if ( _Vectors <> $FFF4 )
408    #error - Vector address is incorrect, loader will crash
409    #else
410    
411    ;
412    ; Here are the functions that the user can call from his own application
413    ;
414    _ApiSetLoadAddress      .byt $4c,<SetLoadAddress,>SetLoadAddress        ; $FFF4
415    _ApiSetLoadData         .byt $4c,<LoadData,>LoadData                            ; $FFF7
416    
417    ;
418    ; These three HAVE to be at these precise adresses, they map to hardware registers
419    ;
420    _VectorNMI                      .word IrqDoNothing              ; FFFA-FFFB - NMI Vector (Usually points to $0247)
421    _VectorReset            .word IrqDoNothing              ; FFFC-FFFD - RESET Vector (Usually points to $F88F)
422    _VectorIRQ                      .word IrqHandler                ; FFFE-FFFF - IRQ Vector (Normally points to $0244)
423    
424    #echo Remaining space in the loader code:
425    #print (_Vectors - _EndLoaderCode)
426    
427    #endif
428    
429    ; End of the loader - Nothing should come after because it's out of the addressable memory range :)
430    

Legend:
Removed from v.1023  
changed lines
  Added in v.1024

  ViewVC Help
Powered by ViewVC 1.1.26