Opening Top/Bottom Borders on the C64

Wanax
Member
Member
Posts: 17
Joined: Sat Apr 12, 2014 6:15 pm
Location: italy
Contact:

Opening Top/Bottom Borders on the C64

Post by Wanax » Thu Sep 25, 2014 8:59 am

Hey all, I hope can be useful...

;===================================
; main.asm triggers all subroutines
; and runs the Interrupt Routine
; Rocky Memphis 02/02/2014
;===================================
*=$c000
main sei ; set interrupt disable flag
ldy #$7f ; $7f = %01111111
sty $dc0d ; Turn off CIAs Timer interrupts ($7f = %01111111)
sty $dd0d ; Turn off CIAs Timer interrupts ($7f = %01111111)
lda $dc0d ; by reading $dc0d and $dd0d we cancel all CIA-IRQs in queue/unprocessed
lda $dd0d ; by reading $dc0d and $dd0d we cancel all CIA-IRQs in queue/unprocessed
lda #$01 ; Set Interrupt Request Mask...
sta $d01a ; ...we want IRQ by Rasterbeam (%00000001)
lda #<irq ; point IRQ Vector to our custom irq routine
ldx #>irq
sta $0314 ; store in $314/$315
stx $0315
lda #$00 ; trigger interrupt at row zero
sta $d012
lda #$06 ; set border to blue color
sta $d020
cli ; clear interrupt disable flag
jmp * ; infinite loop
;================================
; Our custom interrupt routines
;================================
irq lda #$03
- cmp $d012
bne -
lda #$02
sta $d020
sta $d021
lda $fb
sta $d000
adc #24
sta $d002
adc #24
sta $d004
adc #24
sta $d006
adc #24
sta $d008
lda #$10
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
lda #$ff
sta $d015
lda $fb
clc
adc #$02
sta $fb
lda #$2d
sta $d012
lda $d011
and #$7f
sta $d011
lda #<irq1
sta $0314
lda #>irq1
sta $0315
inc $d019
jmp $ea7e
irq1 lda #$2d
- cmp $d012
bne -
lda #$09
sta $d020
sta $d021
lda #$40
- cmp $d012
bne -
lda $d011
and #$7f
ora #$08
sta $d011
lda $fb
sta $d000
adc #24
sta $d002
adc #24
sta $d004
adc #24
sta $d006
adc #24
sta $d008
lda #$30
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
lda #$c5
sta $d012
lda $d011
and #$7f
sta $d011
lda #<irq2
sta $0314
lda #>irq2
sta $0315
inc $d019
jmp $ea7e
irq2 lda #$c7
- cmp $d012
bne -
lda #$08
sta $d020
sta $d021
lda #$f8
sta $d012
lda $d011
and #$7f
sta $d011
lda $fb
sta $d000
adc #24
sta $d002
adc #24
sta $d004
adc #24
sta $d006
adc #24
sta $d008
lda #$ca
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
lda #<irq3
sta $0314
lda #>irq3
sta $0315
inc $d019
jmp $ea7e
irq3 lda #$f8
- cmp $d012
bne -
lda $d011
and #$77
sta $d011
lda $fb
sta $d000
adc #24
sta $d002
adc #24
sta $d004
adc #24
sta $d006
adc #24
sta $d008
lda #$fc
sta $d001
sta $d003
sta $d005
sta $d007
sta $d009
lda #$01
sta $d012
lda #<irq
sta $0314
lda #>irq
sta $0315
inc $d019
jmp $ea7e



dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am

Re: Opening Top/Bottom Borders on the C64

Post by dudz » Thu Sep 25, 2014 2:39 pm

not sure if a rather longish snippet of code with almost no comments (not in the relevant part anyway) and with lots of unrelated stuff helps to understand what is happening... rather look here: http://codebase64.org/doku.php?id=base:vic#border

Wanax
Member
Member
Posts: 17
Joined: Sat Apr 12, 2014 6:15 pm
Location: italy
Contact:

Re: Opening Top/Bottom Borders on the C64

Post by Wanax » Thu Sep 25, 2014 4:18 pm

I have learned to open the borders by disassembling Ikari Warriors (1986), CODEBASE I think did not yet exist ... :D
You are right I take many things for granted, but for beginners CODEBASE is a good starting point.

Prime

Re: Opening Top/Bottom Borders on the C64

Post by Prime » Thu Sep 25, 2014 4:25 pm

Thanks for posting that code my friend I appreciate it.

Wanax
Member
Member
Posts: 17
Joined: Sat Apr 12, 2014 6:15 pm
Location: italy
Contact:

Re: Opening Top/Bottom Borders on the C64

Post by Wanax » Thu Sep 25, 2014 4:32 pm

Prime wrote:Thanks for posting that code my friend I appreciate it.
Thanks, you too my friend.

Prime

Re: Opening Top/Bottom Borders on the C64

Post by Prime » Thu Sep 25, 2014 5:30 pm

Hi my friend I was thinking of showing how to handle basic ai,as me and you handle ai very close good idea?
Then maybe show how to handle finite state ai.

Wanax
Member
Member
Posts: 17
Joined: Sat Apr 12, 2014 6:15 pm
Location: italy
Contact:

Re: Opening Top/Bottom Borders on the C64

Post by Wanax » Fri Sep 26, 2014 9:03 am

It is interesting, you have in mind something special?

Post Reply Previous topicNext topic