Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Text_Screen     EQU $400
  2. Base_Character      EQU %11000000   ; Only change the first four bits!
  3.  
  4.             ORG $E00    ; First free ram after disk area
  5. Start          
  6.             LBSR    SetIntHandler           ; Set up Interrupts
  7.             LDX #$0             ; Seed refresh counter
  8.             STX UpdateCounter
  9.            
  10. MainLoop
  11.            
  12.             ORCC    #$50            * Set I and F bits of CC
  13.            
  14.             ;LDA    #$1
  15.             ;STA    CantUpdate
  16.            
  17.             ; Process chip8 ram to coco video buffer           
  18.             INCLUDE "./chip-vidram.asm"
  19.            
  20.             ANDCC   #$EF            * Clear I bit (allow ints)
  21.            
  22.             ;LDA    #$0
  23.             ;STA    CantUpdate     
  24.                        
  25.             LDX #Video_RAM+192
  26.             LDY #64
  27. !           LDA ,X
  28.             COMA
  29.             STA ,X+
  30.             LEAY    -1,Y
  31.             BNE <
  32.            
  33.        
  34.             LDX UpdateCounter
  35.             LEAX    1,X
  36.             STX UpdateCounter
  37.  
  38.             CWAI    #$EF
  39. Loop            JMP MainLoop
  40.  
  41. *************************************************
  42. * SetIntHandler - Sets up the Interrupt Handler
  43. *************************************************
  44. SetIntHandler
  45.         ORCC    #$50            * Set I and F bits of CC
  46.         LDA #$7E            * JMP Opcode
  47.         STA $010C           * JMP Opcode in Vector Table
  48.         LDX #IntHandler
  49.         STX $010D
  50.        
  51.         LDA $FF03           * Read CRB
  52.         ORA #$05            * Set bits 0 and 2
  53.         ;ANDA   #%11111101      * Ensure bit 1 is clear
  54.         ORA #%00000010
  55.         STA $FF03           * Put in CRB
  56.        
  57.         LDA $FF02           * Read DRB(Clear Flag)
  58.         ANDCC   #$EF            * Clear I bit (allow ints)
  59.         RTS
  60. *************************************************
  61.  
  62. *************************************************
  63. * IntHandler - Interrupt Handler
  64. *************************************************      
  65. IntHandler     
  66.            
  67.             ;TST    CantUpdate
  68.             ;BEQ    @Go
  69.             ;LDA    $FF02
  70.             ;RTI
  71. @Go         LDX #Text_Screen
  72.             LDY #TextScreenBuffer
  73. !           LDD ,Y++
  74.             STD ,X++
  75.             CMPX    #$600
  76.             BNE <
  77.        
  78. IntExit         LDA $FF02
  79.             RTI
  80.            
  81. TextScreenBuffer    RMB 512
  82.  
  83.  
  84.             ;ORG    $7D00           ; Video RAM
  85.            
  86. Video_RAM       INCLUDEBIN  "./chip09.dat"
  87.  
  88. CantUpdate      RMB 1
  89. UpdateDone      RMB 1
  90. UpdateCounter       RMB 2
  91.            
  92.            
  93.             END Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement