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
- * = $9f0 "Zmienne"
- licznik:
- .byte $0
- gora:
- .byte $0
- * = $900 "program"
- 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 #BLACK // 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()
- ldy #10
- !loop:
- lda gora
- cmp #1
- beq przesuniecie_dol
- x1:
- lda kolor,y
- sta kolor-1,y
- iny
- cpy #26
- bne !loop-
- inc licznik
- lda licznik
- cmp #10
- bne wyjscie_irq_gora
- inc gora
- lda gora
- cmp #1
- beq wyjscie_irq_zwykle_gora
- przesuniecie_dol:
- ldy #16
- !loop:
- lda gora
- cmp #0
- beq przesuniecie_gora
- x2:
- lda kolor-2,y
- sta kolor-1,y
- dey
- cpy #00
- bne !loop-
- inc licznik
- lda licznik
- cmp #10
- bne wyjscie_z_irq_dol
- dec gora
- lda gora
- cmp #0
- beq wyjscie_irq_zwykle_dol
- wyjscie_irq_gora:
- dec x1+1
- dec x1+4
- rti
- wyjscie_z_irq_dol:
- inc x2+1
- inc x2+4
- rti
- wyjscie_irq_zwykle_dol:
- lda #0
- sta licznik
- lda #$e0
- sta x1+1
- lda #$df
- sta x1+4
- rti
- wyjscie_irq_zwykle_gora:
- lda #0
- sta licznik
- lda #$de
- sta x2+1
- lda #$df
- sta x2+4
- rti
- * = $0ce0 "Kolory"
- 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 cyklowania"
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement