Dear visitor, welcome to Forum64. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
!to "ver",cbm
; -------------------------------------------------
; Beispiel für einen stabilen Raster (double irq)
; -------------------------------------------------
soft_zähl = $02
hard_zähl = $03
joy_zähl = $fe
x_tmp = $ff
*= $0800
!byte $00,$0c,$08,$0a,$00,$9e,$32,$30,$36,$34,$00,$00,$00,$00
*=$0810
cld ;Clear Decimal Mode
sei ;Disable IRQ's
lda #$1f ;Disable CIA IRQ's
sta $dc0d
sta $dd0
lda #<irq1 ;Install RASTER IRQ
ldx #>irq1 ;into Hardware
sta $fffe ;Interrupt Vector
stx $ffff
lda #$35 ;Set MMU to RAM at
ldx #$ff ;$a000-$bfff and
sta $01 ;$e000-$ffff
txs ;Clear the STACK
lda #$01 ;Enable RASTER IRQ
sta $d01a ;and RASTER IRQ to
lda #$1f ;High bit of RASTER %1011 25 Zeilen
sta $d011 ;line $34
lda #$3b ;compare register Start bei $38
sta $d012
;NOTE double IRQ
;cannot be on or
;around a BAD LINE!
;(Fast Line)
lda #$0e ;Set Background
sta $d020
lda #$06 ;and Border colors
sta $d021
lda #$00 ;to default and
sta $d015
sta $02
asl $d019 ;Ack any previous
lda $dc0d ;IRQ's
lda $dd0d
lda #$07
sta soft_zähl
lda #$00
sta hard_zähl
sta joy_zähl
sta x_tmp
cli ;Renable IRQ's
jmp * ;Endless Loop
; -----------------------------------------------------------
irq1
sta reseta1 ;Preserve A,X and Y
stx resetx1 ;Registers
sty resety1 ;VIA self modifying
;code
;(Faster than the
;STACK is!)
lda #<irq2 ;Set IRQ Vector
ldx #>irq2 ;to point to the
ldy #$3c ;next part of the
sta $fffe ;Stable IRQ
stx $ffff ;ON NEXT LINE!
sty $d012
asl $d019 ;Ack RASTER IRQ
tsx ;We want the IRQ
cli ;To return to our
nop ;endless loop
nop ;NOT THE END OF
nop ;THIS IRQ!
nop
nop ;Execute nop's
nop ;until next RASTER
nop ;IRQ Triggers
nop
nop ;2 cycles per
nop ;instruction so
nop ;we will be within
nop ;1 cycle of RASTER
nop ;Register change
; ---------------------------------------------------------------
irq2
txs ;Restore STACK 2
;Pointer
ldx #$08 ;Wait exactly 1 2
dex ;lines worth of 2*8
bne *-1 ;cycles for compare 2*8
bit $ea ;Minus compare 3
nop ;cycles 2
lda #$3c ;RASTER change yet?
cmp $d012 ; 4
beq start ;If no waste 1 more 2 od. 3
;cycle
; ----------------------------------------------------------------
; Hier $3d
start
lda #$3d
cmp $d012
beq *-3
;--------------------------------------------------
; Hier $3e
jsr wait
jsr wait
jsr wait
jsr wait
lda hard_zähl
beq soft
ldx #$00
loop ldy d011_dat,x
nop
nop
sty $d011
jsr wait
jsr wait
nop
bit $ea
inx
txa
and #$07
tax
inc x_tmp ; 5
lda x_tmp ; 3
cmp hard_zähl ; 3
bcc loop ; 3
soft
lda $d012
cmp #$8c
bcc *-3
lda soft_zähl
and #$07
ora #$18
sta $d011
skip
lda #<irq3 ;Set IRQ to point
ldx #>irq3 ;to subsequent IRQ
ldy #$f8 ;at line $68
sta $fffe
stx $ffff
sty $d012
asl $d019 ;Ack RASTER IRQ
lda #$00 ;Reload A,X,and Y
reseta1 = *-1 ;registers
ldx #$00
resetx1 = *-1
ldy #$00
resety1 = *-1
rti ;Return from IRQ
; -----------------------------------------------------------------
irq3
sta reseta3 ;Preserve A,X,and Y
stx resetx3 ;Registers
sty resety3
lda #<irq1 ;Reset Vectors to
ldx #>irq1 ;first IRQ again
ldy #$3b ;at line $34
sta $fffe
stx $ffff
sty $d012
asl $d019 ;Ack RASTER IRQ
lda #$1f
sta $d011
jsr down
lda #$00
sta x_tmp
lda #$00 ;Reload A,X,and Y
reseta3 = *-1 ;registers
ldx #$00
resetx3 = *-1
ldy #$00
resety3 = *-1
rti ;Return from IRQ
;--------------------------------------------------
;Joystickabfrage
joy lda $dc00
lsr
bcs down
;up
inc soft_zähl
lda soft_zähl
and #$07
sta soft_zähl
bne leave_up
lda hard_zähl
beq leave_up
dec hard_zähl
leave_up rts
down ;lsr
;bcs leave_down
; down
dec soft_zähl
lda soft_zähl
and #$07
sta soft_zähl
cmp #$07
bne leave_down
inc hard_zähl
leave_down rts
;--------------------------------------------------
wait rts
d011_dat !byte $18, $19, $1a, $1b, $1c, $1d, $1e, $1f
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
; Hier $3e jsr wait jsr wait jsr wait jsr wait lda hard_zähl ; Linecruncher beq soft ldx #$00 loop ldy d011_dat,x nop nop sty $d011 jsr wait jsr wait nop bit $ea inx txa and #$07 tax inc x_tmp ; 5 lda x_tmp ; 3 cmp hard_zähl ; 3 bcc loop ; 3 soft lda $d012 cmp #$8c bcc *-3 lda soft_zähl ;softscroller and #$07 ora #$18 sta $d011 |
This post has been edited 1 times, last edit by "Roland" (Jan 3rd 2007, 8:06pm)
Quoted
Bei dem Label "start" zuerstörst Du Deinen stabilen Raster... wenn ich das richtig sehe... Auf D012 warten darf man nicht, dann wird es wieder instabil.
Quoted
Original von CJoke
Bei dem Label "start" zuerstörst Du Deinen stabilen Raster... wenn ich das richtig sehe... Auf D012 warten darf man nicht, dann wird es wieder instabil.
Pro Zeile die man warten will muss man 63 Cycles wechnoppen.
Änder mal vor den "jsr wait" die Rahmen/Hintergrundfarbe und guck ob das flackert.
CJ
|
|
Source code |
1 2 3 4 5 6 |
;lda $d012 ;cmp #$8c ;bcc *-3 lda#$8b soft2 cmp $d012 bcs soft2 |
Quoted
Durch ein einfaches D012-Warten auf eine bestimmte Zeile, hat mein keinen stabilen Raster, dafür ist der C64 zu langsam. Der kommt mal einen Cycle früher aus der Warteschleife raus, mal einen später.
Quoted
Ist auch das erste mal das ich sowas sehe, das einer sich einen stabilen Raster macht und direkt danach auf d012 wartet anstatt, pro weitere Zeile in der nix passieren soll, 63 Cycles wechzunoppen.

Forum Software: Burning Board® 3.1.7, developed by WoltLab® GmbH