
 1000  *SAVES.ASSEM.2.0.OH(FAST BLOAD)
 1010  *--------------------------------
 1020  *1/31/85
 1030  *--------------------------------
 1040  *
 1050  *S-C MACRO ASSEMBER OVERHEAD - ULTRATERM VERSION
 1060  *               by Jan Eugenides
 1070  * 3/9/85
 1080  *
 1090  *--------------------------------
 1100  *CHIP 0 ROUTINE EQUATES
 1110  *--------------------------------
 1120  *Y-register indexes of the chip 0 routines
 1130  *--------------------------------
 1140  *
 1150  MOVEBLK    .EQ 0       Move data block to RAM
 1160  GOMRBRD    .EQ 8       Go to motherboard
 1170  *--------------------------------
 1180  *
 1190  * GENERAL EQUATES
 1200  *
 1210  *--------------------------------
 1220  PRISLOT    .EQ $26  Storage for primary slot
 1230  QLMAP      .EQ $2D  bitmap of QL slots
 1240  SRCL       .EQ $3A  indirect source
 1250  SAVCTRL    .EQ $20A save control word
 1260  QLCTRL     .EQ $C081  QL control register
 1270  *--------------------------------
 1280  *
 1290  * GET SLOT EQUATES
 1300  *
 1310  *--------------------------------
 1320  QLOFF      .EQ $18  00011000 QLOFF; CHIP 0
 1330  CHKNUM     .EQ $20  NUMBER OF FIND SLOT CHECKS
 1340  GSCL       .EQ $40  GET SLOT C PARAMETER.
 1350  GSCH       .EQ $41
 1360  GSEL       .EQ $42  GET SLOT E PARM 
 1370  GSEH       .EQ $43
 1380  SLTXROM    .EQ $C006     IIE SOFT SWITCH
 1390  INT3ROM    .EQ $C00A         "
 1400  SLT3ROM    .EQ $C00B         "
 1410  CLRROM     .EQ $CFFF
 1420  *--------------------------------
 1430         .OR $FEB0 
 1440         .TF ASM.2.0.OH
 1450  *--------------------------------
 1460  * This program will start the assembler in 80x32         
 1470  * mode with ultraterm.  Assumes that assembler has
 1480  * been patched at $DBC9 and $DC11 for 32 line mode,
 1490  * i.e. the normal $17 is now $1F.  If mode is changed
 1500  * these bytes must be re-patched. ($2F for 48 line mode)
 1510  * For S-C assember 2.0 March 1985 version with Bob's
 1520  * ultraterm driver attached at $F700.
 1530  *--------------------------------
 1540  START.PROG LDA #0    Turn on Ultraterm             
 1550             JSR $C300
 1560             LDA #22   bring up in 80x32 mode
 1570             JSR $FDED
 1580             LDA #"5   Mode 5
 1590             JSR $FDED
 1600             LDA #$CB
 1610             STA $3D1  set warmstart vector
 1620             LDA #0 
 1630             STA $9D00 make room between DOS a buffers 
 1640             JSR $A7D4 for fast BLOAD patch
 1650             LDA #$30
 1660             STA $ACA6 patch dos to call fast Bload
 1670             LDA #$9C
 1680             STA $ACA7 which is now at $9C30
 1690             LDA #$4C
 1700             STA $E000
 1710             LDA #0
 1720             STA $E001  put assembler coldstart vector at $E000
 1730             LDA #$D0
 1740             STA $E002
 1750             LDA $C080 select ram card
 1760             JMP $D000 coldstart assembler
 1770  SP.END
 1780  *--------------------------------
 1790         .BS $FF00-*   SKIP TO FF00
 1800  *--------------------------------
 1810  *KATALOG ENTRIES START HERE
 1820  *--------------------------------
 1830  ASMK   .DA #$90     PRIMARY
 1840         .DA N.RESET SOURCE 
 1850         .DA $0000    LENGTH
 1860         .DA $0000    DESTINATION
 1870         .AS -"ASM"  
 1880  *--------------------------------
 1890         .DA #$86     END OF KAT RECORD
 1900  *--------------------------------
 1910  ASMPARM1   .DA $C800     SOURCE  assembler + driver goes here
 1920             .DA $27FF     LENGTH  will load from $D000-$F7FF
 1930             .DA $D000     DESTINATION
 1940  ASMPARM2   .DA $F000     SOURCE  fast bload routine
 1950             .DA $004D     LENGTH
 1960             .DA $9C30 
 1970  *--------------------------------
 1980  INVERT     LSR
 1990             ROR
 2000             ROR
 2010             ROR
 2020             AND #$E0
 2030             STA SAVCTRL
 2040             RTS
 2050  *--------------------------------
 2060         .BS $FF53-*   SKIP TO FF53
 2070  OFFLP  LDA #QLOFF
 2080         STA QLCTRL,X      TURN OFF THE QL
 2090  RTSLOC JSR GETSLOT       THIS INSTRUCTION AT $FF58 (RTS)
 2100         BNE OFFLP
 2110  *--------------------------------
 2120  *
 2130  * FIND SLOT NUMBER BY COMPARING CNXX TO ENXX FOR EACH SLOT
 2140  * START WITH SLOT 7.  USR MUST BE RESET FOR SEARCH TO BE
 2150  * EFFECTIVE IN II OR IIE.
 2160  *--------------------------------
 2170  GETSLOT    STA SLTXROM   ENABLE IIE I/O SELECTS
 2180             STA SLT3ROM
 2190             LDA #0
 2200             STA GSCL
 2210             STA GSEL
 2220  TRYAGEN    LDA #$C1      START WITH SLOT 1
 2230             STA GSCH
 2240             LDA #$E1
 2250             STA GSEH      DESTINATION = $EN00
 2260             LDY #CHKNUM   GET NUMBER OF CHECKS TO VERIFY
 2270  LOOKLP     LDA (GSCL),Y
 2280             CMP (GSEL),Y
 2290             BNE NOTHERE   BRANCH IF QL NOT IN THIS SLOT
 2300             DEY
 2310             BNE LOOKLP
 2320             LDA GSCH
 2330             TAY
 2340             ASL           GET SLOTNUM TIMES $10 TO X
 2350             ASL
 2360             ASL
 2370             ASL
 2380             TAX
 2390             LDA $FE86,Y  GET BIT MAP 
 2400             ORA QLMAP
 2410             STA QLMAP      SET BIT IN QLMAP
 2420             STA INT3ROM    LEAVE INT3ROM AS NORMAL RESET DOES
 2430  *--------------------------------
 2440  *NORMAL RESET FORCES SLTXROM
 2450  *LEAVE 3ROM AND XROM AS WITH NORMAL RESET
 2460  *--------------------------------
 2470         LDA CLRROM   EXPANSION ROM OFF
 2480         RTS
 2490  NOTHERE    INC GSCH
 2500             INC GSEH      CHECK IN NEXT SLOT
 2510             BNE LOOKLP    BRANCH ALWAYS
 2520  *--------------------------------
 2530  *EQU $C0 SHOULDN'T OCCUR; BOMB IF DOES
 2540  *--------------------------------
 2550  MAP    .DA #$80
 2560         .DA #$40
 2570         .DA #$20
 2580         .DA #$10
 2590         .DA #$08
 2600         .DA #$04
 2610         .DA #$02
 2620  *--------------------------------
 2630  * THIS IS N.RESET ROUTINE OF THIS CHIP
 2640  *--------------------------------
 2650  N.RESET    JSR INVERT       Invert the control word
 2660             LDY #5
 2670  .1         LDA ASMPARM1,Y   Move ASSEMBLER parms
 2680             STA SRCL,Y
 2690             DEY
 2700             BPL .1
 2710             LDA SAVCTRL      get control word 
 2720             LDX PRISLOT      slot in X reg
 2730             LDY #MOVEBLK     Command index for move block routine
 2740             JSR GOCHIP0      Call chip 0 to move block
 2750             LDY #5
 2760  .2         LDA ASMPARM2,Y   Move Fast Bload routine parms
 2770             STA SRCL,Y
 2780             DEY
 2790             BPL .2
 2800             LDA SAVCTRL      get control word
 2810             LDX PRISLOT      Slot in X reg
 2820             LDY #MOVEBLK     Command index - move block
 2830             JSR GOCHIP0      Call chip 0
 2840             LDY #SP.END-START.PROG 
 2850  .3         LDA START.PROG,Y Move startup program to $300
 2860             STA $300,Y
 2870             DEY
 2880             BPL .3
 2890             LDA #$02        put address-1 on stack
 2900             PHA
 2910             LDA #$FF
 2920             PHA
 2930             LDY #GOMRBRD     jmp to $300 to start
 2940             LDA SAVCTRL
 2950             LDX PRISLOT
 2960             JMP GOCHIP0
 2970  *--------------------------------
 2980         .BS $FFEC-*    SKIP TO FFEC
 2990  GOCHIP0    STA QLCTRL,X  GO TO CHIP 0
 3000             JMP N.RESET   DO N.RESET ROUTINE OF THIS CHIP
 3010             .BS 3
 3020             RTS
 3030             .BS 2
 3040             .DA ASMK      FIRST KATALOG LOCATION
 3050             .DA $3FB      NMI VECTOR
 3060             .LIST OFF

