Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Text_Screen EQU $400
- Base_Character EQU %11000000 ; Only change the first four bits!
- ORG $E00 ; First free ram after disk area
- Start
- LBSR SetIntHandler ; Set up Interrupts
- LDX #$0 ; Seed refresh counter
- STX UpdateCounter
- MainLoop
- ORCC #$50 * Set I and F bits of CC
- ;LDA #$1
- ;STA CantUpdate
- ; Process chip8 ram to coco video buffer
- INCLUDE "./chip-vidram.asm"
- ANDCC #$EF * Clear I bit (allow ints)
- ;LDA #$0
- ;STA CantUpdate
- LDX #Video_RAM+192
- LDY #64
- ! LDA ,X
- COMA
- STA ,X+
- LEAY -1,Y
- BNE <
- LDX UpdateCounter
- LEAX 1,X
- STX UpdateCounter
- CWAI #$EF
- Loop JMP MainLoop
- *************************************************
- * SetIntHandler - Sets up the Interrupt Handler
- *************************************************
- SetIntHandler
- ORCC #$50 * Set I and F bits of CC
- LDA #$7E * JMP Opcode
- STA $010C * JMP Opcode in Vector Table
- LDX #IntHandler
- STX $010D
- LDA $FF03 * Read CRB
- ORA #$05 * Set bits 0 and 2
- ;ANDA #%11111101 * Ensure bit 1 is clear
- ORA #%00000010
- STA $FF03 * Put in CRB
- LDA $FF02 * Read DRB(Clear Flag)
- ANDCC #$EF * Clear I bit (allow ints)
- RTS
- *************************************************
- *************************************************
- * IntHandler - Interrupt Handler
- *************************************************
- IntHandler
- ;TST CantUpdate
- ;BEQ @Go
- ;LDA $FF02
- ;RTI
- @Go LDX #Text_Screen
- LDY #TextScreenBuffer
- ! LDD ,Y++
- STD ,X++
- CMPX #$600
- BNE <
- IntExit LDA $FF02
- RTI
- TextScreenBuffer RMB 512
- ;ORG $7D00 ; Video RAM
- Video_RAM INCLUDEBIN "./chip09.dat"
- CantUpdate RMB 1
- UpdateDone RMB 1
- UpdateCounter RMB 2
- END Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement