STOP (Kernal)

From C64-Wiki
Jump to navigationJump to search
Stub This article is very short and not very detailed. Please help to improve it.

Note: This article describes the STOP routine for transferring floating point values in BASIC ROM.

The STOP kernal routine is located at $FFE1 (65505).

This routine does an indirect jump to vector $0328/$0329 (808/809), which by default points to $F6ED (63213). It checks for the STOP-key to be pressed by looking if address $91 (145) in the zeropage has value $7f (127)) and if so, it calls CLRCHN to restore all I/O devices to default. Before returning, it also clears the keyboard buffer by storing #$00 in address $C6 (198).

This routine is used in I/O processes like LOAD and SAVE.

FFE1   6C 28 03   JMP ($0328)   ; (F6ED) check stop key
↓
F6ED   A5 91      LDA $91       ; check STOP-key indicator
F6EF   C9 7F      CMP #$7F      ; #$7F is STOP-key value
F6F1   D0 07      BNE $F6FA     ; if not this value, return
F6F3   08         PHP           ; push processor status to stack
F6F4   20 CC FF   JSR $FFCC     ; restore I/O devices to default
F6F7   85 C6      STA $C6       ; clear keyboard buffer (A always equals 0 when returning from $FFCC)
F6F9   28         PLP           ; restore processor status from stack
F6FA   60         RTS