@L}5 _$% l0$)$$Hȱ$ UhL" `e$$%`$%`  R@W!( L(1   Y I`  d  Ld M * @  $ % CC$$)%1 Udߥ$9%: !0 S$% DD˙`  }J)Lr  :H hZ vDmZ t j v pH h l?  vYЍ t0}D #  v`F N ? LvW tȹ jL4 NZ j   p  }`S7 ȱ/Zɛ jԅ      p9@ lCLt!@  @L$  T .  -o} BHEDI V0+` BHE٩ Ԣ BH  Dh ThhL  }@  v.$н L Dڠɛ80 0&ԅ`5JJJJ H5 H0! 0ii0` ؠɀ0) }ȩLpբDE8HL @  `>SD $> .> SD NR DO VAӛTR TM SR MN *N KL RIěRE }*UF !#$D1:*.*D1:DOS.SYS  Lj(LNkle$$%8(k()` R 8 ELO Ri)^>jf | NrC s +0 ; ** COMPUTE! ** JUL 84 ** PAGE 140 ** 0200 ;EQUATES 0210 ICBC = $342 0220 ICBAL = $344 0230 ICBAH = $345 0240 ICBLL = } $348 0250 ICBLH = $349 0260 ICBAX = $34A+16 0270 MEMLO = $2E7 0280 LBUF = $580 0290 INBUF = $F3 0300 CIX = $F2 0310 F }R0 = $D4 0320 FR1 = $E0 0330 GETR = $05 0340 GETC = $07 0350 PUTC = $0B 0360 PUTR = $09 0370 OPEN = $03 0380 CLOSE = $}0C 0390 AXIO = $0C 0400 AXOUT = $08 0410 AXAP = $09 0420 AXDR = $06 0430 FR0Z = $DA44 0440 IFP = $D9AA 0450 FPI = $D9D}2 0460 FPASC = $D8E6 0470 FMOVE = $DDB6 0480 ASCFP = $D800 0490 LO = $00FF 0500 HI = $0100 0510 CIO = $E456 0520 WARMS}T = $E474 0530 DOSVEC = $0A 0540 DOSINI = $0C 0550 OLDDOS = $179F 0560 JMPINI = $1705 0570 JMPRUN = $1708 0580 ; 0590 }; 0600 *= $1CFC ;change this addr for 0610 ;larger versions of DOS2.0S 0620 ; 0630 ; 0640 ST JSR CLSE ;to be sure 0650} STY CIX ;set f.p. pointer 0660 DEY 0670 STY $2E3;clear INIT/RUN 0680 STY $2E1 0690 STY $FF ;reset load flag 0700 }LDX #LBUF&LO ;init flt. pt. 0710 LDY #LBUF/HI 0720 STX INBUF 0730 STY INBUF+1 0740 DISCMD LDY #TAB1-CMDTAB-1 0750 L1 }TYA ;DISPLAY COMMANDS 0760 PHA 0770 LDA CMDTAB,Y 0780 JSR PRINT 0790 PLA 0800 TAY 0810 DEY 0820 BPL L1 0830 L}DA #AXOUT ;init aux 0840 STA ICBAX 0850 JSR GTREC ;get command 0860 LDY #3 ; GET COMMAND 0870 LDA LBUF 0880 L2 CMP T}AB1,Y 0890 BEQ SPECMD 0900 DEY 0910 BPL L2 0920 DIR CMP #'D ;DIRECTORY 0930 BNE WDS 0940 LDA #06 0950 STA ICBAX } 0960 JSR ASKDN ;drive #? 0970 JSR OPN ;open 0980 L3 LDX #$10 0990 JSR GTREC ;get formatted line 1000 JSR PTREC0 ;pri}nt it 1010 BPL L3 1020 SPECMD LDA TAB2,Y ;SPECIAL CMDS 1030 PHA ;save cmd 1040 CMP #$FE ;check if format 1050 BEQ FM}T 1060 JSR PFN 1070 EX PLA ;retrieve command 1080 JSR EXCMD ;do it 1090 BPL ST 1100 FMT LDA #'? ;FORMAT 1110 JSR PR}INT ;sure? 1120 JSR GTREC 1130 LDA LBUF 1140 CMP #'Y ;is there a yes? 1150 B1 BNE ST ;if not start over 1160 JSR ASK}DN ;get drive# 1170 BMI EX ;execute 1180 ASKDN LDA #'D ;GET DRIVE# 1190 JSR PRINT 1200 LDA #'# 1210 JSR PRINT 1220 } JSR GTREC 1230 LDA LBUF 1240 STA ADRDIR+1 ;change D# 1250 STA ADRDOS+1 ;just in case WDS 1260 LDY #6 1270 L4 LDA AD}RDIR,Y ;move filename 1280 STA (INBUF),Y 1290 DEY 1300 BPL L4 1310 RTS 1320 PFN LDA #'F ;PROMPT FILENAME 1330 JSR }PRINT 1340 LDA #'N 1350 JSR PRINT 1360 LDA #'? 1370 JSR PRINT 1380 JMP GTREC 1390 WDS CMP #'W ;WRITE DOS.SYS 1400} BNE LOD 1410 JSR ASKDN 1420 INY 1430 L5 LDA ADRDOS,Y 1440 STA (INBUF),Y 1450 DEY 1460 BNE L5 1470 JSR OPN 148 }0 BPL B1 1490 LOD CMP #'L 1500 BNE SAV 1510 STA $FF 1520 JSR PFN 1530 LSR ICBAX ;8>4 1540 JSR OPN 1550 L6 JSR GE!}TCR2 ;get hdr in pairs 1560 LDA #$FF ;check headr and- 1570 CMP FR0 ;disregard #FF'S 1580 BNE SK2 1590 CMP FR0+1 160"}0 BEQ L6 1610 SK2 JSR FMOVE ;FP0 TO FP1 1620 JSR GETCR2 1630 JSR SUBTR ;subtr HI-LO &execute 1640 JSR CHKIN 1650 BE#}Q L6 1660 CHKIN LDA $2E3 1670 BEQ SK12 1680 JSR JMPINI 1690 LDA #0 1700 STA $2E3 1710 SK12 RTS 1720 SAV CMP#'S ;SA$}VE FUNCTION 1730 BNE RUN 1740 JSR PFN 1750 LDY #$FF ;check if append (/) 1760 L7 INY 1770 LDA (INBUF),Y 1780 CMP #%}'/ 1790 BNE SK4 1800 INC ICBAX ;9=append 1810 LDA #$9B 1820 STA (INBUF),Y 1830 SK4 CMP #$9B 1840 BNE L7 1850 JSR&} OPN ;open for write 1860 LDA #$FF ;start headr 1870 STA FR0 1880 STA FR0+1 1890 JSR PUTCR2 ;write it 1900 JSR INPC'}ON ;get from# 1910 JSR PUTCR2 ;write it 1920 JSR FMOVE ;store it 1930 JSR INPCON ;get to# 1940 JSR PUTCR2 ;write it (}1950 JSR SUBTR ;find len and save 1960 BPL B2 ;the rest 1970 RUN CMP #'@ ;RUN 1980 BNE CART 1990 JSR INPCON ;get # 2)}000 JMP (FR0) ;jump indirectly 2010 CART CMP #'C ;CARTRIDGE 2020 BNE ADOS 2030 JMP WARMST 2040 ADOS CMP#'! ;ESC TO ATA*}RI DUP 2050 BNE HEX 2060 LDA #$40 ;reset DOSINI for no- 2070 STA DOSINI ;trouble later 2080 LDA #$15 2090 STA DOSIN+}I+1 2100 JSR $1540 ;fast reset DOSVEC 2110 JMP OLDDOS 2120 HEX CMP #'$ ;HEX TO DEC 2130 BNE DEC 2140 JSR HASCI ;hex ,}to int 2150 JSR IASC ;int to dec 2160 BPL B2 2170 DEC CMP #'. ;DEC TO HEX 2180 BNE B2 2190 JSR DASCI ;dec to int 22-}00 JSR IHASC ; int to hex 2210 B2 BPL LSTCNC+2 2220 OPN LDA #OPEN ;IOCB MAIN SETUPS 2230 EXCMD LDX #$10 2240 BNE GTR2 .}2250 PTREC0 LDX #0 2260 PTREC LDA #PUTR 2270 BNE GTR2 2280 GETREC0 2290 GTREC LDA #GETR 2300 GTR2 STA ICBC,X 2310 LDA/} #$1E ;max rec length 2320 STA ICBLL,X 2330 LDA #LBUF/HI 2340 STA ICBAH,X 2350 LDA #LBUF&LO 2360 PGIN STA ICBAL,X 20}370 LDA #0 2380 STA ICBLH,X 2390 ICB JSR CIO ;let the OS take over 2400 BMI ERR 2410 RTN2 RTS 2420 PUTCR2 LDA #PUTC 1}2430 BNE GETC2 2440 GETCR2 LDA #GETC 2450 GETC2 LDX #$10 2460 STA ICBC,X 2470 LDA #2 2480 JG STA ICBLL,X 2490 LDA #2}0 2500 STA ICBAH,X 2510 LDA #FR0 2520 BNE PGIN 2530 CLSE LDA #CLOSE 2540 BPL EXCMD 2550 PRINT STA FR0 2560 LDX #03} 2570 LDA #PUTC 2580 STA ICBC,X 2590 LDA #1 2600 BPL JG 2610 ERR CPY #$03 ;ERR next read OK 2620 BEQ RTN2 2630 C4}PY #$88 ;ERR EOF OK too 2640 BEQ CINI 2650 TYA ;store ERR 2660 PHA 2670 LDA #$C5 ;inverted E for error 2680 JSR PR5}INT 2690 JSR FR0Z ;clear FP0 2700 PLA ;retrieve ERR 2710 STA FR0 2720 JSR IASC ;int to dec 2730 LSTCNC PLA ;clr sta6}ck of return 2740 PLA 2750 JMP ST ;do no pass GO 2760 CINI LDA $FF 2770 BEQ LSTCNC 2780 JSR CHKIN 2790 JRUN LDA $2E7}1 2800 BEQ LSTCNC 2810 JSR JMPRUN 2820 BNE LSTCNC 2830 INPCON LDA #'@ ;HEX OR DEC# TYPE 2840 JSR PRINT ;the @ means 8}AT/TO 2850 JSR GTREC 2860 LDY LBUF 2870 CPY #'. 2880 BEQ DASCI 2890 CPY #'$ 2900 BEQ HASCI 2910 BNE ERR ;bad in9}put 2920 DASCI JSR ASCFP ;DEC TO INT 2930 JMP FPI 2940 HASCI JSR FR0Z ;HEX TO INT 2950 LDY #1 2960 LB LDA (INBUF),Y 2:}970 CMP #$9B 2980 BEQ RTN 2990 SEC ;convert each digit 3000 SBC #$30 3010 CMP #$0A 3020 BMI SK7 3030 SBC #7 30;}40 SK7 LDX #4 ;times 16 3050 LA ASL FR0 3060 ROL FR0+1 3070 DEX 3080 BNE LA 3090 ORA FR0 ;add in new bits 3100 STA<} FR0 3110 INY 3120 BPL LB 3130 RTN RTS 3140 IHASC LDY #0 ;INT TO HEX SUBRT 3150 LDX #1 3160 LC LDA #$F0 ;hi mask 31=}70 AND FR0,X 3180 LSR A ;roll into low bits 3190 LSR A 3200 LSR A 3210 LSR A 3220 JSR CONVH ;go conv to digit 323>}0 LDA #$0F ;lo mask 3240 AND FR0,X 3250 JSR CONVH 3260 DEX 3270 BPL LC ;one more time 3280 BMI LE ;set eol and rtn?} 3290 CONVH CMP #$0A ;INT TO HEX DIGIT 3300 BMI SK9 3310 ADC #6 ;carry set 3320 SK9 ADC #$30 ;carry clr 3330 STA (INB@}UF),Y 3340 INY 3350 RTS 3360 IASC JSR IFP ;INT TO DEC 3370 JSR FPASC 3380 AREC LDY #0 ;CLR HI BIT/MAKE REC 3390 L9 LA}DA (INBUF),Y 3400 INY 3410 CMP #$80 ;find hi bit char 3420 BMI L9 3430 AND #$7F ;mask it 3440 DEY 3450 STA (INBUFB}),Y 3460 INY 3470 LE LDA #$9B ;set EOL 3480 STA (INBUF),Y 3490 JMP PTREC0 3500 SUBTR INC FR0 ;inclusive so inc 3510 C} BNE SK5 ;TO address 3520 INC FR0+1 3530 SK5 LDX #$10 3540 LDA FR1 3550 STA ICBAL,X 3560 LDA FR1+1 3570 STA ICBAH,D}X 3580 SEC ;CALC LENGTH 3590 LDA FR0 3600 SBC FR1 3610 STA ICBLL,X ;STORE AT IOCB 3620 LDA FR0+1 3630 SBC FR1+1 E}3640 JMP ICB+3 ;exec same cmd as last 3650 ; 3660 ; 3670 INIT JSR $1540 ;SRESET INIT 3680 JI LDA #END&LO 3690 STA MEMLF}O 3700 LDA #END/HI 3710 STA MEMLO+1 3720 LDA #ST&LO 3730 STA DOSVEC 3740 LDA #ST/HI 3750 STA DOSVEC+1 3760 RTS G} 3770 ; 3780 ; 3790 CMDTAB 3795 ;all spaces are one space 3800 .BYTE ">",$9B,$9B,"SD",$A1 3810 .BYTE " $>",$AE," .>",$H}A4 3820 .BYTE " SD",$D7," NR",$C0 3830 .BYTE " DO",$CC," VA",$D3 3840 .BYTE "TR",$C3," TM",$C6 3850 .BYTE " SR",$C5,"I} MN",$D2 3860 .BYTE " *N",$D5," KL",$AA 3870 .BYTE " RI",$C4,$9B 3880 TAB1 3890 .BYTE "RE*UF" 3900 TAB2 3910 .BYTE J}$20,$21,$23,$24,$FE 3920 ADRDIR 3930 .BYTE "D1:*.*",$9B 3940 ADRDOS 3950 .BYTE "D1:DOS.SYS",$9B 3960 END 3965 ;end afK}ter boot init executed 3970 ; 3980 ; 3990 INIT1 LDA #INIT&LO ;BOOT INIT 4000 STA DOSINI 4010 LDA #INIT/HI 4020 STA DL}OSINI+1 4030 JMP JI 4040 ; 4050 ; 4060 *= $2E2 ;LOAD AND GO INIT ADR 4070 .WORD INIT1 4080 .END 轤{NAMEk Macro library usage definitions Page 1 MACRO usages N} *=*=*=*=*=*=*=*=*=*=*=*=* * Data placement * O} *=*=*=*=*=*=*=*=*=*=*=*=* MEM Developmental ORG [When developing programs tP}hat will run in 16K, it is advantageous to locate them above DOS (typically $4000 to $7FFF) although they will Q} ultimately run at around $600 or so. This makes it easier to load modules to be written to boot disks etc. wR}ithout using a separate utility.] During development, set OFFSET = $4000 and DEVELOP = OFFSET. This will S} put code in high memory and execute it there. On the final assembly, set DEVELOP = 0. This will assemble code asT} though it would run in low memory, but write the binary file to load the program image to high memory. U} Usage: MEM address Example: MEM $800 yields: given:(V}DEVELOP = $4000) (OFFSET = 0) ORG $4800 LOC $800 W}USEBEG My "USE" [The AMAC USE command simply doesn't work. This crude kludge saves the current LOC and X}ORG counters to allow temporary re-placement of inline code. This uses the MEM macro to update ORG and LOC accordY}ing to developmental variables. Also uses local labels, so USEBEG and USEEND must both reside in the same PROC mZ}odule, and cannot be nested.] Usage: USEBEG address Example: USEBEG $[}3000 yields: Macro library usage definitions Page 2 :otmp SET *O \} :ltmp SET *L MEM $3000 USEEND Recovery from USEBEG Restores O]}RG and LOC counters after temporary resetting via USEBEG. Usage: USEEND (no operand) P^}roduces: ORG :otmp LOC :ltmp *=*=*=*=*=_}*=*=*=*=*=*=*=* * 8-bit arithmetic * *=*=*=*=*=*=*=*=*=*=*=*=* `} ADD Add WITHOUT carry Usage: ADD #constant ADD addresa}s ADD address,X ADD address,Y Example: ADD TROGS,Y b} yields: CLC ADC TROGS,Y SUB Subtract WITHOUT carry c} Usage: SUB #constant SUB address SUB address,X SUBd} address,Y Example: SUB #$30 yields: SEC Macroe} library usage definitions Page 3 SBC #$30 DIV Divide A by a power of 2 f} Usage: DIV power of 2 Example: DIV 8 yields: LSR g} A LSR A LSR A MUL Multiply A by a power of 2 Usagh}e: MUL power of 2 Example: MUL 16 yields: ASL A i} ASL A ASL A ASL A BMP Add constant to byte at addrj}ess Usage: BMP address,constant BMP address,X,constant BMP addressk},Y,constant Example: BMP BORT,125 yields: LDA BORT l} CLC ADC #125 STA BORT BAK Subtract constant from byte at addrm}ess Usage: BAK address,constant BAK address,X,constant BAK addressn},Y,constant Macro library usage definitions Page 4 Example: BAK GLERo}X,Y,$42 yields: LDA GLERX,Y SEC SBC #$42 STA p} GLERX,Y *=*=*=*=*=*=*=*=*=*=*=*=* * 16-bit aq}rithmetic * *=*=*=*=*=*=*=*=*=*=*=*=* ADW Add two words at addresses and r}store at a third Usage: ADW address 1,address 2,dest. address Example: ADW s}WREG,TEDUK,WREG yields: LDA WREG CLC ADC TEDUK t} STA WREG LDA WREG+1 ADC TEDUK+1 STA WREG+1 u} SBW Subtract two words at addresses and store at a third Usage: SBW address 1,address 2,dest. addrev}ss Example: SBW VEP,QWERTY,GADS yields: LDA VEP Sw}EC SBC QWERTY STA GADS LDA VEP+1 SBC QWERTY+1x} STA GADS+1 BMPW Add a constant to a word at address Usage: BMPW y}address,constant Macro library usage definitions Page 5 Example: BMPW z} KLUT,$4258 yields: LDA KLUT CLC ADC #$58 STA {} KLUT LDA KLUT+1 ADC #$42 STA KLUT+1 BAKW |} Subtract a constant from a word at address Usage: BAKW address,constant Example: }} BAKW NATHIL,HPOS yields: LDA NATHIL SEC SBC #LOW HPO~}S STA NATHIL LDA NATHIL+1 SBC #HIGH HPOS STA }NATHIL+1 INW Increment a word at address Usage: INW address Example: } INW GOLD yields: INC GOLD BNE LABEL INC } GOLD+1 LABEL = * DEW Decrement a word at address Usage: DEW addres}s Example: DEW ZUGG yields: Macro library usage definitions P}age 6 LDA ZUGG BNE LABEL DEC ZUGG+1 LABEL DEC Z}UGG *=*=*=*=*=*=*=*=*=*=*=*=*=* * Conditional branc}hes * *=*=*=*=*=*=*=*=*=*=*=*=*=* Usage for all branch instructions: } XXX address BGE Branch on Greater than or Equal to BGT Branch on Greater than } BLE Branch on Less than or Equal to BLT Branch on Less than BNZ Branch on Non} Zero BZ Branch on Zero *=*=*=*=*=*=*=*=*=*=*=*=* } * Conditional jumps * *=*=*=*=*=*=*=*=*=*=*=*=* Usage for all} jump instructions: XXX address JMI Jump on Minus JPL Jump on Plus } JCS Jump on Carry Set JCC Jump on Carry Clear Macro library usage definition}s Page 7 JGE Jump on Greater than or Equal to JGT Jump on Greater than JL}E Jump on Less than or Equal to JLT Jump on Less than JNE Jump on Not Equal J}NZ Jump on Non Zero JEQ Jump on Equal to JZ Jump on Zero } *=*=*=*=*=*=*=*=*=*=*=*=* * Auto decrement and * * } branches * *=*=*=*=*=*=*=*=*=*=*=*=* [The sequence: } LDX #value LABEL .... DEX BPL LABEL to repeat a routine "valu}e" number of times is used frequently enough =that it warrants special commands. These macros are smart enough to } determine whether to branch or jump, but not smart enough to branch forward.] DXPL Decreme}nt X and Branch on Plus Usage: DXPL address Example: DXPL LABEL yi}elds: DEX Macro library usage definitions Page 8 BPL LABEL } DYPL Decrement Y and Branch on Plus Usage: DYPL address DCPL Decremen}t a byte at address and Branch on Plus Usage: DCPL address,branch address Example: } DCPL SAXTRY,LABEL yields: DEC SAXTRY BPL LABEL DXNZ} Decrement X and Branch on Non Zero Usage: DXNZ address DYNZ Decrement Y and Bra}nch on Non Zero Usage: DYNZ address DCNZ Decrement a byte at address and Branch on No}n Zero Usage: DCNZ address,branch address *=*=*=*=*=*=*=*=*=*}=*=*=* * Comparisons * *=*=*=*=*=*=*=*=*=*=*=*=* } CPI Compare a byte at address with a constant Usage: CPI address,constant CPI } address,X,constant CPI address,Y,constant Example: CPI FRUITY,X,$80 } Macro library usage definitions Page 9 yields: LDA FRUITY,X } CMP #$80 CPB Compare two bytes at addresses Usage: CPB address 1,address 2} Example: CPB SWEET,SOUR yields: LDA SWEET CMP } SOUR CPW Compare two words at addresses Usage: CPW address 1, address 2 } Example: CPW LEFT,RIGHT yields: LDA LEFT+1 CMP RIGH}T+1 BNE LABEL LDA LEFT CMP RIGHT LABEL = * } CPIW Compare a word at address with a 16-bit constant Usage: CPIW address,constant } Example: CPIW ZIPPER,14352 yields: LDA ZIPPER+1 CMP }#HIGH 14352 BNE LABEL LDA ZIPPER CMP #LOW 14352 LABEL = } * *=*=*=*=*=*=*=*=*=*=*=*=* * Memory Manip}ulation * *=*=*=*=*=*=*=*=*=*=*=*=* Macro library usage definitions Page 10} STB Store a byte at an address Usage: STB constant,address STB } constant,address,X STB constant,address,Y Example: STB $52,ICCMD,X } yields: LDA #$52 STA ICCMD,X MVB Move a byte from one a}ddress to another Usage: MVB address 1,address 2 MVB address 1,X,address 2 } MVB address 1,Y,address 2 MVB address 1,address 2,X MVB address 1,a}ddress 2,Y MVB address1,X,address2,X MVB address1,X,address2,Y MVB } address1,Y,address2,X MVB address1,Y,address2,Y Example: MVB JUICE},Y,PULP yields: LDA JUICE,Y STA PULP MVW Move a word} from one address to another Usage: MVW address 1,address 2 Example: MVW FR}UM,TOO yields: LDA FRUM STA TOO LDA FRUM+1 } STA TOO+1 STW Store a 16-bit constant at an address Macro library usage defin}itions Page 11 Usage: STW constant,address Example: STW DLADDR,SDL}STL yields: LDA #LOW DLADDR STA SDLSTL LDA #HIGH DLADD}R STA SDLSTL+1 *=*=*=*=*=*=*=*=*=*=*=*=* } * Stack Manipulation * *=*=*=*=*=*=*=*=*=*=*=*=* Usage for all stac}k instructions: XXX (no operands...) PHR / PLR Push (Pull) all registers [NOTE}: PHX/PHY/PLX/PLY use the A register, so make sure it's saved or pushed before calling.] PHX / PLX Pus}h (Pull) X register PHY / PLY Push (Pull) Y register *=*=*=*=*=}*=*=*=*=*=*=*=* * Miscellaneous * *=*=*=*=*=*=*=*=*=*=*=*=* } ATTRACT Color-shift A register for attract mode Usage: ATTRACT (no operand) Pr}oduces: EOR COLRSH AND DRKMSK Macro library usage }definitions Page 12 Files MACRO usages } FCLOSE Closes an open file. All that is required is a channel number. If X already holds the proper channel, }you can specify "X" as the channel, and the macro will skip the LDX part. (This is true for any of the file comman}ds.) Usage: FCLOSE channel Example: FCLOSE 6 closes channe}l #6. SAME AS BASIC: CLOSE #channel FOPEN Opens a device to a specified channel. "Devnam}e" should be the address of the filename in ASCII, terminated by an EOL. Aux1 and Aux2 must be specified. } Usage: FOPEN channel,devname,aux1,aux2 Example: FOPEN 4,RNAME,13,0 } ... RNAME DB 'R2:',$9B opens R2: to channel 4 for concurrent I/O. SAME AS BASIC:} OPEN #channel,aux1,aux2,"devname" FGET Gets characters or a record from a designated channel. "Typ}e" is either CHR for characters or REC for record. "Address" is the address of the buffer to receive the data. "}Length" is optional. For characters, it should equal the number of characters to fetch; for a record, it is the m}aximum number of characters to get (string is returned only on [RETURN].) If "length" is not specified, it i}s arbitrarily set to $FFFF. Usage: FGET channel,type,address[,length] Example}: Macro library usage definitions Page 13 FGET 2,CHR,GETBUF,16 ...} GETBUF DS 16 gets 16 characters from channel #2. FGET channel,CHR,address,length SA}ME AS BASIC: FOR NC=1 to length GET #channel,var address$(NC,NC)=chr$(var}) NEXT NC FGET channel,REC,address,length SAME AS BASIC: INPUT #channel,address$ } FGET1 A special case of FGET to get 1 character. No buffer is specified, because the characte}r is returned in the Accumulator. Usage: FGET1 channel Example: FGET1 } 2 gets 1 character in A from channel #2. SAME AS BASIC: GET #channel,var FPUT } Same as FGET, except to put characters to a channel. Usage: FPUT channel,type,address[,leng}th] Example: FPUT 0,REC,STRING ... STRING DB 'HI THERE, LOUISE!',EO}L puts the string "HI THERE, LOUISE!" to the screen editor (channel #0). Note: In most cases, the scre}en editor is always open to channel #0 and can be used in the DOS/BASIC environment without having to OPEN it. } FPUT channel,CHR,address,length SAME AS BASIC: FOR NC=1 TO length var=ASC(address$(}NC,NC)) PUT #channel,var NEXT NC FPUT channel,REC,address,length } SAME AS BASIC: PRINT #channel;address$ Macro library usage definitions Page 14 } FPUT1 Same as FGET1, except to put one character in the Accumulator. Usage: FPUT1 chan}nel Example: FPUT1 4 sends the value in A to channel #4. SAME AS BASIC: } PUT #channel,var FSPEC "XIO" type command. "Command" is command number. Aux1 and Aux2 must be s}pecified. Usage: FSPEC channel,command,devname,aux1,aux2 Example: FSPEC} 4,35,FILNAM,0,0 ... FILNAM DB 'D2:PROGRAM.BAS',$9B unlocks "PROGRAM.BAS" on disk }drive 2, using channel #4. SAME AS BASIC: XIO command,#channel,aux1,aux2,"devname" FSTAT } Get channel status. "Devname" is optional; if specified, it means a "special" status on an un"OPEN"ed device. "OPEN}"s channel, gets status, and then "CLOSE"s channel automatically. In any case, 4 status bytes are returned to D}VSTAT ($2EA) to DVSTAT+3. See hardware manual for significance. Usage: FSTAT channel[,devname] } Example: FSTAT 4 checks for status on channel #4. SAME AS BASIC: STATUS #channel},var <=>?@ABCDEF$*My SYSTEXT *Version 6 OPEN=3 GETREC=5 GETCHR=7 PUTREC=9 PUTCHR=11 CLOSE=12 STATIS=13 SPECIL=14 } DRAWLN=$11 FILLIN=$12 RENAME=$20 DELETE=$21 FORMAT=$22 LOCKFL=$23 UNLOCK=$24 POINT=$25 NOTE=$26 I }OCFRE=$FF APPEND=$01 DIRECT=$02 OPNRD=$04 OPNWT=$08 OPNRW=$0C MXDMOD=$10 INSCLR=$20 SCREDT='E' KBD }='K' DISPLY='S' PRINTR='P' CASSET='C' MODEM='M' DISK='D' EOL=$9B CR=EOL Z=$00 TRUE=$FFFF ON=T }RUE FALSE=0 OFF=FALSE *--------------- CASINI=$02 WARMST=$08 BOOT?=$09 DOSVEC=$0A DOSINI=$0C APPMHI= }$0E POKMSK=$10 BRKKEY=$11 RTCLOK=$12 SOUNDR=$41 ATRACT=$4D DRKMSK=$4E COLRSH=$4F VDSLST=$200 VKEYBD }=$208 VTIMR1=$210 VTIMR2=$212 VTIMR4=$214 VIMIRQ=$216 CDTMV1=$218 CDTMV2=$21A CDTMV3=$21C CDTMV4=$21 }E CDTMV5=$220 VVBLKI=$222 VVBLKD=$224 CDTMA1=$226 CDTMA2=$228 CDTMF3=$22A SRTIMR=$22B CDTMF4=$22C CD }TMF5=$22E SDMCTL=$22F SDLSTL=$230 SDLSTH=$231 SSKCTL=$232 COLDST=$244 GPRIOR=$26F PADDL0=$270 STICK0 }=$278 PTRIG0=$27C STRIG0=$284 SHFLK=$2BE PCOLR0=$2C0 PCOLR1=$2C1 PCOLR2=$2C2 PCOLR3=$2C3 COLOR0=$2C4 } COLOR1=$2C5 COLOR2=$2C6 COLOR3=$2C7 COLOR4=$2C8 MEMLO=$2E7 CRSINH=$2F0 CHACT=$2F3 CHBAS=$2F4 CH=$ }2FC DDEVIC=$300 DUNIT=$301 DCOMND=$302 DSTATS=$303 DBUFLO=$304 DBUFHI=$305 DTIMLO=$306 DBYTLO=$308 D }BYTHI=$309 DAUX1=$30A DAUX2=$30B ICCOM=$342 ICSTA=$343 ICBAL=$344 ICBAH=$345 ICPTL=$346 ICPTH=$347 } ICBLL=$348 ICBLH=$349 ICAX1=$34A ICAX2=$34B DSKINV=$E453 CIOV=$E456 IOCB0=$00 IOCB1=$10 IOCB2=$20 } IOCB3=$30 IOCB4=$40 IOCB5=$50 IOCB6=$60 IOCB7=$70 SIOV=$E459 SETVBV=$E45C SETMR1=1 SETMR2=2 SETMR }3=3 SETMR4=4 SETMR5=5 SETIMM=6 SETDEF=7 XITVBL=$E462 WARMSV=$E474 COLDSV=$E477 HPOSP0=$D000 HPOSP1 }=$D001 HPOSP2=$D002 HPOSP3=$D003 M0PF=$D000 M1PF=$D001 M2PF=$D002 M3PF=$D003 HPOSM0=$D004 HPOSM1=$D }005 HPOSM2=$D006 HPOSM3=$D007 P0PF=$D004 P1PF=$D005 P2PF=$D006 P3PF=$D007 M0PL=$D008 M1PL=$D009 M2PL }=$D00A M3PL=$D00B SIZEP0=$D008 SIZEP1=$D009 SIZEP2=$D00A SIZEP3=$D00B P0PL=$D00C P1PL=$D00D P2PL=$D }00E P3PL=$D00F SIZEM=$D00C GRAFP0=$D00D TRIG0=$D010 TRIG1=$D011 TRIG2=$D012 TRIG3=$D013 GRAFM=$D011 }COLPM0=$D012 COLPF0=$D016 COLPF1=$D017 COLPF2=$D018 COLPF3=$D019 COLBK=$D01A PRIOR=$D01B VDELAY=$D01C } GRACTL=$D01D HITCLR=$D01E CONSOL=$D01F POT0=$D200 AUDF1=$D200 AUDF2=$D202 AUDF3=$D204 AUDF4=$D206 AU }DC1=$D201 AUDC2=$D203 AUDC3=$D205 AUDC4=$D207 AUDCTL=$D208 ALLPOT=$D208 KBCODE=$D209 STIMER=$D209 RAN }DOM=$D20A SERIN=$D20A SKREST=$D20A POTGO=$D20B SEROUT=$D20C IRQEN=$D20E IRQST=$D20E SKCTL=$D20F SKSTA }T=$D20F PORTA=$D300 PORTB=$D301 PACTL=$D302 PBCTL=$D303 DMACTL=$D400 CHACTL=$D401 DLISTL=$D402 DLISTH }=$D403 HSCROL=$D404 VSCROL=$D405 PMBASE=$D407 CHBASE=$D409 WSYNC=$D40A VCOUNT=$D40B NMIEN=$D40E NMIRE }S=$D40F NMIST=$D40F DLBL1=$00 DLBL2=$10 DLBL3=$20 DLBL4=$30 DLBL5=$40 DLBL6=$50 DLBL7=$60 DLBL8= }$70 DLJMP=$01 DLJVB=$41 DLHSCR=$10 DLVSCR=$20 DLLMS=$40 DLINT=$80 DLAM2=2 DLAM3=3 DLAM4=4 DLAM5= }5 DLAM6=6 DLAM7=7 DLAM8=8 DLAM9=9 DLAM10=10 DLAM11=11 DLAM12=12 DLAM13=13 DLAM14=14 DLAM15=15 } DLBM0=DLAM2 DLBM1=DLAM6 DLBM2=DLAM7 DLBM3=DLAM8 DLBM4=DLAM9 DLBM5=DLAM10 DLBM6=DLAM11 DLBM7=DLAM13 D }LBM8=DLAM15 SWSTRT=$01 SWSEL=$02 SWOPT=$04 JYR=$08 JYL=$04 JYB=$02 JYF=$01 *Macro library *V }ersion9 * Data placement MEMMACRO address ORG%1+offset LOC%1+develop ENDM USEMACRO address :otmpset*O } :ltmpset*L MEM%1 ENDM USEENDMACRO org:otmp loc:ltmp ENDM * 8-bit arithmetic ADDMACRO 8con/loc [,in }dex reg] %Lclc IF['[%2]'='[X]']OR['[%2]'='[Y]']  adc%1,%2 ELSE  adc%1 ENDIF ENDM SUBMACRO 8con/loc [,ind }ex reg] %Lsec IF['[%2]'='[X]']OR['[%2]'='[Y]']  sbc%1,%2 ELSE  sbc%1 ENDIF ENDM DIVMACRO pwrof2 %Llsr }a %MCset%1/2 IF%MC>1  DIV%MC ELSE %MC set0 ENDIF ENDM MULMACRO pwrof2 %Lasla %MCset%1/2 IF%MC> }1  MUL%MC ELSE %MC set0 ENDIF ENDM BMPMACRO loc [,index reg] ,8con IF['[%2]'='[X]']OR['[%2]'='[Y]'] %L l }da%1,%2  add#%3  sta%1,%2 ELSE %L lda%1  add#%2  sta%1 ENDIF ENDM BAKMACRO loc [,index reg] ,8con }IF['[%2]'='[X]']OR['[%2]'='[Y]'] %L lda%1,%2  sub#%3  sta%1,%2 ELSE %L lda%1  sub#%2  sta%1 ENDIF E }NDM * 16-bit arithmetic ADWMACRO loc1,loc2,destloc %Llda%1 add%2 sta%3 lda%1+1 adc%2+1 sta%3+1 END }M SBWMACRO loc1,loc2,destloc %Llda%1 sub%2 sta%3 lda%1+1 sbc%2+1 sta%3+1 ENDM BMPWMACRO address,1 }6con %Llda%1 add#low[%2] sta%1 IF[high %2]=0  bcc?%K  inc%1+1 ?%K=* ELSE  lda%1+1  adc#high[%2] }  sta%1+1 ENDIF ENDM BAKWMACRO address,16con %Llda%1 sub#low[%2] sta%1 IF[high %2]=0  bcs?%K  dec }%1+1 ?%K=* ELSE  lda%1+1  sbc#high[%2]  sta%1+1 ENDIF ENDM DEWMACRO word %Llda%1 bne?%K dec%1+ }1 ?%Kdec%1 ENDM INWMACRO word %Linc%1 bne?%K inc%1+1 ?%K=* ENDM * Conditional branches BGEMACRO } loc %Lbcs%1 ENDM BGTMACRO loc %Lbcc?%K bne%1 ?%K=* ENDM BLEMACRO loc %Lbcc%1 beq%1 ENDM B }LTMACRO loc %Lbcc%1 ENDM BNZMACRO loc %Lbne%1 ENDM BZMACRO loc %Lbeq%1 ENDM * Conditional jumps } JMIMACRO loc %Lbpl?%K jmp%1 ?%K=* ENDM JPLMACRO loc %Lbmi?%K jmp%1 ?%K=* ENDM JCSMACRO loc % }Lbcc?%K jmp%1 ?%K=* ENDM JCCMACRO loc %Lbcs?%K jmp%1 ?%K=* ENDM JGEMACRO loc %Lblt?%K jmp% }1 ?%K=* ENDM JGTMACRO loc %Lble?%K jmp%1 ?%K=* ENDM JLEMACRO loc %Lbgt?%K jmp%1 ?%K=* ENDM } JLTMACRO loc %Lbge?%K jmp%1 ?%K=* ENDM JNEMACRO loc %Lbz?%K jmp%1 ?%K=* ENDM JNZMACRO loc } %Lbz?%K jmp%1 ?%K=* ENDM JEQMACRO loc %Lbnz?%K jmp%1 ?%K=* ENDM JZMACRO loc %Lbnz?%K jmp% }1 ?%K=* ENDM * Auto decrement and branches DXPLMACRO loc %Ldex IF%1='*'  bpl*-1 ELSE  IF[[*>%1]&[[ }*-%1]<126]]OR[[*<%1]&[[%1-*]<129]]  bpl%1  ELSE  jpl%1  ENDIF ENDIF ENDM DYPLMACRO loc %Ldey IF%1= }'*'  bpl*-1 ELSE  IF[[*>%1]&[[*-%1]<126]]OR[[*<%1]&[[%1-*]<129]]  bpl%1  ELSE  jpl%1  ENDIF ENDIF }ENDM DXNZMACRO loc %Ldex IF%1='*'  bnz*-1 ELSE  IF[[*>%1]&[[*-%1]<126]]OR[[*<%1]&[[%1-*]<129]]  bnz%1 }  ELSE  jnz%1  ENDIF ENDIF ENDM DYNZMACRO loc %Ldey IF%1='*'  bnz*-1 ELSE  IF[[*>%1]&[[*-%1] }<126]]OR[[*<%1]&[[%1-*]<129]]  bnz%1  ELSE  jnz%1  ENDIF ENDIF ENDM DCPLMACRO address,loc %Ldec%1  }IF%2='*'  IF%1<$100  bpl*-2  ELSE  bpl*-3  ENDIF ELSE  IF[[*>%2]&[[*-%2]<126]]OR[[*<%2]&[[%2-*]< }129]]  bpl%2  ELSE  jpl%2  ENDIF ENDIF ENDM DCNZMACRO address,loc %Ldec%1 IF%2='*'  IF%1<$10 !}0  bnz*-2  ELSE  bnz*-3  ENDIF ELSE  IF[[*>%2]&[[*-%2]<126]]OR[[*<%2]&[[%2-*]<129]]  bnz%2  ELSE "} jnz%2  ENDIF ENDIF ENDM * 8-bit comparison CPIMACRO loc [,index reg] ,8con IF['[%2]'='[X]']OR['[%2]'='[ #}Y]'] %L lda%1,%2  cmp#%3 ELSE %L lda%1  cmp#%2 ENDIF ENDM CPBMACRO loc1,loc2 %Llda%1 cmp%2 ENDM $} * 16-bit comparison CPWMACRO loc1,loc2 %Llda%1+1 cmp%2+1 bne?%K lda%1 cmp%2 ?%K=* ENDM CPIWMA %}CRO loc,16con %Llda%1+1 cmp#high[%2] bne?%K lda%1 cmp#low[%2] ?%K=* ENDM * Memory manipulation STB &}MACRO 8con,loc [,index reg] %Llda#%1 IF['[%3]'='[X]']OR['[%3]'='[Y]']  sta%2,%3 ELSE  sta%2 ENDIF ENDM M '}VBMACRO loc1 [,index reg] ,loc2 [,index reg] IF['[%4]'='[X]']OR['[%4]'='[Y]'] %L lda%1,%2  sta%3,%4 ELSE  IF (}['[%2]'='[X]']OR['[%2]'='[Y]'] %L lda%1,%2  sta%3  ELSE %L lda%1  IF['[%3]'='[X]']OR['[%3]'='[Y]']  )} sta%2,%3  ELSE  sta%2  ENDIF  ENDIF ENDIF ENDM MVWMACRO word1,word2 %Llda%1 sta%2 lda%1+1 *} sta%2+1 ENDM STWMACRO 16con,word %Llda#low[%1] sta%2 lda#high[%1] sta%2+1 ENDM * Stack manipulatio +}n PHRMACRO %Lpha txa pha tya pha ENDM PLRMACRO %Lpla tay pla tax pla ENDM PHXMACRO %Ltx ,}a pha ENDM PLXMACRO %Lpla tax ENDM PHYMACRO %Ltya pha ENDM PLYMACRO %Lpla tay ENDM * Mis -}cellaneous ATTRACTMACRO %Leorcolrsh anddrkmsk ENDM *Files macro library *Version 3 * Close file F .}CLOSEMACRO iocb %L IF'%1'<>'X' ldx#%1*$10 ENDIF stbclose,iccom,x jsrciov ENDM * Open file FOPENMACRO /} iocb,devname,aux1,aux2 %L IF'%1'<>'X' ldx#%1*$10 ENDIF stbopen,iccom,x stblow[%2],icbal,x stbhigh[%2],icba 0}h,x stb%3,icax1,x stb%4,icax2,x jsrciov ENDM * Get character or record * Type = "CHR" or "REC" * If no length 1}, then length = $FFFF FGETMACRO iocb,type,address,length %L IF'%1'<>'X' ldx#%1*$10 ENDIF IF'%2'='CHR' stbg 2}etchr,iccom,x ELSE stbgetrec,iccom,x ENDIF stblow[%3],icbal,x stbhigh[%3],icbah,x IF'[%4]'<>'[]' stblow[%4 3}],icbll,x stbhigh[%4],icblh,x ELSE stb$ff,icbll,x staicblh,x ENDIF jsrciov ENDM FGET1MACRO iocb %L I 4}F'%1'<>'X' ldx#%1*$10 ENDIF stbgetchr,iccom,x stb0,icbll,x staicblh,x jsrciov ENDM * Put character or 5}record * Type = "CHR" or "REC" * If no length, then length = $FFFF FPUTMACRO iocb,type,address,length %L IF'%1'<>'X 6}' ldx#%1*$10 ENDIF IF'%2'='CHR' stbputchr,iccom,x ELSE stbputrec,iccom,x ENDIF stblow[%3],icbal,x stb 7}high[%3],icbah,x IF'[%4]'<>'[]' stblow[%4],icbll,x stbhigh[%4],icblh,x ELSE stb$ff,icbll,x staicblh,x ENDI 8}F jsrciov ENDM FPUT1MACRO iocb %L IF'%1'<>'X' ldx#%1*$10 ENDIF pha stbputchr,iccom,x stb0,icbll,x 9}staicblh,x pla jsrciov ENDM * "Special" command (XIO...) FSPECMACRO iocb,command,devname,aux1,aux2 %L IF' :}%1'<>'X' ldx#%1*$10 ENDIF stb%2,iccom,x stblow[%3],icbal,x stbhigh[%3],icbah,x stb%4,icax1,x stb%5,icax2, ;}x jsrciov ENDM * File status * If devname, then open & close iocb FSTATMACRO iocb,devname %L IF'%1'<>'X' l <}dx#%1*$10 ENDIF stbstatis,iccom,x IF'[%2]'<>'[]' stblow[%3],icbal,x stbhigh[%3],icbah,x ENDIF jsrciov E =}NDM 8 CLC8˥8 @eݥe @`hhh$E)DΩꍍCC+D  MACWDG IS A MACHINE LANGUAGE UTILITY DESIGNED FOR USE WITH THE MAC/65 ASSEMBLER FROM OSS. IT IS FUNCTIONALLY EQUIVALENT TO ?}MY EARLIER BASWDG PROGRAM, PROVIDING ACCESS TO SIMPLE DOS FUNCTIONS WITHOUT EXIT TO DUP.SYS. If you already have BASWDG, y@}ou don't need this whole DOC file..the functions are pretty much the same. However READ THE NEXT 4 PARAGRAPHS!!! THERE IS A}A 'DOCUMENTED FEATURE' (I.E. WEIRD BUG) DO NOT PRESS WHILE YOU ARE IN THE MACWDG MENU. IF, FOR SOME REASON YOU DB}O, YOUR COMPUTER WILL GET HINKY. FORTUNATELY, IT WON'T CRASH IMMEDIATELY. SAVE ANY WORK YOU NEED, AND THEN DO A COMPLETE COLDC}-START. IF YOU DON'T, MAC COLD-START ON THE NEXT RESET!! AAARGH!!!! I'VE BEEN TRYING TO TRACK THIS DOWN FORD} A YEAR, WITH NO LUCK. BUT I HONESTLY THINK THAT THE PROGRAM IS USEFUL ENOUGH THAT, AS LONG AS YOU DON'T DO THAT E}... WHAT IT DOES Once MACWDG is installed, it takes over the computer's DOS vector. When you issue a DOS commF}and, instead of loading DUP.SYS, you'll run MACWDG. It presents a Quick Menu for the most commonly used disk functions withouG}t disturbing your code in EDIT or TEXT (so you can save those 45 sectors for MEM.SAV on D8.) Trust me. This is a lot faster, H}and less hassle than constantly going to DUP. This is an Old Idea. I've tailored MACWDG to match my own programming needs aI}nd quirks. You can do the same thing. See MACWDG.M65 for Source Code. NUMBERS Check the title screen for CJ}ritical Values. The RESET defaults are MACWDG shadows. You can change them with a D command in DDT. TEXT and BACK set MAC'sK} internal color registers (info from the ubiquitous Bill Wilkinson). Poke them as you would 709 and 710 in Basic. The keyboarL}d is speeded up. These shadow 729,730. ABSOLUTELY RESERVED MEMORY Starting at $1CFC, this block is QUITE SMALL. It M}should NEVER, EVER, be overwritten. MACWDG lives mostly in 'SHADOW RAM', UNDER the OSS cartridge (another thank you to OSS N}for info!) When you call it by typing DOS, MAC is disabled, and MACWDG runs. Exit and MAC is back. What that means is that yoO}u have a 1K+ program that steals less than a page from free memory. Handy, no? MACWDG MENU FUNCTIONS P} DIRECTORY Type the drive number. If RAMDISK.COM hasn't loaded, or if you're using DOS 2.0, only 1 or 2 are allowed. OthQ}erwise you have D8: to play with...hoo-hah. DEFAULT DRIVE That's the drive that doesn't need a Device Spec (egR}. D1:) when typing in file names. In DUP.SYS, the Default is always D1: In the MACWDG menu, things are more flexible. THE MS}ACWDG DEFAULT DRIVE IS THE LAST DRIVE FROM WHICH YOU READ A DIRECTORY. The intent is to default to the drive whose files arT}e currently listed on the screen. This can be confusing until you get used to it. So there are a couple of helps: D: is ALU}WAYS translated to D1: The FULL FILESPEC, as translated, is printed on the screen before any action is taken. LOOK AT IT! V}If it's not what you intended, you can bail out. CHANGED YOUR MIND? The All Purpose Quit Key is BREAK. At ANY proW}mpt, pressing it will exit to the menu. BREAK disabled? There are a couple of alternatives: AT FILE NAME 'INPUT' PROMPTS:X} use a 'Null Input.' Press RETURN ONLY with no name. AT ANY OTHER PROMPT: hit ESCAPE. CONFIRM Before MACWY}DG acts, it will ask 'OK?', just to make sure that you really want to do what you said. 1) Want to quit? Hit BREAK,ESCape, Z}or N (for NO, of course.) 2) Go ahead? Any other key. FILE COMMANDS These are E (Erase), R (Rename), and M ([}Move File) At the command prompts, INPUT the filename (remember, no device spec needed if you're using the DEFAULT.) Abort by\} pressing RETURN only, or BREAK. ERASE zaps the selected file. RENAME works in the normal fashion. Type the old name, a ]}comma, and the new name. Sorry, you STILL have to watch out for duplicate names (don't blame me..I'm just using XIO 32!) Use ^}RENAME with the target directory on the screen to make sure you're not doing something nasty. Make sure you complete INPUT, p_}roviding the comma and new name. Otherwise, you're liable to find your file renamed to SECTORS (what?) MOVE IT`}! This is my favorite. The MOVE command combines the functions of COPY FILE (C) and DUPLICATE FILE (O) in the DUP.SYS menu.a} It's especially useful with D8. MOVE uses 'Free RAM', starting at the top of your program, for its buffer (do you have datab} up there? Careful.) The smaller your program the bigger the buffer. (Error 2 means your RAM is full!) MOVE COMMc}ANDS There are SEPARATE PROMPTS for FROM and TO filenames. Remember to use the Default to cut down on typing. Any legal dd}evice (E:, P:, C:, D:) can be used. Please remember the colon! THE LEYENBERGER OPTION If you want to use the SAME Fe}ILE NAME for a disk MOVE, you can type ONLY the Device Spec (INCLUDING THE COLON!) at the TO prompt. The FROM file name will f}be appended. COPY or DUPLICATE? COPY FILE (no swaps) is automatically assumed with files that don't go TO disk. Hg}andy for dumping text files to P: or screen (E:) Likewise if you use 2 different drives (like MOVEing a file to D8 from D1) q} BMACRDS BINBB MACRDS SRCBMMACROS DOCBYMACROS LIBB7>MACWDG DOCBy~MACWDG M65BMACWDG OBJB NOCAPS BASB,NOCAPS DOCB;NOCAPS M65BUNX10DR OBJBXNX10NL OBJB[NXDRFT CNFB^NXNLQ CNFBaPASEXP DOCBsPASEXP PASByPRTSCK ASMBPRTSCK XMOB0RAMXE ASMBRAMXE XMO If the SAME D:num is used for FROM and TO, MACWDG invokes DUPLICATE FILE, and prompts for swaps. These work like 'OK?' BRr}EAK/ESC/N to exit, or RETURN to continue. Depending on exactly where you are in the process, an exit may leave you with a pars}tial file on the TO disk. Erase as necessary. For severe problems, (inserted the wrong disk?) use DISKFIX.COM. EXt}ITING MACWDG Cart returns you to EDIT or TEXT. To go all the way and exit to DUP.SYS, type @ (SHIFT-8.) That's intentionau}lly a two-finger combo, to avoid accidents. DUP.SYS?? I try to avoid DUP.SYS, but sometimes it's necessary (v}DISKFIX!) IF MEM.SAV IS ACTIVE WHEN YOU EXIT DUP.SYS WITH THE B COMMAND, MACWDG is still there. However, it has been unhookw}ed (safety first) To rehook it, go to DDT,*$0C, then DFC1C to reinstall the DOSINI hook. Exit DDT, and RESET. MACWDG is x}back. Do this BEFORE any drastic action like a RESET, LOAD, or NEW. DO make sure that MEM.SAV has restored the RAM. LIST if y}you're not sure. Remember that using options C and O in DUP can zap MEM.SAV (That's why I wrote MOVE) IF MEM.SAV IS NOT ACTz}IVE, you can usually Reload MACWDG with the L command. If in doubt, Reboot. Running DUP.SYS on D8 with no MEM.SAV, alters t{}he sector count for that file(??) Beats me. Even if it says DUP.SYS is taking up 156 sectors, it's really only using 42, as c|}onfirmed by FREE SECTORS. So far, this seems harmless. have fun.... >>don qqqqqqqq}}qqqqqqqK( R A SAR@TBT:," 2-@@@6 B  V!: EIX;X;macwdg 5.87(X;don lebow 70717,7202X;<X;xe/xl..mac65 cart..DOS 2.xFX;PX;Z BOOT? d}COLDSTDn RUNADx DINITX; MEMLO DOSVEC DOSINI X; LBUFF!}DIRTABLBUFF ;;sort buffer INBUFF-EDIT_BUFFENDSHADOW;;move buffer address2BUFF_LENEDIT_BUFF;;move b}uffer lengthX;ICCOMB;;commandICSTAC;;statusICBADRD;;addressICBLENH;;lengthICAUX1J;;a}ux"$NUM1AUXICAUX1;;number 1 aux, CIOVV6X;͠@ OPENJ READT GETREC^GETCHARh WRI}TEr PUTREC |PUTCHAR  CLOSE  RENAME  ERASE! X; FR0ԸZ1;;program equates Z2Z1}LENZ1 COUNTHOLD1COUNTHOLD2COUNTFLAGCOUNTFILENUMCOUNTHOLDLENH}OLDTOP X;& PORTB0CVFPA;;fp to asc:CVIFP;;integer to fpD ZFR0DNINTLBFQXEPUT;;E:} put bytebKGET$;;K: get bytel X;vTXT;;text colorBAK;;background ROWCRST COLCRSUCRSI}NH X;INVFLGSHFLOKKRPDELKEYDEL CHX;STOP;;print terminator}CR;;RETURN GINTLK;;cartridge detect 'MCREG;;MAC color (thanks, bill)X;  X;*X;4X;get address>}X;GET_WORD LABELHGET_WORD R Q>4 \ %>5 fpX;peek labelzX;DPEEK (to a,y from) LABEL DPEEK Q  % }X;poke labelX;DPOKE (a,y to) LABEL DPOKE P  ' 2X;text print..max 256 chars...end string with }0X;PRINT LABEL PRINT GET_WORD  SHOWME$=X;insert os routine...cf pp 81-82,221 in Ian's Revised MAP.X};NO EXCUSES!!8X;BX;GETOS VECTOR,LABELL GETOS V  ` AGETOS ERRORAjt,~Q O> P  Q }O> P X;X;X;TXT = ;;colorsX; X;X;(X;2WARM< MACO}N;;cart onF RESETP ;;old dosiniZ SHADOWSd"GET_WORD GOWEDGE;;new dosvecnDPOKE DOSVECxQ>;;speed up keys}%> PKRPDEL 'KEYDELQ>;;new colors%>  PMCREG 'MCREG:X;X;X; X;to cartX;} GOMAC MACON;;re-enable mac!@:;;warmstart"X;,X;to DUP.SYS6X;@ GODUPJ MACON;;helloT DUPEXIT^!hX};rX;à| X;mahalo to the folks at oss!X; MACOFF CHEKTIK=;;no interrupts QPORTBL>;;no basic, }either! PPORTBQ;;save status PHOLDCARTP;;cart off!Q>PGINTLK;;flag os .;;enable :;;byeX;X};& MACON0 CHEKTIK:=D QPORTBNM>;;no shadow ramX PPORTBb#$HOLDCART;;retrieve cart statuslP9;;cart on!vQ}>PGINTLK;;alert os. :;;byeX;synchronicityX; CHEKTIK Q;;tik TLOOPR FTLOOP :;;tok!X;}X; GOWEDGE  MACOFF;;open shadow ram!TOP;;run wedge X;*X;4HOLDCART>X;HIRX;free ram start}s here\ ENDCODEfEIpX;zX; DINIT MACOFFX;X;X; ;(heh)X;X;>}<TOP-@;;save stack pointer&HOLDSTACK INTLBF;;set lbuff M>;;clear aux PNUM1AUX;;#1 PNUM1AU}X$ PNUM1AUX;;#2. PNUM1AUX8 $>;;close #1B CLOSEMEL $> V  CLOSEME;;close #2` Cj PCRSINH;;no cursort }M>~ PINVFLG;;no inverse L>@ PSHFLOK;;all caps X; PRINT XMENU;;command line  A_KEY;;key? X;} 5;;'scuse me ZAPLINE;;clear command line 7;;retrieve key >;;save 1%>JMPTABLEKEYTABLE;;number of legal keys } NUMLOOP RKEYTABLE8;;match? FFOUNDKEY;;yes 1;;no INUMLOOP( EXIT12 UPONE< !TOP;;start overF X;P X;}Z FOUNDKEYd )>;;directory?n DFINDCOM;;yesx M>;;no PCRSINH;;turn on cursor FINDCOM C;;y T?;;*2 ?;;ind}exes jmptable *QJMPTABLE8;;hi byte of routine address 5 3 QJMPTABLE8;;lo byte 5 :;;go run routine X;} DODIR &DEFAULT;;key=drive# &XDRIVE Q>};;clear screen" POPCHAR, DIRAUX6 %>@ 'NUM1AUX;;set director}y auxJ STUFFITT QDEFAULT8;;directory spec^ P@INBUFF7;;to lbuffh 1r ISTUFFIT| Q>OPEN  ICHIBAN;;kudasai X;} PRINT XDRIVE;;show source PCOUNT;;init filecount at 0 ? 3 'ROWCRS;;start at row 1 READER $> } GETLINE;;get filename GGOTIT;;end of directory %>;;default length #COUNT QCOUNT M>;;check column HCOL1};;left side& Q>;;right side0 HPRINTNAME: COL1D 1;;to strip CRN Q>X PRINTNAMEb PCOLCRS;;set positionl Q>STOPv} #P@INBUFF7;;terminate print line DPEEK INBUFF;;point  SHOWME;;and print IREADER;;always X; GO}TIT QCOUNT;;how many names? R>;;not enough FEXIT1 R>);;too many EEXIT1 V?;;divide by 2 PHOLD1 PHOLD2}  SCREENTOP;;init pointers $>  MAKETABLE;;first column QCOUNT* ;4 &SHOLD2;;remainder in second column> PHOLD1}H  SCREENTOPR QFR0\ ,f O>;;point to second columnp PFR0z DFINISH #FR0 FINISH  MAKETABLE X;} SORTINIT %> 'FLAG;;clear pass %COUNT 1;;0 offset 1;;ignore 'FREE SECTORS' 'FILENUM;;master counte}r X;main loop X; NEXTPAIR QFILENUMFCHECK;;pass completed$' FINDME;;address of 'bottom' string.DPOKE Z28} "FILENUMB QFILENUML FINDME;;and the 'top' oneVDPOKE Z1`%>;;init pointerj 'HOLD2tX;parse names~ CHEKTOP}3;;top first)> EYOURTURN;;end search Q@Z17FCHEKTOP;;ignore spacesPFR0 YOURTURN 'HOLD1%HOLD2;;b}ottom name CHEKBOT3)>  ENEXTPAIR  Q@Z27FCHEKBOT;;no spaces'HOLD2;;save index(RFR0;;compare characte}rs2DSWAP;;got one!<FNEXTCHAR;;try againFENEXTPAIR;;move onP NEXTCHARZ %HOLD1dICHEKTOP;;alwaysnSWAPx%>}'FLAG;;pass not clear MOVECHAR Q@Z175Q@Z27;;new characterP@Z17;;moves up7;;old characterP@Z27;;mov}es down1 IMOVECHAR GNEXTPAIR CHECKQFLAG;;clear pass?HSORTINIT;;no EXIT2!TOP;;dot's it"X;}, FINDME6/X;entry: a=filenum..exit: a,y=screen address@X;JT?;;index*2T>^QDIRTAB9;;low byteh2r%DIRTAB9;;high} byte| :;;slickX; SCREENTOP'X;load pointers to top of screen ram"DPEEK X;;where's the screen?DPOKE FR0}:;;thank youX; MAKETABLE9X;construct address table for file names in screen ramDX;entry: FR0=first screen address, }HOLD1=number of entries to add1X;x=table index...exit:x=last index position+1X; ADDMOREQFR0;;current address,}O>(;;down one line&PFR00PDIRTAB9;;to table: DHIGHD #FR0NHIGHX2b QFR0l PDIRTAB9v2"HOLD1;;cou}nter HADDMORE:;;finishedX;X; DOERASEPRINT XERASE;;prompt Q>ERASE HDOXIOX; DORENA}MEPRINT XRENAME;;prompt Q>RENAMEX;  DOXIOPHOLD1;;save command  GETNAME;;get filename*'CRSINH;;no curs}or4PRINT XCONFIRM;;OK?> WAITKEYHQHOLD1;;fetch commandR! ICHIBAN;;call cio through #1\IEXIT3;;errors trappedf}X;p X;z DOCART UPONE!GOMAC;;exit to MACX;dup.sys exit DODUP!DPEEK DUPEXIT;;zap wedge)DPOKE} DOSVEC;;by restoring defaultsDPEEK RESETDPOKE DOSINI!GODUP;;aloha! EXIT3!TOP;;upvectorEND1}X;X; DOMOVE%GET_WORD EDIT_BUFF;;find buffer$DPOKE HOLDTOP.#GET_WORD BUFF_LEN;;set length8DPO}KE HOLDLENBX;L X;initVM>;;clear...`PFLAG;;swapjPHOLD1;;statustPHOLD2;;dest open~X;get 'from' filePRIN}T XMOVE;;prompt GETNAME;;get source%> MOVEFROMQ@INBUFF7;;save itPFROMNAME83R>CR;;done?HMOVEFR}OM;;noX;get 'to' namePRINT XTO* GETNAME;; colon required for devices!X; QLBUFF;;destination devicePCRSI}NH;;zap cursorR> D;;moving to disk?(HNOSWAP;;no2X;same name?< CHEKSAMEF%>P)Q@INBUFF7;;first character after s}pecZR>CR;;none..use same named HCHEKSWAPn CLOOPxQFROMNAME8;;source nameP@INBUFF7;; to dest 3;;clikR>CR;;d}one?HCLOOP;;no SHOWSPEC;;reprintX;duplicate file (1 drive)? CHEKSWAP%>Q@INBUFF7;;device #RFROMNAME}8;;same for both?FREADY;;yes..swap NOSWAPL>;;no..set bit 7PFLAG;;no swapX;X;" READY,QFLAG};;swap?6 GMSG2;;no@MSG1J!PRINT XFROMIN;;'FROM disk?'T IOPEN1^MSG2hPRINT XCONFIRMr OPEN1| WAITKEY;;sta}ndby)GET_WORD FROMNAME;;set name addressDPOKE INBUFFQ>READ;;set aux PNUM1AUX Q>OPEN ICHIBAN;;open #1} for readX; READ1$>;;channel 1 Q>GETCHARPICCOM9;;set command QHOLDLENPICBLEN9;;max lenQHOLDLEN}PICBLEN9 MOVECIO;;do it& X;READ pau0'HOLD1;;save status:)>;;ok but not finishedDHCHEKERR;;what?NFWR}ITE2;;move onX CHEKERRb)>;;eof:read completelFWRITE2;;okv BADMOVE!ERROR;;quit, errnum in yX; WRITE2%Q}ICBLEN9;;how many bytes came in? PZ2;;saveQICBLEN9 PZ2" INTLBF;;'to' remains in lbuffQFLAG;;swap?G}CHEKOPEN;;noPRINT XTOIN;;prompt swap WAITKEYX; CHEKOPEN $> QHOLD2;;#2 open? HGOWRITE;;yes*Q>WRIT}E;;else4PNUM1AUX;;set aux> Q>OPENH TOCIO;;and do itR'HOLD2;;set open flag\X;f GOWRITEpQ>PUTCHAR;;setzP}ICCOM9;;command QZ2;;setPICBLEN9;;length QZ2PICBLEN9 MOVECIO;;helloGBADMOVE;;oops!QHOLD1;;ar}e we done?GENDMOVE;;yesQFLAG;;swap?GMOICHIDO;;no"PRINT XFROMIN;;prompt source WAITKEY MOICHIDO!RE}AD1;;do it again!X; ENDMOVE$!TOP;;quit.X;8X;ϠBX;L X;closeV CLOSEME` Q>CLOSEj PICCOM9t HCIO}2~X;MOVE cio vector MOVECIOQHOLDTOP;;setPICBADR9;;MOVE bufferQHOLDTOPPICBADR9HCIO2;;do itX;}print asc number in lbuff SHOWASC%>L13Q@INBUFF7;;characterIL1;;last one is inverseM>;;strip P@INB}UFF7;;and restore3Q>CR;;terminate( P@INBUFF72X;string printer<PRINTSTRINGF Q>PUTRECP$>;;to E:ZITOCIO;;}branchdX;select #1n ICHIBANx$>X;ϠKX;entry: x=channel, a=command, inbuff=address, aux bytes set, length}=$20 TOCIOPICCOM9;;set commandQINBUFF;;default address PICBADR9QINBUFFPICBADR9Q> ;;max len }PICBLEN9M>PICBLEN9CIO2 CIOV;;do itGERROR;;whoops!:" X;, ERROR6 )>;;BRK@FCLEANEXI}T;;can handleJ)>;;eof is okTHSHOWERR;;uh-oh^L>;;reset N flagh :;;back!rX;| SHOWERRC5;;save codePRI}NT XBUG;;attention! ZFR0;;clear7;;retrievePFR0;;for translation CVIFP;;to fp CVFPA;;to asc SHOWASC;;p}rint itX;Major Exit CLEANEXIT$HOLDSTACK;;clear B;;stack!TOP;;start overX; X;& GETINPUT0$>;;in}put from E:: GETLINEDQ>GETREC;;input stringN HTOCIOXX;bX;l SHOWMEvKX;print single characters..entry}: a,y=text address (256 characters max!)X;exit: a=0X;DPOKE FR0;;set pointer%> POPONE'LEN;;save index}Q@FR07;;get characterFPRINTED;;end of text POPCHAR;;print char%LEN;;get index3HPOPONE;;always PRINTE}D: X;X; X;*X;4 UPONE>Q>;;cursor upHX;R POPCHAR\!;;os print charfX;p A_KEYz}Q>PCH KEY_LOOPRCH FKEY_LOOP GETKEY!;;os get keyX; ZAPLINEQ>;;delete line HPOPCHAR}X;X; WAITKEY A_KEY;;waiting..)>;;BREAK!FQUIT;;quit$R>;;ESCape?.FQUIT;;quit8 R> N};;NO?BHKEYOK;;else proceedLQUITV ZAPLINE;;clear`!CLEANEXIT;;and quitjX;t KEYOK~#!ZAPLINE;;clear text and re}turnX;X;Ԝ GETNAMEQCOLCRS;;savecolumn PCOUNT GETINPUT;;get inputX; X;parser!X;entry: i}nput string in lbuffX;exit: legal filespec PARSEQLBUFF;;first charGQUIT;;CR..do not pass go %ICBLEN9;;INPUT }length 1;;adjust'LEN;;and save(LOOK2 Q@INBUFF7<R> :;;legal spec?FFLEGAL;;yupP1ZHLOOK;;againd X;no specn} ADJUSTxQLEN;;input length>;;index old pos,O>;;spaces to move?;;index new pos SHIFT3QLBUFF9;;input }characterP@INBUFF7;;3 spaces right10 ISHIFT3INSERTSPECQDEFAULT8;;insert default P@INBUFF71;;backwa}rds!IINSERTSPECX;check device number" LEGAL, QLBUFF6R> D;;disk?@HSHOWSPEC;;noJ)>;;dnum present?THSHOWS}PEC;;yes^QLEN;;no..as aboveh>r,|O>;;adding 1 space? SHIFT1 QLBUFF9P@INBUFF7;;move over10 HSH}IFT1 INSERTNUMQ> 1;;default numberP@INBUFF7;;to inputX;print full spec SHOWSPECQCOUNT;;restore column P}COLCRS  UPONE;;cursor up !PRINTSTRING;;printit& X;0 X;: X;D XMENUN  CR=A1 2 AX D8b * A8 Erase Re}name Move Cart @DOSA=STOPl X;v XDRIVE  AD1:A=STOP;;drive text XBUG  =AError A=STOP XERASE  A >A=}STOP XRENAME  A >A=STOP XMOVE  A A=CR XFROM  A FROM >A=STOP XTO  A TO >A=STOP! }XFROMIN ! A FROM disk?A=STOP! XTOIN ! A TO disk?A=STOP*! XCONFIRM4! A OK?A=STOP>! X;H! KEYTABLER! A1}28ERMC@A;;legal keys\!X;f! JMPTABLEp!k DODIR=DODIR=DODIR=DOERASE=DORENAME=DOMOVE=DOCA}RT=DODUP;;command vectorsz!X;! DEFAULT! AD1:*.*A=CR;;default spec!X;! X;!FROMNAME!HOLDSTACK};;stack pointer!X;!X;! ENDSHADOW!X;!X;!X;back to ram!!X;" ENDCODE"X;"X;bottom of free memory$" X;follo}wing code is wiped out."X;8" INITWEDGEB"X;reset routineL"DPEEK DOSINI;;old oneV"DPOKE RESET;;to wedge`"GET_W}ORD WARM;;new onej"DPOKE DOSINI;;to ost"X;save DUP.SYS run address~"DPEEK DOSVEC"DPOKE DUPEXIT"X;install }os vectors"GETOS EPUT=POPCHAR"GETOS KGET=GETKEY"X;check dos version"Q "ICHEKD8;;dos 2.5"Q>"PDIRAU}X;;set for 2.0"X;check for Ramdisk" CHEKD8"Q ;;DRVBYT#!GD8OK;;ramdisk.com sets bit 7 #Q>;;else replace 8#P}D8;;in menu#Q> 1(#PKEYTABLE;;and keytable2# X;install<#D8OKF#GET_WORD ENDCODEP#DPOKE MEMLOZ# SHADOWS;;take} overd#'CRSINH;;zap cursorn#)PRINT HELLODERE;;print title screenx#PRINT XWARNING# A_KEY;;wait#X;# MACON;;car}t on#$>#&COLDST;;warstart ok#&CRSINH;;cursor on#2#&BOOT?;;disk booted#!@:;;go run mac#X;# HELLODERE#}' AMACWDG 5.87 don lebowA=CR=CR#> AԠA=CR=CR=ATEXT $1D15 BACK $1D17A=CR=CR$0 AKEY DELAY $1D0B KEY} REPEAT $1D0DA=CR=CR$R A˿A=CR=CR=ABRK,ESC, or N to STOPA=CR=CR=Aany other key to GOA=CR=CR$5 AĠ} $1CFC-$1D6EA=CR=CR=CR=STOP"$ XWARNING,$] A>>ϠԠԠ͠Šա< > FROM > TO > FROM disk? }TO disk? OK?128ERMC@ccctD1:*.*ni  )*i[i\$ih%ii p 0} 磩1[n  C C ] GD lMACWDG 5.87 don lebowԠ󺛛TEXT $1D15 BACK $1D17}KEY DELAY $1D0B KEY REPEAT $1D0D˿BRK,ESC, orj N to STOPany other key to GOĠٺ $1CFC-$1D6E>>Ϡ}ԠԠ͠Šա< in 'Immediate Mode'. It's a 'convenience' utility for typing in programs. If a program is RUNning, it leaves IN""}PUT alone. SAFETY FIRST! Anytime you use a program like this, there's a chance for disaster. If you have NoC"#}aps active, and put something ELSE on Page Six, your computer will immediately Freeze Up the first time you try to type anyth"$}ing. (XE owners can usually recover from that with a RESET.) It will ALSO freeze if you try to execute the USR command whil"%}e it's already activated. (careful with that one.) The simplest way to disable NoCaps is just RESET. Or, you can type the "&}BREAK key. Press it, and your computer reverts to it's normal mode, and you're safe. This isn't quite perfect. MOST of the "'}time, if you hit BREAK to stop a program scroll, it'll have no effect. (FYI, The 'disable' routine sets the keyboard back to "(}All Caps.) If you type BREAK to end a program, NoCaps WILL be disabled. To make absolutely sure you've got NoCaps disabled,")} YOU SHOULD PRESS THE BREAK KEY AT A 'READY' PROMPT. Or RESET. Assuming you've left Page Six alone, you can turn NoCaps ba"*}ck on by calling the USR command again: ?USR(1536) That's it. Chances are, it's not something you can't live without, but"+} when you need it... TECHNICAL NOTES To start, you need to know how the Atari handles it's I/O devices, which ",}is beyond my scope here. See MAPPING THE ATARI pp. 81-82 (and 221-222 in the Revised version for XL/XE modifications) for inf"-}o on that. Please note that by using the vector tables, it's relatively easy to write a program like this that works on both ".}an 800 and an XE (there's a lesson there!) When you call the USR routine, a couple of things happen. The address of the E: "/}handler table is changed from it's normal location in ROM, to Page Six. (The disable function works in reverse. The address o"0}f the E: handler is changed back to it's original value.) The ROM table is moved into the NEW table, then we make a change. B"1}ytes 4 and 5 of any I/O table point to the GET BYTE routine. These are changed to point to the NoCaps code. Anytime you're "2}typing on your Atari, each character is saved in the system buffer at LBUFF ($580). In the normal course of events, when you "3}hit RETURN, Basic immediately takes over, and examines the contents of LBUFF, checking it for proper syntax. But we've put in"4} a detour. Our NEW routine waits for a RETURN. When it gets one, it checks LBUFF first, doing the conversions noted above. On"5}ly after it's done, does Basic get to see the line. And by then, it's acceptable. Short and sweet. The only 'trick', is mak"6}ing NoCaps work in immediate mode, but not during a RUN. Fortunately, what with all the JSR's and stuff going on at any given"7} moment in the OS, the value of the stack pointer is DIFFERENT in those two cases. NoCaps knows what the 'immediate mode' val"8}ue is. So a CMP tells it which mode Basic is in. As noted, the source code (crude as it is) can be found in NOCAPS.M65 As"9} always, I hope you can improve it! Questions? Ask!! >>don DDDDDDDDDDDDDDDDDDDDDDDDD":}DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 22@2@$+- #R EIX;Atari Basic-NoCapsX;don lebow 5/87(X;2X;<X;Standard equates...FX;PINVFLG;;inverse flagZSH&<}FLOK;;caps lockdHATABS;;handler tablenINBUFF;;lbuff pointerxX;X;NoCaps equates...X;INDEX;;z p&=}age pointerQFLAG;;quote status tempRETURN;;RETURN keyQUOTES";;asc "X;X;X;X;init with U&>}SR (1536)X;USR7;;pop args-X;"!X;find E: vector table address,X;see MAPPING... pp. 81-826X;@ INSTALLJ&?}$> TX;^ SEARCHhQHATABS9;;search defaultsrR> E;;here?|FTAKEOVER;;yup0;;no 0;;try 0;;againISEARCH;;alwa&@}ysX; X;got it!X; TAKEOVER&HOLDX;;mark place!QHATABS9;;E: table lo bytePOLD_TABLE;;to storagePIND&A}EX;;to pointerQHATABS9;;hi byte tooPOLD_TABLE PINDEXX;&X;move vectors to NEWTABLE0X;:%>;;$10 b&B}ytesDX;N DEFAULTSXQ@INDEX7;;from oldbPNEWTABLE8;;to newl1v IDEFAULTSX;(X;fill in JSR at start of new routi&C}neX;#QNEWTABLE;;original GET BYTE,O>;;adjust for offsetPMYGET;;lo byteQNEWTABLEO>PMYG&D}ET;;hiX;X;point to new GETX;Q>4MYGET PNEWTABLEQ>5MYGET PNEWTABLE*X;4X;alter handler&E} table>X;HQ>4NEWTABLERPHATABS9\Q>5NEWTABLEfPHATABS9pX;z:;;dot's it!X;X;NOCAPS mainlineX;Cust&F}om GET BYTE routineX; MYGET ;;old GET BYTE6;;save flags-)>;;typed BREAK?HACTIVE;;noX;X;turn &G}it OFF!X; DISABLE $HOLDX;;fetch original index+QOLD_TABLE;;restore old handler address$PHATABS9.QOLD_TAB&H}LE8PHATABS9BM>LPINVFLG;;no inverseVL>@`PSHFLOK;;upper casejQ>RETURN;;add crtX;~EXIT8;;restor&I}e flags :;;byeX;X;no break...proceedX; ACTIVER>RETURN;;End of Line?HEXIT;;nope, returnX;X;ok...le&J}t's get to workX; LEGALIZEC;;save registers 5A5(@;;hold stack pointer2X;<X;stackflag set?FX;PQSTA&K}CKFLAGZHCHEKRUN;;yesd3&STACKFLAG;;no...this is 'immediate mode' valuenX;xX;program RUNning?X; CHEKRUN(STAC&L}KFLAGHPAU;;if so, no actionX;%X;Blitz LBUFF! (INPUT line buffer)X; PROCEED%>'QFLAG;;clear quotes C&M}HEK1Q@INBUFF7;;input characterR>RETURN;;Finished? FPAU;;yesR>QUOTES;;delimiter?HCHEK2;;no"QQFLAG;;yes,&N}"N>;;flip status (1=in quotes)6 PQFLAG@INEXTCHAR;;move aheadJX;TX;check for inverse^X;h CHEK2rR>|DCHEK3&O};;no inverse$QFLAG;;in quotes?HCHEK3;;yup-no actionM>;;else, strip inverseP@INBUFF7;;and restoreX;X;ch&P}eck for lower caseX; CHEK3R> aDNEXTCHAR;;no$QFLAG;;in quotes?HNEXTCHAR;;yesN> ;;convert to upper cas&Q}eP@INBUFF7;;put it backX;X;& NEXTCHAR03:ICHEK1;;to end of lbuffDX;NX;processing finishedXX;bPAUl7&R};;leave everythingv>7;;as we found it? Q>RETURN8 :;;alohaX;X;program registersX;,STACKFLAG ;;im&S}mediate mode stack valueHOLDX ;;hatabs index#OLD_TABLE;;old table addressX;X;the new E: handler tableX; &T}NEWTABLEX; X;*4X;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV article for details. ACTION.(Paul Chabot, ANTIC $K>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*W}>>>>>>(>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.Z}>>>>>>,7B%JX~ _ @--GH45PM!(STST2\}  20pEFL>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>2]}>>>>>>07B%JX~ _ @--GH45xM!(STST6_}  20pEFL>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>6`}>>>>>>4EXPONENTIATION IN PASCAL A common question asked to Kyan is "How do I raise a number to a power?" Standard Pascal provides:b} no means of doing this, which is usually implemented with a statement such as: POWER=BASE^NUM:REM BASIC or... :c} Power := Base ** Num; (* Some implementations of Pascal *) Fortunately, there is a short and simple routine that can :d}do it in Standard Pascal. Its main statement is: Power := Exp(Num * Ln(Base)); (You will recall that Exp and Ln a:e}re predefined, Standard Pascal functions.) You can call this function with two real numbers; the first number is the base,:f} and the second is the number you wish to raise the base to. Here's an example of calling Power: NewNum := Power(B:g}ase,Raiser); That is the 'quick & dirty' method of raising a number to a power. 'Quick' applies only to the fact that it i:h}s one line long; this method of exponentiation is not very efficient and may take too long to do the calculation. 'Dirty' :i}applies to the limitation of not accepting negative numbers and the fact that round-off errors may result. For casual prog:j}ramming problems, this routine is acceptable, but for more advanced problems which require speed, efficiency, and accuracy,:k} the longer version of Power must be used. This longer Power routine is based on one written by Jon Snader (who has a Ph.D :l}in mathematics) which appeared in the September 1986 issue of Computer Language magazine. Before you use this longer versi:m}on of Power, make sure that you have included the file FRAC.I, which is available in the data library under the filename FR:n}AC.PAS--see FRAC.DOC, too. This Power is called just like the 'lite' version of Power: NewNum := Power(Base,Raiser:o}); NOTE: Since these function both have the same name, one can not include them both in a program (although I don't know w:p}hy one would want to). When you download them, they are BOTH in the file PASEXP.PAS--be sure to separate them with the Kya:q}n Text Editor and make sure that they are saved with different filenames on the disk. For the 'lite' version, I recommend :r}PWR.I as a filename, and for the 'pro' version, POWER.I. 8;FUNCTION Power(a,n : Real) : Real; (* LITE VERSION *) BEGIN Power := Exp(n * Ln(a)) END; (* Power, 'lite' version *) FUNC>t}TION Power (x : Real; n : Real) : Real; (* PRO VERSION *) FUNCTION Pwr(n : Integer) : Real; BEGIN (* Recursive Pwr funct>u}ion *) IF n = 1 THEN Pwr := x ELSE IF Odd(n) THEN Pwr := Sqr(Pwr(n DIV 2)) * x ELSE Pwr := Sqr>v}(Pwr(n DIV 2)) END;(* Pwr *) BEGIN (* Power *) IF x = 0 THEN Power :=0 ELSE IF n = 0 THEN Power := 1 ELSE IF>w} Frac(n) <> 0 THEN Power := Exp(n * Ln(x)) ELSE IF n < 0 THEN Power := 1/Pwr(-Trunc(n)) ELSE Power := Pwr(T>x}runc(n)) END;(* Power *) <01* PRINT SCREEN KEY 02* ORIGINAL CODE FROM COMPUTE! 03* APRIL'86 BY RALPH JOHNSON 04* MODIFIED TO BE CALLED WITH CTRL-4 Bz}05* BUZZ HAMILTON [73557,1031] JUNE'86 06* 07* WILL DUMP GRAPHIC 0 SCREEN TO 08* PRINTER WHEN CTRL-4 IS HIT 10 ICCOM = $B{}342 20 ICAX1 = $34A 30 ICBAL = $344 40 ICBAH = $345 50 ICBLL = $348 60 ICBLH = $349 70 CIOV = $E456 74 DOSINI =B|} $C 80 SAVMSC = $58 90 SPBYT1 = $CB 0100 SPBYT2 = $CC 0110 VKEYBD = $208 0120 CDTMA2 = $228 0130 RUNAD = $2E0 0135 PRB}}NBUF = $3C0 0140 SETVBV = $E45C 0150 KBCODE = $D209 0160 CTRL4 = $98 0170 *=$0600 0177 RESET 0178 JSR $FFFF 0190 B~} SEI 0200 LDA VKEYBD 0210 CMP #NVKYBD&255 0220 BNE STORE 0230 LDA VKEYBD+1 0240 CMP #NVKYBD/256 0250 BEQ EB}XIT 0260 STORE 0270 LDA VKEYBD 0280 STA JUMP+1 0290 LDA VKEYBD+1 0300 STA JUMP+2 0310 LDA #NVKYBD&255 0320 B} STA VKEYBD 0330 LDA #NVKYBD/256 0340 STA VKEYBD+1 0350 EXIT 0360 CLI 0370 RTS 0380 NVKYBD 0390 LDA KBCODE B}0400 CMP #CTRL4 0401 BNE JUMP 0404 LDA #DOPRT&255 0407 STA CDTMA2 0410 LDA #DOPRT/256 0413 STA CDTMA2+1 041B}6 LDA #2 0419 LDY #30 0422 LDX #0 0425 JSR SETVBV 0426 PLA 0428 RTI 0520 JUMP 0530 JMP JUMP 0540 DOPRT B} 0550 LDX #$50 0560 LDA #$03 0570 STA ICCOM,X 0580 LDA #$08 0590 STA ICAX1,X 0600 LDA #DEV&255 0610 STA IB}CBAL,X 0620 LDA #DEV/256 0630 STA ICBAH,X 0640 LDA #$00 0650 STA LCNT 0660 STA ICBLH,X 0670 LDA #$FF 0680 B} STA ICBLL,X 0690 JSR CIOV 0700 LDA SAVMSC 0710 STA SPBYT1 0720 LDA SAVMSC+1 0730 STA SPBYT2 0740 LDX #$00B} 0750 LOOP 0760 LDY #$00 0770 CLC 0780 LDA ($CB),Y 0790 ADC #$20 0800 STA PRNBUF,X 0810 INX 0820 CLC B} 0830 LDA SPBYT1 0840 ADC #$01 0850 STA SPBYT1 0860 LDA SPBYT2 0870 ADC #$00 0880 STA SPBYT2 0890 LDA LCNB}T 0900 CMP #$18 0910 BEQ CLOSE 0920 CPX #$28 0930 BNE LOOP 0940 PRINT 0950 LDA #$9B 0960 STA PRNBUF,X 097B}0 INC LCNT 0980 LDX #$50 0990 LDA #$09 1000 STA ICCOM,X 1010 LDA #PRNBUF&255 1020 STA ICBAL,X 1030 LDA #PB}RNBUF/256 1040 STA ICBAH,X 1050 LDA #$00 1060 STA ICBLH,X 1070 LDA #$FF 1080 STA ICBLL,X 1090 JSR CIOV 110B}0 LDX #$00 1110 CPX #$00 1120 BEQ LOOP 1130 CLOSE 1140 LDX #$50 1150 LDA #$0C 1160 STA ICCOM,X 1170 JSR B}CIOV 1180 RTS 1190 LCNT 1200 .BYTE 0 1210 DEV 1220 .BYTE "P:" 1221 BEGIN 1222 LDA DOSINI 1223 STA RESET+1 B}1224 LDA DOSINI+1 1225 STA RESET+2 1226 LDA #RESET&255 1227 STA DOSINI 1228 LDA #RESET/256 1229 STA DOSINI+1B} 1230 JMP RESET+3 1260 *=RUNAD 1270 .WORD BEGIN {{{{{@? x* G H* X` ɘI() \h@LFPBJԝDEIH VX˥YF}i i˥i̭0(ݩP BDEIH VP B V`P:    LwwwF}wwwwwwD 00010 *"D:RAMXE.ASM 00020 .LI OFF 00030 *-------------------------------- 00040 * Copyright 1985 by Daniel L. MJ}oore 00050 * This program may not be sold, 00060 * but it may be freely copied and 00070 * distributed. 00080 *----------J}---------------------- 00090 * Last modified 04/16/85 00100 *-------------------------------- 00110 * Allow usage of extraJ} RAM in 00120 * 130XE computers from BASIC. 00130 * There are 2 USR routines: 00140 * The first routine checks if 00150J} * the machine is a 130XE; 00160 * The second moves blocks of 00170 * memory to and from the additional 00180 * 64K of bJ}anked RAM in the 130XE. 00190 *-------------------------------- 00200 * Hardware Equates 00210 * 00220 PORTB .EQ $D30J}1 00230 * 00240 * Page 0 RAM for pointers 00250 * 00260 SOURCE .EQ $D4 FP register 0 00270 SOURCE.BNK .EJ}Q $D6 00280 DEST .EQ $D8 00290 DEST.BNK .EQ $DA 00300 LENGTH .EQ $DC 00310 *-------------------------------- 00320J} * Place the code on Page 6, where 00330 * BASIC won't overwrite it. 00340 * 00350 .OR $600 00360 * 00370 J} .TF "D:RAMXE.OBJ 00380 *-------------------------------- 00390 * In both routines, the value 00400 * returned indicateJ}s success or 00410 * failure of the requested function. 00420 * If the USR routine was successfull, 00430 * a 0 will be reJ}turned. Otherwise 00440 * the result will be non-zero. 00450 *-------------------------------- 00460 * This routine is calJ}lable from 00470 * BASIC. Use the statement: 00480 * A=USR(1536) 00490 * to check if the machine is a 00500 * 130XE. AJ} 0 result means a 130XE 00510 * any other value is not a 130XE. 00520 * 00530 CHECK.XE 00540 PLA parameter J}count from BASIC 00550 BNE BAD.PARAMETERS 00560 * Check if banked RAM is present 00570 LDX $4000 00580 J} LDA XE.BANKS+1 00590 STA PORTB bank #1 00600 DEX 00610 STX $4000 00620 LDJ}A XE.BANKS 00630 STA PORTB normal RAM 00640 CPX $4000 00650 BNE GOOD.EXIT 00660 BEQJ} EXIT.1 00670 *-------------------------------- 00680 * Incorrect number of parameters 00690 * passed to the routine, cleaJ}n up 00700 * the stack and then exit. 00710 BAD.PARAMETERS 00720 TAY 00730 BEQ .2 00740 .1 PLA J} drop 2 bytes 00750 PLA 00760 DEY 00770 BNE .1 done? 00780 .2 LDA #$FF 00790 J} BNE EXIT.1 00800 *-------------------------------- 00810 * The following routine moves 00820 * blocks of memory to anJ}d from the 00830 * the banked RAM in the 130XE. 00840 * 00850 * To call this routine from BASIC: 00860 * A=USR(1577,,, 00870 * ,,