Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :BasicUpstart2(main)
- .label PamiecEkranu = $4400
- .label Ramka = $d020
- .label Ekran = $d021
- .label memory_setup_register_D018 = $d018
- .label VIC_bank = $dd00
- //----------------------------------------------------------
- // Code for creating the breakpoint file sent to Vice.
- //----------------------------------------------------------
- .var _useBinFolderForBreakpoints = cmdLineVars.get("usebin") == "true"
- .var _createDebugFiles = 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(*))
- }
- }
- //------------------------------------------------------
- .macro trybTekstowy () {
- lda #$1b
- sta $d011
- lda #$c8
- sta $d016
- }
- .macro trybGraficzny()
- {
- lda #$3b
- sta $d011
- lda #$08
- sta $d016
- }
- .macro wybierz_index_charmem_pamieci_D018(index) {
- lda memory_setup_register_D018
- and #%11110001 // ustawia tylko bity oznaczone 0
- ora #[index << 1] // wybiera numer strony pamięci według mapy C64 z netu
- sta memory_setup_register_D018 // zapisuje do $D018
- }
- .macro wybierz_index_screen_memory_pamieci_D018(index) {
- lda memory_setup_register_D018
- and #%00001111 // ustawia tylko bity oznaczone 0
- ora #[index << 4] // wybiera numer strony pamięci według mapy C64 z netu
- sta memory_setup_register_D018 // zapisuje do $D018
- }
- .macro wybierz_index_banku_pamieci_VIC_DD00(index) {
- lda VIC_bank
- and #%11111100 // zeruje bit #0 i #1
- ora #[index ^ %00000011] // XOR na wartości z index
- sta VIC_bank
- }
- .macro ClearScreen(PamiecEkranu, clearByte) {
- lda #clearByte
- ldx #0
- !loop:
- sta PamiecEkranu, x
- sta PamiecEkranu + $100, x
- sta PamiecEkranu + $200, x
- sta PamiecEkranu + $300, x
- inx
- bne !loop-
- }
- .macro ClearScreen_DOL(PamiecEkranu, clearByte) {
- lda #clearByte
- ldx #0
- !loop:
- sta PamiecEkranu+633, x
- sta PamiecEkranu+633+100, x
- inx
- bne !loop-
- }
- .pseudocommand pause cycles {
- :ensureImmediateArgument(cycles)
- .var x = floor(cycles.getValue())
- .if (x<2) .error "Cant make a pause on " + x + " cycles"
- // Take care of odd cyclecount
- .if ([x&1]==1) {
- bit $00
- .eval x=x-3
- }
- // Take care of the rest
- .if (x>0)
- :nop #x/2
- }
- //---------------------------------
- // repetition commands
- //---------------------------------
- .macro ensureImmediateArgument(arg) {
- .if (arg.getType()!=AT_IMMEDIATE) .error "The argument must be immediate!"
- }
- .pseudocommand asl x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) asl
- }
- .pseudocommand lsr x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) lsr
- }
- .pseudocommand rol x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) rol
- }
- .pseudocommand ror x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) ror
- }
- .pseudocommand pla x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) pla
- }
- .pseudocommand nop x {
- :ensureImmediateArgument(x)
- .for (var i=0; i<x.getValue(); i++) nop
- }
- main:
- sei //wyłączenie flafi przerwania
- ldy #$7f ////; $7f = %01111111
- sty $dc0d ////; wyłączamy timer CIA
- sty $dd0d ////; ; wyłączamy timer CIA
- lda $dc0d ////; kasuje wszystki przerwania CIA w kolejce
- lda $dd0d ////; kasuje wszystki przerwania CIA w kolejce
- lda #$01 ////; Set Interrupt Request Mask...
- sta $d01a ////; ...we want IRQ by Rasterbeam
- lda #<irq1 ////; wskaźnik to IRQ
- ldx #>irq1
- sta $314 ////; zapisz tutaj
- stx $315
- lda #$00 ////; ustawiam pierwsze przerwanie na raster 0
- sta $d012
- lda $d011 ////; ustawiam 9 bit z $d011 na 0
- and #$7f ////;
- sta $d011 ////;
- :ClearScreen($0400,$20)
- cli
- jmp *
- irq1: inc $d019
- lda #$00
- sta $d012
- lda #BLACK
- sta Ekran
- lda #<irq2
- sta $0314
- lda #>irq2
- sta $0315
- pla
- tay
- pla
- tax
- pla
- rti
- irq2: inc $d019
- lda #$42
- sta $d012
- lda #BLACK
- sta Ekran
- lda #<irq3
- sta $0314
- lda #>irq3
- sta $0315
- pla
- tay
- pla
- tax
- pla
- rti
- irq3: inc $d019
- lda #$43
- sta $d012
- :break()
- :pause #22
- ldy #$00
- !cykl:
- ldx cykle,y
- !petla:
- dex
- bne !petla-
- lda kolorki,y
- sta Ekran
- sta Ramka
- iny
- cpy #$09
- bne !cykl-
- lda #<irq1
- sta $0314
- lda #>irq1
- sta $0315
- pla
- tay
- pla
- tax
- pla
- rti
- kolorki:
- .byte $02, $0a, $01, $01, $0a, $02, $00, $00, $05
- cykle:
- .byte $01, $08, $08, $08, $08, $08, $08, $01
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement