Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apple II cassette-scope
;CASSETTE-SCOPE
;2017-09 JORGE@JORGECHAMORRO.COM
;KEYS:
;(T)RIGGER ON / OFF
;(SPACE) RUN / STOP
;(O)NE SHOT ON /OFF
;Any other key quits
SAMPLES = $7F
TRIGER = $2FF
S_SAVE = $2FE
X_CORD = $2FD
FLIP = $2FC
ONESHOT = $2FB
HGR_BASE = $E6
X0 = 76
Y0 = 72
Y1 = 88
BLACK = 0
WHITE = 3
STACK = $100
KEYBD = $C000
PAGE1 = $C054
PAGE2 = $C055
* = $6000
BOOT JSR $F3D8
JSR GRATICULA
JSR $F3E2
JSR GRATICULA
LDA #0
STA TRIGER
STA FLIP
STA ONESHOT
LDA #$20
STA HGR_BASE
ENTRY TSX
STX S_SAVE
ENTRY2 LDX #SAMPLES
TXS
LDA TRIGER
BEQ NO_EDGE
FIND_EDGE LDX #SAMPLES
EDGE1 DEX
BEQ NONE
LDA $C060
BMI EDGE1
PHA
LDX #SAMPLES
EDGE2 DEX
BEQ NONE
LDA $C060
BPL EDGE2
BMI GO
NONE LDX ONESHOT
BEQ NONE2
JMP ENTRY2
NONE2 PHA
TSX
BPL NONE2
JMP REST_S
NO_EDGE LDA $C040
LDA $C060
PHA
LDA $C060
GO PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
LDA $C060
PHA
REST_S LDA $C040
LDX S_SAVE
TXS
PAINT LDA #X0
STA X_CORD
LDA #SAMPLES
STA S_SAVE
LOOP_PAINT LDX S_SAVE
LDA STACK,X
BMI HI
LO LDX #BLACK
JSR $F6F0
LDX X_CORD
LDY #0
LDA #Y0
JSR $F457
LDX #WHITE
JSR $F6F0
LDX X_CORD
LDY #0
LDA #Y1
JSR $F457
JMP NXTSMP
HI LDX #WHITE
JSR $F6F0
LDX X_CORD
LDY #0
LDA #Y0
JSR $F457
LDX #BLACK
JSR $F6F0
LDX X_CORD
LDY #0
LDA #Y1
JSR $F457
NXTSMP INC X_CORD
DEC S_SAVE
BPL LOOP_PAINT
LDA FLIP
BNE HGR2
LDA PAGE1
LDA #1
STA FLIP
LDA #$40
STA HGR_BASE
JMP END
HGR2 LDA PAGE2
LDA #0
STA FLIP
LDA #$20
STA HGR_BASE
END LDA ONESHOT
BEQ GETKEY
OSHOTW LDA KEYBD
BPL OSHOTW
BMI KEY1
GETKEY LDA KEYBD
BMI KEY1
JMP ENTRY
KEY1 STA $C010
CMP #160
BNE KEY2
LDA ONESHOT
BEQ PAUSE
JMP ENTRY
PAUSE LDA KEYBD
BPL PAUSE
STA $C010
JMP ENTRY
KEY2 CMP #212
BNE KEY3
LDA TRIGER
BNE KEY22
INC TRIGER
JMP ENTRY
KEY22 LDA #0
STA TRIGER
JMP ENTRY
KEY3 CMP #207
BNE KEY4
LDA ONESHOT
BNE KEY32
INC ONESHOT
JMP ENTRY
KEY32 LDA #0
STA ONESHOT
JMP ENTRY
KEY4 NOP
QUIT STA $C010
LDA PAGE1
RTS
GRATICULA RTS
@ThorstenBr

This comment has been minimized.

Copy link

ThorstenBr commented Jun 11, 2019

Very cool. This is what I needed to debug an issue with my Apple IIe's port. I had to adapt this to suite my needs. See my fork.
Thanks for posting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.