Classic Computer Magazine Archive PROGRAM LISTING: 83-09/BINAUTO.ASM


10 ;BINARY AUTOLOAD
20 ;BY Jeff & Ed Schneider
30 ;
40 COUNT=$CF ;COUNT HOLDS # OF FILES
50 ARRAY=$3700 ;ARRAY HOLDS FILE NAMES
60 PRINT=$37D0 ;PRINT BUFFER FOR NAMES
70 TEMP=$37EE ;TEMPORARY STORAGE
80  *=$3800 ;ORG AND RUN ADDRESS OF UTILITY
90  LDA #ARRAY&255
0100  STA $CB
0110  LDA #ARRAY/256
0120  STA $CC
0130  STA $CE
0140  JSR OPENSCREEN
0150  LDA #16
0160  STA $2C6
0170  INC $2F0
0180  LDY #0
0190  STY $56
0200  STY COUNT
0210  TYA
0220  INY
0230  STY $54
0240  INY
0250  STA ($58),Y
0260  LDA #9
0270  STA $55
0280  STA $52
0290  LDA #30
0300  STA $53
0310  LDX #96
0320  LDA #9 ;PRINT SCREEN TITLES
0330  STA $342,X
0340  LDA #TOP&255
0350  STA $344,X
0360  LDA #TOP/256
0370  STA $345,X
0380  LDA #66
0390  STA $348,X
0400  JSR $E456
0410  LDA #2
0420  STA $52
0430  LDA #39
0440  STA $53
0450  LDA #21
0460  STA $54
0470  LDA #4
0480  STA $55
0490  LDX #96
0500  LDA #BOTTOM&255
0510  STA $344,X
0520  LDA #BOTTOM/256
0530  STA $345,X
0540  LDA #32
0550  STA $348,X
0560  JSR $E456
0570  LDX #16 ;OPEN DISK DIRECTORY
0580  LDA #3
0590  STA $342,X
0600  LDA #DISK&255
0610  STA $344,X
0620  LDA #DISK/256
0630  STA $345,X
0640  LDA #6
0650  STA $34A,X
0660  LDA #0
0670  STA $34B,X
0680  JSR $E456
0690 READIN LDX #16 ;READ FILE NAME
0700  LDA #7
0710  STA $342,X
0720  LDA #TEMP&255
0730  STA $344,X
0740  LDA #TEMP/256
0750  STA $345,X
0760  LDA #18
0770  STA $348,X
0780  LDA #0
0790  STA $349,X
0800  JSR $E456
0810  BMI A3 ;IF NO MORE NAMES, BRANCH
0820  LDY #10
0830  LDX #1
0840 A1 LDA TEMP,Y ;CHECK FOR "OBJ"
0850  CMP EXT,X    ;EXTENDER
0860  BNE READIN
0870  INX
0880  INY
0890  CPY #13
0900  BNE A1
0910  LDY #0
0920  LDX #2
0930 A2 LDA TEMP,X ;IF "OBJ", TRANSFER
0940  STA ($CB),Y  ;FILE NAME TO ARRAY
0950  INX
0960  INY
0970  CPY #8
0980  BNE A2
0990  INC COUNT    ;INCREMENT FILE
1000  LDA COUNT    ;COUNTER & CHECK
1010  CMP #26      ;FOR 26 NAMES
1020  BEQ A3
1030  JSR INCPTR
1040  BNE READIN   ;READ NEXT FILE
1050 A3 LDX #16    ;CLOSE DIRECTORY
1060  LDA #12
1070  STA $342,X
1080  JSR $E456
1090  LDA COUNT    ;PRINT MESSAGE IF
1100  BNE A4       ;NO "OBJ" FILES
1110  JMP PRINTNONE
1120 A4 LDA #6
1130  STA $54
1140  LDA #1
1150  STA $E1
1160  LDA #ARRAY&255
1170  STA $CB
1180 PRINTAGAIN LDA #32
1190  LDY #0
1200 A5 STA PRINT,Y
1210  INY
1220  CPY #30
1230  BNE A5
1240  LDA #5
1250  STA $55
1260  LDA COUNT
1270  AND #1
1280  STA $E2
1290  LDA COUNT
1300  LSR A
1310  CLC
1320  ADC $E2
1330  STA $E0
1340  LDA $E1
1350  CLC
1360  ADC #192
1370  STA PRINT
1380  LDA #174
1390  STA PRINT+1
1400  LDY #0
1410  LDX #3
1420 A6 LDA ($CB),Y
1430  STA PRINT,X
1440  INY
1450  INX
1460  CPY #8
1470  BNE A6
1480  LDA $E2
1490  BEQ A7
1500  LDX $E0
1510  CPX $E1
1520  BEQ A9
1530 A7 LDA PRINT
1540  CLC
1550  ADC $E0
1560  STA PRINT+19
1570  LDA #174
1580  STA PRINT+20
1590  LDY #0
1600  LDX #22
1610  LDA $CC
1620  STA $CE
1630  LDA $E0
1640  ASL A
1650  ASL A
1660  ASL A
1670  CLC
1680  ADC $CB
1690  STA $CD
1700 A8 LDA ($CD),Y
1710  STA PRINT,X
1720  INY
1730  INX
1740  CPY #8
1750  BNE A8
1760 A9 LDX #96    ;PRINT FILE NAMES
1770  LDA #9
1780  STA $342,X
1790  LDA #PRINT&255
1800  STA $344,X
1810  LDA #PRINT/256
1820  STA $345,X
1830  LDA #30
1840  STA $348,X
1850  JSR $E456
1860  JSR INCPTR
1870  INC $E1
1880  LDA $E1
1890  CMP $E0
1900  BCS A10
1910  JMP PRINTAGAIN
1920 A10 BNE GETKEY
1930  JMP PRINTAGAIN
1940 GETKEY LDA #255
1950  STA $2FC
1960 A11 LDA $2FC  ;CHECK FOR KEYPRESS
1970  CMP #255
1980  BEQ A11
1990  LDY #0
2000 LOOP LDA KEYS,Y
2010  CMP $2FC     ;IS KEY LEGAL?
2020  BEQ LOAD
2030  INY
2040  CPY COUNT
2050  BNE LOOP
2060  LDA #253     ;IF NOT RING BELL
2070  JSR $F6A4
2080  JMP GETKEY
2090 LOAD TYA      ;YES?  BRANCH HERE
2100  TYA
2110  ASL A
2120  ASL A
2130  ASL A
2140  STA $CB
2150  LDY #0
2160  LDX #2
2170 A12 LDA ($CB),Y
2180  CMP #32
2190  BEQ A13
2200  STA FILE,X
2210  INY
2220  INX
2230  CPY #8
2240  BNE A12
2250 A13 LDY #0
2260 A14 LDA EXT,Y ;GET FILE NAME
2270  STA FILE,X   ;FROM ARRAY
2280  INY
2290  INX
2300  CPY #14
2310  BNE A14
2320  LDX #96
2330  LDA #12
2340  STA $342,X
2350  JSR $E456
2360  JSR OPENSCREEN
2370  LDX #16      ;OPEN FILE
2380  LDA #3
2390  STA $342,X
2400  LDA #FILE&255
2410  STA $344,X
2420  LDA #FILE/256
2430  STA $345,X
2440  LDA #0
2450  STA $349,X
2460  LDA #4
2470  STA $34A,X
2480  JSR $E456
2490  LDA #255
2500  STA $2FC
2510  LDA #47
2520  STA $2E0
2530  LDA #16
2540  STA $2E1
2550  JMP $15C8    ;JUMP TO DOS LOAD ROUTINE
2560 PRINTNONE LDA #12
2570  STA $54      ;IF NO "OBJ" FILE
2580  LDA #7       ;PRINT MESSAGE
2590  STA $55
2600  LDX #96
2610  LDA #9
2620  STA $342,X
2630  LDA #NOFILE&255
2640  STA $344,X
2650  LDA #NOFILE/256
2660  STA $345,X
2670  LDA #27
2680  STA $348,X
2690  JSR $E456
2700 END JMP END
2710 OPENSCREEN LDX #96
2720  LDA #3
2730  STA $342,X
2740  LDA #GR&255
2750  STA $344,X
2760  LDA #GR/256
2770  STA $345,X
2780  LDA #12
2790  STA $34A,X
2800  LDA #0
2810  STA $34B,X
2820  JSR $E456
2830  RTS
2840 INCPTR CLC
2850  LDA $CB
2860  ADC #8
2870  STA $CB
2880  RTS
2890 GR .BYTE "S:"
2900 TOP .BYTE 2,13,13,13,13,13,13,13,13,13,13
2910  .BYTE 13,13,13,13,13,13,13,13,13,13,22
2920  .BYTE 2,32,193,213,212,207,160,211,197,204,197
2930  .BYTE 195,212,173,193,173,198,201,204,197,32,22
2940  .BYTE 2,14,14,14,14,14,14,14,14,14,14
2950  .BYTE 14,14,14,14,14,14,14,14,14,14,22
2960 BOTTOM .BYTE 160,227,232,239,239,243,229,160,225,160,230
2970  .BYTE 233,236,229,160,166,160,240,242,229,243,243
2980  .BYTE 160,225,160,236,229,244,244,229,242,160
2990 NOFILE .BYTE "NO ",34,"OBJ",34," FILES ON THIS DISK"
3000 KEYS .BYTE 63,21,18,58,42,56,61,57,13,1,5,0,37
3010  .BYTE 35,8,10,47,40,62,45,11,16,46,22,43,23
3020 DISK .BYTE "D:*.*"
3030 FILE .BYTE "D:            "
3040 EXT .BYTE ".OBJ"

Back to previous page