Compare commits
31 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed639a4825 | ||
|
|
6683e3f308 | ||
|
|
2c95cb317b | ||
|
|
6b04ebcf20 | ||
|
|
89b00b236f | ||
|
|
ca257b7736 | ||
|
|
edd649e76f | ||
|
|
249a1aecaa | ||
|
|
0cc5cb48c4 | ||
|
|
81eaf30249 | ||
|
|
162936722e | ||
|
|
baba399bec | ||
|
|
12cde3c592 | ||
|
|
1d80964835 | ||
|
|
a27e7041a1 | ||
|
|
b6b7f09527 | ||
|
|
52398fecf7 | ||
|
|
1d58a51d0c | ||
|
|
1b2f4b8c9a | ||
|
|
04f477ccad | ||
|
|
8116edd7a9 | ||
|
|
a1dae93e56 | ||
|
|
2eb35055e7 | ||
|
|
ddd58fcb87 | ||
|
|
e39c5eb99e | ||
|
|
0afc0df22a | ||
|
|
23bd5666c1 | ||
|
|
b14b904990 | ||
|
|
2513ac6065 | ||
|
|
367cefeb73 | ||
|
|
c84b18b9d2 |
12 changed files with 6830 additions and 0 deletions
53
kernal/generate.py
Executable file
53
kernal/generate.py
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import markdown
|
||||
import re
|
||||
|
||||
#lines = [line.rstrip() for line in open("kernal_prg.txt")]
|
||||
lines = [line.rstrip() for line in open("kernal_128intern.txt")]
|
||||
|
||||
calls_raw = []
|
||||
call_lines = None
|
||||
for line in lines:
|
||||
if line.startswith('#') or line.startswith('-'):
|
||||
continue
|
||||
if line.startswith('$'):
|
||||
if call_lines is not None:
|
||||
calls_raw.append(call_lines)
|
||||
call_lines = []
|
||||
|
||||
if call_lines is not None:
|
||||
call_lines.append(line)
|
||||
|
||||
calls = []
|
||||
names = []
|
||||
for call_lines in calls_raw:
|
||||
title = call_lines[0]
|
||||
address = title[1:5]
|
||||
name = title[7:13].rstrip()
|
||||
summary = title[15:]
|
||||
call_lines_stripped = []
|
||||
for call_line in call_lines[1:]:
|
||||
call_lines_stripped.append(call_line[15:])
|
||||
calls.append((address, name, summary, call_lines_stripped))
|
||||
names.append(name)
|
||||
|
||||
print('<table border=1>')
|
||||
|
||||
for (address, name, summary, lines) in calls:
|
||||
print('<tr>')
|
||||
print('<td>$' + address + '</td>')
|
||||
print('<td><a name="' + name + '">' + name + '</td>')
|
||||
print('<td><details open><summary>' + summary + '</summary>')
|
||||
all_text = '\n'.join(lines)
|
||||
html = markdown.markdown(all_text, extensions=['tables' , 'sane_lists'])
|
||||
for replace_name in names:
|
||||
if replace_name != name:
|
||||
html = re.sub('\\b' + replace_name + '\\b', '<a href="#"' + replace_name + '">' + replace_name + '</a>', html)
|
||||
print(html + '</details></td>')
|
||||
|
||||
|
||||
|
||||
print('</tr>')
|
||||
|
||||
print('</table>')
|
||||
547
kernal/kernal_128intern.txt
Normal file
547
kernal/kernal_128intern.txt
Normal file
|
|
@ -0,0 +1,547 @@
|
|||
-
|
||||
- Schieb, Thrun, Wobel: Commodore 128 intern
|
||||
- ISBN 3-89011-098-3
|
||||
-
|
||||
|
||||
$FF81 CINIT Video-Controller und Editor initialisieren
|
||||
|
||||
Es werden die Funktionstasten auf Standard
|
||||
gelegt, beide Video-Controller initialisiert und der 40/80-
|
||||
Zeichen-Modus in Abhängigkeit der 40/80-Zeichen-Taste
|
||||
eingeschaltet. Weiterhin werden der Tastaturbuffer gelöscht
|
||||
sowie alle Flags rückgesetzt und ein CLRCH ausgeführt.
|
||||
|
||||
$FF84 IOINIT Initialisierung der Ein/Ausgabegeräte
|
||||
|
||||
Die Ein/Ausgabegeräte werden initialisiert, d.h.
|
||||
die RESET-Leitung auf dem IEC-Bus wird aktiviert. Ange-
|
||||
schlossene Drucker werden in den Anfangszustand versetzt und
|
||||
die Floppy löscht ihre Kanäle - hört sich also an, als ob sie
|
||||
gerade eingeschaltet worden wäre.
|
||||
|
||||
$FF87 RAMTAS BASIC-Warmstart
|
||||
|
||||
Diese Routine initialisiert die Zeropage, setzt die
|
||||
Zeiger für SYSTOP und SYSBOT (also die Speicherunter- und -
|
||||
obergrenze), setzt die Zeiger für die RS-232-Ein/Ausgabebuffer
|
||||
und den Kassettenbuffer zurück.
|
||||
|
||||
$FF8A RESTOR Systemvektoren initialisieren
|
||||
|
||||
Es werden die Systemvektoren ab Adresse $0314
|
||||
bis $0332 (inkl.) auf Normalwert gesetzt. Diese Routine sollte
|
||||
aufgerufen werden, wenn Sie zu viele Vektoren verbogen und
|
||||
die Übersicht verloren haben oder wenn Sie beispielsweise ein
|
||||
Erweiterungspaket ausschalten wollen. Diese Routine ruft die
|
||||
folgende VECTOR-Routine mit gelöschtem CARRY auf.
|
||||
|
||||
$FF8D VECTOR Systemvektoren kopieren oder rücksetzen
|
||||
|
||||
Diese Routine kopiert die 16 Vektoren ab $0314
|
||||
in den durch das X- (Low) und Y-Register (High) definierten
|
||||
Speicher, sofern das CARRY-Flag gesetzt ist. Bei gelöschtem
|
||||
CARRY-Flag werden die Vektoren ab $0314 mit dem durch das
|
||||
X- und Y-Register angegebenen Bereich geladen.
|
||||
|
||||
**Eingabeparameter**: .X, .Y, CARRY
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
LDX #$00 ;Lo-Byte von $1000
|
||||
LDY #$10 ;Hi-Byte von $1000
|
||||
CLC ;Lösche Carry zum Kopieren ($1000)->($0314)
|
||||
JSR $FF80 ;Belege Vektoren neu
|
||||
|
||||
$FF90 SETMSG DOS-Meldungen ermöglichen/verhindern
|
||||
|
||||
Die Routine speichert den Wert des <Akku> in
|
||||
der Zeropage-Adresse $9D. Sollen Systemmeldungen ausgegeben
|
||||
werden, so ist das Bit 7 des <Akkus> zu setzen. Ist $9D positiv,
|
||||
so werden Systemmeldungen verhindert.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
$FF93 SECND Sekundäradresse nach LISTEN senden
|
||||
|
||||
Es wird die zu sendende Sekundäradresse im
|
||||
<Akku> übergeben. Die Routine gibt den <Akku> dann als
|
||||
Sekundäradresse auf dem IEC-Bus aus.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;LISTEN wurde gesendet
|
||||
LDA #$F0 ;Sekadr. 0 bei CLOSE
|
||||
JSR $FF93 ;Sekundaradresse senden
|
||||
|
||||
$FF96 TKSA Sekundäradresse nach TALK senden
|
||||
|
||||
Adäquat zu der vorhergehenden Routine sendet
|
||||
diese Routine die Sekundäradresse - übergeben im <Akku> -
|
||||
nach erfolgtem TALK-Signal an den IEC-Bus.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
$FF99 MEMTOP Setzen/Holen der Speicherobergrenze
|
||||
|
||||
Ist das CARRY-Flag gesetzt, so wird im X-
|
||||
Register (Lo) und Y-Register (Hi) die maximal verfügbare
|
||||
Speicherstelle übergeben. Wird die Routine mit gelöschtem
|
||||
CARRY angesprungen, so wird die Speicherobergrenze mit den
|
||||
beiden Registern belegt.
|
||||
|
||||
**Eingabeparameter**: .X, .Y (bei gelöschtem CARRY), CARRY
|
||||
|
||||
**Ausgabeparameter**: .X, .Y (bei gesetztem CARRY)
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Auslesen der Speicherobergrenze
|
||||
SEC ;Auslesen der Obergrenze
|
||||
JSR $FF99 ;Hole Obergrenze
|
||||
STX $FC ;zwischenspeichern
|
||||
STY $FD ;zwischenspeichern
|
||||
LDX #$00 ;Lo-Byte von $1000
|
||||
LDY #$10 ;Hi-Byte von $1000
|
||||
CLC ;Flag zum Setzen des MEMTOP
|
||||
JSR $FF99 ;Setze Speicherobergrenze
|
||||
|
||||
$FF9C MEMBOT Setzen/Holen der Speicheruntergrenze
|
||||
|
||||
Genauso wie bei der Routine MEMTOP wird bei
|
||||
gelöschtem CARRY-Flag die Untergrenze des verfügbaren
|
||||
Speichers mit den beiden Registern X ^Lo) und Y (Hi) belegt.
|
||||
Ist das CARRY-Flag gesetzt, so wird die Speicheruntergrenze
|
||||
ausgelesen und in den beiden Registern übergeben.
|
||||
|
||||
**Eingabeparameter**: .X, .Y (bei gelöschtem CARRY), CARRY
|
||||
|
||||
**Ausgabeparameter**: .X, .Y (bei gesetztem CARRY)
|
||||
|
||||
$FF9F KEY Ermitteln gedrückter Tasten
|
||||
|
||||
Diese Routine ist elementar zur Tastatur-
|
||||
dekodierung. Die Tastatur wird auf eine gedrückte Taste anhand
|
||||
der Tastaturdekodiertabellen überprüft. Wird eine gedrückte
|
||||
Taste ermittelt, so wird der ASCII-Wert errechnet und dieser
|
||||
dem Tastaturbuffer (ab $034A) hinzugefügt.
|
||||
|
||||
$FFA2 SETTMO Setzen des Timeout-Flags für IEEE
|
||||
|
||||
Die Routine speichert den im <Akku> überge-
|
||||
benen Wert als Timeout-Flag für die IEEE-Routinen an Adresse
|
||||
$0A0E. Um den Timeout in den IEEE-Routinen zu
|
||||
ermöglichen, muß das Bit 7 des <Akkus> gesetzt sein.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
$FFA5 ACPTR Holt ein Byte vom seriellen Bus
|
||||
|
||||
Die Routine holt ein Byte vom seriellen IEC-Bus.
|
||||
Das geholte Zeichen wird im Akku übergeben. Das Statusbyte
|
||||
ST an $90 wird entsprechend der Aktion gesetzt.
|
||||
|
||||
**Ausgabeparameter**: .A
|
||||
|
||||
$FFA8 CIOUT Ausgabe eines Zeichens auf IEC-Bus
|
||||
|
||||
Diese Routine ist das Gegenstück zu ACPTR. Das
|
||||
im <Akku> übergebene Zeichen wird auf dem lEC-Bus ausge-
|
||||
geben. Auch hier wird das Statusbyte ST an $90 entsprechend
|
||||
der Aktion geändert.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
$FFAB UNTLK UNTALK auf lEC-Bus senden
|
||||
|
||||
Diese Routine wird beim Schließen bzw. Umlegen
|
||||
eines Eingabekanals aufgerufen. Sie bringt das zum Reden
|
||||
(TALK) gebrachte Gerät zum Schweigen.
|
||||
|
||||
$FFAE UNLSN UNLISTEN auf IEC-Bus senden
|
||||
|
||||
Entsprechend zu UNTALK wird bei dieser
|
||||
Routine ein empfangendes Gerät vorerst abgeschaltet. Dies wird
|
||||
beim Schließen oder Umlegen eines Ausgabekanals gemacht.
|
||||
|
||||
$FFB1 LISTN Senden von LISTEN an ein Gerät
|
||||
|
||||
Es wird ein am IEC-Bus angeschlossenes Gerät
|
||||
zum Empfang aufgefordert. Dazu wird das Signal LISTEN über
|
||||
den IEC-Bus geschickt. Im <Akku> wird die Geräteadresse des
|
||||
anzusprechenden Gerätes übergeben. Beispielsweise wird bei
|
||||
einem Drucker ein LISTEN gesendet, bevor die Zeichen zur
|
||||
Ausgabe über den IEC-Bus wandern. Wenn Sie LISTEN ver-
|
||||
wenden, so müssen Sie die auszugebenden Zeichen über die
|
||||
Routine CIOUT ausgeben (nicht über BSOUTÜ). Zum Schließen
|
||||
des Kanals verwenden Sie dann die Routine UNLISTEN. Es
|
||||
kann immer nur ein Gerät am IEC-Bus aktiv sein. Um diese
|
||||
komplizierten Arbeiten zu vereinfachen, können Sie im
|
||||
Betriebssystem Kanäle öffnen und schließen. BSOUT und
|
||||
BASIN übernehmen dann das Senden von LISTEN und
|
||||
UNLISTEN sowie TALK und UNTALK.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;LISTEN an Drucker senden
|
||||
LDA #$24 ;Geräteadresse Drucker & LISTEN ein
|
||||
JSR $FFB1
|
||||
|
||||
$FFB4 TALK Senden von TALK an ein Gerät
|
||||
|
||||
Entsprechend der Routine LISTN sendet diese
|
||||
Routine das Kommando TALK an ein beliebiges Gerät. Die
|
||||
Geräteadresse ist im <Akku> zu übergeben. Das Kommando
|
||||
TALK fordert ein am IEC-Bus angeschlossenes Gerät zum
|
||||
Reden, also zum Senden von Informationen auf.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
$FFB7 READST Holen des I/O-Statusbytes
|
||||
|
||||
Es wird der aktuelle Systemstatus im <Akku>
|
||||
zurückgegeben. Ist die RS232 aktiv, so wird das Statusbyte
|
||||
übergeben und direkt im Speicher gelöscht. Sollten Sie also das
|
||||
Statusbyte öfters benötigen, so speichern Sie es zwischen. Ist ein
|
||||
anderer als der RS232-Kanal geöffnet, so wird das Statusbyte
|
||||
von Adresse $90 übergeben.
|
||||
|
||||
**Ausgabeparameter**: .A
|
||||
|
||||
$FFBA SETLFS Fileparameter setzen
|
||||
|
||||
Diese Routine wird überall dort benötigt, wo man
|
||||
Files öffnen muß. Man übergibt die logische File-nummer im
|
||||
<Akku>, die Geräteadresse im X-Register und die Sekun-
|
||||
däradresse im Y-Register. Die Routine speichert diese Werte an
|
||||
den Zeropage-Adressen $B8 bis $BA ab.
|
||||
|
||||
**Eingabeparameter**: .A, .X, .Y
|
||||
|
||||
$FFBD SETNAM Setzen der Filenamenparameter
|
||||
|
||||
In der Routine werden die Informationen für den
|
||||
Filenamen in der Zeropage gespeichert. Diese Angaben sind alle
|
||||
vor dem Öffnen eines Kanales zu machen. Im <Akku> wird die
|
||||
Länge des Filenamens übergeben, im X-Register das Lo-Byte
|
||||
der Adresse und im Y-Register das Hi-Byte der Adresse, an der
|
||||
der Filename gespeichert ist. Ferner müssen Sie mit der
|
||||
SETBNK-Routine die Konfigurationsindizes für den Filenamen
|
||||
und den zu bearbeitenden Speicherbereich übergeben.
|
||||
|
||||
**Eingabeparameter**: .A, .X, .Y
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Eröffnen eines des Directory-Files auf Diskette
|
||||
LDA #$0C ;Bereich im RAM-Bank 0
|
||||
TAX ;Filename auch in RAM-Bank 0
|
||||
JSR $FF68 ;SETBNK aufrufen
|
||||
LDA #$01 ;Logische Filenummer
|
||||
LDX #$08 ;Geräteadresse
|
||||
LDY #$00 ;Sekundäradresse für Lesen
|
||||
JSR $FFBA ;SETLFS
|
||||
LDA #$01 ;Länge des Filenamens
|
||||
LDX #$00 ;Lo-Byte der Adresse, an der der
|
||||
LDY #$10 ;Filename gespeichert ist ($1000)
|
||||
JSR $FFBD ;SETNAM
|
||||
JSR $FFC0 ;OPEN - Öffnen des Kanals
|
||||
|
||||
und an Adresse $1000:
|
||||
|
||||
01000 24 ....
|
||||
|
||||
$FFC0 OPEN Öffnen einer Datei
|
||||
|
||||
Es wird die durch die Routinen SETNAM,
|
||||
SETLFS und SETBNK definierte Datei in die Liste der
|
||||
logischen Filenummern aufgenommen. Erst ab diesem Augen-
|
||||
blick können die logischen Filenummern bei den Routinen
|
||||
CKOUT und CHKIN angegeben werden. Beachten Sie, daß Sie
|
||||
maximal neun Files auf einmal öffnen können.
|
||||
|
||||
$FFC3 CLOSE Schließen einer logischen Datei
|
||||
|
||||
Es wird die im <Akku> übergebene logische Datei
|
||||
geschlossen. Dabei werden alle gespeicherten Werte wie
|
||||
Geräteadresse, Sekundäradresse etc. in der dafür vorgesehenen
|
||||
Tabelle gelöscht. Ist die Aktion nicht problemlos verlaufen, so
|
||||
wird das CARRY-Flag gesetzt.
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
**Ausgabeparameter**: CARRY
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Beispiel für CLOSE
|
||||
LDA #$01 ;Schließen der Beispieldatei von SETNAM
|
||||
JSR $FFC3 ;CLOSE ausführen
|
||||
BCS Error ;Fehler aufgetreten
|
||||
|
||||
$FFC6 CHKIN Logische Datei als Eingabekanal definieren
|
||||
|
||||
Im X-Register wird die logische Dateinummer
|
||||
übergeben, die als Eingabekanal benutzt werden soll. Die ange-
|
||||
gebene logische Dateinummer muß natürlich bereits mit dem
|
||||
OPEN-Kommando geöffnet worden sein. Wird nach dem Aufruf
|
||||
des CHKIN-Kommandos die BASIN-Routine aufgerufen, so
|
||||
erfolgt die Eingabe nicht von Tastatur, sondern von dem
|
||||
geöffneten Gerät; dies kann beispielsweise die Floppy sein. Zu
|
||||
beachten ist, daß zum Einlesen von Tastatur kein CHKIN not-
|
||||
wendig ist, da die Tastatur Standard-Eingabegerät ist. Nach
|
||||
einem CLOSE oder CLRCH ist die Tastatur automatisch wieder
|
||||
das Eingabegerät. Auch bei dieser Routine wird das CARRY als
|
||||
OK-Flag benutzt.
|
||||
|
||||
**Eingabeparameter**: .X
|
||||
|
||||
**Ausgabeparameter**: CARRY
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Einlesen der Directory
|
||||
JSR DIROP ;OPEN 1,8,0,"$" (selbstdefinierte Routine)
|
||||
LDX #$01 ;LFN der eröffneten Datei
|
||||
JSR $FFC6 ;CHKIN ausführen
|
||||
JSR $FFCF ;BASIN - Zeichen holen
|
||||
|
||||
$FFC9 CKOUT Logische Datei als Ausgabedatei definieren
|
||||
|
||||
Entsprechend zu CHKIN definiert diese Routine
|
||||
ein im X-Register zu übergebene Datei als Ausgabedatei. Die
|
||||
Datei muß ordnungsgemäß geöffnet worden sein, beispielsweise
|
||||
würde eine Datei, die mit OPEN l,8,0,"$" geöffnet wurde und
|
||||
mit CKOUT als Ausgabedatei definiert werden soll, einen
|
||||
Fehler hervorrufen, weil diese Datei zum Lesen und nicht zum
|
||||
Schreiben geöffnet wurde. Nach Definition einer Ausgabedatei
|
||||
ist nicht mehr der Bildschirm, sondern die definierte Datei
|
||||
Ausgabegerät. Alle über BSOUT auzugebenen Zeichen werden
|
||||
an dieses Gerät gesandt. Das CARRY-Flag dient als Fehlermel-
|
||||
der. Ist es gelöscht, war die Aktion erfolgreich.
|
||||
|
||||
**Eingabeparameter**: .X
|
||||
|
||||
**Ausgabeparameter**: CARRY
|
||||
|
||||
$FFCC CLRCH Ein/Ausgabekanäle schließen
|
||||
|
||||
Diese Routine löscht evtl, mit CHKIN und/oder
|
||||
CKOUT definierte Ein- und Ausgabedateien. Es wird an das
|
||||
Eingabegerät ein UNTALK und an das Ausgabegerät ein
|
||||
UNLISTEN gesendet. Der Bildschirm ist wieder Ausgabe- und
|
||||
die Tastatur Eingabegerät. Die Dateien werden nicht geschlossen,
|
||||
es erfolgt also kein CLOSE. Es werden weder Ein- noch
|
||||
Ausgabeparameter übergeben.
|
||||
|
||||
$FFCF BASIN Ein Zeichen von Eingabekanal holen
|
||||
|
||||
Die eröffnete und mit CHKIN als Eingabedatei
|
||||
definierte Datei (sonst Tastatur) übergibt ein Zeichen im
|
||||
<Akku>.
|
||||
|
||||
**Ausgabeparameter**: .A
|
||||
|
||||
$FFD2 BSOUT Ein Zeichen auf Ausgabekanal ausgeben
|
||||
|
||||
Es wird das im <Akku> übergebene Zeichen auf
|
||||
die eröffnete und mit CKOUT als Ausgabedatei definierte Datei
|
||||
ausgegeben. Ist der Bildschirm Ausgabedatei (Default), so wird
|
||||
das ASCII-Zeichen in den darzustellenden POKE-Code
|
||||
umgerechnet (ein recht aufwendiges Verfahren. Interessierte
|
||||
sollten sich den entsprechenden Teil im Kernal im C-Bereich
|
||||
ansehen).
|
||||
|
||||
**Eingabeparameter**: .A
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Wechseln des 40/80-Zeichen-Modus
|
||||
LDA #$1B ;<ESC>
|
||||
JSR BSOUT ;$FFD2, Zeichen ausgeben
|
||||
LDA #"X" ;<ESC>-X zum Uechseln des Bildschirmstatus
|
||||
JSR BSOUT ;ausgeben
|
||||
|
||||
(Es gibt allerdings eine spezielle Routine, die man anspringen
|
||||
kann)
|
||||
|
||||
$FFD5 LOADSP Laden einer Datei in den Speicher
|
||||
|
||||
Bevor mit LOADSP eine Datei geladen werden
|
||||
kann, muß das Gerät, die Sekundäradresse, der Filename etc.
|
||||
durch die Routinen SETLFS, SETNAM und SETBNK definiert
|
||||
worden sein. Im X- (Lo) und Y-Register (Hi) wird die Adresse
|
||||
angegeben, ab der die zu ladende Datei abgelegt werden soll.
|
||||
|
||||
**Eingabeparameter**: .X, .Y
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Laden eines Overlay o.ä.
|
||||
JSR PREP ;SETLFS, SETBNK, SETNAM etc.
|
||||
LDX #$00 ;Lo-Byte von $1000
|
||||
LDY #$10 ;Hi-Byte von $1000 (Ladeadresse)
|
||||
JSR $FFD5 ;Lade Datei ab $1000
|
||||
|
||||
$FFD8 SAVESP Abspeichern eines Bereiches auf Datei
|
||||
|
||||
Diese Routine speichert einen Speicherbereich auf
|
||||
eine Datei (Diskette, Kassette) ab. Dazu muß man, wie bei der
|
||||
LOADSP-Routine, zunächst Geräteadresse, Sekundäradresse,
|
||||
RAM-Bank, Filename etc. durch die Routinen SETBNK,
|
||||
SETLFS und SETNAM definieren. Im Akku wird die Zeropage-
|
||||
Adresse angegeben, an der die Anfangsadresse des abzu-
|
||||
speichernden Bereiches steht. Im X- (Lo) und Y-Register (Hi)
|
||||
wird entsprechend die Endadresse des abzuspeichernden
|
||||
Bereiches angegeben.
|
||||
|
||||
**Eingabeparameter**: .A, .X, .Y, Zeropage
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Abspeichern des Bereiches $1000 bis $1100
|
||||
JSR PREP ;SETLFS, SETNAM, SETBNK etc. aufrufen
|
||||
LDA #$00 ;Lo-Byte von $1000
|
||||
STA $FC ;in Zeropage speichern
|
||||
LDA #$10 ;Hi-Byte von $1000
|
||||
STA $FD ;in Zeropage speichern
|
||||
LDA #$FC ;der Pointer befindet sich an $FC
|
||||
LDX #$00 ;Lo-Byte der Endadresse $1100
|
||||
LDY #$11 ;Hi-Byte der Endadresse $1100
|
||||
JSR $FFD8 ;SAVESP - Speichern des Bereiches $1000-$1100
|
||||
|
||||
$FFDB SETTIM Setzen der Systemuhr TI
|
||||
|
||||
Die Routine setzt die Systemuhr TI, die ab
|
||||
Adresse $A0 definiert ist. Diese Uhr wird von der Kernal-IRQ-
|
||||
Routine gesteuert und ist nicht sehr genau. Legen Sie auf eine
|
||||
genauere Uhr Wert, so benutzen Sie die Timer in den beiden
|
||||
CIAs. (Siehe auch entsprechendes Kapitel) Das höchstwertige
|
||||
Byte der 24-Stunden-Uhr wird im Y-Register übergeben.
|
||||
|
||||
**Eingabeparameter**: .A, .X, .Y
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Rücksetzen der Systemuhr
|
||||
LDA #$00 ;Rücksetzen bedeutet
|
||||
TAY ;auf 0,0,0 setzen
|
||||
TAX ;Alle drei Register auf null
|
||||
JSR $FFDB ;SETTIM
|
||||
|
||||
$FFDE RDTIM Auslesen der Systemuhr
|
||||
|
||||
Diese Routine liest die 24-Stunden-Uhr aus und
|
||||
übergibt die drei Bytes den Registern Y (höchstwertig), X und
|
||||
<Akku> (niederwertig).
|
||||
|
||||
**Ausgabeparameter**: .A, .X, .Y
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Auslesen der 24-Stunden-Uhr
|
||||
JSR $FFDE ;RDTIM aufrufen
|
||||
STY $FC ;MSB merken
|
||||
STX $FD ;mittleres Byte merken
|
||||
STA $FE ;LSB merken
|
||||
|
||||
$FFE1 STOP Abfrage der Stop-Taste
|
||||
|
||||
Wenn bis zum letzten IRQ-Aufruf die Stop-Taste
|
||||
betätigt worden ist, so wird das ZERO-Flag gesetzt und es wird
|
||||
ein CLRCH ausgeführt. Wurde die Stop-Taste nicht betätigt, so
|
||||
wird das ZERO-Flag gelöscht.
|
||||
|
||||
**Ausgabeparameter**: ZERO-Flag
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Auf STOP prüfen
|
||||
JSR $FFE1 ;STOP-Taste gedrückt?
|
||||
BEQ Jawoll ;Ist gedrückt
|
||||
|
||||
$FFE4 GETIN Holt ein Zeichen aus Tastaturbuffer oder RS232
|
||||
|
||||
Holt von der definierten Eingabedatei ein
|
||||
Zeichen. Ist kein Zeichen bereit gestellt, so wird der <Akku>
|
||||
mit null übergeben.
|
||||
|
||||
**Ausgabeparameter**: .A
|
||||
|
||||
$FFE7 CLALL Alle offenen Dateien schließen
|
||||
|
||||
Alle mittels OPEN eröffneten Dateien werden
|
||||
geschlossen oder besser gelöscht - es wird nämlich kein CLOSE
|
||||
ausgeführt. Beispielsweise bei offenen Floppy-Dateien kann dies
|
||||
sehr ärgerlich sein (WRITE FILE OPEN ERROR ist eine
|
||||
Konsequenz). Ferner wird nach dem Löschen der logischen
|
||||
Dateien ein CLRCH (s.o.) ausgeführt. CLALL ist also mit Vor-
|
||||
sicht anzuwenden.
|
||||
|
||||
$FFEA LIDTIM Systemuhr anpassen (updaten)
|
||||
|
||||
Diese Routine wird vornehmlich von der IRQ-
|
||||
Routine aufgerufen. Es wird die Drei-Byte-24-Stunden-Uhr um
|
||||
eine Einheit hochgezählt.
|
||||
|
||||
$FFED SCRORG Größe des aktuellen Fensters holen
|
||||
|
||||
Die Routine SCRORG holt die aktuellen
|
||||
Fensterwerte in die Register. Der <Akku> enthält nach dem
|
||||
Aufruf die maximale Spaltenzahl, im Y-Register befindet sich
|
||||
die Anzahl der Zeilen im Fenster und im X-Register die Anzahl
|
||||
der Spalten des Fensters.
|
||||
|
||||
**Ausgabeparameter**: .A, .X, .Y
|
||||
|
||||
$FFF0 PLOT Cursor-Position holen/setzen
|
||||
|
||||
Je nach Zustand des CARRY-Flags wird entweder
|
||||
die Cursorposition geholt oder gesetzt. X- und Y-Register sind
|
||||
auf jeden Fall die Kommunikationsregister. Das Y-Register
|
||||
definiert die Zeile (Erste Zeile im Fenster ist null) und das X-
|
||||
Register die Spalte des Cursors. Ist das CARRY-Flag gesetzt, so
|
||||
wird die aktuelle Cursorpostion im Fenster in X- und Y-
|
||||
Register zurückgegeben.
|
||||
|
||||
**Eingabeparameter**: .X, .Y, CARRY
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Einen Stern (*) in die Fenstermitte setzen
|
||||
JSR $FFED ;SCRORG aufrufen
|
||||
TXA ;Spaltenzahl nach <Akku>
|
||||
LSR A ;Divisiondurch zwei (Mitte)
|
||||
TAX ;und als Spalte wieder nach X
|
||||
TYA ;Zeilenzahl nach <Akku>
|
||||
LSR A ;Divisiondurch zwei (Mitte)
|
||||
TAY ;und wieder als Zeile nach Y
|
||||
CLC ;Gelöschtes Carry=Setzen Cursorposition
|
||||
JSR $FFF0 ;Setze Cursorposition
|
||||
LDA #"*" ;<Akku> mit Stern laden
|
||||
JSR $FFD2 ;und ausgeben.
|
||||
|
||||
$FFF3 IOBASE Holt die Basisadresse des I/O-Bereiches
|
||||
|
||||
Es wird die Adresse des Ein- und Ausgabebe-
|
||||
reiches in X- (Lo) und Y-Register (Hi) übergeben. Diese
|
||||
Adresse ist beim C128 natürlich immer $D000. Für spätere
|
||||
Erweiterungen bzw. Verschiebungen ist es aus Kompatibilitäts-
|
||||
gründen ratsam, diese Routine in die Software mit zu integrieren
|
||||
und sich darauf zu beziehen.
|
||||
|
||||
**Ausgabeparameter**: .X, .Y
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
;Anfang des Programmes:
|
||||
JSR $FFF3 ;IOBASE
|
||||
STX $FD ;Lo-Byte merken
|
||||
STY $FE ;Hi-Byte merken
|
||||
|
||||
Im Programm bezieht man diese Adresse dann wie folgt ein:
|
||||
|
||||
STA ($FD),Y ;In I/O-Bereich
|
||||
99
kernal/kernal_64intern.txt
Normal file
99
kernal/kernal_64intern.txt
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
$FF81 Video-Reset
|
||||
|
||||
$FF84 CIAs initialisieren
|
||||
|
||||
$FF87 RAM löschen/testen
|
||||
|
||||
$FF8A I/O initialisieren
|
||||
|
||||
$FF8D I/O Vektoren initialisieren
|
||||
|
||||
$FF90 Setzt Flag für Ausgabe von Systemmeldung
|
||||
|
||||
$FF93 schickt Sekundäradresse nach einem LISTEN-Befehl
|
||||
auf den IEC-Bus
|
||||
|
||||
$FF96 schickt Sekundäradresse nach einem TALK-Befehl
|
||||
auf den IEC-Bus
|
||||
|
||||
$FF99 holt bei gesetzem Carry-Flag die höchste RAM-
|
||||
Adresse nach X und Y, bei gelöschtem Carry-
|
||||
Flag wird die Adresse von X und Y gesetzt.
|
||||
|
||||
$FF9C dieselbe Funktion wie $FF99, jedoch für den
|
||||
RAM-Anfang
|
||||
|
||||
$FF9F fragt die Tastatur ab
|
||||
|
||||
$FFA2 setzt das Time-out-Flag für den IEC-Bus
|
||||
|
||||
$FFA5 holt ein Byte vom IEC-Bus in den Akku
|
||||
|
||||
$FFA8 gibt ein Byte aus dem Akku an den IEC-Bus aus
|
||||
|
||||
$FFAB sendet UNTALK-Befehl auf den IEC-Bus
|
||||
|
||||
$FFAE sendet UNLISTEN-Befehl auf den IEC-Bus
|
||||
|
||||
$FFB1 sendet LISTEN-Befehl auf den IEC-Bus
|
||||
|
||||
$FFB4 sendet TALK-Befehl zum IEC-Bus
|
||||
|
||||
$FFB7 holt das Statuswort in den Akku
|
||||
|
||||
$FFBA setzt die Fileparameter, Akku muß logische
|
||||
Filenummer enthalten, X = Gerätenummer und
|
||||
Y = Sekundäradresse
|
||||
|
||||
$FFBD setzt Parameter des Filenamens, Akku muß
|
||||
Länge des Namens enthalten, X und Y enthalten
|
||||
die Adresse des Filenamens (Low- und High-Byte)
|
||||
|
||||
$FFC0 OPEN-Befehl, öffnet logische Datei
|
||||
|
||||
$FFC3 CLOSE-Befehl, schließt logischeDatei,
|
||||
Akku muß logische Filenummer enthalten
|
||||
|
||||
$FFC6 CHKIN setzt folgende Eingabe auf logische
|
||||
Datei, die in X übergeben wird.
|
||||
Die logische Datei muß vorher mit der
|
||||
OPEN-Routine geöffnet werden.
|
||||
|
||||
$FFC9 CKOUT setzt folgende Ausgabe auf logische
|
||||
Datei, die in X übergeben wird.
|
||||
Die logische Datei muß vorher mit der
|
||||
OPEN-Routine geöffnet werden.
|
||||
|
||||
$FFCC CLRCH setzt die Ein- und Ausgabe wieder
|
||||
auf Standard (Tastatur/Bildschirm)
|
||||
|
||||
$FFCF BASIN Eingabe, holt ein Zeichen in den Akku
|
||||
|
||||
$FFD2 BSOUT Ausgabe, gibt Zeichen im Akku aus
|
||||
|
||||
$FFD5 LOAD, lädt Programm in den Speicher
|
||||
|
||||
$FFD8 SAVE, speichert Programm ab
|
||||
|
||||
$FFDE setzt die laufende Zeit neu
|
||||
|
||||
$FFE1 holt die laufende Zeit fragt die STOP-Taste ab
|
||||
|
||||
$FFE4 GET, holt ein Zeichen in den Akku
|
||||
|
||||
$FFE7 CLALL, setzt a lle Ein-/Ausgabekanäle
|
||||
zurück, die Dateien werden jedoch
|
||||
nicht geschlossen
|
||||
|
||||
$FFEA erhöht die laufende Zeit um eine
|
||||
sechzigstel Sekunde
|
||||
|
||||
$FFED SCREEN holt die Anzahl der Zeilen und
|
||||
Spalten des Bildschirms
|
||||
|
||||
$FFF0 bei gelöschtem Carry-Flag wird der Cursor
|
||||
auf die Position X/Y gesetzt, bei gesetztem
|
||||
Carry-Flag wird die Cursorposition nach X/Y
|
||||
geholt (X-Reg = Zeile, Y-Reg = Spalte)
|
||||
|
||||
$FFF3 holt die Startadresse des I/O-Bausteins
|
||||
299
kernal/kernal_ct.txt
Normal file
299
kernal/kernal_ct.txt
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
-
|
||||
- Craig Taylor: Kernal 64 / 128
|
||||
- C=Hacking, Volume 1, Issue 3; July 15, 1992
|
||||
-
|
||||
|
||||
$FF81 CINT Setup VIC, screen values, (128: 8563)...
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : None.
|
||||
Memory Changed: Screen Editor Locations.
|
||||
|
||||
$FF84 IOINIT Initializes pertinant display and i/o devices
|
||||
|
||||
Registers In : C64: None. | C128: $0A04/bit 7
|
||||
| 0 - Full Setup.
|
||||
| 1 - Partial Setup. (no 8563 char)
|
||||
Registers Out : .A, .X, .Y destroyed.
|
||||
Memory Changed: CIA's, VIC, 8502 port, (C128: also optionally 8563).
|
||||
Note : This routine automatically distinguishes a PAL system from a
|
||||
NTSC system and sets PALCNT accordingly for use in the
|
||||
time routines.
|
||||
|
||||
$FF87 RAMTAS Clears Z-Page, Sets RS-232 buffers, top/bot Ram.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A, .X, .Y destroyed.
|
||||
Memory Changed: Z-Page, Rs-232 buffers, top/bot Ram ptrs
|
||||
|
||||
$FF8D VECTOR Copies / Stores KERNAL indirect RAM vectors.
|
||||
|
||||
Registers In : .C = 0 (Set KERNAL Vectors) | .C = 1 (Duplicate KERNAL vectors)
|
||||
.XY = address of vectors | .XY = address of user vectors
|
||||
Registers Out : .A, .Y destroyed | .A, .Y destroyed.
|
||||
Memory Changed: KERNAL Vectors changed | Vectors written to .XY
|
||||
Note : This routine is rarely used, usually the vectors are directly
|
||||
changed themselves. The vectors, in order, are :
|
||||
|
||||
C128: IRQ,BRK,NMI,OPEN,CLOSE,CHKIN,CHKOUT,CLRCH,BASIN,BSOUT
|
||||
STOP,GETIN,CLALL,EXMON (monitor),LOAD,SAVE
|
||||
C64 : IRQ,BRK,NMI,OPEN,CLOSE,CHKIN,CHKOUT,CLRCH,BASIN,BSOUT
|
||||
STOP,GETIN,CLALL,USRCMD (not used),LOAD,SAVE
|
||||
|
||||
$FF90 SETMSG Set control of KERNAL control and error messages.
|
||||
|
||||
Registers In : .A bit 7 = KERNAL Control Messages (1 = on)
|
||||
bit 6 = KERNAL Error Messages (1 = on)
|
||||
Registers Out : None.
|
||||
Note : KERNAL Control messages are those defined as Loading, Found etc
|
||||
... KERNAL Error messages are I/O ERROR # messages which are
|
||||
listed as follows:
|
||||
|
||||
$FF93 SECND Sends secondary address to device after a LISTN
|
||||
|
||||
Registers In : .A = secondary address
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FF96 TKSA Sends secondary address to device after TALK
|
||||
|
||||
Registers In : .A = secondary address.
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FF99 MEMTOP Read or Set top of System Ram
|
||||
|
||||
Registers In : .C = 1 (Read MemTop) | .C = 0 (Set MemTop)
|
||||
| .XY = top of memory
|
||||
Registers Out : .XY = top of memory | None.
|
||||
Memory Changed: None. | Top of memory changed.
|
||||
Note : On the C=128, this routine refers to the top of BANK 0 RAM, not
|
||||
BANK 1 RAM.
|
||||
|
||||
$FF9C MEMBOT Read or Set bottom of System Ram
|
||||
|
||||
Registers In : .C = 1 (Read MemBot) | .C = 0 (Set MemBot)
|
||||
| .XY = bottom of memory.
|
||||
Registers Out : .XY = bottom of memory | None.
|
||||
Memory Changed: None. | Bottom of Memory changed.
|
||||
Note : On the C=128, this routine refers to the bottom of BANK 0 RAM,
|
||||
not, BANK 1 RAM.
|
||||
|
||||
$FF9F KEY Scans Keyboard
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : None.
|
||||
Memory Changed: Relevant System Keyboard Values
|
||||
|
||||
$FFA2 SETMO
|
||||
|
||||
This is a routine who's code never made it into any versions
|
||||
of the KERNAL on the C64, Vic-20 and C128. Thus it is of no
|
||||
pratical use.
|
||||
|
||||
$FFA5 ACPTR Get byte from current talker.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A = data byte.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFA8 CIOUT Output byte to current listener.
|
||||
|
||||
Registers In : .A = byte.
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFAB UNTLK Commands current TALK device to stop TALKING.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFAE UNLSN Commands current listening device to stop listening.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFB1 LISTN Commands device to begin listening.
|
||||
|
||||
Registers In : .A = device #.
|
||||
Registers Out : .A used.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFB4 TALK Commands device to begin talking.
|
||||
|
||||
Registers In : .A = device #.
|
||||
Registers Out : .A used.
|
||||
Memory Changed: None.
|
||||
Note : Low level serial I/O - recommended use OPEN,CLOSE,CHROUT etc..
|
||||
|
||||
$FFB7 READSS Return I/O status byte.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A = status byte. (see section on ERROR messages).
|
||||
Memory Changed: None.
|
||||
|
||||
$FFBA SETLFS Set logical file #, device #, secondary # for I/O.
|
||||
|
||||
Registers In : .A = logical file #, .X = device #, .Y = secondary #
|
||||
Registers Out : None.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFBD SETNAM Sets pointer to filename in preperation for OPEN.
|
||||
|
||||
Registers In : .A = string length, .XY = string address.
|
||||
Registers Out : None.
|
||||
Memory Changed: None.
|
||||
Note : To specify _no_ filename specify a length of 0.
|
||||
|
||||
$FFC0 OPEN Open up file that has been setup by SETNAM,SETLFS
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A = error code, .X,.Y destroyed.
|
||||
.C = 1 if error.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFC3 CLOSE Close a logical file.
|
||||
|
||||
Registers In : .A = logical file #.
|
||||
Registers Out : .A = error code, .X,.Y destroyed.
|
||||
.C = 1 if error
|
||||
Memory Changed: None.
|
||||
|
||||
$FFC6 CHKIN Sets input channel.
|
||||
|
||||
Registers In : .X = logical file #.
|
||||
Registers Out : .A = error code, .X,.Y destroyed.
|
||||
.C = 1 if error
|
||||
Memory Changed: None.
|
||||
|
||||
$FFC9 CHKOUT Sets output channel.
|
||||
|
||||
Registers In : .X = logical file #.
|
||||
Registers Out : .A = error code, .X,.Y destroyed.
|
||||
.C = 1 if error
|
||||
Memory Changed: None.
|
||||
|
||||
$FFCC CLRCH Restore default input and output channels.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A, .X used.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFCF BASIN Read character from current input channel.
|
||||
|
||||
Cassette - Returned one character a time from cassette buffer.
|
||||
Rs-232 - Return one character at a time, waiting until
|
||||
character is ready.
|
||||
Serial - Returned one character at time, waiting if nessc.
|
||||
Screen - Read from current cursor position.
|
||||
Keyboard - Read characters as a string, then return them
|
||||
individually upon each call until all characters
|
||||
have been passed ($0d is the EOL).
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A = character or error code, .C = 1 if error.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFD2 BSOUT Output byte to current channel
|
||||
|
||||
Registers In : .A = Byte
|
||||
Registers Out : .C = 1 if ERROR (examine READST)
|
||||
Memory Changed: Dependent upon current device.
|
||||
|
||||
$FFD5 LOAD Loads file into memory (setup via SETLFS,SETNAM)..
|
||||
|
||||
Registers In : .A = 0 - Load, Non-0 = Verify
|
||||
.XY = load address (if secondary address = 0)
|
||||
Registers Out : .A = error code .C = 1 if error.
|
||||
.XY = ending address
|
||||
Memory Changed: As per registers / data file.
|
||||
|
||||
$FFD8 SAVE Save section of memory to a file.
|
||||
|
||||
Registers In : .A = Z-page ptr to start adress
|
||||
.XY = end address
|
||||
Registers Out : .A = error code, .C = 1 if error.
|
||||
.XY = used.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFDB SETTIM Set internal clock (TI$).
|
||||
|
||||
Registers In : .AXY - Clock value in jiffies (1/60 secs).
|
||||
Registers Out : None.
|
||||
Memory Changed: Relevant system time locations set.
|
||||
|
||||
$FFDE RDTIM Reads internal clock (TI$)
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .AXY - Clock value in jiffies (1/60 secs).
|
||||
Memory Changed: None.
|
||||
|
||||
$FFE1 STOP Scans STOP key.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A = last keyboard row, .X = destroyed (if stop key)
|
||||
Memory Changed: None.
|
||||
Note : The last keyboard row is as follows:
|
||||
.A -> | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
|
||||
KEY: |STOP |Q |C= |SPACE|2 |CTRL |<- |1
|
||||
|
||||
$FFE4 GETIN Read buffered data from file.
|
||||
|
||||
Keyboard - Read from keyboard buffer, else return null ($00).
|
||||
Rs-232 - Read from Rs-232 buffer, else null is returned.
|
||||
Serial - See BASIN
|
||||
Cassette - See BASIN
|
||||
Screen - See BASIN
|
||||
Registers In : None.
|
||||
Registers Out : .A = character, .C = 1 if error.
|
||||
.XY = used.
|
||||
Memory Changed: None.
|
||||
|
||||
$FFE7 CLALL Close all open files and channels.
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .AX used.
|
||||
Memory Changed: None.
|
||||
Note : This routine does not _actually_ close the files, rather it
|
||||
removes their prescense from the file tables held in memory.
|
||||
It's recommended to use close to close files instead of using
|
||||
this routine.
|
||||
|
||||
|
||||
$FFEA UDTIME Update internal (TI$) clock by 1 jiffie (1/60 sec).
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .A,.X destroyed.
|
||||
Memory Changed: Relevant system time locations changed.
|
||||
|
||||
$FFED SCRORG Returns current window/screen size
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .X - Window Row Max
|
||||
.Y - Window Col Max
|
||||
.A - Screen Col Max (128 only, 64 unchanged)
|
||||
Memory Changed: None
|
||||
|
||||
$FFF0 PLOT Read or set cursor position.
|
||||
|
||||
Registers In : .C = 1 (Read) | .C = 0 (Set)
|
||||
None. | .X = Col
|
||||
| .Y = Row
|
||||
Registers Out : .C = 1 (Read) | .C = 0 (Set)
|
||||
.X = Current Col | None.
|
||||
.Y = Current Row |
|
||||
Memory Changed: None | Screen Editor Locations.
|
||||
|
||||
$FFF3 IOBASE Returns base of I/O Block
|
||||
|
||||
Registers In : None.
|
||||
Registers Out : .XY = address of I/O block ($D000)
|
||||
Memory Changed: Screen Editor Locations.
|
||||
1901
kernal/kernal_dh.txt
Normal file
1901
kernal/kernal_dh.txt
Normal file
File diff suppressed because it is too large
Load diff
173
kernal/kernal_fk.txt
Normal file
173
kernal/kernal_fk.txt
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
-
|
||||
- C64 KERNAL jump table, composed by Frank Kontros (jeno@kontr.uzhgorod.ua).
|
||||
- http://www.zimmers.net/anonftp/pub/cbm/c64/programming/documents/c64-kernal.txt
|
||||
-
|
||||
|
||||
$FF81 CINT init VIC & screen editor
|
||||
|
||||
- - - - - - A X Y
|
||||
|
||||
$FF84 IOINIT initialize CIA & IRQ
|
||||
|
||||
- - - - - - A X Y
|
||||
|
||||
$FF87 RAMTAS RAM test & search RAM end
|
||||
|
||||
- - - - - - A X Y
|
||||
|
||||
$FF8A RESTOR restore default I/O vectors
|
||||
|
||||
- - - - - - A - Y
|
||||
|
||||
$FF8D VECTOR read/set I/O vectors
|
||||
|
||||
in: C=0 moves from Y/X to vectors - X Y - X - A - Y
|
||||
C=1 moves vectors to Y/X - X Y - X - A - Y
|
||||
|
||||
$FF90 SETMSG enable/disable KERNAL messages
|
||||
|
||||
in: A bit7=1 error msgs on A - - - - - A - -
|
||||
bit6=1 control msgs on
|
||||
|
||||
$FF93 SECOND send secondary addr after listen
|
||||
|
||||
in: A=secondary address A - - - - - A - -
|
||||
|
||||
$FF96 TKSA send secondary addr after talk
|
||||
|
||||
in: A=secondary address A - - - - - A - -
|
||||
|
||||
$FF99 MEMTOP read/set top of memory
|
||||
|
||||
in: C=0; Y/X address - X Y - X Y - - -
|
||||
out:C=1; Y/X address - - - - X Y - X Y
|
||||
|
||||
$FF9C MEMBOT read/set bottom of memory
|
||||
|
||||
in: C=0; Y/X address - X Y - X Y - - -
|
||||
out:C=1; Y/X address - - - - X Y - X Y
|
||||
|
||||
$FF9F SCNKEY scan keyboard
|
||||
|
||||
- - - - - - A X Y
|
||||
|
||||
$FFA2 SETTMO set IEEE timeout
|
||||
|
||||
in: A bit7=1 disable, bit7=0 enable A - - A - - - - -
|
||||
|
||||
$FFA5 ACPTR input byte from SERIAL
|
||||
|
||||
out:A=byte, C=1 and ST=2 if timeout - - - A - - A - -
|
||||
|
||||
$FFA8 CIOUT output byte to SERIAL
|
||||
|
||||
in: A=byte, C=1 and ST=3 if timeout A - - A - - - - -
|
||||
|
||||
$FFAB UNTLK untalk all SERIAL devices
|
||||
- - - - - - A - -
|
||||
|
||||
$FFAE UNLSN unlisten all SERIAL devices
|
||||
- - - - - - A - -
|
||||
|
||||
$FFB1 LISTEN make SERIAL device listen
|
||||
|
||||
in: A=device number A - - - - - A - -
|
||||
|
||||
$FFB4 TALK make SERIAL device talk
|
||||
|
||||
in: A=device number A - - - - - A - -
|
||||
|
||||
$FFB7 READST read I/O status byte
|
||||
|
||||
out:A=status byte - - - A - - A - -
|
||||
|
||||
$FFBA SETLFS set file parameters
|
||||
|
||||
in: A=logical file number A X Y A X Y - - -
|
||||
X=device number
|
||||
Y=secondary addr
|
||||
|
||||
$FFBD SETNAM set file name
|
||||
|
||||
in: A=length of filename A X Y A X Y - - -
|
||||
Y/X=pointer to name addr
|
||||
|
||||
$FFC0 OPEN open log.file after SETLFS,SETNAM
|
||||
|
||||
out:A=error# if C=1 - - - - - - A X Y
|
||||
|
||||
$FFC3 CLOSE close a logical file
|
||||
|
||||
in: A=logical file number A - - - - - A X Y
|
||||
|
||||
$FFC6 CHKIN open channel for input
|
||||
|
||||
in: X=logical file number - X - - - - A X -
|
||||
|
||||
$FFC9 CHKOUT open channel for output
|
||||
|
||||
in: X=logical file number - X - - - - A X -
|
||||
|
||||
$FFCC CLRCHN restore default devices
|
||||
|
||||
- - - - - - A X -
|
||||
|
||||
$FFCF CHRIN input character
|
||||
|
||||
out:A=character, C=1 and ST=error - - - A - - A - -
|
||||
|
||||
$FFD2 CHROUT output character
|
||||
|
||||
in: A=character, C=1 and ST=error A - - A - - - - -
|
||||
|
||||
$FFD5 LOAD load after call SETLFS,SETNAM
|
||||
|
||||
in: A=0 load, a=1 verify A X Y A X Y A X Y
|
||||
Y/X = dest.addr if sec.addr=0
|
||||
|
||||
$FFD8 SAVE save after call SETLFS,SETNAM
|
||||
|
||||
in: A=zero page pointer to start.addr A X Y - - - A X Y
|
||||
Y/X=ending address
|
||||
|
||||
$FFDB SETTIM set jiffy clock
|
||||
|
||||
in: A=MSB, X=middle, Y=LSB A X Y - - - - - -
|
||||
|
||||
$FFDE RDTIM read jiffy clock
|
||||
|
||||
out:A=MSB, X=middle, Y=LSB - - - A X Y A X Y
|
||||
|
||||
$FFE1 STOP check stop key
|
||||
|
||||
out:Z=0 if STOP not used; X unchanged - - - A - - A - -
|
||||
Z=1 if STOP used; X changed - - - A - - A X -
|
||||
A=last line of keyboard matrix
|
||||
|
||||
$FFE4 GETIN get a byte from channel
|
||||
|
||||
out:keyboard:A=0 if puffer empty - - - A - - A X Y
|
||||
RS232:status byte - - - A - - A - -
|
||||
serial:status byte - - - A - - A - -
|
||||
tape:status byte - - - A - - A - Y
|
||||
|
||||
$FFE7 CLALL close or abort all files
|
||||
|
||||
- - - - - - A X -
|
||||
|
||||
$FFEA UDTIM update jiffy clock
|
||||
|
||||
- - - - - - A X -
|
||||
|
||||
$FFED SCREEN return screen size
|
||||
|
||||
out:X=columns, Y=rows - - - - X Y - X Y
|
||||
|
||||
$FFF0 PLOT read/set cursor position
|
||||
|
||||
in: C=0, X=row, Y=column - X Y - X Y - - -
|
||||
out:C=1, X=row, Y=column - - - - X Y - X Y
|
||||
|
||||
$FFF3 IOBASE returns the addr of I/O devices
|
||||
|
||||
out:Y/X=addr($DC00) - - - - X Y - X Y
|
||||
416
kernal/kernal_ld.txt
Normal file
416
kernal/kernal_ld.txt
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
-
|
||||
- The almost completely commented C64 ROM disassembly. V1.01 Lee Davison 2012
|
||||
-
|
||||
|
||||
$FF81 initialise VIC and screen editor
|
||||
|
||||
|
||||
|
||||
$FF84 initialise SID, CIA and IRQ, unused
|
||||
|
||||
|
||||
|
||||
$FF87 RAM test and find RAM end
|
||||
|
||||
|
||||
|
||||
$FF8A restore default I/O vectors
|
||||
|
||||
This routine restores the default values of all system vectors used in KERNAL and
|
||||
BASIC routines and interrupts.
|
||||
|
||||
|
||||
|
||||
$FF8D read/set vectored I/O
|
||||
|
||||
This routine manages all system vector jump addresses stored in RAM. Calling this
|
||||
routine with the carry bit set will store the current contents of the RAM vectors
|
||||
in a list pointed to by the X and Y registers. When this routine is called with
|
||||
the carry bit clear, the user list pointed to by the X and Y registers is copied
|
||||
to the system RAM vectors.
|
||||
|
||||
NOTE: This routine requires caution in its use. The best way to use it is to first
|
||||
read the entire vector contents into the user area, alter the desired vectors and
|
||||
then copy the contents back to the system vectors.
|
||||
|
||||
|
||||
|
||||
$FF90 control kernal messages
|
||||
|
||||
This routine controls the printing of error and control messages by the KERNAL.
|
||||
Either print error messages or print control messages can be selected by setting
|
||||
the accumulator when the routine is called.
|
||||
|
||||
FILE NOT FOUND is an example of an error message. PRESS PLAY ON CASSETTE is an
|
||||
example of a control message.
|
||||
|
||||
Bits 6 and 7 of this value determine where the message will come from. If bit 7
|
||||
is set one of the error messages from the KERNAL will be printed. If bit 6 is set
|
||||
a control message will be printed.
|
||||
|
||||
|
||||
$FF93 send secondary address after LISTEN
|
||||
|
||||
This routine is used to send a secondary address to an I/O device after a call to
|
||||
the LISTEN routine is made and the device commanded to LISTEN. The routine cannot
|
||||
be used to send a secondary address after a call to the TALK routine.
|
||||
|
||||
A secondary address is usually used to give set-up information to a device before
|
||||
I/O operations begin.
|
||||
|
||||
When a secondary address is to be sent to a device on the serial bus the address
|
||||
must first be ORed with $60.
|
||||
|
||||
|
||||
$FF96 send secondary address after TALK
|
||||
|
||||
This routine transmits a secondary address on the serial bus for a TALK device.
|
||||
This routine must be called with a number between 4 and 31 in the accumulator.
|
||||
The routine will send this number as a secondary address command over the serial
|
||||
bus. This routine can only be called after a call to the TALK routine. It will
|
||||
not work after a LISTEN.
|
||||
|
||||
|
||||
$FF99 read/set the top of memory
|
||||
|
||||
This routine is used to read and set the top of RAM. When this routine is called
|
||||
with the carry bit set the pointer to the top of RAM will be loaded into XY. When
|
||||
this routine is called with the carry bit clear XY will be saved as the top of
|
||||
memory pointer changing the top of memory.
|
||||
|
||||
|
||||
$FF9C read/set the bottom of memory
|
||||
|
||||
This routine is used to read and set the bottom of RAM. When this routine is
|
||||
called with the carry bit set the pointer to the bottom of RAM will be loaded
|
||||
into XY. When this routine is called with the carry bit clear XY will be saved as
|
||||
the bottom of memory pointer changing the bottom of memory.
|
||||
|
||||
|
||||
$FF9F scan the keyboard
|
||||
|
||||
This routine will scan the keyboard and check for pressed keys. It is the same
|
||||
routine called by the interrupt handler. If a key is down, its ASCII value is
|
||||
placed in the keyboard queue.
|
||||
|
||||
|
||||
$FFA2 set timeout on serial bus
|
||||
|
||||
This routine sets the timeout flag for the serial bus. When the timeout flag is
|
||||
set, the computer will wait for a device on the serial port for 64 milliseconds.
|
||||
If the device does not respond to the computer's DAV signal within that time the
|
||||
computer will recognize an error condition and leave the handshake sequence. When
|
||||
this routine is called and the accumulator contains a 0 in bit 7, timeouts are
|
||||
enabled. A 1 in bit 7 will disable the timeouts.
|
||||
|
||||
NOTE: The the timeout feature is used to communicate that a disk file is not found
|
||||
on an attempt to OPEN a file.
|
||||
|
||||
|
||||
$FFA5 input byte from serial bus
|
||||
|
||||
This routine reads a byte of data from the serial bus using full handshaking. the
|
||||
data is returned in the accumulator. before using this routine the TALK routine,
|
||||
$FFB4, must have been called first to command the device on the serial bus to
|
||||
send data on the bus. if the input device needs a secondary command it must be sent
|
||||
by using the TKSA routine, $FF96, before calling this routine.
|
||||
|
||||
Errors are returned in the status word which can be read by calling the READST
|
||||
routine, $FFB7.
|
||||
|
||||
|
||||
$FFA8 output a byte to serial bus
|
||||
|
||||
This routine is used to send information to devices on the serial bus. A call to
|
||||
this routine will put a data byte onto the serial bus using full handshaking.
|
||||
Before this routine is called the LISTEN routine, $FFB1, must be used to
|
||||
command a device on the serial bus to get ready to receive data.
|
||||
|
||||
The accumulator is loaded with a byte to output as data on the serial bus. A
|
||||
device must be listening or the status word will return a timeout. This routine
|
||||
always buffers one character. So when a call to the UNLISTEN routine, $FFAE,
|
||||
is made to end the data transmission, the buffered character is sent with EOI
|
||||
set. Then the UNLISTEN command is sent to the device.
|
||||
|
||||
|
||||
$FFAB command serial bus to UNTALK
|
||||
|
||||
This routine will transmit an UNTALK command on the serial bus. All devices
|
||||
previously set to TALK will stop sending data when this command is received.
|
||||
|
||||
|
||||
$FFAE command serial bus to UNLISTEN
|
||||
|
||||
This routine commands all devices on the serial bus to stop receiving data from
|
||||
the computer. Calling this routine results in an UNLISTEN command being transmitted
|
||||
on the serial bus. Only devices previously commanded to listen will be affected.
|
||||
|
||||
This routine is normally used after the computer is finished sending data to
|
||||
external devices. Sending the UNLISTEN will command the listening devices to get
|
||||
off the serial bus so it can be used for other purposes.
|
||||
|
||||
|
||||
$FFB1 command devices on the serial bus to LISTEN
|
||||
|
||||
This routine will command a device on the serial bus to receive data. The
|
||||
accumulator must be loaded with a device number between 4 and 31 before calling
|
||||
this routine. LISTEN convert this to a listen address then transmit this data as
|
||||
a command on the serial bus. The specified device will then go into listen mode
|
||||
and be ready to accept information.
|
||||
|
||||
|
||||
$FFB4 command serial bus device to TALK
|
||||
|
||||
To use this routine the accumulator must first be loaded with a device number
|
||||
between 4 and 30. When called this routine converts this device number to a talk
|
||||
address. Then this data is transmitted as a command on the Serial bus.
|
||||
|
||||
|
||||
$FFB7 read I/O status word
|
||||
|
||||
This routine returns the current status of the I/O device in the accumulator. The
|
||||
routine is usually called after new communication to an I/O device. The routine
|
||||
will give information about device status, or errors that have occurred during the
|
||||
I/O operation.
|
||||
|
||||
|
||||
$FFBA set logical, first and second addresses
|
||||
|
||||
This routine will set the logical file number, device address, and secondary
|
||||
address, command number, for other KERNAL routines.
|
||||
|
||||
the logical file number is used by the system as a key to the file table created
|
||||
by the OPEN file routine. Device addresses can range from 0 to 30. The following
|
||||
codes are used by the computer to stand for the following CBM devices:
|
||||
|
||||
| ADDRESS | DEVICE |
|
||||
|---------|---------------------------|
|
||||
| 0 | Keyboard |
|
||||
| 1 | Cassette #1 |
|
||||
| 2 | RS-232C device |
|
||||
| 3 | CRT display |
|
||||
| 4 | Serial bus printer |
|
||||
| 8 | CBM Serial bus disk drive |
|
||||
|
||||
Device numbers of four or greater automatically refer to devices on the serial
|
||||
bus.
|
||||
|
||||
A command to the device is sent as a secondary address on the serial bus after
|
||||
the device number is sent during the serial attention handshaking sequence. If
|
||||
no secondary address is to be sent Y should be set to $FF.
|
||||
|
||||
|
||||
$FFBD set the filename
|
||||
|
||||
This routine is used to set up the file name for the OPEN, SAVE, or LOAD routines.
|
||||
The accumulator must be loaded with the length of the file and XY with the pointer
|
||||
to file name, X being th low byte. The address can be any valid memory address in
|
||||
the system where a string of characters for the file name is stored. If no file
|
||||
name desired the accumulator must be set to 0, representing a zero file length,
|
||||
in that case XY may be set to any memory address.
|
||||
|
||||
|
||||
$FFC0 open a logical file
|
||||
|
||||
This routine is used to open a logical file. Once the logical file is set up it
|
||||
can be used for input/output operations. Most of the I/O KERNAL routines call on
|
||||
this routine to create the logical files to operate on. No arguments need to be
|
||||
set up to use this routine, but both the SETLFS, $FFBA, and SETNAM, $FFBD,
|
||||
KERNAL routines must be called before using this routine.
|
||||
|
||||
|
||||
|
||||
$FFC3 close a specified logical file
|
||||
|
||||
This routine is used to close a logical file after all I/O operations have been
|
||||
completed on that file. This routine is called after the accumulator is loaded
|
||||
with the logical file number to be closed, the same number used when the file was
|
||||
opened using the OPEN routine.
|
||||
|
||||
|
||||
$FFC6 open channel for input
|
||||
|
||||
Any logical file that has already been opened by the OPEN routine, $FFC0, can be
|
||||
defined as an input channel by this routine. the device on the channel must be an
|
||||
input device or an error will occur and the routine will abort.
|
||||
|
||||
If you are getting data from anywhere other than the keyboard, this routine must be
|
||||
called before using either the CHRIN routine, $FFCF, or the GETIN routine,
|
||||
$FFE4. if you are getting data from the keyboard and no other input channels are
|
||||
open then the calls to this routine and to the OPEN routine, $FFC0, are not needed.
|
||||
|
||||
When used with a device on the serial bus this routine will automatically send the
|
||||
listen address specified by the OPEN routine, $FFC0, and any secondary address.
|
||||
|
||||
Possible errors are:
|
||||
|
||||
* 3 : file not open
|
||||
* 5 : device not present
|
||||
* 6 : file is not an input file
|
||||
|
||||
|
||||
$FFC9 open channel for output
|
||||
|
||||
Any logical file that has already been opened by the OPEN routine, $FFC0, can be
|
||||
defined as an output channel by this routine the device on the channel must be an
|
||||
output device or an error will occur and the routine will abort.
|
||||
|
||||
If you are sending data to anywhere other than the screen this routine must be
|
||||
called before using the CHROUT routine, $FFD2. if you are sending data to the
|
||||
screen and no other output channels are open then the calls to this routine and to
|
||||
the OPEN routine, $FFC0, are not needed.
|
||||
|
||||
When used with a device on the serial bus this routine will automatically send the
|
||||
listen address specified by the OPEN routine, $FFC0, and any secondary address.
|
||||
|
||||
Possible errors are:
|
||||
|
||||
* 3 : file not open
|
||||
* 5 : device not present
|
||||
* 7 : file is not an output file
|
||||
|
||||
|
||||
$FFCC close input and output channels
|
||||
|
||||
This routine is called to clear all open channels and restore the I/O channels to
|
||||
their original default values. It is usually called after opening other I/O
|
||||
channels and using them for input/output operations. The default input device is
|
||||
0, the keyboard. The default output device is 3, the screen.
|
||||
|
||||
If one of the channels to be closed is to the serial port, an UNTALK signal is sent
|
||||
first to clear the input channel or an UNLISTEN is sent to clear the output channel.
|
||||
By not calling this routine and leaving listener(s) active on the serial bus,
|
||||
several devices can receive the same data from the VIC at the same time. One way to
|
||||
take advantage of this would be to command the printer to TALK and the disk to
|
||||
LISTEN. This would allow direct printing of a disk file.
|
||||
|
||||
|
||||
$FFCF input character from channel
|
||||
|
||||
This routine will get a byte of data from the channel already set up as the input
|
||||
channel by the CHKIN routine, $FFC6.
|
||||
|
||||
If CHKIN, $FFC6, has not been used to define another input channel the data is
|
||||
expected to be from the keyboard. the data byte is returned in the accumulator. the
|
||||
channel remains open after the call.
|
||||
|
||||
Input from the keyboard is handled in a special way. first, the cursor is turned on
|
||||
and it will blink until a carriage return is typed on the keyboard. all characters
|
||||
on the logical line, up to 80 characters, will be stored in the BASIC input buffer.
|
||||
then the characters can be returned one at a time by calling this routine once for
|
||||
each character. when the carriage return is returned the entire line has been
|
||||
processed. the next time this routine is called the whole process begins again.
|
||||
|
||||
|
||||
$FFD2 output character to channel
|
||||
|
||||
This routine will output a character to an already opened channel. Use the OPEN
|
||||
routine, $FFC0, and the CHKOUT routine, $FFC9, to set up the output channel
|
||||
before calling this routine. If these calls are omitted, data will be sent to the
|
||||
default output device, device 3, the screen. The data byte to be output is loaded
|
||||
into the accumulator, and this routine is called. The data is then sent to the
|
||||
specified output device. The channel is left open after the call.
|
||||
|
||||
NOTE: Care must be taken when using routine to send data to a serial device since
|
||||
data will be sent to all open output channels on the bus. Unless this is desired,
|
||||
all open output channels on the serial bus other than the actually intended
|
||||
destination channel must be closed by a call to the KERNAL close channel routine.
|
||||
|
||||
|
||||
$FFD5 load RAM from a device
|
||||
|
||||
This routine will load data bytes from any input device directly into the memory
|
||||
of the computer. It can also be used for a verify operation comparing data from a
|
||||
device with the data already in memory, leaving the data stored in RAM unchanged.
|
||||
|
||||
The accumulator must be set to 0 for a load operation or 1 for a verify. If the
|
||||
input device was OPENed with a secondary address of 0 the header information from
|
||||
device will be ignored. In this case XY must contain the starting address for the
|
||||
load. If the device was addressed with a secondary address of 1 or 2 the data will
|
||||
load into memory starting at the location specified by the header. This routine
|
||||
returns the address of the highest RAM location which was loaded.
|
||||
|
||||
Before this routine can be called, the SETLFS, $FFBA, and SETNAM, $FFBD,
|
||||
routines must be called.
|
||||
|
||||
|
||||
$FFD8 save RAM to a device
|
||||
|
||||
This routine saves a section of memory. Memory is saved from an indirect address
|
||||
on page 0 specified by A, to the address stored in XY, to a logical file. The
|
||||
SETLFS, $FFBA, and SETNAM, $FFBD, routines must be used before calling this
|
||||
routine. However, a file name is not required to SAVE to device 1, the cassette.
|
||||
Any attempt to save to other devices without using a file name results in an error.
|
||||
|
||||
NOTE: device 0, the keyboard, and device 3, the screen, cannot be SAVEd to. If
|
||||
the attempt is made, an error will occur, and the SAVE stopped.
|
||||
|
||||
|
||||
$FFDB set the real time clock
|
||||
|
||||
The system clock is maintained by an interrupt routine that updates the clock
|
||||
every 1/60th of a second. The clock is three bytes long which gives the capability
|
||||
to count from zero up to 5,184,000 jiffies - 24 hours plus one jiffy. At that point
|
||||
the clock resets to zero. Before calling this routine to set the clock the new time,
|
||||
in jiffies, should be in YXA, the accumulator containing the most significant byte.
|
||||
|
||||
|
||||
$FFDE read the real time clock
|
||||
|
||||
This routine returns the time, in jiffies, in AXY. The accumulator contains the
|
||||
most significant byte.
|
||||
|
||||
|
||||
$FFE1 scan the stop key
|
||||
|
||||
If the STOP key on the keyboard is pressed when this routine is called the Z flag
|
||||
will be set. All other flags remain unchanged. If the STOP key is not pressed then
|
||||
the accumulator will contain a byte representing the last row of the keyboard scan.
|
||||
|
||||
The user can also check for certain other keys this way.
|
||||
|
||||
|
||||
$FFE4 get character from input device
|
||||
|
||||
In practice this routine operates identically to the CHRIN routine, $FFCF,
|
||||
for all devices except for the keyboard. If the keyboard is the current input
|
||||
device this routine will get one character from the keyboard buffer. It depends
|
||||
on the IRQ routine to read the keyboard and put characters into the buffer.
|
||||
|
||||
If the keyboard buffer is empty the value returned in the accumulator will be zero.
|
||||
|
||||
|
||||
$FFE7 close all channels and files
|
||||
|
||||
This routine closes all open files. When this routine is called, the pointers into
|
||||
the open file table are reset, closing all files. Also the routine automatically
|
||||
resets the I/O channels.
|
||||
|
||||
|
||||
$FFEA increment real time clock
|
||||
|
||||
This routine updates the system clock. Normally this routine is called by the
|
||||
normal KERNAL interrupt routine every 1/60th of a second. If the user program
|
||||
processes its own interrupts this routine must be called to update the time. Also,
|
||||
the STOP key routine must be called if the stop key is to remain functional.
|
||||
|
||||
|
||||
$FFED return X,Y organization of screen
|
||||
|
||||
This routine returns the x,y organisation of the screen in X,Y
|
||||
|
||||
|
||||
$FFF0 read/set X,Y cursor position
|
||||
|
||||
This routine, when called with the carry flag set, loads the current position of
|
||||
the cursor on the screen into the X and Y registers. X is the column number of
|
||||
the cursor location and Y is the row number of the cursor. A call with the carry
|
||||
bit clear moves the cursor to the position determined by the X and Y registers.
|
||||
|
||||
|
||||
$FFF3 return the base address of the I/O devices
|
||||
|
||||
This routine will set XY to the address of the memory section where the memory
|
||||
mapped I/O devices are located. This address can then be used with an offset to
|
||||
access the memory mapped I/O devices in the computer.
|
||||
|
||||
438
kernal/kernal_mapc64.txt
Normal file
438
kernal/kernal_mapc64.txt
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
$FF81 CINT Initialize Screen Editor and VIC-II Chip
|
||||
|
||||
The start of the routine appears to be a patch that was added to later
|
||||
versions of the Kernal. It first calls the old routine at 58648
|
||||
($E518). This initializes the VIC-II chip to the default values, sets
|
||||
the keyboard as the input device and the screen as the output device,
|
||||
initializes the cursor flash variables, builds the screen line link
|
||||
table, clears the screen, and homes the cursor. The new code then
|
||||
checks the VIC Interrupt register to see if the conditions for a
|
||||
Raster Compare IRQ have been fulfilled. Since the Raster Register was
|
||||
initialized to 311, that can only occur when using a PAL system (NTSC
|
||||
screens do not have that many scan lines). The PAL/NTSC register at
|
||||
678 ($2A6) is set on the basis of the outcome of this test. The CIA
|
||||
#1 Timer A is then set to cause an IRQ interrupt every sixtieth of a
|
||||
second, using the prescaler figures for a PAL or NTSC system, as
|
||||
appropriate.
|
||||
|
||||
$FF84 IOINIT Initialize CIA I/O Devices
|
||||
|
||||
This routine intializes the Complex Interface Adapter (CIA)
|
||||
devices, and turns the volume of the SID chip off. As part of this
|
||||
initialization, it sets CIA #1 Timer A to cause an IRQ interrupt every
|
||||
sixtieth of a second.
|
||||
|
||||
$FF87 RAMTAS Perform RAM Test and Set Pointers to the Top and Bottom of RAM
|
||||
|
||||
This routine performs a number of initialization tasks.
|
||||
|
||||
First, it clears Pages 0, 2, and 3 of memory to zeros. Next, it sets
|
||||
the tape buffer pointer to address 828 ($33C), and performs a
|
||||
nondestructive test of RAM from 1024 ($400) up. When it reaches a
|
||||
non-RAM address (presumably the BASIC ROM at 40960 ($A000)), that
|
||||
address is placed in the top of memory pointer at 643-4 ($283-4). The
|
||||
bottom of memory pointer at 641-2 ($281-2) is set to point to address
|
||||
2048 ($800), which is the beginning of BASIC program text. Finally,
|
||||
the pointer to screen memory at 648 ($288) is set to 4, which lets the
|
||||
Operating System know that screen memory starts at 1024 ($400).
|
||||
|
||||
$FF8A RESTOR Restore RAM Vectors for Default I/O Routines
|
||||
|
||||
This routine sets the values for the 16 RAM vectors to the interrupt and
|
||||
important Kernal I/O routines in the table that starts at 788 ($314)
|
||||
to the standard values held in the ROM table at 64816 ($FD30).
|
||||
|
||||
$FF8D VECTOR Set the RAM Vector Table from the Table Pointed to by .X and .Y
|
||||
|
||||
This routine is used to read or change the values for the 16 RAM vectors to the
|
||||
interrupt and important Kernal I/O routines in the table that starts
|
||||
at 788 ($314). If the Carry flag is set when the routine is called,
|
||||
the current value of the 16 vectors will be stored at a table whose
|
||||
address is pointed to by the values in the .X and .Y registers. If
|
||||
the Carry flag is cleared, the RAM vectors will be loaded from the
|
||||
table whose address is pointed to by the .X and .Y registers. Since
|
||||
this routine can change the vectors for the IRQ and NMI interrupts,
|
||||
you might expect that the Interrupt disable flag would be set at its
|
||||
beginning. Such is not the case, however, and therefore it would be
|
||||
wise to execute an SEI before calling it and a CLI afterwards (as the
|
||||
power-on RESET routine does) just to be safe.
|
||||
|
||||
$FF90 SETMSG Set the Message Control Flag
|
||||
|
||||
This routine controls the printing of error messages and control
|
||||
messages by the Kernal. It Bit 6 is seto to 1 (bit value of 64),
|
||||
Kernal control messages can be printed. These messages include
|
||||
SEARCHING FOR, LOADING, and the like. If Bit 6 is cleared to 0, these
|
||||
messages will not be printed (BASIC will clear this bit when a program
|
||||
is running so that the messages do not appear when I/O is performed
|
||||
from a program). Setting Bit 6 will not suppress the PRESS PLAY ON
|
||||
TAPE or PRESS PLAY & RECORD messages, however.
|
||||
|
||||
If Bit 7 is set to 1 (bit value of 128), Kernal error messages can be
|
||||
printed. If Bit 7 is set to 0, those error messages (for example, I/O
|
||||
ERROR #nn) will be suppressed. Note that BASIC has its own set of
|
||||
error messages (such as FILE NOT FOUND ERROR) which it uses in
|
||||
preference to the Kernal's message.
|
||||
|
||||
$FF93 SECOND Send a Secondary Address to a Device on the Serial Bus after LISTEN
|
||||
|
||||
This routine sends a secondary address from the
|
||||
Accumulator to the device on the serial bus that has just been
|
||||
commanded to LISTEN. This is usually done to give the device more
|
||||
particular instructions on how the I/O is to be carried out before
|
||||
information is sent.
|
||||
|
||||
$FF96 TKSA Send a Secondary Address to a Device on the Serial Bus after TALK
|
||||
|
||||
This routine sends a secondary address from the
|
||||
Accumulator to the device on the serial bus that has just been
|
||||
commanded to TALK. This is usually done to give the device more
|
||||
particular instructions on how the I/O is to be carried out before
|
||||
information is sent.
|
||||
|
||||
$FF99 MEMTOP Read/Set Top of RAM Pointer
|
||||
|
||||
This routine can be used to either read or set the top of RAM pointer. If
|
||||
called with the Carry flag set, the address in the pointer will be
|
||||
loaded into the .X and .Y registers. If called with the Carry flag
|
||||
cleared, the pointer will be changed to the address found in the .X
|
||||
and .Y registers.
|
||||
|
||||
$FF9C MEMBOT Read/Set Bottom of RAM Pointer
|
||||
|
||||
This routine can be used to either read or set the bottom of RAM pointer. If
|
||||
called with the Carry flag set, the address in the pointer willbe
|
||||
loaded into the .X and .Y registers. If called with the Carry flag
|
||||
cleared, the pointer will be changed to the address found in the .X
|
||||
and .Y registers.
|
||||
|
||||
$FF9F SCNKEY Read the Keyboard
|
||||
|
||||
This subroutine is called by the IRQ interrupt handler above to read
|
||||
the keyboard device which is connected to CIA #1 (see entry for 56320
|
||||
($DC00) for details on how to read the keyboard).
|
||||
|
||||
This routine returns the keycode of the key
|
||||
currently being pressed in 203 ($CB), sets the shift/control flag if
|
||||
appropriate, and jumps through the vector at 655 ($28F) to the routine
|
||||
that sets up the proper table to translate the keycode to PETASCII.
|
||||
It concludes with the next routine, which places the PETASCII value of
|
||||
the character in the keyboard buffer.
|
||||
|
||||
$FFA2 SETTMO Set Time-Out Flag for IEEE Bus
|
||||
|
||||
This routine sets the time-out flag for the IEEE bus. When timeouts
|
||||
are enabled, the Commodore will wait for a device for 64 milliseconds,
|
||||
and if it does not receive a response to its signal it will issue a
|
||||
time-out error. Loading the Accumulator with a value less than 128
|
||||
and calling this routine will enable time-outs, while using a value
|
||||
over 128 will disable time-outs.
|
||||
|
||||
This routine is for use only with the Commodore IEEE add-on card,
|
||||
which at the time of this writing was not yet available.
|
||||
|
||||
$FFA5 ACPTR Receive a Byte of Data from a Device on the Serial Bus
|
||||
|
||||
When called, this routine will get a byte of data from
|
||||
the current TALKer on the serial bus and store it in the Accumulator.
|
||||
In order to receive the data, the device must have previously been
|
||||
sent a command to TALK and a secondary address if it needs one.
|
||||
|
||||
$FFA8 CIOUT Send a Byte to an I/O Device over the Serial Bus
|
||||
|
||||
This routine's purpose is to send a byte of data over
|
||||
the serial bus. In order for the data to be received, the serial
|
||||
device must have first been commanded to LISTEN and been given a
|
||||
secondary address if necessary. This routine always buffers the
|
||||
current character, and defers sending it until the next byte is
|
||||
buffered. When the UNLISTEN command is sent, the last byte will be
|
||||
sent with an End or Identify (EOI).
|
||||
|
||||
$FFAB UNTLK Send UNTALK to a Device on the Serial Bus
|
||||
|
||||
When called, this routine sends the UNTALK code (95, $5F) on the
|
||||
serial bus. This commands any TALKer on the bus to stop sending data.
|
||||
|
||||
$FFAE UNLSN Send UNLISTED to a Device on the Serial Bus
|
||||
|
||||
This routine sends the UNLISTEN code (63, $3F) on the serial
|
||||
bus. This commands any LISTENers to get off the serial bus, and frees
|
||||
up the bus for other users.
|
||||
|
||||
$FFB1 LISTEN Send LISTEN to a Device on the Serial Bus
|
||||
|
||||
When called, this routine ORs the device number in the
|
||||
Accumulator with the LISTEN code (32, $20) and sends it on the serial
|
||||
bus. This commands the device to LISTEN.
|
||||
|
||||
$FFB4 TALK Send TALK to a Device on the Serial Bus
|
||||
|
||||
When called, this routine ORs the device number in the
|
||||
Accumulator with the TALK code (64, $40) and sends it on the serial
|
||||
bus. This commands the device to TALK.
|
||||
|
||||
$FFB7 READST Read the I/O Status Word
|
||||
|
||||
Whenever an I/O error occurs, a bit of the Status Word is set to
|
||||
indicate what the problem was. This routine allows you to read the
|
||||
status word (it is returned in the Accumulator). If the device was
|
||||
the RS-232, its status register is read and cleared to zero. For the
|
||||
meanings of the various status codes, see the entry for location 144
|
||||
($90) or 663 ($297) for the RS-232 device.
|
||||
|
||||
$FFBA SETLFS Set Logical File Number, Device Number, and Secondary Address
|
||||
|
||||
This routine stores the value in the Accumulator in the location which holds the
|
||||
current logical file number, the value in the .X register is put in
|
||||
the location that holds the current device number, and the value in
|
||||
the .Y register is stored in the location that holds the current
|
||||
secondary address. If no secondary address is used, the .Y register
|
||||
should be set to 255 ($FF). It is necessary to set the values of the
|
||||
current file number, device number, and secondary address before you
|
||||
OPEN a file, or LOAD or SAVE.
|
||||
|
||||
$FFBD SETNAM Set Filename Parameters
|
||||
|
||||
This routine puts the value in the Accumulator into the location which stores
|
||||
the number of characters in the filename, and sets the pointer to the
|
||||
address of the ASCII text of the filename from the .X and .Y
|
||||
registers. This sets up the filename for the OPEN, LOAD, or SAVE
|
||||
routine.
|
||||
|
||||
$FFC0 OPEN Open a Logical I/O File
|
||||
|
||||
The routine jumps through a RAM vector at 794 ($31A). This routine
|
||||
assigns a logical file to a device, so that it can be used for
|
||||
Input/Output operations. In order to specify the logical file number,
|
||||
the device number, and the secondary address if any, the SETLFS
|
||||
routine must first be called. Likewise, in order to designate the
|
||||
filename, the SETNAM routine must be used first. After these two
|
||||
routines are called, OPEN is then called.
|
||||
|
||||
$FFC3 CLOSE Close a Logical I/O File
|
||||
|
||||
The routine jumps through a RAM vector at 796 ($31C). It is used to
|
||||
close a logical file after all I/O operations involving that file have
|
||||
been completed. This is accomplished by loading the Accumulator with
|
||||
the logical file number of the file to be closed, and calling this
|
||||
routine.
|
||||
|
||||
Closing an RS-232 file will de-allocate space at the top of memory for
|
||||
the receiving and trasmit buffers. Closing a cassette file that was
|
||||
opened for writing will force the last block to be written to
|
||||
cassette, even if it is not a full 192 bytes. Closing a serial bus
|
||||
device will send an UNLISTEN command on the bus. Remember, it is
|
||||
necessary to properly CLOSE a cassette or disk data file in order to
|
||||
retrieve the file later.
|
||||
|
||||
For all types of files, CLOSE removes the file's entry from the tables
|
||||
of logical files, device, and secondary address at 601, 611, and 621
|
||||
($259, $263, $26D), and moves all higher entries in the table down one
|
||||
space.
|
||||
|
||||
$FFC6 CHKIN Designate a Logical File As the Current Input Channel
|
||||
|
||||
The routine jumps through a RAM vector at 798 ($31E). If you wish to
|
||||
get data from any device other than the keyboard, this routine must be
|
||||
called after OPENing the device, before you can get a data byte with
|
||||
the CHRIN or GETIN routine. When called, the routine will designate
|
||||
the logical file whose file number is in the .X register as the
|
||||
current file, its device as the current device, and its secondary
|
||||
address as the current secondary address. If the device on the
|
||||
channel is a serial device, which requires a TALK command and
|
||||
sometimes a secondary address, this routine will send them over the
|
||||
serial bus.
|
||||
|
||||
$FFC9 CHKOUT Designate a Logical File As the Current Output Channel
|
||||
|
||||
The routine jumps through a RAM vector at 800 ($320). If you wish to
|
||||
output data to any device other than the screen, this routine must be
|
||||
called after OPENing the device, and before you output a data byte
|
||||
with the CHROUT routine. When called, the routine will designate the
|
||||
logical file whose file number is in the .X register as the current
|
||||
file, its device as the current device, and its secondary address as
|
||||
the current secondary address. If the device on the channel uses the
|
||||
serial bus, and therefore requires a LISTEN command and possibly a
|
||||
secondary address, this information will be sent on the bus.
|
||||
|
||||
$FFCC CLRCHN Restore Current Input and Output Devices to the Default Devices
|
||||
|
||||
The routine jumps through a RAM vector at 802 ($322). It sets the
|
||||
current input device to the keyboard, and the current output device to
|
||||
the screen. Also, if the current input device was formerly a serial
|
||||
device, the routine sends it an UNTALK command on the serial bus, and
|
||||
if a serial device was formerly the current output device, the routine
|
||||
sends it an UNLISTEN command.
|
||||
|
||||
$FFCF CHRIN Input a Character from the Current Device
|
||||
|
||||
The routine jumps through a RAM vector at 804 ($324). Its function is
|
||||
to get a character from the current input device (whose device number
|
||||
is stored at 153 ($99)). This device must first have been OPENed and
|
||||
then designated as the input channel by the CHKIN routine.
|
||||
|
||||
When this routine is called, the next byte of data available from this
|
||||
device is returned in the Accumulator. The only exception is the
|
||||
routine for the keyboard device (which is the default input device).
|
||||
It the keyboard is the current input device, this routine blinks the
|
||||
cursor, fetches characters from the keyboard buffer, and echoes them
|
||||
to the screen until a carriage return is encountered. When a carriage
|
||||
return is round, the routine sets a flag to indicate the length of the
|
||||
last logical line before the return character, and reads the first
|
||||
character of this logical line from the screen.
|
||||
|
||||
Subsequent calls to this routine will cause the next character in the
|
||||
line to be read from the screen and returned in the Accumulator, until
|
||||
the carriage return character is returned to indicate the end of the
|
||||
line. Any call after this character is received will start the whole
|
||||
process over again.
|
||||
|
||||
Note that only the last logical line before the carriage return is
|
||||
used. Any time you type in more than 80 characters, a new logical
|
||||
line is started. This routine will ignore any characters on the old
|
||||
logical line, and process only the most recent 80-character group.
|
||||
|
||||
$FFD2 CHROUT Output a Byte
|
||||
|
||||
The routine jumps through a RAM vector at 806 ($326).
|
||||
It is probably one of the best known and most used Kernal routines,
|
||||
because it sends the character in the Accumulator to the current
|
||||
output device. Unless a device has been OPENed and designated as the
|
||||
current output channel using the CHKOUT routine, the character is
|
||||
printed to the screen, which is the default output device. If the
|
||||
cassette is the current device, outputting a byte will only add it to
|
||||
the buffer. No actual transmission of data will occur until the
|
||||
192-byte buffer is full.
|
||||
|
||||
$FFD5 LOAD Load RAM from a Device
|
||||
|
||||
The routine jumps through a RAM vector at 816 ($330). LOAD is used to
|
||||
transfer data froma device directly to RAM. It can also be used to
|
||||
verify RAM, comparing its contents to those of a disk or tape file.
|
||||
To choose between these operations you must set the Accumulator with a
|
||||
0 for LOAD, or a 1 for VERIFY.
|
||||
|
||||
Since the LOAD routine performs an OPEN, it must be preceded by a call
|
||||
to the SETLFS routine to specify the logical file number, device
|
||||
number, and secondary address, and a call to the SETNAM routine to
|
||||
specify the filename (a LOAD from tape can be performed without a
|
||||
filename being specified). Then the .X and .Y registers should be set
|
||||
with the starting address for the load, and the LOAD routine called.
|
||||
If the secondary address specified was a 1, this starting address will
|
||||
be ignored, and the header information will be used to supply the load
|
||||
address. If the secondary address was a 0, the address supplied by
|
||||
the call will be used. In either case, upon return from the
|
||||
subroutine, the .X and .Y registers will contain the address of the
|
||||
highest RAM location that was loaded.
|
||||
|
||||
$FFD8 SAVE Save RAM to a Device
|
||||
|
||||
The routine jumps through a RAM vector at 818 ($332). SAVE is used to
|
||||
transfer data directly from RAM to an I/O device. Since the SAVE
|
||||
routine performs an OPEN, it must be preceded by a call to the SETLFS
|
||||
routine to specify the logical file number, device number, and
|
||||
secondary address, and a call to the SETNAM routine to specify the
|
||||
filename (although a SAVE to the cassette can be performed without
|
||||
giving a filename). A Page 0 pointer to the starting address of the
|
||||
area to be saved should be set up, with the low byte of the address
|
||||
first. The accumulator should be loaded with the Page 0 offset of
|
||||
that pointer, then the .X and .Y registers should be set with the
|
||||
ending address for the save, and the SAVE routine called.
|
||||
|
||||
$FFDB SETTIM Set the Software Clock from the .A, .X, and .Y Registers
|
||||
|
||||
This routine performs the reverse operation from RDTIM, storing the value in the
|
||||
.Y register into location 160 ($A0), the .X register into 161 ($A1),
|
||||
and the Accumulator into 162 ($A2). Interrupts are first disabled, to
|
||||
make sure that the clock will not be updated while being set.
|
||||
|
||||
$FFDE RDTIM Read the Time From the Software Clock into the .A, .X, and .Y Registers
|
||||
|
||||
It reads the software clock (which counts sixtieths of a second) into
|
||||
the internal registers. The .Y register contains the most significant
|
||||
byte (from location 160 ($A0)), the .X register contains the middle
|
||||
byte (from location 161 ($A1)), and the Accumulator contains the least
|
||||
significant byte (from location 162 ($A2)).
|
||||
|
||||
$FFE1 STOP Test STOP Key
|
||||
|
||||
This routine is vectored through RAM at 808 ($328). The routine checks to see
|
||||
if the STOP key was pressed during the last UDTIM call. If it was,
|
||||
the Zero flag is set to 1, the CLRCHN routine is called to set the
|
||||
input and output devices back to the keyboard and screen, and the
|
||||
keyboard queue is emptied.
|
||||
|
||||
$FFE4 GETIN Get One Byte from the Input Device
|
||||
|
||||
The routine jumps through a RAM vector at 810 ($32A).
|
||||
Its function is to get a character from the current input device
|
||||
(whose device number is stored at 153 ($99)). In practive, it
|
||||
operates identically to the CHRIN routine below for all devices except
|
||||
for the keyboard. If the keyboard is the current input device, this
|
||||
routine gets one character from the keyboard buffer at 631 ($277). It
|
||||
depends on the IRQ interrupt routine to rad the keyboard and put
|
||||
characters into the buffer.
|
||||
|
||||
$FFE7 CLALL Close All Logical I/O Files
|
||||
|
||||
The routine jumps through a RAM vector at 812 ($32C). It closes all
|
||||
open files, by resetting the index into open files at 152 ($98) to
|
||||
zero. It then falls through to the next routine, which restores the
|
||||
default I/O devices.
|
||||
|
||||
$FFEA UDTIM Update the Software Clock and Check for the STOP Key
|
||||
|
||||
This routine is normally called by the IRQ interrupt handler once every sixtieth
|
||||
of a second. It adds one to the value in the three-byte software
|
||||
jiffy clock at 160-162 ($A0-$A2), and sets the clock back to zero when
|
||||
it reaches the 24 hour point. In addition, it scans the keyboard row
|
||||
in which the STOP key is located, and stores the current value of that
|
||||
key in location 145 ($91). This variable is used by the STOP routine
|
||||
which checks for the STOP key.
|
||||
|
||||
$FFED SCREEN Store Number of Screen Rows and Columns in .Y and .X
|
||||
|
||||
When called, this subroutine returns the number of screen columns in
|
||||
the .X register, and the number of screen rows in .Y. Thus, a program
|
||||
can detect the screen format of the machine on which it is running,
|
||||
and make sure that text output is formatted accordingly.
|
||||
|
||||
The present version of this routine loads the .X register with 40
|
||||
($28) and the .Y register with 25 ($19).
|
||||
|
||||
$FFF0 PLOT Read/Set Location of the Cursor
|
||||
|
||||
The routine allows the user to read or set the position of the cursor.
|
||||
If the carry flag is set with the SEC instruction before calling this
|
||||
subroutine, cursor column (X position) will be returned in the .X
|
||||
register, and the cursor row (Y position) will be returned in the .Y
|
||||
register. If the carry flag is cleared with a CLC instruction before
|
||||
entering this routine, and the .Y and .X registers are loaded with the
|
||||
desired row and column positions respectively, this routine will set
|
||||
the cursor position accordingly.
|
||||
|
||||
The current read routine loads .X and .Y from locations 214 ($D6) and
|
||||
211 ($D3) respectively. The cursor set routine stores .X and .Y in
|
||||
these locations, and calls the routine that sets the screen pointers
|
||||
at 58732 ($E56C).
|
||||
|
||||
The user can access this routine from BASIC by loading the .X, .Y, and
|
||||
.P register values desired to the save area starting at 780 ($30C).
|
||||
|
||||
$FFF3 IOBASE Store Base Address of Memory-Mapped I/O Devices in .X and .Y Registers
|
||||
|
||||
When called, this routine sets the .X register to the low byte of the
|
||||
base address of the memory-mapped I/O devices, and puts the high byte
|
||||
in the .Y register. This allows a user to set up a zero-page pointer
|
||||
to the device, and to load and store indirectly through that pointer.
|
||||
A program which uses this method, rather than directly accessing such
|
||||
devices could be made to function without change on future Commodore
|
||||
models, even though the I/O chips may be addressed at different
|
||||
locations. This of course assumes that the CIA or a similar chip will
|
||||
be used. This routine is of limited value for creating software that
|
||||
is compatible with both the VIC-20 and the 64 because of the
|
||||
differences in the VIA I/O chip that the VIC uses.
|
||||
|
||||
The current version of this routine loads the .X register with a 0,
|
||||
and the .Y register with 220 ($DC), thus pointing to CIA #1, which is
|
||||
at 56320 ($DC00).
|
||||
939
kernal/kernal_mlr.txt
Normal file
939
kernal/kernal_mlr.txt
Normal file
|
|
@ -0,0 +1,939 @@
|
|||
-
|
||||
- Heimarck, Todd D; Parrish, Patrick:
|
||||
- Machine language routines for the Commodore 64 and 128
|
||||
-
|
||||
|
||||
$FFA5 ACPTR
|
||||
|
||||
This low-level I/O routine retrieves a byte from a serial device
|
||||
without checking for a previous I/O error. If the operation is
|
||||
successful, the accumulator will hold the byte received from
|
||||
the device. The contents of .X and .Y are preserved. The suc-
|
||||
cess of the operation will be indicated by the value in the se-
|
||||
rial status flag upon return. (See READST for details.)
|
||||
|
||||
For the routine to function properly, the serial device
|
||||
must currently be a talker on the serial bus, which requires a
|
||||
number of setup steps. Generally, it's preferable to use the
|
||||
higher-level CHRFN routine instead.
|
||||
|
||||
$FFC6 CHKIN
|
||||
|
||||
This routine specifies a logical file as the source of input in
|
||||
preparation for using the CHRIN or GETIN routines. The logi-
|
||||
cal file should be opened before this routine is called. (See the
|
||||
OPEN routine.) The desired logical file number should be in
|
||||
.X when this routine is called. The contents of .Y are un-
|
||||
affected, but the accumulator value will be changed.
|
||||
|
||||
The routine sets the input channel (location $99) to the
|
||||
device number for the specified file. If the device is RS-232
|
||||
(device number 2), the CTA #2 interrupts for RS-232 reception
|
||||
are enabled. Ef a serial device (device number 4 or greater) was
|
||||
specified, the device is made a talker on the serial bus,
|
||||
|
||||
If the file is successfully set for input, the status-register
|
||||
carry bit will be clear upon return. If carry is set, the operation
|
||||
was unsuccessful and the accumulator will contain a Kernal
|
||||
error-code value indicating which error occurred. Possible er-
|
||||
ror codes include 3 (fiLe was not open), 5 (device did not re-
|
||||
spond), and 6 (file was not opened for input). The RS-232 and
|
||||
serial status-flag locations also reflect the success of operations
|
||||
for those devices. (See READST for details.)
|
||||
|
||||
The JMP to the CEDGN execution routine is by way of the
|
||||
ICHKDN indirect vector at 798-799 ($031E-$031F). You can
|
||||
modify the actions of CHfQN by changing the vector to point
|
||||
to a routine of your own.
|
||||
|
||||
$FFC9 CHKOUT
|
||||
|
||||
This routine (some Commodore references call it CKOUT)
|
||||
specifies a logical file as the recipient of output in preparation
|
||||
for using the CHROUT routine. The logical file should be
|
||||
opened before this routine is called. (See the OPEN routine.)
|
||||
The desired logical file number should be in .X when this rou-
|
||||
tine is called. The contents of .Y are unaffected, but the accu-
|
||||
mulator will be changed.
|
||||
|
||||
The routine sets the output channel (location $9A) to the
|
||||
device number for the specified file. If the device is RS-232
|
||||
(device number 2), the routine also enables the CLA #2 inter-
|
||||
rupts for RS-232 transmission. fi a serial device (device num-
|
||||
ber 4 or greater) is specified, the device is also made a listener
|
||||
on the serial bus.
|
||||
|
||||
If the file is successfully set for output, the status-register
|
||||
carry bit will be clear upon return. If the carry is set, the op-
|
||||
eration was unsuccessful, and the accumulator will contain a
|
||||
Kernal error-code value indicating which error occurred. Pos-
|
||||
sible error codes include 3 (file was not open), 5 (device did
|
||||
not respond), and 7 (file was not opened for output). The RS-
|
||||
232 and serial status-flag locations also reflect the success of
|
||||
operations for those devices. (See READST for details.)
|
||||
|
||||
The JMP to the CHKOUT execution routine is by way of
|
||||
the ICKOUT indirect vector at $0320-$0321. You can modify
|
||||
the actions of the routine by changing the vector to point to a
|
||||
routine of your own.
|
||||
|
||||
$FFCF CHRIN
|
||||
|
||||
This high-level I/O routine (some Commodore references may
|
||||
call it BASIN) receives a byte from the logical file currently
|
||||
specified for input (to change the default input device, see
|
||||
CHKIN above). Except to use the routine to retrieve input
|
||||
from the keyboard when the system is set for default I/O, you
|
||||
must open a logical file to the desired device and specify the
|
||||
file as the input source before calling this routine. (See the
|
||||
OPEN and CHKIN routines.)
|
||||
|
||||
For keyboard input (device 0), the routine accepts
|
||||
keypresses until RETURN is pressed, and then returns charac-
|
||||
ters from the input string one at a time on each subsequent
|
||||
call. The character code for RETURN, 13, is returned when the
|
||||
end of an input string is reached. (The Kernal GETIN routine
|
||||
is better for retrieving individual keypresses.)
|
||||
|
||||
For tape (device 1), the routine retrieves the next character
|
||||
from the cassette buffer. If all characters have been read from
|
||||
the buffer, the next data block is read from tape into the
|
||||
buffer.
|
||||
|
||||
For RS-232 (device 2), the routine returns the next avail-
|
||||
able character from the RS-232 input buffer. If the buffer is
|
||||
empty, the routine waits until a character is received—unless
|
||||
the RS-232 status flag indicates that the DSR signal from the
|
||||
external device is missing, in which case a RETURN character
|
||||
code, 13, is returned.
|
||||
|
||||
CHRIN from the screen (device 3) retrieves characters one
|
||||
at a time from the current screen line, ending with a RETURN
|
||||
character code when the last nonspace character on the logical
|
||||
line is reached. (Note that CHRIN from the screen does not
|
||||
work properly in the original version of the 128 Kernal.) For
|
||||
serial devices (device numbers 4 and higher), the routine re-
|
||||
turns the next available character from the serial bus, unless
|
||||
the serial status flag contains a nonzero value. In that case, the
|
||||
RETURN character code is returned.
|
||||
|
||||
For all input devices, the received byte will be in the
|
||||
accumulator upon return. The contents of .X and .Y are pre-
|
||||
served during input from the keyboard, screen, or RS-232. For
|
||||
input from tape, only .X is preserved. For input from serial de-
|
||||
vices, only .Y is preserved. For input from the screen, key-
|
||||
board, or serial devices, the status-register carry bit will always
|
||||
be clear upon return. For tape input, the carry bit will be clear
|
||||
unless the operation was aborted by pressing the RUN/STOP
|
||||
key. For tape, serial, or RS-232 input, the success of the opera-
|
||||
tion will be indicated by the value in the status-flag location.
|
||||
(See the entry for READST.) The RS-232 portion of the orig-
|
||||
inal 128 version of CHRRsJ has a bug: The carry bit will be set
|
||||
if a byte was successfully received, and will be clear only if
|
||||
the DSR signal is missing—the opposite of the settings for the
|
||||
64. It's better to judge the success of an RS-232 operation by
|
||||
the value in the status-flag location rather than by the carry-
|
||||
bit setting. (See the READST routine.)
|
||||
|
||||
TheJMP to the CHREN execution routine is by way of the
|
||||
ICHRfN indirect vector at $0324-$0325. You can modify the
|
||||
actions of the routine by changing the vector to point to a rou-
|
||||
tine of your own.
|
||||
|
||||
$FFD2 CHROUT
|
||||
|
||||
This routine (some Commodore references call it BSOUT)
|
||||
sends a byte to the logical file currently specified for output.
|
||||
Except to send output to the screen when the system is set for
|
||||
default I/O, you must open a logical file to the desired device
|
||||
and specify the file as the output target before calling this rou-
|
||||
tine. (See the OPEN and CHKOUT routines.)
|
||||
|
||||
For output to tape (device 1), the character is stored at the
|
||||
next available position in the cassette buffer. When the buffer
|
||||
is full, the data block is written to tape.
|
||||
|
||||
For output to RS-232 (device 2), the character is stored in
|
||||
the next available position in the RS-232 output buffer, if the
|
||||
buffer is full, the routine waits until a character is sent.
|
||||
|
||||
For output to the screen (device 3), the character is
|
||||
printed at the current cursor position. For serial devices (device
|
||||
numbers 4 and higher), the CIOUT routine is called.
|
||||
|
||||
Regardless of the output device, the contents of the accu-
|
||||
mulator, .X, and .Y are preserved during this routine. The
|
||||
status-register carry bit will always be clear upon return, un-
|
||||
less output to tape is aborted by pressing the RUN/STOP key.
|
||||
(In that case, the accumulator will also be set to 0, setting the
|
||||
status-register Z bit as well.) For tape, serial, or RS-232 output,
|
||||
the success of the operation will be indicated by the value in
|
||||
the status flag. (See READST for details.)
|
||||
|
||||
The JMP to the CHROUT execution routine is by way of
|
||||
the ICHROUT indirect vector at $0326-$0327. You can modify
|
||||
the actions of the routine by changing the vector to point to a
|
||||
routine of your own.
|
||||
|
||||
$FF81 CINT
|
||||
|
||||
This routine initializes all RAM locations used by the screen
|
||||
editor, returning screen memory to its default position and set-
|
||||
ting default screen and border colors. The routine also clears
|
||||
the screen and homes the cursor. All processor registers are
|
||||
affected.
|
||||
|
||||
For the 64 only, this routine initializes all VIC chip reg-
|
||||
isters to their default values (that's done during the Kernal
|
||||
IOINIT routine in the 128). For the 128, CINT clears both dis-
|
||||
plays and redirects printing to the display indicated by the po-
|
||||
sition of the 40/80 DISPLAY key. The 128 routine also sets
|
||||
SID volume to zero and resets programmable function keys to
|
||||
their default definitions. It does not, however, reinitialize the
|
||||
80-column character set. (That's also part of IOINIT.)
|
||||
|
||||
$FFA8 CIOUT
|
||||
|
||||
This low-level I/O routine sends a byte to a serial device. The
|
||||
accumulator should hold the byte to be sent. All register val-
|
||||
ues are preserved. The success of the operation will be in-
|
||||
dicated by the value in the serial status flag. (See READST for
|
||||
details.)
|
||||
|
||||
For the routine to function properly, the target serial de-
|
||||
vice must currently he a listener on the serial bus, which re-
|
||||
quires a number of setup steps. However, if you have already
|
||||
performed all the preparatory steps necessary for CHROUT to
|
||||
a serial device, then you can freely substitute CIOUT for
|
||||
CHROUT, since, for a serial device, CHROUT simply jumps to
|
||||
the CIOUT routine.
|
||||
|
||||
$FFE7 CLALL
|
||||
|
||||
This routine resets the number of open files (location $98) to
|
||||
zero, then falls through into the CLRCH routine to reset de-
|
||||
fault t/O. The contents of .A and .X are changed, but .Y is
|
||||
unaffected.
|
||||
|
||||
Despite its name, the routine doesn't actually close any
|
||||
files that may be open to tape, disk, or RS-232 devices. Un-
|
||||
closed files may cause problems, particularly on disks, so this
|
||||
routine is of limited usefulness. The 128 Kernal provides an
|
||||
alternate routine that does properly close all files open to a se-
|
||||
rial device. (See CLOSE_ALL.)
|
||||
|
||||
The JMP to the CLALL execution routine is by way of the
|
||||
JCLALL indirect vector at $032C-$032D. You can modify the
|
||||
actions of the routine by changing the vector to point to a rou-
|
||||
tine of your own.
|
||||
|
||||
$FFC3 CLOSE
|
||||
|
||||
This routine closes a specified logical file. Call the routine with
|
||||
the accumulator holding the number of the logical file to be
|
||||
closed. If no file with the specified logical file number is cur-
|
||||
rently open, no action is taken and no error is indicated. If a
|
||||
file with the specified number is open, its entry in the logical
|
||||
file number, device number, and secondary address tables will
|
||||
be removed. For RS-232 files, the driving CLA #2 interrupts will
|
||||
also be disabled. For tape files, the final block of data will be
|
||||
written to tape (followed by an end-of-tape marker, if one was
|
||||
specified). For disk files, the EOI sequence will be performed.
|
||||
|
||||
The 128 version of the routine offers a special close func-
|
||||
tion for disk files: Ff this routine is called with the status-
|
||||
register carry bit set, and if the device number for the file is 8
|
||||
or greater, and if the file was opened with a secondary address
|
||||
of 15, then the EOI sequence is skipped. (The table entries for
|
||||
the file are deleted, but that's all.) This solves a problem in
|
||||
earlier versions of the Kernal for disk files opened with a
|
||||
secondary address of 15, the command channel to the drive.
|
||||
An attempt to close the command channel will result in an
|
||||
EOI sequence that closes all files currently open to the drive,
|
||||
not just the command-channel file, This special mode allows
|
||||
the command-channel file to be closed without disturbing
|
||||
other files that may be open to the drive.
|
||||
|
||||
The JMP to the CLOSE execution routine is by way of the
|
||||
ICLOSE indirect vector at $031C-$031D. You can modify the
|
||||
actions of the routine by changing the vector to point to a rou-
|
||||
tine of your own.
|
||||
|
||||
$FFCC CLRCHN
|
||||
|
||||
This routine restores the default I/O sources for the operating
|
||||
system. The output channel (location $9A) is reset to device 3,
|
||||
the video display. (If the previous output channel was a serial
|
||||
device, it is sent an UNLISTEN command.) The input channel
|
||||
(location $99) is reset to device 0, the keyboard, (if the pre-
|
||||
vious input channel was a serial device, it is sent an UNTALK
|
||||
command.) The contents of .X and .A are changed, but .Y is
|
||||
unaffected.
|
||||
|
||||
The JMP to the CLRCHN execution routine is by way of
|
||||
the lCLRCH indirect vector at $0322-$0323. You can modify
|
||||
the actions of the routine by changing the vector to point to a
|
||||
routine of your own.
|
||||
|
||||
$FFE4 GETIN
|
||||
|
||||
This routine retrieves a single character from the current input
|
||||
device. The routine first checks to see whether the input de-
|
||||
vice number is 0 (keyboard) or 2 (RS-232). If it's not either of
|
||||
these, the Kernal CHRIN routine is called instead. For key-
|
||||
board or RS-232, the retrieved character will be in the accu-
|
||||
mulator upon return, and the status-register carry bit wall be
|
||||
clear. If no character is available, the accumulator will contain
|
||||
0. (CHREM, by contrast, will wait for a character.) The contents
|
||||
of .Y are unaffected, but .X will be changed. For RS-232, bit 3
|
||||
of the status flag will also be set if no characters are available.
|
||||
(See READST for details.)
|
||||
|
||||
The JMP to the GETIN execution routine is by way of the
|
||||
IGETIN indirect vector at $032A-$032B. You can modify the
|
||||
actions of the routine by changing the vector to point to a rou-
|
||||
tine of your own.
|
||||
|
||||
$FFF3 IOBASE
|
||||
|
||||
This routine returns a constant 1/0 chip base-address value in
|
||||
.X (low byte) and .Y (high byte). The accumulator is un-
|
||||
affected. For the 64, the value returned is $DCOO—the address
|
||||
of CLA #1. For the 128, the value is $D000—the address of
|
||||
the VIC chip.
|
||||
|
||||
$FF84 IOINIT
|
||||
|
||||
This routine initializes the CIA chips' registers to their default
|
||||
values, along with related RAM locations. All processor reg-
|
||||
isters are affected. For the 128, the routine also initiatizes the
|
||||
VIC and VDC chip registers (a step which is part of the Kernal
|
||||
CINT routine on the 64). In addition, the 128 routine sets all
|
||||
SID chip registers to zero and calls the Kernal DLCHR routine
|
||||
to initiahze the character set for the 80-column chip.
|
||||
|
||||
$FFB1 LISTEN
|
||||
|
||||
This low-level serial I/O routine sends a LISTEN command to
|
||||
a specified serial device. Call the routine with the accumulator
|
||||
holding the device number (4-31) of the serial device to re-
|
||||
ceive the command. The contents of .A and .X will be changed;
|
||||
.Y is unaffected. The success of the operation will be indicated
|
||||
by the value in the serial status flag upon return. (See
|
||||
READST for details.)
|
||||
|
||||
$FFD5 LOAD
|
||||
|
||||
This routine loads a program file from tape or disk into a
|
||||
specified area of memory, or verifies a program file against the
|
||||
contents of a specified area of memory. A number of prepara-
|
||||
tory routines must be called before LOAD: SETLFS, SETNAM,
|
||||
and (for the 128 only) SETBNK. See the discussions of those
|
||||
routines for details.
|
||||
|
||||
SETLFS establishes the device number and secondary ad-
|
||||
dress for the operation. fThe logical file number isn't significant
|
||||
for loading or verifying.) The secondary-address value deter-
|
||||
mines whether the load/verify will be absolute or relocating.
|
||||
If bit 0 of the secondary address is %0 (if the value is 0 or any
|
||||
even number, for example), a relocating load will be performed:
|
||||
The file will be loaded starting at the address specified in .X
|
||||
and .Y. If the bit is %1 (if the value is 1 or any odd number,
|
||||
for example), an absolute load will be performed: The data
|
||||
will be loaded starting at the address specified in the file itself.
|
||||
For tape files, the secondary-address specification can be over-
|
||||
ridden by the file's internal type specification. Nonrelocatable
|
||||
tape program files always load at their absolute address,
|
||||
regardless of the secondary address.
|
||||
|
||||
When calling the LOAD routine, the accumulator should
|
||||
hold the operation type value (0 for a load, or any nonzero
|
||||
value for a verify). If the secondary address specifies a relocat-
|
||||
ing load, the starting address at which data is to be loaded
|
||||
should be stored in .X (low byte) and .Y (high byte). The val-
|
||||
ues of .X and .Y are irrelevant for an absolute load.
|
||||
|
||||
The status-register carry bit will be clear upon return if
|
||||
the file was successfully loaded, or set if an error occurred or if
|
||||
the RUN/STOP key was pressed to abort the load. When
|
||||
carry is se t upon return, the accumulator will hold a Kernal er-
|
||||
ror-code value indicating the problem. Possible error codes in-
|
||||
clude 4 (file was not found), 5 (device was not present), 8 (no
|
||||
name was specified for a serial load), 9 (an illegal device num-
|
||||
ber was specified).
|
||||
|
||||
On the 128 only, the load will be aborted if it extends be-
|
||||
yond address $FEFF. This prevents corruption of the MMU
|
||||
configuration register at $FFQ0. Ln this case, an error code of
|
||||
16 will be returned. The success of the operation will also be
|
||||
indicated by the value in the tape/serial status flag. (See
|
||||
READST for details.)
|
||||
|
||||
$FF9C MEMBOT
|
||||
$FF99 MEMTOP
|
||||
|
||||
These routines read or set the Kernal's bottom-of-memory
|
||||
pointer and top-of-memory pointer, respectively. (The bottom-
|
||||
of-memory pointer is at locations $0281-$0282 for the 64 or
|
||||
$0A05-$0A06 for the 128; the top-of-memory pointer is at
|
||||
locations $0283-$0284 for the 64 or $0A07-$0A08 for the
|
||||
128.) To read the pointer, call the routine with the carry flag
|
||||
set; the pointer value will be returned in .X (low byte) and .Y
|
||||
(high byte). To set the pointer, call the routine with the carry
|
||||
flag clear and with .X and .Y containing the low and high
|
||||
bytes, respectively, of the desired pointer value.
|
||||
|
||||
$FFC0 OPEN
|
||||
|
||||
This routine opens a logical file to a specified device in
|
||||
preparation for input or output. At least one preparatory step
|
||||
is required before the standard OPEN routine is called:
|
||||
SETLFS must be called to establish the logical file number, de-
|
||||
vice number, and secondary address, For tape (device 1), RS-
|
||||
232 (device 2), or serial (device 4 or higher), SETNAM is also
|
||||
required to specify the length and address of the associated
|
||||
filename. Tor the 128, SETBNK must be called to establish the
|
||||
bank number where the filename can he found.
|
||||
|
||||
It is not necessary to load any registers before calling
|
||||
OPEN, and all processor register values may be changed dur-
|
||||
ing the routine. The carry will be clear if the file was success-
|
||||
fully opened, or it will be set if it could not be opened. When
|
||||
carry is set upon return, the accumulator will hold an error
|
||||
code indicating the problem. Possible error-code values in-
|
||||
clude 1 (ten files—the maximum allowed—are already open),
|
||||
2 (a currently open file already uses the specified logical file
|
||||
number), and 5 (specified device did not respond). The RS-232
|
||||
and tape/serial status flags will also reflect the success of the
|
||||
operation for those devices, (See READST for details.)
|
||||
|
||||
On the 128, there is an exception to the carry-bit rule. Be-
|
||||
cause of a bug in the 128's RS-232 OPEN routine, carry will
|
||||
be set if the RS-232 device is present when x-line handshaking
|
||||
is used (if the DSR line is high), or clear if the device is ab-
|
||||
sent—the opposite of the proper setting.
|
||||
|
||||
The JMP to the OPEN execution routine is by way of the
|
||||
IOPEN indirect vector $031A-$031B. You can modify the ac-
|
||||
tions of the routine by changing the vector to point to a rou-
|
||||
tine of your own,
|
||||
|
||||
$FFF0 PLOT
|
||||
|
||||
This routine reads or sets the cursor position on the active dis-
|
||||
play, if it is called with the status-register carry bit clear, the
|
||||
value in .X specifies the new cursor row (vertical position),
|
||||
and the value in .Y specifies the column (horizontal position).
|
||||
The carry bit will be set upon return if the specified column or
|
||||
row values are beyond the right or bottom margins of the cur-
|
||||
rent output window, or it will be clear if the cursor was
|
||||
successfully positioned.
|
||||
|
||||
If the routine is called with the carry bit set, the row num-
|
||||
ber for the current cursor position is returned in .X and the
|
||||
current column number is returned in .Y. For the Commodore
|
||||
128, the cursor position will be relative to the home position
|
||||
of the current output window rather than to the upper left cor-
|
||||
ner of the screen. Of course, in the case of a full-screen output
|
||||
window—the default condition—the upper left comer of the
|
||||
screen is the home position of the window,
|
||||
|
||||
$FF87 RAMTAS
|
||||
|
||||
This routine clears zero-page RAM (locations $02-$FF) and
|
||||
initializes Kernal memory pointers in zero page. For the 64
|
||||
only, the routine also clears pages 2 and 3 (locations
|
||||
$0200-$03FF), tests all RAM locations from $0400 upwards
|
||||
until ROM is encountered, and sets the top-of-memory
|
||||
pointer. For the 128, the routine sets the BASIC restart vector
|
||||
($OAOO) to point to BASIC's cold-start entry address, $4000.
|
||||
|
||||
$FFDE RDTIM
|
||||
|
||||
This routine returns the current value of the jiffy dock. The
|
||||
dock value corresponds to the number of jiffies (1 /60-second
|
||||
intervals) that have elapsed since the system was turned on or
|
||||
reset, or the number of jiffies since midnight if the dock value
|
||||
has been set. The low byte of the clock value (location $A2) is
|
||||
returned in .A, the middle byte (location $A1) in .X, and the
|
||||
high byte loocation $A0) in .Y.
|
||||
|
||||
$FFB7 READST
|
||||
|
||||
This routine (some Commodore references call it READSS) re-
|
||||
turns the status of the most recent I/O operation. The status
|
||||
value will be in the accumulator upon return; the contents of
|
||||
.X and .Y are unaffected. If the current device number is 2 (in-
|
||||
dicating an RS-232 operation), the status value is retrieved
|
||||
from the RS-232 status flag (location $0297 for the 64 or
|
||||
$0A14 for the 128), and the flag is cleared. Otherwise, the sta-
|
||||
tus value is retrieved from the tape/serial status flag (location
|
||||
$90). That flag is not cleared after being read.
|
||||
|
||||
| Bit | Value | Meaning if set Serial | Meaning if set Tape | Meaning if set RS-232 |
|
||||
|-----|---------|-----------------------|---------------------------------------|--------------------------|
|
||||
| 0 | 1/$01 | write timeout | | parity error |
|
||||
| 1 | 2/$02 | read timeout | | framing error |
|
||||
| 2 | 4/$04 | | short block | receiver buffer overflow |
|
||||
| 3 | 8/$08 | | long block | receiver buffet empty |
|
||||
| 4 | 16/$10 | verify mismatch | unrecoverable read or verify mismatch | CTS missing |
|
||||
| | | | | |
|
||||
| 5 | 32/$20 | | checksum mismatch | |
|
||||
| 6 | 64/$40 | EOI (end of file) | end of file | DSR missing |
|
||||
| 7 | 128/$80 | device nol present | end of tape | break |
|
||||
|
||||
$FF8A RESTOR
|
||||
|
||||
This routine resets the Kernal indirect vectors ($0314-$0333)
|
||||
to their default values. All processor registers are affected.
|
||||
|
||||
$FFD8 SAVE
|
||||
|
||||
This routine saves the contents of a block of memory to disk
|
||||
or tape. It could be a BASIC or ML program, but it doesn't
|
||||
have to be. A number of preparatory routines must be called
|
||||
first: SETLFS, SETNAM, and (for the 128 only) SETBNK. See
|
||||
the discussions of those routines for details.
|
||||
|
||||
SETLFS establishes the device number and secondary ad-
|
||||
dress for the operation. (The logical file number isn't signifi-
|
||||
cant for saving.) The secondary address is irrelevant for saves
|
||||
to serial devices, but for tape it specifies the header type. If bit
|
||||
0 of the secondary address value is %1 (if the value is 1, for
|
||||
example), the data will be stored in a nonrelocatable file—one
|
||||
that will always load to the same memory address from which
|
||||
it was saved. Otherwise, the data will be stored in a file that
|
||||
can be loaded to another location. If bit 1 of the secondary ad-
|
||||
dress is %1 (if the value is 2 or 3, for example), the file will be
|
||||
followed by an end-of-tape marker.
|
||||
|
||||
Before calling SAVE, you must also set up a two-byte
|
||||
zero-page pointer containing the starting address of the block
|
||||
of memory to be saved and then store the address of the zero-
|
||||
page pointer in the accumulator. The ending address (plus
|
||||
one) for the save should be stored in .X (low byte) and .Y
|
||||
(high byte). To save the entire contents of the desired area, it's
|
||||
important to remember that .X and .Y must hold an address
|
||||
that is one location beyond the desired ending address.
|
||||
|
||||
When the save is complete, the carry will be clear if the
|
||||
file was successfully saved, or set if an error occurred (or if the
|
||||
RUN/STOP key was pressed to abort the save). When carry is
|
||||
set upon return, the accumulator will hold the Kernal error
|
||||
code indicating the problem. Possible error-code values in-
|
||||
clude 5 (serial device was not present), 8 (no name was speci-
|
||||
fied for a serial save), and 9 (an illegal device number was
|
||||
specified). The success of the operation will also be indicated
|
||||
by the value in the tape/serial status flag. (See READST for
|
||||
details.)
|
||||
|
||||
$FF9F SCNKEY
|
||||
|
||||
This routine scans the keyboard matrix to determine which
|
||||
keys, if any, are currently pressed. The standard KQ service
|
||||
routine calls SCNKEY, so it's not usually necessary to call it
|
||||
explicitly to read the keyboard. The character code for the key
|
||||
currently pressed is loaded into the keyboard buffer, from
|
||||
where it can be retrieved using the Kernal GETIN routine. The
|
||||
matrix code of the keypress read during this routine can also
|
||||
be read in location $CB (64) or $D4 (128), and the status of
|
||||
the shift keys can be read in location $028D (64) or $D3 (128).
|
||||
|
||||
$FFED SCREEN
|
||||
|
||||
This routine (Commodore 128 literature calls it SCRORG) re-
|
||||
turns information on the size of the screen display. For the 64,
|
||||
the routine always returns the same values—the screen width
|
||||
in columns (40) in .X and the screen height in rows (25) in .Y.
|
||||
The accumulator is unaffected. For the 128, the values returned
|
||||
reflect the size of the current output window. The X register
|
||||
will contain in the current window the number of columns mi-
|
||||
nus one, and .Y will contain the number of rows minus one.
|
||||
The accumulator will hold the maximum column number for
|
||||
the display currently active (39 for the 40-column screen or 79
|
||||
for the 80-column screen).
|
||||
|
||||
$FF93 SECOND
|
||||
|
||||
This low-level serial I/O routine sends a secondary address to
|
||||
a device which has been commanded to listen. The value in
|
||||
the serial status flag upon return will indicate whether the op-
|
||||
eration was successful.
|
||||
|
||||
$FFBA SETLFS
|
||||
|
||||
This routine assigns the logical file number (location $B8), de-
|
||||
vice number (location $BA), and secondary address location
|
||||
$B9) for the current I/O operation. Call the routine with the
|
||||
accumulator holding the logical file number, .X holding the
|
||||
device number, and .Y holding the secondary address. All reg-
|
||||
ister values are preserved during the routine. Refer to the
|
||||
LOAD and SAVE routines for the special significance of the
|
||||
secondary address in those cases. When OPENing files to se-
|
||||
rial devices, it's vital that each logical file have a unique
|
||||
secondary address, In the 128 Kernal, the LKUPLA and
|
||||
LKUPSA routines can be used to find unused logical file num-
|
||||
bers and secondary addresses.
|
||||
|
||||
$FF90 SETMSG
|
||||
|
||||
SETMSG sets the value of the Kernal message flag (location
|
||||
$9D). Call the routine with the accumulator holding the de-
|
||||
sired flag value (.X and .Y are unaffected,) Valid flag values
|
||||
are 0 (no Kernal messages are displayed), 64 (only error mes-
|
||||
sages are displayed), 128 (only control messages—PRESS
|
||||
PLAY ON TAPE, for example—are displayed), and 192 (both
|
||||
error and control messages are displayed).
|
||||
|
||||
$FFBD SETNAM
|
||||
|
||||
This routine assigns the length (location $B7) and address
|
||||
locations $BB-$BC) of the filename for the current I/O opera-
|
||||
tion. Call the routine with the length of the filename in .A and
|
||||
the address of the first character of the name in .X (low byte)
|
||||
and .Y (high byte). If no name is used for the current opera-
|
||||
tion, load the accumulator with 0; the values in .X and .Y are
|
||||
then irrelevant, All register values are preserved during this
|
||||
routine.
|
||||
|
||||
$FFDB SETTIM
|
||||
|
||||
This routine sets the value in the software jiffy dock. The
|
||||
value in the accumulator is transferred to the low byte (loca-
|
||||
tion $A2), the value in .X to the middle byte (location $A1),
|
||||
and the value in .Y to the high byte (location $A0). The speci-
|
||||
fied value should be less than $4F1A01, which corresponds to
|
||||
24:00:00 hours.
|
||||
|
||||
$FFA2 SETTMO
|
||||
|
||||
The SETTMO routine stores the contents of the accumulator in
|
||||
the fEEE timeout flag. (.X and .Y are unaffected.) This routine
|
||||
is superfluous, since the flag isn't used by any 64 or 128 ROM
|
||||
routine. It is present merely to maintain consistency with pre-
|
||||
vious versions of the Kernal. For the 64, the flag location is
|
||||
$0285; for the 128, it's at $0A0E.
|
||||
|
||||
$FFE1 STOP
|
||||
|
||||
This routine checks whether the RUN/STOP key is currently
|
||||
pressed. It returns with the status-register Z bit clear if the key
|
||||
is not pressed, or with the bit set if it is pressed. Additionally,
|
||||
if RUN/STOP is pressed the CLRCH routine is called to re-
|
||||
store default I/O channels, and the count of keys in the key-
|
||||
board buffer is reset to zero.
|
||||
The JMP to the STOP execution routine is by way of the
|
||||
ISTOP indirect vector at $0328-$0329. You can modify the ac-
|
||||
tions of the routine by changing the vector to point to a rou-
|
||||
tine of your own.
|
||||
|
||||
$FFB4 TALK
|
||||
|
||||
This low-level 1/0 routine sends a TALK command to a serial
|
||||
device, Call the routine with the accumulator holding the
|
||||
number (4-31) of the device. The success of the operation will
|
||||
be indicated by the value in the serial status flag upon return,
|
||||
(See READST for details.)
|
||||
|
||||
$FF96 TKSA
|
||||
|
||||
This low-level serial 1/0 routine sends a secondary address to
|
||||
a device which has previously been commanded to taLk. The
|
||||
success of the operation will be indicated by the value in the
|
||||
serial status flag upon return. (See READST for details.)
|
||||
|
||||
$FFEA UDTIM
|
||||
|
||||
This routine increments the software jiffy dock and scans the
|
||||
keyboard column containing the RUN/STOP key. (The 128
|
||||
version of the routine also decrements a countdown timer.)
|
||||
This routine is normally called every 1 /60 second as part of
|
||||
the standard lRQ service routine.
|
||||
|
||||
$FFAE UNLSN
|
||||
|
||||
This low-level I/O routine sends an UNLISTEN command to
|
||||
aH devices on the serial bus. Any devices which are currently
|
||||
listeners will cease accepting data.
|
||||
|
||||
$FFAB UNTLK
|
||||
|
||||
This low-level 1/0 routine sends an UNTALK command to all
|
||||
devices on the serial bus. Any devices which are currently
|
||||
talkers will cease sending data.
|
||||
|
||||
$FF8D VECTOR
|
||||
|
||||
This routine can be used either to store the current values of
|
||||
Kernal indirect vectors at $0314-$0333 or to write new values
|
||||
to the vectors. When calling this routine, .X and .Y should be
|
||||
loaded with the address of a 32-byte table (low byte in .X,
|
||||
high byte in .Y). If the status-register carry bit is clear when
|
||||
the routine is called, the vectors will be loaded with the values
|
||||
from the table. If carry is set, the 16 two-byte address values
|
||||
currently in the vectors will be copied to the table.
|
||||
New 128 Kernal Jump Table
|
||||
Locations $FF47-$FF7F comprise a new table of jump vectors
|
||||
to routines found in Commodore 128 ROM, but not in the
|
||||
Commodore 64.
|
||||
|
||||
$FF53 BOOT_CALL
|
||||
|
||||
This routine attempts to load and execute boot sectors from a
|
||||
specified disk drive. Call the routine with .X holding the de-
|
||||
vice number for the drive (usually 8) and with the accu-
|
||||
mulator holding the character code corresponding to the drive
|
||||
number—not the actual drive number. The single drive in
|
||||
1541 and 1571 units is drive 0; in this case, use 48, the charac-
|
||||
ter code for zero. If the specified drive is not present or is
|
||||
tumed off, or if the disk in the drive does not contain a valid
|
||||
boot sector, the routine will return with the status-register
|
||||
carry bit set. If a boot sector is found, it will be loaded into
|
||||
locations $0B00-$0BFF. Additional boot sectors may be loaded
|
||||
into other areas of memory, and the boot code may not return
|
||||
to this routine.
|
||||
|
||||
$FF4A CLOSE_ALL
|
||||
|
||||
This routine closes all files currently opened to a specified de-
|
||||
vice, providing an improved version of CLALL. Enter the rou-
|
||||
tine with the accumulator holding the number of the device
|
||||
on which files are to be closed. Lf the specified device is the
|
||||
current input or output device, the input or output channel
|
||||
will be reset to the default device (screen or keyboard). If all
|
||||
files to the device were successfully closed, the status-register
|
||||
carry bit w01 clear upon return. A set carry bit indicates that a
|
||||
device error occurred.
|
||||
|
||||
$FF4D C64_MODE
|
||||
|
||||
This is the equivalent of the BASIC command GO 64. It per-
|
||||
forms an immediate cold start of 64 mode. To get back to 128
|
||||
mode, it is necessary to reset the computer, or to tum it off
|
||||
and back on.
|
||||
|
||||
$FF62 DLCHR
|
||||
|
||||
This routine copies character shape data for both standard
|
||||
ROM character sets into the VDC video chip's private block of
|
||||
RAM, providing character definitions for the 80-column dis-
|
||||
play. (The VDC has no character ROM.) This routine is also
|
||||
called as part of IOEMFI for the 128.
|
||||
|
||||
$FF50 DMA_CALL
|
||||
|
||||
This routine passes a command to a DMA (Direct Memory Ac-
|
||||
cess) device. The DMA device will then take control of the
|
||||
system to execute the command. The routine is written to sup-
|
||||
port the REC (RAM Expansion Controller) chip in the 1700
|
||||
and 1750 Memory Expansion Modules, the only DMA periph-
|
||||
erals currently available. Call the routine with .Y holding the
|
||||
command for the DMA device and .X holding the bank number
|
||||
for the operation. Other preparatory steps may be required,
|
||||
depending on the command.
|
||||
|
||||
$FF6B GETCFG
|
||||
|
||||
This routine translates a bank number (0-15) into the
|
||||
corresponding MMU register setting to configure the system
|
||||
for that bank. Call the routine with .X holding the bank num-
|
||||
ber. Upon return, the accumulator will hold the corresponding
|
||||
MMU configuration register value. (.Y is unaffected.) Once you
|
||||
have this value, you can store it into $FF00 to change banks.
|
||||
The input bank number is not checked for validity, and a
|
||||
number outside the acceptable range will return a meaningless
|
||||
value.
|
||||
|
||||
$FF7A INDCMP
|
||||
|
||||
This routine compares .A to the number held in a memory
|
||||
location in a specified bank. In preparing to call EMDCMP,
|
||||
load a two-byte zero-page pointer with the address of the
|
||||
location with which the accumulator is to be compared (or
|
||||
with the base location if a series of bytes is to be compared),
|
||||
then store the address of this pointer in location $02C8. Call
|
||||
the routine with the accumulator holding the byte to be com-
|
||||
pared, .X holding the bank number (0-15) for the target loca-
|
||||
tion, and .Y holding an offset value which will be added to
|
||||
the address in the pointer. (Load .Y with 0 if no offset is de-
|
||||
sired.) Upon return, the accumulator will still hold the byte
|
||||
value, and the status-register N, Z, and C (carry) bits will re-
|
||||
flect the result of the comparison. The value in .Y will also be
|
||||
preserved, but it is necessary to reload .X with the bank num-
|
||||
ber before every call to this routine. You can compare up to
|
||||
256 sequential locations without changing the address in the
|
||||
zero-page pointer by simply incrementing .Y between calls.
|
||||
|
||||
$FF74 INDFET
|
||||
|
||||
This routine reads the contents of a location in a specified
|
||||
bank. Prior to calling this routine; you must load a two-byte
|
||||
zero-page pointer with the address of the location to be read
|
||||
(or with the base location if a series of bytes is to be read).
|
||||
|
||||
Call the routine with the accumulator holding the address
|
||||
of the zero-page pointer, .X holding the bank number (0-15)
|
||||
for the target location, and .Y holding an offset value which
|
||||
will be added to the address in the pointer. (Load .Y with 0 if
|
||||
no offset is desired.) Upon return, the accumulator will hold
|
||||
the byte from the specified address. The value in .Y is not
|
||||
changed.
|
||||
|
||||
To read from a series of locations, it is necessary to reload
|
||||
the accumulator and .X values before every call to this routine,
|
||||
but you can read up to 256 sequential locations without
|
||||
changing the address in the zero-page pointer by incrementing
|
||||
.Y between calls.
|
||||
|
||||
$FF77 INDSTA
|
||||
|
||||
This routine stores a value at an address in a specified bank.
|
||||
Before calling the routine, you must load a two-byte zero-page
|
||||
pointer with the address of the location at which the byte is to
|
||||
be stored (or with the base location if a series of bytes is to be
|
||||
stored), and then store the address of this pointer in location
|
||||
$02B9. Call the routine with the accumulator holding the byte
|
||||
to be stored, .X holding the bank number (0-15) for the target
|
||||
location, and .Y holding an offset value which will be added
|
||||
to the address in the pointer. (Load Y with 0 if no offset is de-
|
||||
sired.) Upon return, the accumulator will still hold the byte
|
||||
value; .Y is also preserved. To write to a series of locations,
|
||||
you must reload .X with the bank number before every call,
|
||||
but you can write to up to 256 sequential locations without
|
||||
changing the address in the zero-page pointer by simply in-
|
||||
crementing .Y between calls.
|
||||
|
||||
$FF71 JMPFAR
|
||||
|
||||
JMPFAR jumps to a routine in a specified bank, with no return
|
||||
to the calling bank. Prior to calling this routine, you must store
|
||||
the bank number (0-15) of the target routine in location 2 and
|
||||
the address of the target routine in locations 3-4 in high-
|
||||
byte/low-byte order, opposite from the usual arrangement.
|
||||
Load location 5 with the value you want placed in the status
|
||||
register when the target routine is entered. (The behavior of
|
||||
many operating-system routines is influenced by the status-
|
||||
register setting, particularly the state of the carry bit. Load 5
|
||||
with the value 0 to clear carry or with 1 to set carry.) To pass
|
||||
other register values, store the desired accumulator value in
|
||||
location 6, the value for .X in 7, and the value for .Y in 8.
|
||||
|
||||
$FF6E JSRFAR
|
||||
|
||||
This routine jumps to a subroutine in a specified bank and re-
|
||||
turns to the calling routine in bank 15. Prior to calling this
|
||||
routine, you must store the bank number (0-15) of the target
|
||||
routine in location 2 and the address of the target routine in
|
||||
locations 3-4 (in high-byte/low-byte order, opposite from the
|
||||
usual arrangement). Load location 5 with the value you want
|
||||
placed in the status register when the target routine is called.
|
||||
(The behavior of many operating system routines is influenced
|
||||
by the status-register setting, particularly the state of the carry
|
||||
bit. Load 5 with the value 0 to clear carry, or with 1 to set
|
||||
carry.) To pass other register values to the routine you will be
|
||||
calling, store the desired accumulator value in location 6, the
|
||||
value for .X in 7, and the value for .Y in 8. Upon return, loca-
|
||||
tion 5 will hold the status-register value at the time of exit, 6
|
||||
will hold the accumulator value, 7 will hold the .X value, 8
|
||||
will hold the .Y value, and 9 will hold the stack-pointer value.
|
||||
The system is always configured for bank 15 upon exit.
|
||||
|
||||
$FF59 LKUPLA
|
||||
|
||||
This routine checks whether a specified logical file number is
|
||||
currently used. Call the routine with the accumulator holding
|
||||
the logical-file-number value in question. If that file number is
|
||||
available, the carry bit will be set upon return. (The logical file
|
||||
number will still be in the accumulator.) However, if the num-
|
||||
ber is used for a currently open file, then the carry bit will be
|
||||
clear upon return, the accumulator will still hold the logical
|
||||
file number, .X will hold the corresponding device number,
|
||||
and .Y will hold the corresponding secondary address.
|
||||
|
||||
$FF5C LKUPSA
|
||||
|
||||
This routine checks whether a specified secondary address is
|
||||
currently in use. Call the routine with .Y holding the secondary-
|
||||
address value in question. If that secondary address is not
|
||||
currently used, the status-register carry bit will be set upon re-
|
||||
turn. (The secondary-address value will still be in .Y.) How-
|
||||
ever, ii the number is used for a currently open file, the carry
|
||||
bit will be clear upon return, .Y will still hold the secondary
|
||||
address, the accumulator will hold the associated logical file
|
||||
number, and .X will hold the corresponding device number.
|
||||
|
||||
$FF65 PFKEY
|
||||
|
||||
When you turn on the 128, its function keys are predefined.
|
||||
Pressing F3 prints DIRECTORY, F7 holds the LIST command,
|
||||
and so on. The PFKEY Kernal routine assigns a new definition
|
||||
to one of the 10 programmable function keys (F1-F8, SHIFT-
|
||||
RUN/STOP, and HELP).
|
||||
|
||||
Call the routine with the accumulator holding the address
|
||||
of a three-byte zero-page string descriptor, .X holding the key
|
||||
number (1-10), and .Y holding the length of the new defi-
|
||||
nition string. The first two bytes of the descriptor in zero page
|
||||
should contain the address of the definition string (in the
|
||||
usual low-byte/high-byte order); the final byte should hold
|
||||
the bank number where the definition string is located. PFKEY
|
||||
doesn't check the key number for validity; a value outside the
|
||||
acceptable range may garble existing definitions. Upon return,
|
||||
the carry bit will be clear if the new definition was success-
|
||||
fully added, or set if there was insufficient room in the defi-
|
||||
nition table for the new definition.
|
||||
|
||||
$FF56 PHOENIX
|
||||
|
||||
This routine initializes function ROMs and attempts to boot a
|
||||
disk from the default drive. The presence of function ROMs in
|
||||
cartridges or in the 128's spare ROM socket is recorded during
|
||||
the power-on/reset sequence. This routine initializes the func-
|
||||
tion ROMs by calling their recorded cold-start entry addresses.
|
||||
If ROMs are present, they may or may not return to this rou-
|
||||
tine, depending on the initialization steps performed. If no
|
||||
ROMs are present, or if all ROMs return after initialization,
|
||||
the routine attempts to boot a disk in drive 0 of device 8 using
|
||||
the BOOT_CALL routine,
|
||||
|
||||
$FF7D PRIMM
|
||||
|
||||
This routine prints the string of character codes which im-
|
||||
mediately follows the JSR to this routine. (You must always
|
||||
call this routine with JSR, never with JMP. Only JSR places the
|
||||
required address information on the stack.) The routine contin-
|
||||
ues printing bytes as character codes until a byte containing
|
||||
zero is encountered. When the ending marker is found, the
|
||||
routine returns to the address immediately following the zero
|
||||
byte. All registers (.A, .X, and .Y) are preserved during this
|
||||
routine.
|
||||
|
||||
$FF68 SETBNK
|
||||
|
||||
This Kernal routine establishes the current memory bank from
|
||||
which data will be read or to which data will be written dur-
|
||||
ing load/save operations, as well as the bank where the file-
|
||||
name for the I/O operations can be found. Call the routine
|
||||
with the accumulator holding the bank number for data and
|
||||
.X holding the bank for the filename. All registers (.A, .X, and
|
||||
.Y) are preserved during this routine.
|
||||
|
||||
$FF47 SPIN_SPOUT
|
||||
|
||||
This low-level serial I/O routine sets up the serial bus for fast
|
||||
(burst mode) communications. Unless you're writing a custom
|
||||
data-transfer routine, it's not necessary to call this routine
|
||||
explicitly. All higher-level serial 1/0 routines already include
|
||||
this setup step. The routine should be called with the status-
|
||||
register carry bit clear to establish fast serial input or with the
|
||||
bit set to establish fast serial output.
|
||||
|
||||
$FF5F SWAPPER
|
||||
|
||||
This routine switches active screen displays. The active display
|
||||
is the one which has a live cursor, and to which screen
|
||||
CHROUT output is directed. The routine exchanges the active
|
||||
and inactive screen-editor variable tables, tab-stop bitmaps,
|
||||
and line-link bitmaps; and it toggles the active screen flag
|
||||
(location $D7). The routine doesn't physically tum either
|
||||
video chip on or off—both chips always remain enabled.
|
||||
412
kernal/kernal_pm.txt
Normal file
412
kernal/kernal_pm.txt
Normal file
|
|
@ -0,0 +1,412 @@
|
|||
-
|
||||
- https://www.atarimagazines.com/compute/issue40/cracking_the_kernal.php
|
||||
- Peter Marcotty: Cracking The Kernal
|
||||
- COMPUTE! #40, September 1983, pp. 268-274
|
||||
-
|
||||
- Descriptions of RESTOR, SAVE, SCNKEY and SCREEN are missing from
|
||||
- the original source.
|
||||
-
|
||||
|
||||
$FFA5 ACPTR Input byte from serial port.
|
||||
|
||||
ACPTR is used to get data off the serial bus. TALK and TKSA must be called first.
|
||||
|
||||
;Get a byte from the serial bus.
|
||||
JSR ACPTR
|
||||
STA $0800
|
||||
;This example only shows the end result; call TALK and TKSA first.
|
||||
|
||||
$FFC6 CHKIN Open channel for input.
|
||||
|
||||
CHKIN is used to define any OPENed file as an input file. OPEN must be called first.
|
||||
|
||||
;Define logical file #2 as an input channel.
|
||||
LDX #2
|
||||
JSR CHKIN
|
||||
;The X register designates which file #.
|
||||
|
||||
$FFC9 CHKOUT Open channel for output.
|
||||
|
||||
CHKOUT. Just like CHKIN, but it defines the file for output. OPEN must be called first.
|
||||
|
||||
;Define logical file #4 as an output file.
|
||||
LDX #4
|
||||
JSR CHKOUT
|
||||
;Once again the X register defines the file #.
|
||||
|
||||
$FFCF CHRIN Input character from channel.
|
||||
|
||||
CHRIN will get a character from the current input device. Calling OPEN and CHKIN can change the input device.
|
||||
|
||||
;Store a typed string to the screen.
|
||||
LDY #$00
|
||||
LOOP JSR CHKIN
|
||||
STA $0800,Y
|
||||
INY
|
||||
CMP #$0D
|
||||
BNE LOOP
|
||||
RTS
|
||||
;This example is like an INPUT statement. Try running it.
|
||||
|
||||
$FFD2 CHROUT Output character to channel.
|
||||
|
||||
CHROUT. Load the accumulator with your number and call. OPEN and CHKOUT will change the output device.
|
||||
|
||||
;Duplicate the command of CMD 4:PRINT "A";
|
||||
LDX #4
|
||||
JSR CHKOUT
|
||||
LDA #'A
|
||||
JSR CHROUT
|
||||
RTS
|
||||
;The letter A is printed to the screen; call OPEN first for the printer.
|
||||
|
||||
$FFAB CIOUT Output byte to serial port.
|
||||
|
||||
CIOUT will send data to the serial bus. LISTEN and SECOND must be called first. Call UNLSN to finish up neatly.
|
||||
|
||||
;Send the letter X to the serial bus.
|
||||
LDA #'X
|
||||
JSR CIOUT
|
||||
RTS
|
||||
;The accumulator is used to transfer the data.
|
||||
|
||||
$FF81 CINT Initialize screen editor.
|
||||
|
||||
CINT resets the 6567 video controller chip and the screen editor.
|
||||
|
||||
;Reset the 6567 chip and the 6566 VIC chip.
|
||||
JSR CINT
|
||||
RTS
|
||||
;Basically, just like pressing the STOP and RESTORE keys.
|
||||
|
||||
$FFE7 CLALL Close all channels and files.
|
||||
|
||||
CLALL really does what its name implies-it closes all files and resets all channels.
|
||||
|
||||
;Close all files.
|
||||
JSR CLALL
|
||||
RTS
|
||||
;The CLRCHN routine is called automatically.
|
||||
|
||||
$FFC3 CLOSE Close a specified logical file.
|
||||
|
||||
CLOSE. This routine will CLOSE any logical file that has been OPENed.
|
||||
|
||||
Close logical file #2.
|
||||
LDA #2
|
||||
JSR CLOSE
|
||||
;The accumulator designates the file #.
|
||||
|
||||
$FFCC CLRCHN Close input and output channels.
|
||||
|
||||
CLRCHN resets all channels and I/O registers - the input to keyboard and the output to screen.
|
||||
|
||||
;Restore default values to I/O devices.
|
||||
JSR CLRCHN
|
||||
RTS
|
||||
;The accumulator and the X register are altered.
|
||||
|
||||
$FFE4 GETIN Get character from keyboard buffer.
|
||||
|
||||
GETIN will get one piece of data from the input device. OPEN and CHKIN can be used to change the input device.
|
||||
|
||||
;Wait for a key to be pressed.
|
||||
WAIT JSR GETIN
|
||||
CMP #0
|
||||
BEQ WAIT
|
||||
;If the serial bus is used, then all registers are altered.
|
||||
|
||||
$FFF3 IOBASE Return base address of I/O devices.
|
||||
|
||||
IOBASE returns the low and high bytes of the starting address of the I/O devices in the X and Y registers.
|
||||
|
||||
;Set the Data Direction Register of the user port to 0 (input).
|
||||
JSR IOBASE
|
||||
STX POINT
|
||||
STY POINT+1
|
||||
LDY #2
|
||||
LDA #0
|
||||
STA (POINT),Y
|
||||
;POINT is a zero-page address used to access the DDR indirectly.
|
||||
|
||||
$FF84 IOINIT Initialize input/output.
|
||||
|
||||
IOINIT initializes all I/O devices and routines. It is part of the system's powering-up routine.
|
||||
|
||||
;Initialize all I/O devices.
|
||||
JSR IOINIT
|
||||
RTS
|
||||
;All registers are altered.
|
||||
|
||||
$FFB1 LISTEN Command devices on serial bus to LISTEN.
|
||||
|
||||
LISTEN will command any device on the serial bus to receive data.
|
||||
|
||||
;Command device #8 to listen.
|
||||
LDA #8
|
||||
JSR
|
||||
LISTEN
|
||||
;The accumulator designates the device #.
|
||||
|
||||
$FFD5 LOAD Load RAM from a device.
|
||||
|
||||
LOAD. The computer will perform either the LOAD or the VERIFY command. If the ac cumulator is a 1, then LOAD; if 0, then verify.
|
||||
|
||||
;Load a program into memory.
|
||||
LDA #$08
|
||||
LDX #$02
|
||||
LDY #$00
|
||||
JSR SETLFS
|
||||
LDA #$04
|
||||
LDX #L,NAME
|
||||
LDY #H,NAME
|
||||
JSR SETNAM
|
||||
LDA #$00
|
||||
LDY #$20
|
||||
JSR LOAD
|
||||
RTS
|
||||
NAME .BY 'FILE'
|
||||
;Program 'FILE' will be loaded into memory starting at 8192 decimal, X being the low byte and Y being the high byte for the load.
|
||||
|
||||
$FF9C MEMBOT Read/set bottom of memory.
|
||||
|
||||
MEMBOT. If the carry bit is set, then the low byte and the high byte of RAM are returned in the X and Y registers. If the carry bit is clear, the bottom of RAM is set to the X and Y registers.
|
||||
|
||||
;Move bottom of memory up one page.
|
||||
SEC
|
||||
JSR MEMBOT
|
||||
INY
|
||||
CLC
|
||||
JSR MEMBOT
|
||||
RTS
|
||||
;The accumulator is left alone.
|
||||
|
||||
$FF99 MEMTOP Read/set top of memory.
|
||||
|
||||
MEMTOP. Same principle as MEMBOT, except the top of RAM is affected.
|
||||
|
||||
;Protect 1K of memory from BASIC.
|
||||
SEC
|
||||
JSR MEMTOP
|
||||
DEY
|
||||
CLC
|
||||
JSR MEMTOP
|
||||
;The accumulator is left alone.
|
||||
|
||||
$FFC0 OPEN Open a logical file.
|
||||
|
||||
OPEN. After SETLFS and SETNAM have been called, you can OPEN a logical file.
|
||||
|
||||
;Duplicate the command OPEN 15,8,15,'I/O'
|
||||
LDA #3
|
||||
LDX #L,NAME
|
||||
LDY #H,NAME
|
||||
JSR SETNAM
|
||||
LDA #15
|
||||
LDX #8
|
||||
LDY #15
|
||||
JSR SETLFS
|
||||
JSR OPEN
|
||||
RTS
|
||||
NAME .BY 'I/O'
|
||||
;OPEN opens the current name file with the current LFS.
|
||||
|
||||
$FFF0 PLOT Read/set X,Y cursor position.
|
||||
|
||||
PLOT. If the carry bit of the accumulator is set, then the cursor X,Y is returned in the Y and X registers. If the carry bit is clear, then the cursor is moved to X,Y as determined by the Y and X registers.
|
||||
|
||||
;Move cursor to row 12, column 20 (12,20).
|
||||
LDX #12
|
||||
LDY #20
|
||||
CLC
|
||||
JSR PLOT
|
||||
;The cursor is now in the middle of the screen.
|
||||
|
||||
$FF87 RAMTAS Initialize RAM, reset tape buffer.
|
||||
|
||||
RAMTAS is used to test RAM, reset the top and bottom of memory pointers, clear $0000 to $0101 and $0200 to $03FF, and set the screen memory to $0400.
|
||||
|
||||
;Do RAM test.
|
||||
JSR RAMTAS
|
||||
RTS
|
||||
;All registers are altered.
|
||||
|
||||
$FFDE RDTIM Read realtime clock.
|
||||
|
||||
RDTIM. Locations 160-162 are transferred, in order, to the Y and X registers and the accumulator.
|
||||
|
||||
;Store system clock to screen.
|
||||
JSR RDTIM
|
||||
STA 1026
|
||||
STX 1025
|
||||
STY 1024
|
||||
;The system clock can be translated as hours/minutes/ seconds.
|
||||
|
||||
$FFB7 READST Read I/O status word.
|
||||
|
||||
READST. When called, READST returns the status of the I/O devices. Any error code can be translated as operator error.
|
||||
|
||||
;Check for read error.
|
||||
JSR READST
|
||||
CMP #16
|
||||
BEQ ERROR
|
||||
;In this case, if the accumulator is 16, a read error occurred.
|
||||
|
||||
$FF8A RESTOR Restore I/O default vectors.
|
||||
|
||||
$FFDE SAVE Save RAM to device.
|
||||
|
||||
$FF9F SCNKEY Scan keyboard.
|
||||
|
||||
$FFED SCREEN Return X,Y organization of screen.
|
||||
|
||||
SCREEN returns the number of columns and rows the screen has in the X and Y registers.
|
||||
|
||||
;Determine the screen size.
|
||||
JSR SCREEN
|
||||
STX MAXCOL
|
||||
STY MAXROW
|
||||
RTS
|
||||
;SCREEN allows further compatibility between the 64, the VIC-20, and future versions of the 64.
|
||||
|
||||
$FF93 SECOND Send secondary address after LISTEN.
|
||||
|
||||
SECOND. After LISTEN has been called, a SECONDary address may be sent.
|
||||
|
||||
;Address device #8 with secondary address #15.
|
||||
LDA #8
|
||||
JSR LISTEN
|
||||
LDA #15
|
||||
JSR SECOND
|
||||
;The accumulator designates the address number.
|
||||
|
||||
$FFBA SETLFS Set logical, first, and second address.
|
||||
|
||||
SETLFS stands for SET Logical address, File address, and Secondary address. After SETLFS is called, OPEN may be called.
|
||||
|
||||
;Set logical file #1, device #8, secondary address of 15.
|
||||
LDA #1
|
||||
LDX #8
|
||||
LDY #15
|
||||
JSR SETLFS
|
||||
;If OPEN is called, the command will be OPEN 1,8,15.
|
||||
|
||||
$FF90 SETMSG Control Kernal messages.
|
||||
|
||||
SETMSG. Depending on the accumulator, either error messages, control messages, or neither is printed.
|
||||
|
||||
;Turn on control messages.
|
||||
LDA #$40
|
||||
JSR SETMSG
|
||||
RTS
|
||||
;A 128 is for error messages; a zero, for turning both off.
|
||||
|
||||
$FFBD SETNAM Set filename.
|
||||
|
||||
SETNAM. In order to access the OPEN, LOAD, or SAVE routines, SETNAM must be called first.
|
||||
|
||||
;SETNAM will prepare the disk drive for'FILE#1'.
|
||||
LDA #6
|
||||
LDX #L,NAME
|
||||
LDY #H,NAME
|
||||
JSR SETNAM
|
||||
NAME.BY 'FILE#l'
|
||||
;Accumulator is file length, X is low byte, and Y is high byte.
|
||||
|
||||
$FFDB SETTIM Set realtime clock.
|
||||
|
||||
SETTIM is the opposite of RDTIM: it SETs the system clock instead of ReaDing it.
|
||||
|
||||
;Set system clock to 10 minutes =3600 jiffies.
|
||||
LDA #0
|
||||
LDX #L,3600
|
||||
LDY #H,3600
|
||||
JSR SETTIM
|
||||
;This allows very accurate timing for many things.
|
||||
|
||||
$FFA2 SETTMO Set time-out on serial bus.
|
||||
|
||||
SETTMO is used only with an IEEE add-on card to access the serial bus.
|
||||
|
||||
;Disable time-outs on serial bus.
|
||||
LDA #0
|
||||
JSR SETTMO
|
||||
;To enable time-outs, set the accumulator to a 128 and call SETTMO.
|
||||
|
||||
$FFE1 STOP Check for STOP key.
|
||||
|
||||
STOP will set the Z flag of the accumulator if the STOP key was pressed.
|
||||
|
||||
;Check for STOP key being pressed.
|
||||
WAIT JSR STOP
|
||||
BNE WAIT
|
||||
RTS
|
||||
;STOP must be called if the STOP key is to remain functional.
|
||||
|
||||
$FFB4 TALK Command serial bus device to TALK.
|
||||
|
||||
TALK. This routine will command a device on the serial bus to send data.
|
||||
|
||||
;Command device #8 to TALK.
|
||||
LDA #8
|
||||
JSR TALK
|
||||
RTS
|
||||
;The accumulator designates the file number.
|
||||
|
||||
$FF96 TKSA Send secondary address after TALK.
|
||||
|
||||
TKSA is used to send a secondary address for a TALK device. TALK must be called first.
|
||||
|
||||
;Signal device #4 to talk with command #7.
|
||||
LDA #4
|
||||
JSR TALK
|
||||
LDA #7
|
||||
JSR TKSA
|
||||
RTS
|
||||
;This example will tell the printer to print in uppercase.
|
||||
|
||||
$FFEA UDTIM Increment realtime clock.
|
||||
|
||||
UDTIM. If you are using your own interrupt system, you can update the system clock by calling UDTIM.
|
||||
|
||||
;Update the system clock.
|
||||
JSR UDTIM
|
||||
RTS
|
||||
;It is useful to call UDTIM before calling STOP.
|
||||
|
||||
$FFAE UNLSN Command serial bus to UNLISTEN.
|
||||
|
||||
UNLSN commands all devices on the serial bus to stop receiving data.
|
||||
|
||||
;Command the serial bus to UNLiSteN.
|
||||
JSR UNLSN
|
||||
RTS
|
||||
;The serial bus can now be used for other things.
|
||||
|
||||
$FFAB UNTLK Command serial bus to UNTALK.
|
||||
|
||||
UNTLK. All devices previously set to TALK will stop sending data.
|
||||
|
||||
;Command serial bus to stop sending data.
|
||||
JSR UNTLK
|
||||
RTS
|
||||
;Sending UNTLK commands all talking devices to get off the serial bus.
|
||||
|
||||
$FF8D VECTOR Read/set vectored I/O.
|
||||
|
||||
VECTOR. If the carry bit of the accumulator is set, the start of a list of the current contents of the RAM vectors is returned in the X and Y registers. If the carry bit is clear, there the user list pointed to by the X and Y registers is transferred to the system RAM vectors.
|
||||
|
||||
;Change the input routines to new system.
|
||||
SEC
|
||||
JSR VECTOR
|
||||
LDA #L,MYINP
|
||||
STA USER+10
|
||||
LDA #H,MYINP
|
||||
STA USER+11
|
||||
LDX #L,USER
|
||||
LDY #H,USER
|
||||
CLC
|
||||
JSR VECTOR
|
||||
RTS
|
||||
USER .DE 26
|
||||
;The new input list can start anywhere. USER is the location for temporary strings, and 35-36 is the utility pointer area.
|
||||
1280
kernal/kernal_prg.txt
Normal file
1280
kernal/kernal_prg.txt
Normal file
File diff suppressed because it is too large
Load diff
273
kernal/kernal_sta.txt
Normal file
273
kernal/kernal_sta.txt
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
$FF81 SCINIT Initialize VIC; restore default input/output to keyboard/screen; clear screen; set PAL/NTSC switch and interrupt timer.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X, Y.
|
||||
Real address: $FF5B.
|
||||
|
||||
$FF84 IOINIT Initialize CIA's, SID volume; setup memory configuration; set and start interrupt timer.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: $FDA3.
|
||||
|
||||
$FF87 RAMTAS Clear memory addresses $0002-$0101 and $0200-$03FF; run memory test and set start and end address of BASIC work area accordingly; set screen memory to $0400 and datasette buffer to $033C.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X, Y.
|
||||
Real address: $FD50.
|
||||
|
||||
$FF8A RESTOR Fill vector table at memory addresses $0314-$0333 with default values.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $FD15.
|
||||
|
||||
$FF8D VECTOR Copy vector table at memory addresses $0314-$0333 from or into user table.
|
||||
|
||||
Input: Carry: 0 = Copy user table into vector table, 1 = Copy vector table into user table; X/Y = Pointer to user table.
|
||||
Output: –
|
||||
Used registers: A, Y.
|
||||
Real address: $FD1A.
|
||||
|
||||
$FF90 SETMSG Set system error display switch at memory address $009D.
|
||||
|
||||
Input: A = Switch value.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $FE18.
|
||||
|
||||
$FF93 LSTNSA Send LISTEN secondary address to serial bus. (Must call LISTEN beforehands.)
|
||||
|
||||
Input: A = Secondary address.
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $EDB9.
|
||||
|
||||
$FF96 TALKSA Send TALK secondary address to serial bus. (Must call TALK beforehands.)
|
||||
|
||||
Input: A = Secondary address.
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $EDC7.
|
||||
|
||||
$FF99 MEMBOT Save or restore start address of BASIC work area.
|
||||
|
||||
Input: Carry: 0 = Restore from input, 1 = Save to output; X/Y = Address (if Carry = 0).
|
||||
Output: X/Y = Address (if Carry = 1).
|
||||
Used registers: X, Y.
|
||||
Real address: $FE25.
|
||||
|
||||
$FF9C MEMTOP Save or restore end address of BASIC work area.
|
||||
|
||||
Input: Carry: 0 = Restore from input, 1 = Save to output; X/Y = Address (if Carry = 0).
|
||||
Output: X/Y = Address (if Carry = 1).
|
||||
Used registers: X, Y.
|
||||
Real address: $FE34.
|
||||
|
||||
$FF9F SCNKEY Query keyboard; put current matrix code into memory address $00CB, current status of shift keys into memory address $028D and PETSCII code into keyboard buffer.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X, Y.
|
||||
Real address: $EA87.
|
||||
|
||||
$FFA2 SETTMO Unknown. (Set serial bus timeout.)
|
||||
|
||||
Input: A = Timeout value.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $FE21.
|
||||
|
||||
$FFA5 IECIN Read byte from serial bus. (Must call TALK and TALKSA beforehands.)
|
||||
|
||||
Input: –
|
||||
Output: A = Byte read.
|
||||
Used registers: A.
|
||||
Real address: $EE13.
|
||||
|
||||
$FFA8 IECOUT Write byte to serial bus. (Must call LISTEN and LSTNSA beforehands.)
|
||||
|
||||
Input: A = Byte to write.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $EDDD.
|
||||
|
||||
$FFAB UNTALK Send UNTALK command to serial bus.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $EDEF.
|
||||
|
||||
$FFAE UNLSTN Send UNLISTEN command to serial bus.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $EDFE.
|
||||
|
||||
$FFB1 LISTEN Send LISTEN command to serial bus.
|
||||
|
||||
Input: A = Device number.
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $ED0C.
|
||||
|
||||
$FFB4 TALK Send TALK command to serial bus.
|
||||
|
||||
Input: A = Device number.
|
||||
Output: –
|
||||
Used registers: A.
|
||||
Real address: $ED09.
|
||||
|
||||
$FFB7 READST Fetch status of current input/output device, value of ST variable. (For RS232, status is cleared.)
|
||||
|
||||
Input: –
|
||||
Output: A = Device status.
|
||||
Used registers: A.
|
||||
Real address: $FE07.
|
||||
|
||||
$FFBA SETLFS Set file parameters.
|
||||
|
||||
Input: A = Logical number; X = Device number; Y = Secondary address.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $FE00.
|
||||
|
||||
$FFBD SETNAM Set file name parameters.
|
||||
|
||||
Input: A = File name length; X/Y = Pointer to file name.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $FDF9.
|
||||
|
||||
$FFC0 OPEN Open file. (Must call SETLFS and SETNAM beforehands.)
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X, Y.
|
||||
Real address: ($031A), $F34A.
|
||||
|
||||
$FFC3 CLOSE Close file.
|
||||
|
||||
Input: A = Logical number.
|
||||
Output: –
|
||||
Used registers: A, X, Y.
|
||||
Real address: ($031C), $F291.
|
||||
|
||||
$FFC6 CHKIN Define file as default input. (Must call OPEN beforehands.)
|
||||
|
||||
Input: X = Logical number.
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: ($031E), $F20E.
|
||||
|
||||
$FFC9 CHKOUT Define file as default output. (Must call OPEN beforehands.)
|
||||
|
||||
Input: X = Logical number.
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: ($0320), $F250.
|
||||
|
||||
$FFCC CLRCHN Close default input/output files (for serial bus, send UNTALK and/or UNLISTEN); restore default input/output to keyboard/screen.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: ($0322), $F333.
|
||||
|
||||
$FFCF CHRIN Read byte from default input (for keyboard, read a line from the screen). (If not keyboard, must call OPEN and CHKIN beforehands.)
|
||||
|
||||
Input: –
|
||||
Output: A = Byte read.
|
||||
Used registers: A, Y.
|
||||
Real address: ($0324), $F157.
|
||||
|
||||
$FFD2 CHROUT Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
|
||||
|
||||
Input: A = Byte to write.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: ($0326), $F1CA.
|
||||
|
||||
$FFD5 LOAD Load or verify file. (Must call SETLFS and SETNAM beforehands.)
|
||||
|
||||
Input: A: 0 = Load, 1-255 = Verify; X/Y = Load address (if secondary address = 0).
|
||||
Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1); X/Y = Address of last byte loaded/verified (if Carry = 0).
|
||||
Used registers: A, X, Y.
|
||||
Real address: $F49E.
|
||||
|
||||
$FFD8 SAVE Save file. (Must call SETLFS and SETNAM beforehands.)
|
||||
|
||||
Input: A = Address of zero page register holding start address of memory area to save; X/Y = End address of memory area plus 1.
|
||||
Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1).
|
||||
Used registers: A, X, Y.
|
||||
Real address: $F5DD.
|
||||
|
||||
$FFDB SETTIM Set Time of Day, at memory address $00A0-$00A2.
|
||||
|
||||
Input: A/X/Y = New TOD value.
|
||||
Output: –
|
||||
Used registers: –
|
||||
Real address: $F6E4.
|
||||
|
||||
$FFDE RDTIM read Time of Day, at memory address $00A0-$00A2.
|
||||
|
||||
Input: –
|
||||
Output: A/X/Y = Current TOD value.
|
||||
Used registers: A, X, Y.
|
||||
Real address: $F6DD.
|
||||
|
||||
$FFE1 STOP Query Stop key indicator, at memory address $0091; if pressed, call CLRCHN and clear keyboard buffer.
|
||||
|
||||
Input: –
|
||||
Output: Zero: 0 = Not pressed, 1 = Pressed; Carry: 1 = Pressed.
|
||||
Used registers: A, X.
|
||||
Real address: ($0328), $F6ED.
|
||||
|
||||
$FFE4 GETIN Read byte from default input. (If not keyboard, must call OPEN and CHKIN beforehands.)
|
||||
|
||||
Input: –
|
||||
Output: A = Byte read.
|
||||
Used registers: A, X, Y.
|
||||
Real address: ($032A), $F13E.
|
||||
|
||||
$FFE7 CLALL Clear file table; call CLRCHN.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: ($032C), $F32F.
|
||||
|
||||
$FFEA UDTIM Update Time of Day, at memory address $00A0-$00A2, and Stop key indicator, at memory address $0091.
|
||||
|
||||
Input: –
|
||||
Output: –
|
||||
Used registers: A, X.
|
||||
Real address: $F69B.
|
||||
|
||||
$FFED SCREEN Fetch number of screen rows and columns.
|
||||
|
||||
Input: –
|
||||
Output: X = Number of columns (40); Y = Number of rows (25).
|
||||
Used registers: X, Y.
|
||||
Real address: $E505.
|
||||
|
||||
$FFF0 PLOT Save or restore cursor position.
|
||||
|
||||
Input: Carry: 0 = Restore from input, 1 = Save to output; X = Cursor column (if Carry = 0); Y = Cursor row (if Carry = 0).
|
||||
Output: X = Cursor column (if Carry = 1); Y = Cursor row (if Carry = 1).
|
||||
Used registers: X, Y.
|
||||
Real address: $E50A.
|
||||
|
||||
$FFF3 IOBASE Fetch CIA #1 base address.
|
||||
|
||||
Input: –
|
||||
Output: X/Y = CIA #1 base address ($DC00).
|
||||
Used registers: X, Y.
|
||||
Real address: $E500.
|
||||
|
||||
Loading…
Reference in a new issue