Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :BasicUpstart2(main)
- //----------------------------------------------------------
- // Code for creating the breakpoint file sent to Vice/C64Debugger
- //----------------------------------------------------------
- .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
- .var _createDebugFiles = cmdLineVars.get("afo") == "true"
- .print "File creation " + [_createDebugFiles
- ? "enabled (creating breakpoint file)"
- : "disabled (no breakpoint file created)"]
- .var brkFile
- .if(_createDebugFiles) {
- .if(_useBinFolderForBreakpoints)
- .eval brkFile = createFile("bin/breakpoints.txt")
- else
- .eval brkFile = createFile("breakpoints.txt")
- }
- .macro break() {
- .if(_createDebugFiles) {
- .eval brkFile.writeln("break " + toHexString(*))
- }
- }
- // For C64Debugger v0.54 (2016/09/03)
- .macro setbkg(color) {
- .if(_createDebugFiles) {
- .eval brkFile.writeln("setbkg " + toHexString(*) + " " + color)
- }
- }
- //Because Kick Assembler has to be run with the -afo switch to be able to write breakpoints to a file, we can use this to enable "debugger" specific code when build with Shift-F7 or Shift-F5, ie:
- .const debug = cmdLineVars.get("afo") == "true"
- .if (debug) {
- inc $d020
- }
- .label border_color = $d020
- .label screen_memory = $0400
- .label memory_setup_register = $d018
- .label screen_control_register1 = $d011
- .label vic2_rasterline_register = $d012
- .label character_rom = $d000
- main:
- // jsr $e544
- //:break()
- lda #BLACK
- sta $d020
- sta $d021
- sei //disable maskable IRQs
- lda #$7f
- sta $dc0d //disable timer interrupts which can be generated by the two CIA chips
- sta $dd0d //the kernal uses such an interrupt to flash the cursor and scan the keyboard, so we better
- //stop it.
- lda $dc0d//;by reading this two registers we negate any pending CIA irqs.
- lda $dd0d //if we don't do this, a pending CIA irq might occur after we finish setting up our irq.
- //;we don't want that to happen.
- lda #$01 //;this is how to tell the VICII to generate a raster interrupt
- sta $d01a
- lda #$47 //;this is how to tell at which rasterline we want the irq to be triggered
- sta $d012
- lda #$1b //as there are more than 256 rasterlines, the topmost bit of $d011 serves as
- sta $d011 //the 9th bit for the rasterline we want our irq to be triggered.
- //;here we simply set up a character screen, leaving the topmost bit 0.
- // lda #$35 //we turn off the BASIC and KERNAL rom here
- // sta $01 //the cpu now sees RAM everywhere except at $d000-$e000, where still the registers of
- //SID/VICII/etc are visible
- lda #<irq // nastavit LO byte adresy
- sta $0314 // na LO adresu IRQ - preruseni
- lda #>irq // nastavit HI byte adresy
- sta $0315 // na HI adresu IRQ - preruseni
- cli // vypnout preruseni
- //rts // skoncit program
- // cli //;enable maskable interrupts again
- jmp * //;we better don't RTS, the ROMS are now switched off, there's no way back to the system
- irq:
- inc $d019
- linia1:
- lda #$6b // zaladuj do akku $6b
- !loop:
- cmp $d012 // porownaj z rejestrem rastra
- bne !loop- // Branch Not Equal? to lec do loop i czekaj dalej
- //:break()
- bit $00 // ok mamy 6B. Te bit $00 i nop nie robia nic poza docyklowaniem rastra. bit $00 ma 3 cykle
- bit $00
- bit $00
- bit $00
- bit $00
- nop // nop ma 2 cykle
- ldy #$00 // tu zaczyna sie petla zaladuj do rejestru y = 0
- !kolor:
- ldx kolor,y // zaladuj pierwszy bajt z tablicy kolor + y
- stx $d021 // zapisz w rejestrze obrazu (paper). Ta instrukcja wykonuje sie caly czas, az do nastepnego kolory
- ldx tablica,y // zaladuj pierwszy bajt z tablicy cyklowania (jedna linijka to 63 cykle co 8 linii)
- !loop: dex // wartosc Y jest np. 8 - czyli petla ma sie wykonac 8 razy, zeby przelecialo 63 cykle
- bne !loop- // Y = 0? Nie idz do loop- (czyli pierwsze na gorze)
- iny // Tak? Zwieksz Y
- cpy #$24 // Czy Y=$24?
- bne !kolor- // Nie - idz i wez kolejny kolor z tablicy kolorow jak i z tablicy opoznien
- linia2:
- lda #$90 // bylo juz Y=24? to zaladuj $90
- sta $d012 // i zapisz w rejestrze rastra
- !loop:
- cmp $d012 // i znow sprawdz czy jest $90, nie to czekaj tak to
- bne !loop-
- lda #BLUE // zaladuj czarny i zmien papier na czarny
- sta $d021 // to ta instrukcja. Czyli od $90 do (po przekreceniu licznika) linii 6B na gorze ma byc czarny
- pla // te sa niewazne dla Ciebie
- tay
- pla
- tax
- pla
- przesuniecie_gora:
- :break()
- //ldx licznik
- //cpx #$00
- //beq x1
- //bne przesuniecie_dol
- x1: ldx #$00
- !loop:
- lda kolor+10,x
- a: sta kolor+9,x
- inx
- // :break()
- b: cpx #16
- bne !loop-
- dec !loop-+1
- dec !loop-+4
- inc licznik
- lda licznik
- cmp #11
- bne endirq
- beq przesuniecie_gora
- lda #$00
- sta licznik
- endirq:
- inc wartosc_x
- rti
- przesuniecie_dol:
- //:break()
- //ldx licznik
- //cpx #$00
- //beq przesuniecie_gora
- ldx #15
- !loop:
- lda kolor-1,x
- !a: sta kolor,x
- dex
- //:break()
- cpx #00
- bne !loop-
- b1: lda kolor-1
- b2: sta kolor
- b3: lda kolor-2
- b4: sta kolor-1
- inc b1+1
- inc b2+1
- lda b3+2
- cmp #$0a
- bne b5
- inc b3+2
- b5: inc b3+1
- inc b4+1
- inc !loop-+1
- inc !loop-+4
- dec licznik
- lda licznik
- cmp #$0a
- beq endirq
- bne przesuniecie_dol
- !koniec:
- lda #$0b
- sta przesuniecie_gora+3
- lda #$0a
- sta przesuniecie_gora+6
- lda #$01
- sta przesuniecie_dol+6
- lda #$00
- sta przesuniecie_dol+3
- lda #00
- sta b1+1
- lda #01
- sta b2+1
- lda #$ff
- sta b3+1
- lda #$0a
- sta b3+2
- lda #00
- sta b4+1
- // lda #$00
- //sta licznik
- rti
- * = $b01
- kolor:
- .byte 0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- * = $c00
- tablica:
- .byte 8,9,9,9,9,9,9,1,8,9,9,9,9,9,9,1,8,9,9,9,9,9,9,1,8,9,9,9,9,9,9,1,8,9,9,9,9,9,9,1,8,9,9,9,9,9,9,1
- * = $c60
- licznik:
- .byte $0
- licznik2:
- .byte $0
- wartosc_x:
- .byte $0
- wartosc_x2:
- .byte $0
- gora:
- .byte $0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement