Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ¯\_(ツ)_/¯
- //
- BasicUpstart2(start)
- start: jsr $e544 // clear screen
- ldx #0
- stx $d020
- stx $d021
- inx
- stx $0286
- //
- // Record
- //
- // cursor shit
- record: ldy $d3 // get cursor column
- lda ($d1),y // get character under cursor. $d1 points to current line
- pha // save it
- lda #$a0 // fake cursor (reversed space) char
- sta ($d1),y // paste it in current cursor location
- pla // get the char that was under the cursor
- sta ($d1),y // paste it back
- // handle keyboard input
- jsr $ffe4 // wait for key to be pressed
- beq record // meanwhile, paste the cursor
- jsr $ffd2 // paste it to the screen
- cmp #$85 // is it "F1"?
- beq endrec // if yes, stop recording
- clc // carry controls program flow here
- recaddr: sta buffer // paste the pressed key into the buffer
- bcs playback // carry set = we're in the playback mode
- // update buffer record address
- inc recaddr+1
- bne !skip+
- inc recaddr+2
- !skip: jmp record // get next key
- // paste "F1" code to buffer
- endrec: sec // alter program flow
- jmp recaddr
- //
- // Playback
- //
- playback: jsr $e544 // clear screen
- // cursor shit again
- playit: ldy $d3 // but we restore the char under the cursor, later
- lda ($d1),y
- pha
- lda #$a0
- sta ($d1),y
- tya
- pha
- wait: cmp $d012 // wait for next frame
- bne wait
- lda #15 // create noise by alternating between max volume...
- sta $d418
- // waste cycles to make the playback go slower
- ldx #40 // is there a better loop?
- ldy #1
- waste: dey
- bne waste
- dex
- bne waste
- lda #0 // ... and volume 0
- sta $d418
- // cursor shit
- pla
- tay // altid godt med thai
- pla // get the char that was under the cursor
- sta ($d1),y // paste it back
- // handle playback from buffer
- playaddr: lda buffer
- cmp #$85 // is it "F1"?
- beq endplay // if yes, then stop playback
- jsr $ffd2 // paste the char to the screen
- // update buffer playback address
- inc playaddr+1
- bne !skip+
- inc playaddr+2
- !skip: jmp playit // keep going
- endplay: rts // releasing control...
- // Buffer
- buffer: .byte 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement