doc_20150805212116
DESCRIPTION
Nuts and Bolts of the Commodore C16TRANSCRIPT
-
j Nick Hampshire brings you a I detailed look at the C-16 ! Operating System variables I and memory map.
ANYONE WISHING TO DO EXTENSIVE machine code programming on the C-1 6 or Plus-4 will require two essential pieces of information.
The first, is a list of the operating system variables, their location and function. This is essential if fatal interac-tion with the system software is not to occur. It is also important to know where to place variables when using any of the system subroutines.
The second essential piece of informa-tion is a memory map. This contains the entry points to the operating system and Basic ROM routines. The use of. such routines within a program can save a considerable amount of time and program space, an important considera-tion with the C-16.
I have included both these pieces of information in this article.
Unfortunately, Commodore has not previously produced any of this data and it has therefore been necessary to use the experience gained with p reviou s Commodore machines to deduce the location and function of both variables and routines. All the locations discovered have been thoroughly checked and I have no reason to doubt that they are correct, I wou ld however be very interested to hear from any readers with additional information.
The operating system variables are, in common with all Commodore machines, stored in the bottom area of memory extending from location $0000 up to the bottom of the screen colour memory at $0800, a total of 2K of memory. All ,the . important variable locations are shown in Table 1. It should be noted that locations $00 and $01 are an 1/ 0 port located on the processor chip and cannot therefore be used for variable storage.
A memory map of the ROM based operating system _and Basic routines is shown in Table 2. Many of these routines are usable to some degree, and some are extremely valuable. Most of the routines and variab les are similar, or even identical, in function, if not in location, to those on the C64.
Readers wishing to gain an in depth knowledge of the routines, functions and operations are recommended to consult
38 I one of the advanced books on the 64. The 11m11R, 64 Revealed series by N ick Hampshire,
I published by Collins is recommended , especiall y Advanced Com m odore 64 Basic Revealed.
OF THE
, -,:able:.1 ' .. . : _,,. ' ,< . ~..... ' .,; ' ' I ~
--====---==-----------------------
0001 - Cassette c:cit1trr:r l Bit 4 Cassette read
(100A OOOD 0(10E OOOF (1(114-(1(115 -0016 001 7-0(11 E: 0019-0021 0022-0025 0026-002A -002B-002C 002D-002E -002F-0030 0031-(HJ32 [1[133-00:::4 0035-(1(136 0037-(1038 0039-(1[1:3A 003B- 003C 003D-003E -oo:::F-0040 -0041 -(HJ42 -004:::: - 0044 -0045-0046 -0047-(HJ4f: 0049- 004A -004E:-004C -004D 004E-005:3 0054- 0056 -0057-0060 -0061 0062-0065 0066 0067
:3 : Cassette motcr ( O=on) 1 : Cassette 1.ur i te
0=LOAD,1=VERIFY \o TY~e= FF=string,00=numeric 13 T::1~=e: f:O=inte~er., 00=-f k~.tin-:.1 t '1 DATA scan---'L I ST ::tuote.'memm-::1 + l -: /. 7'5 om::6-(1(fE:7 - F'o 1 nter : ca.ss:E'tte buffer { f, / -OOC4-00C5 I m:L~t cursc~r lo:.1 ( r-01.1.1) e:r:r ltm1n) / :) 00C6 LJh 1 ch ke':::1 : t-4=no ke.:1 f tj o
i
-
o:::: 16-031 7 031!::-(1319 0:31A-ft::::1f: 0:::: 1 C-(t31 D 031E-031F
0:322-(1:32:3 0324-(1:325
0:32A-0:32E: 032C-032D lt32E-0~32F 0:330-03:::: 1
04FC/04FE 04FD/04FF i;.150:::: 0509-0512 1]513-051C 05111"'""(1526
IF.:q ,._.1ector -for ke::::1sc-:.n/c locl~ ?-86 ''i1J1 Mc1.1 n I RC~ vector for tc9 -, 1-'2), OPEN vector }-~ '2. - ")-')3 ~LOS~ vector i,-:') 'i -~ r~S-:=,et 1 t1PUt ~..'ector ~ ~ 6 - "f '2:) 7 Set outt:ut . ..iector ~)& - ;fS Outt=-ut vector f!o'i- tlo')" Test-STOP ,.ector ,9d,- s - Current colour code1~~~
Bit 7 : 1=-f la.sh 6-4 : lw11 i narice ( 0-7) 3-0 : colour (0-15)
0547 07(H3-07E:0
07F5 07F6 07FD 0800-0BFF OC00-(:JFEV 10f10-3FF5 1800-:3FF5 3FF6-3FFD
Maxi mum size . o-f ke'::lboa.rd br_,f-fer V.2.h '.) Petoea.t st:eed cc,tn-1ter l 1 tt !' Re~=-eat de la'=' c:c,ur,ter l)
-
AB8D Perform ' REt4UMBER , ~ S c.) t 7- D965 - It-1toL~t unt i l carr i a~e ,returnss-6'r ADCA Perform FOR DB 11 - Read ke:::1boarcl 56 o 8 7 AE5A Perferrri, ,. DELETE _ . DC:49 - Outt: .. ~ L-c,41 P f.. ,r1...,c-A'.'E,. r .~ / - - er orm EF5:::: (lpen fi le ($0318) 0 L z_ ~ t
C:951 - Per-form ,r1LOAD,. F04A - Load t=-ro& o
C99C - Perform ,sci:.:ATCH'. -S- I bi 2 F265 - Test STOP ke':1 ($(1:3Z,6) 62.p '5':> C9CC Perform ,COLLECT,. F2A4 Power - reset entr:::1 Cf- I L b C9DA - Perform coP'r''. F2CE Set kerna l 1,..ectors 6,2..y~&r C9F 4 - Per-form ,. REHAME,. -S--1 ) 0-U F2D3 - Store kerna l vecj:ors b 2... I o .'.) CA0(1 - Perform ,. BACKUP F30B - Initialise I /0 6 2.....2. l C\ /
- Get Par&c,ters tor disk c,ommands F::::52 - Initialise s'::lstem consf..:1.nt~.62..z. J - Read disk error .F 40C - Set f i lename deta; ls CZ... Lr f6 .
CD32 - ,"ARE 'T'OU SUF=:s'T!J7J F423 - Set timeout &2..