[comp.sys.cbm] 6502/c128 disassembler for UNIX

carus@cbnewsc.ATT.COM (bryce.w.carus) (06/21/89)

The following shar file is Eric Green's original DSM/128 specific monitor. It
is being posted for those who can use it...including Eric who lost it :-).

: ---------CUT HERE---------
: This is a shar archive.  Extract with sh, not csh.
: The rest of this file will extract:
:  .labels README dsm.c tables.h
echo x - .labels
sed 's/^X//' > .labels << '!EOR!'
X# this is the list of labels for the 6502 disassembler. This
X# list is for the C-128. If you wish to make up your own list,
X# note that for a comment the '#' sign must be in column one,
X# and there CANNOT be blank lines -- I don't have error
X# checking (in fact, I just added the comment feature!)
X#                                        .
X0100 BAD -- tape read errors
X0110 XCNT -- dos loop counter
X0111 DOSF1L - dos filename 1 len.
X0112 DOSDS1 - dos disk drive 1
X0113 DOSF2L - dos filename 2 len.
X0114 DOSDS2 - dos disk drive 2
X0115 DOSF2A - dos file name 2 address.
X0117 DOSOFL - bload/bsave starting address
X0119 DOSOFH - bload/bsave ending address
X011b DOSLA - dos logical address
X011c DOSFA - dos physical address
X011d DOSSA - dos sec. addr.
X011e DOSRCL - dos record length
X011f DOSBNK
X0120 DOSDID - dos disk id
X0122 DIDCHK - dos dsk id flg
X0123 BNR - pr. us. pointer to begin. no.
X0124 ENR - pr. us. pointer to end no.
X0125 DOLR - pr. us. dollar flag
X0126 FLAG - pr. us. comma flag
X0127 SWE - pr. us. counter
X0128 USGN - pr. us. sign exponent
X0129 UEXP - pr. us. pointer to exponent
X012a VN - pr. us. # of digits before decimal flag
X012b CHSN - pr. us. justify flag
X012c VF - pr. us. # of pos before decimal point
X012e POSP - pr. us. +/- flag (field)
X012f FESP - pr. us. exponent flag (field)
X0130 ETOF - pr. us. switch
X0131 CFORM - pr. us. char counter (field)
X0132 SNO - pr. us. sign no.
X0133 BLFD - pr. us. blank/star flag
X0134 BEGFD - pr. us. pointer ot begin of field
X0135 LFOR - pr. us. length of format
X0136 ENDFD - pr. us. end of field
X0200,BUF -- input buffer: BASIC & monitor
X02a2,FETCH -- lda(-),y from any bank
X02aa,FETVEC -- fetch zpg vector
X02af,STASH -- sta(-),y to any bank
X02b9,STAVEC -- STASH zpg vector
X02be,CMPARE -- cmp(-),y to any bank
X02c8,CMPVEC -- CMPARE zpg vector
X02cd,JSRFAR -- far jsr to any bank
X02e3,JMPFAR -- far jmp to any bank
X02fc ESC_FN_VEX -- vector for additional function routines
X02fd ESC_FN_VEX+1 -- vector for additional function routines
X02fe BNKVEX -- vector for function cart. users
X02ff BNKVEX+1 -- vector for function cart. users
X0300 IERROR -- Vector for print BASIC error (err in .x)
X0301 IERROR+1 -- Vector for print BASIC error (err in .x)
X0302 IMAIN -- vector to main (system direct loop)
X0303 IMAIN+1 -- vector to main (system direct loop)
X0304 ICRNCH -- vector to crunch (tokenization routine)
X0305 ICRNCH+1 -- vector to crunch (tokenization routine)
X0306 IQPLOP -- vector to list BASIC text (char list)
X0307 IQPLOP+1 -- vector to list BASIC text (char list)
X0308 IGONE -- vector to GONE (BASIC char dispatch)
X0309 IGONE+1 -- vector to GONE (BASIC char dispatch)
X030a IEVAL -- vector to BASIC token evaluation
X030b IEVAL+1 -- vector to BASIC token evaluation
X030c IESCLK -- vector to escape-token crunch
X030d IESCLK+1 -- vector to escape-token crunch
X030e IESCPR -- vector to escape-token print
X030f IESCPR+1 -- vector to escape-token print
X0310 IESCEX -- vector to escape-token execute
X0311 IESCEX+1 -- vector to escape-token execute
X0314,IIRQ -- IRQ RAM vector
X0315,IIRQ+1 -- IRQ RAM vector
X0316 IBRK -- BRK instr. ram vector
X0317 IBRK+1 -- BRK instr. ram vector
X0318 INMI -- NMI vector
X0319 INMI+1 -- NMI vector
X031a IOPEN -- kernal OPEN vector
X031b IOPEN+1 -- kernal OPEN vector
X031c ICLOSE -- kernal CLOSE vector
X031d ICLOSE+1 -- kernal CLOSE vector
X031e ICHKIN -- kernal CHKIN vector
X031f ICHKIN+1 -- kernal CHKIN vector
X0320 ICKOUT -- kernal CHKOUT vector
X0321 ICKOUT+1 -- kernal CHKOUT vector
X0322 ICLRCH -- kernal CLRCHN routine vector
X0323 ICLRCH+1 -- kernal CLRCHN routine vector
X0324 IBASIN -- kernal CHRIN routine vector
X0325 IBASIN+1 -- kernal CHRIN routine vector
X0326 IBSOUT -- kernal CHROUT routine vector
X0327 IBSOUT+1 -- kernal CHROUT routine vector
X0328 ISTOP -- kernal STOP routine vector
X0329 ISTOP+1 -- kernal STOP routine vector
X032a IGETIN -- kernal GETIN routine vector
X032b IGETIN+1 -- kernal GETIN routine vector
X032c ICLALL -- kernal CLALL routine vector
X032d ICLALL+1 -- kernal CLALL routine vector
X032e EXMON -- monitor command vector
X032f EXMON+1 -- monitor command vector
X0330 ILOAD -- kernal LOAD routine vector
X0331 ILOAD+1 -- kernal LOAD routine vector
X0332 ISAVE -- kernal SAVE routine vector
X0333 ISAVE+1 -- kernal SAVE routine vector
X0334 CTLVEC -- editor: print 'contrl' indirect
X0336 SHFVEC -- editor: print 'shftd' indirect
X0338 ESCVEC -- editor: print 'escape' indirect
X033a KEYVEC -- editor: keyscan logic indirect
X033c KEYCHK -- editor: store key indirect
X033e DECODE -- vectors to keyboard matrix, decode tables
X034a KEYD -- irq keyboard buffer (10 bytes)
X0354 TABMAP -- bitmap of tab stops (10 bytes)
X035e BITABL -- bitmap of line wraps. tabmap & bitable swapped to $0a60
Xwhen screen mode changed.
X0362 LAT -- logical file numbers
X036c FAT -- primary device numbers
X0376 SAT -- secondary addresses
X0380 CHRGET
X0386 CHRGOT
X0390 QNUM
X039f INDSUB_RAM0 -- shared rom fetch sub.
X03ab INDSUB_RAM1 -- shared ROM fetch sub.
X03b7 INDIN1_RAM1 -- index1 indirect fetch
X03c0 INDIN2 -- index2 indirect fetch
X03c9 INDTXT -- txtptr
X03d2 ZERO -- numeric constant for BASIC
X03d5 CURRENT_BANK -- context for sys,poke,peek, from "BANK" cmmd
X03d6 TMPDES --- temp for instr
X03da FIN_BANK -- bank pointer for string/number convert rtn.
X03db SAVSIZ -- temp work locations for sshape
X03df BITS -- FAC#1 overflow digit
X03e0 SPRTMP_1 -- temp for SPRSAV
X03e1 SPRTMP_2 -- temp for SPRSAV
X03e2 FG_BG -- packed forground/background color nybbles
X03e3 FG_MC1 -- packed forground/multicolor 1 color nybbles
X0a00 SYSTEM_VECTOR -- vector to restart system (BASIC warm)
X0a02 DEJAVU -- kernal warm/cold init'n statusbyte
X0a03 PALNTS -- PAL/NTSC system flag
X0a04 INIT_STATUS -- flags reset vs. nmi status for init'n rtns
X0a05 MEMSTR -- ptr to bottom of avail. memory in system bank
X0a07 MEMSIZ -- ptr to top of available memory in system bank
X0a09 IRQTMP -- tape handler preserves irq indirect here
X0a0b CASTON -- TOD sense during tape operations
X0a0c KIKA26 -- tape read temporary
X0a0d STUPID -- tape read D1IRQ indicator
X0a0e TIMOUT -- fast serial timeout flag
X0a0f ENABL -- RS-232 enables
X0a10 M51CTR -- rs-232 control register
X0a11 M51CDR -- rs232 command register
X0a12 M51AJB -- rs232 user baud rate
X0a14 RSSTAT -- RS232 status register
X0a15 BITNUM -- rs232 number of bits to se{d
X0a16 BAUDOF -- rs232 baud rate full bit time (created by open)
X0a18 RIDBE -- rs232 input buffer index to end
X0a19 RIDBS -- rs232 input buffer index to start
X0a1a RODBS -- rs232 output buffer index to start
X0a1b RODBE -- rs232 output buffer index to end
X0a1c SERIAL -- fast serial internal/external flag
X0a1d TIMER -- decrementing jiffie register
X0a20 XMAX -- keyboard queue maximum size
X0a21 PAUSE -- <ctrl>s flag
X0a22 RPTFLG -- enable key repeats
X0a23 KOUNT -- delay between key repeats
X0a24 DELAY -- delay before a key starts repeating
X0a25 LSTSHF -- delay between <C=><shft> toggles
X0a26 BLNON -- VIC cursor mode (blinking,solid)
X0a27 BLNSW -- VIC cursor disble
X0a28 BLNCT -- VIC cursor blink counter
X0a29 GDBLN -- VIC cursor character before blink
X0a2a GDCOL -- VIC cursor color before blink
X0a2b CURMOD -- VDC cursor mode (when enabled)
X0a2c VM1 -- VIC text screen/chracter base pointer
X0a2d VM2 -- VIC bit-map base pointer
X0a2e VM3 -- VDC text screen base
X0a2f VM4 -- VDC attribute base
X0a30 LINTMP -- temporary pointer to last line for loop4
X0a31 SAV80A -- temp for 80 column routines
X0a32 SAV80B -- temp for 80 column routines
X0a33 CURCOL -- VDC cursor color before blink
X0a34 SPLIT -- VIC split screen raster value
X0a35 FNADRX -- save .x during bank operations
X0a36 PALCNT -- counter for PAL systems (jiffie adjustment)
X0a37 SPEED -- save system speed during tape and serial ops
X0a38 SPRITES -- save sprite enables during tape and serial ops
X0a39 BLANKING -- save blanking status during tape ops
X0a3a HOLD_OFF -- flag set by user to resrv full cntrl of VIC
X0a3b LDTB1_SA -- Hi byte: SA of VIC scrn (use W/VM1 to move scrn)
X0a3c CLR_EA_LO -- 8563 block fill
X0a3d CLR_EA_HI -- 8563 block fill
X0a40 save area for screen vars in 40/80 column switch
X0a80 XCNT -- compare buffer (32 bytes)
X0aa0 HULP
X0aaa FORMAT
X0aab LENGTH -- asm/dis
X0aac MSAL -- for assembler
X0aaf SXREG -- 1 byte temp used all over
X0ab0 SYREG -- 1 byte temp used all over
X0ab1 WRAP -- 1 byte temp for assembler
X0ab2 XSAVE -- save .x here during indirect subroutine calls
X0ab3 DIRECTION -- direction indicator for 'transfer'
X0ab4 COUNT -- parse number conversion
X0ab5 NUMBER -- parse number conversion
X0ab6 SHIFT -- parse number conversion
X0ab7 TEMPS
X0ac0 CURBNK -- current function key rom bank being polled
X0ac1 PAT -- physical address table (ids of logged-in cards)
X0ac5 DK_FLAG -- reserved for foreign screen editors
X0ac6 reserved for system
X0b00 TBUFFR -- cassette buffer (192 bytes)
X0c00 RS232I -- rs232 input buffer
X0d00 RS232O -- rs232 output buffer
X0e00 sprite definition area
X1000 PKYBUF -- programmable function key lengths table for 10 keys (F1-F8,SH/RUN,HELP)
X100a PKYDEF -- programmable function key strings
X1100 DOSSTR -- DOS output str. buf 48 bytes to build dos string
X1131 VWORK,XYPOS,XPOS -- graphics vars
X1133 YPOS -- current Y position
X1135 XDEST -- x-coordinate destination
X1137 YDEST -- y-coordinate destination
X1139 XYABS,XABS -- line drawing variables
X113b YABS
X113d XYSGN,XSGN
X113f YSGN
X1141 FCT
X1145 ERRVAL
X1147 LESSER
X1148 GRETR
X1149 ANGSGN -- sign of angle
X114a SINVAL -- sine of value of angle
X114c COSVAL -- cosine of value of angle
X114e ANGCNT -- temps for angle distance routines
X1150 XCIRCL -- circle center, X coordinte
X1152 YCIRCL -- circle center, Y coordinate
X1154 XRADUS -- X radius
X1156 YRADUS -- Y radius
X1158 ROTANG -- rotation angle
X115c ANGBEG -- arc angle start
X115e ANGEND -- arc angle end
X1160 XRCOS -- x radius * cos(rotation angle)
X1162 YRSIN -- y radius * sin(rotation angle)
X1164 XRSIN -- x radius * sin(rotation angle)
X1166 YRCOS -- y radius * cos(rotation angle)
X1168 CHRPAG -- high byte: addr of charrom for 'char' cmd
X1169 BITCNT -- temp for GSHAPE
X116a SCALEM -- scale mode flag
X116b WIDTH -- double width flag
X116c FILFLG -- box fill flag
X116d BITMSK -- temp for bit mask
X116e NUMCNT
X116f TRCFLG -- flags trace mode
X1170 RENUM_TMP_1 -- a temp for renumber
X1172 RENUM_TMP_2 -- a temp for renumber
X1174 T3
X1175 T4
X1177 VTEMP3 -- graphic temp storage
X1178 VTEMP4
X1179 VTEMP5
X117a ADRAY1 -- ptr to routine: convert float -> integer
X117c ADRAY2 -- ptr to routine: convert integer -> float
X117e SPRITE_DATA -- sprite speed/direction tables
X11d6 VIC_SAVE -- copy of vic reg's, used to update chip during retrace (21 bytes)
X11eb UPPER_LOWER -- pointer to upper/lower char set for char
X11ec UPPER_GRAPHIC -- pr. to upper/graphic char. set
X11ed DOSSA -- temp storage for file SA during record cmd
X1200 OLDLIN -- previous BASIC line number
X1202 OLDTXT -- pointer: BASIC statement for continue
X1204 PUCHRS,PUFILL -- ??,"print using" fill symbol
X1205 PUCOMA -- "print using" comma symbol
X1206 PUDOT -- "print using" d.p. symbol
X1207 PUMONY -- "print using" monetary symbol
X1208 ERRNUM -- used by error trapping rouine -- last err no.
X1209 ERRLIN -- line # oflast error -- $FFFF if no error
X120b TRAPNO -- line # to go to on error. $ffxx if none set
X120d TMPTRP -- hold trap # tempor.
X120e ERRTXT
X1210 TEXT_TOP -- top of text pointer
X1212 MAX_MEM_0 -- highest address available to BASIC in RAM 0
X1214 TMPTXT -- used by do loop. could be mult. assigned
X1216 TMPLIN
X1218 USRPOK
X121b RNDX
X1220 CIRCLE_SEGMENT -- degrees per circle segment
X1221 DEJAVU -- 'cold' or 'warm' reset status
X1222 TEMP_RATE
X1223 VOICES
X1229 NTIME
X122b OCTAVE
X122c SHARP
X122d PITCH
X122f VOICE
X1230 WAVE0
X1233 DNOTE
X1234 FLTSAV
X1238 FLTFLG
X1239 NIBBLE
X123a TONNUM
X123b TONVAL
X123e PARCNT
X123f ATKTAB
X1249 SUSTAB
X1253 WAVTAB
X125d PULSLW
X1267 PULSVHI
X1271 FILTERS
X1276 INT_TRIP_FLAG (irq stuph)
X1279 INT_ADR_LO (irq stuph)
X127c INT_ADR_HI (irq stuph)
X127f INTVAL (irq stuph)
X1280 COLTYP (irq stuph)
X1281 SOUND_VOICE
X1282 SOUND_TIME_LO
X1285 SOUND_TIME_HI
X1288 SOUND_MAX_LO
X128b SOUND_MAX_HI
X128e SOUND_MIN_LO
X1291 SOUND_MIN_HI
X1294 SOUND_DIRECTION
X1297 SOUND_STEP_LO
X129A SOUND_STEP_HI
X129D SOUND_FREq_LO
X12A0 SOUND_FREq_HI
X12A3 TEMP_TIME_LO
X12A4 TEMP_TIME_HI
X12A5 TEMP_MAX_LO
X12A6 TEMP_MAX_HI
X12A7 TEMP_MIN_LO
X12A8 TEMP_MIN_HI
X12A9 TEMP_DIRECTION
X12AA TEMP_STEP_LO
X12AB TEMP_STEP_HI
X12AC TEMP_FREQ_LO
X12AD TEMP_FREQ_HI
X12AE TEMP_PULSE_LO
X12AF TEMP_PULSE_HI
X12B0 TEMP_WAVEFORM
X12B1 POT_TEMP_1  -- temporaries for 'POT' function
X12b2 POT_TEMP_2
X12B3 WINDOW_TEMP
X12B7 SAVRAM -- used by sprdef & savspr
X12FA DEFMOD -- used by sprdef & savspr
X12FB LINCNT -- used by sprdef & savspr
X12FC SPRITE_NUMBER -- used by sprdef & savspr
X12FD IRQ_WRAP_FLAG -- used by BASIC irq to block all but one irq call
X1300 application program area
X1c00 RAMBOT -- start of BASIC text
X4000 jmp HARD_RESET -- BASIC cold start
X4003 jmp SOFT_RESET -- BASIC warm start
X4006 jmp BASIC_IRQ -- BASIC irq entry
Xaf00 jmp AYINT -- convert f.p. to integer
Xaf03 jmp GIVAYF -- integer to f.p.
Xaf06 jmp FOUT -- convert f.p. to ascii string
Xaf09 jmp VAL_1 -- convert ascii string to f.p.
Xaf0c jmp GETADR -- convert f.p. to an address
Xaf0f jmp FLOATC -- convert address to f.p.
Xaf12 jmp FSUB -- mem - facc
Xaf15 jmp FSUBT -- arg - facc
Xaf18 jmp FADD -- mem + facc
Xaf1b jmp FADDT -- arg - facc
Xaf1e jmp FMULT -- mem * facc
Xaf21 jmp FMULTT -- arg * facc
Xaf24 jmp FDIF -- mem / facc
Xaf27 jmp FDIVT -- arg / facc
Xaf2a jmp LOG -- compute natural log of FACC
Xaf2d jmp INT -- perform basic int on facc
Xaf30 jmp SQR -- compute square root of facc
Xaf33 jmp NEGOP -- negate facc
Xaf36 jmp FPWR -- raise arg to the mem power
Xaf39 jmp FPWRT -- raise arg to the facc power
Xaf3c jmp EXP -- compute exp of facc
Xaf3f jmp COS -- compute cos of facc
Xaf42 jmp SIN -- compute sin of facc
Xaf45 jmp TAN -- compute tan of facc
Xaf48 jmp ATN -- compute atn of facc
Xaf4b jmp ROUND -- round facc
Xaf4e jmp ABS -- absolute value of facc
Xaf51 jmp SIGN -- test sign of facc
Xaf54 jmp FCOMP -- compare facc with memory
Xaf57 jmp RND(0) -- generate random f.p. number
Xaf5a jmp CONUPK -- move ram mem to arg
Xaf5d jmp ROMUPK -- move rom mem to arg
Xaf60 jmp MOVFRM -- move RAM mem to facc
Xaf63 jmp MOVFM -- move rom mem to facc
Xaf66 jmp MOVMF -- move facc to mem
Xaf69 jmp MOVFA -- move arg to facc
Xaf6c jmp MOVAF -- move facc to arg
XAF6F JMP OPTAB
XAF72 JMP DRAWLN
XAF75 JMP GPLOT
XAF78 JMP CIRSUB
XAF7B JMP RUN
XAF7E JMP RUNC
XAF81 JMP CLEAR
XAF84 JMP NEW
XAF87 JMP LNKPRG
XAF8A JMP CRUNCH
XAF8D JMP FNDLIN
XAF90 JMP NEWSTT
XAF93 JMP EVAL
XAF96 JMP FRMEVL
XAF99 JMP RUN_A_PROGRAM
XAF9C JMP SETEXC
XAF9F JMP LINGET
XAFA2 JMP GARBA2
XAFA5 JMP EXECUTE_A_LINE
XB000 jmp CALL -- monitor call entry
Xb003 jmp BREAK -- monitor break entry
Xb006 jmp MONCMD -- monitor command parser entry
Xc000 jmp CINT -- init editor & screen
Xc003 jmp DISPLY -- display char in .a, color in .x
Xc006 jmp LP2 -- get key from irq buffer into .a
Xc009 jmp LOOP5 -- get a chr from scrn line into .a
Xc00c jmp PRINT -- print character in .a
Xc00f jmp SCRORG -- get # of scrn rows,cols into x&y
Xc012 jmp SCNKEY -- scan keyboard subroutine
Xc015 jmp REPEAT -- handle repeat key& store decoded key
Xc018 jmp PLOT -- read or set crsr position in .x,.y
Xc01b jmp CURSOR -- move 8563 cursor subroutine
Xc01e jmp ESCAPE -- execute esc funcion using chr in .a
Xc021 jmp KEYSET -- redefine a programmable func'n key
Xc024 jmp IRQ -- irq entry
Xc027 jmp INIT80 -- init 80 column character set
Xc02a jmp SWAPPER -- swap editor locals (40/80 change)
Xc02d jmp WINDOW -- set top-left or bot-right of window
Xd000 VICREG0 -- sprite 0 x-location
Xd001 VICREG1 -- sprite 0 y-location
Xd002 VICREG2 -- sprite 1 x-location
Xd003 VICREG3 -- sprite 1 y-location
Xd004 VICREG4 -- sprite 2 x-location
Xd005 VICREG5 -- sprite 2 y-location
Xd006 VICREG6 -- sprite 3 x-location
Xd007 VICREG7 -- sprite 3 y-location
Xd008 VICREG8 -- sprite 4 x-location
Xd009 VICREG9 -- sprite 4 y-location
Xd00a VICREG10 -- sprite 5 x-location
Xd00b VICREG11 -- sprite 5 y-location
Xd00c VICREG12 -- sprite 6 x-location
Xd00d VICREG13 -- sprite 6 y-location
Xd00e VICREG14 -- sprite 7 x location
Xd00f VICREG15 -- sprite 7 y location
Xd010 VICREG16 -- MSB of x-location for sprites 0-7
Xd011 VICREG17 -- VIC control register 1
Xd012 VICREG18 -- Read/write raster value for compare irq
Xd013 VICREG19 -- light pen latch x-position
Xd014 VICREG20 -- light pen latch y-position
Xd015 VICREG21 -- sprites 0-7 display enable (1=enable)
Xd016 VICREG22 -- VIC control register 2
Xd017 VICREG23 -- sprites 0-7 y-expand
Xd018 VICREG24 -- VIC memory control register bits
Xd019 VICREG25 -- VIC interrupt flag register (1=irq occured)
Xd01a VICREG26 -- VIC IRQ enable bits (1=enable)
Xd01b VICREG27 -- sprites 0-7 background priority (1=sprite)
Xd01c VICREG28 -- sprites 0-7 multicolor mode (1=multicolor)
Xd01d VICREG29 -- sprites 0-7 x-expand
Xd01e VICREG30 -- sprite to sprite collision latch
Xd01f VICREG31 -- sprite to background collision latch
Xd020 VICREG32 -- border color
Xd021 VICREG33 -- background color 0
Xd022 VICREG34 -- background color 1
Xd023 VICREG35 -- background color 2
Xd024 VICREG36 -- background color 3
Xd025 VICREG37 -- sprite multi-color register 0
Xd026 VICREG38 -- sprite multi-color register 1
Xd027 VICREG39 -- sprite 0 color
Xd028 VICREG40 -- sprite 1 color
Xd029 VICREG41 -- sprite 2 color
Xd02a VICREG42 -- sprite 3 color
Xd02b VICREG43 -- sprite 4 color
Xd02c VICREG44 -- sprite 5 color
Xd02d VICREG45 -- sprite 6 color
Xd02e VICREG46 -- sprite 7 color
Xd02f VICREG47 -- keyboard lines bits
Xd030 VICREG48 -- clock speed bits
Xd400 SIDREG0 -- voice 1 frequency lo
Xd401 SIDREG1 -- voice 1 frequency hi
Xd402 SIDREG2 -- voice 1 pulse width lo
Xd403 SIDREG3 -- voice 1 pulse width hi
Xd404 SIDREG4 -- voice 1 control register
Xd405 SIDREG5 -- voice 1 attack/decay
Xd406 SIDREG6 -- voice 1 sustain/release
Xd407 SIDREG7 -- voice 2 frequency low
Xd408 SIDREG8 -- voice 2 frequency hi
Xd409 SIDREG9 -- voice 2 pulse width lo
Xd40a SIDREG10 -- voice 2 pulse width hi
Xd40b SIDREG11 -- voice 2 control register
Xd40c SIDREG12 -- voice 2 attack/decay
Xd40d SIDREG13 -- voice 2 sustain-release
Xd40e SIDREG14 -- voice 3 frequency lo
Xd40f SIDREG15 -- voice 3 frequency hi
Xd410 SIDREG16 -- voice 3 pulse width lo
Xd411 SIDREG17 -- voice 3 pulse width hi
Xd412 SIDREG18 -- voice 3 control register
Xd413 SIDREG19 -- voice 3 attack/decay
Xd414 SIDREG20 -- voice 3 sustain/release
Xd415 SIDREG21 -- filter cutoff frequency lo
Xd416 SIDREG22 -- filter cutoff freq. hi
Xd417 SIDREG23 -- resonance/filter
Xd418 SIDREG24 -- mode/volume
Xd419 SIDREG25 -- pot x, a/d converter, paddle 1
Xd41a SIDREG26 -- pot y, a/d converter, paddle 2
Xd41b SIDREG27 -- oscillator 3, random number generator
Xd41c SIDREG28 -- envelope generator 3 output
Xd500 MMUCR1 -- configuration register
Xd501 PCRA -- preconfiguration register A
Xd502 PCRB -- preconfiguration register B
Xd503 PCRC -- preconfiguration register C
Xd504 PCRD -- preconfiguration register D
Xd505 MMUMCR -- mode configuration register
Xd506 MMURCR -- RAM configuration register
Xd507 MMUP0L -- page 0 pointer low
Xd508 MMUP0H -- page 0 pointer hi
Xd509 MMUP1L -- page 1 pointer low
Xd50a MMUP1H -- page 1 pointer hi
Xd50b MMUVER -- MMU version number
Xd600 VDCADR -- 8563 address register
Xd601 VDCDAT -- 8563 data register
Xdc00 D1PRA -- CIA#1 port A (output keyboard columns)
Xdc01 D1PRB -- CIA#1 port B (input keyboard rows)
Xdc02 D1DDRA - CIA#1 data direction port A
Xdc03 D1DDRB - CIA#1 data direction port B
Xdc04 D1T1L -- CIA#1 timer A lo
Xdc05 D1T1H -- CIA#1 timer A hi
Xdc06 D1T2L -- CIA#1 timer B lo
Xdc07 D1T2H -- CIA#1 timer B hi
Xdc08 D1TOD1 -- CIA#1 TOD tenths
Xdc09 D1TODS -- CIA#1 TOD seconds
Xdc0a D1TODM -- CIA#1 TOD minutes
Xdc0b D1TODH -- CIA#1 TOD hours
Xdc0c D1SDR -- CIA#1 serial data register
Xdc0d D1ICR -- CIA#1 interrupt control register
Xdc0e D1CRA -- CIA#1 control register A
Xdc0f D1CRB -- CIA#1 control register B
Xdd00 D2PRA -- CIA#2 port A serial bus, rs232, va14-15
Xdd01 D2PRB -- CIA#2 port B user port, rs232 bits
Xdd02 D2DDRA - CIA#2 data direction port A
Xdd03 D2DDRB - CIA#2 data direction port B
Xdd04 D2T1L -- CIA#2 timer A lo
Xdd05 D2T1H -- CIA#2 timer A hi
Xdd06 D2T2L -- CIA#2 timer B lo
Xdd07 D2T2H -- CIA#2 timer B hi
Xdd08 D2TOD2 -- CIA#2 TOD tenths
Xdd09 D2TODS -- CIA#2 TOD seconds
Xdd0a D2TODM -- CIA#2 TOD minutes
Xdd0b D2TODH -- CIA#2 TOD hours
Xdd0c D2SDR -- CIA#2 serial data register
Xdd0d D2ICR -- CIA#2 interrupt control register
Xdd0e D2CRA -- CIA#2 control register A
Xdd0f D2CRB -- CIA#2 control register B
Xff00 MMUCR -- configuration register (secondary)
Xff01 LCRA -- load configuration register A
Xff02 LCRB -- load configuration register B
Xff03 LCRC -- load configuration register C
Xff04 LCRD -- load configuration register D
Xff47 jmp SPIN SPOUT - set up fast serial port for i/o
Xff4a jmp CLOSE ALL - close all logical files for a device
Xff4d jmp C64MODE -- reconfigure system as a C64
Xff50 jmp DMA CALL - initiate dma request to external ram expansion, send command to dma device.
Xff53 jmp BOOT CALL - boot load program from disk
Xff56 jmp PHOENIX -- call all function cards' cold start
Xff59 jmp LKUPLA -- search tables for given LA 
Xff5c jmp LKUPSA -- search tables for given SA
Xff5f jmp SWAPPER - switch between 40 & 80 columns (editor)
Xff62 jmp DLCHR - init 80 col character RAM (editor)
Xff65 jmp PFKEY - program function key (editor)
Xff68 jmp SETBNK -- set bank for i/o operations
Xff6b jsr GETCFG -- lookup mmu data for given bank
Xff6e jmp JSRFAR -- jsr to any bank, rts to calling bank.
Xff71 jmp JMPFAR -- jmp to any bank
Xff74 jmp INDFET -- lda (fetvec),y from any bank
Xff77 jmp INDSTA -- sta (stavec),y to any bank
Xff7a jmp INDCMP - cmp (cmpvec),y to any bank
Xff7d jmp PRIMM - print immediate utility (always jsr to this).
Xff80 release number of kernal
Xff81 jmp CINT -- init editor & display chips (editor)
Xff84 jmp IOINIT -- init i/o devices (ports,timers,etc.)
Xff87 jmp RAMTAS - init ram & buffers for system
Xff8a jmp RESTOR - restore vectors to initial system
Xff8d jmp VECTOR - change vectors for user
Xff90 jmp SETMSG - control O.S. messages
Xff93 jmp SECND - send SA after listen
Xff96 jmp TKSA - send SA after talk
Xff99 jmp MEMTOP - set/read top of system RAM
Xff9c jmp MEMBOT - set/read bottom of system RAM
Xff9f jmp KEY - scan keyboard (editor)
Xffa2 jmp SETTMO - set timeout in IEEE (reserved)
Xffa5 jmp ACPTR - handshake serial byte in
Xffa8 jmp CIOUT - handshake serial byte out
Xffab jmp UNTLK - send untalk out serial
Xffae jmp UNLSN - send unlisten out serial
Xffb1 jmp LISTN - send listen out serial
Xffb4 jmp TALK - send talk out serial
Xffb7 jmp READSS - return i/o status byte
Xffba jmp SETLFS - set LA, FA, SA
Xffbd jmp SETNAM - set length and file name address
Xffc0 jmp (IOPEN) - OPEN logical file
Xffc3 jmp (ICLOSE) - CLOSE logical file
Xffc6 jmp (ICHKIN) - CHKIN - set channel in
Xffc9 jmp (ICKOUT) - CKOUT - set channel out
Xffcc jmp (ICLRCH) - CLRCH - restore default i/o channel
Xffcf jmp (IBASIN) - BASIN - CHRIN from channel
Xffd2 jmp (IBSOUT) - BASOUT - CHROUT from channel
Xffd5 jmp LOADSP -- load from file
Xffd8 jmp SAVESP -- save to file
Xffdb jmp SETTIM - set internal clock
Xffde jmp RDTIM -- read internal clock
Xffe1 jmp (ISTOP) - STOP - scan stop key
Xffe4 jmp (IGETIN) - GETIN - read buffered data
Xffe7 jmp (ICLALL) - CLALL - close all files & channels
Xffea jmp UDTIM - CLOCK - increment internal clock
Xffed jmp SCRORG - return screen window size (editor)
Xfff0 jmp PLOT -- read/set x,y cursor (editor)
Xfff3 jmp IOBASE -- return i/o base
Xf781 IOBASE -- return i/o base
Xf5f8 UDTIM -- increment internal clock
Xf65e RDTIM -- read internal clock
Xf665 SETTIM -- set internal clock
Xf53e SAVESP -- save to file
Xf265 LOADSP -- load from file
Xf731 SETNAM -- set length and file name address
Xf738 SETLFS -- set LA, FA, SA
Xf744 READSS -- return i/o status byte
Xe33b TALK -- send talk out serial
Xe33e LISTN -- sent listen out serial
Xe526 UNLSN -- send unlisten out serial
Xe515 UNTLK -- send untalk out serial
Xe503 CIOUT -- handshake serial byte out
Xe43e ACPTR -- handshake serial byte in
Xf75f SETTMO -- set timeout in IEEE (reserved)
Xf772 MEMBOT - set/read bottom of system RAM
Xf763 MEMTOP -- set/read top of system RAM
Xe4e0 TKSA -- send SA after talk
Xe4d2 SECND -- send SA after listen
Xf75c SETMSG -- control O.S. messages
Xe05b VECTOR -- change vectors for user
Xe056 RESTOR -- restore vectors to initial system
Xe093 RAMTAS -- init ram & buffers for system
Xe109 IOINIT -- init i/o devices (ports, timers,etc.)
Xfa17 PRIMM -- print immediate utility (always jsr to this)
Xf7e3 INDCMP -- cmp (cmpvec),y to any bank
Xf7da INDSTA -- sta (stavec),y to any bank
Xf7d0 INDFET -- lda (fetvec),y from any bank
Xf7ec GETCFG -- lookup mmu data for given bank
Xf73f SETBNK -- set bank for i/o operations
Xf786 LKUPSA -- search tables for given SA
Xf79d LKUPLA -- search tables for given LA
Xf867 PHOENIX - call all function cards' cold start
Xf890 BOOT CALL - boot load program from disk
Xf7a5 DMA CALL - init dma request to external ram expansion, send command to dma device
Xe24b C64MODE -- reconfigure system as a c64
Xf23d CLOSE ALL - close all logical files for a device
Xe5fb SPIN SPOUT - set up fast serial port for i/o
Xff17 IRQ/BRK dispatcher (ROM-pointed-to)
Xff3d RESET dispatcher (ROM-pointed-to)
Xff05 NMI dispatcher (ROM-pointed-to)
Xe224 SYSTEM dispatcher - operating system vector (RAM1)
Xf222 ICLALL routine
Xeeeb IGETIN routine
Xf66e ISTOP routine
Xef79 CHROUT routine
Xef06 CHRIN routine
Xf226 CLRCHN routine
Xf14c CHKOUT routine
Xf106 CHKIN routine
Xefbd OPEN routine
Xfa40 NMI routine
Xfa65 IRQ routine
X4ba9 IESCEX -- escape-token execute
X4023 HARD_RESET -- BASIC cold start
X4009 SOFT_RESET -- BASIC warm start
Xa84d BASIC_IRQ -- BASIC irq entry
Xc07b CINT -- init editor & screen
Xcc34 DISPLY -- display char in .a, color in .x
Xc234 LP2 -- get key from irq buffer into .a
Xc29b LOOP5 -- get a chr from scrn line into .a
Xc72d PRINT -- print character in .a
Xcc5b SCRORG -- get # of scrn rows,cols into x&y
Xc55d SCNKEY -- scan keyboard subroutine
Xc651 REPEAT -- handle repeat key & store decoded key
Xcc6a PLOT -- read or set crsr position in .x,.y
Xcd57 CURSOR -- move 8563 cursor subroutine
Xc9c1 ESCAPE -- execute esc function using chr in .a
Xcca2 KEYSET -- redefine programmable func'n key
Xc194 IRQ -- irq entry
Xce0c INIT80 -- init 80 column character set
Xcd2e SWAPPER -- swap editor locals (40/80 change)
Xca1b WINDOW -- set top-left or bot-right of window
X793c GIVAYF -- integer to f.p
X8e42 FOUT -- convert f.p. to ascii string
X8052 VAL_1 -- convert ascii string to f.p.
X8815 GETADR -- convert f.p. to an address
X8c75 FLOATC -- convert address to f.p.
X882e FSUB -- mem - facc
X8831 FSUBT -- arg - facc
X8845 FADD -- mem + facc
X8848 FADDT -- arg - facc
X8a24 FMULT -- mem * facc
X8a27 FMULTT -- arg * facc
X8b49 FDIF -- mem / facc
X8b4c FDIVT -- arg / facc
X89ca LOG -- compute natural log of FACC
X8cfb INT -- perform basic int on facc
X8fb7 SQR -- compute square root of facc
X8ffa NEGOP -- negate facc
X8fbe FPWR -- raise arg to the mem power
X8fc1 FPWRT - raise arg to the facc power
X9033 EXP -- compute exp of facc
X9409 COS -- compute cos of facc
X9410 SIN -- compute sin of facc
X9459 TAN -- compute tan of facc
X94b3 ATN -- compute atn of facc
X8c47 ROUND -- round facc
X8c84 ABS -- absolute value of facc
X8c57 SIGN -- test sign of facc
X8c87 FCOMP -- compare facc with memory
X8437 RND(0) -- generate random f.p. number
X8ab4 CONUPK -- move ram mem to arg
X8a89 ROMUPK -- move rom mem to arg
X7a85 MOVFRM -- move RAM mem to facc
X8bd4 MOVFM -- move ROM mem to facc
X8c00 MOVMF -- move facc to mem
X8c28 MOVFA -- move arg to facc
X8c38 MOVAF -- move facc to arg
X4828 OPTAB
X9b30 DRAWLN
X9bfb GPLOT
X6750 CIRSUB
X5a9b RUN
X51f3 RUNC
X51f8 CLEAR
X51d6 NEW
X4f4f LNKPRG
X430a CRUNCH
X5064 FNDLIN
X4af6 NEWSTT
X78d7 EVAL
X77ef FRMEVL
X5aa6 RUN_A_PROGRAM
X5a81 SETEXC
X50a0 LINGET
X92ea GARBA2
X4dcd EXECUTE_A_LINE
Xe0cd ?? init MMUCR, bank-move stuff, under-rom irq stuff, loram dma stuff?
Xe000 ?? hard ROM reset code ??
Xe242 ?? look for C-64 cartridge, poll c-128 carts if none ??
Xe26b ?? look for C-128 carts ??
Xf63d ?? scan stop key ??
!EOR!
echo x - README
sed 's/^X//' > README << '!EOR!'
X This is a commenting disassembler for 6502 machine language,
Xfor the Commodore 128 (but easily modified for any other 6502 based
Xmachine, see notes below).  It disassembles code for human
Xperusal, not for feeding into an assembler (I use Merlin and the
XSourceror for that). 
X
XModification notes:
X     Currently, it comments the code with Commodore-128 specific
Xstuff.  However, it uses a hash table and a .labels file for most
Xstuff, so altering it to work with another 6502 based computer would
Xbe childs play (although it'll take awhile to type in another .labels
Xfile). One thing to look at: currently, for efficiency reasons, all of
Xzero page's comments are contained in tables.h in a static array of
X*char (the distribution is too close on the 128, which uses every byte
Xof zero page -- it would wreck havoc with the hash/rehash scheme).
XYou'll have to change these labels for your computer. Also, note that
Xin dsm.c there is code that detects references to screen and color
Xmemory. That will need to be yanked out for non-CBM computers.
X
X     I would especially be grateful if someone would type in the
Xlabels for the Commodore 64... I simply have no time to spend on
Xtyping in a thousand lines or so of labels. Also, if someone knows of
Xa listing of C-128 ROM entries, would be grateful if they'd tell me
Xwhere I can get ahold of it. I'm interested in learning more about my
Xnew machine. Finally, does anybody know of a semi-decent linking
Xassembler for 6502 assembly language? I'm so tired of dealing with
Xhundreds of global labels... fixing instances where I have 5 labels
Xnamed "loop" gets old after awhile.
X
X     This was just a two-day hack, so please leave any suggestions in
Xmy mailbox (I expect there will be quite a few). Maybe we can turn it
Xinto a four-day hack...
X
X  Eric Green (akgua,ut-sally)!usl!elg
!EOR!
echo x - dsm.c
sed 's/^X//' > dsm.c << '!EOR!'
X /* Copyright, 1986 by Eric Green
X    All Rights Reserved, with following exceptions:
X
X   1) Right of duplication: Right of duplication granted to all, under
Xthe condition that 
X      a) source code to this file must be provided, and cannot be
Xpackaged seperately from the binary code
X      b) this copyright notice is left intact
X      c) right of duplication cannot be denied to any who recieve this file.
X
X   2) Right of derivative works: I hereby grant permission for all to
Xfreely modify this work. However, note that all derivative works
Xbecome property of Eric Green under copyright law, and thereby must
Xabide by the conditions of this copyright.
X
X*/
X
X#include <stdio.h>
X#include "tables.h"
X
X#ifndef lint
Xstatic char *copyright_notice = "Copyright 1986 by Eric Green";
X#endif
X
X/* 
X  program: dsm.c
X  purpose: disassemble a 6502 machine code file, generating C-128-specific
X    comments (although that is alterable by changing the .labels file or
X    for zero page, changing tables.h).
X  Author: Eric Green ( {akgua,ut-sally}!usl!{elg,usl-pc!jpdres10} )
X  program history: 
X   Version 1.0:
X   This is the second "C" program I've ever written (the first was a "grep").
X   It was programmed in its entirety on July 25, 1986, in one massive
X   hack attack. The .labels file, however, wasn't complete -- I can't type
X   that fast! Thus, if you think it looks sloppy, it probably is.
X
X   July 26 - added in to print hash table statistics (I'm paranoid),
X             print labels in front of their addresses, etc.,
X        print out when we're in various buffers
X
X   July 28 - add in to print zero-page stuff for 3-byte instructions, too.
X
X*/
X
X
Xstatic  int pc;
Xstatic  int temp_mode;
Xstatic  int temp_length;
Xstatic  int op_lobyte;
Xstatic  int op_hibyte;
Xstatic  int op;
Xstatic  int op_address;
X
X
X/* note: if you ever expand this, it must be a large prime number */
X#define MAX_HASH_SIZE 2003
X
Xstatic int hashtab[MAX_HASH_SIZE];     /* addresses to hash into */
Xstatic char *hashstring[MAX_HASH_SIZE];        /* strings describing those
X                          addresses */
X
X/* hash table statistics -- I'm curious to know how efficient my algorithm
X   is. */
Xstatic int hash_calls = 0;                /* total calls to hash function */
Xstatic int total_hashes = 0;              /* calls + collisions */
X
Xmain()
X{
X  /* We shouldn't have any arguments -- the beginning address is the first
X     two bytes of the file, we just read from std. input, write to std.
X     output. */
X  
X  int index;
X
X  init_hash();                 /* init the hash table */
X  read_hash();                 /* fill it from ".hash" */
X
X  pc =  getchar();
X  pc = pc+getchar()*256;
X    
X  while ( (op=getchar()) != EOF)
X    {
X      index = hash (pc);
X      if (hashtab[index] != -1)
X   printf("         %s",hashstring[index]);
X      else
X   check_page(pc>>8);
X      temp_mode = mode[op];
X      temp_length = length[temp_mode];
X      if (temp_length == 3)
X   {
X     op_lobyte = getchar();
X     op_hibyte = getchar();
X     op_address = op_hibyte*256+op_lobyte;
X     printf ("%04x:%02x %02x %02x  %s %s%04x%s ;",pc,op,op_lobyte,op_hibyte,opcode[op],before[temp_mode],op_address,after[temp_mode]);
X   }
X      else if (temp_length == 2)
X   {
X     op_lobyte = getchar();
X     op_address = op_lobyte;
X     if (temp_mode == 9)
X       { do_rel(); }
X     else
X       printf ("%04x:%02x %02x     %s %s%02x%s ;",pc,op,op_lobyte,opcode[op],before[temp_mode],op_lobyte,after[temp_mode]);
X   }
X      else
X   printf ("%04x:%02x        %s %s%s ;",pc,op,opcode[op],before[temp_mode],after[temp_mode]);
X      print_chars();
X      if (temp_length == 2)
X   {
X     if ( (temp_mode != 2) && (temp_mode != 13) && (temp_mode != 9) )
X       printf (" %s\n",zero_page[op_lobyte]);
X     else
X       putchar ('\n');
X   }
X      else if (temp_length == 3)
X   hash_thingy(op_address);
X      else
X   putchar ('\n');
X      if ( (strcmp(opcode[op],"jmp")==0) || (strcmp(opcode[op],"rts")==0))
X   puts("-----------------------------------------\n");
X      pc = pc + temp_length;
X    }
X  printf("\n Hash calls=%d, total hashes=%d.\n",hash_calls,total_hashes);
X}
X
Xprint_chars()
X{
X  int ch;
X  int count;
X
X  ch = convert(op);
X  putchar(ch);
X  if (temp_length > 1)
X    {
X      ch = convert(op_lobyte);
X      putchar(ch);
X    }
X  else
X    putchar(' ');
X  if (temp_length > 2)
X    {
X      ch = convert(op_hibyte);
X      putchar(ch);
X    }
X  else
X    putchar(' ');
X  putchar(' ');
X}
X
Xint convert (ch)
X     int ch;
X{
X  int new;
X  new = '.';
X  if ( (ch > 31) && (ch < 65))
X    { new=ch;}
X  else if ( (ch > 64) && (ch < 91))
X    { new=ch+32;}
X  else if ( (ch > 90) && (ch < 96))
X    { new = ch;}
X  else if ( (ch>96) && (ch<123))
X    { new = ch-32;}
X  else if ( (ch>192) && (ch<219))
X    new = ch-96;
X  return(new);
X}
X
Xdo_rel()
X{
X  if (op_lobyte < 128)
X    {
X      op_address = op_lobyte+pc+2;
X    }
X  else
X    {
X      op_address = pc-(256-op_lobyte)+2;
X    }
X
X  printf ("%04x:%02x %02x     %s %s%04x%s ;",pc,op,op_lobyte,opcode[op],before[temp_mode],op_address,after[temp_mode]);
X}
X
Xinit_hash()                    /* init hashtab to -1 */
X{
X  int counter;
X  
X  for (counter=0;counter<MAX_HASH_SIZE;counter++)
X    hashtab[counter]= (-1);
X}
X
Xint hash(address)
X     int address;
X{
X  int guard;
X  int index;
X
X  hash_calls++;
X  guard = 0;
X  index = (address*3) % MAX_HASH_SIZE;
X  while ( (hashtab[index] != address) && (hashtab[index] != -1) &&
X     (++guard < MAX_HASH_SIZE*2 ))
X    {
X      index = (index*3) % MAX_HASH_SIZE;
X    }
X  if (guard == MAX_HASH_SIZE*2)
X    {
X      printf("Error! HAsh_thingy overflow!\n");
X      exit(2);
X    }
X  total_hashes = total_hashes + 1 + guard;
X  return(index);
X}
X
Xhash_thingy(address)
X     int address;
X{
X  int index;
X
X  index = hash(address);
X  if (hashtab[index]==-1)
X    {
X      if (check_page(op_hibyte) == 0)
X   putchar('\n');
X    }
X  else
X    printf(" %s",hashstring[index]);
X}
X
X
Xint check_page(page)
X{
X  int returnflag = 1;
X
X  switch (page)
X    {
X    case 0:
X      printf(" %s\n",zero_page[op_lobyte]); break;
X    case 1:
X      puts(" 8510 CPU stack"); break;
X    case 4:
X    case 5:
X    case 6:
X    case 7:
X      puts(" VICSCN -- VIC 40 column text screen"); break;
X    case 8:
X    case 9:
X      puts(" BASIC run-time stack"); break;
X    case 0x0c:
X      puts(" rs-232 input buffer"); break;
X    case 0x0d:
X      puts(" rs-232 output buffer"); break;
X    case 0x10:
X      puts(" Programmable function key data"); break;
X    case 0xd8:
X    case 0xd9:
X    case 0xda:
X    case 0xdb:
X      puts(" VIC color matrix (nybbles)"); break;
X    default:
X      returnflag = 0;
X    }
X  return(returnflag);
X}
X
X
Xstatic char input_line[256];           /* line we're reading in to
X                          put into the hash table */
X
Xread_hash()
X{
X  int index;
X  FILE *input_file;
X  int address;
X  char number[5];
X  char *rest;
X
X  input_file = fopen (".labels","r");
X  if (input_file == NULL)
X    return(0);
X  while ( fgets(input_line,255,input_file) != NULL)
X    {
X      if (input_line[0] != '#')
X   {
X     input_line[4]=0;
X     sscanf (input_line,"%x",&address);
X     index = hash(address);
X     hashtab[index]=address;
X     rest = &input_line[5];
X  /*      printf ("%04x %d %s\n",address,index,rest); */
X     hashstring[index]=malloc(strlen(rest)+1);
X     strcpy (hashstring[index],rest);
X   }
X    }
X  printf("\nHash calls=%d, total hashes = %d\n\n",hash_calls,total_hashes);
X}    
X
!EOR!
echo x - tables.h
sed 's/^X//' > tables.h << '!EOR!'
X
Xstatic char *opcode[] = {
X "brk","ora","002","003","004","ora","asl","007","php","ora","asl","011",
X "012","ora","asl","015","bpl","ora","018","019","020","ora","asl",
X "023","clc","ora","026","027","028","ora","asl","031","jsr","and","034",
X "035","bit","and","rol","039","plp","and","rol","043","bit","and",
X "rol","047","bmi","and","050","051","052","and","rol","055","sec","and",
X "058","059","060","and","rol","063","rti","eor","066","067","068","eor",
X "lsr","071","pha","eor","lsr","075","jmp","eor","lsr","079","bvc","eor",
X "082","083","084","eor","lsr","087","cli","eor","090","091","092","eor",
X "lsr","095","rts","adc","098","099","100","adc","ror","103","pla","adc",
X "ror","107","jmp","adc","ror","111","bvs","adc","114","115","116","adc",
X "ror","119","sei","adc","122","123","124","adc","ror","127","128","sta",
X "130","131","sty","sta","stx","135","dey","137","txa","139","sty","sta",
X "stx","143","bcc","sta","146","147","sty","sta","stx","151","tya","sta",
X "txs","155","156","sta","158","159","ldy","lda","ldx","163","ldy","lda",
X "ldx","167","tay","lda","tax","171","ldy","lda","ldx","175","bcs","lda",
X "178","179","ldy","lda","ldx","183","clv","lda","tsx","187","ldy","lda",
X "ldx","191","cpy","cmp","194","195","cpy","cmp","dec","199","iny","cmp",
X "dex","203","cpy","cmp","dec","207","bne","cmp","210","211","212","cmp",
X "dec","215","cld","cmp","218","219","220","cmp","dec","223","cpx","sbc",
X "226","227","cpx","sbc","inc","231","inx","sbc","nop","235","cpx","sbc",
X "inc","239","beq","sbc","242","243","244","sbc","inc","247","sed","sbc",
X "250","251","252","sbc","inc","255"
X};
X
Xstatic short mode[] = {
X  0,10,13,13,13,                          3,3,13,0,2,
X  1,13,13,6,6,                            13,9,11,13,13,
X  13,4,4,13,0,                            8,13,13,13,7,
X  7,13,6,10,13,                           13,3,3,3,13,
X  0,2,1,13,6,                             6,6,13,9,11,
X  13,13,13,4,4,                           13,0,8,13,13,
X  13,7,7,13,0,                            10,13,13,13,3,
X  3,13,0,2,1,                             13,6,6,6,13,
X  9,11,13,13,13,                          4,4,13,0,8,
X  13,13,13,7,7,                           13,0,10,13,13,
X  13,3,3,13,0,                            2,1,13,12,6,
X  6,13,9,11,13,                           13,13,4,4,13,
X  0,8,13,13,13,                           7,7,13,13,10,
X  13,13,3,3,3,                            13,0,13,0,13,
X  6,6,6,13,9,                             11,13,13,4,4,
X  5,13,0,8,0,                             13,13,7,13,13,
X  2,10,2,13,3,                            3,3,13,0,2,
X  0,13,6,6,6,                             13,9,11,13,13,
X  4,4,5,13,0,                             8,0,13,7,7,
X  8,13,2,10,13,                           13,3,3,3,13,
X  0,2,0,13,6,                             6,6,13,9,11,
X  13,13,13,4,4,                           13,0,8,13,13,
X  13,7,7,13,2,                            10,13,13,3,3,
X  3,13,0,3,0,                             13,6,6,6,13,
X  9,11,13,13,13,                          4,4,13,0,8,
X  13,13,13,7,7,13
X};
X
Xstatic short length[] = {  1,1,2,2,2,2,3,3,3,2,2,2,3,1 };
X
Xstatic char *before[] = {
X  ""," a "," #$"," $"," $"," $"," $"," $"," $"," $",
X  " ($", " ($", " ($",""
X};
X
Xstatic char *after[] = {
X  "        ","     ","   ","    ",
X ",x  ",",y  ","  ",",x",",y","  ",",x)","),y",")","        "
X};
X
Xstatic char *zero_page[] = {
X  "D6510 -- 6510 Data Direction Register",  /*  0 */
X  "R6510 -- 6510 Data Register",            /*  1 */
X  "BANK -- token 'search' looks for, or bank #", /* 2 */
X  "PC_HI -- Address for BASIC sys command or monitor and long call/jump routines", /* 3 */
X  "PC_LO -- Address for BASIC sys or monitor long call/jumps", /* 4 */
X  "S_REG -- status register temp",     /* 5 */
X  "A_REG -- .A reg temp",          /* 6 */
X  "X_REG -- .X reg temp",          /* 7 */
X  "Y_REG -- .Y reg temp",          /* 8 */
X  "STKPTR,INTEGR,CHARAC -- Stack pointer temp, BASIC search character",    /* 9 */
X  "ENDCHR -- flag: scan for quote at end of string", /* a */
X  "TRMPOS -- Screen column from last tab", /* b */
X  "VERCK -- flag: 0=load, 1=verify",       /* c */
X  "COUNT -- Input buf. ptr/# of subscripts",   /* d */
X  "DIMFLG -- Flag: default array dimension",   /* e */
X  "VALTYP -- Data type: $ff=string,$00=numeric", /* f */
X  "INTFLG -- Data type: $00 = float,$80= integer",       /* 10 */   
X  "GARBFL -- flag: data scan/list quote/garbage collection",  /* 11 */
X  "DORES,SUBFLG -- flag: subscript ref./user func. call",     /* 12 */
X  "INPFLG -- Flag: $00=input,$40=get,$98=read",              /* 13 */
X  "DOMASK,TANSGN -- ??, Flag: tan sign/comparision result",   /* 14 */
X  "CHANNL",                              /* 15 */
X  "POKER,LINNUM -- temp integer value",                  /* 16 */
X  "POKER+1,LINNUM+1 -- temp integer value",              /* 17 */
X  "TEMPPT -- pointer: temp string stack",            /* 18 */
X  "LASTPT -- last temp string address",                  /* 19 */
X  "LASTPT+1 -- last temp string address",            /* 1a */
X  "TEMPST -- stack for temp strings",                /* 1b */
X  "TEMPST+1 -- stack for temp strings",                  /* $1C */
X  "TEMPST+2 -- stack for temp strings",                  /* $1D */
X  "TEMPST+3 -- stack for temp strings",                  /* $1E */
X  "TEMPST+4 -- stack for temp strings",                  /* $1F */
X  "TEMPST+5 -- stack for temp strings",                  /* $20 */
X  "TEMPST+6 -- stack for temp strings",                  /* $21 */
X  "TEMPST+7 -- stack for temp strings",                  /* $22 */
X  "TEMPST+8 -- stack for temp strings",                  /* $23 */
X  "INDEX -- utility pointer area",               /* $24 */
X  "INDEX+1 -- utility pointer area",                 /* $25 */
X  "INDEX2 -- utility pointer area",                  /* 26 */
X  "INDEX2+1 -- utility pointer area",                /* 27 */
X  "RESHO -- float. pt. product of multiply",             /* 28 */
X  "RESMOH -- float. pt. product of multiply",            /* 29 */
X  "ADDEND -- float pt. product of multiply",             /* 2a */
X  "RESMO,RESLO -- float point product of multiply",          /* 2b */
X  "??? -- floating point something",                 /* 2c */
X  "TXTTAB -- pointer: start of BASIC text",              /* 2d */
X  "TXTTAB+1 -- pointer: start of BASIC text",            /* 2e */
X  "VARTAB -- pointer: start of BASIC variables",         /* 2f */
X  "VARTAB+1 -- pointer: start of BASIC variables",       /* 30 */
X  "ARYTAB -- pointer: start of BASIC arrays",            /* 31 */
X  "ARYTAB+1 -- pointer: start of BASIC arrays",              /* 32 */
X  "STREND -- pointer: end of bASIC arrays + 1",              /* 33 */
X  "STREND+1 -- pointer: end of BASIC arrays +1",         /* 34 */
X  "FRETOP -- pointer: bottom of string storage",         /* 35 */
X  "FRETOP+1 -- pointer: bottom of string storage",       /* 36 */
X  "FRESPC -- utility string pointer",                /* 37 */
X  "FRESPC+1 -- utility string pointer +1",           /* 38 */
X  "MAX_MEM_1 -- top of string/variable bank (bank 1)",       /* 39 */
X  "MAX_MEM_1+1 -- top of string/variable bank (bank 1)",      /* 3a */
X  "CURLIN -- current BASIC line number",             /* 3b */
X  "CURLINE+1 --current BASIC line number",           /* 3c */
X  "TXTPTR  -- pointer to BASIC text used by CHRGET etc.",     /* 3d */
X  "TXTPTR+1 -- pointer to BASIC text used by CHRGET etc.",    /* 3e */
X  "FORM,FNDPNT -- used by print using, pointer to item found by search.", /* 3f  */
X  "FORM+1,FNDNT+1 -- used by print using, pointer to item found by search.", /* 40 */
X  "DATLIN -- current data line number",                  /* 41 */
X  "DATLIN+1 -- current data line number",            /* 42 */
X  "DATPTR -- current data line address",             /* 43 */
X  "DATPTR+1 -- current data line address",           /* 44 */
X  "INPPTR -- Vector: input routine",                 /* 45 */
X  "INPPTR+1 -- Vector: input routine",               /* 46 */
X  "VARNAM -- current BASIC variable name",           /* 47 */
X  "VARNAM+1 -- current BASIC variable name",             /* 48 */
X  "FDECPT,VARPNT -- ???, Pointer: current BASIC variable data",    /* 49 */
X  "FDECPT+1,VARPNT+1 -- ???, Pointer: current BASIC variable data", /* 4a */
X  "LSTPNT,FORPNT -- ???, pointer: index variable for for/next",    /* 4b */
X  "ANDMSK,EORMSK",                       /* 4c */
X  "VARTXT,OPPTR",                        /* 4d */
X  "VARTXT+1,OPPTR+1",                        /* 4e */
X  "OPMASK",                              /* 4f */
X  "GRBPNT,TEMPF3,DEFPNT",                    /* 50 */
X  "GRBPNT+1,TEMPF3+1,DEFPNT+1",                      /* 51 */
X  "DSCPNT",                              /* 52 */
X  "DSCPNT+1",                            /* 53 */
X  "???",                             /* 54 */
X  "HELPER -- flags 'help' or 'list'",                /* 55 */
X  "JMPER",                           /* 56 */
X  "JMPER+1???",                              /* 57 */
X  "OLDOV",                           /* 58 */
X  "TEMPF1,PTARG1 -- multiply defined for instr.",        /* 59 */
X  "ARYPNT,HIGHDS",                       /* 5a */
X  "PTARG2",                              /* 5b */
X  "PTARG2+1,HIGHTR",                         /* 5c */
X  "STR1",                            /* 5d */
X  "STR1+1,TEMPF2",                       /* 5e */
X  "STR1+2,DECCNT -- Number of digits after the decimal point", /* 5f */
X  "STR2,TENEXP,T0 -- ??,??, ML Monitor Z.P. storeage in FAC", /* 60 */
X  "STR2+1,GRBTOP,DPTFLG,LOWTR -- ??,??, Decimal point flag, ??", /* 61 */
X  "STR2+2,EXPSGN -- ??, part of FAC???",             /* 62 */
X  "POSITN,DSCTMP,LEFT_FLAG,FACEXP,T1 -- ??,??,paint-lft flg,FAC#1 exp.,mon. thingy", /* 63 */
X  "MATCH,RIGHT_FLAG,FACHO -- ??,paint-right flag,FAC#1 Mantissa", /* 64 */
X  "FACMOH -- FAC#1 mantissa high order",             /* 65 */
X  "INDICE,FACMO,T2: ??,FAC#1 mantissa,mon. thingy",          /* 66 */
X  "FACLO -- FAC#1 mantissa",                     /* 67 */
X  "FACSGN -- FAC#1 sign",                    /* 68 */
X  "DEGREE,SGNFLG: ??,pointer:series-eval constant",          /* 69 */
X  "ARGEXP -- FAC#2 exponent",                    /* 6a */
X  "ARGHO -- FAC#2 MAntissa",                     /* 6b */
X  "ARGMOH,INIT_AS_0 -- FAC#2 mantissa, just a count for init", /* 6c */
X  "ARGMO -- FAC#2 mantissa middle order",            /* 6d */
X  "ARGLO -- FAC#2 mantissa lo order",                /* 6e */
X  "ARGSGN -- FAC#2 sign",                    /* 6f */
X  "STRNG1,ARISGN -- ??,sign comparison result: FAC#1 vs #2",  /* 70 */
X  "FACOV  -- FAC#1 low-order (rounding)",            /* 71 */
X  "STRNG2,POLYPT,CURTOL -- ?? FBUFPT -- ptr: cassette buffer", /* 72 */
X  "STRNG2+1,POLYPT+1,CURTOL+1-- ?? FBUFPT+1 -- ptr: cassette buffer", /* 73 */
X  "AUTINC -- incrememt val. for auto (0=off)",           /* 74 */
X  "AUTINC+1 -- incrememt val. for auto (0=off)",         /* 75 */
X  "MVDFLG -- flag if 10k hires area allocated",              /* 76 */
X  "Z_P_TEMP_1 -- print using's leading zero cnter, sprite temp, mid$ temp", /* 77 */
X  "HULP,KEYSIZ -- counter,??",                   /* 78 */
X  "SYNTMP -- used as temp for indirect loads",           /* 79 */
X  "DSDESC,TXTPTR -- descriptor for ds$, monitor ZP storage",  /* 7a */
X  "DSDESC+1,TXTPTR+1 -- descriptor for ds$, monitor ZP storage", /* 7b */
X  "DSDESC+2,TXTPTR+2 -- descriptor for ds$, monitor ZP storage", /* 7c */
X  "TOS -- top of run time stack",                /* 7d */
X  "TOS+1 -- top of run time stack",                  /* 7e */
X  "RUNMOD -- flags run/direct mode",                 /* 7f */
X  "PARSTS -- DOS parser status word  POINT -- using's pointer to dec.pt", /* 80 */
X  "PARSTX",                              /* 81 */
X  "OLDSTK",                              /* 82 */
X  "COLSEL  -- current color selected",               /* 83 */
X  "MULTICOLOR_1",                        /* 84 */
X  "MULTICOLOR_2",                        /* 85 */
X  "FOREGROUND",                              /* 86 */
X  "SCALE_X -- Scale factor in X",                /* 87 */
X  "SCALE_X+1 -- Scale factor in X",                  /* 88 */
X  "SCALE_Y -- Scale factor in Y",                /* 89 */
X  "SCALE_Y+1 -- Scale factor in Y",                  /* 8a */
X  "STOPNB -- stop paint if not background/not same color",    /* 8b */
X  "GRAPNT",                              /* 8c */
X  "GRAPNT+1",                            /* 8d */
X  "VTEMP1",                              /* 8e */
X  "VTEMP2",                              /* 8f */
X  "STATUS -- I/O operation status byte",             /* 90 */
X  "STKEY -- stop key flag",                      /* 91 */
X  "SVXT -- tape temporary",                      /* 92 */
X  "VERCK -- load or verify flag",                /* 93 */
X  "C3PO -- serial buffered char flag",               /* 94 */
X  "BSOUR -- char buffer for serial",                 /* 95 */
X  "SYNO -- Cassette sync #",                     /* 96 */
X  "XSAV -- temp for BASIN",                      /* 97 */
X  "LDTND -- index to logical file",                  /* 98 */
X  "DFLTN -- default input device #",                 /* 99 */
X  "DFLTO -- default output device #",                /* 9a */
X  "PRTY -- cassette parity",                     /* 9b */
X  "DPSW -- cassette dipole switch",                  /* 9c */
X  "MSGFLG -- OS message flag",                   /* 9d */
X  "PTR1,T1 -- cassette error pass1, temporary 1",        /* 9e */
X  "PTR2,T2 -- cassette error pass 2, temporary 2",       /* 9f */
X  "TIME -- 24 hour clock in 1/60th seconds",             /* a0 */
X  "TIME+1 -- 24 hour clock in 1/60th seconds",           /* a1 */
X  "TIME+2 -- 24 hour clock in 1/60th seconds",           /* a2 */
X  "R2D2 -- serial bus usage   PCNTR -- cassette",        /* a3 */
X  "BSOUR1,FIRT -- temp used by serial routine",              /* a4 */
X  "COUNT,CNTDN -- temp used by serial routine, cassette sync countdown", /* a5 */
X  "BUFPT -- cassette buffer pointer",                /* a6 */
X  "INBIT,SHCNL -- RS232 rcvr input bit storage,cassette short count", /* a7 */
X  "BITCI,RER -- RS232 rcvr bit count,cassette read error",    /* a8 */
X  "RINONE -- RS232 rcvr flag for start bit check\n                                REZ -- Cassette reading zeros", /* a9 */
X  "RIDATA,RDFLG -- RS232 rcvr byte buffer, cassette read mode",      /* aa */
X  "RIPRTY -- RS232 rcvr parity storage,  SHCNH -- Cassette short cnt.",    /* ab */
X  "SAL -- pointer: tape buffer/screen scrolling",        /* ac */
X  "SAH -- pointer: tape buffer/screen scrolling",        /* ad */
X  "EAL -- tape end addresses / end of program",              /* ae */
X  "EAH -- tape end addresses / end of program",              /* af */
X  "CMP0 -- tape timing constants",               /* b0 */
X  "TEMP",                            /* b1 */
X  "TAPE1 -- address of tape buffer",                 /* b2 */
X  "TAPE1+1 -- address of tape buffer",               /* b3 */
X  "BITTS,SNSW1 -- RS232 trns bit count",             /* b4 */
X  "NXTBIT,DIFF -- RS232 TRNS next bit to be sent",       /* b5 */
X  "RODATA,PRP -- rs232 trns byte buffer",            /* b6 */
X  "FNLEN -- length current file name str",           /* b7 */
X  "LA -- current file logical addr",                 /* b8 */
X  "SA -- current file 2ndary addr",                  /* b9 */
X  "FA -- current file device addr",                  /* ba */
X  "FNADR -- addr current file name str",             /* bb */
X  "FNADR+1 -- addr current file name str",           /* bc */
X  "ROPRTY,OCHAR -- rs232 trns parity buffer",            /* bd */
X  "FSBLK -- cassette read block count",                  /* be */
X  "DRIVE,MYCH -- serial word buffer",                /* bf */
X  "CAS1 -- Cassette manual/cntrled switch (updated during irq)", /* c0 */
X  "TRACK,STAL -- ??, I/O start address (lo)",            /* c1 */
X  "SECTOR,STAH -- ??, I/O start address (hi)",           /* c2 */
X  "MEMUSS,TMP2 -- Cassette load temps (2 bytes)",        /* c3 */
X  "MEMUSS,TMP2 -- Cassette load temps (2 bytes)",        /* c4 */
X  "DATA -- tape read/write data",                /* c5 */
X  "BA -- bank for current load/save/verify operation",       /* c6 */
X  "FNBANK -- bank where current FN is found (at 'fnadr')",    /* c7 */
X  "RIBUF -- RS232 input buffer pointer",             /* c8 */
X  "RIBUF+1 -- RS232 input buffer pointer",           /* c9 */
X  "ROBUF -- rs232 output buffer pointer",            /* ca */
X  "ROBUF+1 -- rs232 output buffer pointer",              /* cb */
X  "KEYTAB -- keyscan table pointer",                 /* cc */
X  "KEYTAB+1 -- keyscan table pointer",               /* cd */
X  "IMPARM -- PRIMM utility string pointer",              /* ce */
X  "IMPARM+1 -- PRIMM utility string pointer",            /* cf */
X  "NDX -- index to keyboard queue",                  /* d0 */
X  "KYNDX -- pending function key flag",                  /* d1 */
X  "KEYIDX -- index into pending function key string",        /* d2 */
X  "SHFLAG -- keyscan shift key status",                  /* d3 */
X  "SFDX -- keyscan current key index",               /* d4 */
X  "LSTX -- keyscan last key index",                  /* d5 */
X  "CRSW -- <CR> input flag",                     /* d6 */
X  "MODE -- 40/80 column mode flag",                  /* d7 */
X  "GRAPHM -- text/graphic mode flag",                /* d8 */
X  "CHAREN -- RAM/ROM vic character fetch flag (bit-2)",          /* d9 */
X  "KEYSIZ,SEDSAL -- pointers for movlin",            /* da */
X  "KEYLEN,BITMSK -- temporary for tab & line wrap routines",  /* db */
X  "KEYNUM,SAVER -- another temporary place to save a reg.",   /* dc */
X  "KEYNXT,SEDEAL",                       /* dd */
X  "KEYBNK,SEDT1 -- savpos",                      /* de */
X  "KEYTMP,SEDT2 -- ?savpos?",                    /* df */
X  "PNT -- pointer to current line (text)",           /* e0 */
X  "PNT+1 -- pointer to current line (text)",             /* e1 */
X  "USER -- pointer to current line (attribute)",         /* e2 */
X  "USER+1 -- pointer to current line (attribute)",       /* e3 */
X  "SCBOT -- window lower limit",                 /* e4 */
X  "SCTOP -- window upper limit",                 /* e5 */
X  "SCLF -- window left margin",                      /* e6 */
X  "SCRT -- window right margin",                 /* e7 */
X  "LSXP -- current input column start",                  /* e8 */
X  "LSTP -- current input line start",                /* e9 */
X  "INDX -- current input line end",                  /* ea */
X  "TBLX -- current cursor line",                 /* eb */
X  "PNTR -- current cursor column",               /* ec */
X  "LINES -- maximum number of screen lines",             /* ed */
X  "COLUMNS -- maximum number of screen columns",         /* ee */
X  "DATAX -- current data to print",                  /* ef */
X  "LSTCHR -- previous char printed (for <esc> test)",        /* f0 */
X  "COLOR -- curr attribute to print (default fgnd color)",    /* f1 */
X  "TCOLOR -- saved attrib to print ('insert' and 'delete')",  /* f2 */
X  "RVS -- reverse mode flag",                    /* f3 */
X  "QTSW -- quote mode flag",                     /* f4 */
X  "INSRT -- insert mode flag",                   /* f5 */
X  "INSFLG -- auto-insert mode flag",                 /* f6 */
X  "LOCKS -- disables <shift><C=>,<ctrl>s",           /* f7 */
X  "SCROLL -- disables screen scroll, line linker",       /* f8 */
X  "BEEPER -- disables <ctrl>G",                      /* f9 */
X  "user zpg",                  /* $fa */
X  "user zpg",                  /* $fb */
X  "user zpg",                  /* $fc */
X  "user zpg",                  /* $fd */
X  "user zpg",                  /* $fe */
X  "LOFBUF"
X};
!EOR!