ATR Disk Image
Total Bytes: 92160
Number of Sectors: 720
Bytes per Sector: 128
Usable Sectors: 707 (67 free)
12 files
DOS.SYS (037 sectors)
DUP.SYS (042 sectors)
AUTOMAKE.BAS (015 sectors)
CHAOS.BAS (020 sectors)
CSET2.ACT (042 sectors)
CSETDISP.ACT (030 sectors)
CSETDISP.OBJ (040 sectors)
DEGASVUF.M65 (077 sectors)
DEGASVUF.OBJ (016 sectors)
DISKMAST.OBJ (066 sectors)
DMPT1.M65 (100 sectors)
DMPT2.M65 (155 sectors)
AUTOMAKE.BAS
1 REM *******************************
2 REM * AUTORUN.SYS MAKER *
3 REM * by David Schoch *
4 REM * *
5 REM * COPYRIGHT 1989 *
6 REM * BY ANALOG COMPUTING *
7 REM *******************************
8 REM
100 DIM A$(119):COUNT=0
110 POKE 82,0:? CHR$(125):POSITION 0,2
120 ? " AUTORUN.SYS Creator":? :? "*Input Your Command Line -119 Char Max.*";:?
130 INPUT #16,A$
140 COUNT=LEN(A$):IF COUNT=0 THEN 410
150 POKE 82,2
160 ? CHR$(125):POSITION 2,6
170 ? "Insert Disk on which you wish to"
180 ? "write new AUTORUN.SYS into Drive #1."
190 ? :? "Press START when ready...";
200 IF PEEK(53279)<>6 THEN 200
210 ? :? :? "Creating...AUTORUN.SYS...";
220 LENGHT=123+COUNT+16384
230 MSB=INT(LENGHT/256)
240 LSB=LENGHT-(MSB*256)
250 TRAP 400:OPEN #1,8,0,"D:AUTORUN.SYS"
260 RESTORE 1000
270 FOR I=1 TO 4:READ N:PUT #1,N:NEXT I
280 PUT #1,LSB:PUT #1,MSB
290 FOR I=1 TO 123:READ N:PUT #1,N:NEXT I
300 FOR I=1 TO COUNT:N=ASC(A$(I,I)):PUT #1,N:NEXT I
310 FOR I=1 TO 7:READ N:PUT #1,N:NEXT I
320 CLOSE #1
330 ? CHR$(125):END
400 TRAP 40000:? :? "ERROR-";PEEK(195):END
410 ? :? "ERROR- NO COMMANDS ENTERED":END
1000 DATA 255,255,0,64
1010 DATA 162,36,189,26,3,201,69,240,5,202,202,202,16,244,232,142,83,64,189,26,3
1020 DATA 133,203,169,65,157,26,3,232,189,26,3,133,204,169,64,157,26,3,160,0,140
1030 DATA 82,64,177,203,153,65,64,200,192,16,144,246,169,83,141,69,64,169,64,141,70
1040 DATA 64,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1050 DATA 172,82,64,185,123,64,201,155,240,6,238,82,64,160,1,96,72,138,72,174,83
1060 DATA 64,165,203,157,26,3,232,165,204,157,26,3,104,170,104,160,1,96
1070 DATA 155,226,2,227,2,0,64
32768 SAVE "D:AUTOMAKN.BAS"
CHAOS.BAS
10 REM *****************************
11 REM * CHAOS *
12 REM * by Alfredo L. Acosta *
13 REM * *
14 REM * COPYRIGHT 1989 *
15 REM * BY ANALOG COMPUTING *
16 REM *****************************
17 REM
20 GOSUB 1000
29 REM PLOT TRIANGLE
30 GRAPHICS 24:POKE 709,14:POKE 710,0:COLOR 1
40 PLOT AX,AY:PLOT BX,BY:PLOT CX,CY
49 REM PLOT INITIAL POINT
50 X=INT(RND(0)*310)+1:Y=INT(RND(0)*185)+1:PLOT X,Y
59 REM MAIN ROUTINE
60 Z=INT(RND(0)*3)+1
70 IF Z=1 THEN M=ABS(AX-X):N=ABS(AY-Y):D=AX:E=AY:GOTO 100
80 IF Z=2 THEN M=ABS(BX-X):N=ABS(BY-Y):D=BX:E=BY:GOTO 100
90 M=ABS(CX-X):N=ABS(CY-Y):D=CX:E=CY
100 IF X>D THEN X=D+M/2:GOTO 120
110 IF X<D THEN X=D-M/2
120 IF Y>E THEN Y=E+N/2:GOTO 140
130 IF Y<E THEN Y=E-N/2
140 PLOT X,Y
150 IF PEEK(53279)<>5 THEN 60
160 GOTO 2000
999 REM INITIALIZATION & TEXT
1000 DIM A$(193):POKE 712,148:POKE 752,1:? CHR$(125)
1010 AX=160:AY=176:BX=64:BY=16:CX=256:CY=BY
1020 POSITION 13,2:? "*** CHAOS ***":POSITION 5,6
1030 ? "This program will place three dots on the screen to form a triangle. ";
1040 ? "It will then place a dot randomly on the screen. From there it will randomly choose a direction ";
1050 ? "toward one of the three starting dots and place a new spot 1/2 the distance ";
1060 ? "towards it. Thislast step will be continually repeatedfrom the last new spot. ";
1070 ? "Instead of total coverage of the area within the triangle, surprising patterns emerge!"
1080 ? :? "Press SELECT to dump to printer."
1090 ? :? "Press START to begin."
1100 IF PEEK(53279)<>6 THEN 1100
1110 RETURN
1999 REM SCREEN DUMP
2000 RESTORE 3000:LPRINT CHR$(27);CHR$(64)
2010 FOR T=1 TO 61:READ Q:POKE 1535+T,Q:NEXT T:DM=PEEK(88)+PEEK(89)*256:DM=DM+40*191
2020 LPRINT CHR$(27);"3";CHR$(20):FOR V=DM TO DM+39
2030 A$=CHR$(0):A$(192)=CHR$(0):A$(2)=A$
2040 A=USR(1536,V,ADR(A$)):LPRINT CHR$(27);"K";CHR$(192);CHR$(0);A$
2050 NEXT V:END
3000 DATA 104,104,141,21,6,104,141,20,6,104,141,27,6,104,141,26,6,160,193,173,255,255,136,240,35,141,255,255,238
3010 DATA 26,6,240,21,173,20,6,56,233,40,141,20,6,144,4,24,76,19,6,206,21,6,76,19,6,238,27,6,76,33,6,96
32768 SAVE "D:CHAOSNW.BAS"
CSET2.ACT
PROC dli1()
[PHA]
chbase=$E0 ;go back to ROM set
[PLA RTI]
RETURN
PROC DliSetup()
BYTE ARRAY temp
nmien=192 ;enable interrupts
temp=sdlstl ;switch sets at
temp(14)==+128 ;text window
sdmctl=0
vdslst=dli1 ;call interrupt
sdmctl=34
RETURN
PROC TitleScreen()
Graphics(2) ;all this work to get
DliSetup() ;upper and lower case
color2=0 ;in Graphics 2!!
crsinh=1
lmargn=0
RamSet=(memtop-$400)&$FC00
chbas=RamSet RSH 8
memtop=RamSet
MoveBlock(RamSet,$E200,512)
MoveBlock(RamSet,$E000,8)
MoveBlock(RamSet+8,$E100+24,8)
MoveBlock(RamSet+40,$E100+32,8)
MoveBlock(RamSet+24,$E100+152,8)
MoveBlock(RamSet+32,$E100+168,8)
rowcrs=3
colcrs=5
PrintDE(6,"!HARACTER")
PrintDE(6," #ET")
PrintDE(6," %ISPLAY")
PrintDE(6," $TILITY")
txtrow=0
txtcol=0
PrintE(" by Dave Arlington")
PrintE(" (c) 1989 for ANALOG Computing")
PrintE("")
Print(" Insert Disk with Fonts, Press START")
DO
UNTIL consol=START OR strig0=0
OD
RETURN
PROC StashFile(BYTE filenum, col, row)
BYTE index,cnt,temp
index=(filenum-1)*8
FOR cnt=index TO index+7
DO
temp=Locate(col,row)&$7F
IF temp#32 THEN
fnames(cnt)=temp
FI
col==+1
OD
RETURN
PROC MarkFile(BYTE col, row)
BYTE mark,letter
mark=Locate(col,row)
IF mark=32 THEN
letter=Locate(col+1,row)
IF letter#160 THEN
selfiles==+1
IF selfiles<=7 THEN
color=20
Plot(col,row)
ELSE
selfiles=7
FI
FI
ELSEIF mark=20 THEN
selfiles==-1
color=32
Plot(col,row)
FI
RETURN
PROC ClearScreen()
BYTE crow, ccol, cnt
color=32
FOR crow=1 TO 20
DO
FOR cnt=0 TO 3
DO
FOR ccol=cnt*10 TO 8+cnt*10
DO
Plot(ccol,crow)
OD
OD
OD
RETURN
PROC pauz(CARD tim)
CARD cnt
FOR cnt=1 TO tim DO OD
RETURN
PROC FlipFont(BYTE col,row)
BYTE cnt, letter, let
let=Locate(col,row)
FOR cnt=0 TO 7
DO
IF let#32 THEN
letter=Locate(col+cnt,row)
IF letter#32 THEN
colcrs=col+cnt
Put(letter!$80)
colcrs=col+cnt+1
FI
ELSE
colcrs=col+cnt
Put(let!$80)
colcrs=col+cnt+1
FI
OD
RETURN
PROC SelectFiles()
BYTE oldrow, oldcol, mark
INT row, col, delay
ch=255
selfiles=0
rowcrs=22
colcrs=1
SetBlock(fnames,56,32)
Print("SPACE to view fonts ")
Print("/ RETURN New Disk")
row=1
col=1
FlipFont(row,col)
DO
IF consol=SELECT OR (stick0&2)=0 THEN
pauz(2500)
oldrow=row
oldcol=col
row==+1
IF row>20 THEN
row=1
col==+10
IF col>31 THEN
col=1
FI
FI
FlipFont(oldcol,oldrow)
FlipFont(col,row)
FI
IF consol=OPTION OR (stick0&1)=0 THEN
pauz(2500)
oldrow=row
oldcol=col
row==-1
IF row<1 THEN
row=20
col==-10
IF col<1 THEN
col=31
FI
FI
FlipFont(oldcol,oldrow)
FlipFont(col,row)
FI
IF (stick0&4)=0 THEN
pauz(2500)
oldrow=row
oldcol=col
col==-10
IF col<1 THEN
col=31
FI
FlipFont(oldcol,oldrow)
FlipFont(col,row)
FI
IF (stick0&8)=0 THEN
pauz(2500)
oldrow=row
oldcol=col
col==+10
IF col>31 THEN
col=1
FI
FlipFont(oldcol,oldrow)
FlipFont(col,row)
FI
IF consol=START OR strig0=0 THEN
pauz(10000)
MarkFile(col-1,row)
FI
UNTIL ch=12 OR ch=33
OD
IF ch=12 OR selfiles=0 THEN
ClearScreen()
rowcrs=22
colcrs=1
Print(" Insert Disk with Fonts,")
Print(" Press START ")
DO
UNTIL consol=START
OD
ch=255
ELSE
selfiles=0
FOR row=1 TO 20
DO
FOR col=0 TO 30 STEP 10
DO
mark=Locate(col,row)
IF mark=20 THEN
selfiles==+1
StashFile(selfiles,col+1,row)
FI
OD
OD
FI
RETURN
PROC FileScreen()
BYTE ARRAY name(20)
BYTE cnt, row, col, numfiles
Graphics(0)
crsinh=1
color2=$52
color1=12
PrintE("ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ")
FOR rowcrs=1 TO 20
DO
FOR colcrs=9 TO 29 STEP 9
DO
Put(124)
OD
OD
rowcrs=21
colcrs=0
PrintE("Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöœΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöœΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöœΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ")
PrintE("| |")
Print("ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ")
DO
numfiles=0
Close(1)
Open(1,"D:*.FNT",6,0)
row=1 col=1
rowcrs=row colcrs=col
DO
InputMD(1,name,20)
IF name(3)>64 THEN
numfiles==+1
FOR cnt=3 TO 10
DO
Put(name(cnt))
OD
row==+1
IF row>20 THEN
row=1
col==+10
IF col>31 THEN
col=0
FI
FI
rowcrs=row
colcrs=col
FI
UNTIL icsta>$7F OR numfiles=80
OD
Close(1)
SelectFiles()
UNTIL ch=33
OD
ch=255
RETURN
CSETDISP.ACT
;
;Character Set Display Utility
; by Dave Arlington
; COPYRIGHT 1989 BY ANALOG COMPUTING
;
;Global variables and defines
;
DEFINE RTI="$40",
PHA="$48",
PLA="$68",
TXA="$8A",
TAX="$AA",
TYA="$98",
TAY="$A8",
START="6",
SELECT="5",
OPTION="3"
BYTE dindex=$57, sdmctl=$22F,
nmien =$D40E, consol=$D01F,
chbase=$D409, chbas =$2F4,
color2=$2C6, colpf2=$D018,
rowcrs=$54, colcrs=$55,
crsinh=$2F0, lmargn=$52,
color1=$2C5, icsta =$353,
stick0=$278, strig0=$284,
ch =$2FC, iccom =$352,
txtrow=$290, selfiles,
wsync =$D40A, count,
finish
CARD savmsc=$58, sdlstl=$230,
vdslst=$200, memtop=$2E5,
icbadr=$354, icblen=$358,
txtcol=$291, RamSet
BYTE ARRAY fnames(56), filenm(20),
dlspace(512), cset(7),
cols=[$7C $4C $8C
$6C $2C $5C $9C],
dl=[112 112 112 $42 0 0 2
130 $0E 2 2 130 $0E
2 2 130 $0E 2 2 130
$0E 2 2 130 $0E 2 2
130 $0E 2 2 130 $0E
2 $0E 2 $41 0 0]
INCLUDE "D:CSET2.ACT"
PROC CIO=$E456(BYTE areg, xreg)
PROC LoadFont(BYTE ARRAY namefile
CARD addr)
Close(1)
Open(1,namefile,4,0)
iccom=7
icbadr=addr
icblen=1024
CIO(0,$10)
Close(1)
RETURN
PROC GetFont(CARD addr BYTE filenum)
BYTE letcnt
letcnt=0
Zero(filenm,20)
IF fnames(filenum*8)#32 THEN
filenm(1)='D
filenm(2)=':
WHILE fnames(filenum*8+letcnt)#32
AND letcnt<8
DO
filenm(letcnt+3)=fnames(filenum*8+letcnt)
letcnt==+1
OD
filenm(0)=letcnt+6
filenm(letcnt+3)='.
filenm(letcnt+4)='F
filenm(letcnt+5)='N
filenm(letcnt+6)='T
LoadFont(filenm,addr)
ELSE
MoveBlock(addr,$E000,8)
FI
RETURN
PROC AllocMem()
BYTE cnt
CARD temp
FOR cnt=0 TO 5
DO
temp=((memtop-$400)&$FC00)
cset(cnt)=temp RSH 8
memtop=temp
GetFont(temp,cnt+1)
OD
cset(6)=$E0
temp=((memtop-$400)&$FC00)
chbas=temp RSH 8
memtop=temp
GetFont(temp,0)
savmsc=(memtop-$500)&$F000
Zero(savmsc,1280)
RETURN
PROC Dli2()
[PHA TXA PHA TYA PHA]
count==+1
IF count=7 THEN
count=0
FI
colpf2=cols(count)
chbase=cset(count)
[PLA TAY PLA TAX PLA RTI]
RETURN
PROC DliSetup2()
nmien=192
dlspace==+256
dlspace==&$FF00
MoveBlock(dlspace,dl,39)
dlspace(4)=savmsc&$FF
dlspace(5)=savmsc RSH 8
dlspace(37)=dlspace&$FF
dlspace(38)=dlspace RSH 8
sdlstl=dlspace
vdslst=Dli2
RETURN
PROC ShowFonts()
BYTE cnt1, cnt2, cnt3
CARD temp
Graphics(0)
ch=255
sdmctl=0
AllocMem()
crsinh=1
color2=$0C
color1=2
count=6
DliSetup2()
sdmctl=34
temp=savmsc
dindex=0
IF selfiles>0 THEN
FOR cnt1=0 TO selfiles-1
DO
rowcrs=0
colcrs=0
FOR cnt2=0 TO 7
DO
Put(fnames((cnt1 LSH 3)+cnt2))
OD
PutE()
Print(" ABCDEFGHIJKLMNOPQRST")
PrintE("UVWXYZ0123456789")
PrintE(" abcdefghijklmnopqrstuvwxyz")
savmsc==+160
OD
FI
savmsc=temp+1120
rowcrs=0
colcrs=0
PrintE(" SPACEBAR to select more fonts to view ")
savmsc=temp+1200
rowcrs=0
colcrs=0
Print(" START /Trigger to Quit ")
DO
UNTIL consol=START OR strig0=0
OR ch=33
OD
IF ch=33 THEN
ch=255
finish=1
ELSE
finish=0
FI
RETURN
PROC Main()
TitleScreen()
finish=0
DO
FileScreen()
ShowFonts()
UNTIL finish=0
OD
Graphics(0)
RETURN
DEGASVUF.M65
*SAVE#D:DEGASVUF.M65
*ASM,#-,#D:DEGASVUF.COM
* Degas *FULL* View, by Mat*Rat
*
* This program will load a degas
* high resolution, .PI3 format
* picture file and display 1/4
* of it on 4 different pages
* of 130XE (or compatible upgrade
* upgrade XL), in Graphics mode 8.
* The software will then FLIP through
* them as fast as possible. Other
* keyboard control options are
* as follows:
*
* -- Key commands --
* 1 - Display 1/4 of graphic, 1st page
* 2 - second page
* 3 - third page
* 4 - fourth page
* F - full display speed, not real useful
* H - show half image, alternate screens 1 & 3, 30 Hertz
* S - show half image, alternate screens 2 & 4, 30 Hertz
* N - Normal display, show all 4 screens, 15 hertz
* SPACE - Invert display, show at normal speed
* screen will stay inverted, until inverted again
* RETURN - Exit to main menu for another picture selection
* ESCAPE - Exit program
*
* At filename input prompt, press ESC twice, then return
* to exit from there
*
* >>>BEWARE<<< Don't expect to run
* this with SpartaDOS X Cartridge.
* SDX likes all those RAM banks.
* Go mucking about with them and
* you are going to CRASH dude!
* Important addresses for
* loader program:
ESCAPE = 27
SCREEN = $E0
* Byte splitting registers
SHIFT1 = $E2
SHIFT2 = $E3
SHIFT3 = $E4
SHIFT4 = $E5
SAVEX = $E6
BANKSCR = $4000 ;16K IS ADDR
BANKSCR1 = $5000
SCAN1 = 99
SCAN2 = 99
* Page bank select values
PAGE1 = 193
PAGE2 = 193 +4
PAGE3 = 193 +8
PAGE4 = 193 +12
MAIN = 241
* Bank select register
BANKSEL = 54017
BLANK4 = 48
BLANK5 = 64
.ORG $3200
LINECOUNT .BYTE 0
EXFLG .BYTE 0
.OPT OBJ
* Mat*Rat's customized system equates
.INCLUDE #D:SYSEQU.M65
* Mac/65's IO Macros library
.INCLUDE #D:IOMAC.LIB
* Mat*Rat's Graphics routine
.INCLUDE #D:GRAPHICS.M65
* 2 line graphic buffer
BUF160 .DS 160
* Custom display list work area
DISPLAY .BYTE 112 ,48 ,79
.WORD BANKSCR
DLA .DS SCAN1 ; 15'S GO HERE
.BYTE 79 ; SKIP 4K BOUNDARY
.WORD BANKSCR1
DLB .DS SCAN2 ; ANOTHER 104 MODE 8 LINES
.BYTE 65
.WORD DISPLAY
.BYTE 0 ,0 ,0 ,0
* Working filename for parsing
FILEN .BYTE "D1:FILENAME.EXT",155 ,0
* Default directory spec
FILSPEC .BYTE "D1:*.PI3",155 ,0
* Initialize custom, 200 line
* graphics mode 8 display
* list for starters
INIZ LDX #0 ; Setup display list
LDA #15
INIZ1 STA DLA,X
INX
CPX #SCAN1
BNE INIZ1
LDX #0
INIZ2 STA DLB,X
INX
CPX #SCAN2
BNE INIZ2
* Clear screen, show title
* and Start DEGAS VIEW program
START
GRAPHICS 0
LDA #0
STA 710
* Get drive number first
* or accept default displayed
* by pressing return only
CLOSE 1
PRINT 0 ," Degas View, By Mat*Rat, (c) Analog "
PRINT 0 ,FILSPEC
PRINT 0 ,"[RETURN] = Keep default shown above."
PRINT 0 ,"Drive # Degas .PI3 files are on ?"
INPUT 0 ,FILENAME,2
LDA FILENAME
CMP #155
BEQ NONEWDR
STA FILSPEC+1
* Open a directory listing
* and display it
NONEWDR OPEN 1 ,6 ,0 ,FILSPEC
TYA
BMI NOFILE
NEXTFILE INPUT 1 ,FILENAME
TYA
BMI NOFILE
PRINT 0 ,FILENAME
JMP NEXTFILE
* Request filename to view
* [RETURN] only restarts, allowing
* the user to change drive spec
* ESCAPE will exit the program to DOS
* Or type filename (no drive or ext reqd) to load
NOFILE
CLOSE 1
PRINT 0 ,"Graphics file to load ?"
PRINT 0 ,"[RETURN] = Restart, new drive"
PRINT 0 ,"Double [ESC] and [RETURN] exits."
INPUT 0 ,FILENAME,128
CLOSE 1
LDA FILENAME
CMP #ESCAPE
BEQ ESCEXIT
CMP #155
BNE GETFILE
JMP START
ESCEXIT GRAPHICS 0
PRINT 0 ,"Degas View by Mat*Rat"
RTS
* Parse the filename
* If no drive letter or number
* prefixed, insert those
* If no extender, paste on .PI3
GETFILE LDA FILENAME
LDX #0
LDY #0 ; EXTENDER FOUND FLAG
STY EXFLG
CMP #':
BEQ GETF1
LDA FILENAME+1
CMP #':
BEQ GETF1
LDA #'D
STA FILEN
LDA FILSPEC+1
STA FILEN+1
LDA #':
STA FILEN+2
LDY #3
* If a '.' is in the filename
* don't mess with the extender
GETF1 LDA FILENAME,X
STA FILEN,Y
INX
INY
CMP #155
BEQ GETF2
CMP #'.
BNE GETF1
INC EXFLG
JMP GETF1
GETF2 LDA EXFLG
BNE GETF3
DEY
LDA #'.
STA FILEN,Y
INY
LDA #'P
STA FILEN,Y
INY
LDA #'I
STA FILEN,Y
INY
LDA #'3
STA FILEN,Y
INY
LDA #155
STA FILEN,Y
GETF3 PRINT 0 ,FILEN
OPEN 1 ,4 ,0 ,FILEN
TYA
BPL LOADIT
* Bad filename or drive?
* Restart the program
PRINT 0 ,"File error, press RETURN"
LDA #255
HOLD CMP CH
BEQ HOLD
STA CH
JMP START
LOADIT
* Let OS setup the GRAPHICS 24
* originally, to get all system
* variables set properly
* Then point to custom display
* list and memory.
GRAPHICS 24
LDA #<DISPLAY
LDX #>DISPLAY
LDY JIFFY
LOADIT1 CPY JIFFY
BEQ LOADIT1
STA 560
STX 561
LDA #<BANKSCR
STA SAVMSC
LDA #>BANKSCR
STA SAVMSC+1
LDA #SCAN1+SCAN2+2
STA LINECOUNT
* Forget the 34 byte Degas header
BGET 1 ,BUF160,34 ; Get and forget header
TYA
BPL CNTNU
CLOSE 1
GRAPHICS 0
PRINT 0 ,"LOAD ERROR"
RTS
* Setup screen RAM pointers
CNTNU
LDA SAVMSC
STA SCREEN
LDA SAVMSC+1
STA SCREEN+1
LDA #10
STA 710
LDA #0
STA 709
LDA #4
STA 712
* Get next 2 screen lines of picture data
GLINE BGET 1 ,BUF160,160 ; Read a line
TYA
BPL GLINE2
GLINE1 LDX #MAIN
STX BANKSEL
GRAPHICS 0
CLOSE 1
PRINT 0 ,"File input error"
RTS
GLINE2 LDX #0 ; Buffer index
* SHIFT1 will hold even pixels for even lines
* SHIFT2 will hold odd pixels for even lines
GLINE3 LDA BUF160,X
LDY #4
CLC
GLINE4 ROL A
ROL SHIFT1
ROL A
ROL SHIFT2
DEY
BNE GLINE4
CLC
LDY #4
* SHIFT3 will hold even pixels for odd lines
* SHIFT4 will hold odd pixels for odd lines
LDA BUF160+80 ,X
GLINE4A ROL A
ROL SHIFT3
ROL A
ROL SHIFT4
DEY
BNE GLINE4A
INX
LDA BUF160,X
LDY #4
CLC
GLINE5 ROL A
ROL SHIFT1
ROL A
ROL SHIFT2
DEY
BNE GLINE5
LDY #4
CLC
LDA BUF160+80 ,X
GLINE5A ASL A
ROL SHIFT3
ASL A
ROL SHIFT4
DEY
BNE GLINE5A
STX SAVEX
LDX #PAGE1
* Stuff pixel data in PAGE1 bank
* and main bank. Use PAGE1,2,3,4
* for computational convenience
* Shove copy of PAGE1 in MAIN
* so display doesn't flash garbage
* during keyboard inputs.
*
* Stuff appropriate shift bytes
* into proper pages, as enabled.
STX BANKSEL
LDA SHIFT1
STA (SCREEN),Y
LDX #MAIN
STX BANKSEL
STA (SCREEN),Y
LDX #PAGE2
STX BANKSEL
LDA SHIFT2
STA (SCREEN),Y
LDX #PAGE3
STX BANKSEL
LDA SHIFT3
STA (SCREEN),Y
LDX #PAGE4
STX BANKSEL
LDA SHIFT4
STA (SCREEN),Y
INC SCREEN
BNE CHKDN
INC SCREEN+1
* Restore buffer index and check
* if done reading picture file.
CHKDN LDX SAVEX
INX
CPX #80
BEQ UPDLINE
JMP GLINE3
UPDLINE
DEC LINECOUNT
BEQ SHOIT0
LDA LINECOUNT
CMP #100
BNE JMGL
LDA #<BANKSCR1
STA SCREEN
LDA #>BANKSCR1
STA SCREEN+1
JMGL
JMP GLINE
* Display routine
* Enable respective banks
* Stick BLANK4 lines command in
* display list for even line pages
* and BLANK5 for odd line pages
* This is done to minimixe vertical
* jitter during page flipping.
* Horizontal jitter is not eliminated,
* however, as it would require some
* extra fancy bit shifting at load
* time. Not fun.
*
SHOIT0 CLOSE 1
SHOIT LDX #PAGE1
LDY #BLANK4
SHOIT1A LDA JIFFY
SHOIT1 CMP JIFFY
BEQ SHOIT1
STX BANKSEL
STY DISPLAY+1
INX
INX
INX
INX
CPX #PAGE3
BNE SHOIT2
LDY #BLANK5
SHOIT2 LDA CH
CMP #255
BNE SHOIT3
CPX #PAGE4+4
BEQ SHOIT
BNE SHOIT1A
* Always re-enable MAIN bank
* before exiting any display loop!
SHOIT3 LDX #MAIN
STX BANKSEL
* Process key command
* ESCAPE - Exit to dos
* 1 - Display static screen, page 1 only
* 2 - Display page 2
* 3 - Display page 3
* 4 - Display page 4
* H - Show half of image, flip screens
* 1 & 3 at 30 hertz
* S - Show half of image, flip screens
* 2 & 4 at 30 hertz
* F - Fastest display possible, a bit
* useless, but easy enuf to throw in
* N - Normal display (SHOIT above)
* SPACE - Invert displays, swap color registers, simple
*
* Any other key loops back to START
HOLDIT CLOSE 4
OPEN 4 ,4 ,0 ,"K:"
TYA
BPL HOLDNOW
CLOSE 4
JMP START
HOLDNOW BGET 4 ,FILENAME,1
LDA FILENAME
* SPACE - Invert display?
CMP #32 ; SPACE?
BNE CKSCL
JMP INVERT
* (H)alf display, 1&3 ?
CKSCL CMP #'H
BNE CKSNRM
JMP SHOHALF
* (N)ormal display, 4 pages?
CKSNRM CMP #'N
BNE CKSFAST
JMP SHOIT
* (F)astest possible flipping?
CKSFAST CMP #'F
BNE CKSCS
JMP FASTEST
CKSCS
* (S)how half, pages 2&4?
CMP #'S
BNE CK1
JMP SHOSECHAF
* (1)-show screen 1 only?
CK1 CMP #'1
BNE CK2
LDX #PAGE1
BNE SVPG
* (2)-show screen 2 only?
CK2 CMP #'2
BNE CK3
LDX #PAGE2
BNE SVPG
* (3)-show screen 3 only?
CK3 CMP #'3
BNE CK4
LDX #PAGE3
BNE SVPG
* (4)-show screen 4 only?
CK4 CMP #'4
BNE CKESC
LDX #PAGE4
SVPG STX BANKSEL
LDX #255
SVPG1 CPX CH
BEQ SVPG1
LDX #MAIN
STX BANKSEL
JMP HOLDNOW
* (ESCAPE) from the program?
CKESC CMP #ESCAPE
BNE RESTART
CLOSE 4
PRINT 0 ,"Degas View by Mat*Rat, (c) Analog"
RTS
RESTART CLOSE 4
JMP START
* INVERT routine - swap color
* registers 709 & 710
INVERT LDA 710
PHA
LDA 709
STA 710
PLA
STA 709
JMP SHOIT
* Show (H)alf, pages ! & 3
SHOHALF LDX #PAGE1
LDA JIFFY
SHOH1 CMP JIFFY
BEQ SHOH1
STX BANKSEL
LDX #PAGE3
LDA JIFFY
SHOH2 CMP JIFFY
BEQ SHOH2
STX BANKSEL
LDX CH
CPX #255
BEQ SHOHALF
LDX #MAIN
STX BANKSEL
JMP HOLDNOW
* (S)how half, pages 2 & 4
SHOSECHAF LDX #PAGE2
LDA JIFFY
SHOS1 CMP JIFFY
BEQ SHOS1
STX BANKSEL
LDX #PAGE4
LDA JIFFY
SHOS2 CMP JIFFY
BEQ SHOS2
STX BANKSEL
LDX CH
CPX #255
BEQ SHOSECHAF
LDX #MAIN
STX BANKSEL
JMP HOLDNOW
* Show all screens (F)astest
FASTEST LDA #255
FASTEST1 LDX #PAGE1
STX BANKSEL
LDX #PAGE2
STX BANKSEL
LDX #PAGE3
STX BANKSEL
LDX #PAGE4
STX BANKSEL
CMP CH
BEQ FASTEST1
LDX #MAIN
STX BANKSEL
JMP HOLDNOW
*= $02E0
.WORD INIZ
DMPT1.M65
;SAVE#D:DMPT1.M65
.OPT NOLIST
;----------------------------
;
;Disk Master
;the Disk Editor/Disassembler
;
; (C) 1989 BY ST-LOG
;
;by: Barry Kolbe
;and Bryan Schappel
;
;----------------------------
;
*= 0
PASS .= PASS+1
.IF PASS=1
.INCLUDE #D:SYSEQU.M65
.ENDIF
;
;Zero Page Usage
;
*= $80
Y1 .DS 1 ;save x/y hold
Y2 .DS 1 ;areas
Y3 .DS 1
X1 .DS 1
X2 .DS 1
X3 .DS 1
TMP1 .DS 1 ;temp variables
TMP2 .DS 1
TMP3 .DS 1
AIFLAG .DS 1 ;asc/internal
T .DS 2 ;pntr
L .DS 2 ;pntr
CTMP .DS 1 ;extra temp
SECL .DS 1 ;sec # lo
SECH .DS 1 ;sec # hi
UNITS .DS 1 ;units digit
TENS .DS 1 ;tens digit
IV .DS 1 ;inverse flag
HDF .DS 1 ;hex/dex flag
ICNT .DS 1 ;counter
NMD .DS 1
TOTD .DS 1
HXL .DS 1 ;hex lo
HXH .DS 1 ;hex hi
HXORST .DS 1 ;hex/string
FBYTE .DS 1 ;first byte
MATFLG .DS 1 ;match flag
LNKLO .DS 1 ;link lo
LNKHI .DS 1 ;link hi
SSECL .DS 1 ;save sec lo
SSECH .DS 1 ;save sec hi
DENSITY .DS 1 ;density flag
SRCDRV .DS 1 ;source drive
DESDRV .DS 1 ;dest'n drive
ADDR .DS 2 ;disa address
INDR .DS 2 ;pointer
OP .DS 1 ;first disa byte
DTEMP .DS 2 ;next 2 bytes
NBYTE .DS 1 ;# instr bytes
HXDC .DS 1 ;hex/dec flag
ADD_ON .DS 1 ;address offset
LOC_S .DS 2 ;address start
LOC_E .DS 2 ;address end
CNTLO .DS 2 ;counter
DINS .DS 2 ;disa hold
IMODE .DS 1 ;input mode
MAXLEN .DS 1 ;max length
SRFLG .DS 1 ;srch data flag
INPLOC .DS 2 ;input loc
BYTCNT .DS 2 ;segment cnt
GETPTR .DS 1 ;sec offset
STLOAD .DS 2 ;start load
ENLOAD .DS 2 ;end load
TYPE .DS 1 ;disa/file
LABELS? .DS 1 ;label flag
S.SIZE .DS 1 ;sector size
BUFPNT .DS 2 ;output pntr
LINES .DS 1 ;#line in bigbuf
BYTES .DS 1 ;bytes gotten
SFLAG .DS 1 ;source flag
SECCNT .DS 2 ;sector count
SECBYTES .DS 1 ;bytes/sector
SM = $2800 ;screen memory
LINE0 = SM+16 *40 ;text window
BIGBUF = $8000 ;P: buffer
PRNBUF = $03C0
;
;PRINT macro
;
.MACRO PRINT
LDA #<%%1
LDY #>%%1
JSR EPRINT
.ENDM
;
;Work Buffers
;
*= $2C00
MYBUF .DS 128 ;sec work buf
DSBUF .DS 128 ;data buffer
INPLIN .DS 40 ;input line
SRBUF .DS 45 ;search buffer
IBUF .DS 45 ;input buffer
SRCFILE .DS 20 ;source file
DSTFILE .DS 20 ;dest'n file
;
;Program Start
;
*= $3000 ;origin
START JMP INTRO ;go intro!
;
;Intro Display List
;
INDL .BYTE $70 ,$70 ,$70 ,$70 ,$70
.BYTE $70 ,$70 ,$70 ,$70 ,$46
.WORD CREDIT
.BYTE $70 ,$42
.WORD IL0
.BYTE $02 ,$70 ,$06 ,$20
.BYTE $06 ,$20 ,$06 ,$41
.WORD INDL
;
;Info Display List
;
INFODL .BYTE $70 ,$70 ,$70 ,$46
.WORD CR2
.BYTE $06 ,$40 ,$42
.WORD SM+40
.BYTE $02 ,$02 ,$02 ,$02 ,$02
.BYTE $02 ,$02 ,$02 ,$02 ,$41
.WORD INFODL
;
;Disassembler Display List
;
DISADL .BYTE $70 ,$70 ,$70 ,$46
.WORD CR2
.BYTE $20 ,$42
.WORD INFOLN
.BYTE $20 ,$00 ,$42
.WORD SM
.BYTE $02 ,$02 ,$02 ,$02 ,$02
.BYTE $02 ,$02 ,$02 ,$02 ,$02
.BYTE $02 ,$02 ,$02 ,$02 ,$02
.BYTE $02 ,$02 ,$02 ,$02 ,$02
.BYTE $41
.WORD DISADL
;
IL0 .SBYTE " by: Barry Ko"
.SBYTE "lbe and Bryan S"
.SBYTE "chappel "
.SBYTE " Produced for:"
.SBYTE " A.N.A.L.O.G. C"
.SBYTE "omputing "
.SBYTE "option di"
.SBYTE "sk editor "
.SBYTE "select di"
.SBYTE "sassembler"
.SBYTE " start ex"
.SBYTE "it "
;
INFOLN .SBYTE " MNE Operand"
.SBYTE " ADDR "
.SBYTE "B1 B2 B3 "
;
;Disassembler prompts
;
P0 .BYTE "Disa Type [F/D]",0
P3 .BYTE "Dest'n [E/P/Dn]",0
P4 .BYTE " Labels [Y/N]",0
P5 .BYTE " Source File",0
P1 .BYTE "Src Drive [1-8]",0
P2 .BYTE " Density [1-2]",0
P6 .BYTE " Sector [1-2D0]",0
P7 .BYTE " # of Sectors",0
P8 .BYTE " Offset [0-7F]",0
P9 .BYTE "Origin [0-FFFF]",0
PA .BYTE "Byt/Sec [7D/80]",0
;
;INCLUDE Support Files
;
.INCLUDE #D1:DMPT2.M65
.INCLUDE #D1:DMPT3.M65
.INCLUDE #D1:DMPT4.M65
;
;Intro Screen
;
INTRO CLD ;chill decimal
LDX #$FF ;clear stack
TXS
LDA POKMSK
AND #$7F
STA POKMSK
STA IRQEN
LDA #<INDL ;turn on the
STA SDLSTL ;intro display
LDA #>INDL ;list.
STA SDLSTL+1
LDA #$22 ;normal PF
STA SDMCTL
LDA #$0A ;white text
STA COLOR1
LDA #$00 ;black border
STA COLOR4
LDA #2 ;grey backgrnd
STA LMARGN ;left marg=2
STA COLOR2
LDA #$94 ;blue gr1 text
STA COLOR3
I_LOOP LDA CONSOL ;get consol
CMP #6 ;start?
BNE T_5 ;no.
JMP WARMSV ;yes, so long!
T_5 CMP #5 ;select?
BEQ GO_DIS ;yes. disa.
CMP #3 ;option?
BNE I_LOOP ;no, loop
JMP DISKED ;Disk Editor.
;
;Disassembler Data Entry
;
GO_DIS LDA #<INFODL ;install
STA SDLSTL ;the data
LDA #>INFODL ;entry DLIST
STA SDLSTL+1
JSR CLRSCN ;clear screen
LDA #<P0 ;point to the
STA INDR ;first prompt
LDA #>P0
STA INDR+1
JSR PROMPT ;Disk/Files
;
P00 JSR GETONE ;get input
BCC P01 ;ok?
GO_INT JMP INTRO ;no way.
;
P01 LDA IBUF ;get char
AND #223 ;make upper/norm
LDX #0 ;0=files
CMP #'F ;was it F?
BEQ P02 ;yes!
CMP #'D ;a D?
BNE P00 ;no.
INX ;up flag
P02 STX TYPE ;save type
;
JSR PROMPT ;dest'n device
P30 JSR GETFN ;get name
BCS GO_INT ;bad input
LDY #20 ;copy to pos 20
JSR CHECKFN ;check filename
BCS P30 ;oops, bad one.
JSR G.DRV ;get drive #
STA DESDRV ;save it.
;
JSR PROMPT ;want labels?
P40 JSR GETONE ;get response.
BCS GO_INT ;bad one.
LDA IBUF ;get char
AND #223
LDX #0 ;0=labels.
CMP #'Y ;a Y?
BEQ P41 ;yes.
CMP #'N ;try N?
BNE P40 ;no.
INX ;1=no labels
P41 STX LABELS? ;save choice
;
LDA TYPE ;files or disk?
BNE F_SECS ;want disk.
JSR PROMPT ;filename
;
P50 JSR GETFN ;get filename
G.0 BCS GO_INT ;bad one.
LDY #0 ;posit 0
JSR CHECKFN ;check Fname
BCS P50 ;oops.
JSR G.DRV ;get drive
STA SRCDRV ;save it.
JMP DIS_IT ;and disa!
;
F_SECS JSR UP_INDR ;skip fname
JSR PROMPT ;source drive
P10 JSR GETONE ;get response
BCS GO_INT ;bad one.
LDA IBUF ;get the char
AND #$7F
SEC ;make 1-8
SBC #'0
BMI P10 ;<0? yes!
CMP #9 ;=>9?
BCS P10 ;yes.
STA SRCDRV ;save it
;
JSR PROMPT ;density
P20 JSR GETONE ;input.
G.1 BCS G.0 ;bad input.
LDA IBUF ;get char
AND #$7F ;mask inverse
SEC ;make 0-1
SBC #'1
BMI P20 ;<0?, yes.
CMP #2 ;>1?
BCS P20 ;yes.
STA DENSITY ;save density
TAX ;X=A
LDA SDLO,X ;get max sec #
STA FR0 ;and put it in
LDA SDHI,X ;FR0.
STA FR0+1
JSR BIN2HEX ;make hex.
LDY #1 ;copy max #
D.CP LDA LBUFF,Y ;into the next
STA P6+10 ,Y ;prompt.
INY
CPY #4
BNE D.CP
;
JSR PROMPT ;sector
P60 JSR SPC_NUM ;get number
BCS G.1
JSR TESTFR0 ;in range?
BCS P60 ;no.
LDA FR0 ;yes, so we
STA SECL ;save the sector
LDA FR0+1 ;number for
STA SECH ;later.
;
JSR PROMPT ;#secs
P70 JSR SPC_NUM ;get number
G.2 BCS G.1 ;bad one.
LDA FR0 ;is number 0?
ORA FR0+1
BEQ P70 ;yes, that's bad
LDA FR0 ;save the number
STA SECCNT ;of sectors for
CLC ;later & add on
ADC SECL ;start sector
STA FR0 ;so we can test
LDA FR0+1 ;to see if too
STA SECCNT+1 ;many sec's
ADC SECH ;will be read.
STA FR0+1
JSR TESTFR0 ;in range?
BCS P70 ;no way.
;
JSR PROMPT ;offset
P80 JSR SPC_NUM ;get number
BCS G.2
LDA FR0+1 ;test hi byte
BNE P80 ;>? yes!
LDA FR0 ;get lo byte
CMP #$80 ;=> $80?
BCS P80 ;yes.
STA GETPTR ;save for later
;
JSR PROMPT ;origin
P90 JSR SPC_NUM ;get number
BCS G.2
LDA FR0 ;copy the num
STA ADDR ;into the addr
LDA FR0+1 ;for the disa-
STA ADDR+1 ;ssembler.
;
JSR PROMPT ;sector size.
PA0 JSR SPC_NUM ;get number
BCS G.2
LDA FR0+1 ;no hi byte
BNE PA0 ;allowed!
LDA FR0 ;test lo byte
CMP #125 ;125 bytes?
BEQ G.SZ ;yes!
CMP #128 ;128 bytes?
BNE PA0 ;no.
G.SZ STA S.SIZE ;save size
;
;Disassembly Entry Point
;
DIS_IT JSR CLRSCN ;zap screen
STY SFLAG ;clear flag
LDA #<DISADL ;install the
STA SDLSTL ;disa DLIST
LDA #>DISADL
STA SDLSTL+1
JSR OPENIN ;open input
JSR OPENOUT ;open output
;
D_LOOP JSR DISAMEM ;do instr.
JSR PRINT.IT ;print it
LDA #0 ;clear counter
STA BYTES
LDX #$FF ;get a $FF
C_LOOP LDA CH ;key press?
CMP #$FF
BEQ D_LOOP ;no.
STX CH ;clear CH
CMP #28 ;escape?
BNE T.SPC ;no.
END.IT STX CH ;clear CH and
JMP D_OVER ;exit.
;
T.SPC CMP #33 ;Space=pause
BNE D_LOOP
;
K.WAIT LDA CH ;get keypress
CMP #28 ;escape?
BEQ END.IT ;yes, exit
CMP #33 ;wait for SPC
BNE K.WAIT ;to stop the
STX CH ;pause.
JMP D_LOOP ;loop again.
;
;Get drive number
;
G.DRV LDA IBUF+1 ;get char
SEC ;set carry
SBC #'0 ;subtract '0
RTS ;and leave
;
;E: Print routine
;
EPRINT STA E.LP+1 ;save lo byte
STY E.LP+2 ;save hi byte
E.LP LDA $FFFF ;get char
BEQ E.DN ;if 0, all done
JSR E.PUT ;put the char
INC E.LP+1 ;bump pointer
BNE E.LP
INC E.LP+2
BNE E.LP ;and loop
E.DN RTS ;so long.
;
;E: Put byte routine
;
E.PUT CMP #EOL ;is it a CR?
BNE E.EOL ;no.
PUTCR LDA LMARGN ;set xpos to
STA COLCRS ;the margin
INC ROWCRS ;bump ypos
JMP SCROLL ;check scroll
;
E.EOL JSR ASC2IC ;make icode
PHA ;save it
LDY ROWCRS ;get ypos
LDA GL,Y ;look up the
STA L ;address of this
LDA GH,Y ;line and store
STA L+1 ;in temp area
PLA ;get char back
LDY COLCRS ;get xpos
STA (L),Y ;on screen!
;
INY ;up xpos
CPY #39 ;at rmargn?
BCC E.LV ;no.
BEQ E.LV ;just there.
INC ROWCRS ;next line
JSR SCROLL ;scroll screen
LDY LMARGN ;get margin
E.LV STY COLCRS ;set xpos
RTS ;and leave
;
;Check to see if screen must
;be scrolled.
;
SCROLL LDY ROWCRS ;get ypos
CPY #21 ;at line 21?
BCC S.NO ;no.
LDA #<SM ;get the addrs
STA T ;of line 0 & 1
LDA #>SM
STA T+1
LDA #<[SM+40 ]
STA L
LDA #>[SM+40 ]
STA L+1
LDX #0 ;line counter
S.M1 LDY #39 ;now move 1 line
S.M2 LDA (L),Y ;up 40 bytes
STA (T),Y
DEY
BPL S.M2
LDA L+1 ;now update the
STA T+1 ;pointers.
LDA L
STA T
CLC
ADC #40
STA L
LDA L+1
ADC #0
STA L+1
INX ;up line count
CPX #21 ;at end?
BNE S.M1 ;no way.
DEC ROWCRS ;dec ypos
S.NO RTS ;and leave
;
;Print a Prompt
;
PROMPT JSR PUTCR ;print CR
LDA #$40 ;force uppercase
STA SHFLOK
LDA #0 ;and no inverse
STA INVFLG
LDA INDR ;get addr of
LDY INDR+1 ;the prompt
JSR EPRINT ;print it
LDA #': ;put a ':'
JSR E.PUT
LDA #$20 ;and a space
JSR E.PUT
JSR G_SCR ;clear line
UP_INDR LDA INDR ;add 16 to get
CLC ;to the next
ADC #16 ;prompt.
STA INDR
BCC UP_HI
INC INDR+1
UP_HI RTS ;so long.
G_SCR LDA COLCRS ;get xpos
LDY ROWCRS ;and ypos
CLC ;add line addr
ADC GL,Y
STA INPLOC
LDA GH,Y
ADC #0
STA INPLOC+1
LDY #20 ;zap 21 chars
LDA #0 ;a space
G_CLR STA (INPLOC),Y ;on screen
DEY ;down counter
BPL G_CLR ;and loop
RTS ;so long.
;
;Get 1 byte via INPUT
;
GETONE JSR G_SCR ;clear line
LDY #0 ;force text mode
STY IMODE
INY ;1 char
JMP INPUT ;get input
;
;Get a Filename
;
GETFN JSR G_SCR ;zap line
LDY #0 ;force text mode
STY IMODE
LDY #15 ;get 15 chars
JMP INPUT
;
;Special get number
;
SPC_NUM JSR G_SCR ;zap line
JMP G_NUM ;get a number
;
;Test FR0 for sector range
;
TESTFR0 LDA FR0 ;is FR0 a 0?
ORA FR0+1
BEQ T.ERR ;yes!
LDX DENSITY ;get density
LDA FR0+1 ;check to see
CMP SDHI,X ;if the sector
BCC T.GD ;number in FR0
BEQ T.LO ;is allowed.
BCS T.ERR
T.LO LDA FR0
CMP SDLO,X
BCC T.GD
BEQ T.GD
T.ERR SEC ;signal error
RTS
T.GD CLC ;signal good
RTS
;
;Check Filename for Dx:
;
CHECKFN LDA IBUF ;get 1st char
CMP #EOL ;is it EOL?
BEQ CH.B ;yes.
CMP #'D ;is it 'D'?
BEQ FN.D ;yes.
CMP #'P ;is it 'P'?
BEQ CH.C ;yes.
CMP #'E ;is it 'E'?
BNE CH.B ;no.
CH.C LDA #': ;make 2nd char
STA IBUF+1 a ':' and the
LDA #EOL ;3rd char an EOL
STA IBUF+2
CH.R LDX #0 ;zero index
CH.L LDA IBUF,X ;get input char
STA SRCFILE,Y ;save in buf
INY ;up buf index
INX ;up input indx
CPX #20 ;done 20 yet?
BNE CH.L ;no.
CLC ;signal good.
RTS ;and leave.
;
FN.D LDA IBUF+2 ;get 3rd char
CMP #': ;3rd char a ':'?
BNE CH.B ;no, bad name
LDA IBUF+1 ;get drive #
CMP #'1 ;less than 1?
BCC CH.B ;yes.
CMP #'9 ;greater than 8?
BCC CH.R
CH.B SEC ;signal bad
RTS
;
;Dump Editor Screen to Printer
;
DMPSCN JSR PRNLFD
BMI PRERR
LDA #<BORDER ;print top
LDY #>BORDER ;border
JSR DMPSUB
BMI PRERR
LDA #0 ;count lines
STA T ;of sectr info
DMLP LDX T ;get index
LDA GL,X ;Lo/Hi bytes
LDY GH,X ;line address
JSR DMPSUB ;print it
BMI PRERR
INC T ;next line
LDA T
CMP #16 ;done 16?
BNE DMLP ;nope
LDA #<STATUS ;print
LDY #>STATUS ;status line
JSR DMPSUB
BPL DMOK ;Y has error
PRERR JMP IOERR ;dble return
DMOK RTS
;
;Printer Linefeed
;
PRNLFD LDA #$20
STA PRNBUF
LDA #EOL
STA PRNBUF+1
BNE SAP
;
;Print a Line using SIO
;
DMPSUB STA L ;save address
STY L+1 ;for indirect
LDY #0
DML LDX #0 ;use as an
STX TMP1 ;inverse flag
LDA (L),Y ;get byte
BPL DMJ ;inversed?
INC TMP1 ;yes-set flag
DMJ AND #$7F ;mask it off
CMP #123 ;skip control
BCS PERD ;characters
CMP #96
BCS PRK
CMP #64
BCS PERD
CLC ;change to
ADC #$20 ;ATASCII
PRK LDX TMP1 ;was it inverse?
BEQ PORK ;no
ORA #$80 ;add back in
BNE PORK
PERD LDA #'. ;'.' for contrls
PORK STA PRNBUF,Y ;into buffer
INY
CPY #$27 ;done w/line?
BNE DML ;no
LDA #EOL ;add EOL
STA PRNBUF+$27
;
SAP LDX #$0B ;copy cmds
SIP LDA PSIOCB,X ;to DDEVIC
STA $0300 ,X
DEX
BPL SIP
JSR SIOV ;let SIO print
RTS
;
PSIOCB .BYTE $40 ;printer
.BYTE $01 ;unit 1
.BYTE $57 ;write
.BYTE $80 ;send bit 7=out
.WORD PRNBUF ;buffer
.WORD $30 ;time out
.WORD $28 ;buf length
.BYTE $4E ;normal prnt
.BYTE $00 ;unused
;
;Get Label Data
;
.INCLUDE #D:DMPT5.M65
;
;Find where program ends
;
.OPT LIST
ENDPROG = *
.OPT NOLIST
;
;Add Run address
;
*= RUNAD
.WORD START
.END
DMPT2.M65
;SAVE#D:DMPT2.M65
.OPT NOLIST
;
;--------------------;
; Disk Master part 2 ;
; by: Barry Kolbe ;
; (c) 1989 ;
;--------------------;
;
;Graphics 0 Display List
;
GR0DL .BYTE $70 ,$70 ,$10 ,$46
.WORD CR1
.BYTE $10 ,$42
.WORD BORDER
.BYTE $42
.WORD SM
.BYTE 2 ,2 ,2 ,2 ,2
.BYTE 2 ,2 ,2 ,2 ,2
.BYTE 2 ,2 ,2 ,2 ,2 ,$10
.BYTE $01
OLDD .WORD CONT ;flip bottom
CONT .BYTE $42 ;of screen
.WORD STATUS ;for HELP
.BYTE 0 ,2 ;screen at
.BYTE $30 ,$42
.WORD INPLIN
.BYTE $10 ,$42
.WORD LINE0
.BYTE $20 ,$42
.WORD PRLINE
.BYTE $41
.WORD GR0DL
;
;The Help Screen Display
;Code used by HELPME
;
HELPDL .BYTE $42
.WORD HELPS
.BYTE 0 ,2 ,2 ,2 ,2 ,2 ,$41
.WORD GR0DL
;
;Low and High bytes of
;Screen Lines
;
GL .BYTE <SM,<[SM+40 ]
.BYTE <[SM+80 ],<[SM+120 ]
.BYTE <[SM+160 ],<[SM+200 ]
.BYTE <[SM+240 ],<[SM+280 ]
.BYTE <[SM+320 ],<[SM+360 ]
.BYTE <[SM+400 ],<[SM+440 ]
.BYTE <[SM+480 ],<[SM+520 ]
.BYTE <[SM+560 ],<[SM+600 ]
.BYTE <[SM+640 ],<[SM+680 ]
.BYTE <[SM+720 ],<[SM+760 ]
.BYTE <[SM+800 ],<[SM+840 ]
.BYTE <[SM+880 ],<[SM+920 ]
;
GH .BYTE >SM,>[SM+40 ]
.BYTE >[SM+80 ],>[SM+120 ]
.BYTE >[SM+160 ],>[SM+200 ]
.BYTE >[SM+240 ],>[SM+280 ]
.BYTE >[SM+320 ],>[SM+360 ]
.BYTE >[SM+400 ],>[SM+440 ]
.BYTE >[SM+480 ],>[SM+520 ]
.BYTE >[SM+560 ],>[SM+600 ]
.BYTE >[SM+640 ],>[SM+680 ]
.BYTE >[SM+720 ],>[SM+760 ]
.BYTE >[SM+800 ],>[SM+840 ]
.BYTE >[SM+880 ],>[SM+920 ]
;
CREDIT .SBYTE "disk master "
.BYTE "HcI",0 ,"QYXY"
CR1 .SBYTE " disk "
.SBYTE "editor "
CR2 .SBYTE " disk dis"
.SBYTE "assembler "
.SBYTE " data "
.SBYTE "entry "
;
STATUS .SBYTE " SEC: FI"
.SBYTE "L: LNK: "
.SBYTE "BYT: "
;
DRLIN .SBYTE " SRC:1 DS"
.SBYTE "T:1 INP:H "
.SBYTE "DNS:1 "
;
;Help Screen
;
HELPS .SBYTE "Disk Master Help"
.SBYTE " Screen - Select C"
.SBYTE "ommand"
.SBYTE "R-read +-up "
.SBYTE "--dn E-edit "
.SBYTE "W-write "
.SBYTE "U-undo N-#base "
.SBYTE "C-chars B-bfill "
.SBYTE "J-eor "
.SBYTE "T-trace F-file# "
.SBYTE "L-link# V-dens "
.SBYTE "M-menu "
.SBYTE "S-serch H-H D "
.SBYTE ".-D H I-input "
.SBYTE "O-sorce "
.SBYTE "D-destn Γåã-rfrsh "
.SBYTE EOL,"-abort <-hue Γåæ "
.SBYTE ">-lum Γåæ "
;
PRLINE .SBYTE " Press CONTROL-"
.SBYTE "P to print this "
.SBYTE "screen "
;
;The Beginning of the
;Disk Editor
;
DISKED JSR CLRSCN ;clear screen
JSR ERAINP ;clear input
LDA #<GR0DL ;set up DL
STA SDLSTL
LDA #>GR0DL
STA SDLSTL+1
LDA #<[INPLIN+6 ]
STA INPLOC
LDA #>[INPLIN+6 ]
STA INPLOC+1
LDX #0 ;initialize
STX SRFLG
STX SECH
STX AIFLAG ;ASC/INT flag
STX HDF ;hex/dec flag
STX HXORST ;input flag
STX DENSITY ;0=sngl 1 =dbl
INX
STX SECL
STX SRCDRV
STX DESDRV
STX IMODE
JSR DOLEFT ;show border
LDA #0 ;show empty
JSR BFC
JSR MASIN
JG JSR C_OFF
JSR GETCOM ;get comand
JSR ERAINP ;zap input
JMP JG ;more
;
;Get a Command
;
GETCOM LDA CH ;force uppercase
CMP #$FF
BEQ GETCOM ;get key
LDX #$FF
STX CH
PHA ;save it
LDA #<CONT ;reset DLIST
STA OLDD
LDA #>CONT
STA OLDD+1
PLA ;get key
LDX #26 ;check it
CC1 CMP COMKEY,X
BEQ CC2 ;valid
DEX
BPL CC1
BMI GETCOM ;overs
CC2 TXA ;x 2 for offset
ASL A
TAX
ASL A
TAY
CPY #40
BCC N40
LDY #40
N40 JSR SHO_COM
LDA COMTAB,X ;get address
STA JOFF+1 ;of routine
LDA COMTAB+1 ,X
STA JOFF+2
JSR ERATXT ;window
JOFF JSR $FFFF ;carry out
;
C_OFF LDY #40
;
;Show the Command
;
SHO_COM TXA
PHA
LDX #0
SHC LDA CTXT,Y
STA INPLIN,X
INY
INX
CPX #4
BNE SHC
LDA #$9A
STA INPLIN+4
PLA
TAX
RTS
;
;Command Keys
;
COMKEY .BYTE $2A ,$39 ,$22 ,$15 ,$01
.BYTE $38 ,$3E ,$00 ,$28 ,$2E
.BYTE $12 ,$23 ,$66 ,$0B ,$08
.BYTE $3A ,$36 ,$76 ,$0E ,$06
.BYTE $0D ,$2D ,$10 ,$37 ,$25
.BYTE $B6 ,$8A
;
;Get a Key
;
GETKEY LDA $E425 ;the easy way
PHA ;to get keys
LDA $E424 ;from the OS!
PHA
RTS
;
;Get Input until ESCape or
;RETURN is pressed
;
INPUT STY MAXLEN ;save length
LDY #0 ;counter
INLOOP STY Y2 ;save it
LDA #$80 ;cursor is a
STA (INPLOC),Y ;block.
JSR GETKEY ;get a key
LDY Y2 ;restore Y
CMP #EOL ;is it EOL?
BEQ INDONE ;yes!
CMP #27 ;is it ESC?
BNE NOESC ;NO!
SEC ;signal abort
RTS ;so long.
NOESC CMP #126 ;delete?
BNE NODEL ;nope.
CPY #0 ;on 1st char?
BEQ INLOOP ;yes!
LDA #0 ;remove cursor
STA (INPLOC),Y
DEY ;decrease cntr
BPL INLOOP ;and loop
;
NODEL LDX IMODE ;get mode?
BEQ IS_OK ;string mode.
AND #$7F ;mask inverse
CMP #'9 +1 ;>9?
BCC ITS ;no.
AND #223 ;make uppercase.
ITS JSR CHEX ;is legal?
CPX #0 ;test X.
BPL IS_OK ;legal!
BMI INLOOP ;no good.
;
IS_OK CPY MAXLEN ;at max len?
BEQ INLOOP ;yes.
STA IBUF,Y ;no save char
JSR ASC2IC ;and put it
STA (INPLOC),Y ;on screen
INY ;up cntr
BNE INLOOP ;and loop.
;
INDONE STA IBUF,Y ;save EOL
LDA #0 ;erase cursor
STA (INPLOC),Y
CLC ;show good.
RTS ;boogie.
;
;Erase Input Line
;
ERAINP LDA #0
LDX #34
ER1 STA INPLIN+5 ,X
DEX
BPL ER1
RTS
;
;Get a String
;
G_STR LDA #0
STA IMODE
LDY #33
JMP INPUT
;
;Get a Hexstring
;
G_HEX LDA #1 ;hex mode.
STA IMODE
LDY #32 ;32 chars max
JSR INPUT ;get input.
BCC MEV ;ok?
RTS ;no.
MEV LDX #0 ;get length of
G4E LDA IBUF,X ;the input.
CMP #EOL
BEQ G4L
INX
BNE G4E
;
G4L TXA ;is the input
AND #1 ;even?
BEQ G4R ;yes!
;
LDX #43 ;no. add a
MDN LDA IBUF,X ;leading zero
STA IBUF+1 ,X ;to the input
DEX ;buffer.
BPL MDN
LDA #'0
STA IBUF
G4R LDX #0 ;input pntr
LDY #0 ;output pntr
GH2 LDA IBUF,X ;get char
CMP #EOL ;all done?
BEQ GHID ;yes!
STA HXH ;save it
INX ;get next char
LDA IBUF,X
STA HXL ;save it
STX X3 ;save x
STY Y3 ;save y
JSR HEX2BIN ;make binary
LDY Y3 ;get Y
LDX X3 ;get X
STA IBUF,Y ;save binary
INY ;up Y
INX ;up X
BNE GH2 ;and loop
GHID CLC ;signal good
RTS ;later.
;
;Get a Number
;
G_NUM LDA #1 ;hex mode.
STA IMODE
LDY #4 ;4 chars
JSR INPUT ;grab it.
BCC GNK ;good?
RTS ;no.
GNK JSR ZFR ;zap FR0
TAY ;Y=0
G4LOOP LDA IBUF,Y ;get a char
CMP #EOL ;done?
BNE TESTIT ;nope.
G4G CLC ;signal good
RTS ;spater.
;
TESTIT JSR CHEX ;get value
ASL FR0 ;*2
ROL FR0+1
ASL FR0 ;*4
ROL FR0+1
ASL FR0 ;*8
ROL FR0+1
ASL FR0 ;*16
ROL FR0+1
TXA ;get value
ORA FR0 ;add to FR0
STA FR0 ;save it
INY ;up count
BNE G4LOOP ;and loop
;
;Clear out Screen Memory
;
CLRSCN LDA #0
LDY #0
CLRS STA SM,Y
STA SM+$0100 ,Y
STA SM+$0200 ,Y
STA SM+$0300 ,Y
INY
BNE CLRS
LDA LMARGN
STA COLCRS
TYA
STA ROWCRS
RTS
;
;Show the Screen Borders
;
DOLEFT LDA GL ;first line
STA T ;of memory
LDA GH
STA T+1
LDX #0
LFB LDY #0 ;left column
LDA LEFTB,X
STA (T),Y
STY Y1
LDY #28 ;repeat in
STA (T),Y ;middle
LDY Y1
INX ;over 1
INY
LDA LEFTB,X ;column 2
STA (T),Y
STY Y1
LDY #29 ;and in middle
STA (T),Y
LDY Y1
JSR ADD40 ;down 1 line
INX
CPX #32 ;16 lines?
BNE LFB
RTS
;
;Add 40 onto pointer to
;move down one line
;
ADD40 LDA T
CLC
ADC #$28
STA T
BCC A40
INC T+1
A40 RTS
;
;Display the Sector Data
;
SHWSEC LDA GL ;start at top
STA T
LDA GH
STA T+1
LDA #2 ;y pos =2
STA Y2
LDA HDF ;hex or dec?
BEQ H9 ;HEX
JMP SDEC
H9 LDY #0
H1 JSR ZFR
STY Y1
LDA MYBUF,Y ;get a byte
STA FR0
JSR BIN2HEX ;to hex
INC Y1
LDY Y2 ;screen pos Y
INY
LDA LBUFF+2 ;hi byte of hex
JSR ASC2IC
STA (T),Y ;show it
LDA LBUFF+3 ;now low byte
JSR ASC2IC
INY
STA (T),Y
INY
STY Y2
CPY #26 ;end of line?
BEQ H4 ;yes
H5 LDY Y1 ;end of buffer?
CPY #$80
BNE H1 ;no
RTS
H4 JSR ADD40 ;down 1 line
LDA #2 ;reset LMargin
STA Y2
JMP H5
;
;Show Sector in Decimal Mode
;If 'tens' digit is inversed
;the number is over 200,if the
;'units' digit is inversed the
;number is between 100 and 200
;
SDEC LDY #0
INC Y2 ;3
SD1 LDA #$FF ;set inverse
STA IV ;flag
LDA MYBUF,Y ;get byte
INY
STY Y1 ;save buf pos
CMP #200 ;over 200?
BCC DD1
SEC ;- 200
SBC #200
INC IV ;set flag
INC IV ;to 1
BNE DD3
DD1 CMP #100 ;over 100?
BCC DD3
SEC
SBC #100
INC IV ;set flag to 0
DD3 LDX #'0 ;default '00'
STX TENS
STX UNITS
DD5 CMP #$0A ;over 10?
BCS DD4 ;yes
CLC
ADC UNITS ;add units digit
STA UNITS
LDY IV ;see if any are
BMI DD2 ;inversed
LDA UNITS,Y ;do inverse
ORA #$80
STA UNITS,Y
DD2 LDY Y2 ;get screen pos
LDA TENS ;convert to
JSR ASC2IC ;screen code
STA (T),Y
INY
LDA UNITS ;same for
JSR ASC2IC ;units digit
STA (T),Y
INY ;move right
INY
STY Y2
CPY #27 ;done w/line?
BEQ DD6
DD7 LDY Y1 ;done with
CPY #$80 ;sector?
BNE SD1
RTS
DD6 JSR ADD40 ;next line
LDA #3
STA Y2 ;reset LMargin
BNE DD7
DD4 SEC ;get tens digit
SBC #$0A
INC TENS
BNE DD5
RTS
;
;Show Data as ATASCII or
;Internal Code
;
ASCINT JSR MASIN ;show type
LDA GL ;top line
STA T
LDA GH
STA T+1
LDX #0 ;data pos
AIM LDY #30 ;screen Y
AIL LDA MYBUF,X ;get byte
STX X2
LDX AIFLAG ;ATASCII or
BNE AIN ;Internal
JSR ASC2IC ;convert
AIN LDX X2
STA (T),Y ;show it
INX
INY
CPY #$26 ;end of line?
BNE AIL
JSR ADD40 ;next line
CPX #$80 ;end of buffer?
BNE AIM
RTS
;
;Show it as ATASCII on screen
;
ASC2IC JSR BITER
ORA A2I,X
LDX X1
RTS
;
;Show as Internal Code on screen
;
IC2ASC JSR BITER
ORA I2A,X
LDX X1
RTS
;
;Do bit work
;
BITER STX X1
PHA
ROL A
ROL A
ROL A
ROL A
AND #3
TAX
PLA
AND #$9F
RTS
;
;Do heading of 'ATASCII' or
;'INTERNAL' code
;
MASIN LDX #7
LDA AIFLAG ;get flag
BNE IN ;no, internal
LDX #15
IN LDY #7 ;copy header
MA1 LDA INMS,X ;on screen
STA BORDER+30 ,Y
DEX
DEY
BPL MA1
RTS
;
;Display the Sector Data
;
SECINF LDA SECL ;sector #
STA FR0
LDA SECH
STA FR0+1
LDX #5 ;at position 5
JSR PH1 ;put it on.
LDA MYBUF+127 ;# of bytes
STA FR0
LDX #35 ;posit. 35
JSR PH2 ;put it on.
LDA MYBUF+125 ;file #
LSR A ;is in the
LSR A ;6 hi bits
STA FR0
LDX #15 ;posit. 15
JSR PH2 ;display.
LDA MYBUF+126 ;sector link
STA FR0 ;low
LDA MYBUF+125 ;sector link
AND #3 ;high
STA FR0+1
LDX #25 ;posit 25
LDA SRCDRV ;get source
ORA #$90 ;make inverse
STA DRLIN+5 ;on screen
LDA DESDRV ;dest drive
ORA #$90
STA DRLIN+15 ;on screen
LDA DENSITY ;disk density
CLC
ADC #$91
STA DRLIN+35 ;on screen
LDY HXORST ;input mode
LDA INPMS,Y ;get letter
STA DRLIN+25 ;on screen
;
;Put Hex # on Status Line
;enter with X = position
;
PH1 LDY #1 ;start at dig#2
BNE P_IN
PH2 LDY #2 ;digit #3
P_IN STY TMP1 ;save Y
STX TMP2 ;save X
JSR BIN2HEX ;make hex
LDY TMP1 ;restore X&Y
LDX TMP2
P_LP LDA LBUFF,Y ;get char
JSR ASC2IC ;make ICODE
ORA #$80 ;inverse it
STA STATUS,X ;on screen
INX
INY
CPY #4 ;at end?
BNE P_LP ;no.
JMP ZFR ;zap FR0
;
;Copy DSBUF to MYBUF
;
TOMYBUF LDY #$7F
TOM LDA DSBUF,Y
STA MYBUF,Y
DEY
BPL TOM
RTS
;
;Tables for ATASCII and
;Internal code conversions
;
I2A .BYTE $20 ,$40 ,$00 ,$60
A2I .BYTE $40 ,$00 ,$20 ,$60
;
;The Command Table
;
COMTAB .WORD EDITS ;block edit
.WORD HX2DEC ;hex>dec
.WORD DECH ;dec>hex
.WORD BFILL ;block fill
.WORD EORS ;eor sector
.WORD CHNFIL ;file #
.WORD SEARCHS ;search
.WORD SLINKS ;link #
.WORD READS ;read sec
.WORD WRITES ;write sec
.WORD AIFLIP ;flip chars
.WORD HDFLIP ;flip #'s
.WORD HELPME ;help scrn
.WORD UNDO ;undo
.WORD CHNSRC ;src drive
.WORD CHNDES ;dest drive
.WORD KOLOR ;next hue
.WORD REFRESH ;clear scrn
.WORD DOWN1 ;sec=sec-1
.WORD UP1 ;sec=sec+1
.WORD HEXSTR ;input flip
.WORD TRACES ;trace link
.WORD CHNDENS ;new density
.WORD LUMIN ;luminance
.WORD INTRO ;menu screen
.WORD REFRESH ;clear scrn
.WORD DMPSCN ;prnt scrn
;
;Routines
;
;Show Sector as ATASCII (0) or
;Internal Code (1)
;
AIFLIP LDA AIFLAG
EOR #1
STA AIFLAG
JMP ASCINT
;
;Show Sector as Hex (0) or
;Decimal (1) data
;
HDFLIP LDA HDF
EOR #1
STA HDF
JMP SHWSEC
;
;Edit the sector:Set INP to
;H(hex) or S(string) input
;
EDITS JSR G_NUM ;get start byte
BCC EE1
EDN RTS
EE1 LDA FR0+1 ;is the #<$80?
BNE EDN
LDA FR0
CMP #$80
BCS EDN ;no way.
STA FBYTE ;save it
JSR ERAINP ;clear INPLIN
LDA #$A4 ;a 'D'
STA INPLIN+3
JSR G_HS ;get data
BCS EDN
STY Y1 ;save length
DEY
MIC LDA IBUF,Y ;make the data
LDX AIFLAG ;ASC/ICODE
BEQ MIO
JSR ASC2IC
MIO STA IBUF,Y
DEY
BPL MIC
EE2 LDY FBYTE ;Y= pos
LDX #0
CPM LDA IBUF,X ;get byte
EE3 STA MYBUF,Y ;store it
INX
INY
CPY #$80 ;end of sec?
BEQ ERT ;yes.
CPX Y1 ;end of data?
BNE CPM ;no.
ERT JMP SHOWALL ;show changes
;
;Decimal to Hex converter
;
DECH LDA #1 ;hex mode
STA IMODE
LDY #5 ;5 chars max
JSR INPUT
BCC G_IB
RTS
G_IB LDA #<IBUF ;point FP
STA INBUFF ;to buffer
LDA #>IBUF
STA INBUFF+1
LDA #0
STA CIX
JSR AFP ;ASCII to FP
JSR FPI ;FP to Integer
BCC U5 ;CLC->good.
JSR ZFR ;'0000' on error
U5 LDA FR0+1
PHA ;save the #
LDA FR0
PHA
LDX #1
STX HXDC ;force decimal
DEX ;posit 0
JSR COPYNUM
INX ;insert =
LDA #'=
STA IBUF,X
INX
PLA ;get # back
STA FR0
PLA
STA FR0+1
JSR COP_ALL ;copy hex
JMP SHO_IT
;
;Hex to Decimal Converter
;
HX2DEC JSR G_NUM ;get number
BCS ANRTS
;
LDX #1 ;force decimal
STX HXDC
DEX ;insert hex
JSR COP_ALL
LDA #'= ;insert "="
STA IBUF+5
LDX #6 ;posit #6
JSR COPYNUM ;copy number
SHO_IT LDA IBUF,X ;put the str
JSR ASC2IC ;on the
STA LINE0,X ;screen.
DEX
BPL SHO_IT
ANRTS RTS
;
;Copy all 4 Hex digits to IBUF
;
COP_ALL STX TMP1
JSR BIN2HEX
LDX TMP1
LDA #'$
STA IBUF,X
INX
JMP ALL
;
;Block Fill
;
BFILL JSR G_NUM
BCC BFB
RTS
BFB LDA FR0
BFC LDY #$7F ;fill mybuf
BFF STA MYBUF,Y ;with value
DEY
BPL BFF
BFD JMP SHOWALL ;Show it
;
;Convert Hex to Binary value
;returns with A = value
;
HEX2BIN LDA HXL ;check if
JSR CHEX
STX HXL
LDA HXH ;same for hi
JSR CHEX
TXA ;x16
ASL A
ASL A
ASL A
ASL A
ORA HXL ;add low
RTS ;=A
;
;See if digit is in the Hex
;table
;
CHEX LDX #$0F ;16 digits
HH4 CMP HXTAB,X
BEQ HH3
DEX
BPL HH4
HH3 RTS
;
;Sets flag for Hex or
;String (Character) Input
;
HEXSTR LDA HXORST
EOR #1
STA HXORST
JMP SECINF
;
;EOR the data with a byte
;
EORS JSR G_NUM
BCC E_GO
RTS
E_GO LDY #$7F ;eor whole
ERP LDA MYBUF,Y ;sector
EOR FR0
STA MYBUF,Y
DEY
BPL ERP
JMP SHOWALL ;show it
;
;Show Sector Data, Characters
;and Sector information
;
SHOWALL JSR SHWSEC ;data
JSR ASCINT ;characters
JMP SECINF ;inofrmation
;
;Install the HELP screen
;
HELPME LDA #<HELPDL ;change
STA OLDD ;display list
LDA #>HELPDL ;part way
STA OLDD+1 ;down
PLA
PLA
JMP GETCOM
;
;Restore the Sector's Data
;
UNDO JSR TOMYBUF
JMP SHOWALL
;
;Erase text in Window
;
ERATXT LDY #39
LDA #0
ET1 STA LINE0,Y
DEY
BPL ET1
RTS
;
;Change Source Drive
;
CHNSRC LDX SRCDRV
JSR DRV_UP
STX SRCDRV
JMP SECINF
;
;Change Destination Drive
;
CHNDES LDX DESDRV
JSR DRV_UP
STX DESDRV
JMP SECINF
;
;Increment Drive Number
;
DRV_UP INX
CPX #9
BNE SHX
LDX #1
SHX RTS
;
;Change the File Number
;
CHNFIL JSR G_NUM
BCC FF1
FF3 RTS
FF1 LDA FR0+1
BNE FF3
LDA FR0
CMP #64 ;0-63 allowed
BCC FF4
LDY #181
JMP IOERR
FF4 ASL A ;high 6 bits
ASL A ;used for file
STA FR0 ;number
LDA MYBUF+125 ;get byte
AND #3 ;mask out low
ORA FR0 ;add in File #
STA MYBUF+125
JMP SHOWALL ;show it
;
;Get Hex or String
;
G_HS LDA HXORST
BNE G_ST
JMP G_HEX
;
G_ST JMP G_STR
;
;Search for Hex or String.
;String can be either
;ATASCII or Internal Code
;
SEARCHS JSR G_HS ;get data
BCC AO2
AOR RTS
;
AO2 CPY #0 ;just EOL?
BEQ IS_OLD? ;yup, check buf
STY SRFLG ;save length
LDY #44 ;copy bufr over
AOCP LDA IBUF,Y ;to the save
STA SRBUF,Y ;buffer for
DEY ;next time
BPL AOCP
BMI AORI
IS_OLD? LDA SRFLG ;old data?
BEQ AOR ;no way!
;
AORI LDY #0 ;convert to
ALI LDA SRBUF,Y ;internal
LDX AIFLAG
BEQ A_ST
JSR ASC2IC
A_ST STA IBUF,Y
INY
CPY SRFLG
BNE ALI
;
SSTR LDA #$81 ;compute the
SEC ;last posit we
SBC SRFLG ;can look at.
STA MAXLEN ;save it.
LDY #0 ;sec pntr
SEL LDX #0 ;bufr pntr
STY Y1 ;save it
TRYF LDA IBUF,X ;get buffer
CMP MYBUF,Y ;in sector?
BNE GS_UP ;no increment.
INY ;get next char
INX
CPX SRFLG ;at end?
BNE TRYF ;no yet...
LDA Y1 ;first byte
STA FBYTE ;save
JSR SHO_POS ;sho match!
;
GS_UP LDY Y1 ;get posit
INY ;increment
CPY MAXLEN ;at end?
BNE SEL ;no loop.
RTS ;so long
;
;find place on screen to
;mark the match
;
SHO_POS LDA FBYTE ;byte #
LSR A ;div by 8
LSR A ;to get row
LSR A
TAY
LDA GL,Y ;get memory
STA T ;position
LDA GH,Y
STA T+1
TYA
ASL A
ASL A
ASL A ;x8
STA TMP3
LDA FBYTE ;get remainder
SEC
SBC TMP3 ;go right by
STA TMP3 ;threes!
ASL A ;x2
CLC
ADC TMP3 ;x3
CLC
ADC #2 ;for margin
TAY
LDA #127 ;wedge
STA (T),Y ;show it
RTS
;
;Refresh the screen to
;erase the arrows
;
REFRESH JSR CLRSCN
JSR DOLEFT
JMP SHOWALL
;
;Change Screen Color
;
KOLOR LDA COLOR2
CLC
ADC #$10
STA COLOR2
RTS
;
;Change Luminance
;
LUMIN LDA COLOR2
TAX
AND #$F0
STA CTMP
TXA
CLC
ADC #2
AND #$0F
ORA CTMP
STA COLOR2
RTS
;
;Change Sector Link
;
SLINKS JSR G_NUM
BCC SL_G
RTS
SL_G LDA FR0 ;chk for 0
ORA FR0+1
BEQ LN_ER
LDA FR0+1
LDX DENSITY ;make sure the
CMP SDHI,X ;new link is
BCC G_LNK ;allowed in
BEQ G_TLO ;this density.
BCS LN_ER
G_TLO LDA FR0
CMP SDLO,X
BCC G_LNK
BEQ G_LNK
BCS LN_ER
G_LNK LDA FR0 ;store it
STA MYBUF+126
LDA FR0+1
AND #3
STA FR0
LDA MYBUF+125 ;mask off
AND #$FC ;file #
ORA FR0+1 ;add in link
STA MYBUF+125
JMP SHOWALL ;show it
;
LN_ER LDY #180
JMP IOERR
;
;Read a Sector
;
READS JSR G_NUM ;get sector
BCC G_RD
RTS
G_RD LDA FR0 ;just EOL?
ORA FR0+1
BEQ DORED ;yes, reread
LDA FR0 ;copy the new
STA SECL ;# to area
LDA FR0+1
STA SECH
;
DORED JSR READIT ;do the read
BPL G.Q
JSR IOERR
G.Q JSR TOMYBUF ;move to mybuf
JMP SHOWALL ;show it
;
;Set up Reading
;
READIT LDA SRCDRV ;source drv
STA DUNIT
LDA #>DSBUF ;read into
STA DBUFHI ;dsbuf
LDA #<DSBUF
STA DBUFLO
LDA #$52
BNE REDWRT
;
;Set up Write
;
WRITIT LDA DESDRV ;dest. drv
STA DUNIT
LDA #>MYBUF ;write out
STA DBUFHI ;mybuf
LDA #<MYBUF
STA DBUFLO
LDA #$57
;
;general read,write
;
REDWRT STA DCOMND ;save cmd
LDA SECL ;sector 0?
ORA SECH
BNE C_D ;no.
INC SECL ;now sector 1.
C_D LDX DENSITY ;test to be
LDA SECH ;sure that the
CMP SDHI,X ;sector is on
BCC S_OK ;the disk.
BEQ T_LO
BCS T_NO
T_LO LDA SECL ;test lo.
CMP SDLO,X
BCC S_OK
T_NO LDA SDLO,X ;move max #
STA SECL ;into sec #
LDA SDHI,X
STA SECH
S_OK LDA SECL ;save the
STA DAUX1 ;sector in SIO
LDA SECH ;work area
STA DAUX2
LDA #$80 ;128 bytes
STA DBYTLO
LDA #0
STA DBYTHI
JMP DSKINV ;do SIO
;
;Format an I/O Error #
;
F_ERR JSR ZFR ;zap FR0
STY FR0 ;save err #
LDX #1 ;force decimal
STX HXDC
LDX #7 ;copy error msg
DS.1 LDA ERMS,X ;to buffer
STA IBUF,X
DEX
BPL DS.1
LDX #8 ;copy number in
JSR COPYNUM
LDA #0
STA IBUF+1 ,X
RTS
;
;Disk editor Error Routine
;
IOERR JSR F_ERR
JMP SHO_IT ;show error.
;
;Read Down One Sector
;
DOWN1 LDA SECH
BNE DA2 ;ok
LDA SECL
CMP #2 ;if LT 2 no
BCS DA2 ;decrease
RTS
DA2 DEC SECL ;go down 1
LDA SECL
CMP #$FF
BNE DA1
DEC SECH
DA1 JMP DORED ;read it
;
;Read Up One Sector
;
UP1 INC SECL
BNE UPA
INC SECH
UPA JMP DORED
;
;Trace a file
;
TRACES LDA SECL ;save cur
STA SSECL ;number just
LDA SECH ;in case
STA SSECH
LDA MYBUF+125 ;get link
AND #3 ;hi
STA SECH
LDA MYBUF+126 ;and low
STA SECL
ORA SECH
BNE D_R ;if 0 end of
LDY #182
JMP IOERR
D_R JMP DORED ;trace
;
EOFT LDA SSECL ;reset current
STA SECL ;sector number
LDA SSECH
STA SECH
RTS
;
;Write a Sector
;
WRITES JSR G_NUM ;sector to
BCC WR1 ;write.
RTS
WR1 LDA SECL ;save old #
STA SSECL ;for later.
LDA SECH
STA SSECH
LDA FR0 ;sector 0?
ORA FR0+1
BEQ WR2 ;yes.
LDA FR0 ;copy new sec#
STA SECL ;into pntr
LDA FR0+1
STA SECH
WR2 LDA SECL ;use old sector
STA FR0 ;number.
LDA SECH
STA FR0+1
JSR BIN2HEX ;make hex
LDY #3 ;copy to the
WR3 LDA LBUFF,Y ;message.
STA SUREMS+11 ,Y
DEY
BPL WR3
LDA DESDRV ;put in the
ORA #$30 ;destn drive
STA SUREMS+20
LDY #0
WR4 LDA SUREMS,Y
BEQ GYN
JSR ASC2IC
STA (INPLOC),Y
INY
BNE WR4
GYN JSR GETKEY
CMP #27
BEQ WRU
AND #$7F
CMP #'Y
BEQ WR5
CMP #'N
BNE GYN
BEQ WRU
;
WR5 JSR WRITIT
BPL WRU
JSR IOERR
WRU JMP EOFT ;restore
;
;Change Density
;
CHNDENS LDA DENSITY
EOR #1
STA DENSITY
JMP SECINF
;
BORDER .SBYTE " +0 +1 +2 +3"
.SBYTE " +4 +5 +6 +7 A"
.SBYTE "TASCII "
;
INMS .SBYTE "INTERNAL"
ATMS .SBYTE "ATASCII "
INPMS .SBYTE "HS"
SDLO .BYTE $D0 ,$10
SDHI .BYTE $02 ,$04
ERMS .BYTE "Error # "
;
;Left Border
;
LEFTB .SBYTE " 0 810182028303"
.SBYTE "84048505860687078"
;
;Various Messages & Prompts
;
SUREMS .BYTE "Write SEC: 0000"
.BYTE " to D : Y/N?",0
HXTAB .BYTE "0123456789ABCDEF"
CTXT .SBYTE "Edt# H D D H"
.SBYTE "Bfil EorFil#"
.SBYTE "SrchLinkRead"
.SBYTE "Writ "