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.
- //----------------------------------------------------------
- .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(*))
- }
- }
- //------------------------------------------------------
- main:
- :ClearScreen($0400,32)
- sei
- lda #<irq
- sta $0314
- lda #>irq
- sta $0315
- lda #$7f
- sta $dc0d
- sta $dd0d
- lda $dc0d
- lda $dd0d
- lda #$01
- sta $d01a
- lda #$3e
- sta $d012
- lda $d011
- and #$7f
- sta $d011
- lda #$ff
- sta $d019
- cli
- irq:
- lda #$40
- loop:
- cmp $d012
- bne loop
- :pause #54
- lda #WHITE
- sta $d020
- sta $d021
- lda #$41
- loop2: cmp $d012
- bne loop2
- :pause #48
- lda #WHITE
- sta $d020
- sta $d021
- lda #$42
- loop3: cmp $d012
- bne loop3
- :pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$43
- loop4: cmp $d012
- bne loop4
- :pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$44
- loop5: cmp $d012
- bne loop5
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$45
- loop6: cmp $d012
- bne loop6
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$46
- loop7: cmp $d012
- bne loop7
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$47
- loop8: cmp $d012
- bne loop8
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$48
- loop9: cmp $d012
- bne loop9
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$49
- loop10: cmp $d012
- bne loop10
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$4a
- loop11: cmp $d012
- bne loop11
- //:pause #44
- lda #WHITE
- sta $d020
- sta $d021
- lda #$4b
- loop12: cmp $d012
- bne loop12
- :pause #54
- lda #WHITE
- sta $d020
- sta $d021
- lda #$4c
- loop13: cmp $d012
- bne loop13
- lda #BLACK
- sta $d020
- sta $d021
- jmp $ea31
- .macro ClearScreen(screen, clearByte) {
- lda #clearByte
- ldx #0
- !loop:
- sta screen, x
- sta screen + $100, x
- sta screen + $200, x
- sta screen + $300, 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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement