 .OPT NO LIST›;  SAVE #D1:SCREEN1.M65›;›;›;  LOAD #D1:SCREEN2.M65›;›;  *= $EF6E 07 Oct 94› .PAGE "Editor and Screen"›  LIST› .LOCAL›CHAR = COLINC+1›;›SINIT› LDA #$FF Init screen› STA CH› LDA RAMSIZ› STA RAMTOP› LDA #$40    Default upper› STA SHFLOK  case alpha› LDA # <KEYTBL› STA KEYDEF› LDA # >KEYTBL› STA KEYDEF+1› LDA # <FNTBL› STA FKDEF› LDA # >FNTBL› STA FKDEF+1› RTS ›;›OPEN.S› LDA ICAX2Z  Screen open› AND #$0F    If mode 0 clear icax1z› BNE ?OPNCOM and inhibit and mixed mode›;›OPEN.E› LDA ICAX1Z  Editor open› AND #$0F› STA ICAX1Z› LDA #0›;›?OPNCOM› STA DINDEX  Complete open› CMP #15+1   Check mode› BCC ?INRNG› LDA #145    Bad mode› JMP ?61780›;›?INRNG› LDA # >CHARSET1 Set up› STA CHBAS   vblank ram› LDA # >CHARSET2› STA CHSALT› LDA #2› STA CHACT› STA SDMCTL  kill dma next vblank› LDA #1      flag success› STA DSTAT› LDA #$C0    enable break key› ORA POKMSK  and key interrupts› STA POKMSK› STA IRQEN› LDA #$40    disable dlis› STA NMIEN› BIT FINE    Fine scroll?› BPL ?NOFINE No› LDA # <FDL  Set dli vector› STA VDSLST› LDA # >FDL› STA VDSLST+1› LDA #$C0    enable dlis›;›?NOFINE› STA NMIEN› LDA #0› STA TINDEX  text index must be 0› STA ADRESS› STA SWPFLG› STA CRSINH  cursor on› LDY #14     set default tab› LDA #1      stops›;›?CLRTAB› STA TABMAP,Y› DEY › BPL ?CLRTAB› LDX #4›;›?DOPEN8› LDA COLRTB,X set default› STA COLOR0,X colors› DEX › BPL ?DOPEN8› LDY RAMTOP  Set text window› DEY         address 160 bytes› STY TXTMSC+1 under ramtop› LDA #$60› STA TXTMSC› LDX DINDEX› LDA ANCONV,X Convert to› STA HOLD1   antic code› LDA RAMTOP› STA ADRESS+1› LDY DSPTBL,X›;›?DOPEN1› LDA #40     allocate in› JSR ?DBSUB  blocks of 40 bytes› DEY › BNE ?DOPEN1› LDA GPRIOR  Clear gtia modes› AND #$3F› STA MLTTMP+1› TAY › CPX #8      test if 320*1› BCC ?NOT8› CPX #15› BEQ ?MODE15› CPX #12› BCS ?NOT8› TXA         Get two low bits› ROR A› ROR A› ROR A› AND #$C0    Now two top bits› ORA MLTTMP+1› TAY ›;›?MODE15› LDA #16     Subtract 16 more› JSR ?DBSUB  for page boundary› CPX #11› BNE ?NOT8› LDA #6      Mode=11 put gtia lum› STA COLOR4  value into bakground›;›?NOT8› STY GPRIOR  Store priority› LDA ADRESS  Save memory scan› STA SAVMSC  counter address› LDA ADRESS+1› STA SAVMSC+1›;›?VBWAIT› LDA VCOUNT  wait for next› CMP #$7A    vblank before playing› BNE ?VBWAIT with dlist› JSR ?DBDEC  Start d/l right under ram› LDA PAGETB,X test if d/l might cross page boundary› BEQ ?NOMOD› LDA #$FF    If so drop down› STA ADRESS  a page› DEC ADRESS+1›;›?NOMOD› JSR ?DBDDEC Double byte double dec› LDA ADRESS  Save d/l end› STA SAVADR  for later› LDA ADRESS+1› STA SAVADR+1› LDA #$41    Antic JVB› JSR ?STORE› STX MLTTMP› LDA #24     Init bottom of› STA BOTSCR  screen› LDA DINDEX› CMP #12› BCS ?TSTMOD› CMP #9      Disallow mixed› BCS ?NOTMXD if Gr 9-11›;›?TSTMOD› LDA ICAX1Z  Test mixed› AND #$10    mode› BEQ ?NOTMXD› LDA #4› STA BOTSCR  Add 4 text lines› LDX #2      at bottom› LDA FINE› BEQ ?NOTFIN› JSR ?SETSCROL Set scrolling dk entry›;›?NOTFIN› LDA #2› JSR ?TSTFINE› DEX › BPL ?NOTFIN› LDY RAMTOP  Reload msc› DEY         for text› TYA › JSR ?STORE› LDA #$60› JSR ?STORE› LDA #$42    Antic LMS› JSR ?TSTFINE› CLC › LDA #16› ADC MLTTMP› TAY › LDX NUMDLE,Y› BNE ?DOPEN3 Go always›;›?NOTMXD› LDY MLTTMP› LDX NUMDLE,Y› LDA DINDEX› BNE ?DOPEN3› LDA FINE› BEQ ?DOPEN3› JSR ?SETSCROL› LDA #$22› STA HOLD1›;›?DOPEN3› LDA HOLD1   Store number› JSR ?STORE  of dl entries› DEX › BNE ?DOPEN3› LDA DINDEX  Do the 320*1› CMP #8      problem› BCC ?DOPEN5› CMP #15› BEQ ?FIXSCAN› CMP #12› BCS ?DOPEN5›;›?FIXSCAN› LDX #93     Get remaining› LDA RAMTOP  number of dle's› SEC         reload memory scan› SBC #$10› JSR ?STORE› LDA #0› JSR ?STORE› LDA HOLD1› ORA #$40    Add LMS bit› JSR ?STORE›;›?DOPEN4› LDA HOLD1› JSR ?STORE› DEX › BNE ?DOPEN4›;›?DOPEN5› LDA SAVMSC+1 Finish off› JSR ?STORE  dlist› LDA SAVMSC› JSR ?STORE› LDA HOLD1› ORA #$40› JSR ?STORE› LDA #$70    24 blank lines› JSR ?STORE› LDA #$70› JSR ?STORE› LDA ADRESS  Save dl address› STA SDLSTL› LDA ADRESS+1› STA SDLSTH› LDA #$70    Add last blank› JSR ?STORE  line entry› LDA ADRESS  Position address=sdlst-1› STA MEMTOP› LDA ADRESS+1› STA MEMTOP+1› LDY #1› LDA SDLSTL› STA (SAVADR),Y› INY › LDA SDLSTH› STA (SAVADR),Y› LDA DSTAT   If error on allocation open the ed› BPL ?DOPEN9›;›?61780› STA DERRF   open E:› JSR OPEN.E› LDA DERRF› LDY #0› STY DERRF› TAY         Return status› RTS ›;›?DOPEN9› LDA ICAX1Z  Test clear› AND #$20    inhibit bit› BNE ?DOPEN7› JSR CLRSCR  Clear screen› STA TXTROW  Home cursor a=0› LDA LMARGN› STA TXTCOL›;›?DOPEN7› LDA #34     Everything set› ORA SDMCTL  enable dma› STA SDMCTL› JMP ?RETUR2›; Screen get byte›;›GET.S› JSR ?RANGE  Does incrsr› JSR ?GETPLT getplt doesn't› JSR ?INATAC Internal to Atascii› JSR ?INCRSB› JMP STATUS.S›; Get data under cursor›;›?GETPLT› JSR ?CONVRT conv row/col to address› LDA (ADRESS),Y› AND DMASK›;›?SHIFTD› LSR SHFAMT  Shift data› BCS ?SHIFT1 down to low bits› LSR A› BPL ?SHIFTD Go always›;›?SHIFT1› STA CHAR› CMP #0      Restore flags› RTS ›;›PUT.S› STA ATACHR  Screen put-› CMP #125    byte routine› BNE ?NOCLS› JSR CLRSCR  Clear screen› JMP ?RETUR2›;›?NOCLS› JSR ?RANGE  Check end›;›?OUTCHA› LDA ATACHR  of line› CMP #155› BNE ?OUTCHB› JSR DOCRWS  Do cr› JMP ?RETUR2›;›?OUTCHB› JSR ?OUTPLT› JSR ?INCRSR› JMP ?RETUR2›;›?OUTPLT› LDA SSFLAG  Plot point› BNE ?OUTPLT› LDX #2›;›?CRLOOP› LDA ROWCRS,X Save cursor› STA OLDROW,X loc for draw line› DEX › BPL ?CRLOOP› LDA ATACHR  Convert atascii› TAY         to internal› ROL A› ROL A› ROL A› ROL A› AND #3› TAX         x=index› TYA         restore atascii› AND #$9F    strip column address› ORA ATAINT,X›;›?OUTCH2› STA CHAR    Display› JSR ?CONVRT› LDA CHAR›;›?SHIFTU› LSR SHFAMT  Shift up to› BCS ?SHIFT2 proper position› ASL A› JMP ?SHIFTU›;›?SHIFT2› AND DMASK   Save shifted› STA TMPCHR  data› LDA DMASK   invert mask› EOR #$FF    Mask off old data› AND (ADRESS),Y› ORA TMPCHR  or in new data› STA (ADRESS),Y› RTS ›;›?RETUR2› JSR ?GETPLT Do cursor› STA OLDCHR  on the way out› LDX DINDEX  Graphics have› BNE STATUS.S invisible cursor› LDX CRSINH  Test cursor› BNE STATUS.S off› EOR #$80    Toggle msb and› JSR ?OUTCH2 display it›;›STATUS.S› LDY DSTAT   Screen› JMP ?STAT2  status and exit›;›BYE› JMP JSLFTST to match blackbd vector›;›;›?STAT2› LDA #1› STA DSTAT› LDA ATACHR  Return character›;›JUSTRTS› RTS         Editor Special›;›;›CLOSE.E› BIT FINE    Editor Close› BPL STATUS.S Go if fast scroll› LDA #$40    disable dli/nmi› STA NMIEN› LDA #0      Clear flag› STA FINE› LDA # <RTI  Point vdslst to› STA VDSLST  an rti› LDA # >RTI› STA VDSLST+1› JMP OPEN.E›;›GETCHAR› JSR ?SWAP   Editor› JSR ?ERANGE ; Get-byte› LDA BUFCNT  Anything in buffer?› BNE ?EGETC3 Yes› LDA ROWCRS  Save buffer› STA BUFSTR  start address› LDA COLCRS› STA BUFSTR+1›;›?EGETC1› JSR KGB     Fill buffer› STY DSTAT   save status› LDA ATACHR  Test for cr› CMP #155› BEQ ?EGETC2› JSR ?DOSS   Not cr, so print it› JSR ?SWAP   previous sub swapped› LDA LOGCOL  Beep if nearing› CMP #113    column 120› BNE ?EGETC6› JSR BELL›;›?EGETC6› JMP ?EGETC1›;›;›?EGETC2› JSR ?OFFCRS Get buffer count› JSR CBC› LDA BUFSTR  Return a character› STA ROWCRS› LDA BUFSTR+1› STA COLCRS›;›?EGETC3› LDA BUFCNT› BEQ ?EGETC5›;›?EGETC7› DEC BUFCNT  Return until 0› BEQ ?EGETC5› LDA DSTAT   If err, loop til› BMI ?EGETC7 byffer empty› JSR GET.S› STA ATACHR› JMP ?SWAP   return without enabling cursor›;›?EGETC5› JSR DOCRWS  Do real cr› LDA #155    and return eol› STA ATACHR› JSR ?RETUR2 enable cursor then swap› STY DSTAT   save keyboard status› JMP ?SWAP   and exit via ?retur1›;›?JSRIND› JMP (ADRESS) Indirect subroutine›;›;›OUTCHAR› STA ATACHR  Editor› JSR ?SWAP   ;  Put-byte› JSR ?ERANGE› LDA #0› STA SUPERF›;›?DOSS› JSR ?OFFCRS Cursor off› JSR ?TSTCTL Test control› BEQ ?EOUTC5›;›?EOUTC6› ASL ESCFLG  Escflg only works once› JSR ?OUTCHA output› JMP ?SWAP   and exit›;›?EOUTC5› LDA DSPFLG  Do dsp and esc flags› ORA ESCFLG  if non-0, display› BNE ?EOUTC6 instead of execute› ASL ESCFLG  Process controls› INX › LDA SUPERF  Check for fn keys› BEQ ?DOCTL› TXA         Add offset for› CLC         shifted fn› ADC #45     keys› TAX ›;›?DOCTL› LDA CNTRLS,X Set up for› STA ADRESS  indirect subrtn› LDA CNTRLS+1,X› STA ADRESS+1› JSR ?JSRIND Do it› JSR ?RETUR2 Do cursor› JMP ?SWAP   Exit›; end screen editor›