mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 23:32:26 +00:00
SCMASM.SYSTEM 3.0 & BASIC.SYSTEM 1.5 source code......many bugfxes & enh, new commands.....
This commit is contained in:
parent
6d85a16ad1
commit
1cbc954f7f
@ -24,6 +24,45 @@ exists, thus return value is limited to
|
||||
whether or not a valid argument was
|
||||
given.
|
||||
|
||||
# SEQ
|
||||
Prints sequences of numbers.
|
||||
*
|
||||
|
||||
## Arguments
|
||||
**<first>**
|
||||
Starting number for the sequence of numbers.
|
||||
*
|
||||
**<incr>**
|
||||
Count in increments of <incr>. Default is 1 if omitted.
|
||||
*
|
||||
**<last>**
|
||||
Last number to count to. If <last> is less than <first>, then the default <incr> is -1.
|
||||
*
|
||||
|
||||
## Return Value
|
||||
N/A
|
||||
*
|
||||
|
||||
### Author
|
||||
2021-11-17, Brian J. Bernstein <brian@dronefone.com>.
|
||||
|
||||
# XMASTREE
|
||||
Displays a Christmas Tree of user defined height. Ho Ho Ho.
|
||||
*
|
||||
|
||||
## Arguments
|
||||
**<height>**
|
||||
Height of the tree. A positive number up to about 41 is realistic, beyond that you're on your own...
|
||||
*
|
||||
|
||||
## Return Value
|
||||
N/A
|
||||
*
|
||||
|
||||
### Author
|
||||
Original algorithm Jan 2012, Brian J. Bernstein.
|
||||
Updated for A2osx 2021-07-02.
|
||||
|
||||
## License
|
||||
A2osX is licensed under the GNU General Public License.
|
||||
|
||||
|
@ -79,15 +79,15 @@ CC = OK, CS = ERROR
|
||||
Y,A = FD
|
||||
X = hFD
|
||||
|
||||
# GetDevStatus
|
||||
# MkFD
|
||||
|
||||
## C
|
||||
`int getdevstatus(short int DevID, S.DIB *dstat);`
|
||||
`short int mkfd(short int type, );`
|
||||
|
||||
## ASM
|
||||
`>PUSHB DevID`
|
||||
`>PUSHW S.DIB`
|
||||
`>SYSCALL GetDevStatus`
|
||||
`>SYSCALL MkFD`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
@ -317,7 +317,7 @@ CC
|
||||
Initialize a MD5 computation
|
||||
|
||||
# C
|
||||
`hMD5 md5init ();`
|
||||
`short int md5init();`
|
||||
|
||||
# ASM
|
||||
`>SYSCALL MD5Init`
|
||||
@ -430,10 +430,49 @@ Y,A = PTR to MemBlock
|
||||
CS : error
|
||||
A = EC
|
||||
|
||||
# ChTyp
|
||||
Change The type of a ProDOS File
|
||||
|
||||
## C
|
||||
`int chtyp(const char *filepath, short int filetype);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW filepath`
|
||||
`>PUSHB filetype`
|
||||
`>SYSCALL ChTyp`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
# ChAux
|
||||
Change The type of a ProDOS File
|
||||
|
||||
## C
|
||||
`int chaux(const char *filepath, int auxtype);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW filepath`
|
||||
`>PUSHB filetype`
|
||||
`>SYSCALL ChAux`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
# SetAttr
|
||||
Change Attributes of a ProDOS File
|
||||
|
||||
## C
|
||||
`int setattr(const char *filepath, short int attributes);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW filepath`
|
||||
`>PUSHB attributes`
|
||||
`>SYSCALL setattr`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
# ExecL
|
||||
|
||||
## C / CSH
|
||||
`int execl(const char *cmdline, short int flags);`
|
||||
`short int execl(const char *cmdline, short int flags);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW cmdline`
|
||||
@ -446,7 +485,7 @@ A = Child PSID
|
||||
# ExecV
|
||||
|
||||
## C / CSH
|
||||
`int execv(const char* argv[], short int flags);`
|
||||
`short int execv(const char* argv[], short int flags);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW argv`
|
||||
@ -729,29 +768,29 @@ CS : not found
|
||||
## RETURN VALUE
|
||||
A=hSList
|
||||
|
||||
# ChTyp
|
||||
Change The type of a ProDOS File
|
||||
# ChMod
|
||||
change permissions of a file
|
||||
|
||||
## C
|
||||
`int chtyp(const char *filepath, short int filetype);`
|
||||
`int chmod(const char *pathname, int mode);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW filepath`
|
||||
`>PUSHB filetype`
|
||||
`>SYSCALL chtyp`
|
||||
`>PUSHW pathname`
|
||||
`>PUSHW mode`
|
||||
`>SYSCALL chmod`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
# SetAttr
|
||||
Change Attributes of a ProDOS File
|
||||
# FStat
|
||||
Return information about a hFILE
|
||||
|
||||
## C
|
||||
`int setattr(const char *filepath, short int attributes);`
|
||||
`int fstat(short int hFILE, struct stat *statbuf);`
|
||||
|
||||
## ASM
|
||||
`>PUSHW filepath`
|
||||
`>PUSHB attributes`
|
||||
`>SYSCALL setattr`
|
||||
`>PUSHB hFILE`
|
||||
`>PUSHW statbuf`
|
||||
`>SYSCALL fstat`
|
||||
|
||||
## RETURN VALUE
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
1300
BASIC.15/BASIC.S.A.txt
Normal file
1300
BASIC.15/BASIC.S.A.txt
Normal file
File diff suppressed because it is too large
Load Diff
1687
BASIC.15/BASIC.S.B.txt
Normal file
1687
BASIC.15/BASIC.S.B.txt
Normal file
File diff suppressed because it is too large
Load Diff
1506
BASIC.15/BASIC.S.C.txt
Normal file
1506
BASIC.15/BASIC.S.C.txt
Normal file
File diff suppressed because it is too large
Load Diff
659
BASIC.15/BASIC.S.D.txt
Normal file
659
BASIC.15/BASIC.S.D.txt
Normal file
@ -0,0 +1,659 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
BS.SYSIOVECTS .DA BS.IO.OUT
|
||||
.DA BS.IO.IN
|
||||
.DA BS.IO.OUT.TRACE
|
||||
.DA BS.IO.IN0
|
||||
.DA BS.IO.OUT.CAT
|
||||
.DA BS.IO.IN0
|
||||
BS.VSYSO.LO .DA #$A7
|
||||
BS.VSYSO.HI .DA #$9D
|
||||
BS.ParamLByte .DA #$A0
|
||||
.DA #$AC
|
||||
.DA #$AF
|
||||
.DA #$B4
|
||||
.DA #$B4
|
||||
.DA #$C6
|
||||
.DA #$AC
|
||||
.DA #$AC
|
||||
.DA #$CB
|
||||
.DA #$D1
|
||||
.DA #$D5
|
||||
.DA #$D5
|
||||
.DA #$DD
|
||||
.DA #$DD
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
BS.BYTES .DA #$80
|
||||
.DA #$81
|
||||
.DA #$82
|
||||
.DA #$83
|
||||
.DA #$84
|
||||
.DA #$85
|
||||
.DA #$86
|
||||
.DA #$87
|
||||
.DA #$88
|
||||
.DA #$89
|
||||
.DA #$8A
|
||||
.DA #$8B
|
||||
.DA #$19
|
||||
.DA #$8D
|
||||
.DA #$8E
|
||||
.DA #$8F
|
||||
.DA #$90
|
||||
.DA #$91
|
||||
.DA #$92
|
||||
.DA #$93
|
||||
.DA #$94
|
||||
.DA #$95
|
||||
.DA #$96
|
||||
.DA #$97
|
||||
.DA #$98
|
||||
.DA #$99
|
||||
.DA #$9A
|
||||
.DA #$23
|
||||
.DA #$28
|
||||
.DA #$5A
|
||||
.DA #$5A
|
||||
.DA #$56
|
||||
.DA #$A0
|
||||
.DA #$A1
|
||||
.DA #$A2
|
||||
.DA #$A3
|
||||
.DA #$A4
|
||||
.DA #$A5
|
||||
.DA #$34
|
||||
.DA #$A7
|
||||
.DA #$A8
|
||||
.DA #$A9
|
||||
.DA #$1F
|
||||
.DA #$AB
|
||||
.DA #$AC
|
||||
.DA #$00
|
||||
.DA #$AE
|
||||
.DA #$AF
|
||||
.DA #$B0
|
||||
.DA #$B1
|
||||
.DA #$B2
|
||||
.DA #$B3
|
||||
.DA #$B4
|
||||
.DA #$B5
|
||||
.DA #$B6
|
||||
.DA #$B7
|
||||
.DA #$B8
|
||||
.DA #$B9
|
||||
.DA #$00
|
||||
.DA #$BB
|
||||
.DA #$13
|
||||
.DA #$BD
|
||||
.DA #$BE
|
||||
BS.KW.LEN .DA #$BF
|
||||
.DA #$47
|
||||
.DA #$5F
|
||||
.DA #$18
|
||||
.DA #$30
|
||||
.DA #$15
|
||||
.DA #$BD
|
||||
.DA #$3D
|
||||
.DA #$28
|
||||
.DA #$0D
|
||||
.DA #$41
|
||||
.DA #$20
|
||||
.DA #$50
|
||||
.DA #$84
|
||||
.DA #$0D
|
||||
.DA #$04
|
||||
.DA #$46
|
||||
.DA #$6A
|
||||
.DA #$4C
|
||||
.DA #$5C
|
||||
.DA #$35
|
||||
.DA #$A5
|
||||
.DA #$70
|
||||
.DA #$2D
|
||||
.DA #$12
|
||||
.DA #$65
|
||||
.DA #$39
|
||||
.DA #$41
|
||||
.DA #$88
|
||||
.DA #$1C
|
||||
.DA #$B5
|
||||
.DA #$D8
|
||||
BS.KW.TABLE .AS "BSAVERIFYBLOADELETEBYECATALOGOPENWRITEXECREATEFRESTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPEND"
|
||||
BS.KW.JMP .DA BS.JMP.XTRNADDR
|
||||
.DA BS.KW.PR
|
||||
.DA BS.KW.IN
|
||||
.DA BS.KW.CAT
|
||||
.DA BS.KW.01
|
||||
.DA BS.KW.BYE
|
||||
.DA BS.KW.02
|
||||
.DA BS.KW.BRUN
|
||||
.DA BS.KW.EXEC
|
||||
.DA BS.KW.RESTORE
|
||||
.DA BS.KW.LOCK
|
||||
.DA BS.KW.03
|
||||
.DA BS.KW.X04
|
||||
.DA BS.KW.STORE
|
||||
.DA BS.KW.BLOAD
|
||||
.DA BS.KW.BSAVE
|
||||
.DA BS.KW.X05
|
||||
.DA BS.KW.X06
|
||||
.DA BS.KW.FLUSH
|
||||
.DA BS.KW.X07
|
||||
.DA BS.KW.SAVE
|
||||
.DA BS.KW.X08
|
||||
.DA BS.KW.X09
|
||||
.DA BS.KW.CREATE
|
||||
.DA BS.KW.DELETE
|
||||
.DA BS.KW.PREFIX
|
||||
.DA BS.KW.RENAME
|
||||
.DA BS.KW.UNLOCK
|
||||
.DA BS.KW.X10
|
||||
.DA BS.KW.CATALOG
|
||||
.DA BS.KW.LOAD
|
||||
.DA BS.KW.CLOSE
|
||||
.DA BS.KW.APPEND
|
||||
BS.KW.PBITS .DA $8040
|
||||
.DA $8040
|
||||
.DA $0495
|
||||
.DA $0000
|
||||
.DA $0000
|
||||
.DA $0C11
|
||||
.DA $F401
|
||||
.DA $0701
|
||||
.DA $0401
|
||||
.DA $0401
|
||||
.DA $142D
|
||||
.DA $5321
|
||||
.DA $0409
|
||||
.DA $F405
|
||||
.DA $F40D
|
||||
.DA $0C01
|
||||
.DA $0001
|
||||
.DA $0001
|
||||
.DA $0000
|
||||
.DA $0409
|
||||
.DA $4321
|
||||
.DA $142D
|
||||
.DA $040D
|
||||
.DA $0401
|
||||
.DA $0491
|
||||
.DA $0403
|
||||
.DA $0401
|
||||
.DA $0411
|
||||
.DA $0495
|
||||
.DA $0401
|
||||
.DA $0321
|
||||
.DA $0401
|
||||
BS.KW.OPT .AS "ABELSDFRV@"
|
||||
BS.KW.OPT.PBITSLO
|
||||
.DA #$80
|
||||
.DA #$40
|
||||
.DA #$20
|
||||
.DA #$10
|
||||
.DA #$04
|
||||
.DA #$04
|
||||
.DA #$02
|
||||
.DA #$01
|
||||
.DA #$00
|
||||
.DA #$08
|
||||
BS.KW.OPT.PBITSHI
|
||||
.DA #$05
|
||||
.DA #$12
|
||||
.DA #$19
|
||||
.DA #$21
|
||||
.DA #$24
|
||||
.DA #$28
|
||||
.DA #$31
|
||||
.DA #$39
|
||||
.DA #$40
|
||||
.DA #$45
|
||||
BS.PRODOSTYPES.H
|
||||
.DA #$FF
|
||||
.DA #$FE
|
||||
.DA #$FD
|
||||
.DA #$FC
|
||||
.DA #$FB
|
||||
.DA #$FA
|
||||
.DA #$F0
|
||||
.DA #$0F
|
||||
.DA #$06
|
||||
.DA #$04
|
||||
.DA #$EF
|
||||
.DA #$1A
|
||||
.DA #$1B
|
||||
.DA #$19
|
||||
.DA #$B3
|
||||
BS.PRODOSTYPES.ASC
|
||||
.AS -"S16ADBASPAWPPASTXTBINDIRCMDINTIVRBASVARRELSYS"
|
||||
BS.MONTHS .AS -"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
|
||||
BS.NODATE .AS -"<NO DATE>"
|
||||
BS.MLIERTBL .DA #$28
|
||||
.DA #$2B
|
||||
.DA #$40
|
||||
.DA #$41
|
||||
.DA #$42
|
||||
.DA #$43
|
||||
.DA #$44
|
||||
.DA #$45
|
||||
.DA #$46
|
||||
.DA #$47
|
||||
.DA #$48
|
||||
.DA #$49
|
||||
.DA #$4B
|
||||
.DA #$4C
|
||||
.DA #$4D
|
||||
.DA #$4E
|
||||
.DA #$50
|
||||
.DA #$53
|
||||
.DA #$56
|
||||
BS.BIERRTBL .DA #$03
|
||||
.DA #$04
|
||||
.DA #$10
|
||||
.DA #$0C
|
||||
.DA #$0C
|
||||
.DA #$12
|
||||
.DA #$06
|
||||
.DA #$06
|
||||
.DA #$07
|
||||
.DA #$13
|
||||
.DA #$09
|
||||
.DA #$11
|
||||
.DA #$0D
|
||||
.DA #$05
|
||||
.DA #$02
|
||||
.DA #$0A
|
||||
.DA #$14
|
||||
.DA #$0B
|
||||
.DA #$0C
|
||||
BS.ERRCODES .DA #$08
|
||||
.DA #$54
|
||||
.DA #$5B
|
||||
.DA #$66
|
||||
.DA #$6F
|
||||
.DA #$75
|
||||
.DA #$75
|
||||
.DA #$7E
|
||||
.DA #$84
|
||||
.DA #$8A
|
||||
.DA #$91
|
||||
.DA #$9B
|
||||
.DA #$A8
|
||||
.DA #$B4
|
||||
.DA #$BF
|
||||
.DA #$C9
|
||||
.DA #$D1
|
||||
.DA #$D9
|
||||
.DA #$E1
|
||||
.DA #$EC
|
||||
BS.TBL6 .DA #$F3
|
||||
.DA #$C1
|
||||
.DA #$C3
|
||||
.DA #$C4
|
||||
.DA #$C5
|
||||
.DA #$C6
|
||||
.DA #$C9
|
||||
.DA #$CC
|
||||
.DA #$CD
|
||||
.DA #$CE
|
||||
.DA #$CF
|
||||
.DA #$D2
|
||||
.DA #$D4
|
||||
.DA #$D5
|
||||
.DA #$A0
|
||||
.DA #$00
|
||||
.DA #$00
|
||||
.DA #$C2
|
||||
.DA #$C7
|
||||
.DA #$C8
|
||||
.DA #$CB
|
||||
.DA #$D0
|
||||
.DA #$D3
|
||||
.DA #$D6
|
||||
.DA #$D7
|
||||
.DA #$D8
|
||||
.DA #$D9
|
||||
.DA #$AF
|
||||
.DA #$A8
|
||||
.DA #$A9
|
||||
.DA #$AE
|
||||
.DA #$BA
|
||||
BS.TBL7 .DA #$2A
|
||||
.DA #$05
|
||||
.DA #$0A
|
||||
.DA #$B6
|
||||
.DA #$02
|
||||
.DA #$03
|
||||
.DA #$CE
|
||||
.DA #$10
|
||||
.DA #$50
|
||||
.DA #$57
|
||||
.DA #$4E
|
||||
.DA #$2A
|
||||
.DA #$80
|
||||
.DA #$5D
|
||||
.DA #$C4
|
||||
.DA #$BF
|
||||
.DA #$E9
|
||||
.DA #$18
|
||||
.DA #$4E
|
||||
.DA #$00
|
||||
.DA #$10
|
||||
.DA #$C0
|
||||
.DA #$A0
|
||||
.DA #$54
|
||||
.DA #$EE
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$00
|
||||
.DA #$1E
|
||||
.DA #$8A
|
||||
.DA #$36
|
||||
.DA #$56
|
||||
.DA #$43
|
||||
.DA #$00
|
||||
.DA #$2F
|
||||
.DA #$2B
|
||||
.DA #$41
|
||||
.DA #$C4
|
||||
.DA #$3E
|
||||
.DA #$00
|
||||
.DA #$40
|
||||
.DA #$49
|
||||
.DA #$35
|
||||
.DA #$67
|
||||
.DA #$4E
|
||||
.DA #$06
|
||||
.DA #$D0
|
||||
.DA #$1C
|
||||
.DA #$0A
|
||||
.DA #$05
|
||||
.DA #$4F
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$5B
|
||||
.DA #$44
|
||||
.DA #$0F
|
||||
.DA #$00
|
||||
.DA #$16
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$D0
|
||||
.DA #$64
|
||||
.DA #$30
|
||||
.DA #$FE
|
||||
.DA #$00
|
||||
.DA #$2C
|
||||
.DA #$CA
|
||||
.DA #$C1
|
||||
.DA #$7E
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$60
|
||||
.DA #$FF
|
||||
.DA #$B1
|
||||
.DA #$90
|
||||
.DA #$24
|
||||
.DA #$E4
|
||||
.DA #$BB
|
||||
.DA #$AB
|
||||
.DA #$F0
|
||||
.DA #$9A
|
||||
.DA #$E3
|
||||
.DA #$40
|
||||
.DA #$76
|
||||
.DA #$24
|
||||
.DA #$E2
|
||||
.DA #$A9
|
||||
.DA #$94
|
||||
.DA #$2C
|
||||
.DA #$43
|
||||
.DA #$F0
|
||||
.DA #$08
|
||||
.DA #$B6
|
||||
.DA #$C4
|
||||
.DA #$E0
|
||||
.DA #$5B
|
||||
.DA #$AC
|
||||
.DA #$42
|
||||
.DA #$C4
|
||||
.DA #$3F
|
||||
.DA #$49
|
||||
.DA #$3E
|
||||
.DA #$A5
|
||||
.DA #$E3
|
||||
.DA #$1C
|
||||
.DA #$1F
|
||||
.DA #$05
|
||||
.DA #$1C
|
||||
.DA #$03
|
||||
.DA #$E9
|
||||
.DA #$AC
|
||||
.DA #$E5
|
||||
.DA #$AD
|
||||
.DA #$93
|
||||
.DA #$F0
|
||||
.DA #$60
|
||||
.DA #$BA
|
||||
.DA #$E4
|
||||
.DA #$BB
|
||||
.DA #$AB
|
||||
.DA #$F0
|
||||
.DA #$36
|
||||
.DA #$06
|
||||
.DA #$04
|
||||
.DA #$E5
|
||||
.DA #$D7
|
||||
.DA #$7F
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E7
|
||||
.DA #$A2
|
||||
.DA #$04
|
||||
.DA #$43
|
||||
.DA #$F0
|
||||
.DA #$69
|
||||
.DA #$07
|
||||
.DA #$17
|
||||
.DA #$63
|
||||
.DA #$E0
|
||||
.DA #$51
|
||||
.DA #$B1
|
||||
.DA #$84
|
||||
.DA #$C4
|
||||
.DA #$BF
|
||||
.DA #$9A
|
||||
.DA #$E0
|
||||
.DA #$1D
|
||||
.DA #$55
|
||||
.DA #$4B
|
||||
.DA #$06
|
||||
.DA #$E1
|
||||
.DA #$07
|
||||
.DA #$16
|
||||
.DA #$71
|
||||
.DA #$01
|
||||
.DA #$74
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$EC
|
||||
.DA #$0A
|
||||
.DA #$05
|
||||
.DA #$4E
|
||||
.DA #$86
|
||||
.DA #$06
|
||||
.DA #$81
|
||||
.DA #$C2
|
||||
.DA #$03
|
||||
.DA #$F0
|
||||
.DA #$05
|
||||
.DA #$BA
|
||||
.DA #$02
|
||||
.DA #$B1
|
||||
.DA #$8E
|
||||
.DA #$CA
|
||||
.DA #$AE
|
||||
.DA #$71
|
||||
.DA #$B0
|
||||
.DA #$24
|
||||
.DA #$F0
|
||||
.DA #$9A
|
||||
.DA #$CE
|
||||
.DA #$36
|
||||
.DA #$B4
|
||||
.DA #$2C
|
||||
.DA #$E2
|
||||
.DA #$A8
|
||||
.DA #$81
|
||||
.DA #$93
|
||||
.DA #$F0
|
||||
.DA #$06
|
||||
.DA #$0A
|
||||
.DA #$9C
|
||||
.DA #$10
|
||||
.DA #$9E
|
||||
.DA #$4B
|
||||
.DA #$BA
|
||||
.DA #$BF
|
||||
.DA #$36
|
||||
.DA #$B4
|
||||
.DA #$2C
|
||||
.DA #$AB
|
||||
.DA #$0A
|
||||
.DA #$E5
|
||||
.DA #$D7
|
||||
.DA #$7F
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E9
|
||||
.DA #$AC
|
||||
.DA #$EA
|
||||
.DA #$05
|
||||
.DA #$49
|
||||
.DA #$F0
|
||||
.DA #$3D
|
||||
.DA #$05
|
||||
.DA #$76
|
||||
.DA #$21
|
||||
.DA #$C4
|
||||
.DA #$E5
|
||||
.DA #$67
|
||||
.DA #$4E
|
||||
.DA #$91
|
||||
.DA #$84
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E0
|
||||
.DA #$1D
|
||||
.DA #$06
|
||||
.DA #$0A
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$0C
|
||||
.DA #$06
|
||||
.DA #$0D
|
||||
.DA #$E0
|
||||
.DA #$6C
|
||||
.DA #$67
|
||||
.DA #$7E
|
||||
.DA #$A0
|
||||
.DA #$54
|
||||
.DA #$9F
|
||||
|
||||
XBBB5 .BS 2
|
||||
XBBB7 .BS 1
|
||||
XBBB8 .BS 1
|
||||
BS.IsIntCmdMTR ldy #$02
|
||||
LBBBB lda BS.CMDBUF,y
|
||||
cmp BS.MTR,y
|
||||
bne LBBCF
|
||||
dey
|
||||
bpl LBBBB
|
||||
jsr BS.SetState0
|
||||
jsr MON.CLREOL
|
||||
jmp MON.ENTERMON
|
||||
LBBCF jmp BS.IsIntCmd
|
||||
|
||||
BS.MTR .AS "MTR"
|
||||
BS.IVERSION .DA #5
|
||||
|
||||
BS.AS.HIMEMSave .BS 1
|
||||
XBBD7 .BS 1
|
||||
XBBD8 .BS 1
|
||||
|
||||
XBBD9 .DA #4
|
||||
XBBDA .BS 1
|
||||
XBBDB .BS 1
|
||||
XBBDC .BS 1
|
||||
XBBDD .BS 1
|
||||
|
||||
BS.TXTTAB .DA $0800
|
||||
BS.MEMSIZE .DA $9600
|
||||
|
||||
XBBE2 .BS 1
|
||||
XBBE3 .BS 1
|
||||
|
||||
BS.BAS.HDR .BS 5
|
||||
XBBE9 .BS 1
|
||||
XBBEA .BS 1
|
||||
XBBEB .BS 1
|
||||
XBBEC .BS 1
|
||||
XBBED .BS 1
|
||||
XBBEE .BS 1
|
||||
XBBEF .BS 7
|
||||
XBBF6 .BS 1
|
||||
XBBF7 .BS 7
|
||||
XBBFE .BS 1
|
||||
XBBFF .BS 1
|
||||
XBC00 .BS 3
|
||||
BS.CALLX .BS 1
|
||||
BS.GetCharSep .BS 1
|
||||
BS.GetCharMax .BS 1
|
||||
BS.KW.JMPADDR .BS 2
|
||||
XBC08 .BS 1
|
||||
XBC09 .BS 1
|
||||
|
||||
BS.TMPBUF4 .BS 4
|
||||
|
||||
XBC0E .BS 1
|
||||
XBC0F .BS 1
|
||||
XBC10 .BS 1
|
||||
|
||||
BS.CATWIDTH .BS 1
|
||||
|
||||
XBC12 .BS 1
|
||||
XBC13 .BS 1
|
||||
XBC14 .BS 1
|
||||
XBC15 .BS 1
|
||||
XBC16 .BS 1
|
||||
|
||||
BS.CMDBUF.LEN .BS 1
|
||||
BS.CMDBUF .BS 65
|
||||
|
||||
XBC59 .BS 1
|
||||
XBC5A .BS 1
|
||||
XBC5B .BS 165
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.15/basic.s.d
|
||||
LOAD usr/src/basic.15/basic.s
|
||||
ASM
|
155
BASIC.15/BASIC.S.GP..txt
Normal file
155
BASIC.15/BASIC.S.GP..txt
Normal file
@ -0,0 +1,155 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
GP.ENTRY jmp BS.ENTRY
|
||||
GP.DOSCMD jmp BS.DOSCMD
|
||||
GP.EXTRNCMD jmp GP.RTS
|
||||
GP.ERROUT jmp BS.ERROUT
|
||||
GP.PRINTERR jmp BS.PRINTERR
|
||||
GP.ERRCODE .BS 1
|
||||
*--------------------------------------
|
||||
GP.OUTVECT0 .DA MON.COUT1
|
||||
GP.OUTVECT1 .DA BS.NODEVERR
|
||||
GP.OUTVECT2 .DA BS.NODEVERR
|
||||
GP.OUTVECT3 .DA BS.NODEVERR
|
||||
GP.OUTVECT4 .DA BS.NODEVERR
|
||||
GP.OUTVECT5 .DA BS.NODEVERR
|
||||
GP.OUTVECT6 .DA BS.NODEVERR
|
||||
GP.OUTVECT7 .DA BS.NODEVERR
|
||||
GP.INVECT0 .DA MON.KEYIN
|
||||
GP.INVECT1 .DA BS.NODEVERR
|
||||
GP.INVECT2 .DA BS.NODEVERR
|
||||
GP.INVECT3 .DA BS.NODEVERR
|
||||
GP.INVECT4 .DA BS.NODEVERR
|
||||
GP.INVECT5 .DA BS.NODEVERR
|
||||
GP.INVECT6 .DA BS.NODEVERR
|
||||
GP.INVECT7 .DA BS.NODEVERR
|
||||
GP.VECTOUT .DA MON.COUT1
|
||||
GP.VECTIN .DA MON.KEYIN
|
||||
GP.VDOSO .DA BS.JMP.GP.VSYSO
|
||||
GP.VDOSI .DA BS.JMP.GP.VSYSI
|
||||
GP.VSYSO .BS 2
|
||||
GP.VSYSI .BS 2
|
||||
GP.VDEFSLT .DA #6
|
||||
GP.VDEFDRV .DA #1
|
||||
GP.PREGA .BS 1
|
||||
GP.PREGX .BS 1
|
||||
GP.PREGY .BS 1
|
||||
GP.DTRACE .BS 1
|
||||
GP.STATE .BS 1
|
||||
GP.EXECACTV .BS 1
|
||||
GP.IFILACTV .BS 1
|
||||
GP.OFILACTV .BS 1
|
||||
GP.PFXACTV .BS 1
|
||||
GP.DIRFLG .BS 1
|
||||
GP.EDIRFLG .BS 1
|
||||
GP.STRINGS .BS 1
|
||||
GP.TBUFPTR .BS 1
|
||||
GP.INPTR .BS 1
|
||||
GP.CHRLAST .BS 1
|
||||
GP.OPENCNT .BS 1
|
||||
GP.EXECFILE .BS 1
|
||||
GP.CATFLAG .BS 1
|
||||
GP.XTRNADDR .BS 2
|
||||
GP.XLEN .BS 1
|
||||
GP.XCNUM .BS 1
|
||||
GP.AllowedBITS .BS 2
|
||||
GP.FoundBITS .BS 2
|
||||
GP.ParamA .BS 2
|
||||
GP.ParamB .BS 3
|
||||
GP.ParamE .BS 2
|
||||
GP.ParamL .BS 2
|
||||
GP.ParamS .BS 1
|
||||
GP.ParamD .BS 1
|
||||
GP.ParamF .BS 2
|
||||
GP.ParamR .BS 2
|
||||
GP.ParamV .BS 1
|
||||
GP.ParamAT .BS 2
|
||||
GP.ParamT .BS 1
|
||||
GP.ParamINPR .BS 1
|
||||
GP.VPATH1 .DA BS.CMDBUF.LEN
|
||||
GP.VPATH2 .DA MLI.PATHBUF
|
||||
*--------------------------------------
|
||||
GP.GOSYSTEM sta GP.GOSYSTEM.C
|
||||
stx BS.CALLX
|
||||
and #$1F
|
||||
tax
|
||||
lda BS.ParamLByte,x
|
||||
sta GP.GOSYSTEM.P
|
||||
ldx BS.CALLX
|
||||
jsr MLI
|
||||
GP.GOSYSTEM.C .BS 1
|
||||
GP.GOSYSTEM.P .DA GP.GOSYSTEM.P
|
||||
bcs GP.BADCALL
|
||||
rts
|
||||
*--------------------------------------
|
||||
GP.BADCALL ldx #$12
|
||||
|
||||
LBE8D cmp BS.MLIERTBL,x
|
||||
beq LBE97
|
||||
|
||||
dex
|
||||
bpl LBE8D
|
||||
|
||||
ldx #$13
|
||||
|
||||
LBE97 lda BS.BIERRTBL,x
|
||||
ldx BS.CALLX
|
||||
sec
|
||||
|
||||
GP.RTS rts
|
||||
*--------------------------------------
|
||||
GP.CISPARE1 .BS 1
|
||||
GP.SCREATE .DA #7
|
||||
GP.SCREATEPATH .DA BS.CMDBUF.LEN
|
||||
GP.CRACCESS .DA #$C3
|
||||
GP.CRTYPE .BS 1
|
||||
GP.CRAUXTYPE .BS 2
|
||||
GP.CRSTTYPE .BS 1
|
||||
GP.DATETIME .BS 4
|
||||
GP.SDSTROY .DA #1
|
||||
GP.SDSTROYPATH .DA BS.CMDBUF.LEN
|
||||
GP.SRECNAME .DA #2
|
||||
GP.SRECNAMEOLD .DA BS.CMDBUF.LEN
|
||||
GP.SRECNAMENEW .DA MLI.PATHBUF
|
||||
GP.SSGINFO .BS 1
|
||||
GP.SSGINFOPATH .DA BS.CMDBUF.LEN
|
||||
GP.FIACCESS .BS 1
|
||||
GP.FITYPE .BS 1
|
||||
GP.FIAUXTYPE .BS 2
|
||||
GP.STTYPE .BS 1
|
||||
GP.FIBLOKS .BS 2
|
||||
GP.FIMDATE .BS 2
|
||||
GP.FICDATE .BS 2
|
||||
|
||||
.BS 4
|
||||
|
||||
GP.MLIMRKEOFBUF .DA #2
|
||||
GP.MLIMRKEOFBUF.REFNUM
|
||||
.BS 1
|
||||
GP.SBUFADR .BS 3
|
||||
GP.SOPEN .DA #3
|
||||
GP.TXTBUF .DA BS.CMDBUF.LEN
|
||||
GP.OSYSBUF .BS 2
|
||||
GP.OREFNUM .BS 1
|
||||
GP.SNEWLIN .DA #3
|
||||
GP.NEWLREF .BS 1
|
||||
GP.NLINEMASK .DA #$7F
|
||||
GP.NLINECHAR .DA #13
|
||||
GP.MLIRW .DA #4
|
||||
GP.MLIRW.REFNUM .BS 1
|
||||
GP.MLIRW.DATAPTR .BS 2
|
||||
GP.MLIRW.COUNT .BS 2
|
||||
GP.MLIRW.TRANS .BS 2
|
||||
GP.MLICF .DA #1
|
||||
GP.MLICF.REFNUM .BS 1
|
||||
GP.CCCSPARE .BS 1
|
||||
GP.COPYRIGHT .AS -"COPYRIGHT APPLE, 1983"
|
||||
GP.GETBUFR jmp BS.GETBUFR
|
||||
GP.FREEBUFR jmp BS.FREEBUFR
|
||||
GP.RSHIMEM .BS 5
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.15/basic.s.gp
|
||||
LOAD usr/src/basic.15/basic.s
|
||||
ASM
|
310
BASIC.15/BASIC.S.LDR.txt
Normal file
310
BASIC.15/BASIC.S.LDR.txt
Normal file
@ -0,0 +1,310 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
LDR.START jmp LDR.START1
|
||||
LDR.SIG .DA $EEEE
|
||||
.DA #MLI.MAXPATH+1
|
||||
LDR.STARTUP.LEN .DA #7
|
||||
LDR.STARTUP .AS "STARTUP"
|
||||
.BS MLI.MAXPATH-7
|
||||
LDR.START1 lda #$9A
|
||||
sta Ptr2+1
|
||||
lda #$24
|
||||
sta Ptr1+1
|
||||
lda #$00
|
||||
sta Ptr1
|
||||
sta Ptr2
|
||||
ldx #$23
|
||||
tay
|
||||
jsr LDR.MoveXpages
|
||||
ldx #$01
|
||||
lda #$BE
|
||||
sta Ptr2+1
|
||||
jsr LDR.MoveXpages
|
||||
lda #$15
|
||||
jsr MON.COUT
|
||||
jsr MON.SETNORM
|
||||
jsr MON.INIT
|
||||
jsr MON.MON
|
||||
ldx #$17
|
||||
lda #$00
|
||||
|
||||
L2076 sta MLI.MEMTABL,x
|
||||
dex
|
||||
bne L2076
|
||||
|
||||
lda #$CF
|
||||
sta MLI.MEMTABL
|
||||
lda #$3F
|
||||
sta MLI.MEMTABL+19
|
||||
lda #$FF
|
||||
sta MLI.MEMTABL+20
|
||||
sta MLI.MEMTABL+21
|
||||
sta MLI.MEMTABL+22
|
||||
lda #$C3
|
||||
sta MLI.MEMTABL+23
|
||||
lda AS.COLDBOOT
|
||||
cmp #$4C
|
||||
bne L20B1
|
||||
|
||||
lda MLI.MACHID
|
||||
and #$20
|
||||
beq L20B1
|
||||
|
||||
ldx #$03
|
||||
|
||||
L20A6 lda LDR.CSWVECT,x
|
||||
sta ZP.CSW,x
|
||||
dex
|
||||
bpl L20A6
|
||||
|
||||
jmp AS.COLDBOOT
|
||||
|
||||
L20B1 ldx #$27
|
||||
|
||||
L20B3 lda LDR.UNABLE,x
|
||||
sta $628,x
|
||||
dex
|
||||
bpl L20B3
|
||||
|
||||
sta MON.POWERUPBYTE
|
||||
sta MON.POWERUP+1
|
||||
|
||||
L20C2 bmi L20C2
|
||||
|
||||
LDR.MoveXpages dey
|
||||
lda (Ptr1),y
|
||||
sta (Ptr2),y
|
||||
tya
|
||||
bne LDR.MoveXpages
|
||||
|
||||
inc Ptr1+1
|
||||
inc Ptr2+1
|
||||
dex
|
||||
bne LDR.MoveXpages
|
||||
|
||||
L20D3 rts
|
||||
|
||||
LDR.CSW cmp #$DD
|
||||
bne L20D3
|
||||
|
||||
lda GP.OUTVECT0
|
||||
sta ZP.CSW
|
||||
lda GP.OUTVECT0+1
|
||||
sta ZP.CSW+1
|
||||
lda MLI.DEVNUM
|
||||
sta LDR.ONLINE.P.DEVNUM
|
||||
ldx #$01
|
||||
asl
|
||||
bcc L20EE
|
||||
|
||||
inx
|
||||
|
||||
L20EE stx GP.VDEFDRV
|
||||
asl
|
||||
rol
|
||||
rol
|
||||
rol
|
||||
and #$07
|
||||
sta GP.VDEFSLT
|
||||
ldx #$C1
|
||||
ldy #$02
|
||||
lda MLI.SLTBYT
|
||||
lsr
|
||||
|
||||
L2102 lsr
|
||||
pha
|
||||
bcc L2115
|
||||
|
||||
lda #$00
|
||||
sta GP.OUTVECT0,y
|
||||
sta GP.INVECT0,y
|
||||
txa
|
||||
sta GP.OUTVECT0+1,y
|
||||
sta GP.INVECT0+1,y
|
||||
|
||||
L2115 iny
|
||||
iny
|
||||
inx
|
||||
pla
|
||||
bne L2102
|
||||
|
||||
lda #$96
|
||||
sta AS.HIMEM+1
|
||||
sta AS.STRINGSTART+1
|
||||
sta GP.RSHIMEM
|
||||
lda MLI.PFIXPTR
|
||||
beq L214E
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.GETPREFIX
|
||||
.DA LDR.GETSETPFX2.P
|
||||
bne L218B
|
||||
|
||||
ldx MLI.PATHBUF
|
||||
lda #$2F
|
||||
|
||||
L2136 cmp MLI.PATHBUF,x
|
||||
bne L213E
|
||||
|
||||
inc LDR.PFXLEN
|
||||
|
||||
L213E dex
|
||||
bne L2136
|
||||
|
||||
lda LDR.PFXLEN
|
||||
cmp #$03
|
||||
bcs L216F
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX1.P
|
||||
|
||||
L214E jsr MLI
|
||||
.DA #MLI.C.ONLINE
|
||||
.DA LDR.ONLINE.P
|
||||
bne L218B
|
||||
|
||||
lda MLI.PATHBUF+1
|
||||
and #$0F
|
||||
beq L218B
|
||||
|
||||
tax
|
||||
inx
|
||||
stx MLI.PATHBUF
|
||||
lda #$2F
|
||||
sta MLI.PATHBUF+1
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX2.P
|
||||
bne L218B
|
||||
|
||||
L216F jsr MLI
|
||||
.DA #MLI.C.GETFILEINFO
|
||||
.DA LDR.GFINFO.P
|
||||
bne L218B
|
||||
|
||||
ldx LDR.STARTUP.LEN
|
||||
stx LDR.STARTUP.LEN1
|
||||
|
||||
L217D lda LDR.STARTUP.LEN,x
|
||||
sta IO.LINEBUF,x
|
||||
dex
|
||||
bne L217D
|
||||
|
||||
lda #$AD
|
||||
sta IO.LINEBUF
|
||||
|
||||
L218B lda LDR.PFXLEN
|
||||
cmp #$03
|
||||
bcs L2198
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX1.P
|
||||
|
||||
L2198 lda LDR.STARTUP.LEN1
|
||||
bne L21C1
|
||||
|
||||
jsr LDR.KSW
|
||||
ldx #$1C
|
||||
|
||||
L21A2 lda LDR.PRODOSBASIC,x
|
||||
sta $400,x
|
||||
dex
|
||||
bpl L21A2
|
||||
|
||||
ldx #$1F
|
||||
|
||||
L21AD lda LDR.COPYRIGHT,x
|
||||
sta $480,x
|
||||
dex
|
||||
bpl L21AD
|
||||
|
||||
lda #$8D
|
||||
jsr MON.COUT1
|
||||
jsr MON.COUT1
|
||||
jsr MON.COUT1
|
||||
|
||||
L21C1 ldx #$02
|
||||
L21C3 lda LDR.JMP.GP.ENTRY,x
|
||||
sta DOS.WARMSTART,x
|
||||
sta DOS.COLDSTART,x
|
||||
sta MON.USRJMP,x
|
||||
lda LDR.AMPERSANDJMP,x
|
||||
sta MON.AMPERSANDJMP,x
|
||||
dex
|
||||
bpl L21C3
|
||||
|
||||
lda LDR.BRKVECT
|
||||
sta MON.BRKVECT
|
||||
lda LDR.BRKVECT+1
|
||||
sta MON.BRKVECT+1
|
||||
lda LDR.POWERUP
|
||||
sta MON.POWERUP
|
||||
lda LDR.POWERUP+1
|
||||
sta MON.POWERUP+1
|
||||
eor #$A5
|
||||
sta MON.POWERUPBYTE
|
||||
lda #$A5
|
||||
sta AS.TRCFLG
|
||||
lda BS.IVERSION
|
||||
sta MLI.IVERSION
|
||||
|
||||
LDR.JMP.GP.ENTRY
|
||||
jmp GP.ENTRY
|
||||
|
||||
LDR.BRKVECT .DA MON.BREAKV
|
||||
LDR.POWERUP .DA GP.ENTRY
|
||||
|
||||
LDR.AMPERSANDJMP
|
||||
jmp GP.DOSCMD
|
||||
|
||||
LDR.KSW lda GP.INVECT0
|
||||
sta ZP.KSW
|
||||
lda GP.INVECT0+1
|
||||
sta ZP.KSW+1
|
||||
ldx LDR.STARTUP.LEN
|
||||
inx
|
||||
lda #$8D
|
||||
rts
|
||||
|
||||
LDR.CSWVECT .DA LDR.CSW
|
||||
LDR.KSWVECT .DA LDR.KSW
|
||||
LDR.GFINFO.P .DA #10
|
||||
LDR.GFINFO.P.PATHBUF
|
||||
.DA LDR.STARTUP.LEN
|
||||
|
||||
.BS 16
|
||||
|
||||
LDR.GETSETPFX1.P
|
||||
.DA #1
|
||||
LDR.GETSETPFX1.P.BUF
|
||||
.DA LDR.GETSETPFX1.SLASHLEN
|
||||
LDR.GETSETPFX1.SLASHLEN
|
||||
.DA #1
|
||||
LDR.GETSETPFX1.SLASH
|
||||
.AS "/"
|
||||
LDR.STARTUP.LEN1
|
||||
.DA #0
|
||||
LDR.ONLINE.P
|
||||
.DA #2
|
||||
LDR.ONLINE.P.DEVNUM
|
||||
.DA #$70
|
||||
LDR.ONLINE.P.BUF
|
||||
.DA MLI.PATHBUF+1
|
||||
LDR.GETSETPFX2.P
|
||||
.DA #1
|
||||
LDR.GETSETPFX2.P.BUF
|
||||
.DA MLI.PATHBUF
|
||||
LDR.PFXLEN .DA #0
|
||||
|
||||
LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***"
|
||||
LDR.PRODOSBASIC .AS -" PRODOS BASIC 1.5 "
|
||||
LDR.COPYRIGHT .AS -" COPYRIGHT APPLE 1983-92"
|
||||
.BS $2400-*
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.15/basic.s.ldr
|
||||
LOAD usr/src/basic.15/basic.s
|
||||
ASM
|
163
BASIC.15/BASIC.S.txt
Normal file
163
BASIC.15/BASIC.S.txt
Normal file
@ -0,0 +1,163 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 6502
|
||||
.OR $2000
|
||||
.TF BASIC.15,TSYS
|
||||
*--------------------------------------
|
||||
Ptr1 .EQ 0
|
||||
Ptr2 .EQ 2
|
||||
|
||||
ZP.WNDLFT .EQ $20
|
||||
ZP.WNDWDT .EQ $21
|
||||
ZP.WNDTOP .EQ $22
|
||||
ZP.WNDBOT .EQ $23
|
||||
ZP.CH .EQ $24
|
||||
ZP.CV .EQ $25
|
||||
ZP.BASL .EQ $28
|
||||
ZP.BASH .EQ $29
|
||||
|
||||
ZP.PROMPT .EQ $33
|
||||
|
||||
ZP.CSW .EQ $36
|
||||
ZP.KSW .EQ $38
|
||||
|
||||
ZP.PCL .EQ $3A
|
||||
ZP.PCH .EQ $3B
|
||||
ZP.A1L .EQ $3C
|
||||
ZP.A1H .EQ $3D
|
||||
ZP.A2L .EQ $3E
|
||||
ZP.A2H .EQ $3F
|
||||
|
||||
AS.LINNUM .EQ $50
|
||||
AS.PGRMSTART .EQ $67
|
||||
AS.VARSTART .EQ $69
|
||||
AS.ARRAYSTART .EQ $6B
|
||||
AS.ARRAYEND .EQ $6D
|
||||
AS.STRINGSTART .EQ $6F
|
||||
AS.STRINGPTR .EQ $71
|
||||
AS.HIMEM .EQ $73
|
||||
AS.CURLINE .EQ $75
|
||||
AS.LOWTR .EQ $9B
|
||||
AS.PGRMEND .EQ $AF
|
||||
AS.TXTPTR .EQ $B8
|
||||
AS.ERRFLG .EQ $D8
|
||||
AS.ERRNUM .EQ $DE
|
||||
AS.TRCFLG .EQ $F2
|
||||
AS.REMSTK .EQ $F8
|
||||
*--------------------------------------
|
||||
IO.LINEBUF .EQ $200
|
||||
*--------------------------------------
|
||||
DIRENTBUF .EQ $259
|
||||
DIRENTBUF.STNL .EQ $25D
|
||||
DIRENTBUF.TYPE .EQ $269
|
||||
|
||||
DIRENTBUF.UBLK .EQ $26C
|
||||
DIRENTBUF.EOF .EQ $26E
|
||||
|
||||
DIRENTBUF.ACCESS .EQ $277
|
||||
DIRENTBUF.AUXT .EQ $278
|
||||
|
||||
MLI.PATHBUF .EQ $280
|
||||
*--------------------------------------
|
||||
DOS.WARMSTART .EQ $03D0
|
||||
DOS.COLDSTART .EQ $03D3
|
||||
DOS.FILEMGR .EQ $03D6
|
||||
DOS.RWTS .EQ $03D9
|
||||
DOS.FILEMGRPARM .EQ $03DC
|
||||
DOS.RWTSPARM .EQ $03E3
|
||||
DOS.RECONNECT .EQ $03DA
|
||||
DOS.JMPBRKVECT .EQ $03EF
|
||||
|
||||
MON.AMPERSANDJMP .EQ $03F5
|
||||
MON.USRJMP .EQ $03F8
|
||||
MON.NMIJMP .EQ $03FB
|
||||
MON.IRQVECT .EQ $03FE
|
||||
MON.BRKVECT .EQ $03F0
|
||||
MON.POWERUP .EQ $03F2
|
||||
MON.POWERUPBYTE .EQ $03F4
|
||||
*--------------------------------------
|
||||
MLI.MAXPATH .EQ 64
|
||||
MLI.C.ALLOCIRQ .EQ $40
|
||||
MLI.C.DEALLOCIRQ .EQ $41
|
||||
MLI.C.ATALK .EQ $42
|
||||
MLI.C.QUIT .EQ $65
|
||||
MLI.C.READBLOCK .EQ $80
|
||||
MLI.C.WRITEBLOCK .EQ $81
|
||||
MLI.C.GETTIME .EQ $82
|
||||
MLI.C.CREATE .EQ $C0
|
||||
MLI.C.DESTROY .EQ $C1
|
||||
MLI.C.RENAME .EQ $C2
|
||||
MLI.C.SETFILEINFO .EQ $C3
|
||||
MLI.C.GETFILEINFO .EQ $C4
|
||||
MLI.C.ONLINE .EQ $C5
|
||||
MLI.C.SETPREFIX .EQ $C6
|
||||
MLI.C.GETPREFIX .EQ $C7
|
||||
MLI.C.OPEN .EQ $C8
|
||||
MLI.C.NEWLINE .EQ $C9
|
||||
MLI.C.READ .EQ $CA
|
||||
MLI.C.WRITE .EQ $CB
|
||||
MLI.C.CLOSE .EQ $CC
|
||||
MLI.C.FLUSH .EQ $CD
|
||||
MLI.C.SETMARK .EQ $CE
|
||||
MLI.C.GETMARK .EQ $CF
|
||||
MLI.C.SETEOF .EQ $D0
|
||||
MLI.C.GETEOF .EQ $D1
|
||||
MLI.C.SETBUF .EQ $D2
|
||||
MLI.C.GETBUF .EQ $D3
|
||||
*--------------------------------------
|
||||
MLI .EQ $BF00
|
||||
MLI.DEVNUM .EQ $BF30
|
||||
MLI.DEVCNT .EQ $BF31
|
||||
MLI.DEVLST .EQ $BF32
|
||||
MLI.MEMTABL .EQ $BF58
|
||||
MLI.LEVEL .EQ $BF94
|
||||
MLI.MACHID .EQ $BF98
|
||||
MLI.SLTBYT .EQ $BF99
|
||||
MLI.PFIXPTR .EQ $BF9A
|
||||
MLI.MLIACTV .EQ $BF9B
|
||||
MLI.IVERSION .EQ $BFFD
|
||||
*--------------------------------------
|
||||
IO.KBD .EQ $C000
|
||||
IO.KSTROBE .EQ $C010
|
||||
*--------------------------------------
|
||||
AS.RESTART .EQ $D43C
|
||||
AS.RESTART1 .EQ $D43F
|
||||
AS.FINDLINE .EQ $D61A
|
||||
AS.CLEAR1 .EQ $D665
|
||||
AS.NEXTSTMT .EQ $D7D2
|
||||
AS.EXECSTMT .EQ $D820
|
||||
AS.BITERRFLG .EQ $D865
|
||||
AS.NORMAL .EQ $F273
|
||||
AS.COLDBOOT .EQ $E000
|
||||
AS.INTPRINTAX .EQ $ED24
|
||||
*--------------------------------------
|
||||
MON.BREAKV .EQ $FA59
|
||||
MON.INIT .EQ $FB2F
|
||||
MON.MON .EQ $FC58
|
||||
MON.CLREOL .EQ $FC9C
|
||||
MON.RDKEY .EQ $FD0C
|
||||
MON.KEYIN0 .EQ $FD10
|
||||
MON.KEYIN .EQ $FD1B
|
||||
MON.GETLN .EQ $FD6A
|
||||
MON.COUT .EQ $FDED
|
||||
MON.COUT1 .EQ $FDF0
|
||||
MON.IIGSID .EQ $FE1F
|
||||
MON.SETINV .EQ $FE80
|
||||
MON.SETNORM .EQ $FE84
|
||||
MON.ENTERMON .EQ $FF69
|
||||
*--------------------------------------
|
||||
.INB usr/src/basic.15/basic.s.ldr
|
||||
LDR.9A00.CODE .PH $9A00
|
||||
.INB usr/src/basic.15/basic.s.a
|
||||
.INB usr/src/basic.15/basic.s.b
|
||||
.INB usr/src/basic.15/basic.s.c
|
||||
.INB usr/src/basic.15/basic.s.d
|
||||
.EP
|
||||
LDR.BE00.CODE .PH $BE00
|
||||
.INB usr/src/basic.15/basic.s.gp
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.15/basic.s
|
||||
ASM
|
1300
BASIC.FX/BASIC.S.A.txt
Normal file
1300
BASIC.FX/BASIC.S.A.txt
Normal file
File diff suppressed because it is too large
Load Diff
1687
BASIC.FX/BASIC.S.B.txt
Normal file
1687
BASIC.FX/BASIC.S.B.txt
Normal file
File diff suppressed because it is too large
Load Diff
1506
BASIC.FX/BASIC.S.C.txt
Normal file
1506
BASIC.FX/BASIC.S.C.txt
Normal file
File diff suppressed because it is too large
Load Diff
659
BASIC.FX/BASIC.S.D.txt
Normal file
659
BASIC.FX/BASIC.S.D.txt
Normal file
@ -0,0 +1,659 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
BS.SYSIOVECTS .DA BS.IO.OUT
|
||||
.DA BS.IO.IN
|
||||
.DA BS.IO.OUT.TRACE
|
||||
.DA BS.IO.IN0
|
||||
.DA BS.IO.OUT.CAT
|
||||
.DA BS.IO.IN0
|
||||
BS.VSYSO.LO .DA #$A7
|
||||
BS.VSYSO.HI .DA #$9D
|
||||
BS.ParamLByte .DA #$A0
|
||||
.DA #$AC
|
||||
.DA #$AF
|
||||
.DA #$B4
|
||||
.DA #$B4
|
||||
.DA #$C6
|
||||
.DA #$AC
|
||||
.DA #$AC
|
||||
.DA #$CB
|
||||
.DA #$D1
|
||||
.DA #$D5
|
||||
.DA #$D5
|
||||
.DA #$DD
|
||||
.DA #$DD
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
.DA #$C6
|
||||
BS.BYTES .DA #$80
|
||||
.DA #$81
|
||||
.DA #$82
|
||||
.DA #$83
|
||||
.DA #$84
|
||||
.DA #$85
|
||||
.DA #$86
|
||||
.DA #$87
|
||||
.DA #$88
|
||||
.DA #$89
|
||||
.DA #$8A
|
||||
.DA #$8B
|
||||
.DA #$19
|
||||
.DA #$8D
|
||||
.DA #$8E
|
||||
.DA #$8F
|
||||
.DA #$90
|
||||
.DA #$91
|
||||
.DA #$92
|
||||
.DA #$93
|
||||
.DA #$94
|
||||
.DA #$95
|
||||
.DA #$96
|
||||
.DA #$97
|
||||
.DA #$98
|
||||
.DA #$99
|
||||
.DA #$9A
|
||||
.DA #$23
|
||||
.DA #$28
|
||||
.DA #$5A
|
||||
.DA #$5A
|
||||
.DA #$56
|
||||
.DA #$A0
|
||||
.DA #$A1
|
||||
.DA #$A2
|
||||
.DA #$A3
|
||||
.DA #$A4
|
||||
.DA #$A5
|
||||
.DA #$34
|
||||
.DA #$A7
|
||||
.DA #$A8
|
||||
.DA #$A9
|
||||
.DA #$1F
|
||||
.DA #$AB
|
||||
.DA #$AC
|
||||
.DA #$00
|
||||
.DA #$AE
|
||||
.DA #$AF
|
||||
.DA #$B0
|
||||
.DA #$B1
|
||||
.DA #$B2
|
||||
.DA #$B3
|
||||
.DA #$B4
|
||||
.DA #$B5
|
||||
.DA #$B6
|
||||
.DA #$B7
|
||||
.DA #$B8
|
||||
.DA #$B9
|
||||
.DA #$00
|
||||
.DA #$BB
|
||||
.DA #$13
|
||||
.DA #$BD
|
||||
.DA #$BE
|
||||
BS.KW.LEN .DA #$BF
|
||||
.DA #$47
|
||||
.DA #$5F
|
||||
.DA #$18
|
||||
.DA #$30
|
||||
.DA #$15
|
||||
.DA #$BD
|
||||
.DA #$3D
|
||||
.DA #$28
|
||||
.DA #$0D
|
||||
.DA #$41
|
||||
.DA #$20
|
||||
.DA #$50
|
||||
.DA #$84
|
||||
.DA #$0D
|
||||
.DA #$04
|
||||
.DA #$46
|
||||
.DA #$6A
|
||||
.DA #$4C
|
||||
.DA #$5C
|
||||
.DA #$35
|
||||
.DA #$A5
|
||||
.DA #$70
|
||||
.DA #$2D
|
||||
.DA #$12
|
||||
.DA #$65
|
||||
.DA #$39
|
||||
.DA #$41
|
||||
.DA #$88
|
||||
.DA #$1C
|
||||
.DA #$B5
|
||||
.DA #$D8
|
||||
BS.KW.TABLE .AS "BSAVERIFYBLOADELETEBYECATALOGOPENWRITEXECREATEFRESTORENAMEBRUNLOCKCHAIN#FLUSHREADPOSITIONOMONPR#PREFIXCLOSEAPPEND"
|
||||
BS.KW.JMP .DA BS.JMP.XTRNADDR
|
||||
.DA BS.KW.PR
|
||||
.DA BS.KW.IN
|
||||
.DA BS.KW.CAT
|
||||
.DA BS.KW.01
|
||||
.DA BS.KW.BYE
|
||||
.DA BS.KW.02
|
||||
.DA BS.KW.BRUN
|
||||
.DA BS.KW.EXEC
|
||||
.DA BS.KW.RESTORE
|
||||
.DA BS.KW.LOCK
|
||||
.DA BS.KW.03
|
||||
.DA BS.KW.X04
|
||||
.DA BS.KW.STORE
|
||||
.DA BS.KW.BLOAD
|
||||
.DA BS.KW.BSAVE
|
||||
.DA BS.KW.X05
|
||||
.DA BS.KW.X06
|
||||
.DA BS.KW.FLUSH
|
||||
.DA BS.KW.X07
|
||||
.DA BS.KW.SAVE
|
||||
.DA BS.KW.X08
|
||||
.DA BS.KW.X09
|
||||
.DA BS.KW.CREATE
|
||||
.DA BS.KW.DELETE
|
||||
.DA BS.KW.PREFIX
|
||||
.DA BS.KW.RENAME
|
||||
.DA BS.KW.UNLOCK
|
||||
.DA BS.KW.X10
|
||||
.DA BS.KW.CATALOG
|
||||
.DA BS.KW.LOAD
|
||||
.DA BS.KW.CLOSE
|
||||
.DA BS.KW.APPEND
|
||||
BS.KW.PBITS .DA $8040
|
||||
.DA $8040
|
||||
.DA $0495
|
||||
.DA $0000
|
||||
.DA $0000
|
||||
.DA $0C11
|
||||
.DA $F401
|
||||
.DA $0701
|
||||
.DA $0401
|
||||
.DA $0401
|
||||
.DA $142D
|
||||
.DA $5321
|
||||
.DA $0409
|
||||
.DA $F405
|
||||
.DA $F40D
|
||||
.DA $0C01
|
||||
.DA $0001
|
||||
.DA $0001
|
||||
.DA $0000
|
||||
.DA $0409
|
||||
.DA $4321
|
||||
.DA $142D
|
||||
.DA $040D
|
||||
.DA $0401
|
||||
.DA $0491
|
||||
.DA $0403
|
||||
.DA $0401
|
||||
.DA $0411
|
||||
.DA $0495
|
||||
.DA $0401
|
||||
.DA $0321
|
||||
.DA $0401
|
||||
BS.KW.OPT .AS "ABELSDFRV@"
|
||||
BS.KW.OPT.PBITSLO
|
||||
.DA #$80
|
||||
.DA #$40
|
||||
.DA #$20
|
||||
.DA #$10
|
||||
.DA #$04
|
||||
.DA #$04
|
||||
.DA #$02
|
||||
.DA #$01
|
||||
.DA #$00
|
||||
.DA #$08
|
||||
BS.KW.OPT.PBITSHI
|
||||
.DA #$05
|
||||
.DA #$12
|
||||
.DA #$19
|
||||
.DA #$21
|
||||
.DA #$24
|
||||
.DA #$28
|
||||
.DA #$31
|
||||
.DA #$39
|
||||
.DA #$40
|
||||
.DA #$45
|
||||
BS.PRODOSTYPES.H
|
||||
.DA #$FF
|
||||
.DA #$FE
|
||||
.DA #$FD
|
||||
.DA #$FC
|
||||
.DA #$FB
|
||||
.DA #$FA
|
||||
.DA #$F0
|
||||
.DA #$0F
|
||||
.DA #$06
|
||||
.DA #$04
|
||||
.DA #$EF
|
||||
.DA #$1A
|
||||
.DA #$1B
|
||||
.DA #$19
|
||||
.DA #$B3
|
||||
BS.PRODOSTYPES.ASC
|
||||
.AS -"S16ADBASPAWPPASTXTBINDIRCMDINTIVRBASVARRELSYS"
|
||||
BS.MONTHS .AS -"JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
|
||||
BS.NODATE .AS -"<NO DATE>"
|
||||
BS.MLIERTBL .DA #$28
|
||||
.DA #$2B
|
||||
.DA #$40
|
||||
.DA #$41
|
||||
.DA #$42
|
||||
.DA #$43
|
||||
.DA #$44
|
||||
.DA #$45
|
||||
.DA #$46
|
||||
.DA #$47
|
||||
.DA #$48
|
||||
.DA #$49
|
||||
.DA #$4B
|
||||
.DA #$4C
|
||||
.DA #$4D
|
||||
.DA #$4E
|
||||
.DA #$50
|
||||
.DA #$53
|
||||
.DA #$56
|
||||
BS.BIERRTBL .DA #$03
|
||||
.DA #$04
|
||||
.DA #$10
|
||||
.DA #$0C
|
||||
.DA #$0C
|
||||
.DA #$12
|
||||
.DA #$06
|
||||
.DA #$06
|
||||
.DA #$07
|
||||
.DA #$13
|
||||
.DA #$09
|
||||
.DA #$11
|
||||
.DA #$0D
|
||||
.DA #$05
|
||||
.DA #$02
|
||||
.DA #$0A
|
||||
.DA #$14
|
||||
.DA #$0B
|
||||
.DA #$0C
|
||||
BS.ERRCODES .DA #$08
|
||||
.DA #$54
|
||||
.DA #$5B
|
||||
.DA #$66
|
||||
.DA #$6F
|
||||
.DA #$75
|
||||
.DA #$75
|
||||
.DA #$7E
|
||||
.DA #$84
|
||||
.DA #$8A
|
||||
.DA #$91
|
||||
.DA #$9B
|
||||
.DA #$A8
|
||||
.DA #$B4
|
||||
.DA #$BF
|
||||
.DA #$C9
|
||||
.DA #$D1
|
||||
.DA #$D9
|
||||
.DA #$E1
|
||||
.DA #$EC
|
||||
BS.TBL6 .DA #$F3
|
||||
.DA #$C1
|
||||
.DA #$C3
|
||||
.DA #$C4
|
||||
.DA #$C5
|
||||
.DA #$C6
|
||||
.DA #$C9
|
||||
.DA #$CC
|
||||
.DA #$CD
|
||||
.DA #$CE
|
||||
.DA #$CF
|
||||
.DA #$D2
|
||||
.DA #$D4
|
||||
.DA #$D5
|
||||
.DA #$A0
|
||||
.DA #$00
|
||||
.DA #$00
|
||||
.DA #$C2
|
||||
.DA #$C7
|
||||
.DA #$C8
|
||||
.DA #$CB
|
||||
.DA #$D0
|
||||
.DA #$D3
|
||||
.DA #$D6
|
||||
.DA #$D7
|
||||
.DA #$D8
|
||||
.DA #$D9
|
||||
.DA #$AF
|
||||
.DA #$A8
|
||||
.DA #$A9
|
||||
.DA #$AE
|
||||
.DA #$BA
|
||||
BS.TBL7 .DA #$2A
|
||||
.DA #$05
|
||||
.DA #$0A
|
||||
.DA #$B6
|
||||
.DA #$02
|
||||
.DA #$03
|
||||
.DA #$CE
|
||||
.DA #$10
|
||||
.DA #$50
|
||||
.DA #$57
|
||||
.DA #$4E
|
||||
.DA #$2A
|
||||
.DA #$80
|
||||
.DA #$5D
|
||||
.DA #$C4
|
||||
.DA #$BF
|
||||
.DA #$E9
|
||||
.DA #$18
|
||||
.DA #$4E
|
||||
.DA #$00
|
||||
.DA #$10
|
||||
.DA #$C0
|
||||
.DA #$A0
|
||||
.DA #$54
|
||||
.DA #$EE
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$00
|
||||
.DA #$1E
|
||||
.DA #$8A
|
||||
.DA #$36
|
||||
.DA #$56
|
||||
.DA #$43
|
||||
.DA #$00
|
||||
.DA #$2F
|
||||
.DA #$2B
|
||||
.DA #$41
|
||||
.DA #$C4
|
||||
.DA #$3E
|
||||
.DA #$00
|
||||
.DA #$40
|
||||
.DA #$49
|
||||
.DA #$35
|
||||
.DA #$67
|
||||
.DA #$4E
|
||||
.DA #$06
|
||||
.DA #$D0
|
||||
.DA #$1C
|
||||
.DA #$0A
|
||||
.DA #$05
|
||||
.DA #$4F
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$5B
|
||||
.DA #$44
|
||||
.DA #$0F
|
||||
.DA #$00
|
||||
.DA #$16
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$6E
|
||||
.DA #$D0
|
||||
.DA #$64
|
||||
.DA #$30
|
||||
.DA #$FE
|
||||
.DA #$00
|
||||
.DA #$2C
|
||||
.DA #$CA
|
||||
.DA #$C1
|
||||
.DA #$7E
|
||||
.DA #$01
|
||||
.DA #$7A
|
||||
.DA #$20
|
||||
.DA #$40
|
||||
.DA #$60
|
||||
.DA #$FF
|
||||
.DA #$B1
|
||||
.DA #$90
|
||||
.DA #$24
|
||||
.DA #$E4
|
||||
.DA #$BB
|
||||
.DA #$AB
|
||||
.DA #$F0
|
||||
.DA #$9A
|
||||
.DA #$E3
|
||||
.DA #$40
|
||||
.DA #$76
|
||||
.DA #$24
|
||||
.DA #$E2
|
||||
.DA #$A9
|
||||
.DA #$94
|
||||
.DA #$2C
|
||||
.DA #$43
|
||||
.DA #$F0
|
||||
.DA #$08
|
||||
.DA #$B6
|
||||
.DA #$C4
|
||||
.DA #$E0
|
||||
.DA #$5B
|
||||
.DA #$AC
|
||||
.DA #$42
|
||||
.DA #$C4
|
||||
.DA #$3F
|
||||
.DA #$49
|
||||
.DA #$3E
|
||||
.DA #$A5
|
||||
.DA #$E3
|
||||
.DA #$1C
|
||||
.DA #$1F
|
||||
.DA #$05
|
||||
.DA #$1C
|
||||
.DA #$03
|
||||
.DA #$E9
|
||||
.DA #$AC
|
||||
.DA #$E5
|
||||
.DA #$AD
|
||||
.DA #$93
|
||||
.DA #$F0
|
||||
.DA #$60
|
||||
.DA #$BA
|
||||
.DA #$E4
|
||||
.DA #$BB
|
||||
.DA #$AB
|
||||
.DA #$F0
|
||||
.DA #$36
|
||||
.DA #$06
|
||||
.DA #$04
|
||||
.DA #$E5
|
||||
.DA #$D7
|
||||
.DA #$7F
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E7
|
||||
.DA #$A2
|
||||
.DA #$04
|
||||
.DA #$43
|
||||
.DA #$F0
|
||||
.DA #$69
|
||||
.DA #$07
|
||||
.DA #$17
|
||||
.DA #$63
|
||||
.DA #$E0
|
||||
.DA #$51
|
||||
.DA #$B1
|
||||
.DA #$84
|
||||
.DA #$C4
|
||||
.DA #$BF
|
||||
.DA #$9A
|
||||
.DA #$E0
|
||||
.DA #$1D
|
||||
.DA #$55
|
||||
.DA #$4B
|
||||
.DA #$06
|
||||
.DA #$E1
|
||||
.DA #$07
|
||||
.DA #$16
|
||||
.DA #$71
|
||||
.DA #$01
|
||||
.DA #$74
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$EC
|
||||
.DA #$0A
|
||||
.DA #$05
|
||||
.DA #$4E
|
||||
.DA #$86
|
||||
.DA #$06
|
||||
.DA #$81
|
||||
.DA #$C2
|
||||
.DA #$03
|
||||
.DA #$F0
|
||||
.DA #$05
|
||||
.DA #$BA
|
||||
.DA #$02
|
||||
.DA #$B1
|
||||
.DA #$8E
|
||||
.DA #$CA
|
||||
.DA #$AE
|
||||
.DA #$71
|
||||
.DA #$B0
|
||||
.DA #$24
|
||||
.DA #$F0
|
||||
.DA #$9A
|
||||
.DA #$CE
|
||||
.DA #$36
|
||||
.DA #$B4
|
||||
.DA #$2C
|
||||
.DA #$E2
|
||||
.DA #$A8
|
||||
.DA #$81
|
||||
.DA #$93
|
||||
.DA #$F0
|
||||
.DA #$06
|
||||
.DA #$0A
|
||||
.DA #$9C
|
||||
.DA #$10
|
||||
.DA #$9E
|
||||
.DA #$4B
|
||||
.DA #$BA
|
||||
.DA #$BF
|
||||
.DA #$36
|
||||
.DA #$B4
|
||||
.DA #$2C
|
||||
.DA #$AB
|
||||
.DA #$0A
|
||||
.DA #$E5
|
||||
.DA #$D7
|
||||
.DA #$7F
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E9
|
||||
.DA #$AC
|
||||
.DA #$EA
|
||||
.DA #$05
|
||||
.DA #$49
|
||||
.DA #$F0
|
||||
.DA #$3D
|
||||
.DA #$05
|
||||
.DA #$76
|
||||
.DA #$21
|
||||
.DA #$C4
|
||||
.DA #$E5
|
||||
.DA #$67
|
||||
.DA #$4E
|
||||
.DA #$91
|
||||
.DA #$84
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$E0
|
||||
.DA #$1D
|
||||
.DA #$06
|
||||
.DA #$0A
|
||||
.DA #$F0
|
||||
.DA #$56
|
||||
.DA #$74
|
||||
.DA #$0C
|
||||
.DA #$06
|
||||
.DA #$0D
|
||||
.DA #$E0
|
||||
.DA #$6C
|
||||
.DA #$67
|
||||
.DA #$7E
|
||||
.DA #$A0
|
||||
.DA #$54
|
||||
.DA #$9F
|
||||
|
||||
XBBB5 .BS 2
|
||||
XBBB7 .BS 1
|
||||
XBBB8 .BS 1
|
||||
BS.IsIntCmdMTR ldy #$02
|
||||
LBBBB lda BS.CMDBUF,y
|
||||
cmp BS.MTR,y
|
||||
bne LBBCF
|
||||
dey
|
||||
bpl LBBBB
|
||||
jsr BS.SetState0
|
||||
jsr MON.CLREOL
|
||||
jmp MON.ENTERMON
|
||||
LBBCF jmp BS.IsIntCmd
|
||||
|
||||
BS.MTR .AS "MTR"
|
||||
BS.IVERSION .DA #5
|
||||
|
||||
BS.AS.HIMEMSave .BS 1
|
||||
XBBD7 .BS 1
|
||||
XBBD8 .BS 1
|
||||
|
||||
XBBD9 .DA #4
|
||||
XBBDA .BS 1
|
||||
XBBDB .BS 1
|
||||
XBBDC .BS 1
|
||||
XBBDD .BS 1
|
||||
|
||||
BS.TXTTAB .DA $0800
|
||||
BS.MEMSIZE .DA $9600
|
||||
|
||||
XBBE2 .BS 1
|
||||
XBBE3 .BS 1
|
||||
|
||||
BS.BAS.HDR .BS 5
|
||||
XBBE9 .BS 1
|
||||
XBBEA .BS 1
|
||||
XBBEB .BS 1
|
||||
XBBEC .BS 1
|
||||
XBBED .BS 1
|
||||
XBBEE .BS 1
|
||||
XBBEF .BS 7
|
||||
XBBF6 .BS 1
|
||||
XBBF7 .BS 7
|
||||
XBBFE .BS 1
|
||||
XBBFF .BS 1
|
||||
XBC00 .BS 3
|
||||
BS.CALLX .BS 1
|
||||
BS.GetCharSep .BS 1
|
||||
BS.GetCharMax .BS 1
|
||||
BS.KW.JMPADDR .BS 2
|
||||
XBC08 .BS 1
|
||||
XBC09 .BS 1
|
||||
|
||||
BS.TMPBUF4 .BS 4
|
||||
|
||||
XBC0E .BS 1
|
||||
XBC0F .BS 1
|
||||
XBC10 .BS 1
|
||||
|
||||
BS.CATWIDTH .BS 1
|
||||
|
||||
XBC12 .BS 1
|
||||
XBC13 .BS 1
|
||||
XBC14 .BS 1
|
||||
XBC15 .BS 1
|
||||
XBC16 .BS 1
|
||||
|
||||
BS.CMDBUF.LEN .BS 1
|
||||
BS.CMDBUF .BS 65
|
||||
|
||||
XBC59 .BS 1
|
||||
XBC5A .BS 1
|
||||
XBC5B .BS 165
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.fx/basic.s.d
|
||||
LOAD usr/src/basic.fx/basic.s
|
||||
ASM
|
155
BASIC.FX/BASIC.S.GP..txt
Normal file
155
BASIC.FX/BASIC.S.GP..txt
Normal file
@ -0,0 +1,155 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
GP.ENTRY jmp BS.ENTRY
|
||||
GP.DOSCMD jmp BS.DOSCMD
|
||||
GP.EXTRNCMD jmp GP.RTS
|
||||
GP.ERROUT jmp BS.ERROUT
|
||||
GP.PRINTERR jmp BS.PRINTERR
|
||||
GP.ERRCODE .BS 1
|
||||
*--------------------------------------
|
||||
GP.OUTVECT0 .DA MON.COUT1
|
||||
GP.OUTVECT1 .DA BS.NODEVERR
|
||||
GP.OUTVECT2 .DA BS.NODEVERR
|
||||
GP.OUTVECT3 .DA BS.NODEVERR
|
||||
GP.OUTVECT4 .DA BS.NODEVERR
|
||||
GP.OUTVECT5 .DA BS.NODEVERR
|
||||
GP.OUTVECT6 .DA BS.NODEVERR
|
||||
GP.OUTVECT7 .DA BS.NODEVERR
|
||||
GP.INVECT0 .DA MON.KEYIN
|
||||
GP.INVECT1 .DA BS.NODEVERR
|
||||
GP.INVECT2 .DA BS.NODEVERR
|
||||
GP.INVECT3 .DA BS.NODEVERR
|
||||
GP.INVECT4 .DA BS.NODEVERR
|
||||
GP.INVECT5 .DA BS.NODEVERR
|
||||
GP.INVECT6 .DA BS.NODEVERR
|
||||
GP.INVECT7 .DA BS.NODEVERR
|
||||
GP.VECTOUT .DA MON.COUT1
|
||||
GP.VECTIN .DA MON.KEYIN
|
||||
GP.VDOSO .DA BS.JMP.GP.VSYSO
|
||||
GP.VDOSI .DA BS.JMP.GP.VSYSI
|
||||
GP.VSYSO .BS 2
|
||||
GP.VSYSI .BS 2
|
||||
GP.VDEFSLT .DA #6
|
||||
GP.VDEFDRV .DA #1
|
||||
GP.PREGA .BS 1
|
||||
GP.PREGX .BS 1
|
||||
GP.PREGY .BS 1
|
||||
GP.DTRACE .BS 1
|
||||
GP.STATE .BS 1
|
||||
GP.EXECACTV .BS 1
|
||||
GP.IFILACTV .BS 1
|
||||
GP.OFILACTV .BS 1
|
||||
GP.PFXACTV .BS 1
|
||||
GP.DIRFLG .BS 1
|
||||
GP.EDIRFLG .BS 1
|
||||
GP.STRINGS .BS 1
|
||||
GP.TBUFPTR .BS 1
|
||||
GP.INPTR .BS 1
|
||||
GP.CHRLAST .BS 1
|
||||
GP.OPENCNT .BS 1
|
||||
GP.EXECFILE .BS 1
|
||||
GP.CATFLAG .BS 1
|
||||
GP.XTRNADDR .BS 2
|
||||
GP.XLEN .BS 1
|
||||
GP.XCNUM .BS 1
|
||||
GP.AllowedBITS .BS 2
|
||||
GP.FoundBITS .BS 2
|
||||
GP.ParamA .BS 2
|
||||
GP.ParamB .BS 3
|
||||
GP.ParamE .BS 2
|
||||
GP.ParamL .BS 2
|
||||
GP.ParamS .BS 1
|
||||
GP.ParamD .BS 1
|
||||
GP.ParamF .BS 2
|
||||
GP.ParamR .BS 2
|
||||
GP.ParamV .BS 1
|
||||
GP.ParamAT .BS 2
|
||||
GP.ParamT .BS 1
|
||||
GP.ParamINPR .BS 1
|
||||
GP.VPATH1 .DA BS.CMDBUF.LEN
|
||||
GP.VPATH2 .DA MLI.PATHBUF
|
||||
*--------------------------------------
|
||||
GP.GOSYSTEM sta GP.GOSYSTEM.C
|
||||
stx BS.CALLX
|
||||
and #$1F
|
||||
tax
|
||||
lda BS.ParamLByte,x
|
||||
sta GP.GOSYSTEM.P
|
||||
ldx BS.CALLX
|
||||
jsr MLI
|
||||
GP.GOSYSTEM.C .BS 1
|
||||
GP.GOSYSTEM.P .DA GP.GOSYSTEM.P
|
||||
bcs GP.BADCALL
|
||||
rts
|
||||
*--------------------------------------
|
||||
GP.BADCALL ldx #$12
|
||||
|
||||
LBE8D cmp BS.MLIERTBL,x
|
||||
beq LBE97
|
||||
|
||||
dex
|
||||
bpl LBE8D
|
||||
|
||||
ldx #$13
|
||||
|
||||
LBE97 lda BS.BIERRTBL,x
|
||||
ldx BS.CALLX
|
||||
sec
|
||||
|
||||
GP.RTS rts
|
||||
*--------------------------------------
|
||||
GP.CISPARE1 .BS 1
|
||||
GP.SCREATE .DA #7
|
||||
GP.SCREATEPATH .DA BS.CMDBUF.LEN
|
||||
GP.CRACCESS .DA #$C3
|
||||
GP.CRTYPE .BS 1
|
||||
GP.CRAUXTYPE .BS 2
|
||||
GP.CRSTTYPE .BS 1
|
||||
GP.DATETIME .BS 4
|
||||
GP.SDSTROY .DA #1
|
||||
GP.SDSTROYPATH .DA BS.CMDBUF.LEN
|
||||
GP.SRECNAME .DA #2
|
||||
GP.SRECNAMEOLD .DA BS.CMDBUF.LEN
|
||||
GP.SRECNAMENEW .DA MLI.PATHBUF
|
||||
GP.SSGINFO .BS 1
|
||||
GP.SSGINFOPATH .DA BS.CMDBUF.LEN
|
||||
GP.FIACCESS .BS 1
|
||||
GP.FITYPE .BS 1
|
||||
GP.FIAUXTYPE .BS 2
|
||||
GP.STTYPE .BS 1
|
||||
GP.FIBLOKS .BS 2
|
||||
GP.FIMDATE .BS 2
|
||||
GP.FICDATE .BS 2
|
||||
|
||||
.BS 4
|
||||
|
||||
GP.MLIMRKEOFBUF .DA #2
|
||||
GP.MLIMRKEOFBUF.REFNUM
|
||||
.BS 1
|
||||
GP.SBUFADR .BS 3
|
||||
GP.SOPEN .DA #3
|
||||
GP.TXTBUF .DA BS.CMDBUF.LEN
|
||||
GP.OSYSBUF .BS 2
|
||||
GP.OREFNUM .BS 1
|
||||
GP.SNEWLIN .DA #3
|
||||
GP.NEWLREF .BS 1
|
||||
GP.NLINEMASK .DA #$7F
|
||||
GP.NLINECHAR .DA #13
|
||||
GP.MLIRW .DA #4
|
||||
GP.MLIRW.REFNUM .BS 1
|
||||
GP.MLIRW.DATAPTR .BS 2
|
||||
GP.MLIRW.COUNT .BS 2
|
||||
GP.MLIRW.TRANS .BS 2
|
||||
GP.MLICF .DA #1
|
||||
GP.MLICF.REFNUM .BS 1
|
||||
GP.CCCSPARE .BS 1
|
||||
GP.COPYRIGHT .AS -"COPYRIGHT APPLE, 1983"
|
||||
GP.GETBUFR jmp BS.GETBUFR
|
||||
GP.FREEBUFR jmp BS.FREEBUFR
|
||||
GP.RSHIMEM .BS 5
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.fx/basic.s.gp
|
||||
LOAD usr/src/basic.fx/basic.s
|
||||
ASM
|
310
BASIC.FX/BASIC.S.LDR.txt
Normal file
310
BASIC.FX/BASIC.S.LDR.txt
Normal file
@ -0,0 +1,310 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
LDR.START jmp LDR.START1
|
||||
LDR.SIG .DA $EEEE
|
||||
.DA #MLI.MAXPATH+1
|
||||
LDR.STARTUP.LEN .DA #7
|
||||
LDR.STARTUP .AS "STARTUP"
|
||||
.BS MLI.MAXPATH-7
|
||||
LDR.START1 lda #$9A
|
||||
sta Ptr2+1
|
||||
lda #$24
|
||||
sta Ptr1+1
|
||||
lda #$00
|
||||
sta Ptr1
|
||||
sta Ptr2
|
||||
ldx #$23
|
||||
tay
|
||||
jsr LDR.MoveXpages
|
||||
ldx #$01
|
||||
lda #$BE
|
||||
sta Ptr2+1
|
||||
jsr LDR.MoveXpages
|
||||
lda #$15
|
||||
jsr MON.COUT
|
||||
jsr MON.SETNORM
|
||||
jsr MON.INIT
|
||||
jsr MON.MON
|
||||
ldx #$17
|
||||
lda #$00
|
||||
|
||||
L2076 sta MLI.MEMTABL,x
|
||||
dex
|
||||
bne L2076
|
||||
|
||||
lda #$CF
|
||||
sta MLI.MEMTABL
|
||||
lda #$3F
|
||||
sta MLI.MEMTABL+19
|
||||
lda #$FF
|
||||
sta MLI.MEMTABL+20
|
||||
sta MLI.MEMTABL+21
|
||||
sta MLI.MEMTABL+22
|
||||
lda #$C3
|
||||
sta MLI.MEMTABL+23
|
||||
lda AS.COLDBOOT
|
||||
cmp #$4C
|
||||
bne L20B1
|
||||
|
||||
lda MLI.MACHID
|
||||
and #$20
|
||||
beq L20B1
|
||||
|
||||
ldx #$03
|
||||
|
||||
L20A6 lda LDR.CSWVECT,x
|
||||
sta ZP.CSW,x
|
||||
dex
|
||||
bpl L20A6
|
||||
|
||||
jmp AS.COLDBOOT
|
||||
|
||||
L20B1 ldx #$27
|
||||
|
||||
L20B3 lda LDR.UNABLE,x
|
||||
sta $628,x
|
||||
dex
|
||||
bpl L20B3
|
||||
|
||||
sta MON.POWERUPBYTE
|
||||
sta MON.POWERUP+1
|
||||
|
||||
L20C2 bmi L20C2
|
||||
|
||||
LDR.MoveXpages dey
|
||||
lda (Ptr1),y
|
||||
sta (Ptr2),y
|
||||
tya
|
||||
bne LDR.MoveXpages
|
||||
|
||||
inc Ptr1+1
|
||||
inc Ptr2+1
|
||||
dex
|
||||
bne LDR.MoveXpages
|
||||
|
||||
L20D3 rts
|
||||
|
||||
LDR.CSW cmp #$DD
|
||||
bne L20D3
|
||||
|
||||
lda GP.OUTVECT0
|
||||
sta ZP.CSW
|
||||
lda GP.OUTVECT0+1
|
||||
sta ZP.CSW+1
|
||||
lda MLI.DEVNUM
|
||||
sta LDR.ONLINE.P.DEVNUM
|
||||
ldx #$01
|
||||
asl
|
||||
bcc L20EE
|
||||
|
||||
inx
|
||||
|
||||
L20EE stx GP.VDEFDRV
|
||||
asl
|
||||
rol
|
||||
rol
|
||||
rol
|
||||
and #$07
|
||||
sta GP.VDEFSLT
|
||||
ldx #$C1
|
||||
ldy #$02
|
||||
lda MLI.SLTBYT
|
||||
lsr
|
||||
|
||||
L2102 lsr
|
||||
pha
|
||||
bcc L2115
|
||||
|
||||
lda #$00
|
||||
sta GP.OUTVECT0,y
|
||||
sta GP.INVECT0,y
|
||||
txa
|
||||
sta GP.OUTVECT0+1,y
|
||||
sta GP.INVECT0+1,y
|
||||
|
||||
L2115 iny
|
||||
iny
|
||||
inx
|
||||
pla
|
||||
bne L2102
|
||||
|
||||
lda #$96
|
||||
sta AS.HIMEM+1
|
||||
sta AS.STRINGSTART+1
|
||||
sta GP.RSHIMEM
|
||||
lda MLI.PFIXPTR
|
||||
beq L214E
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.GETPREFIX
|
||||
.DA LDR.GETSETPFX2.P
|
||||
bne L218B
|
||||
|
||||
ldx MLI.PATHBUF
|
||||
lda #$2F
|
||||
|
||||
L2136 cmp MLI.PATHBUF,x
|
||||
bne L213E
|
||||
|
||||
inc LDR.PFXLEN
|
||||
|
||||
L213E dex
|
||||
bne L2136
|
||||
|
||||
lda LDR.PFXLEN
|
||||
cmp #$03
|
||||
bcs L216F
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX1.P
|
||||
|
||||
L214E jsr MLI
|
||||
.DA #MLI.C.ONLINE
|
||||
.DA LDR.ONLINE.P
|
||||
bne L218B
|
||||
|
||||
lda MLI.PATHBUF+1
|
||||
and #$0F
|
||||
beq L218B
|
||||
|
||||
tax
|
||||
inx
|
||||
stx MLI.PATHBUF
|
||||
lda #$2F
|
||||
sta MLI.PATHBUF+1
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX2.P
|
||||
bne L218B
|
||||
|
||||
L216F jsr MLI
|
||||
.DA #MLI.C.GETFILEINFO
|
||||
.DA LDR.GFINFO.P
|
||||
bne L218B
|
||||
|
||||
ldx LDR.STARTUP.LEN
|
||||
stx LDR.STARTUP.LEN1
|
||||
|
||||
L217D lda LDR.STARTUP.LEN,x
|
||||
sta IO.LINEBUF,x
|
||||
dex
|
||||
bne L217D
|
||||
|
||||
lda #$AD
|
||||
sta IO.LINEBUF
|
||||
|
||||
L218B lda LDR.PFXLEN
|
||||
cmp #$03
|
||||
bcs L2198
|
||||
|
||||
jsr MLI
|
||||
.DA #MLI.C.SETPREFIX
|
||||
.DA LDR.GETSETPFX1.P
|
||||
|
||||
L2198 lda LDR.STARTUP.LEN1
|
||||
bne L21C1
|
||||
|
||||
jsr LDR.KSW
|
||||
ldx #$1C
|
||||
|
||||
L21A2 lda LDR.PRODOSBASIC,x
|
||||
sta $400,x
|
||||
dex
|
||||
bpl L21A2
|
||||
|
||||
ldx #$1F
|
||||
|
||||
L21AD lda LDR.COPYRIGHT,x
|
||||
sta $480,x
|
||||
dex
|
||||
bpl L21AD
|
||||
|
||||
lda #$8D
|
||||
jsr MON.COUT1
|
||||
jsr MON.COUT1
|
||||
jsr MON.COUT1
|
||||
|
||||
L21C1 ldx #$02
|
||||
L21C3 lda LDR.JMP.GP.ENTRY,x
|
||||
sta DOS.WARMSTART,x
|
||||
sta DOS.COLDSTART,x
|
||||
sta MON.USRJMP,x
|
||||
lda LDR.AMPERSANDJMP,x
|
||||
sta MON.AMPERSANDJMP,x
|
||||
dex
|
||||
bpl L21C3
|
||||
|
||||
lda LDR.BRKVECT
|
||||
sta MON.BRKVECT
|
||||
lda LDR.BRKVECT+1
|
||||
sta MON.BRKVECT+1
|
||||
lda LDR.POWERUP
|
||||
sta MON.POWERUP
|
||||
lda LDR.POWERUP+1
|
||||
sta MON.POWERUP+1
|
||||
eor #$A5
|
||||
sta MON.POWERUPBYTE
|
||||
lda #$A5
|
||||
sta AS.TRCFLG
|
||||
lda BS.IVERSION
|
||||
sta MLI.IVERSION
|
||||
|
||||
LDR.JMP.GP.ENTRY
|
||||
jmp GP.ENTRY
|
||||
|
||||
LDR.BRKVECT .DA MON.BREAKV
|
||||
LDR.POWERUP .DA GP.ENTRY
|
||||
|
||||
LDR.AMPERSANDJMP
|
||||
jmp GP.DOSCMD
|
||||
|
||||
LDR.KSW lda GP.INVECT0
|
||||
sta ZP.KSW
|
||||
lda GP.INVECT0+1
|
||||
sta ZP.KSW+1
|
||||
ldx LDR.STARTUP.LEN
|
||||
inx
|
||||
lda #$8D
|
||||
rts
|
||||
|
||||
LDR.CSWVECT .DA LDR.CSW
|
||||
LDR.KSWVECT .DA LDR.KSW
|
||||
LDR.GFINFO.P .DA #10
|
||||
LDR.GFINFO.P.PATHBUF
|
||||
.DA LDR.STARTUP.LEN
|
||||
|
||||
.BS 16
|
||||
|
||||
LDR.GETSETPFX1.P
|
||||
.DA #1
|
||||
LDR.GETSETPFX1.P.BUF
|
||||
.DA LDR.GETSETPFX1.SLASHLEN
|
||||
LDR.GETSETPFX1.SLASHLEN
|
||||
.DA #1
|
||||
LDR.GETSETPFX1.SLASH
|
||||
.AS "/"
|
||||
LDR.STARTUP.LEN1
|
||||
.DA #0
|
||||
LDR.ONLINE.P
|
||||
.DA #2
|
||||
LDR.ONLINE.P.DEVNUM
|
||||
.DA #$70
|
||||
LDR.ONLINE.P.BUF
|
||||
.DA MLI.PATHBUF+1
|
||||
LDR.GETSETPFX2.P
|
||||
.DA #1
|
||||
LDR.GETSETPFX2.P.BUF
|
||||
.DA MLI.PATHBUF
|
||||
LDR.PFXLEN .DA #0
|
||||
|
||||
LDR.UNABLE .AS -"*** UNABLE TO EXECUTE BASIC SYSTEM ***"
|
||||
LDR.PRODOSBASIC .AS -" PRODOS BASIC 1.5 "
|
||||
LDR.COPYRIGHT .AS -" COPYRIGHT APPLE 1983-92"
|
||||
.BS $2400-*
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.fx/basic.s.ldr
|
||||
LOAD usr/src/basic.fx/basic.s
|
||||
ASM
|
163
BASIC.FX/BASIC.S.txt
Normal file
163
BASIC.FX/BASIC.S.txt
Normal file
@ -0,0 +1,163 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 6502
|
||||
.OR $2000
|
||||
.TF BASIC.FX,TSYS
|
||||
*--------------------------------------
|
||||
Ptr1 .EQ 0
|
||||
Ptr2 .EQ 2
|
||||
|
||||
ZP.WNDLFT .EQ $20
|
||||
ZP.WNDWDT .EQ $21
|
||||
ZP.WNDTOP .EQ $22
|
||||
ZP.WNDBOT .EQ $23
|
||||
ZP.CH .EQ $24
|
||||
ZP.CV .EQ $25
|
||||
ZP.BASL .EQ $28
|
||||
ZP.BASH .EQ $29
|
||||
|
||||
ZP.PROMPT .EQ $33
|
||||
|
||||
ZP.CSW .EQ $36
|
||||
ZP.KSW .EQ $38
|
||||
|
||||
ZP.PCL .EQ $3A
|
||||
ZP.PCH .EQ $3B
|
||||
ZP.A1L .EQ $3C
|
||||
ZP.A1H .EQ $3D
|
||||
ZP.A2L .EQ $3E
|
||||
ZP.A2H .EQ $3F
|
||||
|
||||
AS.LINNUM .EQ $50
|
||||
AS.PGRMSTART .EQ $67
|
||||
AS.VARSTART .EQ $69
|
||||
AS.ARRAYSTART .EQ $6B
|
||||
AS.ARRAYEND .EQ $6D
|
||||
AS.STRINGSTART .EQ $6F
|
||||
AS.STRINGPTR .EQ $71
|
||||
AS.HIMEM .EQ $73
|
||||
AS.CURLINE .EQ $75
|
||||
AS.LOWTR .EQ $9B
|
||||
AS.PGRMEND .EQ $AF
|
||||
AS.TXTPTR .EQ $B8
|
||||
AS.ERRFLG .EQ $D8
|
||||
AS.ERRNUM .EQ $DE
|
||||
AS.TRCFLG .EQ $F2
|
||||
AS.REMSTK .EQ $F8
|
||||
*--------------------------------------
|
||||
IO.LINEBUF .EQ $200
|
||||
*--------------------------------------
|
||||
DIRENTBUF .EQ $259
|
||||
DIRENTBUF.STNL .EQ $25D
|
||||
DIRENTBUF.TYPE .EQ $269
|
||||
|
||||
DIRENTBUF.UBLK .EQ $26C
|
||||
DIRENTBUF.EOF .EQ $26E
|
||||
|
||||
DIRENTBUF.ACCESS .EQ $277
|
||||
DIRENTBUF.AUXT .EQ $278
|
||||
|
||||
MLI.PATHBUF .EQ $280
|
||||
*--------------------------------------
|
||||
DOS.WARMSTART .EQ $03D0
|
||||
DOS.COLDSTART .EQ $03D3
|
||||
DOS.FILEMGR .EQ $03D6
|
||||
DOS.RWTS .EQ $03D9
|
||||
DOS.FILEMGRPARM .EQ $03DC
|
||||
DOS.RWTSPARM .EQ $03E3
|
||||
DOS.RECONNECT .EQ $03DA
|
||||
DOS.JMPBRKVECT .EQ $03EF
|
||||
|
||||
MON.AMPERSANDJMP .EQ $03F5
|
||||
MON.USRJMP .EQ $03F8
|
||||
MON.NMIJMP .EQ $03FB
|
||||
MON.IRQVECT .EQ $03FE
|
||||
MON.BRKVECT .EQ $03F0
|
||||
MON.POWERUP .EQ $03F2
|
||||
MON.POWERUPBYTE .EQ $03F4
|
||||
*--------------------------------------
|
||||
MLI.MAXPATH .EQ 64
|
||||
MLI.C.ALLOCIRQ .EQ $40
|
||||
MLI.C.DEALLOCIRQ .EQ $41
|
||||
MLI.C.ATALK .EQ $42
|
||||
MLI.C.QUIT .EQ $65
|
||||
MLI.C.READBLOCK .EQ $80
|
||||
MLI.C.WRITEBLOCK .EQ $81
|
||||
MLI.C.GETTIME .EQ $82
|
||||
MLI.C.CREATE .EQ $C0
|
||||
MLI.C.DESTROY .EQ $C1
|
||||
MLI.C.RENAME .EQ $C2
|
||||
MLI.C.SETFILEINFO .EQ $C3
|
||||
MLI.C.GETFILEINFO .EQ $C4
|
||||
MLI.C.ONLINE .EQ $C5
|
||||
MLI.C.SETPREFIX .EQ $C6
|
||||
MLI.C.GETPREFIX .EQ $C7
|
||||
MLI.C.OPEN .EQ $C8
|
||||
MLI.C.NEWLINE .EQ $C9
|
||||
MLI.C.READ .EQ $CA
|
||||
MLI.C.WRITE .EQ $CB
|
||||
MLI.C.CLOSE .EQ $CC
|
||||
MLI.C.FLUSH .EQ $CD
|
||||
MLI.C.SETMARK .EQ $CE
|
||||
MLI.C.GETMARK .EQ $CF
|
||||
MLI.C.SETEOF .EQ $D0
|
||||
MLI.C.GETEOF .EQ $D1
|
||||
MLI.C.SETBUF .EQ $D2
|
||||
MLI.C.GETBUF .EQ $D3
|
||||
*--------------------------------------
|
||||
MLI .EQ $BF00
|
||||
MLI.DEVNUM .EQ $BF30
|
||||
MLI.DEVCNT .EQ $BF31
|
||||
MLI.DEVLST .EQ $BF32
|
||||
MLI.MEMTABL .EQ $BF58
|
||||
MLI.LEVEL .EQ $BF94
|
||||
MLI.MACHID .EQ $BF98
|
||||
MLI.SLTBYT .EQ $BF99
|
||||
MLI.PFIXPTR .EQ $BF9A
|
||||
MLI.MLIACTV .EQ $BF9B
|
||||
MLI.IVERSION .EQ $BFFD
|
||||
*--------------------------------------
|
||||
IO.KBD .EQ $C000
|
||||
IO.KSTROBE .EQ $C010
|
||||
*--------------------------------------
|
||||
AS.RESTART .EQ $D43C
|
||||
AS.RESTART1 .EQ $D43F
|
||||
AS.FINDLINE .EQ $D61A
|
||||
AS.CLEAR1 .EQ $D665
|
||||
AS.NEXTSTMT .EQ $D7D2
|
||||
AS.EXECSTMT .EQ $D820
|
||||
AS.BITERRFLG .EQ $D865
|
||||
AS.NORMAL .EQ $F273
|
||||
AS.COLDBOOT .EQ $E000
|
||||
AS.INTPRINTAX .EQ $ED24
|
||||
*--------------------------------------
|
||||
MON.BREAKV .EQ $FA59
|
||||
MON.INIT .EQ $FB2F
|
||||
MON.MON .EQ $FC58
|
||||
MON.CLREOL .EQ $FC9C
|
||||
MON.RDKEY .EQ $FD0C
|
||||
MON.KEYIN0 .EQ $FD10
|
||||
MON.KEYIN .EQ $FD1B
|
||||
MON.GETLN .EQ $FD6A
|
||||
MON.COUT .EQ $FDED
|
||||
MON.COUT1 .EQ $FDF0
|
||||
MON.IIGSID .EQ $FE1F
|
||||
MON.SETINV .EQ $FE80
|
||||
MON.SETNORM .EQ $FE84
|
||||
MON.ENTERMON .EQ $FF69
|
||||
*--------------------------------------
|
||||
.INB usr/src/basic.fx/basic.s.ldr
|
||||
LDR.9A00.CODE .PH $9A00
|
||||
.INB usr/src/basic.fx/basic.s.a
|
||||
.INB usr/src/basic.fx/basic.s.b
|
||||
.INB usr/src/basic.fx/basic.s.c
|
||||
.INB usr/src/basic.fx/basic.s.d
|
||||
.EP
|
||||
LDR.BE00.CODE .PH $BE00
|
||||
.INB usr/src/basic.fx/basic.s.gp
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/basic.fx/basic.s
|
||||
ASM
|
@ -232,7 +232,9 @@ CC.F.CallRetV sec
|
||||
lda #0 Expected T/Q = 0 if VARIADIC
|
||||
tay
|
||||
|
||||
.4 jsr CC.EXP.Eval
|
||||
.4 and #$F0 CONST+VOLATILE+FUNC+FASTCALL
|
||||
|
||||
jsr CC.EXP.Eval
|
||||
bcs .93
|
||||
|
||||
jsr CC.SYM.GetYASizeOfInAXC
|
||||
|
361
BIN/CHAUX.S.txt
Normal file
361
BIN/CHAUX.S.txt
Normal file
@ -0,0 +1,361 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/chaux
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/mli.e.i
|
||||
*--------------------------------------
|
||||
X.ENTER.SUBDIR .EQ 0
|
||||
X.COPY.TO.DEST .EQ 0
|
||||
X.DELETE.SOURCE .EQ 0
|
||||
*--------------------------------------
|
||||
* Zero Page Segment, up to 32 bytes
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
|
||||
ZPPtr1 .BS 2
|
||||
ZPPtr2 .BS 2
|
||||
ZPFileName .BS 2
|
||||
ZPFileStat .BS 2
|
||||
|
||||
ZPFullPath .BS 2
|
||||
|
||||
ArgIndex .BS 1
|
||||
bAuxFileType .BS 1
|
||||
AuxFileType .BS 2
|
||||
|
||||
hSrcFullPath .BS 1
|
||||
bPause .BS 1
|
||||
|
||||
bContinue .BS 1
|
||||
bRecurse .BS 1
|
||||
|
||||
ZS.END .ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA #0 S.PS.F.EVENT
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data SegmentSize
|
||||
.DA #16 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Relocation Table
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
*--------------------------------------
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.FILE .DA MSG.FILE
|
||||
L.MSG.OK .DA MSG.OK
|
||||
L.MSG.ERR .DA MSG.ERR
|
||||
L.SSCANF.D .DA SSCANF.D
|
||||
L.SSCANF.H .DA SSCANF.H
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN inc ArgIndex
|
||||
lda ArgIndex
|
||||
>SYSCALL ArgV
|
||||
bcs .7
|
||||
|
||||
>STYA ZPPtr1
|
||||
lda (ZPPtr1)
|
||||
cmp #'-'
|
||||
bne .4
|
||||
|
||||
ldy #1
|
||||
lda (ZPPtr1),y
|
||||
|
||||
ldx #OptionVars-OptionList-1
|
||||
.2 cmp OptionList,x
|
||||
beq .3
|
||||
|
||||
dex
|
||||
bne .2
|
||||
|
||||
.99 >PUSHW L.MSG.USAGE
|
||||
>PUSHBI 0
|
||||
>SYSCALL PrintF
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.3 ldy OptionVars,x
|
||||
lda #$80
|
||||
sta $0,y
|
||||
bra CS.RUN
|
||||
*--------------------------------------
|
||||
.4 bit bAuxFileType
|
||||
bmi .5
|
||||
|
||||
jsr GetAuxType
|
||||
bcs .99
|
||||
bra CS.RUN
|
||||
|
||||
.5 >LDA.G hSrcBasePath
|
||||
bne .99
|
||||
|
||||
>LDYA ZPPtr1
|
||||
jsr InitSrcDirYA
|
||||
bcs .99
|
||||
bra CS.RUN
|
||||
*--------------------------------------
|
||||
.7 >LDA.G hSrcBasePath
|
||||
beq .99 no src ? ERROR
|
||||
|
||||
bit bAuxFileType
|
||||
bpl .99 we also have a TYPE
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .99
|
||||
|
||||
>STYA ZPFullPath
|
||||
stx hSrcFullPath
|
||||
*--------------------------------------
|
||||
CS.RUN.LOOP ldy #S.PS.hStdIn
|
||||
lda (pPS),y
|
||||
>SYSCALL FEOF
|
||||
bcs .99
|
||||
|
||||
tay
|
||||
bne .1
|
||||
|
||||
>SYSCALL GetChar
|
||||
bcs .99
|
||||
|
||||
cmp #$03 Ctrl-C
|
||||
beq .99 Abort....
|
||||
|
||||
cmp #$13 Ctrl-S
|
||||
bne .1
|
||||
|
||||
lda bPause
|
||||
eor #$ff
|
||||
sta bPause
|
||||
bne CS.RUN.LOOP
|
||||
|
||||
.1 bit bPause
|
||||
bmi CS.RUN.LOOP Pause...
|
||||
*--------------------------------------
|
||||
jsr GetEntry
|
||||
bcs CS.RUN.LEAVE
|
||||
|
||||
jsr FilterMatch
|
||||
bcs CS.RUN.NEXT no match, skip....
|
||||
|
||||
ldy #S.STAT.MODE+1
|
||||
lda (ZPFileStat),y
|
||||
and #$70
|
||||
bne .5 REG file ?
|
||||
|
||||
jsr CS.RUN.FILE
|
||||
bcc CS.RUN.NEXT
|
||||
rts
|
||||
|
||||
.5 cmp /S.STAT.MODE.DIR DIR ?
|
||||
bne .6
|
||||
|
||||
jsr CS.RUN.DIR
|
||||
bcc CS.RUN.NEXT
|
||||
rts
|
||||
|
||||
.6 lda #MLI.E.UNSUPST
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.NEXT jsr GetNextEntry
|
||||
bcc CS.RUN.LOOP
|
||||
|
||||
CS.RUN.LEAVE jsr LeaveSubDir
|
||||
bcs .90
|
||||
|
||||
jsr BasePath..
|
||||
|
||||
jmp CS.RUN.NEXT
|
||||
|
||||
.90 lda #0
|
||||
sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.DIR bit bRecurse
|
||||
bpl .8
|
||||
|
||||
lda (ZPFileName)
|
||||
cmp #'.'
|
||||
bne .1
|
||||
|
||||
ldy #1
|
||||
lda (ZPFileName),y
|
||||
beq .8
|
||||
|
||||
cmp #'.'
|
||||
bne .1
|
||||
|
||||
iny
|
||||
lda (ZPFileName),y
|
||||
beq .8
|
||||
|
||||
.1 jsr CS.RUN.GetFilePath
|
||||
|
||||
>LDYA ZPFileName
|
||||
jmp EnterSubDirYA
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.FILE jsr FilterMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
jsr CS.RUN.GetFilePath
|
||||
|
||||
>PUSHW L.MSG.FILE
|
||||
>PUSHW ZPFullPath
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
bcs .9
|
||||
|
||||
>PUSHW ZPFullPath
|
||||
|
||||
>PUSHW AuxFileType
|
||||
|
||||
>SYSCALL ChAux
|
||||
jsr CS.RUN.CheckErr
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.CheckErr bcs .1
|
||||
|
||||
>LDYA L.MSG.OK
|
||||
>SYSCALL PutS
|
||||
rts
|
||||
|
||||
.1 pha
|
||||
>PUSHW L.MSG.ERR
|
||||
pla
|
||||
pha
|
||||
>PUSHA
|
||||
>PUSHBI 1
|
||||
>SYSCALL PrintF
|
||||
|
||||
lda bContinue
|
||||
eor #$80
|
||||
asl
|
||||
pla
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.GetFilePath
|
||||
>PUSHW ZPFullPath
|
||||
>LDA.G hSrcBasePath
|
||||
>SYSCALL GetMemPtr
|
||||
>PUSHYA
|
||||
>SYSCALL StrCpy
|
||||
|
||||
>PUSHW ZPFullPath
|
||||
>PUSHW ZPFileName
|
||||
>SYSCALL StrCat
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT jsr LeaveSubDir
|
||||
bcc CS.QUIT
|
||||
|
||||
>LDA.G hFilter
|
||||
beq .1
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.1 lda hSrcFullPath
|
||||
beq .8
|
||||
|
||||
>SYSCALL FreeMem
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
GetAuxType lda (ZPPtr1)
|
||||
cmp #'0'
|
||||
bcc .1
|
||||
|
||||
cmp #'9'+1
|
||||
bcs .1
|
||||
|
||||
ldx #0
|
||||
bra .7
|
||||
|
||||
.1 cmp #'x'
|
||||
beq .2
|
||||
|
||||
cmp #'X'
|
||||
bne .9
|
||||
|
||||
inc ZPPtr1
|
||||
bne .2
|
||||
|
||||
inc ZPPtr1+1
|
||||
|
||||
.2 ldx #2
|
||||
|
||||
.7 >PUSHW ZPPtr1
|
||||
>PUSHW L.SSCANF.D,x
|
||||
>PUSHWI AuxFileType
|
||||
>PUSHBI 2
|
||||
>SYSCALL SScanF
|
||||
bcs .9
|
||||
|
||||
cpy #1
|
||||
bne .9
|
||||
|
||||
dec bAuxFileType
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
.INB usr/src/shared/x.fileenum.s
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
OptionList .AS "CRcr"
|
||||
OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse
|
||||
*--------------------------------------
|
||||
MSG.USAGE .AS "Usage : CHTYP auxtype [File *,? wildcards allowed]\r\n"
|
||||
.AS " auxtype : 12345 (Decimal word) ,xABCD (Hexadecimal word)\r\n"
|
||||
.AS " -C : Continue on error\r\n"
|
||||
.AZ " -R : Recurse subdirectories\r\n"
|
||||
MSG.OK .AZ "[OK]"
|
||||
MSG.ERR .AZ "[%h]\r\n"
|
||||
MSG.FILE .AZ "CHAUX File:%S..."
|
||||
SSCANF.D .AZ "%D"
|
||||
SSCANF.H .AZ "%H"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START .INB usr/src/shared/x.fileenum.g
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/bin/chaux.s
|
||||
ASM
|
183
BIN/IRC.S.txt
183
BIN/IRC.S.txt
@ -4,12 +4,17 @@ NEW
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF bin/irc
|
||||
*--------------------------------------
|
||||
TLS .EQ 0
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.i
|
||||
.INB inc/eth.i
|
||||
.INB inc/libtcpip.i
|
||||
.DO TLS=1
|
||||
.INB inc/net.tls.i
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 250 25 sec.
|
||||
MSGSIZE .EQ 4096
|
||||
@ -21,12 +26,11 @@ TEXTMAX .EQ 240
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPPtr1 .BS 2
|
||||
ZPPtr2 .BS 2
|
||||
bEscMode .BS 1
|
||||
bJoin .BS 1
|
||||
TimeOut .BS 1
|
||||
hSocket .BS 1
|
||||
TextPtr .BS 1
|
||||
TextLen .BS 1
|
||||
|
||||
ZPRespPtr .BS 2
|
||||
ZPMsg .BS 2
|
||||
@ -42,6 +46,9 @@ BufPtr .BS 1
|
||||
BufLen .BS 1
|
||||
ZPBufPtr .BS 2
|
||||
|
||||
TextPtr .BS 1
|
||||
TextLen .BS 1
|
||||
|
||||
bPendingMsg .BS 1
|
||||
|
||||
ZS.END .ED
|
||||
@ -111,6 +118,12 @@ J.ESC .DA CS.RUN.CHARIN.LEFT
|
||||
.DA CS.RUN.CHARIN.DOWN
|
||||
.DA CS.RUN.CHARIN.UP
|
||||
.DA CS.RUN.CHARIN.RIGHT
|
||||
.DO TLS=1
|
||||
L.MSG.TLS .DA MSG.TLS
|
||||
L.MSG.TLS.1 .DA MSG.TLS.1
|
||||
L.TLS.CHELLO .DA TLS.CHELLO
|
||||
L.TLS.CHELLO.UT .DA TLS.CHELLO.UT
|
||||
.FIN
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.LIBTCPIP
|
||||
@ -128,11 +141,16 @@ CS.RUN jsr CS.RUN.CheckTCPIP
|
||||
jsr CS.RUN.CheckArgs
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.GetBuffers
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.Connect
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.GetBuffers
|
||||
.DO TLS=1
|
||||
jsr CS.RUN.TLS
|
||||
bcs CS.INIT.RTS
|
||||
.FIN
|
||||
|
||||
jsr CS.RUN.SCRSETUP
|
||||
bcs CS.INIT.RTS
|
||||
@ -263,6 +281,41 @@ CS.RUN.CheckArgs
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.GetBuffers
|
||||
>LDYAI 2048
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPBufPtr
|
||||
txa
|
||||
>STA.G hBufBuf
|
||||
|
||||
>LDYAI MSGSIZE
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPMsg
|
||||
txa
|
||||
>STA.G hMsgBuf
|
||||
|
||||
>LDYAI 384
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPRespPtr
|
||||
txa
|
||||
>STA.G hRespBuf
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPOutputBufPtr
|
||||
txa
|
||||
>STA.G hOutputBuf
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.Connect >PUSHBI S.SOCKET.T.STREAM
|
||||
>PUSHBI 0 no protocol
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
||||
@ -300,41 +353,64 @@ CS.RUN.Connect >PUSHBI S.SOCKET.T.STREAM
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.GetBuffers
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
.DO TLS=1
|
||||
CS.RUN.TLS jsr CS.RUN.TLS.init
|
||||
|
||||
>PUSHB hSocket
|
||||
>PUSHW L.TLS.CHELLO
|
||||
>PUSHWI TLS.CHELLO.L
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Write
|
||||
bcs .9
|
||||
|
||||
>STYA ZPBufPtr
|
||||
txa
|
||||
>STA.G hBufBuf
|
||||
.1 >SLEEP
|
||||
|
||||
>LDYAI MSGSIZE
|
||||
>SYSCALL GetMem
|
||||
lda TimeOut
|
||||
bne .1
|
||||
|
||||
>PUSHB hSocket
|
||||
>PUSHW ZPBufPtr
|
||||
>PUSHWI 2048
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Read
|
||||
bcs .9
|
||||
|
||||
>STYA ZPMsg
|
||||
txa
|
||||
>STA.G hMsgBuf
|
||||
|
||||
>LDYAI 384
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPRespPtr
|
||||
txa
|
||||
>STA.G hRespBuf
|
||||
|
||||
>LDYAI 256
|
||||
>SYSCALL GetMem
|
||||
bcs .9
|
||||
|
||||
>STYA ZPOutputBufPtr
|
||||
txa
|
||||
>STA.G hOutputBuf
|
||||
|
||||
>STYA ZPPtr2 RCVD len
|
||||
>PUSHW L.MSG.TLS.1
|
||||
>PUSHW ZPPtr2
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.TLS.init >LDYA L.MSG.TLS
|
||||
>SYSCALL PutS
|
||||
|
||||
lda A2osX.RANDOM16
|
||||
sta ZPPtr1
|
||||
lda A2osX.RANDOM16+1
|
||||
and #$7F
|
||||
sta ZPPtr1+1
|
||||
|
||||
>LDYA L.TLS.CHELLO.UT
|
||||
>STYA ZPPtr2
|
||||
|
||||
ldy #31
|
||||
|
||||
.10 lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
dey
|
||||
bpl .10
|
||||
|
||||
lda #50
|
||||
sta TimeOut
|
||||
|
||||
rts
|
||||
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
CS.RUN.Register >LDYA L.MSG.REGISTER
|
||||
jsr CS.RUN.STATUSMSG
|
||||
|
||||
@ -363,7 +439,7 @@ CS.RUN.Register >LDYA L.MSG.REGISTER
|
||||
*--------------------------------------
|
||||
CS.RUN.GetMsg bit bPendingMsg
|
||||
bmi .10
|
||||
|
||||
|
||||
>LDYA ZPMsg
|
||||
>STYA ZPMsgPtr
|
||||
|
||||
@ -391,7 +467,7 @@ CS.RUN.GetMsg bit bPendingMsg
|
||||
sta (ZPMsgPtr)
|
||||
inc ZPMsgPtr
|
||||
bne .3
|
||||
|
||||
|
||||
inc ZPMsgPtr+1
|
||||
|
||||
.3 inc BufPtr
|
||||
@ -593,7 +669,7 @@ CS.RUN.CMD.PING >PUSHW ZPRespPtr
|
||||
*--------------------------------------
|
||||
CS.RUN.CMD.JOIN sec
|
||||
ror bJoin
|
||||
|
||||
|
||||
>LDYA L.MSG.NULL
|
||||
jsr CS.RUN.STATUSPDATE
|
||||
*--------------------------------------
|
||||
@ -732,8 +808,7 @@ CS.RUN.TXTCLR.RTS
|
||||
CS.RUN.TOPUPDATE
|
||||
>PUSHW ZPOutputBufPtr
|
||||
>PUSHW L.MSG.TOPBAR
|
||||
>PUSHB #K.VER
|
||||
>PUSHB /K.VER
|
||||
>PUSHW A2osX.KVER
|
||||
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
@ -978,10 +1053,10 @@ CS.DOEVENT lda (pEvent)
|
||||
*--------------------------------------
|
||||
CS.QUIT ldy #hOutputBuf
|
||||
jsr .7
|
||||
|
||||
|
||||
ldy #hRespBuf
|
||||
jsr .7
|
||||
|
||||
|
||||
ldy #hMsgBuf
|
||||
jsr .7
|
||||
|
||||
@ -1003,9 +1078,9 @@ CS.QUIT ldy #hOutputBuf
|
||||
|
||||
.7 lda (pData),y
|
||||
beq .8
|
||||
|
||||
|
||||
>SYSCALL FreeMem
|
||||
.8 rts
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
LIBTCPIP .AZ "libtcpip"
|
||||
@ -1017,6 +1092,10 @@ MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..."
|
||||
MSG.SKTKO .AZ "Failed to Open Socket."
|
||||
MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n"
|
||||
MSG.SKTERR .AZ "Socket Error : $%h\r\n"
|
||||
.DO TLS=1
|
||||
MSG.TLS .AZ "TLS:Negociation..."
|
||||
MSG.TLS.1 .AZ "TLS:Received %D bytes.\r\n"
|
||||
.FIN
|
||||
MSG.REGISTER .AZ "Registering User..."
|
||||
MSG.JOIN .AZ "Joining Channel..."
|
||||
MSG.TOPBAR .AZ "A2osX IRC %d.%d Server:%s:%s Nick:%s"
|
||||
@ -1071,6 +1150,30 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF
|
||||
.BS 1
|
||||
.BS 4 S.SOCKADDR.ADDR
|
||||
.DA 6667
|
||||
*--------------------------------------
|
||||
.DO TLS=1
|
||||
TLS.CHELLO .DA #TLS.CT.HS
|
||||
.DA TLS.LV.TLS10
|
||||
.DA /TLS.CHELLO.L1,#TLS.CHELLO.L1
|
||||
TLS.CHELLO.1 .DA #TLS.HS.MT.CH
|
||||
.DA #0,/TLS.CHELLO.L2,#TLS.CHELLO.L2
|
||||
TLS.CHELLO.2 .DA TLS.LV.TLS12
|
||||
TLS.CHELLO.UT .BS 4
|
||||
TLS.CHELLO.R .BS 28
|
||||
.DA #0 SID
|
||||
.DA #0,#2 CSL
|
||||
.DA #0,#TLS.HS.CH.CS.RSAAES128GCMSHA256
|
||||
.DA TLS.HS.CH.CM.NONE
|
||||
.DA /TLS.CHELLO.LE,#TLS.CHELLO.LE
|
||||
TLS.CHELLO.E .HS 000D T=sig alg
|
||||
.HS 0004 sig alg Len
|
||||
.HS 0002 sig hash alg len
|
||||
.HS 0401 RSA PKCS1 SHA256
|
||||
TLS.CHELLO.L .EQ *-TLS.CHELLO
|
||||
TLS.CHELLO.L1 .EQ *-TLS.CHELLO.1
|
||||
TLS.CHELLO.L2 .EQ *-TLS.CHELLO.2
|
||||
TLS.CHELLO.LE .EQ *-TLS.CHELLO.E
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
|
@ -55,7 +55,7 @@ Dev.Detect >STYA ARGS
|
||||
bne .2
|
||||
|
||||
lda L91C96.BSR+1,x
|
||||
cmp #DEVID
|
||||
cmp #L91C96.DEVID
|
||||
beq .3
|
||||
|
||||
.2 dec FD.DEV.NAME+3
|
||||
|
@ -1,16 +1,18 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF drv/uther2.ai.drv
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/kernel.i
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/nic.i
|
||||
.INB inc/nic.w5100.i
|
||||
.INB inc/eth.i
|
||||
.INB inc/net.tcpip.i
|
||||
.INB inc/libtcpip.i
|
||||
*--------------------------------------
|
||||
ZPArgPtr .EQ ZPBIN
|
||||
@ -79,7 +81,7 @@ Dev.Detect >STYA ARGS
|
||||
cmp /2000
|
||||
bne .2
|
||||
|
||||
lda W5100.DR,x Get RTR LO
|
||||
lda W5100.DR,x Get RTR LO
|
||||
cmp #2000
|
||||
beq .3
|
||||
|
||||
@ -146,7 +148,7 @@ Dev.ParseArgs >LDYA ARGS
|
||||
|
||||
.1 >PUSHW ZPArgPtr
|
||||
>PUSHW L.SSCANF.MAC
|
||||
|
||||
|
||||
ldx #0
|
||||
|
||||
.2 >PUSHW L.MAC0,x
|
||||
@ -154,9 +156,9 @@ Dev.ParseArgs >LDYA ARGS
|
||||
inx
|
||||
cpx #12
|
||||
bne .2
|
||||
|
||||
|
||||
>PUSHBI 12 6 x byte PTRs
|
||||
|
||||
|
||||
>SYSCALL SScanF
|
||||
bcc .8
|
||||
|
||||
@ -248,7 +250,7 @@ STATUS.9 lda #MLI.E.BADCTL
|
||||
rts
|
||||
*--------------------------------------
|
||||
CONTROL jsr GET.IOCTLBUFPTR
|
||||
|
||||
|
||||
ldy #S.IOCTL.C
|
||||
lda (ZPIOCTL),y
|
||||
cmp #S.IOCTL.C.SETDCB
|
||||
@ -260,7 +262,7 @@ CONTROL jsr GET.IOCTLBUFPTR
|
||||
sta DCB,y
|
||||
dey
|
||||
bpl .2
|
||||
|
||||
|
||||
bra OPEN.I
|
||||
*--------------------------------------
|
||||
OPEN lda #S.DIB.S.OPENED
|
||||
@ -278,6 +280,15 @@ OPEN.I jsr CLOSE
|
||||
lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
|
||||
sta W5100.MR,x
|
||||
|
||||
>AR.SELECT SHAR
|
||||
ldy #0
|
||||
|
||||
.1 lda DCB+S.DCB.NIC.MAC,y
|
||||
sta W5100.DR,x
|
||||
iny
|
||||
cpy #6
|
||||
bne .1
|
||||
|
||||
>AR.SELECT GAR
|
||||
|
||||
ldy #0
|
||||
@ -298,16 +309,7 @@ OPEN.I jsr CLOSE
|
||||
cpy #4
|
||||
bne .3
|
||||
|
||||
* >AR.SELECT SHAR
|
||||
ldy #0
|
||||
|
||||
.1 lda DCB+S.DCB.NIC.MAC,y
|
||||
sta W5100.DR,x
|
||||
iny
|
||||
cpy #6
|
||||
bne .1
|
||||
|
||||
* >AR.SELECT SIPR
|
||||
>AR.SELECT SIPR
|
||||
|
||||
ldy #0
|
||||
|
||||
@ -316,7 +318,7 @@ OPEN.I jsr CLOSE
|
||||
iny
|
||||
cpy #4
|
||||
bne .4
|
||||
|
||||
|
||||
>AR.SELECT RMSR
|
||||
lda #%01010101 RAW=2k,ICMP=2k,UDP=2k,TCP=2k
|
||||
sta W5100.DR,x ...for Socket RX Buffers
|
||||
@ -329,26 +331,26 @@ OPEN.I jsr CLOSE
|
||||
>AR.SELECT S0.CR
|
||||
lda #W5100.AR.Sn.CR.OPEN
|
||||
sta W5100.DR,x
|
||||
|
||||
*--------------------------------------
|
||||
lda /W5100.AR.S1.MR
|
||||
sta Sn.IO
|
||||
|
||||
|
||||
ldy #S.IP.PROTOCOL.ICMP
|
||||
jsr OPEN.SnY
|
||||
|
||||
|
||||
inc Sn.IO
|
||||
|
||||
|
||||
ldy #S.IP.PROTOCOL.UDP
|
||||
jsr OPEN.SnY
|
||||
|
||||
|
||||
inc Sn.IO
|
||||
|
||||
|
||||
ldy #S.IP.PROTOCOL.TCP
|
||||
jsr OPEN.SnY
|
||||
|
||||
|
||||
lda #S.DIB.S.OPENED
|
||||
tsb DIB+S.DIB.S
|
||||
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -361,11 +363,11 @@ OPEN.SnY >AR.Sn.SELECT S0.MR
|
||||
sta W5100.DR,x
|
||||
|
||||
* >AR.Sn.SELECT Sn.TOS
|
||||
stz W5100.DR,x
|
||||
* stz W5100.DR,x
|
||||
|
||||
* >AR.Sn.SELECT Sn.TTL
|
||||
lda #K.IP.TTL
|
||||
sta W5100.DR,x
|
||||
* lda #K.IP.TTL
|
||||
* sta W5100.DR,x
|
||||
|
||||
>AR.Sn.SELECT S0.CR
|
||||
lda #W5100.AR.Sn.CR.OPEN
|
||||
@ -386,10 +388,10 @@ CLOSE ldx DEVSLOTx0
|
||||
|
||||
.2 eor $C019
|
||||
bpl .2
|
||||
|
||||
|
||||
lda #S.DIB.S.OPENED
|
||||
trb DIB+S.DIB.S
|
||||
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -400,179 +402,33 @@ READ php
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
lda /W5100.AR.S1.MR
|
||||
ldy #Sn.Cnt-1
|
||||
|
||||
.1 lda Sn.IO.BASE,y
|
||||
sta Sn.IO
|
||||
sta W5100.AR,x
|
||||
lda #W5100.AR.S0.RX.RSR
|
||||
sta W5100.AR+1,x
|
||||
|
||||
|
||||
lda W5100.DR,x get the received size HI
|
||||
ora W5100.DR,x LO
|
||||
bne READ.ICMP
|
||||
|
||||
beq .2
|
||||
|
||||
jmp READ.IPRAW
|
||||
|
||||
.2 dey
|
||||
bne .1
|
||||
|
||||
lda /W5100.AR.S0.RX.RSR
|
||||
sta Sn.IO
|
||||
sta W5100.AR,x
|
||||
lda #W5100.AR.S0.RX.RSR
|
||||
sta W5100.AR+1,x
|
||||
|
||||
|
||||
lda W5100.DR,x get the received size HI
|
||||
ora W5100.DR,x LO
|
||||
beq .9
|
||||
|
||||
jmp READ.RAW
|
||||
|
||||
bne READ.RAW
|
||||
|
||||
.9 jmp READWRITE.NODATA
|
||||
|
||||
READ.ICMP lda #S.IP.PROTOCOL.ICMP
|
||||
sta FRM.HDR.PROTO
|
||||
lda Sn.RX.BASE+1
|
||||
sta Sn.BASE
|
||||
lda Sn.RXTX.MASK+1
|
||||
sta Sn.MASK
|
||||
|
||||
>AR.Sn.SELECT S0.RX.RD
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
sta Offset+1
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
sty Offset
|
||||
|
||||
and Sn.MASK
|
||||
ora Sn.BASE
|
||||
sta W5100.AR,x
|
||||
tya
|
||||
sta W5100.AR+1,x
|
||||
|
||||
ldy #0
|
||||
|
||||
.10 lda W5100.DR,x IPRAW:Get Source IP
|
||||
sta RX.IP,y
|
||||
iny
|
||||
cpy #4
|
||||
bne .10
|
||||
|
||||
lda W5100.DR,x get RX.Size HI (not including 6 bytes Header)
|
||||
sta RXTX.Size+1
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
sta RXTX.Size
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
eor #$ff
|
||||
|
||||
clc
|
||||
adc #S.IP
|
||||
sta BUF.Size
|
||||
ldy #S.IOCTL.BYTECNT
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
iny
|
||||
|
||||
lda RXTX.Size+1
|
||||
adc /S.IP
|
||||
sta BUF.Size+1
|
||||
|
||||
lda RXTX.Size
|
||||
clc
|
||||
adc #6 IPRAW: Add 6 bytes to Total Size
|
||||
sta RXTX.Size
|
||||
bcc .11
|
||||
inc RXTX.Size+1
|
||||
|
||||
.11 lda RXTX.Size
|
||||
clc
|
||||
adc #S.IP-S.ETH.EII
|
||||
sta FRM.HDR.IPLEN+1
|
||||
|
||||
lda RXTX.Size+1
|
||||
adc /S.IP-S.ETH.EII
|
||||
sta FRM.HDR.IPLEN
|
||||
|
||||
>LDYA BUF.Size
|
||||
>SYSCALL2 GetMem
|
||||
bcc .14
|
||||
|
||||
jmp READWRITE.9
|
||||
|
||||
.14 >STYA ZPBufPtr
|
||||
phx
|
||||
|
||||
phy
|
||||
ldy #S.IOCTL.BUFPTR+1
|
||||
sta (ZPIOCTL),y
|
||||
dey
|
||||
pla
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
ldy #S.ETH.EII.TYPE
|
||||
|
||||
.15 lda FRM.HDR-S.ETH.EII.TYPE,y
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
cpy #S.ETH.EII.TYPE+FRM.HDR.LEN
|
||||
bne .15
|
||||
|
||||
ldx #3
|
||||
ldy #S.IP.SRC+3
|
||||
|
||||
.12 lda RX.IP,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .12
|
||||
|
||||
ldx #3
|
||||
ldy #S.IP.DST+3
|
||||
|
||||
.13 lda DCB+S.DCB.NIC.IP,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .13
|
||||
|
||||
ldy #S.IP
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .4
|
||||
|
||||
.3 lda W5100.DR,x
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
bne .2
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bra .2
|
||||
|
||||
.4 >AR.Sn.SELECT S0.RX.RD
|
||||
|
||||
lda Offset
|
||||
clc
|
||||
adc RXTX.Size
|
||||
pha save LO
|
||||
|
||||
lda Offset+1
|
||||
adc RXTX.Size+1
|
||||
sta W5100.DR,x write HI
|
||||
pla
|
||||
sta W5100.DR,x write LO
|
||||
|
||||
>AR.Sn.SELECT S0.CR
|
||||
lda #W5100.AR.Sn.CR.RCVD
|
||||
sta W5100.DR,x
|
||||
|
||||
pla hMem
|
||||
|
||||
plp
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
READ.RAW >AR.SELECT S0.RX.RD
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
@ -593,15 +449,15 @@ READ.RAW >AR.SELECT S0.RX.RD
|
||||
|
||||
ldy #S.IOCTL.BYTECNT
|
||||
sec
|
||||
sbc #2 MACRAW:strip 2 bytes Header from Size
|
||||
sbc #2 MACRAW:strip 2 bytes Header from Size
|
||||
sta (ZPIOCTL),y
|
||||
sta BUF.Size
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
iny
|
||||
lda RXTX.Size+1
|
||||
sbc #0
|
||||
iny
|
||||
sta (ZPIOCTL),y
|
||||
sta BUF.Size+1
|
||||
eor #$ff
|
||||
@ -626,7 +482,7 @@ READ.RAW >AR.SELECT S0.RX.RD
|
||||
ldy #0
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
@ -662,7 +518,158 @@ READ.RAW >AR.SELECT S0.RX.RD
|
||||
|
||||
plp
|
||||
clc
|
||||
rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
READ.IPRAW lda Sn.IP.PROTOCOL,y
|
||||
sta FRM.HDR.PROTO
|
||||
|
||||
lda Sn.RX.BASE+1,y
|
||||
sta Sn.BASE
|
||||
lda Sn.RXTX.MASK+1,y
|
||||
sta Sn.MASK
|
||||
>DEBUG
|
||||
>AR.Sn.SELECT S0.RX.RD
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
sta Offset+1
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
sty Offset
|
||||
|
||||
and Sn.MASK
|
||||
ora Sn.BASE
|
||||
sta W5100.AR,x
|
||||
tya
|
||||
sta W5100.AR+1,x
|
||||
|
||||
ldy #0
|
||||
|
||||
.10 lda W5100.DR,x IPRAW:Get Source IP
|
||||
sta RX.IP,y
|
||||
iny
|
||||
cpy #4
|
||||
bne .10
|
||||
|
||||
lda W5100.DR,x get RX.Size HI (not including 6 bytes Header)
|
||||
sta RXTX.Size+1
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
sta RXTX.Size
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
eor #$ff
|
||||
|
||||
clc
|
||||
adc #S.IP
|
||||
sta BUF.Size
|
||||
ldy #S.IOCTL.BYTECNT
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
lda RXTX.Size+1
|
||||
adc /S.IP
|
||||
sta BUF.Size+1
|
||||
iny
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
lda RXTX.Size
|
||||
clc
|
||||
adc #6 IPRAW: Add 6 bytes to Total Size
|
||||
sta RXTX.Size
|
||||
bcc .11
|
||||
inc RXTX.Size+1
|
||||
|
||||
.11 lda RXTX.Size
|
||||
clc
|
||||
adc #S.IP-S.ETH.EII
|
||||
sta FRM.HDR.IPLEN+1
|
||||
|
||||
lda RXTX.Size+1
|
||||
adc /S.IP-S.ETH.EII
|
||||
sta FRM.HDR.IPLEN
|
||||
|
||||
>LDYA BUF.Size
|
||||
>SYSCALL2 GetMem
|
||||
bcc .14
|
||||
|
||||
jmp READWRITE.9
|
||||
|
||||
.14 >STYA ZPBufPtr
|
||||
phx
|
||||
|
||||
phy
|
||||
ldy #S.IOCTL.BUFPTR+1
|
||||
sta (ZPIOCTL),y
|
||||
dey
|
||||
pla
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
ldy #S.ETH.EII.TYPE
|
||||
|
||||
.15 lda FRM.HDR-S.ETH.EII.TYPE,y
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
cpy #S.ETH.EII.TYPE+FRM.HDR.LEN
|
||||
bne .15
|
||||
|
||||
ldx #3
|
||||
ldy #S.IP.SRC+3
|
||||
|
||||
.12 lda RX.IP,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .12
|
||||
|
||||
ldx #3
|
||||
ldy #S.IP.DST+3
|
||||
|
||||
.13 lda DCB+S.DCB.NIC.IP,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .13
|
||||
|
||||
ldy #S.IP
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .4
|
||||
|
||||
.3 lda W5100.DR,x
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
bne .2
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bra .2
|
||||
|
||||
.4 >AR.Sn.SELECT S0.RX.RD
|
||||
|
||||
lda Offset
|
||||
clc
|
||||
adc RXTX.Size
|
||||
pha save LO
|
||||
|
||||
lda Offset+1
|
||||
adc RXTX.Size+1
|
||||
sta W5100.DR,x write HI
|
||||
pla
|
||||
sta W5100.DR,x write LO
|
||||
|
||||
>AR.Sn.SELECT S0.CR
|
||||
lda #W5100.AR.Sn.CR.RCVD
|
||||
sta W5100.DR,x
|
||||
|
||||
pla hMem
|
||||
|
||||
plp
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
READWRITE.NODATA
|
||||
lda #E.NODATA
|
||||
@ -697,24 +704,25 @@ WRITE php
|
||||
|
||||
ldy #S.IP.PROTOCOL
|
||||
lda (ZPBufPtr),y
|
||||
|
||||
ldx #Sn.cnt-1
|
||||
|
||||
.10 cmp Sn.IP.PROTOCOL,x
|
||||
|
||||
ldy #Sn.cnt-1
|
||||
|
||||
.10 cmp Sn.IP.PROTOCOL,y
|
||||
beq .11
|
||||
dex
|
||||
|
||||
dey
|
||||
bne .10
|
||||
|
||||
|
||||
plp
|
||||
lda #MLI.E.IO
|
||||
sec
|
||||
rts
|
||||
|
||||
.11 lda Sn.IO.BASE,x
|
||||
.11 lda Sn.IO.BASE,y
|
||||
sta Sn.IO
|
||||
lda Sn.TX.BASE,x
|
||||
lda Sn.TX.BASE,y
|
||||
sta Sn.BASE
|
||||
lda Sn.RXTX.MASK,x
|
||||
lda Sn.RXTX.MASK,y
|
||||
sta Sn.MASK
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
@ -58,17 +58,20 @@ Dev.Detect >STYA ZPArgPtr
|
||||
|
||||
.1 lda A2osX.S,y IO based detection, avoid scanning in Disk Controller IO!!!!
|
||||
bne .2
|
||||
|
||||
lda /PP.ID
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.ID
|
||||
sta PacketPagePTR,x
|
||||
|
||||
lda PacketPageDATA+1,x
|
||||
cmp /DEVID
|
||||
cmp /CS8900A.DEVID
|
||||
bne .2
|
||||
|
||||
lda PacketPageDATA,x
|
||||
cmp #DEVID
|
||||
cmp #CS8900A.DEVID
|
||||
beq .3
|
||||
|
||||
.2 dec FD.DEV.NAME+3
|
||||
txa
|
||||
sec
|
||||
@ -76,6 +79,7 @@ Dev.Detect >STYA ZPArgPtr
|
||||
tax
|
||||
dey
|
||||
bne .1
|
||||
|
||||
>LDYA L.MSG.DETECT.KO
|
||||
>SYSCALL PutS
|
||||
|
||||
@ -261,6 +265,7 @@ STATUS.9 lda #MLI.E.BADCTL
|
||||
OPEN lda #S.DIB.S.OPENED
|
||||
bit DIB+S.DIB.S
|
||||
bne .9
|
||||
|
||||
jsr CLOSE
|
||||
|
||||
* ldx DEVSLOTx0 Done by CLOSE
|
||||
@ -279,16 +284,31 @@ OPEN lda #S.DIB.S.OPENED
|
||||
lda #PP.MAC
|
||||
sta PacketPagePTR,x
|
||||
|
||||
>LDYA DCB+S.DCB.NIC.MAC
|
||||
>STYA PacketPageDATA,x
|
||||
>LDYAI PP.MAC+2
|
||||
>STYA PacketPagePTR,x
|
||||
>LDYA DCB+S.DCB.NIC.MAC+2
|
||||
>STYA PacketPageDATA,x
|
||||
>LDYAI PP.MAC+4
|
||||
>STYA PacketPagePTR,x
|
||||
>LDYA DCB+S.DCB.NIC.MAC+4
|
||||
>STYA PacketPageDATA,x
|
||||
lda DCB+S.DCB.NIC.MAC+1
|
||||
sta PacketPageDATA+1,x
|
||||
lda DCB+S.DCB.NIC.MAC+0
|
||||
sta PacketPageDATA,x
|
||||
|
||||
lda /PP.MAC+2
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.MAC+2
|
||||
sta PacketPagePTR,x
|
||||
|
||||
lda DCB+S.DCB.NIC.MAC+3
|
||||
sta PacketPageDATA+1,x
|
||||
lda DCB+S.DCB.NIC.MAC+2
|
||||
sta PacketPageDATA,x
|
||||
|
||||
lda /PP.MAC+4
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.MAC+4
|
||||
sta PacketPagePTR,x
|
||||
|
||||
lda DCB+S.DCB.NIC.MAC+5
|
||||
sta PacketPageDATA+1,x
|
||||
lda DCB+S.DCB.NIC.MAC+4
|
||||
sta PacketPageDATA,x
|
||||
|
||||
lda /PP.LineCTL
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.LineCTL
|
||||
@ -302,6 +322,7 @@ OPEN lda #S.DIB.S.OPENED
|
||||
tsb DIB+S.DIB.S
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #MLI.E.OPEN
|
||||
sec
|
||||
rts
|
||||
@ -320,13 +341,17 @@ CLOSE ldx DEVSLOTx0
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.SelfST
|
||||
sta PacketPagePTR,x
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda PacketPageDATA+1,x
|
||||
lda PacketPageDATA,x
|
||||
and #PP.SelfST.InitDone
|
||||
bne .8
|
||||
|
||||
iny
|
||||
bne .1
|
||||
|
||||
.8 lda #S.DIB.S.OPENED
|
||||
trb DIB+S.DIB.S
|
||||
clc
|
||||
@ -374,6 +399,7 @@ READ php
|
||||
pla
|
||||
>SYSCALL2 GetMem
|
||||
bcs READWRITE.99
|
||||
|
||||
>STYA ZPBufPtr
|
||||
phx
|
||||
phy
|
||||
@ -388,8 +414,10 @@ READ php
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.3 lda RTDATA,x
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
@ -397,8 +425,10 @@ READ php
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
bne .2
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bra .2
|
||||
|
||||
.8 pla hMem
|
||||
|
||||
plp
|
||||
@ -449,14 +479,17 @@ WRITE php
|
||||
ldy PacketPageDATA,x
|
||||
bit /PP.BusST.Rdy4TxNOW
|
||||
beq READWRITE.9
|
||||
|
||||
ldy #S.IOCTL.BUFPTR
|
||||
lda (ZPIOCTL),y
|
||||
sta ZPBufPtr
|
||||
iny
|
||||
lda (ZPIOCTL),y
|
||||
sta ZPBufPtr+1
|
||||
|
||||
ldx #5
|
||||
ldy #S.ETH.SRCMAC+5
|
||||
|
||||
.10 lda DCB+S.DCB.NIC.MAC,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
@ -469,19 +502,25 @@ WRITE php
|
||||
|
||||
.1 inc Counter
|
||||
bne .2
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.2 lda (ZPBufPtr),y
|
||||
sta RTDATA,x
|
||||
iny
|
||||
bne .3
|
||||
|
||||
inc ZPBufPtr+1
|
||||
|
||||
.3 lda (ZPBufPtr),y
|
||||
sta RTDATA+1,x
|
||||
iny
|
||||
bne .1
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bne .1
|
||||
|
||||
.8 plp
|
||||
clc
|
||||
rts
|
||||
|
@ -7,6 +7,7 @@ NEW
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/kernel.i
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/nic.i
|
||||
.INB inc/nic.w5100.i
|
||||
|
@ -171,7 +171,7 @@ SEEK.END .EQ $02
|
||||
* A2osX.SYSCALL Functions Indexes
|
||||
*--------------------------------------D1
|
||||
* STAT
|
||||
SYS.ChTyp .EQ $00
|
||||
* .EQ $00
|
||||
SYS.ChMod .EQ $02
|
||||
SYS.FStat .EQ $04
|
||||
SYS.Stat .EQ $06
|
||||
@ -222,15 +222,15 @@ SYS.SScanF .EQ $4E
|
||||
* .EQ $54
|
||||
* .EQ $56
|
||||
|
||||
* .EQ $58
|
||||
* .EQ $5A
|
||||
* .EQ $5C
|
||||
SYS.Online .EQ $58
|
||||
SYS.ChTyp .EQ $5A
|
||||
SYS.ChAux .EQ $5C
|
||||
SYS.SetAttr .EQ $5E
|
||||
*--------------------------------------D2
|
||||
* MOUNT
|
||||
SYS.Mount .EQ $60
|
||||
SYS.UMount .EQ $62
|
||||
SYS.Online .EQ $64
|
||||
* .EQ $64
|
||||
SYS.GetStkObj .EQ $66
|
||||
* ARG
|
||||
SYS.Shift .EQ $68
|
||||
|
@ -69,7 +69,6 @@ ERR.DNS.ERROR .EQ $B8
|
||||
|
||||
ERR.ARP.PENDING .EQ $B5
|
||||
*--------------------------------------
|
||||
UDP.PORT.DNS .EQ 53
|
||||
UDP.PORT.PMAP .EQ 111
|
||||
UDP.PORT.NTP .EQ 123
|
||||
*--------------------------------------
|
||||
@ -198,103 +197,6 @@ S.SOCKET.TCP.OUTUSED .EQ S.SOCKET+32
|
||||
*
|
||||
S.SOCKET.TCP .EQ S.SOCKET+34
|
||||
*--------------------------------------
|
||||
S.ARP.HTYPE .EQ S.ETH.EII+0 $0001
|
||||
S.ARP.PTYPE .EQ S.ETH.EII+2 $0800
|
||||
S.ARP.HLEN .EQ S.ETH.EII+4 $06
|
||||
S.ARP.PLEN .EQ S.ETH.EII+5 $04
|
||||
S.ARP.OPERATION .EQ S.ETH.EII+6 REQ=$0001,REPLY=$0002
|
||||
S.ARP.OPERATION.REQ .EQ 1
|
||||
S.ARP.OPERATION.REP .EQ 2
|
||||
S.ARP.SHA .EQ S.ETH.EII+8 Sender MAC
|
||||
S.ARP.SPA .EQ S.ETH.EII+14 Sender IP
|
||||
S.ARP.THA .EQ S.ETH.EII+18 Target MAC
|
||||
S.ARP.TPA .EQ S.ETH.EII+24 Target IP
|
||||
*
|
||||
S.ARP .EQ S.ETH.EII+28
|
||||
*--------------------------------------
|
||||
S.IP.V.IHL .EQ S.ETH.EII+0 $45, IPV4,HDR=5DWORDs
|
||||
S.IP.DSCP.ECN .EQ S.ETH.EII+1
|
||||
S.IP.TOTAL.LENGTH .EQ S.ETH.EII+2
|
||||
S.IP.IDENTIFICATION .EQ S.ETH.EII+4
|
||||
S.IP.FRAGMENT.FLAGS .EQ S.ETH.EII+6
|
||||
S.IP.TTL .EQ S.ETH.EII+8
|
||||
S.IP.PROTOCOL .EQ S.ETH.EII+9
|
||||
S.IP.PROTOCOL.ICMP .EQ 1
|
||||
S.IP.PROTOCOL.TCP .EQ 6
|
||||
S.IP.PROTOCOL.UDP .EQ 17
|
||||
S.IP.HDR.CHECKSUM .EQ S.ETH.EII+10
|
||||
S.IP.SRC .EQ S.ETH.EII+12
|
||||
S.IP.DST .EQ S.ETH.EII+16
|
||||
*
|
||||
S.IP .EQ S.ETH.EII+20
|
||||
*--------------------------------------
|
||||
S.ICMP.TYPE .EQ S.IP+0
|
||||
S.ICMP.TYPE.ECHOREP .EQ 0
|
||||
S.ICMP.TYPE.UNREACH .EQ 3
|
||||
S.ICMP.TYPE.ECHOREQ .EQ 8
|
||||
S.ICMP.CODE .EQ S.IP+1
|
||||
S.ICMP.CHECKSUM .EQ S.IP+2
|
||||
S.ICMP.IDENTIFIER .EQ S.IP+4
|
||||
S.ICMP.SEQUENCE .EQ S.IP+6
|
||||
*
|
||||
S.ICMP .EQ S.IP+8
|
||||
*--------------------------------------
|
||||
S.TCPUDP.SRCPORT .EQ S.IP+0
|
||||
S.TCPUDP.DSTPORT .EQ S.IP+2
|
||||
*--------------------------------------
|
||||
S.UDP.LENGTH .EQ S.IP+4
|
||||
S.UDP.CHECKSUM .EQ S.IP+6 $0000 = DISABLE
|
||||
*
|
||||
S.UDP .EQ S.IP+8
|
||||
*--------------------------------------
|
||||
S.TCP.SEQNUM .EQ S.IP+4
|
||||
S.TCP.ACKNUM .EQ S.IP+8
|
||||
S.TCP.DATAOFFSET .EQ S.IP+12
|
||||
S.TCP.OPTIONS .EQ S.IP+13
|
||||
S.TCP.OPTIONS.URG .EQ %00100000
|
||||
S.TCP.OPTIONS.ACK .EQ %00010000
|
||||
S.TCP.OPTIONS.PSH .EQ %00001000
|
||||
S.TCP.OPTIONS.RST .EQ %00000100
|
||||
S.TCP.OPTIONS.SYN .EQ %00000010
|
||||
S.TCP.OPTIONS.FIN .EQ %00000001
|
||||
S.TCP.WINDOW .EQ S.IP+14
|
||||
S.TCP.CHECKSUM .EQ S.IP+16
|
||||
S.TCP.URGPTR .EQ S.IP+18
|
||||
*
|
||||
S.TCP .EQ S.IP+20
|
||||
*--------------------------------------
|
||||
S.DNS.ID .EQ S.UDP+0
|
||||
S.DNS.F .EQ S.UDP+2
|
||||
S.DNS.F.QR .EQ %10000000.00000000
|
||||
S.DNS.F.OPCODE.I .EQ %01000000.00000000
|
||||
S.DNS.F.OPCODE.S .EQ %00100000.00000000
|
||||
S.DNS.F.AA .EQ %00000100.00000000
|
||||
S.DNS.F.TC .EQ %00000010.00000000
|
||||
S.DNS.F.RD .EQ %00000001.00000000
|
||||
S.DNS.F.RA .EQ %00000000.10000000
|
||||
S.DNS.F.RCODE.FRMT .EQ %00000000.00000001
|
||||
S.DNS.F.RCODE.SRVR .EQ %00000000.00000010
|
||||
S.DNS.F.RCODE.UKWN .EQ %00000000.00000011
|
||||
S.DNS.F.RCODE.NIMP .EQ %00000000.00000100
|
||||
S.DNS.F.RCODE.DENY .EQ %00000000.00000101
|
||||
S.DNS.QDCOUNT .EQ S.UDP+4
|
||||
S.DNS.ANCOUNT .EQ S.UDP+6
|
||||
S.DNS.NSCOUNT .EQ S.UDP+8
|
||||
S.DNS.ARCOUNT .EQ S.UDP+10
|
||||
*
|
||||
S.DNS .EQ S.UDP+12
|
||||
*--------------------------------------
|
||||
S.DNS.QTYPE.A .EQ 1
|
||||
S.DNS.QTYPE.NS .EQ 2
|
||||
S.DNS.QTYPE.CNAME .EQ 5
|
||||
S.DNS.QTYPE.SOA .EQ 6
|
||||
S.DNS.QTYPE.WKS .EQ 11
|
||||
S.DNS.QTYPE.PTR .EQ 12
|
||||
S.DNS.QTYPE.MX .EQ 15
|
||||
S.DNS.QTYPE.SRV .EQ 33
|
||||
S.DNS.QTYPE.ANY .EQ 255
|
||||
S.DNS.QCLASS.IN .EQ 1
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE inc/libtcpip.i
|
||||
LOAD usr/src/lib/libtcpip.s
|
||||
|
42
INC/NET.DNS.I.txt
Normal file
42
INC/NET.DNS.I.txt
Normal file
@ -0,0 +1,42 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
UDP.PORT.DNS .EQ 53
|
||||
*--------------------------------------
|
||||
S.DNS.ID .EQ S.UDP+0
|
||||
S.DNS.F .EQ S.UDP+2
|
||||
S.DNS.F.QR .EQ %10000000.00000000
|
||||
S.DNS.F.OPCODE.I .EQ %01000000.00000000
|
||||
S.DNS.F.OPCODE.S .EQ %00100000.00000000
|
||||
S.DNS.F.AA .EQ %00000100.00000000
|
||||
S.DNS.F.TC .EQ %00000010.00000000
|
||||
S.DNS.F.RD .EQ %00000001.00000000
|
||||
S.DNS.F.RA .EQ %00000000.10000000
|
||||
S.DNS.F.RCODE.FRMT .EQ %00000000.00000001
|
||||
S.DNS.F.RCODE.SRVR .EQ %00000000.00000010
|
||||
S.DNS.F.RCODE.UKWN .EQ %00000000.00000011
|
||||
S.DNS.F.RCODE.NIMP .EQ %00000000.00000100
|
||||
S.DNS.F.RCODE.DENY .EQ %00000000.00000101
|
||||
S.DNS.QDCOUNT .EQ S.UDP+4
|
||||
S.DNS.ANCOUNT .EQ S.UDP+6
|
||||
S.DNS.NSCOUNT .EQ S.UDP+8
|
||||
S.DNS.ARCOUNT .EQ S.UDP+10
|
||||
*
|
||||
S.DNS .EQ S.UDP+12
|
||||
*--------------------------------------
|
||||
S.DNS.QTYPE.A .EQ 1
|
||||
S.DNS.QTYPE.NS .EQ 2
|
||||
S.DNS.QTYPE.CNAME .EQ 5
|
||||
S.DNS.QTYPE.SOA .EQ 6
|
||||
S.DNS.QTYPE.WKS .EQ 11
|
||||
S.DNS.QTYPE.PTR .EQ 12
|
||||
S.DNS.QTYPE.MX .EQ 15
|
||||
S.DNS.QTYPE.SRV .EQ 33
|
||||
S.DNS.QTYPE.ANY .EQ 255
|
||||
S.DNS.QCLASS.IN .EQ 1
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE inc/net.dns.i
|
||||
LOAD usr/src/lib/libtcpip.s
|
||||
ASM
|
73
INC/NET.TCPIP.I.txt
Normal file
73
INC/NET.TCPIP.I.txt
Normal file
@ -0,0 +1,73 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
S.ARP.HTYPE .EQ S.ETH.EII+0 $0001
|
||||
S.ARP.PTYPE .EQ S.ETH.EII+2 $0800
|
||||
S.ARP.HLEN .EQ S.ETH.EII+4 $06
|
||||
S.ARP.PLEN .EQ S.ETH.EII+5 $04
|
||||
S.ARP.OPERATION .EQ S.ETH.EII+6 REQ=$0001,REPLY=$0002
|
||||
S.ARP.OPERATION.REQ .EQ 1
|
||||
S.ARP.OPERATION.REP .EQ 2
|
||||
S.ARP.SHA .EQ S.ETH.EII+8 Sender MAC
|
||||
S.ARP.SPA .EQ S.ETH.EII+14 Sender IP
|
||||
S.ARP.THA .EQ S.ETH.EII+18 Target MAC
|
||||
S.ARP.TPA .EQ S.ETH.EII+24 Target IP
|
||||
*
|
||||
S.ARP .EQ S.ETH.EII+28
|
||||
*--------------------------------------
|
||||
S.IP.V.IHL .EQ S.ETH.EII+0 $45, IPV4,HDR=5DWORDs
|
||||
S.IP.DSCP.ECN .EQ S.ETH.EII+1
|
||||
S.IP.TOTAL.LENGTH .EQ S.ETH.EII+2
|
||||
S.IP.IDENTIFICATION .EQ S.ETH.EII+4
|
||||
S.IP.FRAGMENT.FLAGS .EQ S.ETH.EII+6
|
||||
S.IP.TTL .EQ S.ETH.EII+8
|
||||
S.IP.PROTOCOL .EQ S.ETH.EII+9
|
||||
S.IP.PROTOCOL.ICMP .EQ 1
|
||||
S.IP.PROTOCOL.TCP .EQ 6
|
||||
S.IP.PROTOCOL.UDP .EQ 17
|
||||
S.IP.HDR.CHECKSUM .EQ S.ETH.EII+10
|
||||
S.IP.SRC .EQ S.ETH.EII+12
|
||||
S.IP.DST .EQ S.ETH.EII+16
|
||||
*
|
||||
S.IP .EQ S.ETH.EII+20
|
||||
*--------------------------------------
|
||||
S.ICMP.TYPE .EQ S.IP+0
|
||||
S.ICMP.TYPE.ECHOREP .EQ 0
|
||||
S.ICMP.TYPE.UNREACH .EQ 3
|
||||
S.ICMP.TYPE.ECHOREQ .EQ 8
|
||||
S.ICMP.CODE .EQ S.IP+1
|
||||
S.ICMP.CHECKSUM .EQ S.IP+2
|
||||
S.ICMP.IDENTIFIER .EQ S.IP+4
|
||||
S.ICMP.SEQUENCE .EQ S.IP+6
|
||||
*
|
||||
S.ICMP .EQ S.IP+8
|
||||
*--------------------------------------
|
||||
S.TCPUDP.SRCPORT .EQ S.IP+0
|
||||
S.TCPUDP.DSTPORT .EQ S.IP+2
|
||||
*--------------------------------------
|
||||
S.UDP.LENGTH .EQ S.IP+4
|
||||
S.UDP.CHECKSUM .EQ S.IP+6 $0000 = DISABLE
|
||||
*
|
||||
S.UDP .EQ S.IP+8
|
||||
*--------------------------------------
|
||||
S.TCP.SEQNUM .EQ S.IP+4
|
||||
S.TCP.ACKNUM .EQ S.IP+8
|
||||
S.TCP.DATAOFFSET .EQ S.IP+12
|
||||
S.TCP.OPTIONS .EQ S.IP+13
|
||||
S.TCP.OPTIONS.URG .EQ %00100000
|
||||
S.TCP.OPTIONS.ACK .EQ %00010000
|
||||
S.TCP.OPTIONS.PSH .EQ %00001000
|
||||
S.TCP.OPTIONS.RST .EQ %00000100
|
||||
S.TCP.OPTIONS.SYN .EQ %00000010
|
||||
S.TCP.OPTIONS.FIN .EQ %00000001
|
||||
S.TCP.WINDOW .EQ S.IP+14
|
||||
S.TCP.CHECKSUM .EQ S.IP+16
|
||||
S.TCP.URGPTR .EQ S.IP+18
|
||||
*
|
||||
S.TCP .EQ S.IP+20
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE inc/net.tcpip.i
|
||||
LOAD usr/src/lib/libtcpip.s
|
||||
ASM
|
46
INC/NET.TLS.I.txt
Normal file
46
INC/NET.TLS.I.txt
Normal file
@ -0,0 +1,46 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
TLS.CT .EQ 0
|
||||
TLS.CT.CCS .EQ 20
|
||||
TLS.CT.ALERT .EQ 21
|
||||
TLS.CT.HS .EQ 22
|
||||
TLS.CT.APP .EQ 23
|
||||
TLS.CT.HEATBEAT .EQ 24
|
||||
TLS.LV .EQ 1
|
||||
TLS.LV.SSL30 .EQ $0003
|
||||
TLS.LV.TLS10 .EQ $0103
|
||||
TLS.LV.TLS11 .EQ $0203
|
||||
TLS.LV.TLS12 .EQ $0303
|
||||
TLS.LV.TLS13 .EQ $0403
|
||||
TLS.LENGTH .EQ 3
|
||||
|
||||
TLS.HS.MT .EQ 5
|
||||
TLS.HS.MT.HR .EQ 0
|
||||
TLS.HS.MT.CH .EQ 1
|
||||
TLS.HS.MT.SH .EQ 2
|
||||
TLS.HS.MT.NST .EQ 4
|
||||
TLS.HS.MT.EXT .EQ 8
|
||||
TLS.HS.MT.CERT .EQ 11
|
||||
TLS.HS.MT.SKX .EQ 12
|
||||
TLS.HS.MT.CR .EQ 13
|
||||
TLS.HS.MT.SHD .EQ 14
|
||||
TLS.HS.MT.CV .EQ 15
|
||||
TLS.HS.MT.CKX .EQ 16
|
||||
TLS.HS.MT.FIN .EQ 20
|
||||
TLS.HS.LENGTH .EQ 6
|
||||
TLS.HS.CH.V .EQ 8
|
||||
|
||||
TLS.HS.CH.UTIME .EQ 10
|
||||
TLS.HS.CH.RND .EQ 14
|
||||
TLS.HS.CH.SID .EQ 36
|
||||
TLS.HS.CH.CSL .EQ 37
|
||||
TLS.HS.CH.CS .EQ 39
|
||||
TLS.HS.CH.CS.RSAAES128CBCSHA .EQ $2F
|
||||
TLS.HS.CH.CS.RSAAES128GCMSHA256 .EQ $9C
|
||||
TLS.HS.CH.CM .EQ 41
|
||||
TLS.HS.CH.CM.NONE .EQ 1 Len=1, value=0
|
||||
TLS.HS.CH.EXTL .EQ 43
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE inc/net.tls.i
|
@ -5,7 +5,7 @@ AUTO 4,1
|
||||
*--------------------------------------
|
||||
* CS8900A IO Registers
|
||||
*--------------------------------------
|
||||
DEVID .EQ $630E
|
||||
CS8900A.DEVID .EQ $630E
|
||||
*--------------------------------------
|
||||
RTDATA .EQ $C080 Receive/Transmit Data (DWORD)
|
||||
TxCMD .EQ $C084 Transmit Command
|
||||
|
@ -5,7 +5,7 @@ AUTO 4,1
|
||||
*--------------------------------------
|
||||
* SMSC L91C96 IO Registers
|
||||
*--------------------------------------
|
||||
DEVID .EQ $33
|
||||
L91C96.DEVID .EQ $33
|
||||
*--------------------------------------
|
||||
L91C96.0.TCR .EQ $C080
|
||||
L91C96.0.TCR.FDSE .EQ %10000000.00000000
|
||||
|
@ -58,10 +58,10 @@ W5100.AR.Sn.CR.OPEN .EQ $01
|
||||
*W5100.AR.Sn.CR.CONNECT .EQ $04
|
||||
*W5100.AR.Sn.CR.DISCON .EQ $08
|
||||
*W5100.AR.Sn.CR.CLOSE .EQ $10
|
||||
W5100.AR.Sn.CR.SEND .EQ $20
|
||||
W5100.AR.Sn.CR.SEND .EQ $20
|
||||
*W5100.AR.Sn.CR.SENDMAC .EQ $21
|
||||
*W5100.AR.Sn.CR.SENDKEEP .EQ $22
|
||||
W5100.AR.Sn.CR.RCVD .EQ $40
|
||||
W5100.AR.Sn.CR.RCVD .EQ $40
|
||||
W5100.AR.S0.IR .EQ $0402
|
||||
W5100.AR.S0.SR .EQ $0403
|
||||
W5100.AR.S0.PORT .EQ $0404
|
||||
|
@ -499,7 +499,10 @@ SKT.GetDataFromSktIn
|
||||
jsr SKT.SubDataInLenAtSktX
|
||||
|
||||
jsr SKT.StoreTCB
|
||||
jsr TCP.SetSocketTCPO.ACK ACK=1 -> send WSIZE
|
||||
* jsr TCP.SetSocketTCPO.ACK ACK=1 -> send WSIZE
|
||||
|
||||
lda #S.TCP.OPTIONS.ACK
|
||||
jsr TCP.OUT.SendOptA
|
||||
|
||||
>LDYA ZPDataInLen
|
||||
clc
|
||||
@ -569,12 +572,14 @@ SKT.AddDataToSktIn
|
||||
lda SKT.Cache+S.SOCKET.TCP.INHEAD+1
|
||||
cmp /K.TCP.WSIZE
|
||||
bne .1
|
||||
|
||||
stz SKT.Cache+S.SOCKET.TCP.INHEAD+1
|
||||
lda ZPTmpPtr1+1
|
||||
* sec
|
||||
sbc /K.TCP.WSIZE
|
||||
sta ZPTmpPtr1+1
|
||||
bra .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
|
@ -227,7 +227,8 @@ TCP.IN.JMP.ESTBLSH
|
||||
jsr TCP.AddAYToSktCacheAtX
|
||||
|
||||
jsr SKT.StoreTCB update socket
|
||||
|
||||
bra .7
|
||||
|
||||
.70 jsr TCP.SetSocketTCPO.ACK ...and ack data
|
||||
|
||||
.7 ldy #S.TCP.OPTIONS
|
||||
|
@ -35,6 +35,8 @@ AUXPIPE .EQ 1
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/nic.i
|
||||
.INB inc/eth.i
|
||||
.INB inc/net.tcpip.i
|
||||
.INB inc/net.dns.i
|
||||
.INB inc/lib.net.i
|
||||
.INB inc/libtcpip.i
|
||||
*--------------------------------------
|
||||
|
@ -306,15 +306,12 @@ CS.RUN ldx #IOCTL.READ
|
||||
*--------------------------------------
|
||||
.DO DBG=1
|
||||
CS.RUN.FILTER lda (pBuf)
|
||||
cmp #$ff
|
||||
beq .9
|
||||
* cmp #$ff
|
||||
* beq .9
|
||||
|
||||
dec
|
||||
beq .9
|
||||
|
||||
ldy #S.ETH.EII.TYPE+1
|
||||
lda (pBuf),y
|
||||
bne .9
|
||||
* ldy #S.ETH.EII.TYPE+1
|
||||
* lda (pBuf),y
|
||||
* bne .9
|
||||
|
||||
clc
|
||||
rts
|
||||
|
337
SBIN/VEDD.S.txt
Normal file
337
SBIN/VEDD.S.txt
Normal file
@ -0,0 +1,337 @@
|
||||
NEW
|
||||
AUTO 3,1 Enable MASM3 auto line num
|
||||
.LIST OFF
|
||||
.OP 65C02 Target CPU, must match CPU level in header
|
||||
.OR $2000 usualy $2000, but any value > $100 allowed
|
||||
.TF sbin/vedd
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/eth.i
|
||||
.INB inc/libtcpip.i
|
||||
*--------------------------------------
|
||||
ADT.CMD.VSD .EQ $C5 "E": Virtual Drive Command Envelope
|
||||
TIMEOUT.MAX .EQ 250 25 sec.
|
||||
*--------------------------------------
|
||||
* Zero Page Segment, up to 32 bytes
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPBIN
|
||||
ZS.START
|
||||
ZPIPCfgPtr .BS 2
|
||||
ZPFrameBase .BS 2
|
||||
hSocket .BS 1
|
||||
TimeOut .BS 1
|
||||
hFrame .BS 1
|
||||
ZS.END .ED
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA #S.PS.F.EVENT
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data SegmentSize
|
||||
.DA #64 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Relocation Table
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
L.LIBTCPIP .DA LIBTCPIP
|
||||
L.MSG.USAGE .DA MSG.USAGE
|
||||
L.MSG.TCPIPERR .DA MSG.TCPIPERR
|
||||
L.MSG.UNKNOWN .DA MSG.UNKNOWN
|
||||
L.MSG.CONNECTED .DA MSG.CONNECTED
|
||||
L.MSG.NOCONN .DA MSG.NOCONN
|
||||
L.MSG.NOPING .DA MSG.NOPING
|
||||
L.MSG.MOUNTED .DA MSG.MOUNTED
|
||||
L.ADT.REQ .DA ADT.REQ
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Called once at process creation
|
||||
* Put code for loading LIB here
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.LIBTCPIP
|
||||
>SYSCALL LoadLib
|
||||
bcs .9
|
||||
|
||||
sta hLIBTCPIP
|
||||
|
||||
* clc
|
||||
.9
|
||||
CS.INIT.RTS rts
|
||||
*--------------------------------------
|
||||
* Called until exit with CS
|
||||
* if RUN exits with CC, RUN entered again
|
||||
*--------------------------------------
|
||||
CS.RUN lda hSocket
|
||||
beq .1
|
||||
|
||||
lda #0
|
||||
clc
|
||||
rts
|
||||
|
||||
.1 jsr CS.RUN.CheckTCPIP
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.CheckArgs
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
jsr CS.RUN.Connect
|
||||
bcs CS.INIT.RTS
|
||||
|
||||
>PUSHB hSocket
|
||||
>PUSHW L.ADT.REQ
|
||||
>PUSHWI ADT.REQ.LEN
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
||||
bcs .9
|
||||
|
||||
jsr CS.RUN.RECV
|
||||
bcc .8
|
||||
|
||||
>PUSHW L.MSG.NOPING
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
|
||||
.8
|
||||
|
||||
lda #0
|
||||
sec
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.RUN.CheckTCPIP
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
||||
bcs .9
|
||||
|
||||
>STYA ZPIPCfgPtr
|
||||
lda (ZPIPCfgPtr) Configured ?
|
||||
bmi .1
|
||||
|
||||
>LDYA L.MSG.TCPIPERR
|
||||
>SYSCALL PutS
|
||||
|
||||
lda #E.SYN
|
||||
sec
|
||||
.9 rts
|
||||
|
||||
.1 lda #AF.INET
|
||||
>STA.G SA.LOCAL
|
||||
>STA.G SA.REMOTE
|
||||
|
||||
ldy #S.IPCFG.IP+3
|
||||
|
||||
.3 lda (ZPIPCfgPtr),y
|
||||
pha
|
||||
dey
|
||||
cpy #S.IPCFG.IP-1
|
||||
bne .3
|
||||
|
||||
ldy #SA.LOCAL+S.SOCKADDR.ADDR
|
||||
|
||||
.4 pla
|
||||
sta (pData),y
|
||||
iny
|
||||
cpy #SA.LOCAL+S.SOCKADDR.ADDR+4
|
||||
bne .4
|
||||
|
||||
lda #6502
|
||||
>STA.G SA.REMOTE+S.SOCKADDR.PORT
|
||||
iny
|
||||
lda /6502
|
||||
sta (pData),y
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.CheckArgs
|
||||
ldy #S.PS.ARGC
|
||||
lda (pPS),y
|
||||
bne .1
|
||||
|
||||
>LDYA L.MSG.USAGE
|
||||
>SYSCALL PutS
|
||||
lda #E.SYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.1 lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.2 >PUSHEA.G SA.REMOTE+S.SOCKADDR.ADDR
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
|
||||
bcc .3
|
||||
|
||||
>SLEEP
|
||||
lda TimeOut
|
||||
bne .2
|
||||
|
||||
>PUSHW L.MSG.UNKNOWN
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
lda #ERR.SKT.NOCONN
|
||||
sec
|
||||
rts
|
||||
|
||||
.3 lda #2
|
||||
>SYSCALL ArgV
|
||||
bcc .4
|
||||
|
||||
|
||||
|
||||
.4
|
||||
|
||||
.8 clc
|
||||
CS.RUN.CheckArgs.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.Connect >PUSHBI S.SOCKET.T.DGRAM
|
||||
>PUSHBI 0 no protocol
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
||||
bcs .9
|
||||
|
||||
sta hSocket
|
||||
|
||||
>PUSHA
|
||||
>PUSHEA.G SA.LOCAL
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
||||
bcs .9
|
||||
|
||||
lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.1 >SLEEP
|
||||
|
||||
>PUSHB hSocket
|
||||
>PUSHEA.G SA.REMOTE
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
||||
bcc .8
|
||||
|
||||
ldx TimeOut
|
||||
bne .1
|
||||
|
||||
.9 pha
|
||||
|
||||
>PUSHW L.MSG.NOCONN
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 >PUSHW L.MSG.CONNECTED
|
||||
lda #1
|
||||
>SYSCALL ArgV
|
||||
>PUSHYA
|
||||
>PUSHBI 2
|
||||
>SYSCALL PrintF
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN.RECV lda #TIMEOUT.MAX
|
||||
sta TimeOut
|
||||
|
||||
.1 >SLEEP
|
||||
|
||||
lda hSocket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
||||
bcc .8
|
||||
|
||||
cmp #E.NODATA
|
||||
bne .9
|
||||
|
||||
lda TimeOut
|
||||
bne .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.8 sta hFrame
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPFrameBase
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .9 is it a TIMER event?
|
||||
|
||||
lda TimeOut
|
||||
beq .9
|
||||
|
||||
dec TimeOut
|
||||
|
||||
.9 sec do not discard TIMER event
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT
|
||||
|
||||
.1 lda hSocket
|
||||
beq .2
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
||||
|
||||
.2
|
||||
|
||||
lda hLIBTCPIP
|
||||
.7 beq .8
|
||||
|
||||
>SYSCALL UnloadLib
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
* Initialized DATA
|
||||
*--------------------------------------
|
||||
LIBTCPIP .AZ "libtcpip"
|
||||
hLIBTCPIP .BS 1
|
||||
*--------------------------------------
|
||||
MSG.USAGE .AZ "Usage : VEDD <ip|host> [port]"
|
||||
MSG.TCPIPERR .AZ "VEDD:TCP/IP Not initialized properly."
|
||||
MSG.UNKNOWN .AZ "VEDD:%s: Unknown host\r\n"
|
||||
MSG.NOCONN .AZ "VEDD:No Connection To %s\r\n"
|
||||
MSG.CONNECTED .AZ "VEDD:Connected To %s\r\n"
|
||||
MSG.NOPING .AZ "VEDD:No response from %s\r\n"
|
||||
MSG.MOUNTED .AZ "VEDD:%s Mounted As %s\r\n"
|
||||
*--------------------------------------
|
||||
ADT.REQ .DA #ADT.CMD.VSD
|
||||
.HS 030000C6 READ D1, BLK 0
|
||||
ADT.REQ.LEN .EQ *-ADT.REQ
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
SA.LOCAL .BS 1 S.SOCKADDR.AF
|
||||
.BS 1
|
||||
.BS 4 S.SOCKADDR.ADDR
|
||||
.BS 2 S.SOCKADDR.PORT
|
||||
SA.REMOTE .BS 1 S.SOCKADDR.AF
|
||||
.BS 1
|
||||
.BS 4 S.SOCKADDR.ADDR
|
||||
.BS 2 S.SOCKADDR.PORT
|
||||
DS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sbin/vedd.s
|
||||
ASM
|
991
SCMASM.30/ASM65816.S..txt
Normal file
991
SCMASM.30/ASM65816.S..txt
Normal file
@ -0,0 +1,991 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR $A700
|
||||
ASM65816.SEARCH.TABLE .BS 3
|
||||
ASM65816.GNC .BS 3
|
||||
ASM65816.GNC.UC .BS 3
|
||||
ASM65816.GNNB .BS 3
|
||||
ASM65816.EXPR .BS 10
|
||||
ASM65816.EXP1 .BS 10
|
||||
ASM65816.ASM.ERROR .BS 3
|
||||
ASM65816.EMIT .BS 10
|
||||
*--------------------------------
|
||||
.OR $F0 F0-FF is ASM private ZeroPage
|
||||
LEVEL.MASK .BS 1
|
||||
OPBASE .BS 1
|
||||
MODE.BYTE .BS 1
|
||||
FORCE.ADDR.SIZE .BS 1
|
||||
.ED
|
||||
*--------------------------------
|
||||
ERR.BAD.OPCODE .EQ 0
|
||||
ERR.BAD.ADDRESS .EQ 1
|
||||
ERR.RANGE .EQ 2
|
||||
ERR.UNDEFINED .EQ 3
|
||||
*--------------------------------
|
||||
JMP ASM65816.ASM.INIT
|
||||
JMP ASM65816.ASM.LINE
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
JMP DIR.OP
|
||||
*--------------------------------
|
||||
.AS -/FOR THE 6502, 65C02, 65R02, 65816/
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
ASM65816.ASM.INIT
|
||||
LDA #0 MASK FOR 6502
|
||||
STA LEVEL.MASK
|
||||
LDA #15 MARGIN FOR 6502
|
||||
STA EMIT.MARGIN
|
||||
RTS
|
||||
*--------------------------------
|
||||
ASM65816.ASM.LINE
|
||||
LDA SEARCH.KEY 1ST LETTER
|
||||
CMP #'A'
|
||||
BCC .5 ...NOT A LETTER, SO BADOP
|
||||
CMP #'Z'+1
|
||||
BCS .5 ...NOT A LETTER, SO BADOP
|
||||
AND #$1F MAKE 01...1A
|
||||
TAX
|
||||
LDA FIRST.LETTER.TABLE-1,X
|
||||
BNE .8 ...UNUSED LETTER
|
||||
.5 JMP BADOPERR
|
||||
*---BUILD OPTBL.PNTR INTO TABLE--------
|
||||
.8 ADC #OPCODE.TABLE CARRY CLEAR ALREADY
|
||||
STA OPTBL.PNTR
|
||||
LDY /OPCODE.TABLE
|
||||
BCC .1
|
||||
INY
|
||||
.1 CPX #'R'-$40 WHICH HALF OF TABLE?
|
||||
BCC .2 ...FIRST HALF
|
||||
INY ...SECOND HALF
|
||||
.2 CLC INITIAL SEARCH
|
||||
.3 JSR ASM65816.SEARCH.TABLE
|
||||
BCC .5 ...NOT FOUND
|
||||
*---FOUND IT!--------------------
|
||||
LDA (OPTBL.PNTR),Y
|
||||
STA OPBASE
|
||||
INY
|
||||
LDA (OPTBL.PNTR),Y
|
||||
AND #$E1 ISOLATE LEVEL BITS
|
||||
BEQ .7 ...PLAIN 6502 LEVEL
|
||||
AND LEVEL.MASK
|
||||
BNE .7 ...ALLOWS 'STP' FOR BOTH 65816 & SWEET-16
|
||||
SEC CONTINUE SEARCH
|
||||
BCS .3 ...ALWAYS
|
||||
*---BRANCH TO PROCESS OPCODE-----
|
||||
.7 LDA (OPTBL.PNTR),Y
|
||||
AND #$1E
|
||||
TAY
|
||||
LDA OP.MODE+1,Y
|
||||
PHA
|
||||
LDA OP.MODE,Y
|
||||
PHA
|
||||
RTS
|
||||
*--------------------------------
|
||||
.MA MODE
|
||||
O..]1 .EQ *-OP.MODE
|
||||
.DA OP.]1-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
OP.MODE
|
||||
>MODE SNGL 0 -- SINGLE BYTE OPCODES
|
||||
>MODE COPS 2 -- LDA GROUP
|
||||
>MODE SHIFTS 4 -- ASL GROUP
|
||||
>MODE REL16 6 -- BRL & PER
|
||||
>MODE REL8 8 -- RELATIVE BRANCHES
|
||||
>MODE BITS A -- BIT GROUP
|
||||
>MODE MOVES C -- MVP & MVN
|
||||
>MODE JUMPS E -- JUMP GROUP
|
||||
>MODE ROCKB 10 -- ROCKWELL BIT OPS
|
||||
>MODE ROCKC 12 -- ROCKWELL BIT OPS
|
||||
>MODE XN 14 -- SWEET 16 REGISTER OPS
|
||||
>MODE POP 16 -- SWEET 16 POP & POPD
|
||||
>MODE SET 18 -- SWEET 16 SET
|
||||
>MODE CRS 1A -- COP, REP, SEP
|
||||
*--------------------------------
|
||||
OP.SNGL
|
||||
EMIT.OPBASE
|
||||
LDA OPBASE
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
OP.CRS JSR ASM65816.GNNB
|
||||
CMP #'#'
|
||||
BNE ERBA.E2
|
||||
JSR ASM65816.EXP1
|
||||
JMP EMIT.OP.AND.EXP.BYTE
|
||||
ERBA.E2
|
||||
JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
OP.COPS
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
LDA MODE.BYTE ALL INDIRECT MODES <<<12-16-85>>>
|
||||
AND #$04 REQUIRE ZP VALUE <<<12-16-85>>>
|
||||
BEQ .1 ...NOT INDIRECT <<<12-16-85>>>
|
||||
CPY #14
|
||||
BCC .4 ...MODES 0...13
|
||||
DEC ADDR.LENGTH SHORTEN >(ZP) AND >(ZP),Y
|
||||
.4 JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE ERBA.E2 ...MUST BE DIRECT VALUE
|
||||
.1 LDA ADDR.MODE.BITS.CLASS.1,Y
|
||||
BPL .2 VALID MODE
|
||||
INC ADDR.LENGTH ...DIRECT,Y NOT VALID
|
||||
LDA ADDR.MODE.BITS.CLASS.1+1,Y
|
||||
.2 EOR OPBASE
|
||||
CMP #$89 STA IMMED?
|
||||
BEQ ERBA.E2 ...YES, NO SUCH ANIMAL
|
||||
* FALL INTO EMIT.OP.AND.VALUE ***
|
||||
*--------------------------------
|
||||
EMIT.OP.AND.VALUE
|
||||
JSR ASM65816.EMIT
|
||||
ASM65816.EMIT.VALUE
|
||||
JSR EMIT.EXP.BYTE
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+1
|
||||
JSR ASM65816.EMIT
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+2
|
||||
JSR ASM65816.EMIT
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+3
|
||||
JSR ASM65816.EMIT
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
OP.BITS
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
CPY #7 ONLY MODES 0...6 LEGAL
|
||||
BCS .2 ...NOT VALID MODE
|
||||
LDX OPBASE
|
||||
BNE .0 ...NOT BIT OPCODE
|
||||
LDA LEVEL.MASK
|
||||
AND #$20
|
||||
BNE .0 ...AT LEAST 65C02
|
||||
LDA #$60 ONLY ZP AND ABS LEGAL
|
||||
BNE .7 ...ALWAYS
|
||||
.0 LDA CLASS.5.LEGAL.MODES,X
|
||||
.7 AND CLASS.5.MODE.MASKS,Y
|
||||
BNE .4 ...LEGAL
|
||||
LDA PASS
|
||||
BEQ .1 ...IN PASS 1
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .2 ...TOO BIG FOR ZP
|
||||
.1 DEY CHANGE ABS TO ZP MODE
|
||||
BMI .2 ...WASN'T ABS
|
||||
TYA
|
||||
LSR
|
||||
BCC .2 ...WASN'T ABS
|
||||
LDA CLASS.5.LEGAL.MODES,X
|
||||
AND CLASS.5.MODE.MASKS,Y
|
||||
BNE .3 ...LEGAL AFTERALL
|
||||
.2 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE
|
||||
.3 DEC ADDR.LENGTH
|
||||
*---FORM OPCODE------------------
|
||||
.4 LDA ADDR.MODE.BITS.CLASS.5,Y
|
||||
EOR CLASS.5.OPS,X
|
||||
LDY #$89
|
||||
CMP #$20
|
||||
BEQ .5
|
||||
LDY #$9C
|
||||
CMP #$6C
|
||||
BEQ .5
|
||||
LDY #$9E
|
||||
CMP #$7C
|
||||
BNE .6
|
||||
.5 TYA
|
||||
.6 JMP EMIT.OP.AND.VALUE
|
||||
*--------------------------------
|
||||
OP.SHIFTS
|
||||
JSR ASM65816.GNC CHECK FOR ACCUMULATOR MODE
|
||||
BNE .2 NOT ACCUM MODE
|
||||
JSR ASM65816.GNC
|
||||
BNE .2 NOT ACCUM MODE
|
||||
*---ACCUMULATOR MODE-------------
|
||||
LDA OPBASE
|
||||
EOR #$08 MAKE ACCUM MODE OPCODE
|
||||
BPL .1 NOT INC OR DEC
|
||||
PHA
|
||||
LDA LEVEL.MASK
|
||||
AND #$20 ONLY IN 65C02 AND ABOVE
|
||||
BEQ .5
|
||||
PLA
|
||||
EOR #$F0 CHANGE EA-->1A, CA-->3A
|
||||
.1 JMP ASM65816.EMIT
|
||||
*---MODES WITH OPERAND FIELD-----
|
||||
.2 DEC CHAR.PNTR
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
CPY #5 ONLY MODES 1...4 LEGAL
|
||||
BCS .5
|
||||
TYA
|
||||
BEQ .5 ...NO IMMEDIATE MODE ALLOWED
|
||||
LDA ADDR.MODE.BITS.CLASS.1,Y
|
||||
EOR OPBASE
|
||||
JMP EMIT.OP.AND.VALUE
|
||||
.5 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE
|
||||
*--------------------------------
|
||||
OP.REL8
|
||||
.DO SWEET.16
|
||||
LDA OPBASE CHECK FOR 'BNM1' SWEET-16 OP
|
||||
CMP #$09
|
||||
BNE .1 ...NOT 'BNM1'
|
||||
JSR ASM65816.GNC CHECK FOR '1'
|
||||
CMP #'1'
|
||||
BNE BADOPERR ...NO, SO BAD OP
|
||||
.FIN
|
||||
.1 JSR ASM65816.EXPR
|
||||
LDA OPBASE
|
||||
OP.REL8.A
|
||||
JSR ASM65816.EMIT EMIT OPCODE
|
||||
LDA EXP.UNDEF
|
||||
BMI GOEMIT ...UNDEFINED
|
||||
LDY EXP.VALUE+1
|
||||
CLC COMPUTE RELATIVE OFFSET
|
||||
LDA EXP.VALUE
|
||||
SBC ORGN
|
||||
STA EXP.VALUE
|
||||
BPL .2
|
||||
INY
|
||||
.2 TYA
|
||||
SBC ORGN+1
|
||||
BNE ERR.RANGE.EMIT.ONE
|
||||
EMIT.EXP.BYTE
|
||||
LDA EXP.VALUE
|
||||
GOEMIT JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
BADOPERR
|
||||
LDA #ERR.BAD.OPCODE
|
||||
JMP ASM65816.ASM.ERROR
|
||||
*--------------------------------
|
||||
* BRL & PER, 16-bit relative
|
||||
*--------------------------------
|
||||
OP.REL16
|
||||
JSR ASM65816.EXPR Get value of expression
|
||||
JSR EMIT.OPBASE Emit the opcode, bumping origin once
|
||||
LDA EXP.UNDEF If undefined, say so
|
||||
BMI .3 (If we didn't, might be RANGE ERR)
|
||||
CLC ADD 2 MORE TO ORIGIN
|
||||
LDY ORGN+2
|
||||
LDA ORGN
|
||||
ADC #2
|
||||
STA EXP.VALUE+3 (TEMP)
|
||||
LDA ORGN+1
|
||||
ADC #0
|
||||
BCC .2
|
||||
INY BANK BYTE
|
||||
.2 CPY EXP.VALUE+2 IN SAME BANK AS TARGET?
|
||||
BNE ERR.RANGE.EMIT.TWO ...NO, ERR RANGE
|
||||
STA EXP.VALUE+2 YES, SAVE IN ANOTHER TEMP
|
||||
LDA EXP.VALUE TARGET-ORGN+3
|
||||
SBC EXP.VALUE+3
|
||||
STA EXP.VALUE
|
||||
LDA EXP.VALUE+1
|
||||
SBC EXP.VALUE+2
|
||||
STA EXP.VALUE+1
|
||||
.3 LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
*--------------------------------
|
||||
ERR.RANGE.EMIT.TWO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ERR.RANGE.EMIT.ONE
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ASM65816.RAER
|
||||
LDA #ERR.RANGE
|
||||
JMP ASM65816.ASM.ERROR
|
||||
*--------------------------------
|
||||
OP.MOVES
|
||||
JSR EMIT.OPBASE
|
||||
JSR ASM65816.EXPR GET SOURCE BANK
|
||||
LDA EXP.VALUE+2
|
||||
PHA
|
||||
JSR ASM65816.GNC
|
||||
CMP #',' MUST HAVE COMMA HERE
|
||||
BNE .1 ...ILLEGAL
|
||||
JSR ASM65816.EXP1 GET DESTINATION BANK
|
||||
LDA EXP.VALUE+2
|
||||
JSR ASM65816.EMIT
|
||||
PLA
|
||||
JMP ASM65816.EMIT
|
||||
.1 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
OP.JUMPS
|
||||
JSR GENERAL.OPERAND
|
||||
LDA LEGAL.JUMP.MODES,Y
|
||||
BMI .4 ...ILLEGAL
|
||||
ORA OPBASE
|
||||
TAY
|
||||
LDA LEVEL.MASK
|
||||
BMI .1 65816, ALLOW ALL MODES
|
||||
CPY #5 DISALLOW JML, JSL, AND PEA
|
||||
BCS .4 ...ONE OF THOSE
|
||||
CPY #1 DISALLOW JMP LONG
|
||||
BEQ .4
|
||||
AND #$20 SEE IF 65C02
|
||||
BNE .1 ...YES
|
||||
CPY #3 ...NO, DISALLOW JMP (ABS,X)
|
||||
BEQ .4 ...THAT'S WHAT IT IS...
|
||||
.1 LDA JUMP.OPCODES,Y
|
||||
BEQ .4 ...ILLEGAL
|
||||
LDY #2 ASSUME TWO BYTE ADDRESS
|
||||
CMP #$5C CHECK FOR "JMP LONG"
|
||||
BEQ .2 ...YES, 3 BYTES OF ADDRESS
|
||||
CMP #$22 CHECK FOR "JSL"
|
||||
BNE .3 ...NO, ONLY 2 BYTES OF ADDRESS
|
||||
.2 INY 3 BYTE ADDRESS
|
||||
.3 STY ADDR.LENGTH
|
||||
JMP EMIT.OP.AND.VALUE
|
||||
.4 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
ASM65816.TEST.EXP.VALUE.ZP
|
||||
LDA EXP.VALUE+1
|
||||
ORA EXP.VALUE+2
|
||||
ORA EXP.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
LONG.INDIRECT
|
||||
JSR ASM65816.EXP1
|
||||
JSR ASM65816.GNC
|
||||
CMP #']'
|
||||
BNE ERBA.EMIT.TWO
|
||||
JSR ASM65816.GNC
|
||||
BEQ .1 ...[EXP]
|
||||
CMP #','
|
||||
BNE ERBA.EMIT.TWO
|
||||
JSR ASM65816.GNC.UC
|
||||
CMP #'Y'
|
||||
BNE ERBA.EMIT.TWO
|
||||
LDA #$47 ...[EXP],Y
|
||||
.HS 2C
|
||||
.1 LDA #$44 ...[EXP],Y
|
||||
STA MODE.BYTE
|
||||
LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP CHECK.IF.SUFFIX.LEGAL
|
||||
*--------------------------------
|
||||
IMMEDIATE
|
||||
JSR ASM65816.GNC.UC
|
||||
CMP DLIM 16-BIT IMMEDIATE?
|
||||
BNE .1 ...NO, BACKUP
|
||||
LDA LEVEL.MASK 16-BIT IMMEDIATE OKAY?
|
||||
BPL ERBA.EMIT.TWO ...NOT AT 65816 LEVEL
|
||||
INC ADDR.LENGTH ...YES, INCREASE LENGTH
|
||||
BNE .2 ...ALWAYS
|
||||
.1 DEC CHAR.PNTR
|
||||
.2 JSR ASM65816.EXP1
|
||||
JSR ASM65816.GNC
|
||||
BNE ERBA.EMIT.TWO ILLEGAL
|
||||
LDA DLIM
|
||||
CMP #'/' #=23, /=2F, ^=5E
|
||||
BCC .4 ...#
|
||||
BEQ .3 .../
|
||||
JSR ASM65816.EXP.OVER.256 ...^
|
||||
.3 JSR ASM65816.EXP.OVER.256
|
||||
.4 LDY #0 SIGNAL IMMEDIATE MODE
|
||||
STY MODE.BYTE COPS NEEDS THIS <<<12-16-85>>>
|
||||
RTS
|
||||
*--------------------------------
|
||||
ERBA.EMIT.THREE
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ERBA.EMIT.TWO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ASM65816.ERBA
|
||||
LDA #ERR.BAD.ADDRESS
|
||||
JMP ASM65816.ASM.ERROR
|
||||
ASM65816.EMIT.ZERO LDA #0
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
* RETURN:
|
||||
* # BYTES IN ADDRESS IN ADDR.LENGTH
|
||||
* (Y) = INDEX TO ADDR.MODE.BITS
|
||||
*--------------------------------
|
||||
GENERAL.OPERAND
|
||||
JSR ASM65816.GNNB GET NEXT NON-BLANK
|
||||
BCS ERBA.EMIT.TWO ...NO OPERAND
|
||||
*---PARSE PREFIX-----------------
|
||||
LDY #1
|
||||
STY ADDR.LENGTH
|
||||
STA DLIM
|
||||
CMP #'('
|
||||
BEQ .3 ...indirect, must be ZP
|
||||
CMP #'['
|
||||
BEQ LONG.INDIRECT
|
||||
CMP #'#'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'/'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'^'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'<'
|
||||
BEQ .3 MAKE FORCE SIZE = 1
|
||||
DEY Y=0
|
||||
CMP #'>'
|
||||
BNE .2 ...SIZE NOT FORCED
|
||||
JSR ASM65816.GNC
|
||||
LDY #3 Y=3
|
||||
CMP DLIM IS IT ">>"?
|
||||
BEQ .3 ...YES
|
||||
DEY Y=2
|
||||
STA DLIM CHANGE DLIM TO NEW VALUE
|
||||
CMP #'(' IS IT (?
|
||||
BEQ .3 ...YES, >(
|
||||
.2 DEC CHAR.PNTR ...NO, SO BACKUP
|
||||
.3 STY FORCE.ADDR.SIZE
|
||||
*---PARSE THE EXPRESSION---------
|
||||
JSR ASM65816.EXP1
|
||||
*---FIGURE # OF BYTES------------
|
||||
LDX FORCE.ADDR.SIZE
|
||||
BNE .6 ...FORCED WITH <, >, OR >>
|
||||
LDX #2 ASSUME 2-BYTE ADDRESS
|
||||
LDA EXP.UNDEF
|
||||
BMI .6
|
||||
LDA PASS IGNORE FWD REF FLAG IN PASS 1
|
||||
BEQ .4 ...PASS 1
|
||||
LDA EXP.FWDREF ...PASS 2, DEFINED
|
||||
BNE .4 ...BUT NOT FWD REF
|
||||
LDA EXP.VALUE+3 ...FWD REF MUST BE ONLY
|
||||
ORA EXP.VALUE+2 16 BITS
|
||||
BEQ .6 ...IT FITS!
|
||||
BNE ERBA.1 ...ALWAYS, ERBA
|
||||
.4 LDA EXP.VALUE+3 DO NOT ALLOW 32-BITS
|
||||
BNE ERBA.1 ...BAD ADDR
|
||||
LDA EXP.VALUE+2
|
||||
BNE .5 ...3-BYTE ADDRESS
|
||||
DEX X=1
|
||||
LDA EXP.VALUE+1
|
||||
BEQ .6 ...ZP
|
||||
.5 INX
|
||||
.6 STX ADDR.LENGTH
|
||||
*---PARSE SUFFIX-----------------
|
||||
DEX MAKE 0, 1, OR 2
|
||||
STX MODE.BYTE
|
||||
LDX #6
|
||||
.7 JSR ASM65816.GNC.UC
|
||||
.8 CMP MODE.CHARS,X
|
||||
BEQ .9
|
||||
CLC
|
||||
ROL MODE.BYTE
|
||||
DEX
|
||||
BPL .8
|
||||
BMI ERBA.1
|
||||
.9 CMP #' ' BLANK?
|
||||
BEQ CHECK.IF.SUFFIX.LEGAL ...YES, END OF OPERAND
|
||||
CMP #')' RIGHT PAREN?
|
||||
BNE .10 ...NO
|
||||
LDA DLIM WAS THERE A LEFT PAREN?
|
||||
CMP #'('
|
||||
BNE ERBA.1 ...NO
|
||||
.10 SEC
|
||||
ROL MODE.BYTE
|
||||
DEX
|
||||
BPL .7
|
||||
ERBA.1 JMP ERBA.EMIT.TWO ILLEGAL
|
||||
*--------------------------------
|
||||
CHECK.IF.SUFFIX.LEGAL
|
||||
LDY #0 SEARCH FORWARD FOR VARIOUS REASONS
|
||||
LDA MODE.BYTE
|
||||
.13 INY
|
||||
CPY #MODE.TABLE.SIZE+1
|
||||
BCS ERBA.1 ...END OF TABLE
|
||||
CMP MODE.TABLE-1,Y
|
||||
BNE .13 ...KEEP LOOKING
|
||||
RTS
|
||||
*--------------------------------
|
||||
SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
LDA LEVEL.MASK
|
||||
BMI .15 ...65816 LEVEL, ALL LEGAL
|
||||
CPY #9
|
||||
BCC .15 ...6502 MODES
|
||||
BEQ .14 ...65C02 MODE
|
||||
CPY #16
|
||||
BNE ERBA.1
|
||||
.14 AND #$20 AT C02 LEVEL?
|
||||
BEQ ERBA.1 ...NO
|
||||
.15 RTS
|
||||
*--------------------------------
|
||||
ASM65816.EXP.OVER.256
|
||||
LDA EXP.VALUE+1
|
||||
STA EXP.VALUE
|
||||
LDA EXP.VALUE+2
|
||||
STA EXP.VALUE+1
|
||||
LDA EXP.VALUE+3
|
||||
STA EXP.VALUE+2
|
||||
LDA #0
|
||||
STA EXP.VALUE+3
|
||||
RTS
|
||||
.DO ROCKWELL
|
||||
*--------------------------------
|
||||
* ROCKWELL 65C02 EXCLUSIVES
|
||||
*
|
||||
* RMB bit#,zp
|
||||
* SMB bit#,zp
|
||||
* BBR bit#,zp,reladdr
|
||||
* BBS bit#,zp,reladdr
|
||||
*--------------------------------
|
||||
OP.ROCKB
|
||||
JSR OP.ROCKWELL
|
||||
JSR ASM65816.GNC REQUIRE A COMMA
|
||||
CMP #','
|
||||
BNE .1 ...NO COMMA
|
||||
LDA EXP.VALUE
|
||||
PHA SAVE ZP VALUE
|
||||
JSR ASM65816.EXP1 GET BRANCH EXPRESSION
|
||||
JSR EMIT.OPBASE <<<12-16-85>>>
|
||||
PLA
|
||||
JMP OP.REL8.A
|
||||
.1 JMP ERBA.EMIT.THREE
|
||||
*--------------------------------
|
||||
OP.ROCKC
|
||||
JSR OP.ROCKWELL
|
||||
.FIN
|
||||
EMIT.OP.AND.EXP.BYTE
|
||||
JSR EMIT.OPBASE <<<12-16-85>>>
|
||||
JMP EMIT.EXP.BYTE <<<12-16-85>>>
|
||||
*--------------------------------
|
||||
.DO ROCKWELL
|
||||
OP.ROCKWELL
|
||||
JSR ASM65816.EXPR GET BIT #
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .1 ...MUST BE SMALL NUMBER!
|
||||
LDA EXP.VALUE
|
||||
CMP #8 MUST BE 0...7
|
||||
BCS .1 ...TOO LARGE
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ORA OPBASE MERGE INTO OPCODE
|
||||
STA OPBASE
|
||||
JSR ASM65816.GNC NEED A COMMA NOW
|
||||
CMP #','
|
||||
BNE .1
|
||||
JSR ASM65816.EXP1 GET ZP VALUE
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .1 MUST BE ZERO PAGE
|
||||
RTS
|
||||
.1 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
.ELSE
|
||||
OP.ROCKB
|
||||
OP.ROCKC
|
||||
JMP BADOPERR
|
||||
.FIN
|
||||
|
||||
.DO SWEET.16
|
||||
*--------------------------------
|
||||
* SWEET-16 OPCODES
|
||||
*--------------------------------
|
||||
OP.POP
|
||||
JSR ASM65816.GNC.UC SEE WHICH: POP OR POPD
|
||||
BEQ OP.XN ...POP
|
||||
CMP #'D'
|
||||
BEQ .1
|
||||
JMP BADOPERR
|
||||
.1 LDA #$A2 ...POP
|
||||
STA OPBASE
|
||||
*--------------------------------
|
||||
OP.XN
|
||||
JSR ASM65816.GNNB
|
||||
BCS SWEET.ERBA
|
||||
CMP #'@'
|
||||
BNE .1 ...NOT '@N'
|
||||
LDA OPBASE ...'@N', SEE IF LEGAL
|
||||
AND #2
|
||||
BEQ SWEET.ERBA ...NOT LEGAL WITH THIS OP
|
||||
LDA OPBASE ...LEGAL, ADD $20
|
||||
ADC #$1F .CS., SO 1F IS 20
|
||||
BNE .2 ...ALWAYS
|
||||
.1 DEC CHAR.PNTR Backup character pointer
|
||||
LDA OPBASE
|
||||
LSR
|
||||
BCC SWEET.ERBA 'N' NOT LEGAL FOR THIS OP
|
||||
LDA OPBASE
|
||||
.2 AND #$F0 CLEAR AWAY LEGALITY FLAGS
|
||||
STA OPBASE
|
||||
JSR ASM65816.EXP1 GET REGISTER NUMBER
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE SWEET.RAER
|
||||
LDA EXP.VALUE
|
||||
CMP #$10
|
||||
BCS SWEET.RAER
|
||||
ORA OPBASE
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
SWEET.ERBA JMP ASM65816.ERBA
|
||||
SWEET.RAER JMP ASM65816.RAER
|
||||
*--------------------------------
|
||||
OP.SET
|
||||
JSR OP.XN
|
||||
JSR ASM65816.GNC
|
||||
CMP #','
|
||||
BNE SWEET.ERBA
|
||||
JSR ASM65816.EXP1
|
||||
LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
*--------------------------------
|
||||
.ELSE
|
||||
OP.POP
|
||||
OP.XN
|
||||
OP.SET
|
||||
JMP BADOPERR
|
||||
.FIN
|
||||
*--------------------------------
|
||||
LEGAL.JUMP.MODES
|
||||
.HS FF.00.00.FF.FF.FF
|
||||
.HS FF.FF.03.02.FF.FF
|
||||
.HS 01.FF.02.FF.03
|
||||
*--------------------------------
|
||||
JUMP.OPCODES
|
||||
.HS 4C.5C.6C.7C JMP
|
||||
.HS 20.22.00.FC JSR
|
||||
.HS 00.00.DC.00 JML
|
||||
.HS 22.22.00.00 JSL
|
||||
.HS F4.00.00.00 PEA
|
||||
*--------------------------------
|
||||
MODE.CHARS
|
||||
.AS / Y,)SX,/
|
||||
*--------------------------------
|
||||
MODE.TABLE
|
||||
.HS 00 1 -- DIRECT
|
||||
.HS 40 2 -- ABSOLUTE
|
||||
.HS 30 3 -- DIRECT,X
|
||||
.HS 70 4 -- ABSOLUTE,X
|
||||
.HS 21 5 -- DIRECT,Y
|
||||
.HS 61 6 -- ABSOLUTE,Y
|
||||
.HS 07 7 -- (DIRECT),Y
|
||||
.HS 34 8 -- (DIRECT,X)
|
||||
*---IN 65C02, 802, 816-----------
|
||||
.HS 04 9 -- (DIRECT)
|
||||
*---IN 65802, 816----------------
|
||||
.HS 28 A -- ...,S
|
||||
.HS 2F B -- (...,S),Y
|
||||
*---ONLY IN 65816----------------
|
||||
.HS 80 C -- LONG
|
||||
.HS B0 D -- LONG,X
|
||||
.HS 44 E -- >(DIRECT)
|
||||
.HS 47 F -- >(DIRECT),Y
|
||||
*---SPECIAL FOR JMP,JSR (A,X)----
|
||||
.HS 74 10 -- (ABSOLUTE,X)
|
||||
MODE.TABLE.SIZE .EQ *-MODE.TABLE
|
||||
*--------------------------------
|
||||
ADDR.MODE.BITS.CLASS.1
|
||||
.HS 08 0 -- IMMEDIATE
|
||||
.HS 04 1 -- DIRECT
|
||||
.HS 0C 2 -- ABSOLUTE
|
||||
.HS 14 3 -- DIRECT,X
|
||||
.HS 1C 4 -- ABSOLUTE,X
|
||||
.HS FF 5 -- DIRECT,Y <<<NOT LEGAL>>>
|
||||
.HS 18 6 -- ABSOLUTE,Y
|
||||
.HS 10 7 -- (DIRECT),Y
|
||||
.HS 00 8 -- (DIRECT,X)
|
||||
*---IN 65C02, 802, 816-----------
|
||||
.HS 13 9 -- (DIRECT)
|
||||
*---IN 65802, 816----------------
|
||||
.HS 02 A -- ...,S
|
||||
.HS 12 B -- (...,S),Y
|
||||
*---ONLY IN 65816----------------
|
||||
.HS 0E C -- LONG
|
||||
.HS 1E D -- LONG,X
|
||||
.HS 06 E -- >(DIRECT)
|
||||
.HS 16 F -- >(DIRECT),Y
|
||||
*--------------------------------
|
||||
ADDR.MODE.BITS.CLASS.5
|
||||
.HS 00 0 -- IMMEDIATE
|
||||
.HS 04 1 -- DIRECT
|
||||
.HS 0C 2 -- ABSOLUTE
|
||||
.HS 14 3 -- DIRECT,X
|
||||
.HS 1C 4 -- ABSOLUTE,X
|
||||
.HS 14 5 -- DIRECT,Y
|
||||
.HS 1C 6 -- ABSOLUTE,Y
|
||||
*--------------------------------
|
||||
CLASS.5.MODE.MASKS
|
||||
.HS 80.40.20.10.08.04.02
|
||||
*--------------------------------
|
||||
FIRST.LETTER.TABLE
|
||||
.DA #LTR.A-OPCODE.TABLE
|
||||
.DA #LTR.B-OPCODE.TABLE
|
||||
.DA #LTR.C-OPCODE.TABLE
|
||||
.DA #LTR.D-OPCODE.TABLE
|
||||
.DA #LTR.E-OPCODE.TABLE
|
||||
.DA #LTR.F-OPCODE.TABLE
|
||||
.DA #LTR.G-OPCODE.TABLE
|
||||
.DA #LTR.H-OPCODE.TABLE
|
||||
.DA #LTR.I-OPCODE.TABLE
|
||||
.DA #LTR.J-OPCODE.TABLE
|
||||
.DA #LTR.K-OPCODE.TABLE
|
||||
.DA #LTR.L-OPCODE.TABLE
|
||||
.DA #LTR.M-OPCODE.TABLE
|
||||
.DA #LTR.N-OPCODE.TABLE
|
||||
.DA #LTR.O-OPCODE.TABLE
|
||||
.DA #LTR.P-OPCODE.TABLE
|
||||
.DA #LTR.Q-OPCODE.TABLE
|
||||
.DA #LTR.R-OPCODE.TABLE
|
||||
.DA #LTR.S-OPCODE.TABLE
|
||||
.DA #LTR.T-OPCODE.TABLE
|
||||
.DA #LTR.U-OPCODE.TABLE
|
||||
.DA #LTR.V-OPCODE.TABLE
|
||||
.DA #LTR.W-OPCODE.TABLE
|
||||
.DA #LTR.X-OPCODE.TABLE
|
||||
.DA #LTR.Y-OPCODE.TABLE
|
||||
.DA #LTR.Z-OPCODE.TABLE
|
||||
*--------------------------------
|
||||
* TWO KINDS OF ENTRIES, DISTINGUISHED BY FIRST BIT:
|
||||
* 8-BIT ENTRIES: FIRST BIT = 0
|
||||
* 24-BIT ENTRIES: FIRST BIT = 1
|
||||
*
|
||||
* FIRST ENTRY AT EACH LETTER IS AN 8-BIT ENTRY.
|
||||
* EACH 8-BIT ENTRY IS FOLLOWED BY ONE OR MORE
|
||||
* 24-BIT ENTRIES.
|
||||
* THE SUB-LIST OF 24-BIT ENTRIES IS TERMINATED
|
||||
* BY THE NEXT 8-BIT ENTRY.
|
||||
* THE LIST OF 8-BIT ENTRIES IS TERMINATED BY
|
||||
* AN 8-BIT ENTRY WITH BIT 6 = 1.
|
||||
*
|
||||
* THE VALUE OF BITS 5-0 IN AN 8-BIT ENTRY
|
||||
* IS THE DIMINISHED ASCII CODE FOR THE
|
||||
* SECOND LETTER OF AN OPCODE.
|
||||
* THE VALUE OF BITS 5-0 OF A 24-BIT ENTRY
|
||||
* IS THE DIMINISHED ASCII CODE FOR THE
|
||||
* THIRD LETTER OF AN OPCODE.
|
||||
* A...Z = $81...9A
|
||||
* BLANK = $E0
|
||||
* '1' = $F1
|
||||
* THE VALUE OF THE SECOND BYTE OF A 24-BIT
|
||||
* ENTRY IS AN OPCODE BASE.
|
||||
* THE THIRD BYTE OF A 24-BIT ENTRY HAS TWO PARTS:
|
||||
* BITS 4-1 ARE AN INDEX TO THE OP.MODE
|
||||
* JUMP TABLE IN ASM.65816
|
||||
* BITS 7-5 AND 0 ARE LEVEL MASK BITS.
|
||||
* 000XXXX0 = 6502 OPCODE
|
||||
* 000XXXX1 = SWEET-16
|
||||
* 001XXXX0 = 65C02
|
||||
* 010XXXX0 = ROCKWELL SPECIALS
|
||||
* 100XXXX0 = 65816
|
||||
*
|
||||
* LEVEL.MASK = $00 FOR 6502
|
||||
* = $20 FOR 65C02
|
||||
* = $60 FOR ROCKWELL C02
|
||||
* = $A0 FOR 65816
|
||||
*--------------------------------
|
||||
OP..1 .SE 0
|
||||
OP..2 .SE 0
|
||||
.MA OP
|
||||
.DO "]1"=OP..1=0
|
||||
LTR.]1 .DA #"]2"-$80 bits 76 = 01
|
||||
OP..1 .SE "]1"
|
||||
OP..2 .SE "]2"
|
||||
.ELSE
|
||||
.DO "]2"=OP..2=0
|
||||
.DA #"]2"-$C0 bits 76 = 00
|
||||
OP..2 .SE "]2"
|
||||
.FIN
|
||||
.FIN
|
||||
.DA #"]3"^$40,#$]4,#O..]5!O..]6 bits 76 = 10 or 11
|
||||
.EM
|
||||
*--------------------------------
|
||||
O..65816 .EQ $80
|
||||
O..65R02 .EQ $40
|
||||
O..65C02 .EQ $20
|
||||
O..SWEET .EQ $01
|
||||
O.. .EQ $00
|
||||
*--------------------------------
|
||||
OPCODE.TABLE
|
||||
LTR.F
|
||||
LTR.G
|
||||
LTR.H
|
||||
LTR.K
|
||||
LTR.Q
|
||||
LTR.U
|
||||
LTR.V
|
||||
LTR.Y
|
||||
LTR.Z .HS 00
|
||||
*--------------------------------
|
||||
>OP A,D,C,61,COPS
|
||||
>OP A,D,D,A1,XN,SWEET
|
||||
>OP A,N,D,21,COPS
|
||||
>OP A,S,L,02,SHIFTS
|
||||
>OP B,C,C,90,REL8
|
||||
>OP B,C,S,B0,REL8
|
||||
>OP B,C," ",03,REL8,SWEET
|
||||
>OP B,E,Q,F0,REL8
|
||||
>OP B,G,E,B0,REL8
|
||||
>OP B,I,T,00,BITS
|
||||
>OP B,L,T,90,REL8
|
||||
>OP B,M,I,30,REL8
|
||||
>OP B,M," ",05,REL8,SWEET
|
||||
>OP B,M,1,08,REL8,SWEET
|
||||
>OP B,N,E,D0,REL8
|
||||
>OP B,N,C,02,REL8,SWEET
|
||||
>OP B,N,M,09,REL8,SWEET (BNM1)
|
||||
>OP B,N,Z,07,REL8,SWEET
|
||||
>OP B,P,L,10,REL8
|
||||
>OP B,P," ",04,REL8,SWEET
|
||||
>OP B,R,A,80,REL8,65C02
|
||||
>OP B,R,K,00,SNGL
|
||||
>OP B,R,L,82,REL16,65816
|
||||
>OP B,R," ",01,REL8,SWEET
|
||||
>OP B,V,C,50,REL8
|
||||
>OP B,V,S,70,REL8
|
||||
>OP B,B,R,0F,ROCKB,65R02
|
||||
>OP B,B,S,8F,ROCKB,65R02
|
||||
>OP B,K," ",0A,SNGL,SWEET
|
||||
>OP B,S," ",0C,REL8,SWEET
|
||||
>OP B,Z," ",06,REL8,SWEET
|
||||
>OP C,L,C,18,SNGL
|
||||
>OP C,L,D,D8,SNGL
|
||||
>OP C,L,I,58,SNGL
|
||||
>OP C,L,V,B8,SNGL
|
||||
>OP C,M,P,C1,COPS
|
||||
>OP C,O,P,02,CRS,65816
|
||||
>OP C,P,X,04,BITS
|
||||
>OP C,P,Y,03,BITS
|
||||
>OP C,P,R,D1,XN,SWEET
|
||||
>OP D,E,C,C2,SHIFTS
|
||||
>OP D,E,X,CA,SNGL
|
||||
>OP D,E,Y,88,SNGL
|
||||
>OP D,C,R,F1,XN,SWEET
|
||||
>OP E,O,R,41,COPS
|
||||
>OP I,N,C,E2,SHIFTS
|
||||
>OP I,N,X,E8,SNGL
|
||||
>OP I,N,Y,C8,SNGL
|
||||
>OP I,N,R,E1,XN,SWEET
|
||||
>OP J,M,L,08,JUMPS,65816
|
||||
>OP J,M,P,00,JUMPS
|
||||
>OP J,S,L,0C,JUMPS,65816
|
||||
>OP J,S,R,04,JUMPS
|
||||
>OP L,D,A,A1,COPS
|
||||
>OP L,D,X,02,BITS
|
||||
>OP L,D,Y,01,BITS
|
||||
>OP L,D," ",23,XN,SWEET
|
||||
>OP L,D,D,42,XN,SWEET
|
||||
>OP L,S,R,42,SHIFTS
|
||||
>OP M,V,N,54,MOVES,65816
|
||||
>OP M,V,P,44,MOVES,65816
|
||||
>OP N,O,P,EA,SNGL
|
||||
>OP O,R,A,01,COPS
|
||||
>OP P,E,A,10,JUMPS,65816
|
||||
>OP P,E,I,0A,BITS,65816
|
||||
>OP P,E,R,62,REL16,65816
|
||||
>OP P,H,A,48,SNGL
|
||||
>OP P,H,B,8B,SNGL,65816
|
||||
>OP P,H,D,0B,SNGL,65816
|
||||
>OP P,H,K,4B,SNGL,65816
|
||||
>OP P,H,P,08,SNGL
|
||||
>OP P,H,X,DA,SNGL,65C02
|
||||
>OP P,H,Y,5A,SNGL,65C02
|
||||
>OP P,L,A,68,SNGL
|
||||
>OP P,L,B,AB,SNGL,65816
|
||||
>OP P,L,D,2B,SNGL,65816
|
||||
>OP P,L,P,28,SNGL
|
||||
>OP P,L,X,FA,SNGL,65C02
|
||||
>OP P,L,Y,7A,SNGL,65C02
|
||||
>OP P,O,P,62,POP,SWEET (POP,POPD)
|
||||
>OP R,E,P,C2,CRS,65816
|
||||
>OP R,O,L,22,SHIFTS
|
||||
>OP R,O,R,62,SHIFTS
|
||||
>OP R,T,I,40,SNGL
|
||||
>OP R,T,L,6B,SNGL,65816
|
||||
>OP R,T,S,60,SNGL
|
||||
>OP R,T,N,00,SNGL,SWEET
|
||||
>OP R,M,B,07,ROCKC,65R02
|
||||
>OP R,S," ",0B,SNGL,SWEET
|
||||
>OP S,B,C,E1,COPS
|
||||
>OP S,E,C,38,SNGL
|
||||
>OP S,E,D,F8,SNGL
|
||||
>OP S,E,I,78,SNGL
|
||||
>OP S,E,P,E2,CRS,65816
|
||||
>OP S,E,T,11,SET,SWEET
|
||||
>OP S,T,A,81,COPS
|
||||
>OP S,T,P,DB,SNGL,65816
|
||||
>OP S,T,P,72,XN,SWEET
|
||||
>OP S,T,X,06,BITS
|
||||
>OP S,T,Y,05,BITS
|
||||
>OP S,T,Z,07,BITS,65C02
|
||||
>OP S,T," ",33,XN,SWEET
|
||||
>OP S,T,D,52,XN,SWEET
|
||||
>OP S,U,B,B1,XN,SWEET
|
||||
>OP S,M,B,87,ROCKC,65R02
|
||||
>OP T,A,X,AA,SNGL
|
||||
>OP T,A,Y,A8,SNGL
|
||||
>OP T,C,D,5B,SNGL,65816
|
||||
>OP T,C,S,1B,SNGL,65816
|
||||
>OP T,D,C,7B,SNGL,65816
|
||||
>OP T,R,B,09,BITS,65C02
|
||||
>OP T,S,B,08,BITS,65C02
|
||||
>OP T,S,C,3B,SNGL,65816
|
||||
>OP T,S,X,BA,SNGL
|
||||
>OP T,X,A,8A,SNGL
|
||||
>OP T,X,S,9A,SNGL
|
||||
>OP T,X,Y,9B,SNGL,65816
|
||||
>OP T,Y,A,98,SNGL
|
||||
>OP T,Y,X,BB,SNGL,65816
|
||||
>OP W,A,I,CB,SNGL,65816
|
||||
>OP W,D,M,42,SNGL,65816
|
||||
>OP X,B,A,EB,SNGL,65816
|
||||
>OP X,C,E,FB,SNGL,65816
|
||||
.HS 40 <<<TERMINATOR>>>
|
||||
*--------------------------------
|
||||
CLASS.5.OPS
|
||||
* BIT LDY LDX CPY CPX STY STX STZ
|
||||
.HS 20..A0..A2..C0..E0..80..82..60
|
||||
*
|
||||
* TSB TRB PEI
|
||||
.HS 00..10..D0
|
||||
*
|
||||
CLASS.5.LEGAL.MODES
|
||||
.HS F8..F8..E6..E0..E0..70..64..78
|
||||
.HS 60..60..40
|
||||
*
|
||||
* 80 -- IMMEDIATE
|
||||
* 40 -- DIRECT
|
||||
* 20 -- ABSOLUTE
|
||||
* 10 -- DIRECT,X
|
||||
* 08 -- ABSOLUTE,X
|
||||
* 04 -- DIRECT,Y
|
||||
* 02 -- ABSOLUTE,Y
|
||||
* 01 -- <<<NOT USED>>>
|
||||
*--------------------------------
|
||||
* OPCODE TABLE SELECTION
|
||||
* .OP 6502/65C02/R65C02/65816/SWEET16,...
|
||||
*--------------------------------
|
||||
DIR.OP LDA #0
|
||||
STA LEVEL.MASK
|
||||
LDA #15
|
||||
STA EMIT.MARGIN
|
||||
.1 JSR ASM65816.GNC.UC GET NEXT CHARACTER
|
||||
BCS .5 END
|
||||
LDY #-2
|
||||
.2 INY
|
||||
INY
|
||||
LDA PSOP.TABLE,Y
|
||||
BEQ .1 ...END OF TABLE, TRY NEXT CHARACTER
|
||||
CMP CURRENT.CHAR
|
||||
BNE .2 ...NOT THIS ONE
|
||||
.3 LDA PSOP.TABLE+1,Y
|
||||
STA LEVEL.MASK
|
||||
BPL .5
|
||||
LDA #18
|
||||
STA EMIT.MARGIN
|
||||
.5 RTS RETURN TO ASSEMBLER
|
||||
*--------------------------------
|
||||
PSOP.TABLE
|
||||
.DA #'8',#$A0 65816 = $A0
|
||||
.DA #'C',#$20 65C02 = $20
|
||||
.DO ROCKWELL
|
||||
.DA #'R',#$60 ROCKWELL= $60
|
||||
.FIN
|
||||
.DO SWEET.16
|
||||
.DA #'S',#$01 SWEET-16= $01
|
||||
.FIN
|
||||
.DA #0
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/asm65816.s
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
137
SCMASM.30/IO.S.IIE..txt
Normal file
137
SCMASM.30/IO.S.IIE..txt
Normal file
@ -0,0 +1,137 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP IIE.INIT
|
||||
JMP IIE.WARM
|
||||
JMP IIE.RDKEY
|
||||
JMP S.GET.HORIZ.POSN
|
||||
JMP MON.HOME
|
||||
JMP MON.CLREOL
|
||||
JMP MON.CLREOP
|
||||
JMP MON.UP
|
||||
JMP MON.LF
|
||||
JMP IIE.LEFT
|
||||
JMP IIE.RIGHT
|
||||
JMP IIE.COUT
|
||||
JMP IIE.PICK.SCREEN
|
||||
JMP IIE.HTABX
|
||||
JMP IIE.HTAB
|
||||
JMP IIE.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
IIE.INIT
|
||||
LDA $BF98
|
||||
AND #2
|
||||
BEQ IO.HOME
|
||||
LDA #$99 CTRL-Y
|
||||
JMP $C300
|
||||
*--------------------------------
|
||||
IIE.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR IIE.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.HTAB
|
||||
BIT $C01F
|
||||
BPL .1
|
||||
STA $57B
|
||||
RTS
|
||||
.1 STA CH
|
||||
RTS
|
||||
*--------------------------------
|
||||
S.GET.HORIZ.POSN
|
||||
LDA $57B
|
||||
BIT $C01F
|
||||
BMI .1
|
||||
LDA CH
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
IIE.WARM
|
||||
CLD
|
||||
LDX CV SAVE CV
|
||||
JSR MON.INIT
|
||||
TXA GET CV, FALL INTO VTAB
|
||||
IIE.VTAB
|
||||
STA CV
|
||||
JMP MON.VTAB
|
||||
*--------------------------------
|
||||
IIE.RDKEY
|
||||
LDA #40
|
||||
BIT $C01F
|
||||
BPL .1
|
||||
ASL
|
||||
.1 STA SCREEN.WIDTH
|
||||
JSR MON.RDKEY
|
||||
CMP #$FF
|
||||
BNE .2
|
||||
LDA #$88
|
||||
.2 ASL $C061 SET CARRY IF "OPEN APPLE" PRESSED
|
||||
ORA #$80
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.COUT
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .2 ...NORMAL
|
||||
BIT $C01F ...INVERSE; 40- OR 80-COLUMNS?
|
||||
BPL .2 ...40-COLUMN
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR MON.COUT
|
||||
PLA
|
||||
CMP #$20 CONTROL CHAR?
|
||||
BCS .1 ...NO
|
||||
ORA #$40 MAKE PRINTABLE CHARACTER
|
||||
.1 ORA #$80
|
||||
JSR MON.COUT
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.2 JMP MON.COUT
|
||||
*--------------------------------
|
||||
IIE.PICK.SCREEN
|
||||
BIT $C01F
|
||||
BMI .1
|
||||
LDA (BASL),Y
|
||||
RTS
|
||||
.1 TYA
|
||||
LSR
|
||||
TAY
|
||||
PHP
|
||||
SEI
|
||||
LDA $C055
|
||||
BCC .2
|
||||
LDA $C054
|
||||
.2 LDA (BASL),Y
|
||||
BIT $C054
|
||||
PLP
|
||||
PHA SAVE CHAR FROM SCREEN
|
||||
TYA RESTORE Y-REG
|
||||
ROL
|
||||
TAY
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.RIGHT
|
||||
BIT $C01F IN 80-COLUMN MODE?
|
||||
BMI .1 ...YES
|
||||
JMP MON.ADVANC
|
||||
.1 LDA #$9C FORWARD SPACE
|
||||
.HS 2C SKIP TWO BYTES
|
||||
*--------------------------------
|
||||
IIE.LEFT
|
||||
LDA #$88 BACKSPACE
|
||||
JMP MON.COUT
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/io.s.iie
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
270
SCMASM.30/IO.S.IIE.ULTRA.txt
Normal file
270
SCMASM.30/IO.S.IIE.ULTRA.txt
Normal file
@ -0,0 +1,270 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
* VIDEX ULTRATERM DRIVER -- ASSUME SLOT 3
|
||||
ULTRA.SLOT .EQ 3
|
||||
SKMOD .EQ 1 SHIFT KEY MOD (=0 FOR //E VERSION)
|
||||
*--------------------------------
|
||||
* TO MAKE THE EDIT COMMAND USE MORE THAN 24 LINES,
|
||||
* CHANGE $17 TO $1F OR $2F AT $803A
|
||||
*--------------------------------
|
||||
ULTRA.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
ULTRA.CARD .EQ ULTRA.SLOT*256+$C000
|
||||
ULTRA.COUT1 .EQ ULTRA.SLOT*256+$C007
|
||||
*--------------------------------
|
||||
ULTRA.REG .EQ ULTRA.SLOT*16+$C080
|
||||
ULTRA.DATA .EQ ULTRA.SLOT*16+$C081
|
||||
*--------------------------------
|
||||
ULTRA.HORIZ .EQ $0578+ULTRA.SLOT
|
||||
ULTRA.START .EQ $06F8+ULTRA.SLOT TOP-OF-SCREEN ADDRESS / 16
|
||||
ULTRA.CHPG .EQ $0678
|
||||
ULTRA.TEMPX .EQ $0778
|
||||
ULTRA.TEMPY .EQ $07F8
|
||||
ULTRA.FLAGS .EQ $07F8+ULTRA.SLOT
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP ULTRA.INIT
|
||||
JMP ULTRA.WARM
|
||||
JMP ULTRA.READ.KEY.WITH.CASE
|
||||
JMP ULTRA.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP ULTRA.PICK.SCREEN
|
||||
JMP ULTRA.HTABX
|
||||
JMP ULTRA.HTAB
|
||||
JMP ULTRA.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
LDA ULTRA.FLAGS
|
||||
EOR #$40
|
||||
STA ULTRA.FLAGS
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
ULTRA.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR ULTRA.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.GET.HORIZ.POSN
|
||||
LDA ULTRA.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.VTAB
|
||||
STA CV
|
||||
LDA ULTRA.HORIZ
|
||||
ULTRA.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR ULTRA.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
JSR .1
|
||||
LDA CV
|
||||
|
||||
.1 CLC ADD $A0 OFFSET
|
||||
ADC #$A0
|
||||
JMP ULTRA.COUT1
|
||||
*--------------------------------
|
||||
ULTRA.INIT
|
||||
LDA #80
|
||||
STA ULTRA.SCREEN.WIDTH
|
||||
LDA #$8C CLEAR SCREEN AND START VIDEX-80
|
||||
STA $C00B SWITCH OFF //E C3 ROM
|
||||
STA $C006 SWITCH OFF //E C100-C7FF ROM
|
||||
JSR ULTRA.CARD
|
||||
ULTRA.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA ULTRA.VECTORS,X
|
||||
STA $36,X
|
||||
STA ULTRA.SLOT*2+$BE10,X
|
||||
LDA ULTRA.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA ULTRA.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.VECTORS
|
||||
.DA ULTRA.COUT
|
||||
.DA ULTRA.RDKEY
|
||||
*--------------------------------
|
||||
ULTRA.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP ULTRA.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
ULTRA.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC COMMAND
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.RDKEY
|
||||
CLD
|
||||
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
|
||||
STA ULTRA.REG
|
||||
LDA #$67
|
||||
STA ULTRA.DATA
|
||||
LDA #$0B
|
||||
STA ULTRA.REG
|
||||
LDA #$08
|
||||
STA ULTRA.DATA
|
||||
.1 LDA $C000
|
||||
BPL .1
|
||||
STA $C010
|
||||
PHA
|
||||
LDA #$06 HIDE THE CURSOR
|
||||
STA ULTRA.DATA
|
||||
PLA
|
||||
CMP #$8D
|
||||
BNE .2
|
||||
JSR IO.CLREOL
|
||||
LDA #$8D
|
||||
.DO SKMOD
|
||||
.2 PHA CHECK SHIFT LOCK FLAG
|
||||
LDA ULTRA.FLAGS
|
||||
ASL
|
||||
ASL
|
||||
PLA
|
||||
BCC .5 ...SHIFT LOCK IS ON
|
||||
CMP #$C0
|
||||
BCC .5 NOT IN ALPHA RANGE
|
||||
BEQ .3 ...@ IS CAPITAL P
|
||||
ORA #$20 ADJUST TO LOWER CASE
|
||||
BIT $C063 TEST SHIFT KEY (PB3)
|
||||
BMI .5 ...NOT PRESSED, LOWER CASE
|
||||
CMP #$FB
|
||||
BCC .4 ...NORMAL A-Z
|
||||
.3 EOR #$10 CHANGE @ to P, [\]^_ to KLMNO
|
||||
.4 AND #$DF UPPER CASE
|
||||
.5 RTS
|
||||
.ELSE
|
||||
.2 RTS
|
||||
.FIN
|
||||
*--------------------------------
|
||||
ULTRA.COUT
|
||||
CLD
|
||||
PHA
|
||||
STA MON.INVFLG BIT 7 CONTROLS INV/NORM
|
||||
CMP #$20 CATCH INV CTRL CHARS
|
||||
BCS .1 ...NOT ONE
|
||||
ORA #$40 MAKE CTRL VISIBLE
|
||||
.1 JSR ULTRA.COUT1
|
||||
LDA #$FF
|
||||
STA MON.INVFLG
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
W16TBL .DA #80/16
|
||||
.DA #96/16
|
||||
.DA #160/16
|
||||
.DA #80/16
|
||||
.DA #80/16
|
||||
.DA #80/16
|
||||
.DA #160/16
|
||||
.DA #128/16
|
||||
*--------------------------------
|
||||
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
|
||||
*--------------------------------
|
||||
ULTRA.PICK.SCREEN
|
||||
STY ULTRA.TEMPY
|
||||
STX ULTRA.TEMPX
|
||||
BIT $CFFF
|
||||
BIT ULTRA.CARD TURN ON SCREEN
|
||||
*--------------------------------
|
||||
LDA ULTRA.FLAGS GET MODE (0...7)
|
||||
AND #$07
|
||||
TAY Y = MODE INDEX (0...7)
|
||||
*--------------------------------
|
||||
LDA ULTRA.TEMPY HORIZ. POSN
|
||||
CPY #$06 132 COL MODE?
|
||||
BNE .1 ...NOT 132 COLUMNS
|
||||
ADC #14 ADJUST FOR 132 COLUMN MODE
|
||||
.1 STA ULTRA.CHPG
|
||||
*--------------------------------
|
||||
LDX W16TBL,Y GET WIDTH/16
|
||||
LDA ULTRA.START CV*(WIDTH/16) + START
|
||||
.2 CLC INCLUDE 'CLC' IN LOOP ON PURPOSE
|
||||
ADC CV TO FORCE WRAP-AROUND
|
||||
DEX
|
||||
BNE .2
|
||||
*--------------------------------
|
||||
PHA
|
||||
LSR *16
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX SAVE PAGE VALUE IN X-REG
|
||||
PLA
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
*--------------------------------
|
||||
CLC + CH (or CH+15 if 132 columns)
|
||||
ADC ULTRA.CHPG
|
||||
STA ULTRA.CHPG
|
||||
BCC .3
|
||||
INX ADD CARRY TO PAGE VALUE
|
||||
*--------------------------------
|
||||
.3 TXA GET PAGE VALUE
|
||||
AND #$0F
|
||||
ORA MODETBL,Y
|
||||
STA ULTRA.REG+2
|
||||
*--------------------------------
|
||||
ASL
|
||||
AND #$0C
|
||||
TAY
|
||||
LDA ULTRA.REG,Y
|
||||
TXA GET PAGE VALUE AGAIN
|
||||
LSR SET CARRY IF IN 2ND PAGE
|
||||
*--------------------------------
|
||||
LDY ULTRA.CHPG
|
||||
LDA $CC00,Y
|
||||
BCC .4
|
||||
LDA $CD00,Y
|
||||
.4 ORA #$80 MAKE HIGH ASCII
|
||||
LDY ULTRA.TEMPY RESTORE REGS
|
||||
LDX ULTRA.TEMPX
|
||||
RTS ALL DONE
|
||||
*--------------------------------
|
||||
MODETBL .HS 40 80X24 (VIDEOTERM EMULATION)
|
||||
.HS 50 96X24
|
||||
.HS 70 160X24
|
||||
.HS 50 80X24 INTERLACE
|
||||
.HS 50 80X32 INTERLACE
|
||||
.HS 50 80X48 INTERLACE
|
||||
.HS 70 132X24 INTERLACE
|
||||
.HS 70 128X32 INTERLACE
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/io.s.ultra
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
219
SCMASM.30/IO.S.IIE.VIDEX.txt
Normal file
219
SCMASM.30/IO.S.IIE.VIDEX.txt
Normal file
@ -0,0 +1,219 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
VIDEX.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
VIDEX.SLOT .EQ 3 ASSUME SLOT 3
|
||||
*--------------------------------
|
||||
VIDEX.CARD .EQ VIDEX.SLOT*256+$C000
|
||||
VIDEX.COUT1 .EQ VIDEX.SLOT*256+$C007
|
||||
VIDEX.REG .EQ VIDEX.SLOT*16+$C080
|
||||
VIDEX.DATA .EQ VIDEX.SLOT*16+$C081
|
||||
*--------------------------------
|
||||
VIDEX.BASEL .EQ $0478+VIDEX.SLOT
|
||||
VIDEX.BASEH .EQ $04F8+VIDEX.SLOT
|
||||
VIDEX.HORIZ .EQ $0578+VIDEX.SLOT
|
||||
VIDEX.CHAR .EQ $0678+VIDEX.SLOT
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP VIDEX.INIT
|
||||
JMP VIDEX.WARM
|
||||
JMP VIDEX.READ.KEY.WITH.CASE
|
||||
JMP VIDEX.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP VIDEX.PICK.SCREEN
|
||||
JMP VIDEX.HTABX
|
||||
JMP VIDEX.HTAB
|
||||
JMP VIDEX.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
LDA CASEFLG
|
||||
EOR #$80
|
||||
STA CASEFLG
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
VIDEX.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR VIDEX.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.GET.HORIZ.POSN
|
||||
LDA VIDEX.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.VTAB
|
||||
STA CV
|
||||
LDA VIDEX.HORIZ
|
||||
VIDEX.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR VIDEX.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
CLC
|
||||
ADC #$A0
|
||||
JSR VIDEX.COUT1
|
||||
LDA CV
|
||||
ORA #$A0
|
||||
JMP VIDEX.COUT1
|
||||
*--------------------------------
|
||||
VIDEX.INIT
|
||||
LDA #80
|
||||
STA VIDEX.SCREEN.WIDTH
|
||||
STA CASEFLG CLEAR CASEFLG (BIT7=0)
|
||||
LDA #$8C CLEAR SCREEN AND START VIDEX-80
|
||||
JSR VIDEX.CARD
|
||||
VIDEX.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA VIDEX.VECTORS,X
|
||||
STA $36,X
|
||||
STA VIDEX.SLOT*2+$BE10,X
|
||||
LDA VIDEX.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA VIDEX.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.VECTORS
|
||||
.DA VIDEX.COUT
|
||||
.DA VIDEX.RDKEY
|
||||
*--------------------------------
|
||||
VIDEX.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP VIDEX.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
VIDEX.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC COMMAND
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.RDKEY
|
||||
CLD
|
||||
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
|
||||
STA VIDEX.REG
|
||||
LDA #$67
|
||||
STA VIDEX.DATA
|
||||
LDA #$0B
|
||||
STA VIDEX.REG
|
||||
LDA #$08
|
||||
STA VIDEX.DATA
|
||||
.1 LDA $C000
|
||||
BPL .1
|
||||
STA $C010
|
||||
PHA
|
||||
LDA #$0A HIDE THE CURSOR
|
||||
STA VIDEX.REG
|
||||
LDA #$09
|
||||
STA VIDEX.DATA
|
||||
PLA
|
||||
CMP #$8D
|
||||
BNE .2
|
||||
JSR IO.CLREOL
|
||||
LDA #$8D
|
||||
.2 BIT CASEFLG TEST CASE CONVERSION FLAG
|
||||
BPL .6 DO NOT CONVERT
|
||||
CMP #$B0
|
||||
BCC .6 DO NOT CONVERT
|
||||
BIT $C063 TEST PADDLE BUTTON
|
||||
BMI .5 NO SHIFTKEY PRESSED
|
||||
CMP #$B0
|
||||
BEQ .4
|
||||
CMP #$C0
|
||||
BNE .3
|
||||
LDA #$D0
|
||||
.3 CMP #$DB
|
||||
BCC .6
|
||||
AND #$CF
|
||||
BNE .6
|
||||
.4 LDA #$DD
|
||||
.5 ORA #$20
|
||||
.6 AND #$7F
|
||||
STA VIDEX.CHAR
|
||||
ORA #$80
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.COUT
|
||||
CLD
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .1 ...NORMAL
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR VIDEX.COUT1
|
||||
PLA
|
||||
ORA #$80 MAKE PRINTABLE CHARACTER
|
||||
CMP #$A0
|
||||
BCS .2
|
||||
ORA #$40
|
||||
.2 JSR VIDEX.COUT1
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.1 JMP VIDEX.COUT1
|
||||
*--------------------------------
|
||||
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
|
||||
*--------------------------------
|
||||
VIDEX.PICK.SCREEN
|
||||
STX SAVEX
|
||||
BIT $CFFF TURN ON $C800 VIDEO SPACE
|
||||
BIT VIDEX.CARD
|
||||
*---CALCULATE POSITION-----------
|
||||
CLC
|
||||
TYA COLUMN 0-79
|
||||
ADC VIDEX.BASEL
|
||||
PHA
|
||||
LDA #0
|
||||
ADC VIDEX.BASEH
|
||||
PHA
|
||||
ASL
|
||||
AND #$0C USE BIT 0 AND 1 FOR PAGING
|
||||
TAX
|
||||
LDA VIDEX.REG,X
|
||||
PLA
|
||||
LSR ODD/EVEN PAGE
|
||||
PLA
|
||||
TAX
|
||||
*---GET CHAR FROM WINDOW---------
|
||||
LDA $CC00,X
|
||||
BCC .1
|
||||
LDA $CD00,X
|
||||
.1 ORA #$80
|
||||
STA VIDEX.CHAR
|
||||
LDX SAVEX
|
||||
RTS
|
||||
*--------------------------------
|
||||
SAVEX .BS 1
|
||||
CASEFLG .BS 1
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/io.s.videx
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
166
SCMASM.30/IO.S.STB80.txt
Normal file
166
SCMASM.30/IO.S.STB80.txt
Normal file
@ -0,0 +1,166 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
STB.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
STB.SLOT .EQ 3
|
||||
*--------------------------------
|
||||
STB.HORIZ .EQ $05F8+STB.SLOT
|
||||
STB.ESCBYT .EQ $06F8+STB.SLOT
|
||||
STB.FLAGS .EQ $0778+STB.SLOT
|
||||
*--------------------------------
|
||||
STB.ENTRY .EQ STB.SLOT*256+$C000
|
||||
STB.RDKEY1 .EQ STB.SLOT*256+$C005
|
||||
STB.COUT1 .EQ STB.SLOT*256+$C019
|
||||
STB.SCREEN .EQ STB.SLOT*256+$C031
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP STB.INIT
|
||||
JMP STB.WARM
|
||||
JMP STB.READ.KEY.WITH.CASE
|
||||
JMP STB.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP STB.PICK.SCREEN
|
||||
JMP STB.HTABX
|
||||
JMP STB.HTAB
|
||||
JMP STB.VTAB
|
||||
*---Case Change MUST go here-----
|
||||
LDA STB.FLAGS
|
||||
EOR #$40
|
||||
STA STB.FLAGS
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
STB.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR STB.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.GET.HORIZ.POSN
|
||||
LDA STB.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.VTAB
|
||||
STA CV
|
||||
LDA STB.HORIZ
|
||||
STB.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR STB.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
JSR .1
|
||||
LDA CV
|
||||
|
||||
.1 CLC
|
||||
ADC #$A0
|
||||
JMP STB.COUT1
|
||||
*--------------------------------
|
||||
STB.INIT
|
||||
LDA #80
|
||||
STA STB.SCREEN.WIDTH
|
||||
LDA #$8C CLEAR SCREEN AND START STB-80
|
||||
JSR STB.ENTRY
|
||||
LDA #0
|
||||
STA STB.ESCBYT DISABLE ^A AND ESC-MODE
|
||||
LDA #2 DISABLE "HOME" SENSING
|
||||
STA STB.FLAGS
|
||||
STB.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA STB.VECTORS,X
|
||||
STA $36,X
|
||||
STA STB.SLOT*2+$BE10,X
|
||||
LDA STB.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA STB.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.VECTORS .DA STB.COUT
|
||||
.DA STB.RDKEY
|
||||
*--------------------------------
|
||||
STB.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP STB.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
STB.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC FILES
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.RDKEY
|
||||
CLD
|
||||
LDA #$0A
|
||||
STA STB.SLOT*16+$C080
|
||||
LDA #$07 SOLID DBL LINE CURSOR
|
||||
STA STB.SLOT*16+$C081
|
||||
JSR STB.RDKEY1
|
||||
ORA #$80 Make sure it looks right
|
||||
PHA
|
||||
LDA #$0A
|
||||
STA STB.SLOT*16+$C080
|
||||
LDA #$20 CURSOR OFF
|
||||
STA STB.SLOT*16+$C081
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.COUT
|
||||
CLD
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .1 ...NORMAL
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR STB.COUT1
|
||||
PLA
|
||||
ORA #$80 MAKE PRINTABLE CHARACTER
|
||||
CMP #$A0
|
||||
BCS .2
|
||||
ORA #$40
|
||||
.2 JSR STB.COUT1
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.1 JMP STB.COUT1
|
||||
*--------------------------------
|
||||
STB.PICK.SCREEN
|
||||
STX $481
|
||||
TYA
|
||||
STA $482
|
||||
JSR STB.HTAB
|
||||
JSR STB.SCREEN
|
||||
LDY $482
|
||||
LDX $481
|
||||
RTS
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/io.s.stb80
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
457
SCMASM.30/SCI.S.CAT.txt
Normal file
457
SCMASM.30/SCI.S.CAT.txt
Normal file
@ -0,0 +1,457 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* CATALOG COMMAND
|
||||
*--------------------------------
|
||||
CAT
|
||||
LDA #39
|
||||
.HS 2C SKIP OVER TWO BYTES
|
||||
CATALOG
|
||||
LDA #79
|
||||
STA CAT.WIDTH
|
||||
LDA #0 CLEAR ACCUMULATED BLOCKS COUNTER
|
||||
STA BLOCKS
|
||||
STA BLOCKS+1
|
||||
LDA FBITS TEST FOR TYPE AND PATHNAME
|
||||
AND #$05
|
||||
LSR PATHNAME BIT INTO CARRY
|
||||
BNE .1 ...TYPE STATED
|
||||
STA VAL.T SET T=0, LIST ALL TYPES
|
||||
.1 BCS .2 ...PATH GIVEN
|
||||
JSR GET.FILE.INFO NONE STATED, GET PREFIX
|
||||
BCS .8 ...ERROR
|
||||
*---GET DIRECTORY----------------
|
||||
.2 JSR OPEN.READ.DIR.HEADER
|
||||
BCS .8 ...ERROR
|
||||
LDY #0 Print directory pathname
|
||||
.15 LDA PATHNAME.ONE.BUFFER+1,Y
|
||||
ORA #$80
|
||||
JSR COUT
|
||||
INY
|
||||
CPY PATHNAME.ONE.BUFFER
|
||||
BCC .15
|
||||
JSR CROUT
|
||||
*---PRINT TITLES-----------------
|
||||
LDA #Q.DIRHDR
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
JSR PRINT.CATALOG.LINE
|
||||
*---IF NO MORE FILES, FINISHED---
|
||||
.3 LDA FILE.COUNT ANY FILES LEFT?
|
||||
ORA FILE.COUNT+1
|
||||
BEQ .7 ...NO, FINISHED
|
||||
*---NEXT FILE DESCRIPTION--------
|
||||
JSR READ.NEXT.ENTRY
|
||||
BCS .8 ...ERROR
|
||||
LDA VAL.T CHECK IF WE LIKE THIS TYPE
|
||||
BEQ .4 ...WE LIKE THEM ALL
|
||||
CMP DIRBUF+16 FILE TYPE
|
||||
BNE .5 ...NO, SKIP OVER IT
|
||||
.4 JSR FORMAT.CAT.ENTRY
|
||||
JSR PRINT.CATALOG.LINE PRINT IT
|
||||
*---CHECK FOR PAUSE/ABORT--------
|
||||
.5 JSR CHECK.KEY SEE IF KEYPRESS
|
||||
BMI .3 ...NO, CONTINUE CATALOG
|
||||
BEQ .7 ...<CR> or <ESC>, abort
|
||||
*---<CR> or <ESC>, so abort------
|
||||
.6 JSR CHECK.KEY
|
||||
BMI .6 WAIT FOR KEY
|
||||
BNE .3 ...NOT CR OR ESC, CONTINUE
|
||||
*---<CR> or <ESC>, abort---------
|
||||
.7 LDX CAT.INDEX
|
||||
LDA FILE.REFNUMS,X
|
||||
JSR CLOSE.ONE.FILE
|
||||
BCS .8 ...ERROR
|
||||
JMP FREE.BLOCKS FORMAT BLOCKS FREE ETC.
|
||||
.8 RTS
|
||||
*--------------------------------
|
||||
CHECK.KEY
|
||||
LDA $C000 SEE IF KEYSTROKE
|
||||
BPL .1 ...NO
|
||||
STA $C010 ...YES, CLEAR STROBE
|
||||
.1 EOR #$8D SET .EQ. IF <RET>
|
||||
BEQ .2 ...YES
|
||||
EOR #$8D^$9B OR IF <ESC>
|
||||
.2 RTS .MI. IF NO KEY
|
||||
*--------------------------------
|
||||
* FORMAT BLOCKS FREE/INUSE
|
||||
*--------------------------------
|
||||
FREE.BLOCKS
|
||||
JSR ZERO.ACCUM
|
||||
JSR BLANK.WBUF
|
||||
LDA #Q.BLOCKS.ABOVE
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
LDA BLOCKS
|
||||
LDX BLOCKS+1
|
||||
LDY #24
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
JSR PRINT.MESSAGE
|
||||
*--------------------------------
|
||||
LDA #PATHNAME.ONE.BUFFER+1 set up ONLINE call
|
||||
STA MISC.PARMS+2 to read volume name
|
||||
LDA /PATHNAME.ONE.BUFFER+1
|
||||
STA MISC.PARMS+3
|
||||
LDA UNIT
|
||||
STA MISC.PARMS+1
|
||||
JSR MLI.C5 ONLINE
|
||||
BCS .1 ...ERROR
|
||||
*---Setup GET FILE INFO call-----
|
||||
LDA PATHNAME.ONE.BUFFER+1
|
||||
AND #$0F
|
||||
TAX
|
||||
INX
|
||||
STX PATHNAME.ONE.BUFFER
|
||||
LDA #"/"
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
JSR GET.FILE.INFO
|
||||
BCS .1 ...ERROR
|
||||
*---Format the bottom line-------
|
||||
JSR BLANK.WBUF
|
||||
LDA #Q.BLOCKS
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
*---Total Blocks in Volume-------
|
||||
LDA GET.SET.PARMS+5
|
||||
LDX GET.SET.PARMS+6
|
||||
LDY #51
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---Blocks Used in Volume--------
|
||||
LDA GET.SET.PARMS+8
|
||||
LDX GET.SET.PARMS+9
|
||||
LDY #24
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---Blocks Free in Volume--------
|
||||
LDA GET.SET.PARMS+5
|
||||
SEC
|
||||
SBC GET.SET.PARMS+8
|
||||
PHA
|
||||
LDA GET.SET.PARMS+6
|
||||
SBC GET.SET.PARMS+9
|
||||
TAX
|
||||
PLA
|
||||
LDY #37
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
JSR PRINT.CATALOG.LINE
|
||||
CLC
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* OPEN/READ DIRECTORY HEADER
|
||||
*--------------------------------
|
||||
OPEN.READ.DIR.HEADER
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
STX CAT.INDEX
|
||||
LDX #$0F IS STORAGE TYPE = VOL DIR?
|
||||
CPX GET.SET.PARMS+7
|
||||
BNE .1 ...NO
|
||||
STX GET.SET.PARMS+4 ...YES, MAKE TYPE = DIR
|
||||
.1 LDA #$01 FILE MUST BE READABLE
|
||||
JSR OPEN.DIRECTORY
|
||||
BCS .3 ...ERROR
|
||||
|
||||
LDX CAT.INDEX
|
||||
STA FILE.REFNUMS,X
|
||||
LDA #DIRBUF
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /DIRBUF
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #$2B
|
||||
STA READ.WRITE.PARMS+4
|
||||
STA MISC.PARMS+2
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ
|
||||
BCS .3
|
||||
LDX #3
|
||||
.2 LDA DIRBUF+35,X ENTRY LENGTH, ENTRIES/BLOCK,
|
||||
STA ENTRY.LENGTH,X and FILE COUNT
|
||||
DEX
|
||||
BPL .2
|
||||
LDA #1
|
||||
STA ENTRY.COUNTER
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
* READ NEXT DIRECTORY ENTRY
|
||||
*--------------------------------
|
||||
READ.NEXT.ENTRY
|
||||
.1 LDY ENTRY.COUNTER
|
||||
CPY ENTRIES.PER.BLOCK
|
||||
BCC .2
|
||||
*---Skip ahead remainder bytes---
|
||||
LDA #4
|
||||
SBC MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+4
|
||||
JSR MLI.CA
|
||||
BCS .4 ...ERROR
|
||||
LDY #0
|
||||
LDA #4
|
||||
STA MISC.PARMS+2
|
||||
*---Read a file description------
|
||||
.2 INY NEXT ENTRY
|
||||
STY ENTRY.COUNTER
|
||||
LDA ENTRY.LENGTH
|
||||
STA READ.WRITE.PARMS+4
|
||||
ADC MISC.PARMS+2
|
||||
STA MISC.PARMS+2
|
||||
JSR MLI.CA READ
|
||||
BCS .4 ...ERROR
|
||||
*---Check if deleted file--------
|
||||
LDA DIRBUF
|
||||
AND #$F0
|
||||
BEQ .1 ...deleted
|
||||
*---Count the file---------------
|
||||
LDA FILE.COUNT
|
||||
BNE .3
|
||||
DEC FILE.COUNT+1
|
||||
.3 DEC FILE.COUNT
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* FORMAT CATALOG ENTRY LINE
|
||||
*--------------------------------
|
||||
FORMAT.CAT.ENTRY
|
||||
JSR BLANK.WBUF
|
||||
LDA DIRBUF LENGTH OF FILENAME
|
||||
AND #$0F
|
||||
TAY
|
||||
.1 LDA DIRBUF,Y
|
||||
ORA #$80
|
||||
STA WBUF+7,Y
|
||||
DEY
|
||||
BNE .1
|
||||
STY ACCUM+2
|
||||
*---GET FILE TYPE----------------
|
||||
LDA DIRBUF+16 FILE TYPE
|
||||
LDX #LAST.FILE.TYPE
|
||||
LDY #3 POINT INTO WBUF
|
||||
.2 CMP FILE.TYPES,X
|
||||
BEQ .3 ...MATCH!
|
||||
DEX
|
||||
DEX
|
||||
DEX
|
||||
DEX
|
||||
BPL .2
|
||||
JSR CONVERT.TO.HEX
|
||||
JMP .6
|
||||
.3 DEX
|
||||
LDA FILE.TYPES,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
BNE .3
|
||||
*---SKIP IF 40-COLUMN------------
|
||||
BIT CAT.WIDTH
|
||||
BVC .7
|
||||
*---Display AuxType--------------
|
||||
LDY #"R" Use "R=" if type TXT
|
||||
LDA DIRBUF+16 FILE TYPE
|
||||
CMP #$04
|
||||
BEQ .5 ...it is TXT
|
||||
CMP #$06 Use "A=" if type BIN
|
||||
BNE .6 ...not BIN, just show $xxxx
|
||||
LDY #"A" ...BIN
|
||||
.5 STY WBUF+73
|
||||
LDA #"="
|
||||
STA WBUF+74
|
||||
.6 LDY #78
|
||||
LDA DIRBUF+31 AUXTYPE
|
||||
JSR CONVERT.TO.HEX
|
||||
LDA DIRBUF+32 "
|
||||
JSR CONVERT.TO.HEX
|
||||
*---Show file length-------------
|
||||
LDA DIRBUF+23 EOF MARK MSB
|
||||
STA ACCUM+2
|
||||
LDA DIRBUF+21 EOF MARK
|
||||
LDX DIRBUF+22 " "
|
||||
LDY #70
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---CREATION DATE/TIME-----------
|
||||
LDX #$18 OFFSET IN DIRBUF
|
||||
LDY #61 OFFSET IN WBUF
|
||||
JSR FORMAT.DATE.AND.TIME
|
||||
*---Blocks in the file-----------
|
||||
.7 LDY #27
|
||||
LDA DIRBUF+19 BLOCKS IN USE
|
||||
LDX DIRBUF+20 "
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
CLC
|
||||
LDA BLOCKS
|
||||
ADC DIRBUF+19
|
||||
STA BLOCKS
|
||||
LDA BLOCKS+1
|
||||
ADC DIRBUF+20
|
||||
STA BLOCKS+1
|
||||
*---Access code------------------
|
||||
LDA DIRBUF+30 ACCESS
|
||||
AND #$C2
|
||||
CMP #$C2
|
||||
BEQ .8
|
||||
LDA #"*" LOCKED
|
||||
STA WBUF+1
|
||||
*---Modified Date/Time-----------
|
||||
.8 LDX #$21 OFFSET IN DIRBUF
|
||||
LDY #44 OFFSET IN WBUF
|
||||
*--------------------------------
|
||||
* FORMAT DATE & TIME
|
||||
* --MSB--- --LSB---
|
||||
* YYYYYYYM MMMDDDDD
|
||||
*--------------------------------
|
||||
FORMAT.DATE.AND.TIME
|
||||
LDA DIRBUF,X MMMDDDDD
|
||||
AND #$1F 000DDDDD
|
||||
BEQ .1 ...DAY=0, NO DATE
|
||||
STA DAY
|
||||
LDA DIRBUF+1,X YYYYYYYM
|
||||
LSR 0YYYYYYY
|
||||
STA YEAR
|
||||
CMP #100
|
||||
BCS .1 ...YEAR>99, NO DATE
|
||||
LDA DIRBUF+1,X YYYYYYYM
|
||||
LSR M INTO CARRY
|
||||
LDA DIRBUF,X MMMDDDDD
|
||||
ROL MMDDDDDM M
|
||||
ROL MDDDDDMM M
|
||||
ROL DDDDDMMM M
|
||||
ROL DDDDMMMM
|
||||
AND #$0F 0000MMMM
|
||||
BEQ .1 ...MONTH=0, NO DATE
|
||||
CMP #13
|
||||
BCC .3 ...MONTH=1...12, GOOD
|
||||
*---Format <NO DATE>-------------
|
||||
.1 TYA
|
||||
SEC
|
||||
SBC #6 BACK UP OVER TIME SLOT
|
||||
TAY
|
||||
LDX #8
|
||||
.2 LDA NO.DATE.MSG,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
DEX
|
||||
BPL .2
|
||||
RTS
|
||||
*---Format date, time------------
|
||||
.3 STA MONTH
|
||||
LDA DIRBUF+3,X HOURS
|
||||
PHA
|
||||
LDA DIRBUF+2,X MINUTES
|
||||
LDX #0 HIGH BYTE
|
||||
CMP #60 IF > 59, USE 0
|
||||
BCC .4 0...59
|
||||
TXA
|
||||
.4 JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDA #":" SEPARATE WITH ":"
|
||||
STA WBUF+2,Y
|
||||
PLA HOURS
|
||||
LDX #0 HIGH BYTE
|
||||
CMP #24 IF > 24, USE 0
|
||||
BCC .5 0...23
|
||||
TXA
|
||||
.5 JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDA YEAR
|
||||
JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDX MONTH
|
||||
LDA MONTH.NAMES-1+24,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA MONTH.NAMES-1+12,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA MONTH.NAMES-1,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA #"-"
|
||||
STA WBUF+5,Y
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA DAY
|
||||
LDX #0 HIGH BYTE
|
||||
* JMP CONVERT.TO.DECIMAL
|
||||
*--------------------------------
|
||||
* CONVERT TO DECIMAL
|
||||
*--------------------------------
|
||||
CONVERT.TO.DECIMAL
|
||||
STX ACCUM+1
|
||||
STA ACCUM
|
||||
.1 JSR DIVIDE.ACCUM.BY.TEN
|
||||
ORA #$B0
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA ACCUM
|
||||
ORA ACCUM+1
|
||||
ORA ACCUM+2
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONVERT 2 DIGIT NUMBER
|
||||
*--------------------------------
|
||||
CONVERT.DECIMAL.TWO.DIGITS
|
||||
CLC
|
||||
ADC #100 FORCE TWO DIGITS TO PRINT
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
LDA #" " COVER UP THE "1"
|
||||
INY
|
||||
*--------------------------------
|
||||
STUFF.WBUF.AND.BACKUP
|
||||
STA WBUF+1,Y
|
||||
DEY
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONVERT TO HEX
|
||||
*--------------------------------
|
||||
CONVERT.TO.HEX
|
||||
PHA
|
||||
AND #$0F
|
||||
JSR .1
|
||||
PLA
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
.1 ORA #$B0
|
||||
CMP #$BA
|
||||
BCC .2
|
||||
ADC #6
|
||||
.2 JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA #"$"
|
||||
STA WBUF+1,Y
|
||||
RTS
|
||||
*--------------------------------
|
||||
* DIVIDE ACCUM BY TEN
|
||||
*--------------------------------
|
||||
* DIVIDE 24-BIT VALUE IN ACCUM BY TEN
|
||||
* RETURN REMAINDER IN A-REG
|
||||
*--------------------------------
|
||||
DIVIDE.ACCUM.BY.TEN
|
||||
LDX #24 24 BITS IN DIVIDEND
|
||||
LDA #0 START WITH REM=0
|
||||
.1 JSR SHIFT.ACCUM.LEFT
|
||||
ROL
|
||||
CMP #10
|
||||
BCC .2 ...STILL < 10
|
||||
SBC #10
|
||||
INC ACCUM QUOTIENT BIT
|
||||
.2 DEX NEXT BIT
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
BLANK.WBUF
|
||||
LDA #" "
|
||||
LDY #79
|
||||
.1 JSR STUFF.WBUF.AND.BACKUP
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
NOW JSR GP.MLI
|
||||
.DA #$82,0000
|
||||
JSR BLANK.WBUF
|
||||
LDX #4
|
||||
.1 LDA GP.DATE-1,X
|
||||
STA DIRBUF-1,X
|
||||
DEX
|
||||
BNE .1
|
||||
LDY #15
|
||||
JSR FORMAT.DATE.AND.TIME
|
||||
LDA #20
|
||||
STA CAT.WIDTH
|
||||
*** JMP PRINT.CATALOG.LINE
|
||||
*--------------------------------
|
||||
PRINT.CATALOG.LINE
|
||||
LDX CAT.WIDTH
|
||||
LDA #$8D
|
||||
STA WBUF+1,X
|
||||
JSR PRINT.MESSAGE
|
||||
CLC because a SEC would indicate ERROR
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.cat
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
562
SCMASM.30/SCI.S.CPAR.txt
Normal file
562
SCMASM.30/SCI.S.CPAR.txt
Normal file
@ -0,0 +1,562 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DA COMMAND.TABLE needed for HELP command
|
||||
*--------------------------------
|
||||
* PARSE COMMAND LINE
|
||||
*--------------------------------
|
||||
PARSE.COMMAND
|
||||
JSR SCAN.COMMAND.TABLE
|
||||
BCS SYNERR2 ...SYNTAX ERROR
|
||||
LDA #0
|
||||
STA FBITS
|
||||
STA FBITS+1
|
||||
STA PATHNAME.TWO.BUFFER
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
LDA D.SLOT
|
||||
STA VAL.S
|
||||
LDA D.DRIV
|
||||
STA VAL.D
|
||||
*---Handle special cases---------
|
||||
BIT PBITS Check for PR# or IN#
|
||||
BVS PARSE.INPR PR# & IN# commands
|
||||
BPL .1 ...not CAT(ALOG) or PREFIX
|
||||
JSR MLI.C7 ...CAT, CATALOG, or PREFIX
|
||||
*---TEST CHAR AFTER COMMAND------
|
||||
.1 JSR GET.NEXT.NONBLANK
|
||||
BNE .2 ...not comma or <CR>
|
||||
BCC .5 ...<CR> already
|
||||
JMP GET.ANOTHER.PARM
|
||||
*---Get a pathname---------------
|
||||
.2 CMP #'/' MUST START WITH "/" OR LETTER
|
||||
BEQ .3
|
||||
CMP #'A'
|
||||
BCC SYNERR2 ...SYNTAX ERROR
|
||||
.3 DEX RE-SCAN THE FIRST CHAR OF PATH
|
||||
LDY #0
|
||||
.4 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
STA PATHNAME.ONE.BUFFER+1,Y
|
||||
JSR STORE.PATH.TWO.AND.TEST
|
||||
BCC .4
|
||||
DEY
|
||||
STY PATHNAME.ONE.BUFFER
|
||||
STY PATHNAME.TWO.BUFFER
|
||||
LDA #$01 TELL THE WORLD ABOUT IT
|
||||
STA FBITS
|
||||
*--------------------------------
|
||||
DEX RE-SCAN CHAR AFTER PATHNAME
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE SYNERR2 ...NOT COMMA OR <CR>
|
||||
BCS MORE.PARMS ...COMMA
|
||||
.5 JMP NO.MORE.PARMS ...<CR>
|
||||
SYNERR2
|
||||
JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
* PR# or IN# commands
|
||||
*--------------------------------
|
||||
PARSE.INPR
|
||||
JSR GET.NEXT.NONBLANK CHAR AFTER COMMAND
|
||||
BEQ SYNERR2 ...comma or <CR>
|
||||
DEX ...IN CASE IT IS "Axxx"
|
||||
CMP #'A'
|
||||
BEQ GET.ANOTHER.PARM ...HANDLE PR#Axxx or IN#Axxx
|
||||
INX RESTORE X
|
||||
JSR ZERO.ACCUM
|
||||
STY PARM.LENM1 Y=0, 1 BYTE PARM
|
||||
LDY #VAL.LB-VAL.A PARM OFFSET FROM VAL.A
|
||||
STY PARM.OFFSET
|
||||
LDY #$40
|
||||
STY FBITS
|
||||
JSR CONVERT.DECIMAL.NUMBER
|
||||
BCS RTS4
|
||||
LDA VAL.LB
|
||||
CMP #$08
|
||||
BCC TEST.IF.MORE.PARMS
|
||||
SCI.ERR.RANGE
|
||||
LDA #$02
|
||||
SEC
|
||||
RTS4 RTS
|
||||
*--------------------------------
|
||||
MORE.PARMS
|
||||
LDA PBITS
|
||||
LSR TEST BIT 0
|
||||
BCC SYNERR2 ...NO PATHNAME EXPECTED
|
||||
LSR TEST BIT 1
|
||||
BCC GET.ANOTHER.PARM ...NO PATH-TWO EXPECTED
|
||||
*---Get second pathname----------
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR2 ...COMMA OR <CR>
|
||||
DEX RE-SCAN FIRST CHAR OF PATHNAME
|
||||
LDY #0
|
||||
.1 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
JSR STORE.PATH.TWO.AND.TEST
|
||||
BCC .1
|
||||
DEY
|
||||
STY PATHNAME.TWO.BUFFER
|
||||
LDA #$03 WE GOT TWO PATHNAMES, SO
|
||||
STA FBITS MARK THE BITS
|
||||
DEX RE-SCAN TERM. CHAR
|
||||
*--------------------------------
|
||||
TEST.IF.MORE.PARMS
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE SYNERR2
|
||||
BCC NO.MORE.PARMS
|
||||
GET.ANOTHER.PARM
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR2 ...NULL PARAMETER
|
||||
JSR PARSE.PARAMETER
|
||||
BCC TEST.IF.MORE.PARMS
|
||||
RTS ...error return
|
||||
*--------------------------------
|
||||
NO.MORE.PARMS
|
||||
LDA VAL.S CHECK RANGE OF S AND D
|
||||
BEQ SCI.ERR.RANGE
|
||||
CMP #$08
|
||||
BCS SCI.ERR.RANGE
|
||||
LDA VAL.D
|
||||
BEQ SCI.ERR.RANGE
|
||||
CMP #$03
|
||||
BCS SCI.ERR.RANGE
|
||||
*---CHECK IF DEFERRED COMMAND----
|
||||
LDA PBITS (only OPEN and WRITE are deferred)
|
||||
AND #$21
|
||||
LSR
|
||||
BEQ .1 ...NOT DEFERRED
|
||||
LDA STATE ...ARE WE IN DIRECT MODE?
|
||||
BEQ .6 ...YES, DEFERRED IS ILLEGAL
|
||||
*---CHECK PATHNAME---------------
|
||||
.1 BCC .5 ...NO PATH PERMITTED
|
||||
LDA PBITS+1
|
||||
AND #$04 S OR D OK?
|
||||
BEQ .5 ...NO
|
||||
LDA FBITS
|
||||
LSR HAVE WE A PATHNAME?
|
||||
BCS .2 ...YES
|
||||
LDA PBITS ...NO, IS PATH NEEDED
|
||||
AND #$90
|
||||
BEQ ERR.SYNTAX ...YES
|
||||
BPL .5
|
||||
*---NEED PREFIX OR S,D-----------
|
||||
.2 LDA PATHNAME.ONE.BUFFER+1
|
||||
EOR #'/' SLASH
|
||||
BEQ .3 ...EXPLICIT PREFIX
|
||||
LDA PREFIX.FLAG MLI's flag
|
||||
BEQ .4 ...NO PREFIX IS SET
|
||||
.3 LDA FBITS+1 DID WE GET S,D?
|
||||
AND #$04
|
||||
BEQ .5 ...NO
|
||||
BCS .4 ...YES, AND THERE IS A PATHNAME
|
||||
LDA #0 ...YES, BUT NO PATHNAME
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
LDA #$01 SIGNAL WE GOT PATHNAME AFTER ALL
|
||||
ORA FBITS
|
||||
STA FBITS
|
||||
.4 JSR INSERT.VOLUME.NAME
|
||||
BCS .7
|
||||
*---BRANCH TO COMMAND------------
|
||||
.5 CLC SIGNAL NO ERROR
|
||||
LDA COMMAND.NUMBER
|
||||
BEQ EXTERNAL ...USER'S COMMAND
|
||||
EOR #CN.PREFIX
|
||||
BEQ INTERNAL ...PREFIX COMMAND
|
||||
LDA PBITS+1 ARE S/D VALID?
|
||||
AND #$04
|
||||
BEQ INTERNAL ...NO
|
||||
LDA FBITS ANY PATHNAME SPECIFIED?
|
||||
LSR
|
||||
BCC INTERNAL ...NO
|
||||
JSR GET.FILE.INFO ...YES
|
||||
BCC INTERNAL ...NO ERROR
|
||||
ORA #0 ...ERROR, WAS IT "FILE NOT FOUND"?
|
||||
BPL .7 ...NO, REAL ERROR
|
||||
LDA PBITS OKAY TO CREATE PATHNAME?
|
||||
AND #$08
|
||||
BNE INTERNAL ...YES
|
||||
LDA #$06 "PATH NOT FOUND"
|
||||
.HS 2C
|
||||
.6 LDA #$0F "NOT DIRECT COMMAND"
|
||||
SEC
|
||||
.7 RTS
|
||||
*--------------------------------
|
||||
INTERNAL JMP (COMMAND.ADDR)
|
||||
EXTERNAL JMP (EXTERNAL.COMMAND.HANDLER)
|
||||
*--------------------------------
|
||||
ERR.SYNTAX
|
||||
LDA #$10 SYNTAX ERROR
|
||||
ERRR SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* INSERT PREFIX BEFORE PATHNAME
|
||||
*--------------------------------
|
||||
INSERT.VOLUME.NAME
|
||||
LDA VAL.S BUILD UNIT # FROM SLOT,DRIVE
|
||||
TAY SAVE VAL.S
|
||||
LSR 0000.00SS S
|
||||
ROR S000.000S S
|
||||
ROR SS00.0000 S
|
||||
ROR SSS0.0000 0
|
||||
LDX VAL.D
|
||||
CPX #2 .CS. if 2, .CC. if 1
|
||||
ROR DSSS.0000
|
||||
STA MISC.PARMS+1
|
||||
LDA #WBUF+1
|
||||
STA MISC.PARMS+2
|
||||
LDA /WBUF+1
|
||||
STA MISC.PARMS+3
|
||||
JSR MLI.C5 ONLINE -- READ VOLUME NAME
|
||||
BCS .4 NO SUCH SLOT AND DRIVE
|
||||
STX D.DRIV UPDATE DEFAULT S AND D
|
||||
STY D.SLOT
|
||||
*--------------------------------
|
||||
LDA PATHNAME.ONE.BUFFER+1
|
||||
EOR #'/' ALREADY HAVE VOLUME NAME?
|
||||
BEQ .4 ...YES, DON'T NEED ANOTHER
|
||||
*---ISOLATE VOLNAME LENGTH-------
|
||||
LDA WBUF+1 DSSSLLLL
|
||||
AND #$0F 0000LLLL
|
||||
STA WBUF+1
|
||||
*---MOVE PATHNAMES OVER L+2------
|
||||
LDY #62
|
||||
TYA
|
||||
SEC
|
||||
SBC WBUF+1
|
||||
TAX
|
||||
.1 LDA PATHNAME.ONE.BUFFER,X
|
||||
STA PATHNAME.ONE.BUFFER+2,Y
|
||||
LDA PATHNAME.TWO.BUFFER,X
|
||||
STA PATHNAME.TWO.BUFFER+2,Y
|
||||
DEY
|
||||
DEX
|
||||
BNE .1
|
||||
*---INSERT VOLUME SLASHES--------
|
||||
LDA #'/'
|
||||
STA PATHNAME.ONE.BUFFER+2,Y
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
STA PATHNAME.TWO.BUFFER+2,Y
|
||||
STA PATHNAME.TWO.BUFFER+1
|
||||
*---COPY VOLUME NAME-------------
|
||||
.2 LDA WBUF+1,Y
|
||||
STA PATHNAME.ONE.BUFFER+1,Y
|
||||
STA PATHNAME.TWO.BUFFER+1,Y
|
||||
DEY
|
||||
BNE .2
|
||||
*---UPDATE PATH LENGTHS----------
|
||||
CLC
|
||||
LDA WBUF+1
|
||||
ADC #2 INCLUDE SLASHES
|
||||
TAY
|
||||
ADC PATHNAME.ONE.BUFFER
|
||||
CMP #64
|
||||
.3 BCS ERR.SYNTAX
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
TYA
|
||||
ADC PATHNAME.TWO.BUFFER
|
||||
STA PATHNAME.TWO.BUFFER
|
||||
CMP #64
|
||||
BCS .3 ...BRIDGE TO SYNTAX ERROR
|
||||
*--------------------------------
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
SCAN.COMMAND.TABLE
|
||||
LDY #0 PNTR INTO COMMAND TABLE
|
||||
STY COMMAND.NUMBER
|
||||
DEY
|
||||
*---COMPARE COMMAND NAME---------
|
||||
.1 INC COMMAND.NUMBER
|
||||
LDX #0 PNTR INTO WBUF
|
||||
.2 INY next byte in command table
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ .4 ...end of WBUF contents
|
||||
EOR COMMAND.TABLE,Y
|
||||
BEQ .2 ...same so far
|
||||
ASL Might be last char
|
||||
BNE .4 ...No, try next command
|
||||
*---We found the command---------
|
||||
LDA COMMAND.TABLE+1,Y
|
||||
STA COMMAND.ADDR
|
||||
LDA COMMAND.TABLE+2,Y
|
||||
STA COMMAND.ADDR+1
|
||||
LDA COMMAND.TABLE+3,Y
|
||||
STA PBITS
|
||||
LDA COMMAND.TABLE+4,Y
|
||||
STA PBITS+1
|
||||
CLC
|
||||
RTS
|
||||
*---SKIP TO NEXT COMMAND---------
|
||||
.3 INY
|
||||
.4 LDA COMMAND.TABLE,Y
|
||||
BPL .3 ...NOT LAST CHAR YET
|
||||
INY SKIP OVER ADDRESS
|
||||
INY
|
||||
INY SKIP OVER PBITS
|
||||
INY
|
||||
LDA COMMAND.TABLE+1,Y
|
||||
BNE .1 ...more commands in table
|
||||
*---TRY EXTERNAL COMMAND---------
|
||||
LDA #$FF
|
||||
STA COMMAND.NUMBER
|
||||
SEC
|
||||
JMP SCI.USER.CMD
|
||||
*--------------------------------
|
||||
SYNERR1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
PARSE.PARAMETER
|
||||
JSR ZERO.ACCUM
|
||||
LDY #NO.PARM.NAMES-1
|
||||
.1 CMP PARM.NAMES,Y
|
||||
BEQ FOUND.PARM
|
||||
DEY
|
||||
BPL .1
|
||||
CMP #'T'
|
||||
BNE SYNERR1 ...SYNTAX ERROR
|
||||
*---PARSE T PARAMETER------------
|
||||
LDA #$04
|
||||
AND PBITS
|
||||
BEQ ERR.BADPARM
|
||||
ORA FBITS
|
||||
STA FBITS
|
||||
LDA #0 SINGLE BLYTE
|
||||
STA PARM.LENM1
|
||||
LDA #VAL.T-VAL.A PARM OFFSET FROM VAL.A
|
||||
STA PARM.OFFSET
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR1
|
||||
CMP #'$'
|
||||
BEQ CONVERT.HEX.NUMBER
|
||||
CMP #'A'
|
||||
BCC CONVERT.DECIMAL.NUMBER
|
||||
JMP CONVERT.FILE.TYPE
|
||||
*--------------------------------
|
||||
ERR.BADPARM
|
||||
SEC "INVALID PARAMETER"
|
||||
LDA #$0B
|
||||
RTS
|
||||
*--------------------------------
|
||||
FOUND.PARM
|
||||
LDA PARM.MASKS,Y
|
||||
BEQ .2
|
||||
AND PBITS+1
|
||||
BEQ ERR.BADPARM
|
||||
CMP #$04 IS IT S OR D
|
||||
BNE .1 ...NO
|
||||
AND FBITS+1 ...YES, DID WE ALREADY HAVE S OR D
|
||||
BNE .2 ...YES
|
||||
LDA #1 ...NO, SET D=1
|
||||
STA VAL.D
|
||||
LDA #$04
|
||||
.1 ORA FBITS+1
|
||||
STA FBITS+1
|
||||
.2 LDA PARM.VARIABLES,Y
|
||||
AND #$03
|
||||
STA PARM.LENM1
|
||||
LDA PARM.VARIABLES,Y
|
||||
LSR
|
||||
LSR
|
||||
STA PARM.OFFSET
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
CMP #'$'
|
||||
BEQ CONVERT.HEX.NUMBER
|
||||
*--------------------------------
|
||||
CONVERT.DECIMAL.NUMBER
|
||||
STX COMMAND.LINE.LENGTH
|
||||
JSR ACCUMULATE.DECIMAL.DIGIT
|
||||
BCC .1
|
||||
BMI GO.ERR.RANGE.1
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
.1 LDX COMMAND.LINE.LENGTH
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE CONVERT.DECIMAL.NUMBER
|
||||
BEQ CHECK.PARAMETER.RANGE
|
||||
*--------------------------------
|
||||
CONVERT.HEX.NUMBER
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
.1 STX COMMAND.LINE.LENGTH
|
||||
JSR ACCUMULATE.HEX.DIGIT
|
||||
BCC .2
|
||||
BMI GO.ERR.RANGE.1
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
.2 LDX COMMAND.LINE.LENGTH
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE .1
|
||||
*--------------------------------
|
||||
CHECK.PARAMETER.RANGE
|
||||
LDX #$02
|
||||
.1 CPX PARM.LENM1
|
||||
BEQ .2
|
||||
LDA ACCUM,X
|
||||
BNE GO.ERR.RANGE.1
|
||||
DEX
|
||||
BNE .1
|
||||
.2 LDY PARM.OFFSET
|
||||
.3 LDA ACCUM,X
|
||||
STA VAL.A,Y
|
||||
DEY
|
||||
DEX
|
||||
BPL .3
|
||||
LDX COMMAND.LINE.LENGTH
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
GO.ERR.SYNTAX.1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
GO.ERR.RANGE.1 JMP SCI.ERR.RANGE
|
||||
*--------------------------------
|
||||
CONVERT.FILE.TYPE
|
||||
STA ACCUM+2 1ST LETTER
|
||||
LDY #2 GET 2ND AND 3RD
|
||||
.1 JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
STA ACCUM-1,Y STORE THEM BACKWARDS
|
||||
DEY
|
||||
BNE .1 ...UNTIL Y=0
|
||||
STX COMMAND.LINE.LENGTH SAVE X-REG
|
||||
.2 LDX #2 COMPARE NEXT ENTRY
|
||||
.3 LDA ACCUM,X
|
||||
EOR FILE.TYPES,Y
|
||||
INY
|
||||
ASL IGNORE BIT 7
|
||||
BNE .4 ...NOT THE SAME
|
||||
DEX NEXT CHAR
|
||||
BPL .3
|
||||
LDA FILE.TYPES,Y
|
||||
STA VAL.T
|
||||
LDX COMMAND.LINE.LENGTH RESTORE X-REG
|
||||
CLC
|
||||
RTS
|
||||
.4 INY
|
||||
DEX
|
||||
BPL .4
|
||||
CPY #LAST.FILE.TYPE
|
||||
BCC .2
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
*--------------------------------
|
||||
* GET NEXT NON-BLANK CHAR FROM WBUF
|
||||
* CHAR Z C
|
||||
* <CR> YES CLR
|
||||
* COMMA YES SET
|
||||
* OTHER NO ?
|
||||
*--------------------------------
|
||||
GET.NEXT.NONBLANK
|
||||
.1 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
CMP #' '
|
||||
BEQ .1 IGNORE BLANKS
|
||||
CMP #','
|
||||
BEQ .2 .CS. and .EQ.
|
||||
CMP #$0D .EQ. if <CR>
|
||||
CLC .CC.
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
GET.NEXT.CHAR.FROM.WBUF
|
||||
LDA WBUF,X
|
||||
BNE .1 MAKE 00==8D
|
||||
LDA #$0D
|
||||
.1 AND #$7F
|
||||
CMP #$60 CONVERT LOWER CASE TO UPPER
|
||||
BCC .2
|
||||
AND #$5F
|
||||
.2 INX
|
||||
RTS
|
||||
*--------------------------------
|
||||
ACCUMULATE.DECIMAL.DIGIT
|
||||
CMP #$30
|
||||
BCC .1
|
||||
CMP #$3A
|
||||
BCC .2
|
||||
.1 SEC
|
||||
ORA #0
|
||||
RTS
|
||||
*--------------------------------
|
||||
.2 AND #$0F
|
||||
PHA
|
||||
LDA ACCUM+2
|
||||
CMP #$1A
|
||||
BCS .5
|
||||
LDX #$02
|
||||
.3 LDA ACCUM,X
|
||||
PHA
|
||||
DEX
|
||||
BPL .3
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
LDX #0
|
||||
CLC
|
||||
.4 PLA
|
||||
ADC ACCUM,X
|
||||
STA ACCUM,X
|
||||
INX
|
||||
TXA
|
||||
EOR #$03
|
||||
BNE .4
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
.5 PLA
|
||||
BCS TOOBIG
|
||||
ADC ACCUM
|
||||
STA ACCUM
|
||||
BCC RTS1
|
||||
CLC
|
||||
INC ACCUM+1
|
||||
BNE RTS1
|
||||
INC ACCUM+2
|
||||
BNE RTS1
|
||||
TOOBIG LDA #$FF
|
||||
SEC
|
||||
RTS1 RTS
|
||||
*--------------------------------
|
||||
ACCUMULATE.HEX.DIGIT
|
||||
CMP #'0'
|
||||
BCC .1
|
||||
CMP #'9'+1
|
||||
BCC .3
|
||||
CMP #'A'
|
||||
BCC .1
|
||||
CMP #'F'+1
|
||||
BCC .2
|
||||
.1 SEC
|
||||
ORA #0
|
||||
RTS
|
||||
.2 SBC #$06
|
||||
.3 AND #$0F
|
||||
LDX #$03
|
||||
.4 JSR SHIFT.ACCUM.LEFT
|
||||
BCS TOOBIG
|
||||
DEX
|
||||
BPL .4
|
||||
ORA ACCUM
|
||||
STA ACCUM
|
||||
RTS
|
||||
*--------------------------------
|
||||
SHIFT.ACCUM.LEFT
|
||||
ASL ACCUM
|
||||
ROL ACCUM+1
|
||||
ROL ACCUM+2
|
||||
RTS
|
||||
*--------------------------------
|
||||
ZERO.ACCUM
|
||||
LDY #0
|
||||
STY ACCUM
|
||||
STY ACCUM+1
|
||||
STY ACCUM+2
|
||||
RTS
|
||||
*--------------------------------
|
||||
* RETURN .CC. IF NOT END OF PATHNAME YET
|
||||
* ELSE .CS.
|
||||
*--------------------------------
|
||||
STORE.PATH.TWO.AND.TEST
|
||||
STA PATHNAME.TWO.BUFFER+1,Y
|
||||
INY
|
||||
CMP #','
|
||||
BEQ .1
|
||||
CMP #' '
|
||||
BEQ .1
|
||||
CMP #$0D
|
||||
BEQ .1
|
||||
CPY #65
|
||||
.1 RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.cpar
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
47
SCMASM.30/SCI.S.EQ.txt
Normal file
47
SCMASM.30/SCI.S.EQ.txt
Normal file
@ -0,0 +1,47 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
*BASL .EQ $28
|
||||
CSWL .EQ $36
|
||||
CSWH .EQ $37
|
||||
KSWL .EQ $38
|
||||
KSWH .EQ $39
|
||||
DRIVER.PTR .EQ $3A,3B
|
||||
RETRY.COUNT .EQ $3C
|
||||
*--------------------------------
|
||||
SC.INFLAG .EQ $51 $Cx if .INBx
|
||||
SC.LOMEM .EQ $52,53 START OF SYMBOLS
|
||||
SC.EOT .EQ $54,55 END OF SYMBOL TABLE
|
||||
SC.PP .EQ $56,57 START OF SOURCE PROGRAM
|
||||
SC.HIMEM .EQ $58,59 END OF SOURCE PROGRAM
|
||||
*PASS .EQ $63 PASS ($FF if command, 0 or 1 if assembling)
|
||||
*--------------------------------
|
||||
*WBUF .EQ $0200
|
||||
DIRBUF .EQ $0259
|
||||
PATHNAME.TWO.BUFFER .EQ $0280
|
||||
*--------------------------------
|
||||
GP.MLI .EQ $BF00
|
||||
UNIT .EQ $BF30
|
||||
BITMAP .EQ $BF58
|
||||
GP.DATE .EQ $BF90 ... 93
|
||||
LEVEL .EQ $BF94
|
||||
PREFIX.FLAG .EQ $BF9A
|
||||
*--------------------------------
|
||||
KEYBOARD .EQ $C000
|
||||
STROBE .EQ $C010
|
||||
IO.OFF .EQ $CFFF
|
||||
*--------------------------------
|
||||
BELL .EQ $FBE2
|
||||
ABORT.EXIT .EQ $FD10
|
||||
PRBYTE .EQ $FDDA
|
||||
CROUT .EQ $FD8E
|
||||
COUT .EQ $FDED
|
||||
*MON.SETVID .EQ $FE93
|
||||
*--------------------------------
|
||||
SC.HARD .EQ $8000
|
||||
SC.SOFT .EQ $8003
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.eq
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
107
SCMASM.30/SCI.S.ERRORS.txt
Normal file
107
SCMASM.30/SCI.S.ERRORS.txt
Normal file
@ -0,0 +1,107 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* Error Handler
|
||||
*--------------------------------
|
||||
ERROR.HANDLER
|
||||
AND #$1F TRIM TO SIZE
|
||||
STA ERROR.CODE
|
||||
LDA #$0F LEVEL
|
||||
STA LEVEL
|
||||
JSR UNHOOK.WRITE ...IF WRITING
|
||||
LDA #0
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
JSR MLI.CC CLOSE ALL FILES
|
||||
BCS .1
|
||||
LDA #0
|
||||
STA LEVEL
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
JSR MLI.CD FLUSH
|
||||
.1 LDA ERROR.CODE
|
||||
JSR PRINT.ERROR
|
||||
JSR CLOSE.EXEC.FILE
|
||||
JSR CROUT
|
||||
JMP SC.SOFT
|
||||
*--------------------------------
|
||||
ERR.FILE.BUSY
|
||||
LDA #$14
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
ERROR.PRINTER
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
JSR BELL
|
||||
*---PRINT MESSAGE FROM WBUF------
|
||||
PRINT.CR.MESSAGE
|
||||
JSR CROUT
|
||||
PRINT.MESSAGE
|
||||
LDX #0
|
||||
.1 LDA WBUF+1,X
|
||||
JSR COUT
|
||||
INX
|
||||
CMP #$8D END OF MESSAGE?
|
||||
BNE .1 ...NO
|
||||
RTS ...YES
|
||||
*--------------------------------
|
||||
FIND.AND.PUT.MSG.IN.WBUF
|
||||
LDX #0
|
||||
CLC
|
||||
*---SEARCH FOR MESSAGE #---------
|
||||
STA WBUF
|
||||
TAY
|
||||
BEQ .5 ...FIRST MESSAGE
|
||||
.2 JSR SCI.GET.NEXT.NYBBLE
|
||||
BNE .4
|
||||
.3 JSR SCI.GET.NEXT.NYBBLE
|
||||
BEQ .3
|
||||
BNE .2
|
||||
.4 EOR #$0F
|
||||
BNE .2
|
||||
DEC WBUF
|
||||
BNE .2
|
||||
*---Put message in WBUF----------
|
||||
.5 LDY #0
|
||||
STY WBUF+80 SQUEEZED BLANK COUNT
|
||||
.6 STY WBUF STORAGE INDEX
|
||||
LDA WBUF+80 BLANK COUNT
|
||||
BNE .8 ...ANOTHER BLANK
|
||||
.7 JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.FIRST.TABLE,Y
|
||||
BNE .9 ...FREQUENT CHAR
|
||||
JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.SECOND.TABLE,Y
|
||||
BNE .9 ...TWO NYBBLE CHAR
|
||||
JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.THIRD.TABLE,Y
|
||||
BMI .9 ...REAL CHAR
|
||||
STA WBUF+80 ...BLANK COUNT
|
||||
.8 LDA #" "
|
||||
DEC WBUF+80
|
||||
BEQ .7 ...NO MORE BLANKS
|
||||
.9 LDY WBUF STORAGE INDEX
|
||||
STA WBUF+1,Y
|
||||
INY NEXT COLUMN
|
||||
EOR #$8D END OF MESSAGE?
|
||||
BNE .6 ...NO
|
||||
RTS ...YES
|
||||
*--------------------------------
|
||||
SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.MESSAGES,X
|
||||
BCS .1 2ND NYBBLE
|
||||
LSR 1ST NYBBLE
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAY
|
||||
SEC
|
||||
RTS
|
||||
.1 INX
|
||||
AND #$0F
|
||||
TAY
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.errors
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
125
SCMASM.30/SCI.S.EXEC.txt
Normal file
125
SCMASM.30/SCI.S.EXEC.txt
Normal file
@ -0,0 +1,125 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
EXEC.ERR.FILE.BUSY JMP ERR.FILE.BUSY
|
||||
EXEC.ERR.MISMATCH JMP TYPERR
|
||||
*--------------------------------
|
||||
EXEC
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCS .1 ...NOT CURRENTLY OPEN
|
||||
*---File is in use---------------
|
||||
BIT EXEC.FILE.CLOSING.FLAG
|
||||
BPL EXEC.ERR.FILE.BUSY
|
||||
*---Restarting same EXEC file----
|
||||
STA MISC.PARMS+1 REFNUM
|
||||
LDA #0 "REWIND" THE FILE
|
||||
STA MISC.PARMS+2
|
||||
STA MISC.PARMS+3
|
||||
STA MISC.PARMS+4
|
||||
JSR MLI.CE SET MARK
|
||||
BCS CLOSE.EXEC.SAVING.ERROR
|
||||
BCC .2 ...ALWAYS, RESTART
|
||||
*--------------------------------
|
||||
.1 JSR CLOSE.EXEC.FILE STOP ANY EXEC IN PROGRESS
|
||||
BCS .3 ...ERROR
|
||||
*---Check file type--------------
|
||||
LDA GET.SET.PARMS+4 FILE TYPE MUST BE TXT
|
||||
CMP #$04 TXT FILETYPE CODE
|
||||
BNE EXEC.ERR.MISMATCH
|
||||
*---Open the file----------------
|
||||
LDA #0
|
||||
STA LEVEL LEVEL
|
||||
STA MISC.PARMS+2 BUFFER ADDRESS
|
||||
LDA EXEC.BUFFER.BASE
|
||||
STA MISC.PARMS+3 BUFFER ADDRESS HI
|
||||
STA OPEN.PARMS+4 "
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .3 ...ERROR
|
||||
LDA OPEN.PARMS+5 REFNUM OF FILE
|
||||
STA EXEC.REFNUM
|
||||
*---Fill other param blocks------
|
||||
.2 LDX GET.SET.PARMS+5 RECORD LENGTH
|
||||
STX VAL.L
|
||||
LDX GET.SET.PARMS+6
|
||||
STX VAL.L+1
|
||||
LDX #2 POINT AT EXEC FILE NAME
|
||||
JSR SAVE.FILENAME.IN.TABLE
|
||||
*---Switch EXEC on now-----------
|
||||
LDA #$FF MARK EXEC ACTIVE
|
||||
STA F.EXEC
|
||||
LDA KSWL
|
||||
STA VDOSIO+2
|
||||
LDA KSWH
|
||||
STA VDOSIO+3
|
||||
LDA #READ.EXEC.FILE
|
||||
STA KSWL
|
||||
LDA /READ.EXEC.FILE
|
||||
STA KSWH
|
||||
CLC
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
CLOSE.EXEC.SAVING.ERROR
|
||||
PHA SAVE ERROR CODE
|
||||
JSR CLOSE.EXEC.FILE CLOSE THE FILE
|
||||
PLA GET ERROR CODE
|
||||
SEC SIGNAL ERROR
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CLOSE EXEC FILE
|
||||
*--------------------------------
|
||||
CLOSE.EXEC.FILE
|
||||
CLC
|
||||
LDA F.EXEC
|
||||
BPL .1 ...NO EXEC IN PROGRESS
|
||||
LDA VDOSIO+2 RESTORE INPUT HOOK
|
||||
STA KSWL
|
||||
LDA VDOSIO+3
|
||||
STA KSWH
|
||||
LDA #$FF
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
LDX #2
|
||||
LDA EXEC.REFNUM
|
||||
JSR CLOSE.ONE.FILE CLOSE THE FILE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* "EXEC" INPUT HOOK
|
||||
*--------------------------------
|
||||
READ.EXEC.FILE
|
||||
STA (BASL),Y STOP BLINKING ON SCREEN
|
||||
JSR SAVE.REGS SAVE A,X,Y
|
||||
*---Check for CTRL-C Abort-------
|
||||
LDA KEYBOARD
|
||||
CMP #$83 CONTROL-C?
|
||||
BNE .2 ...NO
|
||||
JSR CLOSE.EXEC.FILE ...YES
|
||||
STA STROBE
|
||||
*---End of Data------------------
|
||||
.1 JSR RESTORE.REGS
|
||||
JMP ABORT.EXIT
|
||||
*---Set up EXEC char input-------
|
||||
.2 LDA EXEC.REFNUM REFNUM
|
||||
STA READ.WRITE.PARMS+1
|
||||
LDA #EXEC.INPUT.CHAR
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /EXEC.INPUT.CHAR
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #1 READ JUST ONE BYTE
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ
|
||||
BCS .3 ...ERROR OR END OF DATA
|
||||
JSR RESTORE.REGS
|
||||
LDA EXEC.INPUT.CHAR
|
||||
ORA #$80
|
||||
RTS
|
||||
*--------------------------------
|
||||
.3 JSR CLOSE.EXEC.SAVING.ERROR CLOSE EXEC FILE
|
||||
CMP #$05 END OF DATA?
|
||||
BEQ .1 ...YES
|
||||
JMP ERROR.HANDLER
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.exec
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
174
SCMASM.30/SCI.S.GP.txt
Normal file
174
SCMASM.30/SCI.S.GP.txt
Normal file
@ -0,0 +1,174 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
JMP WARM.DOS
|
||||
JMP PARSE.COMMAND
|
||||
SCI.USER.CMD JMP GP.RTS USER COMMAND PARSER
|
||||
JMP ERROR.HANDLER
|
||||
PRINT.ERROR JMP ERROR.PRINTER
|
||||
ERROR.CODE .HS 00
|
||||
*--------------------------------
|
||||
OUTVEC .DA $FDF0,$C100,$C200,$C300,$C400,$C500,$C600,$C700
|
||||
INVEC .DA $FD1B,$C100,$C200,$C300,$C400,$C500,$C600,$C700
|
||||
*--------------------------------
|
||||
VECOUT .HS F0FD
|
||||
VECIN .HS 1BFD
|
||||
*--------------------------------
|
||||
VDOSIO .DA 0,0 SAVE HARDWARE VECTOR DURING EXEC, WRITE
|
||||
.DA 0,0 VSYSIO
|
||||
*--------------------------------
|
||||
D.SLOT .HS 06
|
||||
D.DRIV .HS 01
|
||||
*--------------------------------
|
||||
PREGA .BS 1
|
||||
PREGX .BS 1
|
||||
PREGY .BS 1
|
||||
*--------------------------------
|
||||
F.TRACE .BS 1 +=TRACE OFF, -=TRACE ON
|
||||
STATE .BS 1 0=IMMD, >0=DEFERRED
|
||||
F.EXEC .BS 1
|
||||
F.READ .BS 1
|
||||
F.WRITE .BS 1
|
||||
F.PREFIX .BS 1
|
||||
DIR.FILE.READ.FLAG .BS 1
|
||||
*--------------------------------
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
STRINGS.SPACE.COUNT .BS 1
|
||||
BUFFERED.WRITE.COUNT .BS 1
|
||||
COMMAND.LINE.LENGTH .BS 1
|
||||
PREVIOUS.CHAR .BS 1
|
||||
OPEN.FILE.COUNT .BS 1
|
||||
EXEC.FILE.CLOSING.FLAG .BS 1
|
||||
CATALOG.LINE.STATE .BS 1
|
||||
*--------------------------------
|
||||
EXTERNAL.COMMAND.HANDLER .BS 2
|
||||
COMMAND.NAME.LENGTH .BS 1
|
||||
COMMAND.NUMBER .BS 1
|
||||
*--------------------------------
|
||||
PBITS .HS 0000
|
||||
FBITS .HS 0000
|
||||
VAL.A .HS 0000
|
||||
VAL.B .HS 000000
|
||||
VAL.E .HS 0000
|
||||
VAL.L .HS 0000
|
||||
VAL.S .HS 00
|
||||
VAL.D .HS 00
|
||||
VAL.F .HS 0000
|
||||
VAL.R .HS 0000
|
||||
VAL.V .HS 00
|
||||
VAL.AT .HS 0000
|
||||
VAL.T .HS 00
|
||||
VAL.LB .HS 00 PR# OR IN# VALUE
|
||||
*--------------------------------
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.DA PATHNAME.TWO.BUFFER
|
||||
*--------------------------------
|
||||
MLI.CALLER
|
||||
STA .2
|
||||
STX GP.SAVEX
|
||||
CMP #$CF
|
||||
BCC .1
|
||||
LDA #$CE
|
||||
.1 TAX
|
||||
LDA MLI.PARM.PNTRS-$C0,X
|
||||
STA .3
|
||||
JSR GP.MLI
|
||||
.2 .HS 00
|
||||
.3 .DA *
|
||||
BCC .6
|
||||
LDX #0
|
||||
.4 CMP MLI.ERROR.CODES,X
|
||||
BEQ .5
|
||||
INX
|
||||
CPX #19
|
||||
BCC .4
|
||||
.5 LDA BI.ERROR.CODES,X
|
||||
*** SEC (CARRY ALREADY SET)
|
||||
.6 LDX #*-*
|
||||
GP.SAVEX .EQ *-1
|
||||
ORA #0
|
||||
GP.RTS RTS
|
||||
*--------------------------------
|
||||
.HS 00 <<<SPARE>>>
|
||||
*---CREATE PARMS-----------------
|
||||
CREATE.PARMS
|
||||
.HS 07
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS C3.00.0000.00.0000.0000
|
||||
*---GET & SET PREFIX, DESTROY----
|
||||
PREFIX.PARMS
|
||||
.HS 01
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
*---RENAME-----------------------
|
||||
RENAME.PARMS
|
||||
.HS 02
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.DA PATHNAME.TWO.BUFFER
|
||||
*---GET & SET FILE INFO----------
|
||||
GET.SET.PARMS
|
||||
.HS 0A
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS 00.00.0000
|
||||
.HS 00.0000.0000.0000.0000.0000
|
||||
*---MISC-------------------------
|
||||
MISC.PARMS
|
||||
.HS 02.00.0000
|
||||
.HS 00
|
||||
*---OPEN PARMS-------------------
|
||||
OPEN.PARMS
|
||||
.HS 03
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS 0000.00
|
||||
*---SET NEWLINE PARMS------------
|
||||
NEWLINE.PARMS
|
||||
.HS 03.00.7F.0D
|
||||
*---READ & WRITE PARMS-----------
|
||||
READ.WRITE.PARMS
|
||||
.HS 04.00.0000.0000.0000
|
||||
*---CLOSE & FLUSH PARMS----------
|
||||
CLOSE.FLUSH.PARMS
|
||||
.HS 01.00
|
||||
*--------------------------------
|
||||
* ADDRESSES OF MLI PARM LISTS FOR EACH CALL $C0-$D3
|
||||
* actual address is $BExx
|
||||
*--------------------------------
|
||||
MLI.PARM.PNTRS
|
||||
.DA #CREATE.PARMS $C0--CREATE
|
||||
.DA #PREFIX.PARMS $C1--DESTROY
|
||||
.DA #RENAME.PARMS $C2--RENAME
|
||||
.DA #GET.SET.PARMS $C3--SFI
|
||||
.DA #GET.SET.PARMS $C4--GFI
|
||||
.DA #MISC.PARMS $C5--ONLINE
|
||||
.DA #PREFIX.PARMS $C6--SPFX
|
||||
.DA #PREFIX.PARMS $C7--GPFX
|
||||
.DA #OPEN.PARMS $C8--OPEN
|
||||
.DA #NEWLINE.PARMS $C9--NEWLINE
|
||||
.DA #READ.WRITE.PARMS $CA--READ
|
||||
.DA #READ.WRITE.PARMS $CB--WRITE
|
||||
.DA #CLOSE.FLUSH.PARMS $CC--CLOSE
|
||||
.DA #CLOSE.FLUSH.PARMS $CD--FLUSH
|
||||
.DA #MISC.PARMS $CE--SMARK
|
||||
* .DA #MISC.PARMS $CF--GMARK
|
||||
* .DA #MISC.PARMS $D0--SEOF
|
||||
* .DA #MISC.PARMS $D1--GEOF
|
||||
* .DA #MISC.PARMS $D2--SBUF
|
||||
* .DA #MISC.PARMS $D3--GBUF
|
||||
*--------------------------------
|
||||
.AS -/++++/
|
||||
*--------------------------------
|
||||
BUFFER.BASES .HS 78.7C LOWER/UPPER BUFFERS
|
||||
EXEC.BUFFER.BASE .HS 74
|
||||
*--------------------------------
|
||||
RTS WAS GET BUFFER
|
||||
NOP
|
||||
NOP
|
||||
RTS WAS RETURN BUFFER
|
||||
NOP
|
||||
NOP
|
||||
.HS 74 HIMEM PAGE
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.gp
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
381
SCMASM.30/SCI.S.LOADSAVE.txt
Normal file
381
SCMASM.30/SCI.S.LOADSAVE.txt
Normal file
@ -0,0 +1,381 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
DASH
|
||||
LDA GET.SET.PARMS+4 GET FILE TYPE
|
||||
CMP #$06 BINARY?
|
||||
BEQ .3 ...YES, BRUN
|
||||
CMP #$04 TEXT?
|
||||
BNE .1 ...NO, TRY SYS
|
||||
JMP EXEC ...YES, EXEC
|
||||
*--------------------------------
|
||||
.1 CMP #$FF SYS FILE?
|
||||
BEQ .2 ...YES, BRUN IT
|
||||
LDA #$0D "FILE TYPE MISMATCH"
|
||||
SEC
|
||||
RTS
|
||||
*---RUN SYS FILE-----------------
|
||||
.2 JSR CLOSE.ALL.FILES
|
||||
JSR CLOSE.EXEC.FILE
|
||||
LDA #0
|
||||
STA VAL.A
|
||||
LDX #6 RELEASE $8000-$B7FF
|
||||
.4 STA BITMAP+16,X
|
||||
DEX
|
||||
BPL .4
|
||||
LDA #$01 RELEASE $B800-$BEFF
|
||||
STA BITMAP+23 B800.BFFF
|
||||
LDA /$2000 A$2000
|
||||
STA VAL.A+1
|
||||
LDA #$FF T=SYS
|
||||
STA VAL.T
|
||||
LDA #$80 SIGNAL FOUND T,A, AND PATHNAME
|
||||
STA FBITS+1
|
||||
LDA #$05
|
||||
STA FBITS
|
||||
.3 JMP BRUN
|
||||
*--------------------------------
|
||||
WARM.DOS
|
||||
JSR CLOSE.ALL.FILES
|
||||
JSR CROUT
|
||||
JMP SC.SOFT
|
||||
*--------------------------------
|
||||
* LOAD A SOURCE PROGRAM
|
||||
*--------------------------------
|
||||
LOAD
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
BCS .5
|
||||
LDA #$01 READ
|
||||
LDX #$FA FILE TYPE
|
||||
JSR OPEN.A.FILE
|
||||
BCS .5 ...ERROR
|
||||
*---GET LENGTH OF FILE-----------
|
||||
LDA SC.INFLAG
|
||||
ASL
|
||||
BPL .1 ...NOT .INBx
|
||||
AND #$7F
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+2
|
||||
BEQ .2 ...ALWAYS
|
||||
.1 JSR MLI.D1 GET LENGTH OF FILE
|
||||
BCS .5 ...ERROR
|
||||
*---FIGURE LOAD ADDRESS----------
|
||||
.2 SEC
|
||||
LDA SC.HIMEM
|
||||
SBC MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+2
|
||||
STA VAL.A
|
||||
TAX
|
||||
LDA SC.HIMEM+1
|
||||
SBC MISC.PARMS+3
|
||||
STA READ.WRITE.PARMS+3
|
||||
STA VAL.A+1
|
||||
TAY
|
||||
*---CHECK FOR ROOM IN RAM--------
|
||||
BMI .6 ADDRESS>$7FFF MEANS NO ROOM
|
||||
TXA
|
||||
CMP SC.LOMEM
|
||||
TYA
|
||||
SBC SC.LOMEM+1
|
||||
BCC .6 ...BELOW LOMEM
|
||||
*---READ FILE--------------------
|
||||
LDA MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA MISC.PARMS+3
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ THE FILE
|
||||
BCS .5
|
||||
*---CLOSE UNLESS .INBx-----------
|
||||
BIT SC.INFLAG
|
||||
BVS .4 ...IT IS .INBx
|
||||
.3 JSR MLI.CC CLOSE THE FILE
|
||||
BCS .5
|
||||
*--------------------------------
|
||||
.4 LDX VAL.A+1
|
||||
LDY VAL.A
|
||||
STX SC.PP+1
|
||||
STY SC.PP
|
||||
.5 RTS
|
||||
.6 LDA #$0E "PROGRAM TOO LARGE"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SAVE SOURCE PROGRAM ON DISK
|
||||
*--------------------------------
|
||||
SAVE
|
||||
BCC .1 ...FILE ALREADY HERE
|
||||
LDA #$FA FILE TYPE "INT"
|
||||
STA VAL.T
|
||||
STA GET.SET.PARMS+4
|
||||
LDA #$C3
|
||||
STA GET.SET.PARMS+3
|
||||
LDA SC.PP START OF PROGRAM
|
||||
STA CREATE.PARMS+5
|
||||
STA GET.SET.PARMS+5
|
||||
LDA SC.PP+1
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+6
|
||||
JSR MAKE.A.FILE CREATE A NEW FILE
|
||||
BCS .2 ...ERROR
|
||||
.1 JSR ALLOCATE.UPPER.BUFFER
|
||||
BCS .2
|
||||
LDA #$02
|
||||
LDX #$FA
|
||||
JSR OPEN.A.FILE
|
||||
BCS .2 ...ERROR
|
||||
*---GET LENGTH-------------------
|
||||
SEC GET LENGTH
|
||||
LDA SC.HIMEM
|
||||
SBC SC.PP
|
||||
TAX
|
||||
STA MISC.PARMS+2
|
||||
LDA SC.HIMEM+1
|
||||
SBC SC.PP+1
|
||||
TAY
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+4
|
||||
*---WRITE THE FILE---------------
|
||||
LDA SC.PP
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA SC.PP+1
|
||||
STA READ.WRITE.PARMS+3
|
||||
STX READ.WRITE.PARMS+4
|
||||
STY READ.WRITE.PARMS+5
|
||||
JSR MLI.CB WRITE DATA ON FILE
|
||||
BCS .2 ...ERROR
|
||||
JSR MLI.D0 SET EOF (TRUNCATE OLD LONGER FILE)
|
||||
BCS .2 ...ERROR
|
||||
JSR MLI.CC CLOSE THE FILE
|
||||
BCS .2 ...ERROR
|
||||
*---UPDATE FILE INFO-------------
|
||||
LDA SC.PP+1
|
||||
LDX SC.PP
|
||||
CMP GET.SET.PARMS+6
|
||||
BNE .3
|
||||
CPX GET.SET.PARMS+5
|
||||
CLC
|
||||
BNE .3
|
||||
.2 RTS
|
||||
.3 STX GET.SET.PARMS+5
|
||||
STA GET.SET.PARMS+6
|
||||
LDA #0
|
||||
STA GET.SET.PARMS+10
|
||||
STA GET.SET.PARMS+11
|
||||
STA GET.SET.PARMS+12
|
||||
STA GET.SET.PARMS+13
|
||||
JMP SET.FILE.INFO
|
||||
*--------------------------------
|
||||
CREATE
|
||||
LDX #0
|
||||
LDY #0 AuxType = 0000 unless specified
|
||||
LDA FBITS+1
|
||||
BPL .1 ...no A-value specified
|
||||
LDX VAL.A use A-value for AuxType
|
||||
LDY VAL.A+1
|
||||
.1 STX CREATE.PARMS+5
|
||||
STY CREATE.PARMS+6
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BNE MAKE.A.FILE
|
||||
LDA #$0F
|
||||
STA VAL.T
|
||||
|
||||
MAKE.A.FILE
|
||||
LDA VAL.T
|
||||
STA CREATE.PARMS+4
|
||||
LDX #$C3
|
||||
LDY #$01 SEEDLING
|
||||
CMP #$0F
|
||||
BNE .1
|
||||
LDY #$0D DIRECTORY
|
||||
.1 STX CREATE.PARMS+3
|
||||
STY CREATE.PARMS+7
|
||||
JMP MLI.C0 CREATE
|
||||
*--------------------------------
|
||||
RENAME LDA FBITS
|
||||
AND #$02 PATH 2?
|
||||
BEQ .1 ...NO, ERROR
|
||||
JMP MLI.C2 RENAME
|
||||
.1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
LOCK JSR GET.FILE.INFO
|
||||
BCS RTS3
|
||||
LDA GET.SET.PARMS+3
|
||||
AND #$3C
|
||||
ORA #$01
|
||||
BNE LKUNLK ...ALWAYS
|
||||
UNLOCK JSR GET.FILE.INFO
|
||||
BCS RTS3
|
||||
LDA #$C3
|
||||
ORA GET.SET.PARMS+3
|
||||
LKUNLK STA GET.SET.PARMS+3
|
||||
JMP SET.FILE.INFO
|
||||
*--------------------------------
|
||||
PREFIX
|
||||
LDX #0
|
||||
LDA FBITS+1
|
||||
AND #$04
|
||||
BNE .1 ...SPECIFIED S/D
|
||||
LDA FBITS SEE IF SPECIFIED PATHNAME
|
||||
LSR
|
||||
BCC .3 ...NO, SO PRINT CURRENT PREFIX
|
||||
.1 JMP MLI.C6 SET PREFIX
|
||||
*---PRINT CURRENT PREFIX---------
|
||||
.2 LDA PATHNAME.ONE.BUFFER+1,X
|
||||
ORA #$80
|
||||
JSR COUT
|
||||
INX
|
||||
.3 CPX PATHNAME.ONE.BUFFER
|
||||
BCC .2
|
||||
JSR CROUT
|
||||
CLC
|
||||
RTS3 RTS
|
||||
*--------------------------------
|
||||
NOPREFIX
|
||||
LDA #0
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
JMP MLI.C6 SET PREFIX
|
||||
*--------------------------------
|
||||
BSAVE
|
||||
BCC .2 ...EXISTING FILE
|
||||
LDA FBITS+1
|
||||
AND #$B0 A-EL
|
||||
CMP #$90 Require A and either E or L
|
||||
BCC .3 ...Neither E nor L
|
||||
LDA VAL.A
|
||||
STA CREATE.PARMS+5
|
||||
STA GET.SET.PARMS+5
|
||||
LDA VAL.A+1
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+6
|
||||
*---T=BIN unless specified-------
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BNE .1 ...TYPE SPECIFIED
|
||||
LDA #$06 ...NO TYPE, ASSUME BINARY
|
||||
STA VAL.T
|
||||
.1 LDA VAL.T
|
||||
STA GET.SET.PARMS+4
|
||||
*--------------------------------
|
||||
JSR MAKE.A.FILE
|
||||
BCS .4
|
||||
JSR GET.FILE.INFO
|
||||
BCS .4
|
||||
.2 LDA #$02
|
||||
BNE B.COMMON ...ALWAYS
|
||||
|
||||
.3 LDA #$06 "PATH NOT FOUND"
|
||||
SEC
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
BRUN
|
||||
JSR BLOAD
|
||||
BCS .1
|
||||
JSR .2
|
||||
CLC
|
||||
.1 RTS
|
||||
.2 JMP (READ.WRITE.PARMS+2)
|
||||
*--------------------------------
|
||||
BLOAD
|
||||
LDA #$01
|
||||
B.COMMON
|
||||
PHA
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
PLA
|
||||
BCS .3
|
||||
LDX #$06
|
||||
JSR OPEN.A.FILE
|
||||
BCS .3
|
||||
LDX VAL.A
|
||||
LDY VAL.A+1
|
||||
LDA FBITS+1
|
||||
BMI .1 ...ADDRESS SPECIFIED
|
||||
LDX GET.SET.PARMS+5
|
||||
LDY GET.SET.PARMS+6
|
||||
LDA FBITS DON'T ALLOW DEFAULT ADDRESS
|
||||
AND #$04 ON NON-BINARY FILES
|
||||
BEQ .0 ...T not specified, so it is BIN
|
||||
LDA VAL.T T specified, better be BIN or SYS
|
||||
CMP #$06 is it BIN?
|
||||
BEQ .0 ...yes, use AuxType value
|
||||
CMP #$FF is it SYS?
|
||||
BNE .4 ...no, error
|
||||
LDX #$2000 ...type SYS, assume A$2000
|
||||
LDY /$2000
|
||||
.0 LDA FBITS+1
|
||||
.1 STX READ.WRITE.PARMS+2
|
||||
STY READ.WRITE.PARMS+3
|
||||
LDX VAL.L
|
||||
LDY VAL.L+1
|
||||
AND #$30
|
||||
BEQ .5
|
||||
EOR #$30
|
||||
BEQ .4
|
||||
AND #$10
|
||||
BEQ .7
|
||||
LDA VAL.E
|
||||
SEC
|
||||
SBC VAL.A
|
||||
TAX
|
||||
LDA VAL.E+1
|
||||
SBC VAL.A+1
|
||||
TAY
|
||||
INX
|
||||
BNE .2
|
||||
INY
|
||||
.2 BCS .7
|
||||
LDA #$02 "RANGE ERROR"
|
||||
SEC
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
.4 LDA #$0B "INVALID PARAMETER"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
.5 JSR MLI.D1 GET EOF
|
||||
BCS .6
|
||||
LDX MISC.PARMS+2
|
||||
LDY MISC.PARMS+3
|
||||
LDA MISC.PARMS+4
|
||||
BEQ .7
|
||||
LDA #$0E "PROGRAM TOO LARGE"
|
||||
.6 SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
.7 STX READ.WRITE.PARMS+4
|
||||
STY READ.WRITE.PARMS+5
|
||||
LDA FBITS+1
|
||||
AND #$40
|
||||
BEQ .10
|
||||
LDX #$02
|
||||
.8 LDA VAL.B,X
|
||||
STA MISC.PARMS+2,X
|
||||
DEX
|
||||
BPL .8
|
||||
.9 JSR MLI.CE SET MARK
|
||||
LDX COMMAND.NUMBER
|
||||
BCC .10
|
||||
CMP #$02
|
||||
BNE .6
|
||||
CPX #CN.BSAVE
|
||||
BNE .6
|
||||
JSR MLI.D0 SET EOF
|
||||
BCC .9
|
||||
RTS
|
||||
*--------------------------------
|
||||
.10 LDX COMMAND.NUMBER
|
||||
CPX #CN.BSAVE
|
||||
BNE .12 ...NOT BSAVE
|
||||
JSR MLI.CB ...BSAVE
|
||||
BCS .13 ...ERROR
|
||||
.11 JMP MLI.CC
|
||||
.12 JSR MLI.CA READ
|
||||
BCC .11 ...GOOD, CLOSE
|
||||
.13 RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.loadsave
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
75
SCMASM.30/SCI.S.ONLINE.txt
Normal file
75
SCMASM.30/SCI.S.ONLINE.txt
Normal file
@ -0,0 +1,75 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ONLINE LDA BUFFER.BASES
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+2
|
||||
STA MISC.PARMS+1
|
||||
JSR MLI.C5 (Might clobber DRIVER.PTR)
|
||||
*---Now display the list---------
|
||||
LDA BUFFER.BASES
|
||||
STA DRIVER.PTR+1
|
||||
LDA #0
|
||||
STA DRIVER.PTR
|
||||
.1 PHA
|
||||
TAY
|
||||
LDA (DRIVER.PTR),Y
|
||||
BEQ .5 ...END OF LIST
|
||||
PHA
|
||||
LDA #"S"
|
||||
JSR COUT
|
||||
PLA
|
||||
PHA
|
||||
LSR ISOLATE SLOT NUMBER
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
AND #7
|
||||
ORA #"0"
|
||||
JSR COUT PRINT SLOT NUMBER
|
||||
LDA #","
|
||||
JSR COUT
|
||||
LDA #"D"
|
||||
JSR COUT
|
||||
PLA
|
||||
PHA
|
||||
ASL SET CARRY IF DRIVE 2
|
||||
LDA #"1" ASSUME DRIVE 1
|
||||
ADC #0 CHANGE TO 2 IF TRUE
|
||||
JSR COUT
|
||||
LDA #" " PRINT SPACE
|
||||
JSR COUT
|
||||
PLA get dsssllll again
|
||||
AND #$0F isolate length
|
||||
BEQ .3 no name, show error code
|
||||
TAX
|
||||
LDA #"/"
|
||||
.2 JSR COUT
|
||||
INY PRINT THE VOLUME OR FILE NAME
|
||||
LDA (DRIVER.PTR),Y
|
||||
ORA #$80
|
||||
DEX
|
||||
BPL .2
|
||||
LDA #"/"
|
||||
BNE .4 ...ALWAYS
|
||||
.3 LDA #"("
|
||||
JSR COUT
|
||||
INY
|
||||
LDA (DRIVER.PTR),Y GET ERROR CODE
|
||||
JSR PRBYTE
|
||||
LDA #")"
|
||||
.4 JSR COUT
|
||||
JSR CROUT
|
||||
*--------------------------------
|
||||
.5 CLC POINT TO NEXT VOLUME NAME
|
||||
PLA
|
||||
ADC #16
|
||||
BCC .1 STILL IN SAME PAGE
|
||||
CLC NO ERROR!
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.online
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
321
SCMASM.30/SCI.S.OPENCLOSE.txt
Normal file
321
SCMASM.30/SCI.S.OPENCLOSE.txt
Normal file
@ -0,0 +1,321 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* FOLLOWING USE "BIT" TO SKIP OVER TWO BYTES,
|
||||
* SO CANNOT HAVE THE SECOND OF THE TWO =$CX.
|
||||
*--------------------------------
|
||||
MLI.C0 LDA #$00 CREATE
|
||||
.HS 2C
|
||||
MLI.C1 LDA #$01 DESTROY
|
||||
.HS 2C
|
||||
MLI.C2 LDA #$02 RENAME
|
||||
.HS 2C
|
||||
MLI.C3 LDA #$03 SET FILE INFO
|
||||
.HS 2C
|
||||
MLI.C4 LDA #$04 GET FILE INFO
|
||||
.HS 2C
|
||||
MLI.C5 LDA #$05 ONLINE
|
||||
.HS 2C
|
||||
MLI.C6 LDA #$06 SET PREFIX
|
||||
.HS 2C
|
||||
MLI.C7 LDA #$07 GET PREFIX
|
||||
.HS 2C
|
||||
MLI.C8 LDA #$08 OPEN
|
||||
.HS 2C
|
||||
MLI.C9 LDA #$09 NEWLINE
|
||||
.HS 2C
|
||||
MLI.CA LDA #$0A READ
|
||||
.HS 2C
|
||||
MLI.CB LDA #$0B WRITE
|
||||
.HS 2C
|
||||
MLI.CC LDA #$0C CLOSE
|
||||
.HS 2C
|
||||
MLI.CD LDA #$0D FLUSH
|
||||
.HS 2C
|
||||
MLI.CE LDA #$0E SET MARK
|
||||
.HS 2C
|
||||
MLI.CF LDA #$0F GET MARK
|
||||
.HS 2C
|
||||
MLI.D0 LDA #$D0 SET EOF
|
||||
.HS 2C
|
||||
MLI.D1 LDA #$D1 GET EOF
|
||||
ORA #$C0 MAKE INTO MLI CALL CODE
|
||||
JMP MLI.CALLER
|
||||
*--------------------------------
|
||||
GET.FILE.INFO
|
||||
LDA #10
|
||||
STA GET.SET.PARMS
|
||||
BNE MLI.C4 GET FILE INFO
|
||||
*--------------------------------
|
||||
SET.FILE.INFO
|
||||
LDA #7
|
||||
STA GET.SET.PARMS
|
||||
BNE MLI.C3 SET FILE INFO
|
||||
*--------------------------------
|
||||
BYE
|
||||
JSR CLOSE.ALL.FILES
|
||||
JSR CLOSE.EXEC.FILE
|
||||
JSR GP.MLI
|
||||
.DA #$65,READ.WRITE.PARMS
|
||||
*--------------------------------
|
||||
OPEN.A.FILE
|
||||
PHA
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BEQ .1
|
||||
LDX VAL.T
|
||||
.1 PLA
|
||||
|
||||
OPEN.DIRECTORY
|
||||
CPX GET.SET.PARMS+4
|
||||
BNE TYPERR
|
||||
AND GET.SET.PARMS+3
|
||||
BEQ .3
|
||||
LDA ALLOCATED.BUFFER.PAGE
|
||||
STA OPEN.PARMS+4
|
||||
LDA #$0F
|
||||
STA LEVEL
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .1
|
||||
LDA OPEN.PARMS+5
|
||||
STA READ.WRITE.PARMS+1
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
STA MISC.PARMS+1
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
.3 LDA #$0A "FILE LOCKED"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
VERIFY
|
||||
LDA #$06 "PATH NOT FOUND"
|
||||
RTS ALREADY .CS. IF ERROR
|
||||
*--------------------------------
|
||||
TYPERR LDA #$0D
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* OPEN -- ONLY USED BY SCASM FOR OPENING
|
||||
* .TF AND "TEXT" FILES
|
||||
* THE FILES MAY BE TXT OR BIN FILE TYPE
|
||||
*--------------------------------
|
||||
OPEN
|
||||
PHP
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCC .9 ...ALREADY OPEN, ERROR
|
||||
PLP ...GET SAVED STATUS
|
||||
BCC .3 ...FILE ALREADY EXISTS
|
||||
*---MAKE A NEW FILE--------------
|
||||
LDA FBITS WAS T SPECIFIED?
|
||||
AND #$04
|
||||
BEQ .1 ...NO
|
||||
LDA VAL.T WHAT WAS SPEC?
|
||||
BCS .2 ...always, use spec'd type
|
||||
.1 LDA #$06 ...new file, type not spec'd, T=BIN
|
||||
BIT PASS $FF if command level, 0 or 1 if assembling
|
||||
BPL .4 ...assembling, make BIN file
|
||||
LDA #$04 ...command, make TXT file
|
||||
.4 STA VAL.T
|
||||
.2 STA GET.SET.PARMS+4
|
||||
LDA #$C3 FULL ACCESS PRIVILEGES
|
||||
STA GET.SET.PARMS+3
|
||||
LDA #0 RECORD LENGTH = 0000
|
||||
STA CREATE.PARMS+5
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+5
|
||||
STA GET.SET.PARMS+6
|
||||
JSR MAKE.A.FILE CREATE THE FILE
|
||||
BCS .8 ...ERROR
|
||||
*---NOW THE FILE EXISTS----------
|
||||
*---OPEN THE FILE----------------
|
||||
.3 JSR ALLOCATE.LOWER.BUFFER
|
||||
STA OPEN.PARMS+4 STARTING PAGE OF BUFFER
|
||||
LDA #$07 LEVEL #
|
||||
STA LEVEL
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .8 ...ERROR
|
||||
*---SAVE NAME, ETC OF OPEN FILE--
|
||||
LDA OPEN.PARMS+4 MARK THE BUFFER IN USE
|
||||
STA FILE.BUFFER.PNTRS,X
|
||||
LDA OPEN.PARMS+5 REFNUM
|
||||
STA FILE.REFNUMS,X
|
||||
JSR SAVE.FILENAME.IN.TABLE
|
||||
CLC
|
||||
.8 RTS
|
||||
*--------------------------------
|
||||
.9 PLP
|
||||
JMP ERR.FILE.BUSY
|
||||
*--------------------------------
|
||||
SAVE.FILENAME.IN.TABLE
|
||||
TXA
|
||||
ASL INDEX TIMES 32
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
TAX
|
||||
*---FORM NAME LENGTH BYTE--------
|
||||
LDA PATHNAME.TWO.BUFFER
|
||||
STA OPEN.FILE.NAME.BUFFERS,X
|
||||
TAY SAVE ACTUAL LENGTH
|
||||
CMP #30 ONLY ROOM FOR 29 CHARS
|
||||
BCC .1 ...'TWILL FIT
|
||||
LDA #29 USE LAST 29 CHARS
|
||||
.1 STA FNLEN
|
||||
LDA VAL.L
|
||||
STA OPEN.FILE.NAME.BUFFERS+1,X
|
||||
LDA VAL.L+1
|
||||
STA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
.2 INX
|
||||
LDA PATHNAME.TWO.BUFFER,Y
|
||||
STA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
DEY
|
||||
DEC FNLEN
|
||||
BNE .2
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SEARCH OPEN FILE NAME TABLE
|
||||
* RETURN .CS., A=ERRCOD IF NO PATHNAME
|
||||
* OR IF NOT IN TABLE
|
||||
* RETURN .CC., A=REFNUM IF FOUND IN TABLE
|
||||
*--------------------------------
|
||||
GET.REFNUM.OF.OPEN.FILE
|
||||
LDA FBITS WAS PATHNAME GIVEN?
|
||||
LSR
|
||||
BCS .1 ...YES
|
||||
JMP ERR.SYNTAX ...NO, "SYNTAX ERROR"
|
||||
*---CHECK AMONG NON-EXEC FILES---
|
||||
.1 LDX #1 MAX # OF FILES IS 2
|
||||
STX EXEC.FILE.CLOSING.FLAG
|
||||
.2 LDA FILE.BUFFER.PNTRS,X SEE IF IN USE
|
||||
BEQ .3 NO
|
||||
JSR COMPARE.TO.FILE.NAME.BUFFER
|
||||
BCC .5 ...FOUND IT
|
||||
.3 DEX
|
||||
BPL .2
|
||||
*---CHECK EXEC FILE--------------
|
||||
BIT F.EXEC IS EXEC ON?
|
||||
BPL .4 ...NO, FILE NOT OPEN
|
||||
LDX #2 ...YES
|
||||
JSR COMPARE.TO.FILE.NAME.BUFFER
|
||||
BCS .4 ...NOT THIS ONE EITHER
|
||||
LDA #$FF
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
LDA EXEC.REFNUM
|
||||
RTS RETURN .CC.
|
||||
.4 LDA #$12 "FILE NOT OPEN"
|
||||
SEC
|
||||
RTS RETURN .CS.
|
||||
.5 LDA FILE.REFNUMS,X
|
||||
RTS RETURN .CC.
|
||||
*--------------------------------
|
||||
* COMPARE NAMES
|
||||
* RETURN .CC. IF SAME, ELSE .CS.
|
||||
*--------------------------------
|
||||
COMPARE.TO.FILE.NAME.BUFFER
|
||||
TXA
|
||||
PHA SAVE X-REGISTER
|
||||
ASL INDEX TIMES 32
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
TAX
|
||||
LDA OPEN.FILE.NAME.BUFFERS,X
|
||||
CMP PATHNAME.TWO.BUFFER
|
||||
BNE .3 ...DIFFERENT LENGTHS
|
||||
TAY POINT TO END OF PATHNAME
|
||||
CMP #30 CHOP AT 29
|
||||
BCC .1
|
||||
LDA #29
|
||||
.1 STA FNLEN
|
||||
LDA OPEN.FILE.NAME.BUFFERS+1,X
|
||||
STA RECORD.LENGTH
|
||||
LDA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
STA RECORD.LENGTH+1
|
||||
.2 INX
|
||||
LDA PATHNAME.TWO.BUFFER,Y
|
||||
CMP OPEN.FILE.NAME.BUFFERS+2,X
|
||||
BNE .3 NOT THE SAME NAME
|
||||
DEY
|
||||
DEC FNLEN
|
||||
BNE .2 MORE TO THE NAME
|
||||
CLC SIGNAL SAME NAMES
|
||||
.HS B0 "BCS" OPCODE, SKIPS OVER "SEC"
|
||||
.3 SEC SIGNAL DIFFERENT NAMES
|
||||
PLA RESTORE X-REG
|
||||
TAX
|
||||
RTS
|
||||
*--------------------------------
|
||||
CLOSE
|
||||
LDA FBITS
|
||||
LSR ANY PATHNAME GIVEN?
|
||||
BCC CLOSE.ALL.FILES ...NO
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCC CLOSE.ONE.FILE ...OPEN, SO CLOSE IT
|
||||
CLC ...NOT OPEN, SO FINISHED
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CLOSE A FILE ... REFNUM IN A-REG
|
||||
* INDEX IN X-REG
|
||||
*--------------------------------
|
||||
CLOSE.ONE.FILE
|
||||
STA CLOSE.FLUSH.PARMS+1 REFNUM
|
||||
LDA #0
|
||||
STA LEVEL LEVEL 0
|
||||
JSR MLI.CC CLOSE
|
||||
BCS RTS2 ...ERROR
|
||||
LDA #0
|
||||
BIT EXEC.FILE.CLOSING.FLAG
|
||||
BPL .1
|
||||
STA F.EXEC
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
RTS
|
||||
.1 STA FILE.BUFFER.PNTRS,X
|
||||
LDA CLOSE.FLUSH.PARMS+1
|
||||
EOR WRITE.REFNUM TEST .EQ., LEAVE CARRY CLEAR
|
||||
BNE RTS2 ...NOT SAME AS "WRITE" FILE
|
||||
*--------------------------------
|
||||
UNHOOK.WRITE
|
||||
BIT F.WRITE
|
||||
BPL RTS2
|
||||
LDA VDOSIO
|
||||
STA CSWL
|
||||
LDA VDOSIO+1
|
||||
STA CSWH
|
||||
LDA #0
|
||||
STA F.WRITE
|
||||
RTS2 RTS
|
||||
*--------------------------------
|
||||
CLOSE.ALL.FILES
|
||||
LDX #1 MAX FILES IS 2
|
||||
.1 LDA FILE.BUFFER.PNTRS,X
|
||||
BEQ .2 NOT IN USE
|
||||
LDA FILE.REFNUMS,X
|
||||
JSR CLOSE.ONE.FILE
|
||||
BCS RTS2
|
||||
.2 DEX
|
||||
BPL .1
|
||||
INX X=0
|
||||
STX CLOSE.FLUSH.PARMS+1
|
||||
LDA #$07
|
||||
STA LEVEL
|
||||
JMP MLI.CC CLOSE
|
||||
*--------------------------------
|
||||
* ALLOCATE UPPER/LOWER BUFFER
|
||||
*--------------------------------
|
||||
ALLOCATE.UPPER.BUFFER
|
||||
LDX #1
|
||||
.HS 2C
|
||||
ALLOCATE.LOWER.BUFFER
|
||||
LDX #0
|
||||
.2 LDA BUFFER.BASES,X
|
||||
STA ALLOCATED.BUFFER.PAGE
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.openclose
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
87
SCMASM.30/SCI.S.PRIN.txt
Normal file
87
SCMASM.30/SCI.S.PRIN.txt
Normal file
@ -0,0 +1,87 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* PR#slot copy address from OUTVEC,slot to CSW
|
||||
* PR#Aaddr copy Aaddress into CSW
|
||||
* PR#slot,Aaddr copy Aaddress into OUTVEC,slot
|
||||
*
|
||||
* IN#slot copy address from INVEC,slot to KSW
|
||||
* IN#Aaddr copy Aaddress into KSW
|
||||
* IN#slot,Aaddr copy Aaddress into INVEC,slot
|
||||
*--------------------------------
|
||||
PR LDA #0
|
||||
.HS 2C SKIP NEXT LINE
|
||||
IN LDA #2
|
||||
PHA SAVE 0 OR 2
|
||||
ASL
|
||||
ASL 00 OR 08
|
||||
ORA VAL.LB +SLOT
|
||||
ASL *2
|
||||
TAX
|
||||
BIT FBITS WAS SLOT PARAMETER GIVEN?
|
||||
BVC .1 ...NO
|
||||
LDA FBITS+1 ...YES, WAS A$ PARM ALSO?
|
||||
BMI .2 ...YES, SO UPDATE TABLE
|
||||
TXA Check for "PR#0"
|
||||
BEQ .4 ...yes, so call MON.SETVID directly
|
||||
LDA OUTVEC,X ...NO, ONLY SLOT
|
||||
STA VAL.A SO GET VALUE FROM TABLE
|
||||
LDA OUTVEC+1,X
|
||||
STA VAL.A+1
|
||||
.1 JSR CHECK.IO.DRIVER
|
||||
BCS .3 ...NOT VALID DRIVER
|
||||
PLA POP SAVED 0 OR 2
|
||||
TAX
|
||||
LDA VAL.A INSTALL HOOK FOR DRIVER
|
||||
STA CSWL,X
|
||||
LDA VAL.A+1
|
||||
STA CSWH,X
|
||||
RTS
|
||||
*---ENTER NEW VALUE IN TABLE-----
|
||||
.2 JSR CHECK.IO.DRIVER
|
||||
BCS .3 ...ERROR
|
||||
PLA POP OFF SAVED 0 OR 2
|
||||
LDA VAL.A+1 UPDATE TABLE
|
||||
STA OUTVEC+1,X
|
||||
LDA VAL.A
|
||||
STA OUTVEC,X
|
||||
RTS
|
||||
.3 PLA POP OFF SAVED 0 OR 2
|
||||
LDA #$03 "NO DEVICE CONNECTED"
|
||||
RTS
|
||||
*--------------------------------
|
||||
.4 PLA POP OFF SAVED 0 OR 2
|
||||
JSR MON.SETVID
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
CHECK.IO.DRIVER
|
||||
LDA VAL.A GET DRIVER ADDRESS INTO PNTR
|
||||
STA DRIVER.PTR
|
||||
LDA VAL.A+1
|
||||
STA DRIVER.PTR+1
|
||||
LDY #0
|
||||
CMP #$C0 IS IT IN ROM AREA?
|
||||
BCC .3 ...NO
|
||||
LDA IO.OFF ...YES, TURN OFF $C800 SPACE
|
||||
STY RETRY.COUNT
|
||||
LDA (DRIVER.PTR),Y CHECK FOR ROM PRESENT
|
||||
CMP #$FF
|
||||
BEQ .4 ...NOT VALID ROM VALUE
|
||||
.1 CMP (DRIVER.PTR),Y BETTER NOT CHANGE...
|
||||
BNE .4 ...WOOPS, NOT ROM
|
||||
DEC RETRY.COUNT TRY IT 256 TIMES
|
||||
BNE .1 ...AGAIN
|
||||
.2 CLC ...REALLY A DRIVER
|
||||
RTS
|
||||
*---VERIFY RAM-BASED DRIVER------
|
||||
.3 LDA (DRIVER.PTR),Y GET FIRST BYTE
|
||||
CMP #$D8 "CLD" OPCODE?
|
||||
BEQ .2 ...YES, VALID DRIVER
|
||||
.4 SEC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.prin
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
65
SCMASM.30/SCI.S.RWPA.txt
Normal file
65
SCMASM.30/SCI.S.RWPA.txt
Normal file
@ -0,0 +1,65 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
WRITE
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCS .1 ...NOT OPEN
|
||||
STA WRITE.REFNUM
|
||||
LDA CSWL
|
||||
STA VDOSIO
|
||||
LDA CSWH
|
||||
STA VDOSIO+1
|
||||
LDA #WRITE.TEXT.FILE
|
||||
STA CSWL
|
||||
LDA /WRITE.TEXT.FILE
|
||||
STA CSWH
|
||||
LDA #$FF
|
||||
STA F.WRITE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* OUTPUT HOOK DURING A WRITE OPERATION
|
||||
*--------------------------------
|
||||
WRITE.TEXT.FILE
|
||||
AND #$7F PRODOS STANDARD IS BIT7=0
|
||||
STA WRITE.OUTPUT.CHAR
|
||||
JSR SAVE.REGS
|
||||
LDX WRITE.REFNUM
|
||||
STX READ.WRITE.PARMS+1
|
||||
ASL IGNORE BIT 7
|
||||
BEQ .2 END OF FILE
|
||||
LDA #WRITE.OUTPUT.CHAR
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /WRITE.OUTPUT.CHAR
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #1
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CB WRITE
|
||||
BCC RESTORE.REGS
|
||||
*--------------------------------
|
||||
.1 JMP ERROR.HANDLER
|
||||
*--------------------------------
|
||||
.2 STX MISC.PARMS+1
|
||||
JSR MLI.CF READ MARK
|
||||
BCS .1
|
||||
JSR MLI.D0 SET EOF
|
||||
BCS .1 ...ERROR
|
||||
*---fall into RESTORE.REGS-------
|
||||
*--------------------------------
|
||||
RESTORE.REGS
|
||||
LDY PREGY
|
||||
LDX PREGX
|
||||
LDA PREGA
|
||||
RTS
|
||||
*--------------------------------
|
||||
SAVE.REGS
|
||||
STA PREGA
|
||||
STX PREGX
|
||||
STY PREGY
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.rwpa
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
180
SCMASM.30/SCI.S.TABLES.txt
Normal file
180
SCMASM.30/SCI.S.TABLES.txt
Normal file
@ -0,0 +1,180 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
CN. .SE 1
|
||||
.MA CMD
|
||||
CN. .SE CN.+1
|
||||
CN.]2 .EQ CN.
|
||||
.AT /]2]3/
|
||||
.DA ]2
|
||||
.HS ]1
|
||||
.EM
|
||||
*--------------------------------
|
||||
COMMAND.TABLE
|
||||
.AT /-/
|
||||
.DA DASH
|
||||
.HS 0104
|
||||
>CMD 05F4,BLOAD
|
||||
>CMD 01F4,BRUN
|
||||
>CMD 0DF4,BSAVE
|
||||
>CMD 0000,BYE
|
||||
>CMD 9504,CATALOG
|
||||
>CMD 9504,CAT
|
||||
>CMD 0100,CLOSE
|
||||
>CMD 0D84,CREATE
|
||||
|
||||
* >CMD 0104,DELETE
|
||||
|
||||
CN. .SE CN.+1
|
||||
CN.DELETE .EQ CN.
|
||||
.AT /DELETE/
|
||||
.DA MLI.C1
|
||||
.HS 0104
|
||||
|
||||
>CMD 0107,EXEC
|
||||
>CMD 4080,IN,#
|
||||
>CMD 0504,LOAD
|
||||
>CMD 0104,LOCK
|
||||
>CMD 0000,NOPREFIX
|
||||
>CMD 0000,NOW
|
||||
>CMD 0000,ONLINE
|
||||
>CMD 2D14,OPEN
|
||||
>CMD 4080,PR,#
|
||||
>CMD 9104,PREFIX
|
||||
>CMD 0304,RENAME
|
||||
>CMD 0D04,SAVE
|
||||
>CMD 0104,UNLOCK
|
||||
>CMD 1104,VERIFY
|
||||
>CMD 2147,WRITE
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
* PARAMETER NAME TABLE
|
||||
*--------------------------------
|
||||
PARM.NAMES
|
||||
.AS /ABELSDFRV/
|
||||
NO.PARM.NAMES .EQ *-PARM.NAMES
|
||||
*--------------------------------
|
||||
* BIT MASK FOR PARAMETERS IN PERMISSION BITS
|
||||
*--------------------------------
|
||||
* A B E L S D F R V @
|
||||
PARM.MASKS
|
||||
.HS 80.40.20.10.04.04.02.01.00
|
||||
*--------------------------------
|
||||
* XXXXXXYY where yy+1= # of bytes
|
||||
* xxxxxx= offset from VAL.A
|
||||
* of last byte
|
||||
*--------------------------------
|
||||
.MA PAR
|
||||
.DA #VAL.]1-VAL.A+]2-1*4+]2-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
PARM.VARIABLES
|
||||
>PAR A,2
|
||||
>PAR B,3
|
||||
>PAR E,2
|
||||
>PAR L,2
|
||||
>PAR S,1
|
||||
>PAR D,1
|
||||
>PAR F,2
|
||||
>PAR R,2
|
||||
>PAR V,1
|
||||
*--------------------------------
|
||||
* FILE TYPE CODES
|
||||
*--------------------------------
|
||||
.MA FT
|
||||
.AS -/]1/
|
||||
.HS ]2
|
||||
.EM
|
||||
*--------------------------------
|
||||
FILE.TYPES
|
||||
>FT TXT,04
|
||||
>FT BIN,06
|
||||
>FT DIR,0F
|
||||
>FT ADB,19
|
||||
>FT AWP,1A
|
||||
>FT ASP,1B
|
||||
>FT PAS,EF
|
||||
>FT CMD,F0
|
||||
>FT S-C,FA (NORMALLY "INT")
|
||||
>FT IVR,FB
|
||||
>FT BAS,FC
|
||||
>FT VAR,FD
|
||||
>FT REL,FE
|
||||
>FT SYS,FF
|
||||
LAST.FILE.TYPE .EQ *-FILE.TYPES-1
|
||||
*--------------------------------
|
||||
* NAMES OF THE MONTHS
|
||||
*--------------------------------
|
||||
MONTH.NAMES
|
||||
.AS -/JFMAMJJASOND/
|
||||
.AS -/AEAPAUUUECOE/
|
||||
.AS -/NBRRYNLGPTVC/
|
||||
*--------------------------------
|
||||
NO.DATE.MSG
|
||||
.AS -/<NO DATE>/
|
||||
*--------------------------------
|
||||
* MLI ERROR CODES
|
||||
*--------------------------------
|
||||
MLI.ERROR.CODES
|
||||
.HS 282B4041424344454647
|
||||
.HS 48494B4C4D4E505356
|
||||
*--------------------------------
|
||||
* EQUIVALENT BI ERROR CODES
|
||||
*--------------------------------
|
||||
BI.ERROR.CODES
|
||||
.HS 0304100C0C1206068613 (86 IS A TRICK)
|
||||
.HS 09110D05020A140B0C08
|
||||
*--------------------------------
|
||||
SCI.MESSAGES
|
||||
.AC 0 INIT NYBBLE.FLAG
|
||||
.AC 1"ACDEFILNOPRST %"
|
||||
.AC 2"BGHKMUVWXY/():."
|
||||
.AC 3"QZ-4567890123@&"
|
||||
Q.BLOCKS.ABOVE .EQ 0
|
||||
.AC / BLOCKS SHOWN ABOVE:6%/
|
||||
*--------------------------------
|
||||
Q.DIRHDR .EQ 1
|
||||
.AC /TYPE NAME2BLOCKS MODIFIED9CREATED9ENDFILE AUXTYPE%/
|
||||
*--------------------------------
|
||||
.AC /RANGE ERROR%/
|
||||
.AC /NO DEVICE CONNECTED%/
|
||||
.AC /WRITE PROTECTED%/
|
||||
.AC /END OF DATA%/
|
||||
.AC /PATH NOT FOUND%/
|
||||
*--------------------------------
|
||||
Q.BLOCKS .EQ 7
|
||||
.AC / VOLUME BLOCKS USED:8FREE:8TOTAL:5%/
|
||||
*--------------------------------
|
||||
.AC "I/O ERROR%"
|
||||
.AC /DISK FULL%/
|
||||
.AC /FILE LOCKED%/
|
||||
.AC /INVALID PARAMETER%/
|
||||
.AC /NO BUFFERS AVAILABLE%/
|
||||
.AC /FILE TYPE MISMATCH%/
|
||||
.AC /PROGRAM TOO LARGE%/
|
||||
.AC /NOT DIRECT COMMAND%/
|
||||
.AC /SYNTAX ERROR%/
|
||||
.AC /DIRECTORY FULL%/
|
||||
.AC /FILE NOT OPEN%/
|
||||
.AC /DUPLICATE FILE NAME%/
|
||||
.AC /FILE BUSY%/
|
||||
.AC /FILE(S) STILL OPEN%/
|
||||
*--------------------------------
|
||||
.AC "%"
|
||||
*ZZ.MESSAGES .EQ *-MESSAGES
|
||||
*--------------------------------
|
||||
SCI.FIRST.TABLE .EQ *
|
||||
.HS 00
|
||||
.AS -"ACDEFILNOPRST "
|
||||
.HS 8D
|
||||
SCI.SECOND.TABLE .EQ *
|
||||
.HS 00
|
||||
.AS -"BGHKMUVWXY/():."
|
||||
SCI.THIRD.TABLE .EQ *
|
||||
.AS -"JQZ-"
|
||||
.HS 05.06.07.08.09.0A.0B.0C.0D.0E.0F.10 (BLANK COUNTS+1)
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.tables
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
53
SCMASM.30/SCI.S.VARS.txt
Normal file
53
SCMASM.30/SCI.S.VARS.txt
Normal file
@ -0,0 +1,53 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ALLOCATED.BUFFER.PAGE .BS 1
|
||||
*--------------------------------
|
||||
FNLEN .BS 1
|
||||
RECORD.LENGTH .BS 2
|
||||
PARM.LENM1 .BS 1
|
||||
PARM.OFFSET .BS 1
|
||||
ACCUM .BS 3
|
||||
OVERFLOW .BS 1
|
||||
COMMAND.ADDR .BS 2
|
||||
BLOCKS .BS 2
|
||||
*--------------------------------
|
||||
MONTH .BS 1
|
||||
DAY .BS 1
|
||||
YEAR .BS 1
|
||||
*--------------------------------
|
||||
CAT.WIDTH .BS 1
|
||||
ENTRY.LENGTH .BS 1
|
||||
ENTRIES.PER.BLOCK .BS 1
|
||||
FILE.COUNT .BS 2
|
||||
ENTRY.COUNTER .BS 1
|
||||
*--------------------------------
|
||||
CAT.INDEX .BS 1
|
||||
*--------------------------------
|
||||
FILE.REFNUMS .BS 2
|
||||
FILE.BUFFER.PNTRS .BS 2
|
||||
*--------------------------------
|
||||
EXEC.REFNUM .BS 1
|
||||
EXEC.INPUT.CHAR .BS 1
|
||||
*--------------------------------
|
||||
WRITE.REFNUM .BS 1
|
||||
WRITE.OUTPUT.CHAR .BS 1
|
||||
*--------------------------------
|
||||
PATHNAME.ONE.BUFFER .BS 1
|
||||
TXTBUF .BS 65
|
||||
*--------------------------------
|
||||
* OPEN FILE NAME BUFFERS
|
||||
* 3 BUFFERS, 32 BYTES EACH
|
||||
* 0 -- # BYTES IN FILE NAME (bits (6-0)
|
||||
* Bit 7 = DIR file READ flag
|
||||
* 1 -- L value lsb
|
||||
* 2 -- L value msb
|
||||
* 3-31 -- file name, backwards
|
||||
*--------------------------------
|
||||
OPEN.FILE.NAME.BUFFERS
|
||||
.BS 32*3
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/sci.s.vars
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
103
SCMASM.30/SCMASM.S.ACDIR.txt
Normal file
103
SCMASM.30/SCMASM.S.ACDIR.txt
Normal file
@ -0,0 +1,103 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
TABLE1 .EQ $BE00-48
|
||||
TABLE2 .EQ $BE00-32
|
||||
TABLE3 .EQ $BE00-16
|
||||
*--------------------------------
|
||||
DIR.AC
|
||||
JSR GNNB GET NEXT NON-BLANK FOR DELIMITER
|
||||
BCS .8 ...ERROR
|
||||
STA DLIM IN CASE IT IS A DELIMITER
|
||||
EOR #'0'
|
||||
BEQ .9 ...INITIAL STRING
|
||||
CMP #4
|
||||
BCC .10
|
||||
*---GET NEXT CHAR OF STRING------
|
||||
.2 JSR GNC GET NEXT CHAR TO ENCODE
|
||||
BCS .8 ...ERROR
|
||||
CMP DLIM
|
||||
BEQ .7 ...END OF STRING
|
||||
*---SEARCH TABLE 1---------------
|
||||
LDY #15
|
||||
.3 CMP TABLE1,Y
|
||||
BEQ .6 ...FOUND IT
|
||||
DEY
|
||||
BNE .3
|
||||
*---SEARCH TABLE 2---------------
|
||||
JSR OUTPUT.NYBBLE.Y
|
||||
LDY #15
|
||||
.4 CMP TABLE2,Y
|
||||
BEQ .6 ...FOUND IT
|
||||
DEY
|
||||
BNE .4
|
||||
*---SEARCH TABLE 3---------------
|
||||
JSR OUTPUT.NYBBLE.Y
|
||||
LDY #15
|
||||
.5 CMP TABLE3,Y
|
||||
BEQ .6 ...FOUND IT
|
||||
DEY
|
||||
BNE .5
|
||||
*---NOT IN ANY TABLE-------------
|
||||
JSR OUTPUT.NYBBLE.Y
|
||||
PHA
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAY
|
||||
JSR OUTPUT.NYBBLE.Y
|
||||
PLA
|
||||
AND #$0F
|
||||
TAY
|
||||
*---OUTPUT TABLE INDEX-----------
|
||||
.6 JSR OUTPUT.NYBBLE.Y
|
||||
*---NEXT CHAR--------------------
|
||||
JMP .2
|
||||
*---END OF STRING----------------
|
||||
.9 STA NYBBLE.FLAG
|
||||
.7 RTS
|
||||
*---ERROR------------------------
|
||||
.8 JMP ERBA
|
||||
*---READ NEW CODING TABLES-------
|
||||
.10 SBC #0 CHANGE TO 0,1,2
|
||||
ASL *16
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
TAX
|
||||
JSR GNC
|
||||
BCS .7 ...NO STRING
|
||||
STA DLIM
|
||||
.11 JSR GNC ...ALLOW LOWER CASE
|
||||
BCS .8 ...ERROR
|
||||
CMP DLIM
|
||||
BEQ .7 ...END OF STRING
|
||||
INX
|
||||
CPX #48
|
||||
BCS .8 ...GONE TOO FAR
|
||||
STA TABLE1,X
|
||||
BCC .11 ...ALWAYS
|
||||
*--------------------------------
|
||||
OUTPUT.NYBBLE.Y
|
||||
PHA SAVE A-REG
|
||||
TYA
|
||||
LSR NYBBLE.FLAG
|
||||
BCS .1 ...IT WAS = $01
|
||||
ASL ...IT WAS = $00
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
STA BYTE
|
||||
INC NYBBLE.FLAG
|
||||
PLA
|
||||
RTS
|
||||
.1 ORA BYTE
|
||||
JSR EMIT
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.acdir
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
369
SCMASM.30/SCMASM.S.ASMGEN.txt
Normal file
369
SCMASM.30/SCMASM.S.ASMGEN.txt
Normal file
@ -0,0 +1,369 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* ASSEMBLER MAIN DRIVER
|
||||
*--------------------------------
|
||||
ASM
|
||||
* LDX #0 X=0 FROM COMMAND DISPATCHER
|
||||
STX PASS SET TO PASS 1
|
||||
STX ERROR.COUNT
|
||||
STX ERROR.COUNT+1
|
||||
* STX MACRO.LEVEL ALREADY DONE IN GNL
|
||||
* STX PARAM.PNTR ALREADY DONE IN GNL
|
||||
* STX PAGE.LENGTH ALREADY DONE IN GNL
|
||||
STX PAGE.NUMBER
|
||||
STX PAGE.NUMBER+1
|
||||
JSR STINIT INITIALIZE SYMBOL TABLE
|
||||
JSR RESTORE IF IN INCLUDE, RESTORE
|
||||
*--------------------------------
|
||||
* PERFORM NEXT PASS OF ASSEMBLY
|
||||
*--------------------------------
|
||||
ASM1 LDA ERROR.COUNT
|
||||
ORA ERROR.COUNT+1
|
||||
BEQ .1
|
||||
JMP ASM.END PRINT # ERRORS AND ABORT ASSEMBLY
|
||||
.1 LDX #1 INIT 2-BYTE VARIABLES
|
||||
.2 LDA PP,X POINT TO BEGINNING OF SOURCE PROGRAM
|
||||
STA SRCP,X
|
||||
STA MACSTK,X
|
||||
LDA #0
|
||||
STA CALL.CNTR,X TOTAL # MACRO CALLS
|
||||
STA CALL.NUM,X CURRENT MACRO CALL #
|
||||
STA ORGN+2,X HIGH 16 OF ORIGIN
|
||||
DEX
|
||||
BPL .2
|
||||
*---Following = $FF--------------
|
||||
STX DO.STACK SET OUTER LEVEL TRUE (=$FF)
|
||||
STX LF.CONDITIONAL do not list false sets (=$FF)
|
||||
*---Following = $00--------------
|
||||
STA DUMMY.FLAG NOT IN DUMMY SECTION
|
||||
STA PHASE.FLAG NOT IN PHASE
|
||||
STA DO.INDEX SET DO.STACK TO EMPTY
|
||||
STA LF.ALL turn on main listing
|
||||
STA LF.MACRO list macro expansions too
|
||||
STA LF.XTRA.BYTES list all bytes, use extra lines
|
||||
STA TF.FLAG not in ".TF"
|
||||
STA DO.SKIP.CNT not in ".DO"
|
||||
STA FLAG.MA not in ".MA"
|
||||
STA NYBBLE.FLAG .AC odd/even
|
||||
STA ORGN ORIGIN = $0800
|
||||
STA TRGT TARGET = $0800
|
||||
*---Following = $08--------------
|
||||
LDA #$08
|
||||
STA ORGN+1
|
||||
STA TRGT+1
|
||||
JSR ASM.INIT Initialize for particular assembler
|
||||
*--------------------------------
|
||||
* MOVE NEXT LINE INTO WORKING BUFFER
|
||||
*--------------------------------
|
||||
ASM2 LDA $C000 CHECK FOR ABORT WITHOUT
|
||||
CMP #CHR.RETURN CLEARING STROBE
|
||||
BNE .1
|
||||
JMP JMP.SOFT YES, STOP RIGHT NOW
|
||||
.1 LDX #$FF INITIALIZE STACK POINTER
|
||||
TXS
|
||||
INX MAKE X=0
|
||||
STX EMIT.COLUMN
|
||||
STX EXP.UNDEF CLEAR UNDEFINED FLAG
|
||||
JSR SETUP.NEXT.LINE
|
||||
BCC .2 GOT A LINE
|
||||
JMP ENDM NO MORE LINES, ACT LIKE .EN FOUND
|
||||
*---CHECK CURRENT CONDITION------
|
||||
.2 LDA DO.STACK CURRENT LEVEL IN SIGN BIT
|
||||
BMI ASSEMBLE.ONE.LINE TRUE, SO ASSEMBLE
|
||||
*--------------------------------
|
||||
* SKIP TO .FIN OR .ELSE
|
||||
*--------------------------------
|
||||
SKIP.TO.FIN
|
||||
JSR SCAN.TO.OPCODE
|
||||
BCS .3
|
||||
LDX #DIR.QT.DO
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCC .1 NOT .DO
|
||||
INC DO.SKIP.CNT .DO
|
||||
BNE .3 ...ALWAYS
|
||||
.1 LDY DO.SKIP.CNT
|
||||
BNE .2 INSIDE A NESTED .DO, IGNORE .ELSE'S
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCS ASSEMBLE.ONE.LINE FOUND .ELSE
|
||||
.2 LDX #DIR.QT.FI
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCC .3 NOT .FIN
|
||||
LDY DO.SKIP.CNT .FIN, SEE IF NESTED ONE
|
||||
BEQ ASSEMBLE.ONE.LINE NO, ASSEMBLE THIS .FIN
|
||||
DEC DO.SKIP.CNT YES, POP OFF THIS NEST
|
||||
.3 BIT LF.CONDITIONAL LIST CONDITIONAL LINES?
|
||||
BMI ASM2 NO, SKIP IT
|
||||
JSR CRLF.IF.LISTING YES, NEW LINE
|
||||
JMP CMNT AND LIST IT
|
||||
*--------------------------------
|
||||
* ANALYZE SOURCE LINE
|
||||
*--------------------------------
|
||||
ASSEMBLE.ONE.LINE
|
||||
JSR CRLF.IF.LISTING
|
||||
JSR PACK.MACRO.LINE
|
||||
BCS CMNT ...only list if MACRO definition line
|
||||
JSR GNC.UC.START not MACRO line, get first char
|
||||
BCS CMNT ...empty line
|
||||
BEQ .3 ...blank, so no label
|
||||
JSR CHECK.COMMENT.CHAR
|
||||
BEQ CMNT ...comment (* or ;)
|
||||
JSR LABL PROCESS LABEL DEFINITION
|
||||
.3 JSR GNNB Scan to opcode field
|
||||
BCS CMNT ...none, only label on this line
|
||||
JSR CHECK.COMMENT.CHAR might be a comment with no opcode
|
||||
BEQ CMNT ...yes, there is a comment
|
||||
CMP #'> CHECK IF MACRO OPCODE
|
||||
BEQ .4 ...YES
|
||||
CMP #'_ CHECK IF MACRO OPCODE
|
||||
BEQ .4 ...YES
|
||||
CMP #'='
|
||||
BEQ .5 '=' is synonym for .EQ
|
||||
STA SEARCH.KEY FIRST OPCODE CHAR
|
||||
JSR GNC.UC
|
||||
STA SEARCH.KEY+1 2ND OPCODE CHAR
|
||||
JSR GNC.UC
|
||||
STA SEARCH.KEY+2 3RD OPCODE CHAR
|
||||
LDA SEARCH.KEY
|
||||
CMP #'. IS IT A DIRECTIVE?
|
||||
BNE .6 NO, TRY NORMAL OPCODES
|
||||
LDA #OPTBL.DIR
|
||||
LDY /OPTBL.DIR
|
||||
CLC INITIAL SEARCH
|
||||
JSR SEARCH.COMPRESSED.TABLE
|
||||
BCC OPER ...NOT FOUND IN TABLE
|
||||
JSR PERFORM.DIRECTIVE
|
||||
JMP CMNT
|
||||
.4 JMP MACRO.CALL
|
||||
.5 JSR PSEQ "=" is synonym for .EQ
|
||||
JMP CMNT
|
||||
.6 JSR ASM.PARTICULAR
|
||||
*--------------------------------
|
||||
CMNT LDA EXP.UNDEF
|
||||
BPL .1 NO UNDEFINED EXPRESSIONS ON THIS LINE
|
||||
LDA PASS
|
||||
BEQ .1 IF WE GOT THIS FAR, OKAY IN PASS 1
|
||||
JMP UNDF
|
||||
.1 JSR LIST.SOURCE.IF.LISTING
|
||||
JMP ASM2 NEXT LINE
|
||||
*--------------------------------
|
||||
*--------------------------------
|
||||
PERFORM.DIRECTIVE
|
||||
INY POINT AT HIGH BYTE OF ADDRESS
|
||||
LDA (OPTBL.PNTR),Y
|
||||
PHA
|
||||
DEY
|
||||
LDA (OPTBL.PNTR),Y
|
||||
PHA
|
||||
RTS
|
||||
*--------------------------------
|
||||
OPER LDY #QER2 ERROR--BAD OPCODE
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
* EMIT ONE BYTE OF OBJECT CODE
|
||||
*
|
||||
* IF IN PASS TWO THEN
|
||||
* ! IF LISTING THEN <LIST>
|
||||
* ! IF IN ".TF" THEN
|
||||
* ! ! <WRITE BYTE ON DISK>
|
||||
* ! ELSE IF NOT IN DUMMY SECTION THEN
|
||||
* ! ! ! IF IN PROTECTED AREA THEN
|
||||
* ! ! ! ! <ABORT ASSEMBLY>
|
||||
* ! ! ! ELSE <STORE BYTE IN TARGET>
|
||||
* INCREMENT ORIGIN AND ORIGIN.SAVE
|
||||
* IF NOT IN DUMMY SECTION THEN INCREMENT TARGET
|
||||
*--------------------------------
|
||||
EMIT.ZERO
|
||||
LDA #0
|
||||
EMIT LDY PASS CHECK WHICH PASS
|
||||
BEQ .5 PASS 1, JUST INCREMENT LOCATION
|
||||
STA OBJ.BYTE SAVE OBJECT BYTE
|
||||
*---LIST THE BYTE----------------
|
||||
JSR P.EMITTED.BYTE
|
||||
*---STORE THE BYTE---------------
|
||||
BIT DUMMY.FLAG No output inside dummy section
|
||||
BMI .6 ...only increment the origin
|
||||
LDA OBJ.BYTE GET OUTPUT BYTE
|
||||
BIT TF.FLAG SEE IF IN ".TF"
|
||||
BMI .4 YES
|
||||
JSR USER.OBJECT.BYTE
|
||||
JMP .5 ...ALWAYS
|
||||
.4 JSR DOUT WRITE ON TARGET FILE
|
||||
*---INCREMENT LOCATION-----------
|
||||
.5 LDA DUMMY.FLAG IF IN DUMMY SECTION,
|
||||
BMI .6 THEN ONLY INCREMENT ORGN
|
||||
>INCD TRGT BUMP TARGET ADDRESS
|
||||
>INCD ORIGIN.SAVE AND ORIGIN OUTSIDE .PH
|
||||
.6 >INCD ORGN BUMP CURRENT ORIGIN
|
||||
RTS
|
||||
*--------------------------------
|
||||
STORE.OBJECT.BYTE
|
||||
LDA TRGT+1 TARGET PAGE
|
||||
BNE .1 NOT PAGE ZERO
|
||||
LDA TRGT ALLOW $00-$1E
|
||||
CMP #$1F
|
||||
BCC .4 SAFE
|
||||
BCS .3 NOT SAFE
|
||||
*---ALLOW $300-$3CF--------------
|
||||
.1 CMP #$03 IN PAGE 3?
|
||||
BNE .2 NO
|
||||
LDA TRGT BELOW $3D0?
|
||||
CMP #$D0
|
||||
BCC .4 YES, SAFE
|
||||
BCS .3 NO, NOT SAFE
|
||||
.DO AUXMEM
|
||||
*---ALLOW $800-MACSTK------------
|
||||
.2 CMP #$08 BELOW PAGE 8?
|
||||
BCC .3 YES, NOT SAFE
|
||||
LDA TRGT
|
||||
CMP MACSTK
|
||||
LDA TRGT+1
|
||||
SBC MACSTK+1
|
||||
BCC .4 BELOW MACSTK, SAFE
|
||||
.ELSE
|
||||
*---ALLOW $800-MACLBL------------
|
||||
.2 CMP #$08 BELOW PAGE 8?
|
||||
BCC .3 YES, NOT SAFE
|
||||
LDA TRGT NO, COMPARE TO MACLBL
|
||||
CMP MACLBL
|
||||
LDA TRGT+1
|
||||
SBC MACLBL+1
|
||||
BCC .4 BELOW MACLBL, SO SAFE
|
||||
*---ALLOW EOT-MACSTK-------------
|
||||
LDA EOT
|
||||
CMP TRGT
|
||||
LDA EOT+1
|
||||
SBC TRGT+1
|
||||
BCS .3 BELOW EOT, NOT SAFE
|
||||
LDA TRGT
|
||||
CMP MACSTK
|
||||
LDA TRGT+1
|
||||
SBC MACSTK+1
|
||||
BCC .4 BELOW MACSTK, SAFE
|
||||
.FIN
|
||||
*---NOT SAFE, CHECK USER RANGE---
|
||||
.3 LDA TRGT
|
||||
CMP USER.MEM.LO
|
||||
LDA TRGT+1
|
||||
SBC USER.MEM.LO+1
|
||||
BCC .5 DEFINITELY OUT OF BOUNDS
|
||||
LDA USER.MEM.HI
|
||||
CMP TRGT
|
||||
LDA USER.MEM.HI+1
|
||||
SBC TRGT+1
|
||||
BCC .5 DEFINITELY OUT OF BOUNDS
|
||||
.4 LDY #0
|
||||
LDA OBJ.BYTE
|
||||
STA (TRGT),Y
|
||||
RTS
|
||||
.5 LDY #QMEMPRO
|
||||
JMP FIRM.ERROR
|
||||
*--------------------------------
|
||||
* LIST SOURCE LINE
|
||||
*--------------------------------
|
||||
LIST.SOURCE.IF.LISTING
|
||||
JSR CHECK.IF.LISTING
|
||||
LIST.SOURCE.REGARDLESS
|
||||
JSR P.MARGIN PRINT BLANKS TILL MARGIN
|
||||
LIST.SOURCE.AT.MARGIN
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
LDY MACRO.LEVEL
|
||||
BEQ .2
|
||||
LDA #'>'
|
||||
.1 JSR CHO
|
||||
DEY
|
||||
BNE .1 ...UNTIL Y=0
|
||||
.2 LDA #' ' ...NOW Y=0
|
||||
.3 JSR CHO
|
||||
INY
|
||||
LDA WBUF-1,Y
|
||||
BNE .3
|
||||
RTS
|
||||
*--------------------------------
|
||||
* PRINT CRLF IF IN PASS 2 AND IF LISTING IS ON
|
||||
*--------------------------------
|
||||
CRLF.CAUSED.FORM.FEED
|
||||
JSR FORM.FEED
|
||||
CRLF.IF.LISTING
|
||||
JSR CHECK.IF.LISTING
|
||||
CRLF.WITH.PAGING
|
||||
JSR CRLF
|
||||
INC LINE.COUNT
|
||||
LDA PAGE.LENGTH
|
||||
BEQ .1 ...NOT TITLING
|
||||
CMP LINE.COUNT
|
||||
BCC CRLF.CAUSED.FORM.FEED ...END OF PAGE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* PROCESS LABEL DEFINITION
|
||||
*--------------------------------
|
||||
LABL JSR PACK PACK AND CHECK SYMBOL
|
||||
BCC ERR.BS BAD SYMBOL
|
||||
JSR STSRCH SEE IF DEFINED
|
||||
BCC ERR.DD YES, DOUBLE DEFINITION
|
||||
JMP STADD ADD TO SYMBOL TABLE
|
||||
*--------------------------------
|
||||
ERR.DD LDY PASS ERROR IN PASS 1
|
||||
BEQ ERR.DBLDF OK IN PASS 2
|
||||
LDY #6 SET FLAG FOR TESTING FWD REFS
|
||||
>SYM LDA,STPNTR
|
||||
ORA #$40
|
||||
>SYM STA,STPNTR
|
||||
LDY WBUF LOOK AT COLUMN 1
|
||||
CPY #': IF PRIVATE LABEL...
|
||||
BEQ .2 ...THEN DON'T UPDATE C.M.LABEL
|
||||
LDA STPNTR SAVE POINTER TO THIS MAJOR LABEL
|
||||
STA CURRENT.MAJOR.LABEL
|
||||
LDA STPNTR+1
|
||||
STA CURRENT.MAJOR.LABEL+1
|
||||
.2 RTS
|
||||
ERR.DBLDF
|
||||
LDY #QER4 DOUBLE DEFN
|
||||
.HS 2C SKIP 2 BYTES
|
||||
ERR.BS LDY #QER7 BAD SYMBOL
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
* Search Compressed Opcode Table
|
||||
* If carry clear, (Y,A) = address of table
|
||||
* If carry set, continue searching same table
|
||||
*
|
||||
* Return with carry set if found, else carry clear.
|
||||
* (OPTBL.PNTR),Y points at 16-bit value
|
||||
* of entry which matched.
|
||||
*--------------------------------
|
||||
SEARCH.COMPRESSED.TABLE
|
||||
BCS .6 ...Continue searching same table
|
||||
STA OPTBL.PNTR
|
||||
STY OPTBL.PNTR+1
|
||||
*---Try matching 2nd letter------
|
||||
LDY #0
|
||||
.1 LDA (OPTBL.PNTR),Y Possible match
|
||||
ORA #$40 Make it ASCII
|
||||
CMP SEARCH.KEY+1 same as 2nd letter?
|
||||
BEQ .6 ...yes, matched.
|
||||
BNE .3 ...no
|
||||
*---Scan to next 8-bit entry-----
|
||||
.2 INY
|
||||
INY
|
||||
.3 INY
|
||||
LDA (OPTBL.PNTR),Y
|
||||
BMI .2 ...another 24-bit entry
|
||||
ASL check if beyond our sub-group
|
||||
BPL .1 ...no, valid 2nd letter option
|
||||
.4 CLC ...no match in table, carry clear
|
||||
RTS
|
||||
*---Try matching 3rd letter------
|
||||
.5 INY
|
||||
.6 INY
|
||||
LDA (OPTBL.PNTR),Y
|
||||
BPL .4 ...no more options, not in table
|
||||
INY point at data
|
||||
EOR #$C0 make like ASCII
|
||||
CMP SEARCH.KEY+2 compare to 3rd letter
|
||||
BNE .5 ...did not match, try another
|
||||
RTS ...found it, return carry set
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.asmgen
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
114
SCMASM.30/SCMASM.S.ASMNL.txt
Normal file
114
SCMASM.30/SCMASM.S.ASMNL.txt
Normal file
@ -0,0 +1,114 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* SET UP NEXT LINE TO ASSEMBLE
|
||||
*--------------------------------
|
||||
SETUP.NEXT.LINE
|
||||
.1 BIT INFLAG
|
||||
BVS .5 ...INSIDE .INBx
|
||||
LDA SRCP CHECK IF AT END
|
||||
CMP HI.MEM TOP OF SOURCE CODE
|
||||
LDA SRCP+1
|
||||
SBC HI.MEM+1
|
||||
BCS .7 RETURN WITH CARRY SET
|
||||
.5 LDA MACRO.LEVEL IN SKELETON OR BODY?
|
||||
BEQ .2 BODY
|
||||
LDY #0 SEE IF END OF SKELETON
|
||||
>SYM LDA,SRCP
|
||||
BNE .3 NO, STILL IN SKELETON
|
||||
LDA (MACSTK),Y POP SKELETON OFF MACRO STACK
|
||||
STA CALL.NUM+1
|
||||
INY
|
||||
LDA (MACSTK),Y
|
||||
STA CALL.NUM
|
||||
INY
|
||||
LDA (MACSTK),Y
|
||||
STA LF.ALL Real value of listing option
|
||||
INY
|
||||
LDA (MACSTK),Y
|
||||
STA SRCP+1
|
||||
INY
|
||||
LDA (MACSTK),Y
|
||||
STA SRCP
|
||||
INY
|
||||
LDA (MACSTK),Y (HIGH BYTE)
|
||||
PHA
|
||||
INY
|
||||
LDA (MACSTK),Y (LOW BYTE)
|
||||
STA MACSTK
|
||||
PLA
|
||||
STA MACSTK+1
|
||||
DEC MACRO.LEVEL
|
||||
JMP .1
|
||||
*--------------------------------
|
||||
.2 JSR GET.LINE.NUMBER BODY
|
||||
.3 LDX #0
|
||||
.4 JSR GET.NEXT.SOURCE.CHAR
|
||||
BEQ .6 END OF LINE
|
||||
STA WBUF,X PUT INTO WORKING BUFFER
|
||||
INX
|
||||
BNE .4 ...ALWAYS
|
||||
.6 STA WBUF,X PUT ZERO ON END
|
||||
CLC RETURN WITH CARRY CLEAR
|
||||
.7 RTS
|
||||
*--------------------------------
|
||||
* GET NEXT CHARACTER FROM SOURCE LINE
|
||||
* (IF INSIDE A MACRO SKELETON, EXPAND PARAMETERS)
|
||||
*--------------------------------
|
||||
GET.NEXT.SOURCE.CHAR
|
||||
STX MACRO.SAVEX MUST PRESERVE X-REGISTER
|
||||
LDY PARAM.PNTR
|
||||
BNE .1 PRESENTLY EXPANDING A PARAMETER
|
||||
LDA MACRO.LEVEL IN A SKELETON?
|
||||
BNE .2 YES
|
||||
JMP NTKN NO
|
||||
*--------------------------------
|
||||
.1 INC PARAM.PNTR
|
||||
LDA (MACSTK),Y
|
||||
BNE .8 ...NORMAL CHAR
|
||||
STA PARAM.PNTR ...END OF PARAMETER
|
||||
.2 JSR NTKN
|
||||
BEQ .8 END OF LINE
|
||||
CMP #$7F PARAMETER?
|
||||
BNE .8 NO, NORMAL CHAR
|
||||
*---MACRO PARAMETER--------------
|
||||
JSR NTKN YES, GET PARAM #
|
||||
LDY #6
|
||||
CMP #'# ]# RETURNS NUMBER OF PARAMETERS (0-9)
|
||||
BEQ .5 ...FOUND ]#
|
||||
SEC
|
||||
SBC #'1' CHANGE "1"..."9" TO 0...8
|
||||
BEQ .4 ...]1
|
||||
TAX ...]2 THRU ]9
|
||||
.3 INY
|
||||
LDA (MACSTK),Y SKIP OVER A PARAMETER
|
||||
BNE .3
|
||||
DEX
|
||||
BNE .3
|
||||
.4 INY
|
||||
STY PARAM.PNTR
|
||||
BNE .1 ...ALWAYS
|
||||
*---NUMBER OF PARAMETERS---------
|
||||
.5 CLC
|
||||
LDA (MACSTK),Y
|
||||
SBC MACSTK
|
||||
TAY
|
||||
LDX #10
|
||||
.6 LDA (MACSTK),Y
|
||||
BNE .7
|
||||
DEX
|
||||
DEY
|
||||
CPY #7
|
||||
BCS .6
|
||||
LDX #0
|
||||
.7 TXA
|
||||
ORA #$30
|
||||
*--------------------------------
|
||||
.8 LDX MACRO.SAVEX RESTORE X-REG
|
||||
CMP #0 SET "EQ" STATUS IF END OF LINE
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.asmnl
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
241
SCMASM.30/SCMASM.S.DATA.txt
Normal file
241
SCMASM.30/SCMASM.S.DATA.txt
Normal file
@ -0,0 +1,241 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* PAGE ZERO VARIABLES
|
||||
*--------------------------------
|
||||
* $00 THRU $1F RESERVED FOR USER
|
||||
*---Apple Monitor, mostly--------
|
||||
MON.WIDTH .EQ $21
|
||||
CH80 .EQ $57B
|
||||
CH .EQ $24
|
||||
CV .EQ $25
|
||||
BASL .EQ $28
|
||||
YSAVE .EQ $2F
|
||||
ESCAPE.FLAG .EQ $30
|
||||
MON.MODE .EQ $31
|
||||
MON.INVFLG .EQ $32
|
||||
MON.YSAV .EQ $34
|
||||
HOOK.OUT .EQ $36,37
|
||||
HOOK.IN .EQ $38,39
|
||||
A0L .EQ $3A
|
||||
A0H .EQ $3B
|
||||
A1L .EQ $3C
|
||||
A1H .EQ $3D
|
||||
A2L .EQ $3E
|
||||
A2H .EQ $3F
|
||||
*--------------------------------
|
||||
* ProDOS USES $40-4F
|
||||
*--------------------------------
|
||||
A3L .EQ $40
|
||||
A3H .EQ $41
|
||||
A4L .EQ $42
|
||||
A4H .EQ $43
|
||||
*--------------------------------
|
||||
.DUMMY
|
||||
.OR $50
|
||||
*--------------------------------
|
||||
*
|
||||
* Following needed at all times
|
||||
*
|
||||
*--------------------------------
|
||||
SCREEN.WIDTH .BS 1
|
||||
INFLAG .BS 1
|
||||
LO.MEM .BS 2 START OF SYMBOL TABLE
|
||||
EOT .BS 2 END OF SYMBOL TABLE
|
||||
PP .BS 2 START OF SOURCE PROGRAM
|
||||
HI.MEM .BS 2 END OF SOURCE CODE
|
||||
*--------------------------------
|
||||
PAGE.NUMBER .BS 2
|
||||
PAGE.LENGTH .BS 1 =0 means no titles
|
||||
LINE.COUNT .BS 1
|
||||
DGTCNT .BS 1
|
||||
INCREMENT.VALUE .BS 2 FOR AUTO-LINE-NUMBERING (INIT=10)
|
||||
CURLNO .BS 2 NUMBER OF LAST-SUBMITTED LINE (INIT=990)
|
||||
PASS .BS 1 PASS NUMBER (0=PASS 1, 1=PASS 2)
|
||||
CHAR.PNTR .BS 1
|
||||
CURRENT.CHAR .BS 1 CURRENT CHARACTER FROM 'GNC'
|
||||
CURRENT.MAJOR.LABEL .BS 2 PNTR TO CURRENT MAJOR LABEL
|
||||
EXP.NEW .BS 1 NEW EXPRESSION FLAG
|
||||
STPNTR .BS 2 SYMBOL TABLE WORKING POINTER
|
||||
TPTR .BS 2 SYMBOL TABLE TEMP POINTER
|
||||
BASE.INDEX .BS 1 used in EXPR
|
||||
LC.MODE .BS 1
|
||||
EXP.VALUE .BS 4
|
||||
EXP.VALUE64 .BS 4
|
||||
SYM.VALUE .BS 4
|
||||
EXP.UNDEF .BS 1 UNDEFINED TERM FLAG
|
||||
EMIT.COLUMN .BS 1 KEEPS TRACK OF COLUMN FOR EMIT
|
||||
ORGN .BS 4
|
||||
RPTCHR .BS 1 (NML, NTKN)
|
||||
RPTCNT .BS 1 (NML, NTKN)
|
||||
PNTR .BS 2 SEARCH STRING PNTR
|
||||
INSAVE .BS 8
|
||||
*--------------------------------
|
||||
CALL.NUM .BS 2 CURRENT MACRO CALL NUMBER
|
||||
MACLBL .BS 2
|
||||
CONV.CTRL .BS 1 CONTROL FLAG INSIDE CONVERT.LINE.NUMBER
|
||||
MACRO.LEVEL .BS 1
|
||||
PARAM.PNTR .BS 1
|
||||
PARAM.CNT .BS 1
|
||||
*--------------------------------
|
||||
PROMPT.FLAG .BS 1 NULL, "H", OR "I"
|
||||
HIDE.HIMEM .BS 2 SAVES HIMEM DURING "HIDE"
|
||||
CURRENT.LINE.NUMBER .BS 2
|
||||
LF.ALL .BS 1 =0 TO LIST, <0 TO NOT LIST
|
||||
LF.MACRO .BS 1 =0 TO LIST MACRO EXPANSIONS
|
||||
FLAG.SPEED .BS 1
|
||||
DLIM .BS 1 ".AS" DELIMITER, also ASM
|
||||
SRCP .BS 2 POINTER TO CURRENT SOURCE LINE
|
||||
ENDP .BS 2 POINTER TO END OF LINE RANGE
|
||||
EXP.FWDREF .BS 1
|
||||
AUTOLN.FLAG .BS 1 +=MANUAL, -=AUTO LINE NUMBERS
|
||||
LINE.START .BS 2
|
||||
LINE.END .BS 2
|
||||
*--------------------------------
|
||||
ZP.COMMON .EQ *
|
||||
*--------------------------------
|
||||
*
|
||||
* Variables used only during SPECIFIC commands
|
||||
*
|
||||
*--------------------------------
|
||||
BLKSIZ .BS 1 used in MOVE.TEXT.UP and MOVE.TEXT.DOWN
|
||||
MOVE.DISTANCE .BS 2 used in NML, COPY, and MOVE.TEXT.UP
|
||||
AUTO.FLAG .BS 1 +=VERIFY, -=AUTO REPLACE
|
||||
CHANGE.CNT .BS 1 # OF REPLACEMENTS IN THIS LINE
|
||||
ED.FCOL .BS 1
|
||||
ED.FKEY .BS 1
|
||||
ED.PNTR .BS 1
|
||||
ED.BEGLIN .BS 1
|
||||
TEXT.OPTIONS .BS 1 used in TEXT command only
|
||||
REPLACE.LENGTH .BS 1
|
||||
SOURCE.LENGTH .BS 1
|
||||
WBUF.LENGTH .BS 1
|
||||
KEY.PNTR .BS 2 USED IN FIND, REPLACE
|
||||
BUF.PNTR .BS 2 USED IN FIND, REPLACE
|
||||
KEY.ADDR .BS 2 SEARCH KEY ADDRESS
|
||||
MATCH.END .BS 1
|
||||
LC.FLAG .BS 1 +=AS IS, -=ACCEPT BOTH CASES
|
||||
*--------------------------------
|
||||
.OR ZP.COMMON
|
||||
*--------------------------------
|
||||
*
|
||||
* Variables used only during Assembly
|
||||
*
|
||||
*--------------------------------
|
||||
SEARCH.KEY .BS 3 USED BY OPCODE SEARCH ROUTINE
|
||||
OPTBL.PNTR .BS 2 USED BY OPCODE SEARCH ROUTINE
|
||||
DO.INDEX .BS 1 DO level: =0 if empty, else 1-63
|
||||
DO.STACK .BS 8 64 bits, =1 if true
|
||||
DO.SKIP.CNT .BS 1 COUNTS .DO NESTS WHEN SKIPPING
|
||||
NYBBLE.FLAG .BS 1 .AC DIRECTIVE
|
||||
BYTE .BS 1 .AC DIRECTIVE
|
||||
PHASE.FLAG .BS 1 +=NORMAL, -=IN PHASE
|
||||
DUMMY.FLAG .BS 1 +=NORMAL, -=IN DUMMY SECTION
|
||||
TF.FLAG .BS 1
|
||||
TRGT .BS 2 TARGET ADDRESS
|
||||
MACSTK .BS 2 MACRO STACK POINTER
|
||||
ERROR.COUNT .BS 2
|
||||
*--------------------------------
|
||||
OBJ.BYTE .BS 1
|
||||
ADDR.LENGTH .BS 1
|
||||
LF.CONDITIONAL .BS 1 =0 TO LIST FALSE SETS
|
||||
LF.XTRA.BYTES .BS 1 =0 TO LIST XTRA BYTES ON XTRA LINES
|
||||
EMIT.MARGIN .BS 1 COLUMN FOR LINE NUMBER TO START IN
|
||||
MACRO.SAVEX .BS 1
|
||||
DUMMY.ORGN .BS 4
|
||||
ORIGIN.SAVE .BS 4
|
||||
FLAG.MA .BS 1
|
||||
CALL.CNTR .BS 2 TOTAL # OF MACRO CALLS
|
||||
*--------------------------------
|
||||
*---ONLY IN .BS DIRECTIVE--------
|
||||
BS.COUNT .BS 2 # BYTES TO RESERVE
|
||||
*---ONLY IN .AS & .AT DIRECTIVES
|
||||
AS.HIBIT .BS 1 BIT 7 VALUE FOR .AS/.AT
|
||||
AT.HIBIT .BS 1 BIT 7 TOGGLE FOR LAST BYTE BIT 7
|
||||
*--------------------------------
|
||||
*
|
||||
*---$EB reserved for ECHO TEXTALKER software---
|
||||
*
|
||||
*---$F0-FF reserved for ASM.PARTICULAR---
|
||||
*
|
||||
*--------------------------------
|
||||
.ED
|
||||
*--------------------------------
|
||||
* CHARACTER CODES
|
||||
*--------------------------------
|
||||
CHR.CTRL.I .EQ $89
|
||||
CHR.RETURN .EQ $8D
|
||||
CHR.BLANK .EQ $A0
|
||||
CHR.DOLLAR .EQ $A4
|
||||
CHR.STAR .EQ $AA
|
||||
CHR.DASH .EQ $AD
|
||||
CHR.PERIOD .EQ $2E
|
||||
CHR.BSLASH .EQ $DC
|
||||
*--------------------------------
|
||||
* MISCELLANEOUS SYMBOLS
|
||||
*--------------------------------
|
||||
SYMBOL .EQ $0100 SYMBOL PACK AREA
|
||||
HSHTBL .EQ $0130 HASH POINTER TABLE
|
||||
KBUF .EQ $0170 - $01BF KEY STRING
|
||||
WBUF .EQ $0200 WORKING BUFFER
|
||||
WBUF.MAX .EQ 248 AND ITS LENGTH
|
||||
PATHNAME .EQ $2CE (LAST 50 BYTES)
|
||||
*--------------------------------
|
||||
* ROM-BASED ROUTINES
|
||||
*--------------------------------
|
||||
MON.PRNTAX .EQ $F941
|
||||
MON.PRBL2 .EQ $F94A PRINT (X) BLANKS
|
||||
MON.INIT .EQ $FB2F TEXT MODE, FULL WINDOW
|
||||
MON.ADVANC .EQ $FBF4
|
||||
MON.BS .EQ $FC10
|
||||
MON.UP .EQ $FC1A
|
||||
MON.VTAB .EQ $FC22
|
||||
MON.CLREOP .EQ $FC42
|
||||
MON.HOME .EQ $FC58
|
||||
MON.LF .EQ $FC66
|
||||
MON.CLREOL .EQ $FC9C
|
||||
MON.DELAY .EQ $FCA8
|
||||
MON.RDKEY .EQ $FD0C READ NEXT CHAR
|
||||
MON.READCH .EQ $FD18
|
||||
MON.PHEX .EQ $FDDA PRINT BYTE IN HEX
|
||||
MON.COUT .EQ $FDED
|
||||
MON.BL1 .EQ $FE00
|
||||
MON.SETKBD .EQ $FE89
|
||||
MON.SETVID .EQ $FE93
|
||||
MON.OUTPORT .EQ $FE95 SET NEW PR#N OUTPUT
|
||||
MON.BELL .EQ $FF3A RING THE BELL
|
||||
MON.RTS .EQ $FF58 ONLY AN "RTS"
|
||||
MNTR .EQ $FF69 CALL-151 ENTRY INTO MONITOR
|
||||
MON.GETNUM .EQ $FFA7
|
||||
MON.TOSUB .EQ $FFBE
|
||||
MON.CHRTBL .EQ $FFCC MONITOR COMMAND CHAR TABLE
|
||||
*--------------------------------
|
||||
MON.RESET .EQ $3F2 THRU 3F4
|
||||
*--------------------------------
|
||||
.MA INCD
|
||||
INC ]1
|
||||
BNE :1
|
||||
INC ]1+1
|
||||
:1
|
||||
.EM
|
||||
*--------------------------------
|
||||
RDMAIN .EQ $C002
|
||||
RDAUX .EQ $C003
|
||||
RDROM .EQ $C082
|
||||
RDRAM .EQ $C083
|
||||
WRMAIN .EQ $C004
|
||||
WRAUX .EQ $C005
|
||||
AUX.CODE .EQ $DF00
|
||||
*--------------------------------
|
||||
.MA SYM
|
||||
.DO AUXMEM
|
||||
JSR ]1.]2
|
||||
.ELSE
|
||||
]1 (]2),Y
|
||||
.FIN
|
||||
.EM
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.data
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
308
SCMASM.30/SCMASM.S.DIR1.txt
Normal file
308
SCMASM.30/SCMASM.S.DIR1.txt
Normal file
@ -0,0 +1,308 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* DIRECTIVES
|
||||
*--------------------------------
|
||||
* .DUMMY -- START DUMMY SECTION
|
||||
*--------------------------------
|
||||
D.DUMMY
|
||||
LDA DUMMY.FLAG DO NOTHING IF ALREADY IN DUMMY
|
||||
BMI .2
|
||||
LDX #3
|
||||
.1 LDA ORGN,X
|
||||
STA DUMMY.ORGN,X
|
||||
DEX
|
||||
BPL .1
|
||||
STX DUMMY.FLAG SET FLAG NEGATIVE
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* .ED -- END DUMMY SECTION
|
||||
*--------------------------------
|
||||
D.END.DUMMY
|
||||
LDA DUMMY.FLAG
|
||||
BPL .2 DO NOTHING IF NOT IN .DUMMY
|
||||
LDX #3
|
||||
STX DUMMY.FLAG SET FLAG POSITIVE
|
||||
.1 LDA DUMMY.ORGN,X
|
||||
STA ORGN,X
|
||||
DEX
|
||||
BPL .1
|
||||
.2 RTS RETURN TO MAIN LEVEL OF ASM
|
||||
*---------------------------------
|
||||
* .PH -- START PHASE
|
||||
*--------------------------------
|
||||
D.PHASE
|
||||
JSR D.END.PHASE
|
||||
JSR EXPR.DEFINED GET PHASE ORIGIN
|
||||
LDX #3
|
||||
.1 LDA ORGN,X SAVE ORIGIN
|
||||
STA ORIGIN.SAVE,X
|
||||
LDA EXP.VALUE,X
|
||||
STA ORGN,X SET PHASE ORIGIN
|
||||
DEX
|
||||
BPL .1
|
||||
SEC SET FLAG TO $80
|
||||
ROR PHASE.FLAG
|
||||
RTS RETURN TO MAIN LEVEL OF ASM
|
||||
*--------------------------------
|
||||
* .EP -- END PHASE
|
||||
*--------------------------------
|
||||
D.END.PHASE
|
||||
ASL PHASE.FLAG TEST AND CLEAR FLAG
|
||||
BCC .2 IT WAS ALREADY CLEAR
|
||||
LDX #3
|
||||
.1 LDA ORIGIN.SAVE,X
|
||||
STA ORGN,X
|
||||
DEX
|
||||
BPL .1
|
||||
.2 RTS
|
||||
*---------------------------------
|
||||
* .OR -- SET ORIGIN
|
||||
*---------------------------------
|
||||
PSOR JSR EXPR.DEFINED GET ORIGIN VALUE
|
||||
LDX #3
|
||||
.1 LDA EXP.VALUE,X STORE IT IN
|
||||
STA ORGN,X LOCATION
|
||||
DEX COUNTER
|
||||
BPL .1
|
||||
LDA DUMMY.FLAG IF IN DUMMY SECTION, DON'T
|
||||
BMI RTS.1 ...IN DUMMY
|
||||
NEW.TARGET
|
||||
JSR TFEND END .TF IF DOING ONE
|
||||
LDA EXP.VALUE STORE VALUE IN
|
||||
STA TRGT TARGET ADDRESS
|
||||
LDA EXP.VALUE+1
|
||||
STA TRGT+1
|
||||
RTS.1 RTS
|
||||
*---------------------------------
|
||||
* .TA -- SET TARGET ADDRESS
|
||||
*---------------------------------
|
||||
PSTA JSR EXPR.DEFINED GET EXPR VALUE
|
||||
LDA EXP.VALUE+2
|
||||
ORA EXP.VALUE+3
|
||||
BEQ NEW.TARGET
|
||||
JMP RAER
|
||||
*--------------------------------
|
||||
* .AT -- ASCII STRING WITH LAST BYTE FLAGGED
|
||||
* .AS -- ASCII STRING WITH ALL BYTES SAME
|
||||
* .AZ -- Same as .AS, but with 00 terminator byte.
|
||||
*--------------------------------
|
||||
PSAZ JSR PSAS
|
||||
JMP EMIT.ZERO
|
||||
PSAT LDA #$80 LAST BYTE HAS OPPOSITE BIT 7
|
||||
.HS 2C ...SKIP OVER 2 BYTES
|
||||
PSAS LDA #0 ALL BYTES GET SAME BIT 7
|
||||
STA AT.HIBIT
|
||||
JSR GNNB Scan to next non-blank
|
||||
BCS ERBA2 END OF LINE
|
||||
DEC CHAR.PNTR BACK UP
|
||||
.1 JSR TRY.HEX.STRING
|
||||
BEQ .5 ...END OF LINE
|
||||
LDY #0
|
||||
STY AS.HIBIT ...assume hibit is 0
|
||||
CMP #'-' 1ST NON-BLANK A MINUS?
|
||||
BNE .15 ...no, hibit is 0
|
||||
ROR AS.HIBIT ...yes, hibit is 1
|
||||
JSR GNC.UC
|
||||
.15 STA DLIM SAVE DELIMITER
|
||||
JSR GNC.UC GET NEXT CHAR
|
||||
BCS ERBA2 END OF LINE IS BAD NEWS
|
||||
CMP DLIM CHK IF DELIMITER
|
||||
BEQ .4 YES, NO STRING IN BETWEEN
|
||||
.2 JSR GNC.UC GET NEXT CHAR
|
||||
BCS ERBA2 END OF LINE IS BAD NEWS
|
||||
CMP DLIM CHK IF DELIMITER
|
||||
BEQ .3 YES, FINISH UP AND RETURN
|
||||
LDA WBUF-2,Y ...NO, GET PREVIOUS CHAR
|
||||
ORA AS.HIBIT MERGE WITH TOP BIT
|
||||
JSR EMIT
|
||||
JMP .2 GO FOR ANOTHER ONE
|
||||
.3 LDA WBUF-2,Y GET PREVIOUS CHAR
|
||||
ORA AS.HIBIT MERGE WITH SELECTED BIT 7
|
||||
EOR AT.HIBIT TOGGLE BIT 7 IF IN .AT
|
||||
JSR EMIT EMIT THE BYTE
|
||||
.4 JSR GNC CHECK IF MORE IN LIST
|
||||
BEQ .5
|
||||
CMP #','
|
||||
BEQ .1
|
||||
.5 RTS
|
||||
*---------------------------------
|
||||
* .HS -- HEX STRING
|
||||
*---------------------------------
|
||||
PSHS JSR GNNB GET NEXT NON-BLANK CHAR
|
||||
BCS ERBA2 END OF LINE
|
||||
JSR BACKUP.CHAR.PNTR
|
||||
JSR TRY.HEX.STRING
|
||||
BNE ERBA2 ...ERROR, BAD ADDRESS
|
||||
RTS
|
||||
*--------------------------------
|
||||
THX1 JSR HEX.DIGIT GET NEXT HEX DIGIT
|
||||
BCC ERBA2 ERROR, ODD DIGITS
|
||||
LDA SYM.VALUE GET CONVERTED VALUE
|
||||
JSR EMIT
|
||||
TRY.HEX.STRING
|
||||
.1 JSR HEX.DIGIT
|
||||
BCS THX1
|
||||
LDA CURRENT.CHAR
|
||||
BEQ .2 ...END OF LINE
|
||||
CMP #',' IF COMMA, GO GET MORE BYTES
|
||||
BEQ .1 ...OKAY
|
||||
CMP #' ' IF BLANK, VALID END OF STRING
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
ERBA2 JMP ERBA ERROR: BAD ADDRESS
|
||||
GT255ERR LDY #QER8 VALUE > 255 ERROR
|
||||
.HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES
|
||||
NOLBLERR LDY #QER1 "NO LABEL"
|
||||
.HS 2C LONG "BIT" TO SKIP NEXT TWO BYTES
|
||||
UNDF LDY #QER6 "UNDEF"
|
||||
JMP SOFT.ERROR
|
||||
*---------------------------------
|
||||
* .EQ -- EQUATE
|
||||
*---------------------------------
|
||||
PSEQ LDY WBUF SEE IF ANY LABEL
|
||||
CPY #$20
|
||||
BEQ NOLBLERR NO LABEL ON LINE
|
||||
LDA STPNTR SAVE STPNTR WHILE CALLING EXPR
|
||||
PHA
|
||||
LDA STPNTR+1
|
||||
PHA
|
||||
JSR EXPR.DEFINED GET VALUE
|
||||
PLA RESTORE STPNTR
|
||||
STA STPNTR+1
|
||||
PLA
|
||||
STA STPNTR
|
||||
LDA PASS WHICH PASS
|
||||
BNE .5 PASS 2, PRINT VALUE
|
||||
*---PASS 1: DEFINE VALUE--------
|
||||
LDY WBUF COLUMN 1 AGAIN
|
||||
CPY #': PRIVATE LABEL?
|
||||
BCC .4 ...LOCAL LABEL
|
||||
BEQ .2 ...PRIVATE LABEL
|
||||
*---NORMAL LABEL-----------------
|
||||
LDY #2
|
||||
.1 LDA EXP.VALUE-2,Y REDEFINE SYMBOL
|
||||
>SYM STA,PNTR
|
||||
INY
|
||||
CPY #6
|
||||
BCC .1
|
||||
RTS
|
||||
*---PRIVATE LABEL----------------
|
||||
.2 LDY #0
|
||||
.3 LDA EXP.VALUE,Y
|
||||
>SYM STA,STPNTR
|
||||
INY
|
||||
CPY #4
|
||||
BCC .3
|
||||
RTS
|
||||
*---LOCAL LABEL------------------
|
||||
.4 LDY #2 COMPUTE LOCAL OFFSET
|
||||
SEC
|
||||
LDA EXP.VALUE
|
||||
>SYM SBC,STPNTR
|
||||
DEY
|
||||
>SYM STA,PNTR
|
||||
LDY #3
|
||||
LDA EXP.VALUE+1
|
||||
>SYM SBC,STPNTR
|
||||
BNE GT255ERR VALUE > 255
|
||||
RTS RETURN TO MAIN LEVEL OF ASM
|
||||
*---PASS 2: PRINT VALUE---------
|
||||
.5 JMP P.EXP.VALUE.DASH
|
||||
*---------------------------------
|
||||
* .DA -- DATA VALUE (8- OR 16-BITS)
|
||||
*---------------------------------
|
||||
PSDA LDA #0 UNDEF FLAG FOR LINE
|
||||
PHA
|
||||
.1 JSR GNNB GET NEXT NON-BLANK CHAR
|
||||
BCS ERBA2 END OF LINE
|
||||
STA DLIM
|
||||
*---Could be $$dstringd----------
|
||||
CMP #'$' $$dstringd value?
|
||||
BNE .2 ...NO
|
||||
LDA WBUF,Y Look for second $
|
||||
CMP #'$'
|
||||
BNE .25 ...NO, MUST BE SIMPLE HEX WORD
|
||||
JSR GNC SKIP OVER SECOND '$'
|
||||
JSR PSAS GET dstringd
|
||||
JMP .5
|
||||
*---Look for size char-----------
|
||||
.2 LDY #1 ASSUME 1-BYTE DATA
|
||||
CMP #'#'
|
||||
BEQ .3
|
||||
CMP #'/'
|
||||
BEQ .3
|
||||
LDY #3 ASSUME 3-BYTE DATA
|
||||
CMP #'<' 24-BIT SIGNAL
|
||||
BEQ .3 ...3-BYTE DATA
|
||||
INY ASSUME 4-BYTE DATA
|
||||
CMP #'>' 32-BIT SIGNAL
|
||||
BEQ .3
|
||||
*---Size is two bytes------------
|
||||
.25 JSR BACKUP.CHAR.PNTR
|
||||
LDY #2 2-BYTE DATA
|
||||
*---Get expression, emit value---
|
||||
.3 STY ADDR.LENGTH
|
||||
JSR EXPR CRACK EXPRESSION
|
||||
LDY DLIM If preceded by /, shift over
|
||||
CPY #'/'
|
||||
BNE .4 ...NOT /
|
||||
JSR EXP.OVER.256
|
||||
.4 JSR EMIT.VALUE ACCORDING TO ADDR.LENGTH
|
||||
*---Update UNDEF flag------------
|
||||
PLA .DA'S UNDEF FLAG
|
||||
ORA EXP.UNDEF
|
||||
PHA
|
||||
*---Next item in list------------
|
||||
.5 JSR GNC.UC LOOK FOR ANOTHER ITEM
|
||||
CMP #', COMMA?
|
||||
BEQ .1 YES, GET ANOTHER ONE
|
||||
PLA GET .DA'S UNDEF FLAG
|
||||
STA EXP.UNDEF MERGED VALUE
|
||||
RTS LIST LINE OR REPORT UNDEF ERROR
|
||||
*--------------------------------
|
||||
* DO/ELSE/FIN
|
||||
*--------------------------------
|
||||
PSDO JSR EXPR.DEFINED GET VALUE
|
||||
LDX DO.INDEX 0 IF EMPTY, ELSE 1-63
|
||||
INX
|
||||
CPX #64
|
||||
BCC .2
|
||||
LDY #QERDO2 ".DO NEST TOO DEEP"
|
||||
JMP SOFT.ERROR
|
||||
.2 LDA EXP.VALUE
|
||||
ORA EXP.VALUE+1 TEST FOR ZERO
|
||||
ORA EXP.VALUE+2
|
||||
ORA EXP.VALUE+3
|
||||
BEQ .3 ZERO, FALSE
|
||||
SEC NONZERO, TRUE
|
||||
.3 STX DO.INDEX
|
||||
LDX #-8
|
||||
.4 ROR DO.STACK+8,X
|
||||
INX
|
||||
BNE .4
|
||||
RTS LIST THE LINE
|
||||
*--------------------------------
|
||||
PSEL LDX DO.INDEX
|
||||
BEQ ERR.DO ERROR, NOT BTWN .DO AND .FIN
|
||||
LDA DO.STACK
|
||||
EOR #$80 TOGGLE CURRENT LOGIC LEVEL
|
||||
STA DO.STACK
|
||||
RTS RETURN TO MAIN LEVEL OF ASM
|
||||
*--------------------------------
|
||||
ERR.DO LDY #QERDO "MISSING .DO"
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
PSFI LDX DO.INDEX
|
||||
BEQ ERR.DO ERROR, NOT AFTER .DO
|
||||
DEC DO.INDEX POP THIS DO
|
||||
LDX #7
|
||||
.1 ROL DO.STACK,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS RETURN TO MAIN LEVEL OF ASM
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.dir1
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
279
SCMASM.30/SCMASM.S.DIR2.txt
Normal file
279
SCMASM.30/SCMASM.S.DIR2.txt
Normal file
@ -0,0 +1,279 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* .IN -- INCLUDE A SOURCE FILE
|
||||
*--------------------------------
|
||||
PSIN LDA INFLAG SEE IF NESTED .IN
|
||||
BNE .4 ...YES, ERROR
|
||||
SEC
|
||||
ROR INFLAG TURN ON FLAG (=$80)
|
||||
LDA #'I PUT "I" IN PROMPT MESSAGE
|
||||
STA PROMPT.FLAG
|
||||
JSR LIST.LINE.BOTH.PASSES
|
||||
*---SAVE CURRENT, SET UP NEW-----
|
||||
LDX #1
|
||||
.1 LDA HI.MEM,X SAVE CURRENT SOURCE POINTERS
|
||||
STA INSAVE,X
|
||||
LDA SRCP,X
|
||||
STA INSAVE+2,X
|
||||
LDA PP,X
|
||||
STA HI.MEM,X
|
||||
.DO AUXMEM
|
||||
.ELSE
|
||||
LDA LO.MEM,X MAKE DOS PROTECT THE SYMBOL TABLE
|
||||
STA INSAVE+6,X DURING THE LOAD
|
||||
LDA EOT,X
|
||||
STA LO.MEM,X
|
||||
.FIN
|
||||
DEX
|
||||
BPL .1
|
||||
*---CHECK FOR .INBx--------------
|
||||
JSR GNC.UC
|
||||
CMP #'B'
|
||||
BNE .2 ...NOT .INBx
|
||||
JSR GNC.UC GET # OF BLOCKS
|
||||
EOR #'0'
|
||||
BEQ .12 ...NOT 1-9, USE 1
|
||||
CMP #10
|
||||
BCC .14 ...1-9
|
||||
.12 LDA #1 USE 1 BLOCK
|
||||
.14 ORA #$C0
|
||||
STA INFLAG
|
||||
*---LOAD THE FILE----------------
|
||||
.2 JSR SAVE.PATHNAME
|
||||
LDY #PQ.LOD LOAD COMMAND
|
||||
JSR ISSUE.DOS.COMMAND
|
||||
*---ASSEMBLE INCLUDED STUFF------
|
||||
LDX #1
|
||||
.3 LDA PP,X MOVE SRCP TO BEGINNING OF INCLUDED FILE
|
||||
STA SRCP,X
|
||||
STA MACSTK,X
|
||||
.DO AUXMEM
|
||||
.ELSE
|
||||
LDA INSAVE+6,X RESTORE LO.MEM
|
||||
STA LO.MEM,X
|
||||
.FIN
|
||||
LDA SCI.IOB.RW+6,X # BYTES ACTUALLY RECEIVED
|
||||
STA INSAVE+4,X
|
||||
DEX
|
||||
BPL .3
|
||||
LDA SCI.IOB.RW+1 REFNUM OF INB FILE
|
||||
STA INSAVE+6
|
||||
JMP ASM2 CONTINUE ASSEMBLY
|
||||
*---NO NESTING ALLOWED-----------
|
||||
.4 LDY #QNIN "NEST .IN"
|
||||
JMP FIRM.ERROR
|
||||
*--------------------------------
|
||||
* .EN -- END OF SOURCE PROGRAM
|
||||
*--------------------------------
|
||||
PSEN JSR LIST.SOURCE.IF.LISTING
|
||||
ENDM
|
||||
BIT INFLAG IN A ".IN"?
|
||||
BPL .1 NO
|
||||
BVC .3 ...NOT IN .INBx
|
||||
LDA INSAVE+6 .INBx REFNUM
|
||||
STA SCI.IOB.CLOSE+1
|
||||
LDA #$CC Close the .INclude file
|
||||
JSR SCI.MLI
|
||||
.3 JSR RESTORE YES, BACK TO ROOT
|
||||
JMP ASM2 CONTINUE ASSEMBLY
|
||||
*---END OF ROOT FILE-------------
|
||||
.1 JSR TFEND END .TF IF DOING ONE
|
||||
LDA PASS WHICH PASS?
|
||||
BNE .2 ...END OF PASS 2
|
||||
INC PASS END OF PASS 1
|
||||
JMP ASM1
|
||||
.2 BIT LF.ALL Are we listing?
|
||||
BMI ASM.END ...no, we are finished
|
||||
JSR CRLF.WITH.PAGING
|
||||
JSR CRLF.WITH.PAGING
|
||||
JSR CRLF.WITH.PAGING
|
||||
LDY #QST "SYMBOL TABLE"
|
||||
JSR QT.OUT
|
||||
JSR CRLF.WITH.PAGING
|
||||
JSR CRLF.WITH.PAGING
|
||||
JSR STPRNT PRINT THE SYMBOLS
|
||||
*--------------------------------
|
||||
ASM.END
|
||||
JSR CRLF.WITH.PAGING
|
||||
LDA ERROR.COUNT
|
||||
STA CURRENT.LINE.NUMBER
|
||||
LDA ERROR.COUNT+1
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
LDY #QERRCNT
|
||||
JSR QT.OUT
|
||||
JMP SOFT END OF ASSEMBLY
|
||||
*--------------------------------
|
||||
* RESTORE IF INSIDE AN INCLUDE
|
||||
*--------------------------------
|
||||
RESTORE
|
||||
LDA INFLAG
|
||||
BEQ .1 RETURN
|
||||
LDX #0 CLEAR PROMPT.FLAG
|
||||
STX PROMPT.FLAG
|
||||
STX INFLAG CLEAR INFLAG
|
||||
INX X=1
|
||||
.2 LDA HI.MEM,X
|
||||
STA PP,X
|
||||
STA MACSTK,X
|
||||
LDA INSAVE,X
|
||||
STA HI.MEM,X
|
||||
LDA INSAVE+2,X
|
||||
STA SRCP,X
|
||||
DEX
|
||||
BPL .2
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* SET UP TITLE LINE
|
||||
*--------------------------------
|
||||
PSTI LDA PASS
|
||||
BEQ PGXIT DO NOTHING IN PASS ONE
|
||||
JSR EXPR.DEFINED GET PAGE LENGTH
|
||||
LDA EXP.VALUE USE MOD 256
|
||||
STA PAGE.LENGTH NON-ZERO PAGE LENGTH MEANS TITLING IS ON
|
||||
LDX #0 POINT AT TITLE BUFFER
|
||||
JSR GNC
|
||||
CMP #',
|
||||
BNE .2 NO TITLE
|
||||
.1 JSR GNC
|
||||
BCS .2 END OF TITLE
|
||||
STA KBUF,X
|
||||
INX
|
||||
CPX #70 MAX TITLE SIZE
|
||||
BCC .1
|
||||
.2 LDA #0 TERMINATE TITLE
|
||||
STA KBUF,X
|
||||
*---FALL INTO PSPG CODE----------
|
||||
*--------------------------------
|
||||
* PAGE EJECT
|
||||
*--------------------------------
|
||||
PSPG JSR FORM.FEED
|
||||
PGXIT JMP ASM2
|
||||
*--------------------------------
|
||||
FORM.FEED
|
||||
JSR CHECK.IF.LISTING
|
||||
LDA #$0C FORM FEED CHAR
|
||||
JSR CHO
|
||||
>INCD PAGE.NUMBER
|
||||
LDA PAGE.LENGTH
|
||||
CMP #3 PAGE LENGTHS LESS THAN 3 CANNOT BE TITLED
|
||||
BCC .1 EXIT, NOT TITLING NOW
|
||||
LDX #0
|
||||
STX LINE.COUNT
|
||||
.3 LDA KBUF,X PRINT TITLE
|
||||
BEQ .4 END OF TITLE
|
||||
JSR CHO
|
||||
INX
|
||||
BNE .3 ...ALWAYS
|
||||
.4 LDY #PAGEQT " PAGE "
|
||||
JSR QT.OUT
|
||||
LDA CURRENT.LINE.NUMBER SAVE LINE #
|
||||
PHA
|
||||
LDA CURRENT.LINE.NUMBER+1
|
||||
PHA
|
||||
LDA PAGE.NUMBER PRINT PAGE #
|
||||
STA CURRENT.LINE.NUMBER
|
||||
LDA PAGE.NUMBER+1
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
JSR CRLF.WITH.PAGING
|
||||
PLA RESTORE LINE #
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
PLA
|
||||
STA CURRENT.LINE.NUMBER
|
||||
.1 RTS RETURN
|
||||
*--------------------------------
|
||||
* .BS -- BLOCK STORAGE
|
||||
*--------------------------------
|
||||
PSBS JSR EXPR.DEFINED GET # OF BYTES
|
||||
LDA EXP.VALUE+3
|
||||
ORA EXP.VALUE+2
|
||||
BNE RAER VALUE >32767
|
||||
LDA EXP.VALUE+1
|
||||
BMI RAER VALUE >32767
|
||||
STA BS.COUNT+1
|
||||
LDA EXP.VALUE
|
||||
STA BS.COUNT SAVE COUNT
|
||||
JSR P.ORIGIN PRINT ADDRESS
|
||||
JSR GNC GET NEXT CHAR
|
||||
CMP #', COMMA?
|
||||
BNE .1 NO, NO VALUE PRESENT
|
||||
JSR EXPR GET FILL VALUE
|
||||
BPL .2 BRANCH IF GOOD EXPRESSION
|
||||
.1 JSR ZERO.EXP.VALUE USE ZERO FOR FILL VALUE
|
||||
.2 SEC
|
||||
ROR LF.ALL TURN OFF LISTING
|
||||
.3 LDA BS.COUNT GET COUNT
|
||||
BNE .4 STILL MORE BYTES
|
||||
DEC BS.COUNT+1
|
||||
BMI .5 ...ALL THRU
|
||||
.4 DEC BS.COUNT COUNT DOWN
|
||||
LDA EXP.VALUE GET FILL VALUE
|
||||
JSR EMIT AND EMIT IT
|
||||
JMP .3
|
||||
|
||||
.5 ASL LF.ALL RESTORE LISTING
|
||||
RTS
|
||||
|
||||
*--------------------------------
|
||||
RAER LDY #QER3 ERROR -- OUT OF RANGE
|
||||
JMP SOFT.ERROR
|
||||
|
||||
*--------------------------------
|
||||
* LISTING CONTROL
|
||||
* .LIST ON/OFF/MON/MOFF/CON/COFF,...
|
||||
*--------------------------------
|
||||
PSLI LDY #LI.INDEX-2
|
||||
JSR SET.FLAGS
|
||||
JMP ASM2 DON'T LIST LINE
|
||||
*--------------------------------
|
||||
* SWITCH FLAGS ON OR OFF
|
||||
*--------------------------------
|
||||
SET.FLAGS
|
||||
STY YSAVE
|
||||
.1 LDY YSAVE
|
||||
.2 INY Find letter in table
|
||||
INY
|
||||
LDA FLAG.TABLE,Y
|
||||
BEQ .7 ...end of table, get next letter
|
||||
CMP CURRENT.CHAR
|
||||
BNE .2 ...try next entry in table
|
||||
*---Found letter in table--------
|
||||
LDX FLAG.TABLE+1,Y
|
||||
.3 EOR #'N 'N' means ON
|
||||
BEQ .5 ...set flag to $00
|
||||
EOR #'F^'N 'F' means OFF
|
||||
BEQ .4 ...set flag to $FF
|
||||
EOR #',^'F comma here is an error
|
||||
BEQ .9 ...oops!
|
||||
JSR GNC.UC get next char from user
|
||||
BNE .3 ...might be N, F, or comma
|
||||
RTS ...blank or end of line
|
||||
*---Turn flag ON or OFF----------
|
||||
.4 LDA #$FF signal OFF with $FF
|
||||
.5 STA 0,X store $00 or $FF in flag
|
||||
*---Scan to a comma or eol-------
|
||||
.6 JSR GNC GET NEXT CHAR
|
||||
BEQ .8 ...blank or end of line
|
||||
CMP #','
|
||||
BNE .6 ...not comma yet
|
||||
*---Get next char from user------
|
||||
.7 JSR GNC.UC
|
||||
BCC .1 ...not end of line yet
|
||||
.8 RTS RETURN TO CALLER
|
||||
.9 JMP ERBA
|
||||
*--------------------------------
|
||||
FLAG.TABLE
|
||||
LI.INDEX .EQ *-FLAG.TABLE
|
||||
.DA #'N',#LF.ALL
|
||||
.DA #'F',#LF.ALL
|
||||
.DA #'M',#LF.MACRO
|
||||
.DA #'C',#LF.CONDITIONAL
|
||||
.DA #'X',#LF.XTRA.BYTES
|
||||
.HS 00
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.dir2
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
231
SCMASM.30/SCMASM.S.DISK.txt
Normal file
231
SCMASM.30/SCMASM.S.DISK.txt
Normal file
@ -0,0 +1,231 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
SCI.TBLADR .EQ $AA00 Address of Command Table
|
||||
SCI.LINBUF .EQ $BC80
|
||||
SCI.STARTUP .EQ $BE00
|
||||
SCI.COMMAND .EQ $BE03
|
||||
SCI.ERROR .EQ $BE09
|
||||
SCI.SLOT .EQ $BE3C
|
||||
SCI.DRIVE .EQ $BE3D
|
||||
SCI.STATE .EQ $BE42 0=immediate, else deferred
|
||||
SCI.MLI .EQ $BE70 Call MLI, (A)=operation
|
||||
SCI.RTS .EQ $BE9E
|
||||
SCI.IOB.GETSET .EQ $BEB4 Get/Set File Info IOB
|
||||
SCI.IOB.MISC .EQ $BEC6 Misc functions IOB
|
||||
SCI.IOB.OPEN .EQ $BECB Open IOB
|
||||
SCI.IOB.RW .EQ $BED5 Read/Write IOB
|
||||
SCI.IOB.CLOSE .EQ $BEDD Close IOB
|
||||
SCI.BUFFER.PAGES .EQ $BEF2,3,4 Buf1, Buf2, Exec
|
||||
SCI.HIMEM.PAGE .EQ $BEFB
|
||||
*--------------------------------
|
||||
* LIST SOURCE CODE ON TEXT FILE
|
||||
*--------------------------------
|
||||
* TEXT.OPTIONS:
|
||||
* TEXT <FILENAME> NO LINE NUMBERS
|
||||
* TEXT#<FILENAME> WITH LINE NUMBERS
|
||||
* TEXT%<FILENAME> WITH TAB.CHAR
|
||||
*--------------------------------
|
||||
TEXT LDX #0 00=NO LINE NUMBERS
|
||||
STX TEXT.OPTIONS
|
||||
JSR GNNB GET NEXT NON-BLANK CHAR
|
||||
CMP #'# TEXT # MEANS WRITE LINE NUMBERS
|
||||
BEQ .5 USE LINE NUMBERS
|
||||
CMP #'% TEXT % MEANS WRITE CONTROL-I
|
||||
BNE .6 NEITHER, WRITE TEXT ONLY
|
||||
LDA TAB.CHAR
|
||||
STA TEXT.OPTIONS
|
||||
BNE .7 ...ALWAYS
|
||||
.5 INC TEXT.OPTIONS
|
||||
BNE .7 ...ALWAYS
|
||||
.6 JSR BACKUP.CHAR.PNTR
|
||||
.7 LDA #1 INTO "DEFERRED" STATE
|
||||
STA SCI.STATE
|
||||
JSR SAVE.PATHNAME
|
||||
LDY #PQ.OPN
|
||||
JSR ISSUE.DOS.COMMAND
|
||||
LDY #PQ.WRT
|
||||
JSR ISSUE.DOS.COMMAND
|
||||
JSR SETUP.TEXT.POINTERS (PP --> SRCP, HIMEM --> ENDP)
|
||||
.1 JSR CMP.SRCP.ENDP END OF RANGE YET?
|
||||
BCS .4 ...YES
|
||||
JSR GET.LINE.NUMBER
|
||||
LDA TEXT.OPTIONS
|
||||
BEQ .3 NO LINE #
|
||||
BMI .2 TAB.CHAR
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
LDA #$20 SPACE AFTER LINE #
|
||||
.2 JSR CHO
|
||||
.3 JSR NTKN
|
||||
BNE .2
|
||||
JSR CRLF
|
||||
JMP .1
|
||||
.4 LDA #0 TRUNCATE REST OF FILE
|
||||
JSR CHO
|
||||
JMP SOFT
|
||||
*--------------------------------
|
||||
* .TF DIRECTIVE
|
||||
*--------------------------------
|
||||
* END EXISTING .TF IF ANY
|
||||
* SET .TF FLAG ON
|
||||
*
|
||||
* PASS 1: THAT'S ALL
|
||||
*
|
||||
* PASS 2: OPEN THE FILE, WITH T=BIN
|
||||
* SET MARK=EOF=0
|
||||
* SET STARTING ADDRESS IN FILE-INFO
|
||||
* WRITE START ADDRESS AND LENGTH
|
||||
*--------------------------------
|
||||
PSTF JSR TFEND CLOSE EXISTING TF IF ANY
|
||||
SEC
|
||||
ROR TF.FLAG SET FLAG ON
|
||||
JSR LIST.LINE.BOTH.PASSES
|
||||
LDA PASS WHICH PASS?
|
||||
BEQ .9 ...PASS 1, EXIT NOW
|
||||
JSR SAVE.PATHNAME
|
||||
LDY #PQ.OPN
|
||||
JSR ISSUE.DOS.COMMAND
|
||||
*---Empty the file now-----------
|
||||
LDA #0
|
||||
STA SCI.IOB.MISC+2
|
||||
STA SCI.IOB.MISC+3
|
||||
STA SCI.IOB.MISC+4
|
||||
LDA SCI.IOB.OPEN+5 REFNUM FOR TARGET FILE
|
||||
STA TF.PRM TARGET FILE REF. NUM.
|
||||
STA SCI.IOB.MISC+1
|
||||
LDA #$CE SET MARK
|
||||
JSR SCI.MLI
|
||||
BCS JMP.PRODOS.ERR ...ERROR
|
||||
LDA #$D0 SET EOF
|
||||
JSR SCI.MLI
|
||||
BCS JMP.PRODOS.ERR ...ERROR
|
||||
*---Get current file info--------
|
||||
LDA #10
|
||||
STA SCI.IOB.GETSET
|
||||
LDA #$C4 GET FILE INFO
|
||||
JSR SCI.MLI
|
||||
BCS JMP.PRODOS.ERR ...ERROR
|
||||
*---Set proper file info---------
|
||||
LDA #7 change IOB for set.file.info
|
||||
STA SCI.IOB.GETSET
|
||||
LDA SCI.IOB.GETSET+4 current file type
|
||||
CMP #$04 is it type TXT?
|
||||
BEQ .9 ...yes, make no changes
|
||||
LDX #$2000 if type is SYS ($FF), force A=$2000
|
||||
LDY /$2000
|
||||
CMP #$FF is it type SYS?
|
||||
BEQ .3 ...yes
|
||||
LDX ORGN all other types, A=origin
|
||||
LDY ORGN+1
|
||||
.3 STX SCI.IOB.GETSET+5 new AuxType
|
||||
STY SCI.IOB.GETSET+6
|
||||
LDA #$C3 SET FILE INFO
|
||||
JSR SCI.MLI
|
||||
BCS JMP.PRODOS.ERR ...ERROR
|
||||
.9 JMP ASM2 ...CONTINUE ASSEMBLY
|
||||
*--------------------------------
|
||||
JMP.PRODOS.ERR JMP PRODOS.ERROR
|
||||
*--------------------------------
|
||||
* OUTPUT (A) TO ALREADY OPENED DISK FILE
|
||||
*--------------------------------
|
||||
DOUT BIT DUMMY.FLAG
|
||||
BMI .3 No output inside DUMMY section
|
||||
STA TF.BUF Save in buffer outside zero-page
|
||||
STX TF.SVX
|
||||
LDX #4 copy parms to SCI parmblock
|
||||
.1 LDA TF.PRM,X
|
||||
STA SCI.IOB.RW+1,X
|
||||
DEX
|
||||
BPL .1 ...until all copied
|
||||
LDA #$CB Write command code
|
||||
JSR SCI.MLI
|
||||
BCS JMP.PRODOS.ERR
|
||||
LDX TF.SVX
|
||||
LDA OBJ.BYTE
|
||||
.3 RTS
|
||||
*
|
||||
TF.SVX .BS 1
|
||||
TF.BUF .BS 1
|
||||
TF.PRM .DA #*-*,TF.BUF,1
|
||||
*--------------------------------
|
||||
* TFEND - FINISH OFF A .TF SECTION
|
||||
* CALLED FROM: .TF, .TA, .OR, .EN PROCESSORS
|
||||
*
|
||||
* IF NOT IN .TF NOW, RETURN IMMEDIATELY
|
||||
* CLEAR .TF FLAG
|
||||
* PASS 1 - THAT'S ALL TO DO
|
||||
* PASS 2 - CLOSE FILE
|
||||
*--------------------------------
|
||||
TFEND ASL TF.FLAG TEST AND CLEAR FLAG SIMULTANEOUSLY
|
||||
BCC .1 ...TF NOT ACTIVE, DO NOTHING
|
||||
LDA PASS
|
||||
BNE CLOSE.FILES ...PASS 2
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
CLOSE.FILES
|
||||
LDY #PQ.CLS
|
||||
.HS 2C
|
||||
FP LDY #PQ.FP
|
||||
LDA #0
|
||||
STA PATHNAME
|
||||
*--------------------------------
|
||||
* ISSUE DOS COMMAND WITH FILE NAME
|
||||
* (Y)=QUOTE OFFSET FOR COMMAND
|
||||
*
|
||||
* SAVES AND RESTORES CHARACTER POINTER
|
||||
* SO THAT FILE NAME CAN BE USED AGAIN.
|
||||
*--------------------------------
|
||||
ISSUE.DOS.COMMAND
|
||||
LDX #$7F SAVE WBUF (0-127)
|
||||
.1 LDA WBUF,X
|
||||
STA SCI.LINBUF,X
|
||||
DEX
|
||||
BPL .1
|
||||
.2 INX COPY PATHNAME INTO WBUF (5...)
|
||||
LDA PATHNAME,X
|
||||
STA WBUF+5,X
|
||||
BNE .2
|
||||
TAX X=0
|
||||
.3 INX COPY COMMAND INTO WBUF (0...)
|
||||
INY
|
||||
LDA PQTS-1,Y
|
||||
STA WBUF-1,X
|
||||
BPL .3
|
||||
STX SCI.STATE ALLOW DEFERRED COMMANDS
|
||||
JSR PASS.CMD.TO.PRODOS
|
||||
LDX #$7F RESTORE WBUF (0-127)
|
||||
.4 LDA SCI.LINBUF,X
|
||||
STA WBUF,X
|
||||
DEX
|
||||
BPL .4
|
||||
RTS
|
||||
*--------------------------------
|
||||
SAVE.PATHNAME
|
||||
LDX #0
|
||||
.1 CPX #49
|
||||
BCS .2
|
||||
JSR GNNB
|
||||
BCC .3
|
||||
.2 LDA #0
|
||||
.3 STA PATHNAME,X
|
||||
INX
|
||||
BCC .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
PQTS .EQ *
|
||||
PQ.CLS .EQ *-PQTS
|
||||
.AT /CLOSE/
|
||||
PQ.OPN .EQ *-PQTS
|
||||
.AT /OPEN /
|
||||
PQ.WRT .EQ *-PQTS
|
||||
.AT /WRITE/
|
||||
PQ.LOD .EQ *-PQTS
|
||||
.AT /LOAD /
|
||||
PQ.FP .EQ *-PQTS
|
||||
.AS /-BASIC.SYSTEM/
|
||||
.HS 00FF
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.disk
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
509
SCMASM.30/SCMASM.S.EDIT..txt
Normal file
509
SCMASM.30/SCMASM.S.EDIT..txt
Normal file
@ -0,0 +1,509 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* SOFT INITIALIZATION
|
||||
*--------------------------------
|
||||
SOFT LDA /$1000 START SYMBOL TABLE AT $1000
|
||||
SYMBOL.BASE .EQ *-1
|
||||
STA LO.MEM+1
|
||||
LDA #0
|
||||
STA LO.MEM
|
||||
STA AUTOLN.FLAG TURN OFF AUTOMATIC LINE NUMBERS
|
||||
JSR IO.WARM INIT SCREEN, CONNECT DOS
|
||||
JSR CLOSE.FILES
|
||||
*--------------------------------
|
||||
FAST CLC SET TO FAST LISTING SPEED
|
||||
.HS 24 (SKIP OVER SEC)
|
||||
SLOW SEC SET TO SLOW LISTING SPEED
|
||||
ROR FLAG.SPEED SET/CLEAR SIGN BIT
|
||||
*--------------------------------
|
||||
* GET NEXT LINE
|
||||
*--------------------------------
|
||||
GNL
|
||||
LDX #$FF INIT STACK
|
||||
TXS
|
||||
STX PASS PASS=-1 IF NOT ASSEMBLING
|
||||
INX MAKE X=0
|
||||
STX SCI.STATE GET INTO "IMMEDIATE" STATE
|
||||
STX RPTCNT CLEAR REPEAT COUNT
|
||||
STX MACRO.LEVEL
|
||||
STX PARAM.PNTR
|
||||
STX CHAR.PNTR
|
||||
STX PAGE.LENGTH TURN OFF TITLING
|
||||
JSR READ.LINE
|
||||
JSR GNC.UC.START GET FIRST CHAR OF LINE
|
||||
BEQ GNL EMPTY LINE OR 1ST CHAR IS BLANK
|
||||
JSR CHECK.LETTER
|
||||
BCC .1 NOT A LETTER
|
||||
JSR SEARCH.COMMAND.TABLE
|
||||
JMP GNL
|
||||
*---Test for single char cmds----
|
||||
.1 LDY #CHARS.FOR.COMMANDS
|
||||
JSR SEARCH.CHAR.TABLES
|
||||
JMP GNL
|
||||
*---" LINE, ECHO ALL CHARS-------
|
||||
ECHO1 JSR CHO SEND CHARACTER
|
||||
ECHO.LINE
|
||||
JSR GNC GET NEXT CHAR
|
||||
BCC ECHO1 NOT END YET
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SYNTAX ERROR
|
||||
*--------------------------------
|
||||
SYNX LDY #QSYNX
|
||||
JMP HARD.ERROR
|
||||
*--------------------------------
|
||||
* NUMBERED LINE
|
||||
*--------------------------------
|
||||
NML JSR GNC.START GET FIRST CHAR
|
||||
JSR DECN CONVERT LINE NUMBER
|
||||
LDA DGTCNT MUST BE 1 TO 5 DIGITS
|
||||
BEQ SYNX
|
||||
LDA SYM.VALUE+2
|
||||
ORA SYM.VALUE+3
|
||||
BNE SYNX > 65535
|
||||
*---Compact the numbered line----
|
||||
DEY Backup to previous character
|
||||
JSR COMPACT.LINE
|
||||
*--------------------------------
|
||||
LDX #1 COPY IN BINARY LINE #
|
||||
.51 LDA SYM.VALUE,X
|
||||
STA CURLNO,X SAVE HERE TOO, FOR AUTO-NUMBER
|
||||
STA WBUF+1,X
|
||||
DEX
|
||||
BPL .51
|
||||
*--------------------------------
|
||||
* FIND LINE, OR PLACE WHERE IT SHOULD GO
|
||||
* LINE.START --> BEGINNING OF THIS LINE
|
||||
* LINE.END --> BEGINNING OF NEXT LINE
|
||||
*--------------------------------
|
||||
LDX #SYM.VALUE POINT AT LINE NUMBER
|
||||
JSR SERTXT FIND IT IF THERE
|
||||
SEC GET LENGTH OF HOLE
|
||||
LDA LINE.END WILL ALWAYS BE LESS THAN 256
|
||||
SBC LINE.START
|
||||
SEC SUBTRACT LENGTH OF NEW LINE
|
||||
SBC WBUF LINE SIZE
|
||||
BEQ .11 SAME SIZE EXACTLY
|
||||
STA MOVE.DISTANCE
|
||||
LDA #0
|
||||
SBC #0
|
||||
STA MOVE.DISTANCE+1
|
||||
BCC .6 NEW LINE LONGER THAN HOLE
|
||||
*--------------------------------
|
||||
* NEW LINE SHORTER THAN HOLE
|
||||
*--------------------------------
|
||||
CLC COMPUTE TARGET TO MOVE UP TO
|
||||
LDA LINE.START
|
||||
ADC MOVE.DISTANCE
|
||||
STA A4L
|
||||
LDA LINE.START+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA A4H
|
||||
JSR MOVE.TEXT.UP
|
||||
JMP .10 NOW HOLE IS RIGHT SIZE
|
||||
*--------------------------------
|
||||
* ENLARGE HOLE TO MAKE ROOM
|
||||
*--------------------------------
|
||||
.6 CLC (MOVE.DISTANCE) = -<#BYTES TO EXPAND>
|
||||
LDA PP COMPUTE TARGET ADDRESS
|
||||
ADC MOVE.DISTANCE
|
||||
STA A4L
|
||||
LDA PP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA A4H
|
||||
LDA A4L BE SURE THERE IS ROOM
|
||||
CMP LO.MEM
|
||||
LDA A4H
|
||||
SBC LO.MEM+1
|
||||
BCC MFER NO ROOM!
|
||||
JSR MOVE.TEXT.DOWN
|
||||
*---Adjust SRCP if needed--------
|
||||
.10 LDA SRCP If hole is above (SRCP),
|
||||
CMP LINE.END then need to add MOVE.DISTANCE
|
||||
LDA SRCP+1
|
||||
SBC LINE.END+1
|
||||
BCS .11
|
||||
LDA SRCP
|
||||
ADC MOVE.DISTANCE
|
||||
STA SRCP
|
||||
LDA SRCP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA SRCP+1
|
||||
*--------------------------------
|
||||
* COPY NEW LINE INTO THE HOLE
|
||||
*--------------------------------
|
||||
.11 LDX WBUF LINE SIZE
|
||||
BEQ .14 NO NEW LINE TO COPY
|
||||
LDY #0
|
||||
.12 LDA LINE.END BACK UP POINTER TO END OF HOLE
|
||||
BNE .13
|
||||
DEC LINE.END+1
|
||||
.13 DEC LINE.END
|
||||
DEX
|
||||
LDA WBUF,X
|
||||
STA (LINE.END),Y
|
||||
TXA
|
||||
BNE .12
|
||||
.14 RTS
|
||||
*--------------------------------
|
||||
MFER LDY #QMEMFL MEM FULL ERROR
|
||||
JMP HARD.ERROR
|
||||
*--------------------------------
|
||||
COMPACT.LINE
|
||||
LDX #4 Start storing at WBUF+3
|
||||
LDA #-1 Prime RPT pump
|
||||
STA RPTCNT
|
||||
.1 STA RPTCHR
|
||||
.2 INY advance input pointer
|
||||
INC RPTCNT (first time makes it = 0)
|
||||
LDA WBUF,Y get next char
|
||||
AND #$7F be sure its low ascii
|
||||
CMP RPTCHR save as previous char?
|
||||
BEQ .2 ...yes, just count it
|
||||
PHA save new character
|
||||
*--------------------------------
|
||||
LDA RPTCNT
|
||||
BEQ .3
|
||||
JSR PROCESS.REPEAT.COUNT
|
||||
*--------------------------------
|
||||
.3 PLA get new character
|
||||
BNE .1 ...not 00 terminator
|
||||
STA WBUF-1,X store terminator
|
||||
CPX #5 If only line number, make length 00
|
||||
BCS .4
|
||||
LDX #0
|
||||
.4 STX WBUF
|
||||
RTS
|
||||
*--------------------------------
|
||||
PROCESS.REPEAT.COUNT
|
||||
LDA RPTCHR
|
||||
CMP #' '
|
||||
BEQ .5 ...compress blanks in special way
|
||||
LDA RPTCNT
|
||||
CMP COMPRESSION.LIMIT
|
||||
BCS .2 ...enough to compress to 3 bytes
|
||||
.1 LDA RPTCHR spit out uncompressed chars
|
||||
STA WBUF-1,X
|
||||
INX
|
||||
DEC RPTCNT
|
||||
BNE .1
|
||||
RTS
|
||||
*---Compress $C0 cnt char--------
|
||||
.2 STA WBUF,X store count
|
||||
LDA #$C0 Compression token
|
||||
STA WBUF-1,X
|
||||
INX
|
||||
INX
|
||||
LDA RPTCHR repeated char
|
||||
.3 STA WBUF-1,X
|
||||
INX
|
||||
LDA #0
|
||||
STA RPTCNT
|
||||
RTS
|
||||
*---Compress blanks--------------
|
||||
.4 SBC #$3F Maximum blanks in one token
|
||||
STA RPTCNT
|
||||
LDA #$BF $3F blanks
|
||||
STA WBUF-1,X
|
||||
INX
|
||||
.5 LDA RPTCNT Number of blanks left
|
||||
CMP #$40
|
||||
BCS .4 ...too many for one token
|
||||
ORA #$80 make into blank token + count
|
||||
BNE .3 ...always
|
||||
*--------------------------------
|
||||
SCAN.3.DECIMAL.NUMBERS
|
||||
LDX #6 FIRST CLEAR TO ZERO
|
||||
LDA #0
|
||||
.1 STA A0L-1,X
|
||||
DEX
|
||||
BNE .1
|
||||
JSR SCAN.1.DECIMAL.NUMBER
|
||||
JSR SCAN.1.DECIMAL.NUMBER
|
||||
*** JMP SCAN.1.DECIMAL.NUMBER
|
||||
*--------------------------------
|
||||
SCAN.1.DECIMAL.NUMBER
|
||||
.1 JSR GNC
|
||||
BCS .2 END OF LINE
|
||||
EOR #$30 IS THIS A DIGIT?
|
||||
CMP #10
|
||||
BCS .1 NO
|
||||
TXA SAVE X-REG
|
||||
PHA
|
||||
JSR DECN CONVERT NUMBER
|
||||
PLA RESTORE X-REG
|
||||
TAX
|
||||
LDA SYM.VALUE STACK NUMBER
|
||||
STA A0L,X
|
||||
INX
|
||||
LDA SYM.VALUE+1
|
||||
STA A0L,X
|
||||
INX
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* DECIMAL NUMBER INPUT
|
||||
*--------------------------------
|
||||
DECN JSR BACKUP.CHAR.PNTR
|
||||
JSR ZERO.SYM.VALUE CLEAR ACCUMULATOR
|
||||
STA DGTCNT
|
||||
.1 JSR GNC GET NEXT CHAR
|
||||
EOR #$30 CHECK IF DIGIT
|
||||
CMP #10
|
||||
BCS .5 NOT A DIGIT
|
||||
PHA SAVE THE DIGIT
|
||||
*---ACCUMULATOR * TEN------------
|
||||
JSR ASL.SYM.VALUE
|
||||
BCS .6 OVERFLOW ERROR
|
||||
LDX #3
|
||||
.2 LDA SYM.VALUE,X HI- TO LO-
|
||||
PHA
|
||||
DEX
|
||||
BPL .2
|
||||
.3 JSR ASL.SYM.VALUE
|
||||
BCS .6 OVERFLOW ERROR
|
||||
INX
|
||||
BEQ .3 DO IT TWICE
|
||||
PLA
|
||||
ADC SYM.VALUE
|
||||
STA SYM.VALUE
|
||||
PLA
|
||||
ADC SYM.VALUE+1
|
||||
STA SYM.VALUE+1
|
||||
PLA
|
||||
ADC SYM.VALUE+2
|
||||
STA SYM.VALUE+2
|
||||
PLA
|
||||
ADC SYM.VALUE+3
|
||||
STA SYM.VALUE+3
|
||||
BCS .6 OVERFLOW ERROR
|
||||
*---ADD CURRENT DIGIT------------
|
||||
PLA
|
||||
ADC SYM.VALUE
|
||||
STA SYM.VALUE
|
||||
BCC .4
|
||||
INC SYM.VALUE+1
|
||||
BNE .4
|
||||
INC SYM.VALUE+2
|
||||
BNE .4
|
||||
INC SYM.VALUE+3
|
||||
BEQ .6 OVERFLOW ERROR
|
||||
.4 INC DGTCNT COUNT THE DIGIT
|
||||
BNE .1 ...ALWAYS
|
||||
.5 RTS
|
||||
.6 LDY #QER3 RANGE ERROR
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
* GET NEXT NON-BLANK CHAR
|
||||
*--------------------------------
|
||||
GNNB JSR GNC.UC GET NEXT CHAR IN UPPER CASE
|
||||
BCS .1 END OF LINE
|
||||
BEQ GNNB BLANK
|
||||
.1 RTS RETURN
|
||||
*--------------------------------
|
||||
* GET NEXT CHAR IN UPPER CASE
|
||||
*--------------------------------
|
||||
GNC.UC.START
|
||||
LDY #0
|
||||
STY CHAR.PNTR
|
||||
GNC.UC JSR GNC GET NEXT CHAR ANY CASE
|
||||
BEQ .1 SPACE OR <EOL>
|
||||
JSR ELIMINATE.CASE MAP LOWER CASE TO UPPER CASE
|
||||
STA CURRENT.CHAR
|
||||
CMP #$FF CLEAR CARRY, SET .NE.
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* GET NEXT CHAR
|
||||
*--------------------------------
|
||||
GNC.START
|
||||
LDY #0 BEGINNING OF LINE
|
||||
.HS 2C SKIP NEXT TWO BYTES
|
||||
GNC LDY CHAR.PNTR
|
||||
GNC2 LDA WBUF,Y GET CHAR
|
||||
AND #$7F
|
||||
STA CURRENT.CHAR
|
||||
BEQ .1 END OF LINE
|
||||
INY BUMP POINTER
|
||||
STY CHAR.PNTR
|
||||
CMP #$20 SEE IF BLANK
|
||||
CLC CARRY CLEAR SINCE NOT AT END
|
||||
RTS
|
||||
.1 LDA #$20 RETURN BLANK
|
||||
CMP #$20 SET CARRY AND EQUAL STATUS
|
||||
RTS
|
||||
*--------------------------------
|
||||
* BACK UP CHARACTER POINTER
|
||||
*--------------------------------
|
||||
BACKUP.CHAR.PNTR
|
||||
PHA SAVE A-REG
|
||||
LDA CURRENT.CHAR
|
||||
BEQ .1 DO NOT BACK OFF THE END
|
||||
LDA CHAR.PNTR
|
||||
BEQ .1 DO NOT BACK BEYOND THE BEGINNING
|
||||
DEC CHAR.PNTR
|
||||
.1 PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
* GET NEXT TOKEN FROM SOURCE LINE
|
||||
*--------------------------------
|
||||
NTKN
|
||||
LDA RPTCNT
|
||||
BNE .3 IN A REPEATED CHAR LOOP
|
||||
JSR GNB GET NEXT CHAR FROM SOURCE
|
||||
ASL ...WEIRD WAY TO TEST SIGN BIT
|
||||
ROR ...AND AS WELL AS 00
|
||||
BPL .4 ...NORMAL CHARACTER
|
||||
CMP #$C0 SEE IF BLANKS
|
||||
BCC .1 ...YES
|
||||
JSR GNBI REPEAT TOKEN $C0 XX YY, GET XX
|
||||
STA RPTCNT
|
||||
JSR GNBI GET YY (CHAR TO BE REPEATED)
|
||||
JMP .2 ...ALWAYS
|
||||
.1 AND #$3F BLANK COUNT
|
||||
STA RPTCNT
|
||||
LDA #$20 BLANK
|
||||
.2 STA RPTCHR
|
||||
.3 DEC RPTCNT
|
||||
LDA RPTCHR
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* GET NEXT BYTE FROM SOURCE
|
||||
*--------------------------------
|
||||
GNB LDY #0
|
||||
GNBI
|
||||
.DO AUXMEM
|
||||
LDA MACRO.LEVEL
|
||||
BEQ .0 ...NOT IN A SKELETON
|
||||
>SYM LDA,SRCP
|
||||
.HS 2C SKIP OVER LDA (SRCP),Y
|
||||
.FIN
|
||||
.0 LDA (SRCP),Y
|
||||
>INCD SRCP
|
||||
BIT INFLAG INSIDE BLOCKED .IN?
|
||||
BVC .3 ...NO
|
||||
PHA
|
||||
LDA MACRO.LEVEL
|
||||
BNE .25 INSIDE A SKELETON
|
||||
LDA INSAVE+4 REMAINING BYTES IN THIS BLOCK
|
||||
BNE .2 ...THERE ARE MORE
|
||||
ORA INSAVE+5
|
||||
BEQ .4 ...NO MORE IN THIS BLOCK
|
||||
DEC INSAVE+5
|
||||
.2 DEC INSAVE+4
|
||||
.25 PLA
|
||||
.3 RTS
|
||||
*---TRY TO READ ANOTHER BLOCK----
|
||||
.4 PLA
|
||||
LDA INSAVE+6 REFNUM OF INB FILE
|
||||
STA SCI.IOB.RW+1
|
||||
LDA PP STARTING ADDRESS
|
||||
STA SRCP
|
||||
STA SCI.IOB.RW+2
|
||||
LDA PP+1
|
||||
STA SRCP+1
|
||||
STA SCI.IOB.RW+3
|
||||
SEC
|
||||
LDA HI.MEM+1 NUMBER OF PAGES
|
||||
SBC PP+1
|
||||
STA SCI.IOB.RW+5
|
||||
LDA #0
|
||||
STA SCI.IOB.RW+4
|
||||
LDA #$CA READ
|
||||
JSR SCI.MLI
|
||||
BCC .5 ...NO ERRORS
|
||||
CMP #5 END OF DATA?
|
||||
BNE PRODOS.ERROR ...ERROR
|
||||
.5 LDA SCI.IOB.RW+6
|
||||
STA INSAVE+4 # BYTES ACTUALLY READ
|
||||
LDA SCI.IOB.RW+7
|
||||
STA INSAVE+5
|
||||
BCC GNB ...NOT END OF DATA
|
||||
LDA INSAVE+6 REFNUM
|
||||
STA SCI.IOB.CLOSE+1 FOR CLOSE CALL
|
||||
LDA #$CC
|
||||
JSR SCI.MLI
|
||||
BCS PRODOS.ERROR
|
||||
JSR RESTORE END OF THE INBx FILE
|
||||
JMP ASM2
|
||||
*--------------------------------
|
||||
PRODOS.ERROR
|
||||
PHA
|
||||
JSR RESTORE.IF.IN.INBX
|
||||
PLA
|
||||
JMP SCI.ERROR
|
||||
*--------------------------------
|
||||
* RETURN .CS. IF VALID CHAR
|
||||
* .CC. IF INVALID CHAR
|
||||
*--------------------------------
|
||||
CHECK.DOT.DIGIT.OR.LETTER
|
||||
CMP #'.
|
||||
BEQ CHECKS.OK
|
||||
CMP #'_' allow underline in symbols too
|
||||
BEQ CHECKS.OK
|
||||
CHECK.DIGIT.OR.LETTER
|
||||
JSR CHECK.DIGIT
|
||||
BCS CHECKS.OK
|
||||
CHECK.LETTER
|
||||
CMP #'A
|
||||
BCC CHECKS.NOT.OK
|
||||
CMP #'Z+1
|
||||
BCC CHECKS.OK
|
||||
CHECKS.NOT.OK
|
||||
CLC
|
||||
RTS
|
||||
CHECK.DIGIT
|
||||
CMP #'0
|
||||
BCC CHECKS.NOT.OK
|
||||
CMP #'9+1
|
||||
BCS CHECKS.NOT.OK
|
||||
CHECKS.OK
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
CHECK.COMMENT.CHAR
|
||||
CMP #'* STAR?
|
||||
BEQ .1 YES
|
||||
CMP #'; SEMI-COLON?
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* INITIALIZE FOR HARD ENTRY
|
||||
*--------------------------------
|
||||
HARD.INIT
|
||||
CLD
|
||||
*---Establish LO.MEM & HI.MEM------
|
||||
LDA SYMBOL.BASE SET UP LO.MEM
|
||||
STA LO.MEM+1
|
||||
LDA SCI.HIMEM.PAGE
|
||||
STA HI.MEM+1
|
||||
LDA #0
|
||||
STA LO.MEM
|
||||
STA HI.MEM
|
||||
*---Init other parameters--------
|
||||
STA INCREMENT.VALUE+1
|
||||
STA PROMPT.FLAG
|
||||
STA INFLAG
|
||||
JSR STINIT INITIALIZE SYMBOL TABLE
|
||||
LDA #10 SET AUTO-LINE-NUMBERING INCREMENT
|
||||
STA INCREMENT.VALUE
|
||||
LDA #990 SET AUTO-LINE-NUMBERING
|
||||
STA CURLNO INITIAL VALUE
|
||||
LDA /990
|
||||
STA CURLNO+1
|
||||
*---Print Heading----------------
|
||||
JSR IO.INIT INIT TEXT, FULL WINDOW, ETC.
|
||||
JSR VERSION Print Version Number
|
||||
*--------------------------------
|
||||
EMPTY.SOURCE.AREA
|
||||
LDA HI.MEM
|
||||
STA PP EMPTY SOURCE AREA
|
||||
LDA HI.MEM+1
|
||||
STA PP+1
|
||||
RTS
|
||||
*--------------------------------
|
||||
Q.VERSION
|
||||
.DA #VERSION.LO+"0",#".",#VERSION.HI+"0"
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.edit
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
321
SCMASM.30/SCMASM.S.ELINES.txt
Normal file
321
SCMASM.30/SCMASM.S.ELINES.txt
Normal file
@ -0,0 +1,321 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* EDIT ONE LINE
|
||||
* TEXT OF LINE ALREADY IN WBUF
|
||||
* (A1L,A1H) POINT AT LINE IN SOURCE AREA
|
||||
*--------------------------------
|
||||
EDIT.ONE.LINE
|
||||
LDA BOTTOM.OF.SCREEN
|
||||
STA ED.BEGLIN
|
||||
JSR IO.VTAB
|
||||
JSR E.BEG Start edit 2 columns after line #
|
||||
.1 STX ED.PNTR
|
||||
JSR E.DISPLAY.LINE Put line on screen
|
||||
LDX ED.PNTR Restore PNTR in X
|
||||
JSR E.PROCESS.CHAR
|
||||
BCC .1 Not control-L, -M, or -Q
|
||||
JSR E.DISPLAY.LINE ...One last time
|
||||
JSR CRLF
|
||||
JMP NML Submit line and return
|
||||
*--------------------------------
|
||||
* DISPLAY LINE FROM WBUF
|
||||
*--------------------------------
|
||||
E.DISPLAY.LINE
|
||||
LDA ED.BEGLIN
|
||||
JSR IO.VTAB
|
||||
LDA #0
|
||||
JSR IO.HTAB
|
||||
JSR SPC One space
|
||||
LDX #0
|
||||
.1 LDA WBUF,X
|
||||
BEQ .4 End of line
|
||||
ORA #$80
|
||||
CMP #$A0 Control char?
|
||||
BCS .2 No
|
||||
AND #$3F ...YES, MAKE IT INVERSE
|
||||
.2 PHA
|
||||
JSR GET.HORIZ.POSN
|
||||
TAY
|
||||
PLA
|
||||
INY
|
||||
CPY SCREEN.WIDTH
|
||||
BCC .3 No
|
||||
LDY CV Last line on screen?
|
||||
CPY BOTTOM.OF.SCREEN
|
||||
BCC .3 No
|
||||
DEC ED.BEGLIN Yes, it will scroll
|
||||
.3 JSR IO.COUT
|
||||
INX
|
||||
BNE .1 ...Always
|
||||
.4 JMP IO.CLREOP
|
||||
*--------------------------------
|
||||
* PROCESS EDITING CHARACTER
|
||||
*--------------------------------
|
||||
E.PROCESS.CHAR
|
||||
EPC.1 JSR E.INPUT Get char from keyboard
|
||||
EPC.2 CMP #$A0 Control char?
|
||||
BCC E.PROCESS.CNTRL
|
||||
*--------------------------------
|
||||
* PUT CHARACTER INTO LINE
|
||||
*--------------------------------
|
||||
E.PUT.CHARACTER
|
||||
LDA WBUF,X At end of line?
|
||||
BNE .1 No
|
||||
CPX #WBUF.MAX Line too long?
|
||||
BCS .2 Yes
|
||||
STA WBUF+1,X Put new <EOL>
|
||||
.1 LDA CURRENT.CHAR
|
||||
STA WBUF,X
|
||||
INX
|
||||
.2 CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* PROCESS CONTROL CHAR
|
||||
*--------------------------------
|
||||
E.PROCESS.CNTRL
|
||||
LDY #CHARS.FOR.EDIT
|
||||
JMP SEARCH.CHAR.TABLES
|
||||
*--------------------------------
|
||||
E.ILLCHAR
|
||||
JSR MON.BELL
|
||||
LDX ED.PNTR Restore X-reg
|
||||
JMP EPC.1
|
||||
*--------------------------------
|
||||
* CONTROL-R: RESTORE ORIGINAL LINE
|
||||
*--------------------------------
|
||||
E.RESTORE
|
||||
LDA A1L Set line pointer back
|
||||
STA SRCP
|
||||
LDA A1H
|
||||
STA SRCP+1
|
||||
JSR GET.LINE.TO.WBUF
|
||||
*--------------------------------
|
||||
* CONTROL-B: BEGINNING OF LINE
|
||||
*--------------------------------
|
||||
FIND.START.OF.LINE.IN.WBUF
|
||||
E.BEG LDY #0 Find 1st column after line number
|
||||
.1 JSR GNC2
|
||||
BCS .2 End of line
|
||||
JSR CHECK.DIGIT
|
||||
BCS .1 Yes
|
||||
INY
|
||||
.2 TYA Get column # into X
|
||||
TAX
|
||||
DEX
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-D: DELETE CHARACTER
|
||||
*--------------------------------
|
||||
E.DEL LDX ED.PNTR
|
||||
.1 LDA WBUF,X Are we at the end?
|
||||
BEQ .3 Yes
|
||||
.2 INX ADVANCE PNTR
|
||||
LDA WBUF,X SLIDE REST OF LINE LEFT
|
||||
STA WBUF-1,X ...to delete char
|
||||
BNE .2 ...UNTIL END OF LINE
|
||||
.3 LDX ED.PNTR
|
||||
CLC
|
||||
RTS Return with Carry clear
|
||||
*--------------------------------
|
||||
* CONTROL-N: END OF LINE
|
||||
*--------------------------------
|
||||
E.END LDX ED.PNTR
|
||||
DEX
|
||||
.1 INX
|
||||
LDA WBUF,X End of buffer?
|
||||
BNE .1 ...KEEP LOOKING
|
||||
CLC
|
||||
RTS Carry clear
|
||||
*--------------------------------
|
||||
* CONTROL-F: FIND NEXT OCCURRENCE
|
||||
*--------------------------------
|
||||
E.FIND LDX ED.PNTR
|
||||
LDA WBUF,X End of buffer?
|
||||
BEQ .3 Yes
|
||||
JSR E.INPUT Get 1 char
|
||||
STX ED.FCOL Save beg col
|
||||
STA ED.FKEY Save key to locate
|
||||
.1 INX
|
||||
LDA WBUF,X Text buffer
|
||||
BEQ .2 End of buffer
|
||||
ORA #$80
|
||||
CMP ED.FKEY No, see if key
|
||||
BNE .1 No, go forward
|
||||
STX ED.FCOL Save this col
|
||||
JSR E.INPUT Try another key
|
||||
CMP ED.FKEY Same char
|
||||
BEQ .1 Yes, search again
|
||||
STX ED.PNTR No, exit pointing here
|
||||
JMP EPC.2
|
||||
.2 LDX ED.FCOL Restore col
|
||||
.3 JSR MON.BELL Beep
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-H: BACKSPACE
|
||||
*--------------------------------
|
||||
E.BKSP LDX ED.PNTR
|
||||
TXA At beginning already?
|
||||
BEQ .1 Yes, stay there
|
||||
DEX Backup
|
||||
.1 CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-O: ALLOW INSERTION OF CONTROL CHAR
|
||||
*--------------------------------
|
||||
E.OVR LDX ED.PNTR
|
||||
JSR E.INPUT Read char
|
||||
JMP E.INS1 Skip control check
|
||||
*--------------------------------
|
||||
* CONTROL-I: INSERT CHARACTERS
|
||||
*--------------------------------
|
||||
E.INS LDX ED.PNTR
|
||||
JSR E.INPUT Read char
|
||||
CMP #$A0 Control char pops user out
|
||||
BCS E.INS1
|
||||
JMP E.PROCESS.CNTRL
|
||||
E.INS1 CPX #WBUF.MAX End of block
|
||||
BEQ .1 Yes, stay there
|
||||
INC ED.PNTR
|
||||
.1 PHA Char to insert
|
||||
LDA WBUF,X Save char to move
|
||||
TAY
|
||||
PLA
|
||||
STA WBUF,X Put over saved char
|
||||
INX
|
||||
TYA Insert saved char
|
||||
BNE .1 If not buffer end
|
||||
CPX #WBUF.MAX At end?
|
||||
BCC .2 Not yet
|
||||
LDX #WBUF.MAX Yes
|
||||
.2 STA WBUF,X Store end char
|
||||
JSR E.DISPLAY.LINE
|
||||
LDX ED.PNTR
|
||||
BNE E.INS ...Always
|
||||
*--------------------------------
|
||||
* CONTROL-Q: QUIT, DROPPING REST OF LINE
|
||||
*--------------------------------
|
||||
E.RETQ JSR E.ZAP Clear rest of line
|
||||
*--------------------------------
|
||||
* CONTROL-M: QUIT, SUBMITTING WHOLE LINE
|
||||
*--------------------------------
|
||||
E.RET SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-L: SUBMIT THIS LINE, EDIT NEXT LINE
|
||||
*--------------------------------
|
||||
E.DOWN LDA ENDP See if at HI.MEM already
|
||||
CMP HI.MEM
|
||||
LDA ENDP+1
|
||||
SBC HI.MEM+1
|
||||
BCS .1 Yes, no need to move ENDP
|
||||
JSR CMP.SRCP.ENDP End of range yet?
|
||||
BCC .1 ...NO
|
||||
CLC Move ENDP one line
|
||||
LDY #0
|
||||
LDA (SRCP),Y Line length of next line
|
||||
ADC ENDP
|
||||
STA ENDP
|
||||
BCC .1
|
||||
INC ENDP+1
|
||||
.1 SEC Signal submit line
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-T: SKIP TO NEXT TAB STOP
|
||||
*--------------------------------
|
||||
E.TAB LDX ED.PNTR
|
||||
.1 JSR E.CHECK.TAB
|
||||
BCS E.RIT1 MOVE ONE MORE COLUMN
|
||||
JSR E.RIT1 Move one column right
|
||||
BCC .1 ...ALWAYS
|
||||
*--------------------------------
|
||||
* CONTROL-U: RIGHT ARROW
|
||||
*--------------------------------
|
||||
E.RIT LDX ED.PNTR
|
||||
E.RIT1 LDA WBUF,X End of buffer?
|
||||
BNE .1 No
|
||||
CPX #WBUF.MAX
|
||||
BCS .2
|
||||
STA WBUF+1,X
|
||||
LDA #$A0 Put a blank
|
||||
STA WBUF,X To extend line
|
||||
.1 INX Move ahead
|
||||
.2 CLC Return
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONTROL-X: ABORT EDIT COMMAND
|
||||
*--------------------------------
|
||||
E.ABORT
|
||||
JSR E.DISPLAY.LINE
|
||||
LDA #$DC Backslash
|
||||
JSR MY.COUT
|
||||
JMP GNL Get next command
|
||||
*--------------------------------
|
||||
* CONTROL-@: CLEAR TO EOL
|
||||
*--------------------------------
|
||||
E.ZAP LDA #0 EOL mark
|
||||
LDX ED.PNTR
|
||||
STA WBUF,X
|
||||
CLC
|
||||
RTS Carry clear
|
||||
*--------------------------------
|
||||
* INPUT CHAR WHERE CURSOR SHOULD BE
|
||||
*--------------------------------
|
||||
E.INPUT
|
||||
LDY ED.BEGLIN
|
||||
INX
|
||||
TXA
|
||||
DEX
|
||||
DEY
|
||||
SEC
|
||||
.1 INY
|
||||
SBC SCREEN.WIDTH
|
||||
BCS .1
|
||||
ADC SCREEN.WIDTH
|
||||
JSR IO.HTAB HTAB (A)
|
||||
TYA
|
||||
JSR IO.VTAB
|
||||
JSR READ.KEY.WITH.CASE
|
||||
STA CURRENT.CHAR
|
||||
RTS
|
||||
*--------------------------------
|
||||
* DETERMINE IF AT TAB STOP YET
|
||||
* RETURN .EQ. IF AT A TAB STOP
|
||||
* .CS. IF PAST LAST TAB STOP
|
||||
* .CC. IF BEFORE A TAB STOP
|
||||
*--------------------------------
|
||||
E.CHECK.TAB
|
||||
TXA Column position
|
||||
CLC
|
||||
ADC #3
|
||||
LDY #0
|
||||
.1 CMP TAB.SETTINGS,Y
|
||||
BCC .2
|
||||
BEQ .2
|
||||
INY
|
||||
CPY #5
|
||||
BCC .1
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* CONTROL-I -- CLEAR TO TAB STOP
|
||||
*--------------------------------
|
||||
E.TABI LDX ED.PNTR
|
||||
LDA #" "
|
||||
STA CURRENT.CHAR
|
||||
.1 JSR E.CHECK.TAB
|
||||
BCS .2 ...REACHED TAB STOP
|
||||
JSR E.PUT.CHARACTER
|
||||
BCC .1 ...ALWAYS
|
||||
.2 JMP E.PUT.CHARACTER One more space
|
||||
*--------------------------------
|
||||
E.TOGGLE
|
||||
JSR IO.CASE.TOGGLE
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.elines
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
414
SCMASM.30/SCMASM.S.EXP.txt
Normal file
414
SCMASM.30/SCMASM.S.EXP.txt
Normal file
@ -0,0 +1,414 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* EXPRESSION CRACKER
|
||||
*-------------------------------
|
||||
EXPR.DEFINED
|
||||
JSR EXPR
|
||||
BMI .1
|
||||
RTS
|
||||
.1 JMP UNDF
|
||||
*--------------------------------
|
||||
OPERATOR.CHARS
|
||||
.AS "^!|&<=>/*)], "
|
||||
OPERATOR.CHARS.SIZE .EQ *-OPERATOR.CHARS
|
||||
*--------------------------------
|
||||
OPERATOR.INDEX
|
||||
.HS 0C.0A.0A.08.0E.10.12.06.04.FF.FF.FF.FF
|
||||
* ^ ! | & < = > / * ) ] , SPC
|
||||
*--------------------------------
|
||||
OPERATOR.TABLE
|
||||
.DA EXP.SUBTRACT-1 0 FOR -<=>
|
||||
.DA EXP.ADD-1 2 FOR +
|
||||
.DA EXP.MULTIPLY-1 4 FOR *
|
||||
.DA EXP.DIVIDE-1 6 FOR /
|
||||
.DA EXP.AND-1 8 FOR &
|
||||
.DA EXP.ORA-1 A FOR !|
|
||||
.DA EXP.EOR-1 C FOR ^
|
||||
.DA EXP.LESS-1 E FOR <
|
||||
.DA EXP.EQUAL-1 10 FOR =
|
||||
.DA EXP.GREATER-1 12 FOR >
|
||||
*--------------------------------
|
||||
ERBA3 JMP ERBA
|
||||
*--------------------------------
|
||||
EXPR JSR GNNB GET NEXT NON-BLANK
|
||||
BCS ERBA3 NO EXPRESSION ON LINE
|
||||
JSR BACKUP.CHAR.PNTR
|
||||
*--------------------------------
|
||||
EXP1 JSR ZERO.EXP.VALUE
|
||||
STA EXP.NEW NEW EXPRESSION FLAG = 0
|
||||
STA EXP.UNDEF ZERO UNDEF FLAG
|
||||
LDX #$40 INIT FWD REF FLAG
|
||||
STX EXP.FWDREF
|
||||
*--------------------------------
|
||||
EXP2 LDX #0 SET OPERATOR=0 FOR +
|
||||
JSR GNC.UC
|
||||
BCS .3 END OF LINE
|
||||
CMP #'- MINUS
|
||||
BEQ .6 X=0 FOR MINUS OR RELOPS
|
||||
LDX #2 X=2 FOR ADDITION
|
||||
CMP #'+ ADD
|
||||
BEQ .6
|
||||
LDY EXP.NEW NOT + OR -
|
||||
BEQ .7 BUT IT IS NEW EXPR
|
||||
LDX #OPERATOR.CHARS.SIZE-1
|
||||
.1 LDA OPERATOR.CHARS,X
|
||||
CMP CURRENT.CHAR
|
||||
BEQ .2
|
||||
DEX
|
||||
BPL .1
|
||||
JMP ERBA
|
||||
*---FOUND OP OR TERM CHAR--------
|
||||
.2 LDA OPERATOR.INDEX,X
|
||||
BPL .5 ...OPERATOR
|
||||
*---END OF EXPRESSION-----------
|
||||
JSR BACKUP.CHAR.PNTR
|
||||
.3 LDY EXP.UNDEF UNDEF FLAG
|
||||
BPL .4
|
||||
JSR ZERO.EXP.VALUE
|
||||
TYA RECOVER UNDEF STATUS
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
.5 TAX
|
||||
.6 JSR GNC.UC
|
||||
.7 INC EXP.NEW NOT A NEW EXPRESSION ANYMORE
|
||||
LDA OPERATOR.TABLE+1,X
|
||||
PHA
|
||||
LDA OPERATOR.TABLE,X
|
||||
PHA
|
||||
*-------------------------------
|
||||
* GET OPERAND
|
||||
*-------------------------------
|
||||
GET.OPERAND
|
||||
JSR ZERO.SYM.VALUE
|
||||
LDA CURRENT.CHAR
|
||||
CMP #$30 FIRST CHAR OF OPERAND
|
||||
BCC .3 PUNCTUATION
|
||||
CMP #$3A
|
||||
BCS .2 MIGHT BE LETTER, TRY LABEL
|
||||
JSR DECN CONVERT DECIMAL NUMBER
|
||||
.15 JMP BACKUP.CHAR.PNTR
|
||||
*---TRY A LABEL------------------
|
||||
.2 JSR PACK TRY LABEL
|
||||
BCC .4 NO GOOD
|
||||
JSR STSRCH LOOK UP THE VALUE
|
||||
LDY #6 UPDATE FWD REF FLAG
|
||||
>SYM LDA,STPNTR
|
||||
AND EXP.FWDREF
|
||||
STA EXP.FWDREF
|
||||
BCC .1 DEFINED LABEL
|
||||
ROR EXP.UNDEF UNDEFINED, MAKE FLAG NEGATIVE
|
||||
.1 RTS
|
||||
*---TRY LOCAL LABEL--------------
|
||||
.3 CMP #'.
|
||||
BEQ .2 LOCAL LABEL
|
||||
*---TRY CONSTANTS----------------
|
||||
LDX #3 3-->HEX CONSTANT
|
||||
CMP #'$
|
||||
BEQ .5 HEX CONSTANT
|
||||
DEX 2-->OCT CONSTANT
|
||||
CMP #'&'
|
||||
BEQ .5 ...OCTAL
|
||||
LDX #0 0-->BIN CONSTANT
|
||||
CMP #'% BINARY CONSTANT
|
||||
BEQ .5 ...BINARY
|
||||
*---TRY LITERALS-----------------
|
||||
CMP #'' (X = 0)
|
||||
BEQ .6 LITERAL
|
||||
CMP #'" LITERAL WITH HIGH BIT SET
|
||||
BEQ .9
|
||||
*---TRY STAR---------------------
|
||||
CMP #'*
|
||||
BNE .4 ...NONE OF THE ABOVE, ERROR
|
||||
LDX #3 VALUE IS CURRENT LOCATION
|
||||
.7 LDA ORGN,X
|
||||
STA SYM.VALUE,X
|
||||
DEX
|
||||
BPL .7
|
||||
RTS
|
||||
*---INVALID OPERAND--------------
|
||||
.4 JMP ERBA BAD ADDRESS ERROR
|
||||
*---HEX/OCT/BIN CONSTANT--------
|
||||
.5 JSR HEX.OCT.BIN.DGT $ABCD, &777, %1010
|
||||
BCC .4 NO, ERROR BAD ADDRESS
|
||||
.8 JSR HEX.OCT.BIN.DGT.1 GET ANOTHER DIGIT
|
||||
BCS .8
|
||||
BCC .15 ...ALWAYS
|
||||
*---TICK & QUOTE LITERALS-------
|
||||
.9 LDX #$80 HIBIT=1
|
||||
.6 STX SYM.VALUE
|
||||
STA DGTCNT SAVE ' OR " FOR OPTIONAL TERMCHAR
|
||||
JSR GNC GET FOLLOWING CHAR
|
||||
BCS .4 END OF LINE
|
||||
ORA SYM.VALUE SET HIGH BIT
|
||||
STA SYM.VALUE
|
||||
JSR GNC SEE IF CLOSING QUOTE
|
||||
CMP DGTCNT (IT IS OPTIONAL)
|
||||
BNE .15 NO, BACK UP CHAR PNTR
|
||||
RTS
|
||||
*-------------------------------
|
||||
* IF NEXT CHAR IS VALID DIGIT,
|
||||
* APPEND IT TO CURRENT VALUE
|
||||
*
|
||||
* (X) DETERMINES BASE: 0-->2, 2-->8, 3-->16
|
||||
*-------------------------------
|
||||
HEX.DIGIT
|
||||
LDX #3
|
||||
HEX.OCT.BIN.DGT
|
||||
STX BASE.INDEX
|
||||
HEX.OCT.BIN.DGT.1
|
||||
.1 JSR GNC.UC IGNORE CASE
|
||||
CMP #'.' ALLOW PERIODS
|
||||
BEQ .1 ...BUT IGNORE THEM
|
||||
EOR #$30
|
||||
CMP #$0A
|
||||
BCC .3 ...0-9, TEXT VALIDITY
|
||||
ADC #$88 ...MIGHT BE A...F
|
||||
.2 CMP #$FA
|
||||
BCC .5 NOT A-F EITHER, RETURN CARRY CLEAR
|
||||
AND #$0F TRIM HEX A...F
|
||||
.3 LDX BASE.INDEX
|
||||
CMP BASE.TABLE,X CHECK REAL RANGE
|
||||
BCS .2 ...NOT VALID, CLR CARRY WITH 'CMP #$FA'
|
||||
PHA SAVE DIGIT
|
||||
.4 JSR ASL.SYM.VALUE
|
||||
DEX MAKE ROOM FOR DIGIT
|
||||
BPL .4
|
||||
PLA GET DIGIT
|
||||
ORA SYM.VALUE MERGE WITH PREVIOUS
|
||||
STA SYM.VALUE
|
||||
SEC FLAG GOT A DIGIT
|
||||
.5 RTS
|
||||
*--------------------------------
|
||||
BASE.TABLE
|
||||
.DA #2,#2,#8,#16
|
||||
ASL.SYM.VALUE
|
||||
CLC
|
||||
ROL.SYM.VALUE
|
||||
ROL SYM.VALUE
|
||||
ROL SYM.VALUE+1
|
||||
ROL SYM.VALUE+2
|
||||
ROL SYM.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
ZERO.EXP.VALUE
|
||||
LDA #0
|
||||
STA EXP.VALUE
|
||||
STA EXP.VALUE+1
|
||||
STA EXP.VALUE+2
|
||||
STA EXP.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
ZERO.EXP.VALUE64
|
||||
LDA #0
|
||||
STA EXP.VALUE64
|
||||
STA EXP.VALUE64+1
|
||||
STA EXP.VALUE64+2
|
||||
STA EXP.VALUE64+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
ZERO.SYM.VALUE
|
||||
LDA #0
|
||||
STA SYM.VALUE
|
||||
STA SYM.VALUE+1
|
||||
STA SYM.VALUE+2
|
||||
STA SYM.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
EXP.AND
|
||||
LDX #3
|
||||
.1 LDA EXP.VALUE,X
|
||||
AND SYM.VALUE,X
|
||||
STA EXP.VALUE,X
|
||||
DEX
|
||||
BPL .1
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.ORA
|
||||
LDX #3
|
||||
.1 LDA EXP.VALUE,X
|
||||
ORA SYM.VALUE,X
|
||||
STA EXP.VALUE,X
|
||||
DEX
|
||||
BPL .1
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.EOR
|
||||
LDX #3
|
||||
.1 LDA EXP.VALUE,X
|
||||
EOR SYM.VALUE,X
|
||||
STA EXP.VALUE,X
|
||||
DEX
|
||||
BPL .1
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.ADD
|
||||
CLC PLUS
|
||||
LDX #-4
|
||||
.1 LDA EXP.VALUE+4,X
|
||||
ADC SYM.VALUE+4,X
|
||||
STA EXP.VALUE+4,X
|
||||
INX
|
||||
BNE .1
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.SUBTRACT
|
||||
JSR EXP.SUBTRACTION
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.SUBTRACTION
|
||||
SEC
|
||||
LDX #-4
|
||||
.7 LDA EXP.VALUE+4,X
|
||||
SBC SYM.VALUE+4,X
|
||||
STA EXP.VALUE+4,X
|
||||
INX
|
||||
BNE .7
|
||||
RTS
|
||||
*--------------------------------
|
||||
EXP.LESS
|
||||
JSR EXP.SUBTRACTION
|
||||
LDA EXP.VALUE+3
|
||||
BMI EXP.TRUE
|
||||
EXP.FALSE
|
||||
CLC
|
||||
EXP.TRUE.OR.FALSE
|
||||
JSR ZERO.EXP.VALUE
|
||||
ROL EXP.VALUE
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.EQUAL
|
||||
JSR EXP.SUBTRACTION
|
||||
JSR TEST.EXP.VALUE
|
||||
BNE EXP.FALSE
|
||||
EXP.TRUE
|
||||
SEC
|
||||
BCS EXP.TRUE.OR.FALSE
|
||||
*--------------------------------
|
||||
TEST.EXP.VALUE.ZP
|
||||
LDA #0
|
||||
.HS 2C
|
||||
TEST.EXP.VALUE
|
||||
LDA EXP.VALUE
|
||||
ORA EXP.VALUE+1
|
||||
ORA EXP.VALUE+2
|
||||
ORA EXP.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
EXP.GREATER
|
||||
JSR EXP.SUBTRACTION
|
||||
JSR TEST.EXP.VALUE
|
||||
BEQ EXP.FALSE
|
||||
LDA EXP.VALUE+3 LOOK AT SIGN BIT
|
||||
BMI EXP.FALSE
|
||||
BPL EXP.TRUE
|
||||
*-------------------------------
|
||||
EXP.DIVIDE
|
||||
JSR EXP.DIVISION
|
||||
JMP EXP2
|
||||
*--------------------------------
|
||||
EXP.DIVISION
|
||||
JSR ZERO.EXP.VALUE64
|
||||
LDY #32 32 BITS
|
||||
.1 ASL EXP.VALUE SHIFT DIVIDEND/QUOTIENT LEFT
|
||||
ROL EXP.VALUE+1
|
||||
ROL EXP.VALUE+2
|
||||
ROL EXP.VALUE+3
|
||||
ROL EXP.VALUE64 SHIFT PARTIAL DIVIDEND LEFT
|
||||
ROL EXP.VALUE64+1
|
||||
ROL EXP.VALUE64+2
|
||||
ROL EXP.VALUE64+3
|
||||
SEC SUBTRACT DIVISOR FROM PARTIAL DIVIDEND
|
||||
LDA EXP.VALUE64
|
||||
SBC SYM.VALUE
|
||||
PHA SAVE LO-BYTE OF DIFFERENCE ON STACK
|
||||
LDA EXP.VALUE64+1
|
||||
SBC SYM.VALUE+1
|
||||
PHA
|
||||
LDA EXP.VALUE64+2
|
||||
SBC SYM.VALUE+2
|
||||
PHA
|
||||
LDA EXP.VALUE64+3
|
||||
SBC SYM.VALUE+3
|
||||
BCC .2 REMAINDER TOO SMALL
|
||||
INC EXP.VALUE SET BIT IN QUOTIENT
|
||||
STA EXP.VALUE64+3 HI-BYTE OF REMAINDER
|
||||
PLA RETRIEVE NEXT BYTE OF REMAINDER
|
||||
STA EXP.VALUE64+2
|
||||
PLA
|
||||
STA EXP.VALUE64+1
|
||||
PLA
|
||||
STA EXP.VALUE64
|
||||
BCS .3
|
||||
.2 PLA STACK BACK TO NORMAL
|
||||
PLA
|
||||
PLA
|
||||
.3 DEY NEXT BIT
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
EXP.MULTIPLY
|
||||
JSR ZERO.EXP.VALUE64
|
||||
LDY #32 32-BIT MULTIPLY
|
||||
.1 LDA EXP.VALUE CHECK LSB OF MULTIPLIER
|
||||
LSR
|
||||
BCC .2 IF 0, DON'T ADD MULTIPLICAND
|
||||
CLC ADD MULTIPLICAND
|
||||
LDA EXP.VALUE64
|
||||
ADC SYM.VALUE
|
||||
STA EXP.VALUE64
|
||||
LDA EXP.VALUE64+1
|
||||
ADC SYM.VALUE+1
|
||||
STA EXP.VALUE64+1
|
||||
LDA EXP.VALUE64+2
|
||||
ADC SYM.VALUE+2
|
||||
STA EXP.VALUE64+2
|
||||
LDA EXP.VALUE64+3
|
||||
ADC SYM.VALUE+3
|
||||
STA EXP.VALUE64+3
|
||||
.2 ROR EXP.VALUE64+3
|
||||
ROR EXP.VALUE64+2
|
||||
ROR EXP.VALUE64+1
|
||||
ROR EXP.VALUE64
|
||||
ROR EXP.VALUE+3
|
||||
ROR EXP.VALUE+2
|
||||
ROR EXP.VALUE+1
|
||||
ROR EXP.VALUE
|
||||
DEY
|
||||
BNE .1
|
||||
JMP EXP2
|
||||
*-------------------------------
|
||||
* MGO COMMAND
|
||||
*-------------------------------
|
||||
MGO JSR EXPR.DEFINED CRACK EXPRESSION
|
||||
JMP (EXP.VALUE) ENTER USER'S PROGRAM
|
||||
*--------------------------------
|
||||
* VAL COMMAND
|
||||
*--------------------------------
|
||||
VAL JSR EXPR.DEFINED GET VALUE OF EXPRESSION
|
||||
LDA #'$'
|
||||
JSR CHO
|
||||
JSR P.EXP.VALUE
|
||||
LDA #'='
|
||||
JSR CHO
|
||||
JSR ZERO.SYM.VALUE
|
||||
TAX X=0
|
||||
LDA #10
|
||||
STA SYM.VALUE
|
||||
.1 JSR EXP.DIVISION
|
||||
LDA EXP.VALUE64 REMAINDER
|
||||
PHA
|
||||
INX
|
||||
JSR TEST.EXP.VALUE
|
||||
BNE .1
|
||||
.2 PLA
|
||||
ORA #'0'
|
||||
JSR CHO
|
||||
DEX
|
||||
BNE .2
|
||||
JMP CRLF
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.exp
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
407
SCMASM.30/SCMASM.S.FNDREP.txt
Normal file
407
SCMASM.30/SCMASM.S.FNDREP.txt
Normal file
@ -0,0 +1,407 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* FIND AND LIST COMMANDS
|
||||
*--------------------------------
|
||||
LIST
|
||||
FIND JSR GET.KEY.STRING
|
||||
JSR PARSE.LINE.RANGE
|
||||
JSR HANDLE.REPLACE.OPTIONS
|
||||
.1 JSR GET.LINE.TO.WBUF
|
||||
BCC .2
|
||||
RTS
|
||||
.2 JSR FIND.KEY.IN.WBUF
|
||||
BCC .1 KEY NOT IN WBUF
|
||||
LDA A1L SET UP POINTER FOR LIST
|
||||
LDX A1H
|
||||
JSR LIST.LINE.AX
|
||||
JMP .1
|
||||
*--------------------------------
|
||||
* PARSE <D><STRING><D> INTO FREE MEMORY
|
||||
*--------------------------------
|
||||
GET.KEY.STRING
|
||||
LDA #KBUF
|
||||
STA KEY.ADDR
|
||||
LDA /KBUF
|
||||
STA KEY.ADDR+1
|
||||
GET.KEY2
|
||||
JSR GNNB GET NEXT NON-BLANK
|
||||
STA DLIM FOR DELIMITER
|
||||
BCS .4 EOL
|
||||
CMP #',
|
||||
BEQ .4 COMMA
|
||||
CMP #'. PERIOD
|
||||
BEQ .4
|
||||
EOR #$30
|
||||
CMP #10
|
||||
BCC .4 DIGIT
|
||||
LDY #0
|
||||
.1 STY PNTR
|
||||
JSR GNC MOVE STRING
|
||||
BCS .2 END OF LINE
|
||||
CMP DLIM
|
||||
BEQ .2 END OF STRING
|
||||
LDY PNTR
|
||||
STA (KEY.ADDR),Y
|
||||
INY
|
||||
CPY #39 SEE IF STRING FITS
|
||||
BCC .1 YES, KEEP GOING
|
||||
LDY #QSTRLNG NO, STRING TOO LONG
|
||||
JMP HARD.ERROR
|
||||
.2 LDY PNTR
|
||||
LDA #0
|
||||
STA (KEY.ADDR),Y
|
||||
SEC WE FOUND IT
|
||||
RTS
|
||||
.4 LDA #0
|
||||
STA PNTR
|
||||
CLC DIDN'T FIND IT
|
||||
JMP BACKUP.CHAR.PNTR
|
||||
*--------------------------------
|
||||
* GET NEXT LINE INTO WBUF
|
||||
* RETURN CARRY CLEAR IF SUCCESSFUL
|
||||
* CARRY SET IF BEYOND <ENDP>
|
||||
* X = LENGTH OF LINE
|
||||
*--------------------------------
|
||||
GET.LINE.TO.WBUF
|
||||
LDA SRCP
|
||||
STA A1L SAVE POINTER FOR LIST
|
||||
LDA SRCP+1
|
||||
STA A1H
|
||||
JSR CMP.SRCP.ENDP END OF RANGE YET?
|
||||
BCS .2 ...YES, FINISHED
|
||||
JSR GET.LINE.NUMBER
|
||||
LDY #0 START AT BEGINNING OF WBUF
|
||||
JSR CONVERT.LINE.NUMBER.STORE PUT CONVERTED # AT WBUF,Y
|
||||
LDA #$A0 APPEND A SPACE AFTER LINE NUMBER
|
||||
STA WBUF,Y
|
||||
INY
|
||||
TYA
|
||||
TAX
|
||||
.1 JSR NTKN BYTE FROM PROGRAM
|
||||
STA WBUF,X
|
||||
INX
|
||||
TAY TEST CHAR
|
||||
BNE .1 END OF LINE
|
||||
CLC FLAG SUCCESSFUL
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* LIST LINE POINTED TO BY <SRCP>
|
||||
*--------------------------------
|
||||
LIST.LINE.AX
|
||||
STA SRCP
|
||||
STX SRCP+1
|
||||
*--------------------------------
|
||||
LIST.CURRENT.LINE
|
||||
JSR CRLF PRINT CARRIAGE RETURN
|
||||
JSR SPC SPACE
|
||||
LDA PROMPT.FLAG
|
||||
BEQ .1 ...NO SPACE SINCE NOT "H"
|
||||
JSR SPC
|
||||
.1 JSR GET.LINE.NUMBER BODY
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
LDA #$20 SPACE
|
||||
.2 JSR CHO PRINT CHAR
|
||||
JSR GET.NEXT.SOURCE.CHAR
|
||||
BNE .2 NOT END YET
|
||||
RTS FINISHED
|
||||
*--------------------------------
|
||||
* FIND KEY IN WBUF
|
||||
* RETURN WITH CARRY CLEAR IF NO MATCH.
|
||||
* RETURN WITH CARRY SET IF MATCH, AND WITH
|
||||
* (PNTR) = INDEX OF START OF MATCH
|
||||
* (X) = INDEX OF LAST CHAR MATCHED + 1
|
||||
*--------------------------------
|
||||
FIND.KEY.IN.WBUF
|
||||
JSR FIND.START.OF.LINE.IN.WBUF
|
||||
LDA PNTR
|
||||
BNE .1 NON-NULL KEY STRING
|
||||
LDA DLIM If delimiter is slash, list
|
||||
CMP #'/' only major labels
|
||||
BEQ .3 ...it is
|
||||
SEC ...no string, so SIGNAL MATCH
|
||||
RTS
|
||||
.3 LDA WBUF,X GET FIRST CHAR
|
||||
JSR ELIMINATE.CASE
|
||||
JMP CHECK.LETTER
|
||||
.1 LDY #39 MAP SEARCH KEY INTO UPPER CASE
|
||||
.2 LDA (KEY.ADDR),Y ...IF LC.FLAG IS ON
|
||||
JSR ELIMINATE.CASE.MAYBE
|
||||
STA (KEY.ADDR),Y
|
||||
DEY
|
||||
BPL .2
|
||||
FIND.KEY.IN.WBUF2
|
||||
LDY #0 START AT FIRST CHAR OF KEY
|
||||
.1 STY KEY.PNTR CURRENT STARTING POINT IN KEY
|
||||
.2 STX BUF.PNTR CURRENT STARTING POINT IN BUFFER
|
||||
.3 LDA (KEY.ADDR),Y NEXT CHAR FROM KEY
|
||||
BEQ .6 END OF KEY, IT MATCHES
|
||||
CMP WILD.CARD NORMALLY CONTROL-W
|
||||
BEQ .8 YES
|
||||
LDA WBUF,X NEXT CHAR FROM BUFFER
|
||||
BEQ .5 END OF BUFFER, DID NOT MATCH
|
||||
JSR ELIMINATE.CASE.MAYBE MAP INTO UPPER CASE IS NEEDED
|
||||
CMP (KEY.ADDR),Y COMPARE WITH KEY CHAR
|
||||
BNE .4 NO MATCH
|
||||
INY ADVANCE KEY POINTER
|
||||
INX ADVANCE BUFFER POINTER
|
||||
BNE .3 ...ALWAYS
|
||||
*--------------------------------
|
||||
.4 LDY KEY.PNTR TRY AGAIN FURTHER INTO BUFFER
|
||||
LDX BUF.PNTR
|
||||
INX
|
||||
BNE .2 ...ALWAYS
|
||||
*--------------------------------
|
||||
.5 LDA $C000
|
||||
CMP #$8D ALLOW 'ABORT' WITH <RETURN>
|
||||
BEQ .11
|
||||
CLC SIGNAL NO MATCH
|
||||
RTS
|
||||
*--------------------------------
|
||||
.6 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY
|
||||
BNE .7 NO
|
||||
LDA BUF.PNTR YES
|
||||
STA PNTR
|
||||
.7 SEC SIGNAL MATCH
|
||||
RTS
|
||||
*--------------------------------
|
||||
.8 LDA KEY.PNTR SEE IF IN FIRST SEGMENT OF KEY
|
||||
BNE .9 NO
|
||||
LDA BUF.PNTR YES
|
||||
STA PNTR
|
||||
.9 INY ADVANCE KEY POINTER
|
||||
LDA (KEY.ADDR),Y PEEK AT NEXT CHAR OF KEY
|
||||
BNE .1 NOT AT END YET
|
||||
.10 LDA WBUF,X AT END, SO SCAN TO END OF BUFFER
|
||||
BEQ .6 FOUND END, AND ALL MATCHES
|
||||
INX ADVANCE BUFFER POINTER
|
||||
BNE .10 ...ALWAYS
|
||||
*--------------------------------
|
||||
.11 JMP SOFT HE ABORTED
|
||||
*--------------------------------
|
||||
* REPLACE COMMAND
|
||||
*--------------------------------
|
||||
REPLACE
|
||||
JSR GET.KEY.STRING
|
||||
BCC R.ERR1 (SYN ERROR)
|
||||
LDA PNTR NULL SEARCH FAILS
|
||||
BEQ R.ERR1
|
||||
JSR BACKUP.CHAR.PNTR USE DELIMITER OVER AGAIN
|
||||
LDA #KBUF+40
|
||||
STA KEY.ADDR
|
||||
LDA /KBUF+40
|
||||
STA KEY.ADDR+1 SET UP CALL
|
||||
JSR GET.KEY2
|
||||
BCC R.ERR1 (SYN ERROR)
|
||||
STY REPLACE.LENGTH
|
||||
JSR PARSE.LINE.RANGE
|
||||
JSR HANDLE.REPLACE.OPTIONS
|
||||
LDA #KBUF FOR SEARCH
|
||||
STA KEY.ADDR
|
||||
LDA /KBUF
|
||||
STA KEY.ADDR+1
|
||||
LDA #1
|
||||
STA PNTR PNTR MUST BE > 0 FOR SEARCH
|
||||
.1 JSR GET.LINE.TO.WBUF
|
||||
BCS .5 FINISHED
|
||||
STX WBUF.LENGTH
|
||||
JSR FIND.KEY.IN.WBUF
|
||||
BCC .1
|
||||
LDA #0
|
||||
STA CHANGE.CNT (DEF IS EQ)
|
||||
.2 TXA COMPUTE # CHARS IN TARGET FIELD
|
||||
SEC
|
||||
SBC PNTR
|
||||
STA SOURCE.LENGTH
|
||||
STX MATCH.END
|
||||
JSR REPLACE.REPLACE
|
||||
BCS .5 NEITHER "Y" NOR "N"
|
||||
BNE .3 THEY HIT 'N'
|
||||
INC CHANGE.CNT
|
||||
LDX MATCH.END
|
||||
BNE .4 ...ALWAYS
|
||||
.3 LDX PNTR MATCH BEGINNING
|
||||
INX +1
|
||||
.4 JSR FIND.KEY.IN.WBUF2
|
||||
BCS .2 LOOP IF ANOTHER
|
||||
LDA CHANGE.CNT ANY CHANGES?
|
||||
BEQ .1 NO - TRY NEXT LINE
|
||||
JSR NML PUT LINE BACK
|
||||
LDA WBUF If replacement line was null,
|
||||
BEQ .6 then just lshow line number
|
||||
LDA LINE.END AND LIST
|
||||
LDX LINE.END+1
|
||||
JSR LIST.LINE.AX
|
||||
JMP .1 TRY NEXT LINE
|
||||
.5 RTS FINISHED
|
||||
.6 LDA WBUF+1
|
||||
STA CURRENT.LINE.NUMBER
|
||||
LDA WBUF+2
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
JSR CRLF
|
||||
JSR CONVERT.LINE.NUMBER.PRINT
|
||||
JMP .1
|
||||
*--------------------------------
|
||||
R.ERR1 JMP SYNX MISSING STRING
|
||||
R.ERR2 LDY #QREPLNG REP STRNG TOO LONG
|
||||
JMP HARD.ERROR
|
||||
*--------------------------------
|
||||
* A MATCH IS FOUND, MAYBE REPLACE
|
||||
* RETURNS: CARRY ZERO
|
||||
* Q CS NE QUIT
|
||||
* N CC NE NO CHG
|
||||
* Y CC EQ CHANGE MADE
|
||||
*--------------------------------
|
||||
REPLACE.REPLACE
|
||||
LDA AUTO.FLAG
|
||||
BMI .40 - = AUTO MODE, + = VERIFY MODE
|
||||
JSR PRINT.AND.PROMPT
|
||||
BNE .99 Q,N EXITS
|
||||
.40 SEC
|
||||
LDA REPLACE.LENGTH
|
||||
SBC SOURCE.LENGTH
|
||||
BCC .60 (IF SHORTER)
|
||||
BEQ .50 (IF EQUAL )
|
||||
*--------------------------------
|
||||
* REPLACE IS LONGER - MAKE SPACE
|
||||
* ACC IS REP.LEN-SRC.LEN
|
||||
*--------------------------------
|
||||
CLC
|
||||
ADC WBUF.LENGTH
|
||||
BCS .45 OVER 256 LEN
|
||||
CMP #WBUF.MAX
|
||||
BCC .51
|
||||
.45 JMP R.ERR2 TOO LONG ERR
|
||||
.51 TAX
|
||||
LDY WBUF.LENGTH
|
||||
STX WBUF.LENGTH (RESET IT)
|
||||
.52 LDA WBUF,Y
|
||||
STA WBUF,X
|
||||
DEX
|
||||
DEY
|
||||
CPY MATCH.END
|
||||
BCS .52
|
||||
INX
|
||||
STX MATCH.END
|
||||
*--------------------------------
|
||||
* MOVE STRING INTO GAP
|
||||
*--------------------------------
|
||||
.50 LDX PNTR MOVE REPLACEMENT STRING INTO GAP
|
||||
LDY #0 POINT AT REPLACEMENT STRING
|
||||
.55 LDA KBUF+40,Y NEXT CHAR FROM REP. STRING
|
||||
BEQ .57 END OF REP. STRING
|
||||
STA WBUF,X STORE IN GAP
|
||||
INX
|
||||
INY
|
||||
BNE .55 ...ALWAYS
|
||||
.57 CLC SIGNAL SUCCESS
|
||||
LDA #0 (CC,EQ)
|
||||
.99 RTS
|
||||
*--------------------------------
|
||||
* REPLACE IS SHORTER - REMOVE EXTRA
|
||||
*--------------------------------
|
||||
.60 LDA PNTR
|
||||
ADC REPLACE.LENGTH
|
||||
TAX
|
||||
LDY MATCH.END
|
||||
STX MATCH.END (RESET IT)
|
||||
.1 LDA WBUF,Y
|
||||
STA WBUF,X
|
||||
INY
|
||||
INX
|
||||
CPX WBUF.LENGTH
|
||||
BCC .1
|
||||
STX WBUF.LENGTH (RESET THIS TOO)
|
||||
BCS .50 ...ALWAYS
|
||||
*--------------------------------
|
||||
* PRINT LINE AND GET Y,N,Q
|
||||
* RETURNS: CARRY ZERO
|
||||
* Q CS NE
|
||||
* N CC NE
|
||||
* Y CS EQ
|
||||
*--------------------------------
|
||||
PRINT.AND.PROMPT
|
||||
JSR P.RETURN PRINT <CR>
|
||||
LDX #0
|
||||
.1 LDA WBUF,X
|
||||
BEQ .4 EOL?
|
||||
ORA #$80
|
||||
CMP #$A0 SKIP CONTROL
|
||||
BCC .3
|
||||
CPX PNTR
|
||||
BCC .2
|
||||
CPX MATCH.END
|
||||
BCS .2
|
||||
JSR ELIMINATE.CASE
|
||||
AND #$3F ...DISPLAY IN INVERSE
|
||||
.2 JSR IO.COUT
|
||||
.3 INX
|
||||
BNE .1 NEXT CHAR
|
||||
.4 JSR MON.CLREOL
|
||||
LDY #QREPPRMT PRINT "REPLACE? "
|
||||
YES.OR.NO
|
||||
JSR QT.OUT
|
||||
JSR READ.KEY.WITH.CASE
|
||||
CMP #$A0 CONTROL CHAR?
|
||||
BCC .2 ...YES, DO NOT ECHO
|
||||
JSR MY.COUT
|
||||
AND #$DF NOW IGNORE CASE
|
||||
.2 CMP #'N+$80 NO: RETURN CC, NE
|
||||
BEQ .1 ..."N"
|
||||
CMP #'Y+$80 YES: RETURN CS, EQ
|
||||
SEC NEITHER: CS, NE
|
||||
RTS
|
||||
.1 LSR WAS = N = $CE, SO CLEAR CARRY, SET NE
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SET FLAGS FROM CHAR IN ACC
|
||||
* CHAR FLAG MEANING
|
||||
* "A" AUTO.FLAG +=VERIFY, -=AUTO
|
||||
* "U" LC.FLAG +=AS TYPED, -=ACCEPT EITHER CASE
|
||||
*
|
||||
* RETURN CS -> VALID OPTION
|
||||
* CC -> NOT AN OPTION
|
||||
*--------------------------------
|
||||
HANDLE.REPLACE.OPTIONS
|
||||
LSR AUTO.FLAG +=VERIFY MODE
|
||||
LSR LC.FLAG +=CASE AS TYPED
|
||||
.1 JSR GNNB GET NEXT BYTE FROM INPUT LINE
|
||||
BCS .3 END OF LINE
|
||||
JSR ELIMINATE.CASE MAP LOWER TO UPPER
|
||||
CMP #'A AUTO MODE?
|
||||
BNE .2 NO
|
||||
ROR AUTO.FLAG YES, SET SIGN BIT FROM CARRY
|
||||
.2 CMP #'U ACCEPT BOTH CASES?
|
||||
BNE .1 NO
|
||||
ROR LC.FLAG YES, SET SIGN BIT FROM CARRY
|
||||
BNE .1 ...ALWAYS
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
* MAP LOWER CASE INTO UPPER CASE
|
||||
*--------------------------------
|
||||
ELIMINATE.CASE.MAYBE
|
||||
BIT LC.FLAG
|
||||
BPL LCUC3 DON'T DO IT
|
||||
ELIMINATE.CASE
|
||||
PHA SAVE ORIGINAL CHAR
|
||||
ORA #$80 MAKE CANONICAL FORM
|
||||
CMP #$E0 IN LOWER CASE REGION?
|
||||
PLA RESTORE ORIGINAL CHAR
|
||||
BCC LCUC3 ...NOT LOWER CASE REGION
|
||||
AND #$DF ...LC, MAP TO UPPER CASE
|
||||
LCUC3 RTS
|
||||
*--------------------------------
|
||||
* LOAD CURRENT LINE NUMBER FROM SRCP
|
||||
*--------------------------------
|
||||
GET.LINE.NUMBER
|
||||
JSR GNB SKIP LENGTH
|
||||
JSR GNB GET LINE NUMBER
|
||||
STA CURRENT.LINE.NUMBER
|
||||
JSR GNB
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.fndrep
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
115
SCMASM.30/SCMASM.S.IOSTD.txt
Normal file
115
SCMASM.30/SCMASM.S.IOSTD.txt
Normal file
@ -0,0 +1,115 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
IO.INIT JMP S.IO.INIT
|
||||
IO.WARM JMP S.IO.WARM
|
||||
READ.KEY.WITH.CASE JMP S.READ.KEY.WITH.CASE
|
||||
GET.HORIZ.POSN LDA CH
|
||||
RTS
|
||||
IO.HOME JMP MON.HOME
|
||||
IO.CLREOL JMP MON.CLREOL
|
||||
IO.CLREOP JMP MON.CLREOP
|
||||
IO.UP JMP MON.UP
|
||||
IO.DOWN JMP MON.LF
|
||||
IO.LEFT JMP MON.BS
|
||||
IO.RIGHT JMP MON.ADVANC
|
||||
IO.COUT JMP MON.COUT
|
||||
IO.PICK.SCREEN LDA (BASL),Y
|
||||
RTS
|
||||
IO.HTABX STX CH
|
||||
RTS
|
||||
IO.HTAB STA CH
|
||||
RTS
|
||||
IO.VTAB JMP S.IO.VTAB
|
||||
IO.CASE.TOGGLE LDA LC.MODE
|
||||
EOR #$FF
|
||||
STA LC.MODE
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
* (ENTERED THROUGH VECTORS)
|
||||
*--------------------------------
|
||||
S.IO.VTAB
|
||||
STA CV
|
||||
JMP MON.VTAB
|
||||
*--------------------------------
|
||||
S.IO.INIT
|
||||
LDA #40
|
||||
STA SCREEN.WIDTH
|
||||
JSR MON.SETKBD
|
||||
JSR MON.SETVID
|
||||
JSR MON.INIT
|
||||
JMP MON.HOME
|
||||
*--------------------------------
|
||||
S.IO.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
STX LC.MODE POSITIVE VALUE
|
||||
JSR MON.VTAB
|
||||
RTS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
S.READ.KEY.WITH.CASE
|
||||
LDA $BE43 See if "EXEC" in progress
|
||||
BMI .1 ...Yes, use straight input
|
||||
LDA LC.MODE
|
||||
BMI .2 Yes, use fancy translation
|
||||
.1 JSR MON.RDKEY
|
||||
ORA #$80 Make sure it looks right
|
||||
CLC SIGNAL "NO OPEN APPLE PRESSED"
|
||||
RTS
|
||||
*--------------------------------
|
||||
.2
|
||||
LDY CH Set up cursor
|
||||
LDA (BASL),Y Char from screen
|
||||
PHA
|
||||
CMP #$E0 ELIMINATE CASE
|
||||
BCC .25
|
||||
AND #$DF
|
||||
.25 AND #$3F Make it flash
|
||||
ORA #$40
|
||||
STA (BASL),Y
|
||||
PLA
|
||||
JSR MON.READCH
|
||||
BIT $C063 Shift key down?
|
||||
BPL .4 Yes
|
||||
CMP #$C0 No, lower case if letter
|
||||
BCC .3
|
||||
ORA #$20
|
||||
CLC SIGNAL "NO OPEN APPLE PRESSED"
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
.4 CMP #$C0 Shift key down
|
||||
BCC .8 Not a letter key
|
||||
BEQ .7 Shift-P
|
||||
CMP #$DD Shift-M
|
||||
BEQ .5 Yes
|
||||
CMP #$DE Shift-N
|
||||
BNE .6 No
|
||||
.5 AND #$EF Make capital-M or -N
|
||||
.6 CLC SIGNAL "NO OPEN APPLE PRESSED"
|
||||
RTS
|
||||
*--------------------------------
|
||||
.7 LDA #$D0 Make capital-P
|
||||
CLC SIGNAL "NO OPEN APPLE PRESSED"
|
||||
RTS
|
||||
*--------------------------------
|
||||
.8 CMP #$87 Look for control-shift-A thru -F
|
||||
BCS .10 No
|
||||
CMP #$81 Control-A
|
||||
BCC .10 No, control-P
|
||||
BNE .9 No, control-B thru -F
|
||||
LDA #$C0-$58-1 Control-shift-A = at-sign (@)
|
||||
.9 ADC #$58
|
||||
.10 CLC SIGNAL "NO OPEN APPLE PRESSED"
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.iostd
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
222
SCMASM.30/SCMASM.S.LDR.txt
Normal file
222
SCMASM.30/SCMASM.S.LDR.txt
Normal file
@ -0,0 +1,222 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
SPTR .EQ $00
|
||||
DPTR .EQ $02
|
||||
*--------------------------------
|
||||
MLI.UNIT .EQ $BF30
|
||||
MLI.BITMAP .EQ $BF58
|
||||
MLI.PREFIX.FLAG .EQ $BF9A
|
||||
*--------------------------------
|
||||
MON.CROUT .EQ $FD8E
|
||||
SETNORM .EQ $FE84
|
||||
*--------------------------------
|
||||
* sys file execution
|
||||
* --------- ---------
|
||||
* 2000-21FF LOADER
|
||||
* 2200-4AFF 8000-A8FF S-C MACRO ASSEMBLER with 40-col driver
|
||||
* A900-A9FF additional space for longer drivers
|
||||
* 4B00-5FFF AA00-BEFF S-C ProDOS Interface
|
||||
* 6000-60FF A800-A8FF //E 80-COLUMN DRIVER
|
||||
* 6100-61FF A800-A8FF STB80 DRIVER
|
||||
* 6200-63FF A800-A9FF VIDEX VIDEOTERM DRIVER
|
||||
* 6400-65FF A800-A9FF VIDEX ULTRATERM DRIVER
|
||||
* 6600-71FF D400-DFFF ASM PARTICULAR
|
||||
*--------------------------------
|
||||
* BLOAD SCASM (loader and Macro and 40-col driver)
|
||||
* BLOAD B.SCI (ProDOS Interpreter)
|
||||
* BLOAD B.IO.TWO.E (//E 80-COLUMN DRIVER)
|
||||
* BLOAD B.IO.STB80
|
||||
* BLOAD B.IO.VIDEX
|
||||
* BLOAD B.IO.ULTRA
|
||||
* BSAVE SCASM.SYS,A$2000,L$4600
|
||||
*--------------------------------
|
||||
.MA MOVE
|
||||
LDA /]1 DESTINATION
|
||||
LDY /]2 SOURCE BEGINNING
|
||||
LDX /]3-]2+255 # PAGES
|
||||
JSR MOVE
|
||||
.EM
|
||||
*--------------------------------
|
||||
STARTUP.SC.MACRO
|
||||
JMP LOAD.SC
|
||||
*--------------------------------
|
||||
DRIVER.FLAG .HS 00
|
||||
*--------------------------------
|
||||
LOAD.SC
|
||||
JSR SELECT.DRIVER
|
||||
>MOVE $AA00,$4B00,$5FFF
|
||||
>MOVE $8000,$2200,$4AFF
|
||||
LDA $C083
|
||||
LDA $C083
|
||||
>MOVE $D400,$6600,$71FF
|
||||
LDA $C082
|
||||
JSR LOAD.DRIVER
|
||||
*--------------------------------
|
||||
*---GET SCREEN TO NORMAL 40------
|
||||
* LDA #$15 CTRL-U, TURNS OFF 80-COLUMN
|
||||
* JSR MON.COUT
|
||||
* JSR SETNORM
|
||||
* JSR MON.INIT
|
||||
* JSR MON.HOME
|
||||
*---ESTABLISH RAM BITMAP---------
|
||||
LDX #BITMAP.SIZE-1
|
||||
.2 LDA MY.BITMAP,X
|
||||
STA MLI.BITMAP,X
|
||||
DEX
|
||||
BPL .2
|
||||
*---BUILD $3D0-3FF---------------
|
||||
LDX #5
|
||||
.3 LDA IMAGE.3D0,X
|
||||
STA $3D0,X
|
||||
DEX
|
||||
BPL .3
|
||||
LDX #10
|
||||
.4 LDA IMAGE.3F0,X
|
||||
STA $3F0,X
|
||||
DEX
|
||||
BPL .4
|
||||
*---Establish HIMEM page---------
|
||||
LDA #$74
|
||||
STA SCI.HIMEM.PAGE
|
||||
STA SCI.BUFFER.PAGES+2 EXEC BUFFER
|
||||
CLC
|
||||
ADC #4
|
||||
STA SCI.BUFFER.PAGES BUF 0
|
||||
ADC #4
|
||||
STA SCI.BUFFER.PAGES+1 BUF 1
|
||||
*---SET A NULL PREFIX------------
|
||||
LDA #0
|
||||
STA MLI.PREFIX.FLAG
|
||||
*---SET SLOT/DRIVE DEFAULTS------
|
||||
LDA MLI.UNIT
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
CMP #$08
|
||||
AND #$07
|
||||
STA SCI.SLOT
|
||||
LDA #1
|
||||
ADC #0
|
||||
STA SCI.DRIVE
|
||||
*--------------------------------
|
||||
IIGS SEC
|
||||
JSR $FE1F
|
||||
BCS .2 ...NOT IIGS
|
||||
*--------------------------------
|
||||
LDY #GS.NUM-1
|
||||
.1 LDA GS.NEW,Y
|
||||
STA FAKE.MONITOR,Y
|
||||
DEY
|
||||
BPL .1
|
||||
*---START UP ProDOS--------------
|
||||
.2 JMP $8000
|
||||
*--------------------------------
|
||||
GS.NEW LDA #" " COVER UP THE DOLLAR SIGN
|
||||
STA WBUF
|
||||
LDA WBUF-1,X LOOK FOR "HEXNUM=" COMMAND
|
||||
CMP #"="
|
||||
BEQ .1 ...YES, DON'T APPEND " Q"
|
||||
LDA #" "
|
||||
STA WBUF,X APPEND " Q"
|
||||
LDA #"Q"
|
||||
STA WBUF+1,X
|
||||
.1 JMP $FF70
|
||||
GS.NUM .EQ *-GS.NEW
|
||||
*--------------------------------
|
||||
IMAGE.3D0
|
||||
JMP SCI.STARTUP $3D0
|
||||
JMP SCI.STARTUP $3D3
|
||||
IMAGE.3F0
|
||||
.DA $FA59 'BRK' VECTOR
|
||||
.DA SCI.STARTUP,#$BE^$A5 RESET VECTOR
|
||||
JMP SCI.RTS &-VECTOR
|
||||
JMP SCI.RTS Y-VECTOR
|
||||
*--------------------------------
|
||||
MY.BITMAP
|
||||
.HS C3.00.00.00.00.00.00.00 0000-3FFF
|
||||
.HS 00.00.00.00.00.00.00.00 4000-7FFF
|
||||
.HS FF.FF.FF.FF.FF.FF.FF.F3 8000-BFFF
|
||||
BITMAP.SIZE .EQ *-MY.BITMAP
|
||||
*--------------------------------
|
||||
SELECT.DRIVER
|
||||
LDY DRIVER.FLAG
|
||||
BNE .3 ...LOAD SPECIFIC DRIVER
|
||||
LDA $FBB3
|
||||
CMP #6
|
||||
BEQ .3 ...//E OR //C, USE //E DRIVER
|
||||
*---Display menu-----------------
|
||||
JSR MON.HOME
|
||||
LDY #0
|
||||
.1 LDA MENU,Y
|
||||
BEQ .2
|
||||
JSR MON.COUT
|
||||
INY
|
||||
BNE .1
|
||||
*---Get choice-------------------
|
||||
.2 JSR MON.RDKEY
|
||||
EOR #$B0
|
||||
BEQ .2
|
||||
CMP #5
|
||||
BCS .2
|
||||
TAY
|
||||
ORA #$B0
|
||||
JSR MON.COUT
|
||||
JSR MON.CROUT
|
||||
*---(Y) is selected driver-------
|
||||
.3 STY DRIVER.FLAG
|
||||
RTS
|
||||
*--------------------------------
|
||||
LOAD.DRIVER
|
||||
LDY DRIVER.FLAG
|
||||
LDA DRIVER.ADDRS,Y
|
||||
BEQ .4 ...40-COLUMN, RETURN NOW
|
||||
TAY
|
||||
LDA /$A800
|
||||
LDX #2
|
||||
JSR MOVE
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* MOVE (X) PAGES FROM YY00 TO AA00
|
||||
*--------------------------------
|
||||
MOVE
|
||||
STA DPTR+1
|
||||
STY SPTR+1
|
||||
LDY #0
|
||||
STY DPTR
|
||||
STY SPTR
|
||||
.1 LDA (SPTR),Y
|
||||
STA (DPTR),Y
|
||||
INY
|
||||
BNE .1
|
||||
INC SPTR+1
|
||||
INC DPTR+1
|
||||
DEX
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
DRIVER.ADDRS
|
||||
.HS 60...00...62...64...61
|
||||
* //E 40 VID ULT STB
|
||||
*--------------------------------
|
||||
MENU
|
||||
.AS -/S-C MACRO ASSEMBLER 2.0 (PRODOS)/
|
||||
.HS 8D8D
|
||||
.AS -/1 -- STANDARD 40-COLUMN/
|
||||
.HS 8D
|
||||
.AS -/2 -- VIDEX VIDEOTERM/
|
||||
.HS 8D
|
||||
.AS -/3 -- VIDEX ULTRATERM/
|
||||
.HS 8D
|
||||
.AS -/4 -- STB-80/
|
||||
.HS 8D8D
|
||||
.AS -/WHICH? /
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
.AS /<<<COPYRIGHT (C) 1985, S-C SOFTWARE CORPORATION>>>/
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.ldr
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
370
SCMASM.30/SCMASM.S.MACRO.txt
Normal file
370
SCMASM.30/SCMASM.S.MACRO.txt
Normal file
@ -0,0 +1,370 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* .MA DIRECTIVE
|
||||
*--------------------------------
|
||||
PSMA LDA PASS WHICH PASS?
|
||||
BNE .2 PASS 2, SO SET FLAG AND IGNORE
|
||||
LDA #'Z+1 RIGHT BRACKET CODE
|
||||
STA SYMBOL+7
|
||||
LDA #0 CLEAR VALUE BYTES
|
||||
LDX #3
|
||||
.1 STA SYMBOL+2,X
|
||||
DEX
|
||||
BPL .1
|
||||
JSR GNNB GET FIRST CHAR OF MACRO NAME
|
||||
LDX #1
|
||||
JSR PACK.NAME
|
||||
CPX #2 NEED AT LEAST TWO CHARS, COUNTING BRACKET
|
||||
BCC .3 NO MACRO NAME
|
||||
STX SYMBOL+6 LENGTH
|
||||
JSR STSRCH
|
||||
BCC .4 DOUBLE DEFN
|
||||
JSR STADD ENTER INTO SYMBOL TABLE
|
||||
.2 SEC SET "INSIDE MACRO DEFINITION" FLAG
|
||||
ROR FLAG.MA
|
||||
RTS RETURN TO MAIN LEVEL OF ASM
|
||||
.3 LDY #QNONAM NO MACRO NAME
|
||||
.HS 2C SKIP NEXT TWO BYTES
|
||||
.4 LDY #QER4 EXTRA DEF'N
|
||||
JMP FIRM.ERROR
|
||||
*--------------------------------
|
||||
* PACK MACRO LINE
|
||||
*--------------------------------
|
||||
PACK.MACRO.LINE
|
||||
JSR SCAN.TO.OPCODE
|
||||
LDX FLAG.MA IN A MACRO DEF'N?
|
||||
BPL D.SET ...NO, TRY .SE DIRECTIVE
|
||||
LDX PASS WHICH PASS?
|
||||
BNE .10 PASS 2
|
||||
*---PASS 1-----------------------
|
||||
BCS .4 ...OPCODE IS NOT A DIRECTIVE
|
||||
LDX #DIR.QT.MA
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCC .2 NOT .MA
|
||||
.1 LDY #QER2 "BAD OPCODE"
|
||||
JMP SOFT.ERROR
|
||||
.2 JSR DIR.SCAN.OR.FAIL
|
||||
BCC .3 NOT .EM
|
||||
LDA #0 TERMINATE THE SKELETON
|
||||
STA CURRENT.MAJOR.LABEL+1 KILL POSSIBILITY OF LOCAL LABELS
|
||||
* UNTIL ANOTHER MAJOR LABEL
|
||||
JSR ADD.CHAR.TO.SKELETON
|
||||
.11 LSR FLAG.MA
|
||||
.12 SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
.3 JSR DIR.SCAN.OR.FAIL SEE IF .IN
|
||||
BCS .1 YES, SO ILLEGAL!
|
||||
* FALL INTO ACCEPTABLE LINE CODE
|
||||
*--------------------------------
|
||||
.4 LDY #0 BACK TO BEGINNING OF LINE
|
||||
BEQ .5 ...ALWAYS
|
||||
.55 LDX #$80 COMPRESSED BLANK TOKEN
|
||||
.6 INX COUNT THE BLANK
|
||||
CPX #$BF MAX BLANK COUNT?
|
||||
BCS .7 YES, OUTPUT TOKEN NOW
|
||||
JSR GNC2 GET NEXT CHARACTER
|
||||
BCS .7 END OF LINE
|
||||
BEQ .6 BLANK, SO COMPRESS IT
|
||||
DEY NON-BLANK, SO BACK UP PNTR
|
||||
.7 TXA COMPRESSED BLANK TOKEN
|
||||
.8 JSR ADD.CHAR.TO.SKELETON
|
||||
.5 JSR GNC2 GET NEXT CHARACTER
|
||||
BCS .9 END OF LINE
|
||||
BEQ .55 ...it is a blank
|
||||
CMP #']' MACRO PARAMETER?
|
||||
BNE .8 ...NO
|
||||
TAX save ']' in X
|
||||
JSR GNC2 GET PARAMETER CODE
|
||||
BCS .7 ...eol, add ']' and end
|
||||
CMP #']'
|
||||
BEQ .8 ...two makes one
|
||||
CMP #'#'
|
||||
BEQ .81 ...]# is valid parameter
|
||||
CMP #'9'+1 HOW ABOUT 1...9
|
||||
BCS .82 ...not a parameter
|
||||
CMP #'1'
|
||||
BCC .82 ...not a parameter
|
||||
.81 LDX #$7F valid parameter
|
||||
.82 DEY back up char pntr
|
||||
JMP .7 go add $7F or ']'
|
||||
*--------------------------------
|
||||
.9 LDA #0 TERMINATE THE LINE
|
||||
JSR ADD.CHAR.TO.SKELETON
|
||||
SEC
|
||||
RTS
|
||||
*---PASS 2-----------------------
|
||||
* IF NOT ".EM", JUST LIST THE LINE
|
||||
.10 BCS .12 ...OPCODE IS NOT A DIRECTIVE
|
||||
LDX #DIR.QT.EM
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCC .12 NOT .EM
|
||||
BCS .11 ...ALWAYS
|
||||
*--------------------------------
|
||||
* .SET DIRECTIVE
|
||||
*--------------------------------
|
||||
D.SET
|
||||
BCS .1 NOT A DIRECTIVE
|
||||
LDX #DIR.QT.SE
|
||||
JSR DIR.SCAN.OR.FAIL
|
||||
BCS .2 FOUND .SE
|
||||
.1 CLC
|
||||
RTS
|
||||
.2 JSR EXPR.DEFINED GET VALUE
|
||||
JSR GNC.UC.START CHECK FOR VALID LABEL
|
||||
BEQ .6 ...NO LABEL ERROR
|
||||
JSR CHECK.LETTER MUST BE NORMAL LABEL
|
||||
BCC .7 ...DOES NOT START WITH A-Z
|
||||
JSR PACK
|
||||
BCC .7 ...BAD SYMBOL
|
||||
JSR STSRCH
|
||||
BCC .3 ...IN TABLE ALREADY
|
||||
LDA SYMBOL+7
|
||||
ORA #$80
|
||||
STA SYMBOL+7 SET THE .SE FLAG
|
||||
JSR STADD
|
||||
JMP .4
|
||||
.3 LDY #7 CK .SE FLAG
|
||||
>SYM LDA,TPTR
|
||||
BPL .9 DOUBLE DEF IF NOT SET!
|
||||
LDA TPTR USE SAME PTR AS STADD
|
||||
STA PNTR
|
||||
LDA TPTR+1
|
||||
STA PNTR+1
|
||||
LDA PASS HANDLE FORWARD REFERENCES
|
||||
BEQ .5 ...IN PASS ONE
|
||||
DEY POINT AT FLAGS
|
||||
>SYM LDA,PNTR
|
||||
ORA #$40
|
||||
>SYM STA,PNTR
|
||||
.4 JSR P.EXP.VALUE.DASH (IF LISTING)
|
||||
.5 LDY #2 PUT VALUE IN SYMBOL TABLE
|
||||
.8 LDA EXP.VALUE-2,Y
|
||||
>SYM STA,PNTR
|
||||
INY
|
||||
CPY #6
|
||||
BCC .8
|
||||
RTS RETURN TO ASM WITH .CS.
|
||||
.6 JMP NOLBLERR
|
||||
.7 JMP ERR.BS
|
||||
.9 JMP ERR.DBLDF
|
||||
*--------------------------------
|
||||
* ADD CHARACTER TO SKELETON
|
||||
*--------------------------------
|
||||
ADD.CHAR.TO.SKELETON
|
||||
PHA SAVE CHAR
|
||||
.DO AUXMEM
|
||||
LDA EOT+1
|
||||
CMP /$C000
|
||||
BCC .1
|
||||
JMP MFER MEM FULL ERROR
|
||||
.1 STA WRAUX
|
||||
LDX #0
|
||||
PLA
|
||||
STA (EOT,X)
|
||||
STA WRMAIN
|
||||
.ELSE
|
||||
LDA EOT
|
||||
CMP PP
|
||||
LDA EOT+1
|
||||
SBC PP+1
|
||||
BCC .1 ROOM
|
||||
JMP MFER MEM FULL ERROR
|
||||
.1 LDX #0
|
||||
PLA
|
||||
STA (EOT,X)
|
||||
.FIN
|
||||
>INCD EOT
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SCAN TO OPCODE
|
||||
*--------------------------------
|
||||
SCAN.TO.OPCODE
|
||||
JSR GNC.START GET FIRST CHAR
|
||||
BEQ .2 ...BLANK OR END
|
||||
JSR CHECK.COMMENT.CHAR
|
||||
BEQ .3 ...YES, IT IS A COMMENT
|
||||
.1 JSR GNC SCAN TO A BLANK
|
||||
BNE .1 ...NOT BLANK YET
|
||||
.2 JSR GNNB SCAN TO NON-BLANK
|
||||
BCS .3 ...END OF LINE
|
||||
CMP #'.' DIRECTIVE?
|
||||
BNE .3 ...NO
|
||||
JSR GNC.UC GET NEXT BYTE
|
||||
CLC SIGNAL IT IS A DIRECTIVE
|
||||
RTS
|
||||
.3 SEC SIGNAL IT IS NOT A DIRECTIVE
|
||||
RTS
|
||||
*--------------------------------
|
||||
* PROCESS MACRO CALL
|
||||
*--------------------------------
|
||||
MACER1 LDY #QNONAM
|
||||
.HS 2C
|
||||
MACER2 LDY #QERR.MACRO
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
MACRO.CALL
|
||||
LDA #'Z+1 MACRO KEY IN SYMBOL TABLE
|
||||
STA SYMBOL+7
|
||||
LDX #1
|
||||
JSR GNC.UC GET FIRST CHAR OF MACRO NAME
|
||||
JSR PACK.NAME
|
||||
CPX #2
|
||||
BCC MACER1 ERROR, NO NAME
|
||||
STX SYMBOL+6 LENGTH OF NAME
|
||||
JSR STSRCH
|
||||
BCS MACER2 ERROR, NO SUCH MACRO
|
||||
JSR P.ORIGIN
|
||||
JSR LIST.SOURCE.IF.LISTING
|
||||
JSR GNNB SCAN TO PARAMETER LIST
|
||||
JSR BACKUP.CHAR.PNTR
|
||||
LDA MACSTK+1 SAVE PNTR FOR LATER
|
||||
PHA
|
||||
LDA MACSTK
|
||||
PHA
|
||||
LDX #0 PROCESS PARAMETER LIST
|
||||
LDA #9 FIND 9 PARAMETERS
|
||||
STA PARAM.CNT
|
||||
.1 JSR GET.ONE.PARAMETER
|
||||
DEC PARAM.CNT
|
||||
BNE .1
|
||||
.2 LDA WBUF-1,X
|
||||
JSR PUSH.MACSTK
|
||||
DEX
|
||||
BNE .2
|
||||
PLA PUT OLD MACSTK PNTR ON MACRO STACK
|
||||
JSR PUSH.MACSTK (LOW BYTE)
|
||||
PLA
|
||||
JSR PUSH.MACSTK (HIGH BYTE)
|
||||
LDA SRCP
|
||||
JSR PUSH.MACSTK
|
||||
LDA SRCP+1
|
||||
JSR PUSH.MACSTK
|
||||
LDA LF.ALL save current list option
|
||||
JSR PUSH.MACSTK
|
||||
LDA CALL.NUM STACK CURRENT CALL #
|
||||
JSR PUSH.MACSTK
|
||||
LDA CALL.NUM+1
|
||||
JSR PUSH.MACSTK
|
||||
CLC COMPUTE ADDRESS OF SKELETON
|
||||
LDA #7
|
||||
LDY #6 POINT AT LENGTH OF MACRO NAME
|
||||
>SYM ADC,STPNTR NAME LENGTH+7
|
||||
ADC STPNTR
|
||||
STA SRCP
|
||||
LDA STPNTR+1
|
||||
ADC #0
|
||||
STA SRCP+1
|
||||
LDA LF.MACRO
|
||||
ORA LF.ALL DON'T LIST EXPANSION IF NOT LISTING
|
||||
STA LF.ALL
|
||||
INC MACRO.LEVEL
|
||||
>INCD CALL.CNTR COUNT THIS MACRO CALL
|
||||
LDA CALL.CNTR
|
||||
STA CALL.NUM
|
||||
LDA CALL.CNTR+1
|
||||
STA CALL.NUM+1
|
||||
JMP ASM2
|
||||
*--------------------------------
|
||||
* PUSH A BYTE ON MACSTK
|
||||
*--------------------------------
|
||||
PUSH.MACSTK
|
||||
PHA SAVE BYTE TO BE PUSHED
|
||||
.DO AUXMEM
|
||||
LDA MACSTK+1
|
||||
CMP /$0800
|
||||
BCS .1
|
||||
.ELSE
|
||||
LDA EOT
|
||||
CMP MACSTK
|
||||
LDA EOT+1
|
||||
SBC MACSTK+1
|
||||
BCC .1 STILL ROOM
|
||||
.FIN
|
||||
JMP MFER NO ROOM
|
||||
.1 LDA MACSTK
|
||||
BNE .2
|
||||
DEC MACSTK+1
|
||||
.2 DEC MACSTK
|
||||
PLA BYTE TO BE PUSHED
|
||||
LDY #0
|
||||
STA (MACSTK),Y
|
||||
RTS
|
||||
*--------------------------------
|
||||
* GET ONE PARAMETER FROM MACRO CALL LINE
|
||||
*--------------------------------
|
||||
GET.ONE.PARAMETER
|
||||
JSR GNC
|
||||
BEQ .2 SPACE OR EOL, NO MORE PARAMETERS
|
||||
CMP #', COMMA
|
||||
BEQ .3 NULL PARAMETER
|
||||
CMP #'" QUOTE
|
||||
BEQ .4 QUOTED PARAMETER
|
||||
.1 STA WBUF,X NORMAL PARAMETER
|
||||
INX
|
||||
JSR GNC
|
||||
BEQ .2 END OF PARAMETER
|
||||
CMP #', COMMA
|
||||
BNE .1 MORE TO PARAMETER
|
||||
BEQ .3 END OF PARAMETER
|
||||
.2 JSR BACKUP.CHAR.PNTR
|
||||
.3 LDA #0
|
||||
STA WBUF,X
|
||||
INX
|
||||
RTS
|
||||
.4 JSR GNC QUOTED PARAMETER
|
||||
BCS .3 END OF LINE
|
||||
CMP #'"
|
||||
BEQ .5 END OF QUOTED PARAMETER
|
||||
.6 STA WBUF,X
|
||||
INX
|
||||
BNE .4 ...ALWAYS
|
||||
.5 JSR GNC
|
||||
BEQ .2 END OF PARAMETER LIST
|
||||
CMP #', COMMA
|
||||
BEQ .3
|
||||
BNE .6 ...ALWAYS
|
||||
*--------------------------------
|
||||
* DIRECTIVE SCAN OR FAIL
|
||||
* COMPARE NEXT TWO CHARS WITH TABLE ENTRY
|
||||
* ENTER: FIRST CHAR SET UP BY GNC.UC
|
||||
* (X)=OFFSET OF TWO-BYTE ENTRY IN DIR.QTS
|
||||
*--------------------------------
|
||||
DIR.SCAN.OR.FAIL
|
||||
CMP DIR.QTS,X
|
||||
BNE .1 FAIL
|
||||
LDY CHAR.PNTR
|
||||
LDA WBUF,Y NEXT CHAR
|
||||
AND #$DF MAP LOWER CASE TO UPPER CASE
|
||||
CMP DIR.QTS+1,X
|
||||
BNE .1 FAIL
|
||||
JSR GNC.UC SCAN OVER SECOND CHAR
|
||||
SEC SIGNAL SUCCESS
|
||||
RTS
|
||||
.1 CLC SIGNAL FAILURE
|
||||
LDA CURRENT.CHAR RESTORE (A)
|
||||
INX ADVANCE TO NEXT QUOTE
|
||||
INX
|
||||
RTS
|
||||
*--------------------------------
|
||||
DIR.QTS
|
||||
DIR.QT.DO .EQ *-DIR.QTS
|
||||
.AS /DO/
|
||||
DIR.QT.EL .EQ *-DIR.QTS
|
||||
.AS /EL/
|
||||
DIR.QT.FI .EQ *-DIR.QTS
|
||||
.AS /FI/
|
||||
DIR.QT.MA .EQ *-DIR.QTS
|
||||
.AS /MA/
|
||||
DIR.QT.EM .EQ *-DIR.QTS
|
||||
.AS /EM/
|
||||
DIR.QT.IN .EQ *-DIR.QTS
|
||||
.AS /IN/
|
||||
DIR.QT.SE .EQ *-DIR.QTS
|
||||
.AS /SE/
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.macro
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
266
SCMASM.30/SCMASM.S.MCMDS.txt
Normal file
266
SCMASM.30/SCMASM.S.MCMDS.txt
Normal file
@ -0,0 +1,266 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
HELP
|
||||
LDA #CMD.TBL
|
||||
LDX /CMD.TBL
|
||||
LDY #2
|
||||
JSR HELP.1
|
||||
JSR CRLF
|
||||
LDA SCI.TBLADR
|
||||
LDX SCI.TBLADR+1
|
||||
LDY #4
|
||||
*--------------------------------
|
||||
HELP.1
|
||||
STA .92+1
|
||||
STX .92+2
|
||||
STY .91+1
|
||||
LDY #-1 POINT TO BEGINNING
|
||||
LDX #10
|
||||
LDA #$0D
|
||||
.1 JSR CHO
|
||||
BPL .2
|
||||
JSR MON.PRBL2
|
||||
TYA
|
||||
CLC
|
||||
.91 ADC #0
|
||||
TAY
|
||||
LDX #10
|
||||
.2 INY
|
||||
DEX
|
||||
.92 LDA $5555,Y
|
||||
BNE .1
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
HILO JSR EXPR.DEFINED
|
||||
LDA EXP.VALUE+3 MUST BE 0000XX00
|
||||
ORA EXP.VALUE+2
|
||||
ORA EXP.VALUE
|
||||
BNE HL.RAER
|
||||
LDX EXP.VALUE+1
|
||||
RTS
|
||||
*--------------------------------
|
||||
HIMEM JSR HILO
|
||||
DEX
|
||||
CPX SYMBOL.BASE
|
||||
BCC HL.RAER ...BELOW OR SAME AS LOMEM
|
||||
CPX SCI.BUFFER.PAGES+2 Start of Exec Buffer
|
||||
BCS HL.RAER ABOVE EXEC BUFFER
|
||||
INX
|
||||
STX SCI.HIMEM.PAGE
|
||||
JMP NEW
|
||||
*--------------------------------
|
||||
HL.RAER JMP RAER
|
||||
*--------------------------------
|
||||
LOMEM JSR HILO
|
||||
CPX #8
|
||||
BCC HL.RAER ...BELOW $800
|
||||
CPX SCI.HIMEM.PAGE
|
||||
BCS HL.RAER ...ABOVE OR SAME AS HIMEM
|
||||
STX SYMBOL.BASE
|
||||
JMP NEW
|
||||
*--------------------------------
|
||||
* SET INCREMENT VALUE FOR AUTO-LINE-NUMBERING
|
||||
*--------------------------------
|
||||
INCREMENT
|
||||
JSR SCAN.1.DECIMAL.NUMBER
|
||||
DEX be sure there was a value
|
||||
BMI SYNX1 ...no, not one
|
||||
.1 LDA A0L,X GET VALUE
|
||||
STA INCREMENT.VALUE,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
SYNX1 JMP SYNX
|
||||
*--------------------------------
|
||||
* AUTO & MANUAL COMMANDS
|
||||
*--------------------------------
|
||||
AUTO JSR SCAN.1.DECIMAL.NUMBER GET BASE, IF ANY
|
||||
JSR SCAN.1.DECIMAL.NUMBER Get increment, if any
|
||||
DEX Were there any parameters?
|
||||
BMI .4 ...no, use current values
|
||||
DEX ...yes, see if two parameters
|
||||
DEX
|
||||
BMI .2 ...no, only a starting line number
|
||||
.1 LDA A1L,X ...yes, copy new increment
|
||||
STA INCREMENT.VALUE,X
|
||||
DEX
|
||||
BPL .1
|
||||
*---X=-1, form "previous" line number---
|
||||
.2 SEC As written, this loop only works
|
||||
.3 LDA A0L+1,X if all values are in page zero
|
||||
SBC INCREMENT.VALUE+1,X because it uses negative
|
||||
STA CURLNO+1,X indexing.
|
||||
INX
|
||||
BEQ .3
|
||||
*---Set the AUTO flag------------
|
||||
.4 SEC SET FLAG
|
||||
.HS 90 "BCC", ALWAYS SKIP NEXT BYTE
|
||||
MANUAL CLC CLEAR FLAG
|
||||
ROR AUTOLN.FLAG
|
||||
RTS
|
||||
*--------------------------------
|
||||
*
|
||||
* EDIT COMMAND
|
||||
*
|
||||
*--------------------------------
|
||||
EDIT
|
||||
JSR GET.KEY.STRING
|
||||
JSR PARSE.LINE.RANGE
|
||||
.1 JSR GET.LINE.TO.WBUF
|
||||
BCC .2
|
||||
RTS Finished with range
|
||||
.2 JSR FIND.KEY.IN.WBUF
|
||||
BCC .1 Not there
|
||||
JSR EDIT.ONE.LINE
|
||||
JMP .1
|
||||
*--------------------------------
|
||||
DATE JSR SCAN.3.DECIMAL.NUMBERS Day, Month, Year
|
||||
CPX #6
|
||||
BCC SYNX1 NEED ALL THREE VALUES
|
||||
LDA A1L MONTH
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL M-MMM00000
|
||||
ORA A0L M-MMMDDDDD
|
||||
STA $BF90
|
||||
LDA A2L YEAR
|
||||
ROL YYYYYYYM
|
||||
STA $BF91
|
||||
RTS
|
||||
*--------------------------------
|
||||
TIME JSR SCAN.3.DECIMAL.NUMBERS Hour, Minute
|
||||
CPX #4
|
||||
BCC SYNX1 NEED BOTH VALUES
|
||||
LDA A0L HOUR
|
||||
STA $BF93
|
||||
LDA A1L MINUTE
|
||||
STA $BF92
|
||||
RTS
|
||||
*---------------------------------
|
||||
* RENUMBER COMMAND
|
||||
*
|
||||
* UP TO THREE PARAMETERS
|
||||
* 1: BASE NUMBER (DEFAULT = 1000)
|
||||
* 2: INCREMENT (DEFAULT = 10)
|
||||
* 3: STARTING LINE (DEFAULT = 0)
|
||||
*---------------------------------
|
||||
RENUMBER
|
||||
JSR SCAN.3.DECIMAL.NUMBERS Base, Increment, Starting Line
|
||||
.1 CPX #3 COPY DEFAULTS IF ANY NEEDED
|
||||
BCS .2 NO MORE DEFAULTS NEEDED
|
||||
LDA RENDTA,X
|
||||
STA A0L,X
|
||||
INX
|
||||
BNE .1 ...ALWAYS
|
||||
.2 LDX #A2L FIND STARTING LINE
|
||||
JSR SERTXT
|
||||
.3 LDA LINE.START TEST IF THRU YET
|
||||
CMP HI.MEM
|
||||
LDA LINE.START+1
|
||||
SBC HI.MEM+1
|
||||
BCS .4 FINISHED
|
||||
LDY #0
|
||||
LDA (LINE.START),Y GET LINE LENGTH
|
||||
PHA SAVE FOR LATER
|
||||
INY
|
||||
LDA A0L STORE NEW LINE NUMBER IN LINE
|
||||
STA (LINE.START),Y
|
||||
ADC A1L ADD INCREMENT AS WE GO
|
||||
STA A0L
|
||||
INY
|
||||
LDA A0H REST OF LINE NUMBER
|
||||
STA (LINE.START),Y
|
||||
ADC A1H ADD REST OF INCREMENT
|
||||
BCS .5 YES, TOO BIG
|
||||
STA A0H OK, AND CARRY CLEAR
|
||||
PLA GET LINE SIZE
|
||||
ADC LINE.START BUMP POINTER TO NEXT LINE
|
||||
STA LINE.START
|
||||
BCC .3
|
||||
INC LINE.START+1
|
||||
BNE .3 ...ALWAYS
|
||||
.4 RTS FINISHED!
|
||||
.5 LDY #QER3 RANGE ERROR
|
||||
JMP HARD.ERROR
|
||||
RENDTA .DA 1000 DEFAULT BASE
|
||||
.DA #10 DEFAULT INCREMENT
|
||||
*** .DA 0 DEFAULT STARTING LINE
|
||||
*--------------------------------
|
||||
* HIDE COMMAND
|
||||
*--------------------------------
|
||||
HIDE JSR MERGE MERGE IF ANY PREVIOUS HIDE
|
||||
LDA #'H
|
||||
STA PROMPT.FLAG NO, HIDE IT ALONE
|
||||
INX NOW X=1
|
||||
.1 LDA HI.MEM,X SAVE HI.MEM
|
||||
STA HIDE.HIMEM,X
|
||||
LDA PP,X
|
||||
STA HI.MEM,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
* MERGE COMMAND
|
||||
*--------------------------------
|
||||
MERGE LDA PROMPT.FLAG
|
||||
EOR #'H
|
||||
BNE .1
|
||||
STA PROMPT.FLAG CLEAR PROMPT CHAR
|
||||
LDA HIDE.HIMEM RESTORE HI.MEM
|
||||
STA HI.MEM
|
||||
LDA HIDE.HIMEM+1
|
||||
STA HI.MEM+1
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* NEW COMMAND
|
||||
*--------------------------------
|
||||
NEW JSR RESTORE RESTORE IF IN AN INCLUDE
|
||||
JSR MERGE
|
||||
JSR EMPTY.SOURCE.AREA
|
||||
JMP HARD
|
||||
*--------------------------------
|
||||
* MEMORY COMMAND
|
||||
* PRINT OUT BOUNDS ON SOURCE PROGRAM
|
||||
* AND ON SYMBOL TABLE
|
||||
*--------------------------------
|
||||
MEMORY LDY #QSRCPRG "SOURCE PROGRAM: $"
|
||||
LDX #PP
|
||||
LDA #HI.MEM
|
||||
JSR MEM.LINE
|
||||
LDY #QSYMTBL " SYMBOL TABLE: $"
|
||||
LDX #LO.MEM
|
||||
LDA #EOT
|
||||
MEM.LINE
|
||||
PHA SAVE SECOND VALUE PNTR
|
||||
TXA
|
||||
PHA SAVE FIRST VALUE PNTR
|
||||
JSR QT.OUT
|
||||
PLA GET FIRST VALUE PNTR
|
||||
JSR MEM.HEXVAL
|
||||
JSR P.DASH
|
||||
PLA GET SECOND VALUE PNTR
|
||||
MEM.HEXVAL
|
||||
TAX
|
||||
LDA 1,X
|
||||
JSR MON.PHEX
|
||||
LDA 0,X
|
||||
JMP MON.PHEX
|
||||
*--------------------------------
|
||||
RST JSR EXPR
|
||||
LDY EXP.VALUE
|
||||
LDA EXP.VALUE+1
|
||||
*--------------------------------
|
||||
SET.RESET.VECTOR
|
||||
STY MON.RESET
|
||||
STA MON.RESET+1
|
||||
EOR #$A5
|
||||
STA MON.RESET+2
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.mcmds
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
129
SCMASM.30/SCMASM.S.NEWQ.txt
Normal file
129
SCMASM.30/SCMASM.S.NEWQ.txt
Normal file
@ -0,0 +1,129 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* Y = MESSAGE NUMBER
|
||||
*--------------------------------
|
||||
QT.OUT
|
||||
TXA
|
||||
PHA
|
||||
LDX #0
|
||||
CLC
|
||||
*---Search for message #---------
|
||||
.2 JSR GET.NEXT.NYBBLE
|
||||
BNE .4
|
||||
.3 JSR GET.NEXT.NYBBLE
|
||||
BEQ .3
|
||||
BNE .2
|
||||
.4 EOR #$0F
|
||||
BNE .2
|
||||
DEY
|
||||
BNE .2
|
||||
*---Print the message------------
|
||||
.5 JSR GET.NEXT.NYBBLE
|
||||
TAY
|
||||
LDA FIRST.TABLE,Y
|
||||
BNE .6 ...FREQUENT CHAR
|
||||
JSR GET.NEXT.NYBBLE
|
||||
TAY
|
||||
LDA SECOND.TABLE,Y
|
||||
BNE .6 ...TWO NYBBLE CHAR
|
||||
JSR GET.NEXT.NYBBLE
|
||||
TAY
|
||||
LDA THIRD.TABLE,Y
|
||||
.6 BPL .7 ...END OF MESSAGE
|
||||
PHP
|
||||
JSR MY.COUT
|
||||
PLP
|
||||
BMI .5 ...NEXT CHAR, ALWAYS
|
||||
.7 PLA ...YES
|
||||
TAX
|
||||
RTS
|
||||
*--------------------------------
|
||||
GET.NEXT.NYBBLE
|
||||
LDA MESSAGES,X
|
||||
BCS .1 2ND NYBBLE
|
||||
LSR 1ST NYBBLE
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
SEC
|
||||
RTS
|
||||
.1 INX
|
||||
AND #$0F
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
FIRST.TABLE .HS 00
|
||||
.AS -/ABCDEILMNORST /
|
||||
.HS 7F
|
||||
SECOND.TABLE .HS 00
|
||||
.AS -/FGPUXY$.*:?52/
|
||||
.HS 878D
|
||||
THIRD.TABLE .AS -/.HJKQVWZ>1-...../
|
||||
*--------------------------------
|
||||
MESSAGES
|
||||
.AC 0
|
||||
.AC 1/ABCDEILMNORST %/
|
||||
.AC 2/FGPUXY$.*:?52!#/
|
||||
.AC 3/HJKQVWZ>1-...../
|
||||
*--------------------------------
|
||||
.MA QT
|
||||
QN. .SE QN.+1
|
||||
]1 .EQ QN.
|
||||
.AC /]2/
|
||||
.EM
|
||||
QN. .SE 0
|
||||
*--------------------------------
|
||||
.AC "%" ELIMINATE QT# 0
|
||||
>QT QSC,"S-C MACRO ASSEMBLER %"
|
||||
>QT QST,"SYMBOL TABLE%"
|
||||
>QT QSTARS,"#***!! %"
|
||||
>QT QSRCPRG,"#SOURCE PROGRAM: $%"
|
||||
>QT QSYMTBL,"# SYMBOL TABLE: $%"
|
||||
>QT QERROR," ERROR#%"
|
||||
>QT PAGEQT," PAGE %"
|
||||
>QT QREPPRMT,"#REPLACE? %"
|
||||
>QT QERRCNT," ERRORS IN ASSEMBLY#%"
|
||||
>QT QBLOADB," LOAD %"
|
||||
>QT QDELOR,"DELETE ORIGINAL? %"
|
||||
>QT QMEMPRO,"MEM PROTECT%"
|
||||
>QT QMEMFL,"MEM FULL%"
|
||||
>QT QSYNX,"SYNTAX%"
|
||||
>QT QER1,"NO LABEL%"
|
||||
>QT QER2,"BAD OPCODE%"
|
||||
>QT QER3,"RANGE%"
|
||||
>QT QER4,"EXTRA DEFINITION%"
|
||||
>QT QER5,"BAD ADDRESS%"
|
||||
>QT QER6,"UNDEF LABEL%"
|
||||
>QT QER7,"BAD SYMBOL%"
|
||||
>QT QER8,"VALUE > 255%"
|
||||
>QT QER9,"NO NORMAL LABEL%"
|
||||
>QT QNIN,"NESTED .IN%"
|
||||
>QT QERDO,"MISSING .DO%"
|
||||
>QT QERDO2,".DO NEST TOO DEEP%"
|
||||
>QT QSTRLNG,"KEY TOO LONG%"
|
||||
>QT QNONAM,"NO MACRO NAME%"
|
||||
>QT QREPLNG,"REPLACE TOO LONG%"
|
||||
>QT QERR.MACRO,"UNDEF MACRO%"
|
||||
.AC "%" FLUSH LAST BYTE
|
||||
*--------------------------------
|
||||
.DO 0
|
||||
T
|
||||
LDA #1
|
||||
STA 0
|
||||
.1 LDA 0
|
||||
JSR $FDDA
|
||||
LDY 0
|
||||
JSR PRINT.QUOTATION
|
||||
JSR $FD8E
|
||||
INC 0
|
||||
LDA 0
|
||||
CMP #$20
|
||||
BCC .1
|
||||
RTS
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.newq
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
250
SCMASM.30/SCMASM.S.OUTPUT.txt
Normal file
250
SCMASM.30/SCMASM.S.OUTPUT.txt
Normal file
@ -0,0 +1,250 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* ERROR PRINTER
|
||||
*---------------------------------
|
||||
FIRM.ERROR
|
||||
SEC SIGNAL FIRM ERROR
|
||||
.HS 24 SKIP NEXT BYTE
|
||||
SOFT.ERROR
|
||||
CLC SIGNAL SOFT ERROR
|
||||
LDA PASS SEE IF IN ASSEMBLY
|
||||
BMI HARD.ERROR ...NO
|
||||
PHP SAVE CLC/SEC STATUS
|
||||
LDA RDROM
|
||||
JSR PRINT.ERROR.MESSAGE
|
||||
>INCD ERROR.COUNT
|
||||
JSR SPC
|
||||
JSR LIST.SOURCE.AT.MARGIN
|
||||
JSR CRLF
|
||||
PLP GET SOFT/FIRM STATUS
|
||||
BCS JMP.SOFT ...FIRM, ABORT ASSEMBLY
|
||||
JMP ASM2 ...SOFT, CONTINUE ASSEMBLY
|
||||
HARD.ERROR
|
||||
JSR PRINT.ERROR.MESSAGE
|
||||
JMP.SOFT
|
||||
JSR RESTORE.IF.IN.INBX
|
||||
JMP SOFT
|
||||
*--------------------------------
|
||||
RESTORE.IF.IN.INBX
|
||||
BIT INFLAG
|
||||
BVC .1
|
||||
JSR RESTORE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
P.EXP.VALUE.DASH
|
||||
JSR CHECK.IF.LISTING
|
||||
JSR P.EXP.VALUE
|
||||
P.DASH LDA #'-'
|
||||
.HS 2C
|
||||
P.RETURN
|
||||
LDA #$0D
|
||||
.HS 2C
|
||||
SPC LDA #' ' ONE SPACE
|
||||
CHO PHA
|
||||
ORA #$80 CHAR OUT
|
||||
JSR MY.COUT SEND THE CHARACTER
|
||||
PLA
|
||||
RTS
|
||||
*---------------------------------
|
||||
* PRINT A <RETURN>
|
||||
* IF IN "SLOW" MODE, DELAY FIRST
|
||||
* CHECK KEYBOARD FOR PAUSE OR ABORT
|
||||
*--------------------------------
|
||||
CRLF BIT FLAG.SPEED CHECK SLOW/FAST SPEED
|
||||
BPL .1 FAST
|
||||
LDA #0 SLOW
|
||||
JSR MON.DELAY
|
||||
.1 JSR CHECK.KEYBOARD.FOR.ABORT
|
||||
BCC P.RETURN ...NO KEYPRESS
|
||||
BEQ JMP.SOFT ...ABORT
|
||||
.2 JSR CHECK.KEYBOARD.FOR.ABORT
|
||||
BCC .2 WAIT FOR KEYPRESS
|
||||
BNE P.RETURN ...CONTINUE
|
||||
BEQ JMP.SOFT ...ABORT
|
||||
*--------------------------------
|
||||
* RETURN .CC. AND .NE. IF NO KEYPRESS
|
||||
* RETURN .CS. AND .EQ. IF <RETURN> TYPED
|
||||
* RETURN .CS. AND .NE. IF ANY OTHER KEY
|
||||
*--------------------------------
|
||||
CHECK.KEYBOARD.FOR.ABORT
|
||||
CLC
|
||||
LDA $C000
|
||||
BPL .1
|
||||
STA $C010
|
||||
CMP #$8D
|
||||
SEC
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* PRINT ERROR MESSAGE
|
||||
*--------------------------------
|
||||
PRINT.ERROR.MESSAGE
|
||||
TYA SAVE ERROR #
|
||||
TAX IN X-REG
|
||||
LDY #QSTARS "*** "
|
||||
JSR QT.OUT
|
||||
TXA
|
||||
TAY
|
||||
JSR QT.OUT
|
||||
LDY #QERROR
|
||||
JMP QT.OUT
|
||||
*--------------------------------
|
||||
* PRINT LOCATION COUNTER AND DASH
|
||||
*--------------------------------
|
||||
P.ORIGIN
|
||||
JSR CHECK.IF.LISTING
|
||||
P.ORIGIN.REGARDLESS
|
||||
LDX #7 assume col. 7 after 6-digit origin
|
||||
LDY #2
|
||||
LDA ORGN+2 If > $FFFF, print 3 bytes
|
||||
BNE .1 ...orgn > $FFFF, print 3 bytes
|
||||
DEY ...orgn <$10000, print 2 bytes
|
||||
LDX #5 will end up in col. 5
|
||||
.1 STX EMIT.COLUMN
|
||||
.2 LDA ORGN,Y HIGH BYTE FIRST
|
||||
JSR MON.PHEX
|
||||
DEY
|
||||
BPL .2
|
||||
JMP P.DASH PRINT "-"
|
||||
*--------------------------------
|
||||
P.EMITTED.BYTE
|
||||
JSR CHECK.IF.LISTING
|
||||
LDY EMIT.COLUMN
|
||||
BEQ .2 ...AT BEGINNING OF LINE
|
||||
LDY EMIT.MARGIN
|
||||
LDA ORGN+2
|
||||
BNE .1
|
||||
DEY
|
||||
DEY
|
||||
.1 CPY EMIT.COLUMN
|
||||
BCS .3 ...STILL ROOM ON THIS LINE
|
||||
BIT LF.XTRA.BYTES
|
||||
BMI .4
|
||||
JSR CRLF.WITH.PAGING
|
||||
.2 JSR P.ORIGIN
|
||||
.3 LDY EMIT.COLUMN
|
||||
INY MAKE ROOM FOR NEXT BYTE
|
||||
INY
|
||||
INY
|
||||
STY EMIT.COLUMN
|
||||
JSR SPC
|
||||
LDA OBJ.BYTE
|
||||
JMP MON.PHEX
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
P.MARGIN
|
||||
SEC
|
||||
LDA EMIT.MARGIN
|
||||
SBC EMIT.COLUMN
|
||||
TAX
|
||||
LDA ORGN+2
|
||||
BEQ .1
|
||||
INX
|
||||
INX
|
||||
.1 JMP MON.PRBL2
|
||||
*--------------------------------
|
||||
P.EXP.VALUE
|
||||
LDY #3 EXP.VALUE IS 4 BYTES
|
||||
.1 LDA EXP.VALUE,Y TRIM LEADING ZERO BYTES
|
||||
BNE .2 ...FIRST NON-ZERO BYTE
|
||||
DEY
|
||||
BNE .1 ...STILL NOT LAST BYTE
|
||||
.2 TYA
|
||||
ASL
|
||||
ADC #3
|
||||
STA EMIT.COLUMN
|
||||
.3 LDA EXP.VALUE,Y PRINT REST OF EXP.VALUE
|
||||
JSR MON.PHEX
|
||||
DEY
|
||||
BPL .3
|
||||
RTS
|
||||
*--------------------------------
|
||||
CHECK.IF.LISTING
|
||||
LDA PASS
|
||||
BEQ .1 ...NO LISTING IN PASS 1
|
||||
LDA LF.ALL
|
||||
BPL .2 ...YES, LIST
|
||||
.1 PLA POP RETURN
|
||||
PLA
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
LIST.LINE.BOTH.PASSES
|
||||
LDA PASS
|
||||
BEQ .1 DEFINITE IN PASS 1
|
||||
LDA LF.ALL
|
||||
BPL .2 ...ALREADY DID CRLF
|
||||
.1 JSR CRLF.WITH.PAGING
|
||||
.2 JSR P.ORIGIN.REGARDLESS
|
||||
JMP LIST.SOURCE.REGARDLESS
|
||||
*---------------------------------
|
||||
* CONVERT LINE NUMBER
|
||||
* (CURRENT.LINE.NUMBER) = NUMBER TO USE
|
||||
*---------------------------------
|
||||
CONVERT.LINE.NUMBER.BOTH
|
||||
LDA #$C0 PRINT FLAG ON, STORE FLAG ON
|
||||
.HS 2C SKIP NEXT 2 BYTES
|
||||
CONVERT.LINE.NUMBER.STORE
|
||||
LDA #$80 PRINT FLAG OFF, STORE FLAG ON
|
||||
.HS 2C SKIP NEXT 2 BYTES
|
||||
CONVERT.LINE.NUMBER.PRINT
|
||||
LDA #$40 PRINT FLAG ON, STORE FLAG OFF
|
||||
PHA
|
||||
LDX #3 CONVERT 4 DIGITS
|
||||
LDA CURRENT.LINE.NUMBER
|
||||
CMP #10000
|
||||
LDA CURRENT.LINE.NUMBER+1
|
||||
SBC /10000
|
||||
BCC .1 4 DIGITS WILL DO IT
|
||||
INX 5 DIGITS
|
||||
.1 PLA
|
||||
*--------------------------------
|
||||
* CONVERT (CURRENT.LINE.NUMBER)
|
||||
* (X) = ONE LESS THAN NUMBER OF DIGITS
|
||||
* (A) = FLAGS: BIT 7 = 1 MEANS TO STORE AT WBUF,Y
|
||||
* BIT 6 = 1 MEANS TO PRINT
|
||||
*--------------------------------
|
||||
CONVERT.LINE.NUMBER
|
||||
STA CONV.CTRL
|
||||
.5 LDA #$B0 SET DIGIT TO ASCII ZERO
|
||||
.1 PHA PUSH DIGIT ON STACK
|
||||
SEC SUBTRACT CURRENT DIVISOR
|
||||
LDA CURRENT.LINE.NUMBER
|
||||
SBC PLNTBL,X
|
||||
PHA SAVE BYTE ON STACK
|
||||
LDA CURRENT.LINE.NUMBER+1
|
||||
SBC PLNTBH,X
|
||||
BCC .2 LESS THAN DIVISOR
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
PLA GET LOW BYTE OFF STACK
|
||||
STA CURRENT.LINE.NUMBER
|
||||
PLA GET DIGIT FROM STACK
|
||||
ADC #0 INCREMENT DIGIT
|
||||
BNE .1 ...ALWAYS
|
||||
.2 PLA DISCARD BYTE FROM STACK
|
||||
PLA GET DIGIT FROM STACK
|
||||
BIT CONV.CTRL
|
||||
BVC .3 NO PRINT
|
||||
JSR MON.COUT PRINT CHARACTER
|
||||
.3 BIT CONV.CTRL TEST BUFFER STORAGE FLAG
|
||||
BPL .4 OFF, DO NOT STORE IN BUFFER
|
||||
STA WBUF,Y
|
||||
INY
|
||||
.4 DEX NEXT DIGIT
|
||||
BPL .5
|
||||
RTS RETURN
|
||||
*---------------------------------
|
||||
PLNTBL .DA #1
|
||||
.DA #10
|
||||
.DA #100
|
||||
.DA #1000
|
||||
.DA #10000
|
||||
PLNTBH .DA /1
|
||||
.DA /10
|
||||
.DA /100
|
||||
.DA /1000
|
||||
.DA /10000
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.output
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
76
SCMASM.30/SCMASM.S.PARAM.txt
Normal file
76
SCMASM.30/SCMASM.S.PARAM.txt
Normal file
@ -0,0 +1,76 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
*--------------------------------
|
||||
* ENTRY POINTS AND USER EXITS
|
||||
*--------------------------------
|
||||
* HARD ENTRY
|
||||
HARD JSR HARD.INIT
|
||||
*--------------------------------
|
||||
* SOFT ENTRY
|
||||
JMP SOFT
|
||||
*--------------------------------
|
||||
* USER DEFINED COMMAND
|
||||
USR JMP SOFT
|
||||
*--------------------------------
|
||||
* USER PRINT ROUTINE
|
||||
PRT JMP SOFT
|
||||
*--------------------------------
|
||||
* USER ESC-U FUNCTION
|
||||
USER.ESC.U
|
||||
JMP RDL.ERR
|
||||
*--------------------------------
|
||||
* USER "." COMMAND
|
||||
USER.CMD JMP SOFT
|
||||
*--------------------------------
|
||||
* USER OBJECT CODE STORAGE
|
||||
USER.OBJECT.BYTE
|
||||
JMP STORE.OBJECT.BYTE
|
||||
*--------------------------------
|
||||
* USER ASSEMBLER DIRECTIVE
|
||||
PSUSER JMP CMNT
|
||||
*--------------------------------
|
||||
* TAB CONTROL CHARACTER AND TAB STOPS
|
||||
TAB.CHAR .DA #CHR.CTRL.I
|
||||
TAB.SETTINGS .DA #14,#18,#27,#32,#0
|
||||
*--------------------------------
|
||||
* USER COMMENT CHARACTER
|
||||
* (IN ESC-L FROM COLUMN 6)
|
||||
*--------------------------------
|
||||
USER.COM.DELIM .DA #CHR.DASH
|
||||
*--------------------------------
|
||||
* COMPRESSION LOWER LIMIT
|
||||
* =4 IF DESIRE COMPRESSION
|
||||
* =255 IF DO NOT DESIRE COMPRESSION
|
||||
*--------------------------------
|
||||
COMPRESSION.LIMIT .HS 04
|
||||
*--------------------------------
|
||||
* WILD CARD CHARACTER FOR SEARCH STRING
|
||||
*--------------------------------
|
||||
WILD.CARD .HS 17 CONTROL-W
|
||||
*--------------------------------
|
||||
* OUTPUT A SINGLE CHARACTER TO SCREEN
|
||||
*--------------------------------
|
||||
MY.COUT JMP MON.COUT
|
||||
*--------------------------------
|
||||
USER.MEM.LO .DA $0000
|
||||
USER.MEM.HI .DA $0000
|
||||
*--------------------------------
|
||||
* LINKAGE TO FULL SCREEN EDITOR
|
||||
*--------------------------------
|
||||
LINK.FSE
|
||||
JMP GNL <<<REPLACE WITH ADDRESS OF F.S.E.>>>
|
||||
*--------------------------------
|
||||
JMP GNC.UC
|
||||
JMP GNNB
|
||||
JMP CMNT
|
||||
JMP ERBA
|
||||
JMP EMIT
|
||||
*--------------------------------
|
||||
BOTTOM.OF.SCREEN
|
||||
.DA #23 CHANGE TO 31 OR 47 FOR LONGER SCREENS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.param
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
102
SCMASM.30/SCMASM.S.PLINE.txt
Normal file
102
SCMASM.30/SCMASM.S.PLINE.txt
Normal file
@ -0,0 +1,102 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* PARSE LINE RANGE
|
||||
* START END CARRY
|
||||
* <EOL> (PP) (HI.MEM) SET
|
||||
* #<EOL> # # CLEAR
|
||||
* #1,#2<EOL> #1 #2 CLEAR
|
||||
* #, # (HI.MEM) CLEAR
|
||||
* ,# (PP) # CLEAR
|
||||
*---------------------------------
|
||||
PARSE.LINE.RANGE
|
||||
JSR SETUP.TEXT.POINTERS
|
||||
JSR GNNB.AUC GET NEXT NON-BLANK CHAR
|
||||
BCS .4 EOL, RETURN WITH CARRY SET
|
||||
BEQ .1 COMMA, SO START AT PP
|
||||
JSR SCAN.LINE.NUMBER
|
||||
BCS .5
|
||||
LDA LINE.START
|
||||
STA SRCP
|
||||
LDA LINE.START+1
|
||||
STA SRCP+1
|
||||
JSR GNNB.AUC GET NEXT NON-BLANK AFTER LINE NUMBER
|
||||
BCS .2 EOL, SO ONLY THIS ONE LINE
|
||||
BNE .5 NOT COMMA, SO ERROR
|
||||
.1 JSR GNNB.AUC GET NEXT NON-BLANK AFTER COMMA
|
||||
BCS .3 EOL, SO GO THRU HI.MEM
|
||||
BEQ .3 COMMA, SAME AS EOL
|
||||
JSR SCAN.LINE.NUMBER
|
||||
BCS .5
|
||||
.2 LDA LINE.END
|
||||
STA ENDP
|
||||
LDA LINE.END+1
|
||||
STA ENDP+1
|
||||
.3 CLC FLAG WE GOT AT LEAST ONE NUMBER
|
||||
.4 RTS
|
||||
.5 JMP SYNX
|
||||
*---------------------------------
|
||||
* SCAN INPUT LINE FOR DIGIT OR PERIOD
|
||||
* IF FIND DIGIT, CONVERT LINE NUMBER
|
||||
* AND SEARCH FOR IT
|
||||
* IF FIND PERIOD, SEARCH FOR <CURLNO>
|
||||
* IF NEITHER, RETURN WITH CARRY SET
|
||||
*---------------------------------
|
||||
SCAN.LINE.NUMBER
|
||||
CMP #'. DOT: USE (CURLNO)
|
||||
BEQ .1
|
||||
EOR #$30
|
||||
CMP #10
|
||||
BCS .2 NOT DOT NOR DIGIT, EXIT CARRY SET
|
||||
JSR DECN CONVERT THE NUMBER
|
||||
JSR BACKUP.CHAR.PNTR
|
||||
LDX #SYM.VALUE
|
||||
.HS 2C SKIP OVER NEXT 2 BYTES
|
||||
.1 LDX #CURLNO
|
||||
JSR SERTXT FIND LINE
|
||||
CLC SIGNAL GOOD NUMBER
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* LOAD PP --> SRCP, HI.MEM --> ENDP
|
||||
*--------------------------------
|
||||
SETUP.TEXT.POINTERS
|
||||
LDA PP ASSUME PP THRU HI.MEM
|
||||
STA SRCP
|
||||
LDA PP+1
|
||||
STA SRCP+1
|
||||
LDA HI.MEM
|
||||
STA ENDP
|
||||
LDA HI.MEM+1
|
||||
STA ENDP+1
|
||||
RTS
|
||||
*--------------------------------
|
||||
CMP.SRCP.ENDP
|
||||
LDA SRCP
|
||||
CMP ENDP
|
||||
LDA SRCP+1
|
||||
SBC ENDP+1
|
||||
RTS
|
||||
*--------------------------------
|
||||
* GET NEXT NON-BLANK CHARACTER
|
||||
* AND CHECK FOR A, U, OR COMMA
|
||||
* SET CARRY IF A, U, OR EOL
|
||||
* SET EQ IF A, U, EOL, OR COMMA
|
||||
*--------------------------------
|
||||
GNNB.AUC
|
||||
JSR GNNB NEXT NON-BLANK, CONV LOWER TO UPPER
|
||||
BCS .1 EOL
|
||||
CMP #'A
|
||||
BEQ .1
|
||||
CMP #'U
|
||||
BEQ .1
|
||||
CMP #',
|
||||
CLC
|
||||
RTS
|
||||
.1 JSR BACKUP.CHAR.PNTR
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.pline
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
126
SCMASM.30/SCMASM.S.PSYM.txt
Normal file
126
SCMASM.30/SCMASM.S.PSYM.txt
Normal file
@ -0,0 +1,126 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
*--------------------------------
|
||||
* PRINT SYMBOL TABLE IN ALPHABETICAL ORDER
|
||||
*--------------------------------
|
||||
SYMBOLS
|
||||
STPRNT LDY #2 SKIP OVER .TF PSEUDO-SYMBOLS
|
||||
.1 STY PNTR
|
||||
LDA HSHTBL,Y
|
||||
STA STPNTR
|
||||
LDA HSHTBL+1,Y
|
||||
BEQ .5
|
||||
STA STPNTR+1
|
||||
*---PRINT VALUE AND DASH---------
|
||||
.2 LDY #2 POINT AT VALUE
|
||||
.25 >SYM LDA,STPNTR
|
||||
STA SYM.VALUE-2,Y SAVE FOR LOCAL OFFSETS
|
||||
INY
|
||||
CPY #6
|
||||
BCC .25
|
||||
LDY #3
|
||||
.26 LDA SYM.VALUE,Y
|
||||
BNE .27 ...NON-ZERO BYTE
|
||||
JSR SPC
|
||||
JSR SPC
|
||||
DEY
|
||||
BNE .26 ...UNTIL LAST BYTE
|
||||
.27 LDA SYM.VALUE,Y
|
||||
JSR MON.PHEX
|
||||
DEY
|
||||
BPL .27 ...INCLUDE LAST BYTE
|
||||
JSR P.DASH
|
||||
JSR SPC
|
||||
*---PRINT NAME-------------------
|
||||
LDY #6
|
||||
>SYM LDA,STPNTR GET NAME LENGTH
|
||||
PHA SAVE AGAIN FOR LOCAL LABELS FLAG
|
||||
AND #$3F ISOLATE LENGTH
|
||||
TAX
|
||||
.3 INY
|
||||
>SYM LDA,STPNTR
|
||||
JSR CHO
|
||||
DEX
|
||||
BNE .3
|
||||
*---CHECK FOR LOCAL LABELS-------
|
||||
PLA GET LENGTH AND FLAGS
|
||||
BMI .6 LOCAL LABELS
|
||||
*---NEXT LABEL-------------------
|
||||
.4 JSR CRLF.WITH.PAGING
|
||||
LDY #1 POINT AT POINTER
|
||||
>SYM LDA,STPNTR
|
||||
PHA
|
||||
DEY
|
||||
>SYM LDA,STPNTR
|
||||
STA STPNTR
|
||||
PLA
|
||||
STA STPNTR+1
|
||||
BNE .2 NEXT SYMBOL IN THIS CHAIN, IF ANY
|
||||
.5 LDY PNTR
|
||||
INY
|
||||
INY
|
||||
CPY #54 # BYTES IN HASH POINTER TABLE
|
||||
BNE .1
|
||||
RTS
|
||||
*---PRINT LOCAL LABELS-----------
|
||||
.6 AND #$3F POINT AT FIRST LOCAL LABEL
|
||||
CLC
|
||||
ADC #7
|
||||
TAY
|
||||
LDA #1 FORCE CRLF BEFORE 1ST LABEL
|
||||
STA EMIT.COLUMN
|
||||
.7 >SYM LDA,STPNTR
|
||||
BEQ .4 END OF LOCALS
|
||||
AND #$7F ISOLATE NAME
|
||||
PHA SAVE NAME OF SYMBOL
|
||||
STY YSAVE SAVE POINTER
|
||||
DEC EMIT.COLUMN
|
||||
BNE .9 ...UNLESS NEED A NEW LINE
|
||||
JSR CRLF.WITH.PAGING CLOBBERS Y-REG IF FORMFEED
|
||||
LDY #8
|
||||
.81 JSR SPC
|
||||
DEY
|
||||
BNE .81
|
||||
LDY #7 ...SEVEN PER LINE
|
||||
LDA SYM.VALUE+2
|
||||
BEQ .82
|
||||
LDY #5 ...FIVE PER LINE
|
||||
.82 STY EMIT.COLUMN
|
||||
.9 JSR SPC
|
||||
JSR SPC
|
||||
LDA #CHR.PERIOD
|
||||
JSR CHO
|
||||
PLA GET NAME
|
||||
STA CURRENT.LINE.NUMBER
|
||||
LDA #0
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
LDX #1 ONLY TWO DIGITS
|
||||
LDA #$40 PRINT ONLY, DO NOT STORE IN WBUF
|
||||
JSR CONVERT.LINE.NUMBER
|
||||
LDA #'=' EQUAL SIGN
|
||||
JSR CHO
|
||||
LDY YSAVE GET VALUE OF SYMBOL
|
||||
INY
|
||||
>SYM LDA,STPNTR
|
||||
CLC
|
||||
ADC SYM.VALUE
|
||||
PHA
|
||||
LDA SYM.VALUE+1
|
||||
ADC #0
|
||||
PHA
|
||||
LDA SYM.VALUE+2
|
||||
ADC #0
|
||||
BEQ .10 PRINT ONLY TWO BYTES
|
||||
JSR MON.PHEX
|
||||
.10 PLA
|
||||
JSR MON.PHEX
|
||||
PLA
|
||||
JSR MON.PHEX
|
||||
INY
|
||||
BNE .7 ...ALWAYS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.psym
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
411
SCMASM.30/SCMASM.S.RLINE.txt
Normal file
411
SCMASM.30/SCMASM.S.RLINE.txt
Normal file
@ -0,0 +1,411 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.MA JTBL
|
||||
.DA #$]1,]2-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
CHAR.TABLES
|
||||
CHARS.FOR.COMMANDS .EQ *-CHAR.TABLES
|
||||
>JTBL 22,ECHO.LINE "--ECHO REST OF LINE
|
||||
>JTBL 2D,PASS.CMD.TO.PRODOS DASH COMMAND
|
||||
>JTBL 2E,USER.CMD .--USER DOT COMMAND
|
||||
>JTBL 2F,LINK.FSE /--LINK TO F.S.E.
|
||||
>JTBL 3F,HELP ?--list commands
|
||||
>JTBL 00,NML other, try numbered line
|
||||
*--------------------------------
|
||||
CHARS.FOR.READ.LINE.1 .EQ *-CHAR.TABLES
|
||||
>JTBL 83,RDL.CATALOG ^C--MACRO FOR "CATALOG"
|
||||
>JTBL 85,RDL.EDIT ^E--MACRO FOR "EDIT "
|
||||
>JTBL 86,RDL.FIND ^F--MACRO FOR "FIND "
|
||||
>JTBL 8C,RDL.LIST ^L--MACRO FOR "LIST "
|
||||
>JTBL 90,RDL.PREFIX ^P--MACRO FOR "PREFIX"
|
||||
CHARS.FOR.READ.LINE.2 .EQ *-CHAR.TABLES
|
||||
>JTBL 88,RDL.BACKSPACE ^H--BACKSPACE
|
||||
>JTBL 8A,RDL.DOWN ^J--DOWN ARROW KEY
|
||||
>JTBL 8B,RDL.UP ^K--UP ARROW KEY
|
||||
>JTBL 8D,RDL.EOL ^M--CARRIAGE RETURN
|
||||
>JTBL 8F,RDL.OVERRIDE ^O--OVERRIDE
|
||||
>JTBL 93,RDL.TOGGLE ^S--TOGGLE CASE FLAG
|
||||
>JTBL 95,RDL.RITARR ^U--RIGHT ARROW
|
||||
>JTBL 98,RDL.RUBOUT ^X--RUBOUT LINE
|
||||
>JTBL 9B,RDL.ESCAPE ESC--ESCAPE MODE
|
||||
>JTBL 00,RDL.ERR
|
||||
*--------------------------------
|
||||
CHARS.FOR.ESCAPE .EQ *-CHAR.TABLES
|
||||
>JTBL C0,IO.HOME @--CLEAR SCREEN AND HOME
|
||||
>JTBL C1,IO.RIGHT A--MOVE CURSOR RIGHT
|
||||
>JTBL C2,IO.LEFT B--MOVE CURSOR LEFT
|
||||
>JTBL C3,IO.DOWN C--MOVE CURSOR DOWN
|
||||
>JTBL C4,IO.UP D--MOVE CURSOR UP
|
||||
>JTBL C5,IO.CLREOL E--CLEAR TO END OF LINE
|
||||
>JTBL C6,IO.CLREOP F--CLEAR TO END OF SCREEN
|
||||
>JTBL C9,IO.UP I--MOVE CURSOR UP
|
||||
>JTBL CA,IO.LEFT J--MOVE CURSOR LEFT
|
||||
>JTBL CB,IO.RIGHT K--MOVE CURSOR RIGHT
|
||||
>JTBL CC,ESCAPE.L L--"LOAD ..." OR "*---..."
|
||||
>JTBL CD,IO.DOWN M--MOVE CURSOR DOWN
|
||||
>JTBL D3,ESCAPE.S S--AUTO-SAVE LINE
|
||||
>JTBL D5,USER.ESC.U U--USER COMMAND
|
||||
>JTBL AE,ESCAPE.DOT .--LIS., COMMAND
|
||||
>JTBL 88,IO.LEFT ^H--LEFT ARROW KEY
|
||||
>JTBL 95,IO.RIGHT ^U--RIGHT ARROW KEY
|
||||
>JTBL 8A,IO.DOWN ^J--DOWN ARROW KEY
|
||||
>JTBL 8B,IO.UP ^K--UP ARROW KEY
|
||||
>JTBL 00,RDL.ESC.END END ESCAPE MODE
|
||||
*--------------------------------
|
||||
CHARS.FOR.EDIT .EQ *-CHAR.TABLES
|
||||
>JTBL 80,E.ZAP ^@ -- Clear to EOL
|
||||
>JTBL 81,E.INS ^A -- Add (Insert)
|
||||
>JTBL 82,E.BEG ^B
|
||||
>JTBL 84,E.DEL ^D
|
||||
>JTBL 86,E.FIND ^F
|
||||
>JTBL 88,E.BKSP ^H
|
||||
>JTBL 89,E.TABI ^I -- Clear to tab
|
||||
>JTBL 8C,E.DOWN ^L
|
||||
>JTBL 8D,E.RET ^M
|
||||
>JTBL 8E,E.END ^N
|
||||
>JTBL 8F,E.OVR ^O
|
||||
>JTBL 91,E.RETQ ^Q -- Clear to EOL, Quit
|
||||
>JTBL 92,E.RESTORE ^R -- Restore original line
|
||||
>JTBL 93,E.TOGGLE ^S -- TOGGLE CASE FLAG
|
||||
>JTBL 94,E.TAB ^T
|
||||
>JTBL 95,E.RIT ^U
|
||||
>JTBL 98,E.ABORT ^X
|
||||
>JTBL 00,E.ILLCHAR
|
||||
*--------------------------------
|
||||
RDL.TOGGLE
|
||||
JSR IO.CASE.TOGGLE
|
||||
JMP RDL3
|
||||
*--------------------------------
|
||||
RDL.UP
|
||||
JSR IO.UP
|
||||
JMP RDL3
|
||||
*--------------------------------
|
||||
RDL.DOWN
|
||||
JSR IO.DOWN
|
||||
JMP RDL3
|
||||
*--------------------------------
|
||||
* HANDLE TABULATION
|
||||
*--------------------------------
|
||||
TAB TXA SEE IF IN COLUMN 1
|
||||
BEQ .4 YES, AUTO-LINE-NUMBER
|
||||
.3 JSR E.CHECK.TAB
|
||||
BCS .5 ONE MORE SPACE
|
||||
LDA #CHR.BLANK
|
||||
JSR INSTALL.CHAR
|
||||
BCC .3 MORE TO GO
|
||||
JMP RDL.RUBOUT
|
||||
*--------------------------------
|
||||
.4 CLC ADD INCREMENT TO CURRENT LINE #
|
||||
LDA CURLNO
|
||||
ADC INCREMENT.VALUE
|
||||
STA CURRENT.LINE.NUMBER
|
||||
LDA CURLNO+1
|
||||
ADC INCREMENT.VALUE+1
|
||||
STA CURRENT.LINE.NUMBER+1
|
||||
LDY #0
|
||||
JSR CONVERT.LINE.NUMBER.BOTH STORE AND PRINT NUMBER
|
||||
TYA
|
||||
TAX
|
||||
*--------------------------------
|
||||
.5 LDA #CHR.BLANK
|
||||
JMP RDL.ADD.CHAR
|
||||
*--------------------------------
|
||||
* READ LINE SUBROUTINE
|
||||
*--------------------------------
|
||||
READ.LINE
|
||||
JSR GET.HORIZ.POSN
|
||||
TAX TEST FOR POSITION=0
|
||||
BEQ RDL1 DON'T OUTPUT CRLF
|
||||
RDL0 JSR CRLF
|
||||
RDL1 LDA PROMPT.FLAG
|
||||
JSR CHO NULL, "I", OR "H"
|
||||
LDA #':' COLON PROMPT
|
||||
JSR CHO
|
||||
LDX #0 START NEW LINE
|
||||
STX WBUF CLEAR OUT "$" FROM COL. 1 (JUST IN CASE)
|
||||
BIT AUTOLN.FLAG SEE IF IN "AUTO" MODE
|
||||
BMI TAB ...YES
|
||||
RDL3 JSR READ.KEY.WITH.CASE
|
||||
BCS RDL.ESCAPE.2E
|
||||
LDY WBUF SEE IF IN $ OR " MODE
|
||||
CPY #$A2 "?
|
||||
BEQ .2
|
||||
CPY #$A4 $?
|
||||
BEQ .2
|
||||
CMP TAB.CHAR <<ALLOW TAB.CHAR TO BE NON-CTRL
|
||||
BEQ TAB
|
||||
LDY #CHARS.FOR.READ.LINE.1
|
||||
.HS 2C
|
||||
.2 LDY #CHARS.FOR.READ.LINE.2
|
||||
CMP #CHR.BLANK SEE IF CONTROL CHAR
|
||||
BCS RDL.ADD.CHAR NO
|
||||
STA CURRENT.CHAR
|
||||
JMP SEARCH.CHAR.TABLES
|
||||
*--------------------------------
|
||||
RDL.ERR
|
||||
JSR MON.BELL ALARM IF NOT ONE OF THE ABOVE
|
||||
JMP RDL3 AND IGNORE IT
|
||||
*--------------------------------
|
||||
RDL.OVERRIDE
|
||||
JSR READ.KEY.WITH.CASE
|
||||
JMP RDL.ADD.CHAR
|
||||
*--------------------------------
|
||||
RDL.RITARR
|
||||
JSR GET.HORIZ.POSN
|
||||
TAY
|
||||
JSR IO.PICK.SCREEN
|
||||
RDL.ADD.CHAR
|
||||
JSR INSTALL.CHAR
|
||||
BCC RDL3 STILL ROOM FOR MORE
|
||||
RDL.RUBOUT
|
||||
LDA #CHR.BSLASH
|
||||
JSR MON.COUT
|
||||
JMP READ.LINE
|
||||
*--------------------------------
|
||||
RDL.BACKSPACE
|
||||
LDA #$88
|
||||
JSR MON.COUT PRINT BACKSPACE
|
||||
TXA SEE IF OVER PROMPT
|
||||
BEQ RDL0 YES, START NEW LINE
|
||||
DEX NO, BACK UP BUFFER POINTER
|
||||
JMP RDL3
|
||||
*--------------------------------
|
||||
RDL.PREFIX LDY #QM.PREFIX-QM.
|
||||
.HS 2C
|
||||
RDL.CATALOG LDY #QM.CATALOG-QM.
|
||||
.HS 2C
|
||||
RDL.LIST LDY #QM.LIST-QM.
|
||||
.HS 2C
|
||||
RDL.FIND LDY #QM.FIND-QM.
|
||||
.HS 2C
|
||||
RDL.EDIT LDY #QM.EDIT-QM.
|
||||
*
|
||||
CPX #0 ^C & ^E ONLY EFFECTIVE IN COL. 1
|
||||
BNE RDL.ERR ...ELSE ERRONEOUS
|
||||
.1 LDA QM.,Y SPELL OUT "EDIT " OR "CATALOG"
|
||||
PHP SAVE TERMINATION STATUS
|
||||
JSR INSTALL.CHAR
|
||||
INY
|
||||
PLP GET TERMINATION STATUS
|
||||
BPL .1 ...NOT FINISHED YET
|
||||
JMP RDL3
|
||||
*--------------------------------
|
||||
* HANDLE ESCAPE EDITING
|
||||
*--------------------------------
|
||||
RDL.ESCAPE
|
||||
JSR READ.KEY.WITH.CASE
|
||||
RDL.ESCAPE.2E
|
||||
JSR ELIMINATE.CASE
|
||||
STA CURRENT.CHAR
|
||||
LDY #CHARS.FOR.ESCAPE
|
||||
JSR SEARCH.CHAR.TABLES
|
||||
LDA CURRENT.CHAR
|
||||
CMP #"L" STAR DASH LINE?
|
||||
BEQ RDL.EOL ...YES, FINISH IT OFF
|
||||
CMP #$A0 CHECK FOR ARROW KEYS (//E)
|
||||
BCC RDL.ESCAPE ...YES, STAY IN ESCAPE MODE
|
||||
CMP #$C9 IJKM?
|
||||
BCC RDL4 ...NO, LEAVE ESCAPE MODE
|
||||
CMP #$CE
|
||||
BCC RDL.ESCAPE ...YES, STAY IN ESCAPE MODE
|
||||
BCS RDL4 ...NO, LEAVE ESCAPE MODE
|
||||
RDL.ESC.END
|
||||
PLA
|
||||
PLA
|
||||
RDL4 JMP RDL3
|
||||
*--------------------------------
|
||||
RDL.EOL
|
||||
JSR IO.CLREOL
|
||||
LDA #CHR.RETURN
|
||||
STA WBUF,X
|
||||
JSR MY.COUT
|
||||
LDY #0
|
||||
STY MON.MODE
|
||||
INY
|
||||
LDA WBUF GET FIRST CHAR
|
||||
CMP #CHR.DOLLAR
|
||||
BEQ FAKE.MONITOR
|
||||
JMP RDL.STRIP.LINE
|
||||
*--------------------------------
|
||||
* FAKE MONITOR
|
||||
*--------------------------------
|
||||
FMN1 CPX $FBC0 //C ID BYTE (X = 0 OR 1)
|
||||
BCC .1 ...NOT //C (//C = 0, OTHERS > 1)
|
||||
DEY
|
||||
BMI FMN3 ...NOT VALID COMMAND
|
||||
CPY #$13
|
||||
BCS FMN2
|
||||
.1 JSR MON.TOSUB
|
||||
LDY MON.YSAV
|
||||
FAKE.MONITOR
|
||||
JSR FMN5 INDIRECT TO MON.GETNUM
|
||||
STY MON.YSAV
|
||||
CMP #$C6 $8D EOR $B0 PLUS $89
|
||||
BEQ FMN4 ...<RETURN>
|
||||
LDY #22 # CMDS - 1
|
||||
FMN2 CMP MON.CHRTBL,Y
|
||||
BEQ FMN1 ...FOUND CMD IN TABLE
|
||||
DEY ...NEXT ENTRY
|
||||
BPL FMN2 ...NEXT ENTRY
|
||||
FMN3 JSR MON.BELL ...NOT IN TABLE
|
||||
JMP READ.LINE
|
||||
FMN4 LDA MON.MODE <RETURN> COMMAND
|
||||
LDY #0
|
||||
DEC MON.YSAV
|
||||
JSR MON.BL1
|
||||
JMP READ.LINE
|
||||
FMN5 JMP ($FF74) MON.GETNUM CALL
|
||||
*--------------------------------
|
||||
* ESCAPE-L
|
||||
* COLUMN 0: LOAD A FILE
|
||||
* COL. 1-N: MAKE "*------" LINE
|
||||
*--------------------------------
|
||||
ESCAPE.L
|
||||
TXA
|
||||
BEQ .3 "LOAD ...."
|
||||
*---GENERATE STAR-DASH LINE------
|
||||
LDA #CHR.STAR
|
||||
.1 JSR INSTALL.CHAR
|
||||
LDA USER.COM.DELIM
|
||||
CPX #38
|
||||
BCC .1
|
||||
.2 RTS
|
||||
*---GENERATE LOAD COMMAND--------
|
||||
.3 JSR IO.HTABX HTAB TO FIRST COLUMN
|
||||
LDY #QBLOADB " LOAD "
|
||||
JSR QT.OUT
|
||||
LDX #22
|
||||
JSR IO.HTABX
|
||||
JSR GET.DOS.CMD.OFF.SCRN
|
||||
PLA POP RETURN ADDRESS
|
||||
PLA
|
||||
JMP RDL.EOL SUBMIT COMMAND
|
||||
*--------------------------------
|
||||
* ESC-S AUTO SAVE LINE
|
||||
*--------------------------------
|
||||
ESCAPE.S
|
||||
TXA
|
||||
BNE .4 ...NOT IN COLUMN 1
|
||||
JSR SETUP.TEXT.POINTERS
|
||||
LDX #10 MUST APPEAR IN FIRST 10 LINES
|
||||
.1 LDY #3 POINT TO FIRST TEXT CHAR OF LINE
|
||||
LDA (SRCP),Y
|
||||
JSR CHECK.COMMENT.CHAR
|
||||
BEQ .5
|
||||
.2 DEX PAST 10TH LINE?
|
||||
BMI .4 ...YES, LOOK NO FURTHER
|
||||
LDY #0 POINT TO LENGTH
|
||||
LDA (SRCP),Y
|
||||
CLC
|
||||
ADC SRCP
|
||||
STA SRCP
|
||||
BCC .3
|
||||
INC SRCP+1
|
||||
.3 JSR CMP.SRCP.ENDP PAST END OF PROGRAM?
|
||||
BCC .1 ...NO, KEEP LOOKING
|
||||
.4 RTS
|
||||
.5 INY
|
||||
LDA (SRCP),Y
|
||||
BEQ .2 ...END OF LINE
|
||||
CMP #'S'
|
||||
BNE .5
|
||||
JSR LIST.CURRENT.LINE
|
||||
*--------------------------------
|
||||
GET.DOS.CMD.OFF.SCRN
|
||||
JSR IO.CLREOL
|
||||
LDY #0 NOW PICK 0...39 OFF SCREEN
|
||||
LDX #0 BUT NO BLANKS
|
||||
.1 JSR IO.PICK.SCREEN
|
||||
STA WBUF,X STORE IN BUFFER
|
||||
INY
|
||||
CMP #" " ELIMINATE BLANKS
|
||||
BEQ .2 ...BLANK
|
||||
INX
|
||||
.2 CPY #39
|
||||
BCC .1
|
||||
.3 DEY
|
||||
JSR IO.PICK.SCREEN
|
||||
CMP #" "
|
||||
BEQ .3
|
||||
INY
|
||||
TYA
|
||||
JMP IO.HTAB POSITION AFTER LAST NON-BLANK
|
||||
*--------------------------------
|
||||
* INSTALL CHARACTER IN INPUT BUFFER
|
||||
*--------------------------------
|
||||
INSTALL.CHAR
|
||||
ORA #$80 ASSURE SIGN BIT ON
|
||||
STA WBUF,X STORE IN INPUT BUFFER
|
||||
CMP #$A0 CONTROL CHAR?
|
||||
BCS .1 ...NO
|
||||
AND #$3F ...YES, DISPLAY AS INVERSE
|
||||
.1 JSR IO.COUT ECHO ON SCREEN
|
||||
CPX #WBUF.MAX SEE IF END OF BUFFER
|
||||
BCS .2 ...YES
|
||||
INX
|
||||
RTS
|
||||
.2 JSR MON.BELL
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* STRIP SIGN BITS OFF ALL BYTES
|
||||
* AND CHANGE <CR> TO <EOL>
|
||||
*--------------------------------
|
||||
RDL.STRIP.LINE
|
||||
LDY #$FF LOOP TO CLEAR HIGH BITS
|
||||
.1 INY
|
||||
LDA WBUF,Y
|
||||
AND #$7F STRIP OFF BIT
|
||||
CMP #$0D WAS IT THE END?
|
||||
BNE .2 NOT YET
|
||||
LDA #0 YES, SUBSTITUTE <EOL> FOR <CR>
|
||||
.2 STA WBUF,Y
|
||||
BNE .1 UNTIL <EOL>
|
||||
TAX CLEAR X-REG
|
||||
RTS
|
||||
*--------------------------------
|
||||
ESCAPE.DOT
|
||||
TXA
|
||||
BNE .5 NOT IN COLUMN 1, IGNORE IT
|
||||
JSR GET.HORIZ.POSN FIND CURSOR POSITION
|
||||
TAY
|
||||
.1 JSR IO.PICK.SCREEN
|
||||
AND #$7F
|
||||
JSR CHECK.DIGIT
|
||||
BCC .2 NOT A DIGIT
|
||||
STA WBUF+4,X
|
||||
INX
|
||||
INY
|
||||
BNE .1 ...ALWAYS
|
||||
.2 TXA
|
||||
BEQ .3 ...NO DIGITS
|
||||
LDA #4
|
||||
STA CHAR.PNTR
|
||||
STA WBUF+4,X
|
||||
LDX #CURLNO-A0L
|
||||
JSR SCAN.1.DECIMAL.NUMBER
|
||||
.3 LDY #4
|
||||
LDX #0
|
||||
.4 LDA LDC,Y
|
||||
JSR INSTALL.CHAR
|
||||
DEY
|
||||
BPL .4
|
||||
STA CURRENT.CHAR at end, current.char = comma
|
||||
JSR IO.CLREOP
|
||||
.5 RTS
|
||||
*--------------------------------
|
||||
LDC .AS /,.SIL/
|
||||
*--------------------------------
|
||||
QM.
|
||||
QM.EDIT .AT /EDIT /
|
||||
QM.CATALOG .AT /CATALOG/
|
||||
QM.PREFIX .AT /PREFIX/
|
||||
QM.LIST .AT /LIST /
|
||||
QM.FIND .AT /FIND /
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.rline
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
118
SCMASM.30/SCMASM.S.SCMD.txt
Normal file
118
SCMASM.30/SCMASM.S.SCMD.txt
Normal file
@ -0,0 +1,118 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* SEARCH COMMAND TABLE
|
||||
*--------------------------------
|
||||
SEARCH.COMMAND.TABLE
|
||||
LDX #-1 COMMAND STRING INDEX
|
||||
.1 LDY #0 BUFFER INDEX
|
||||
STY CHAR.PNTR
|
||||
.2 INX NEXT POSITION IN CMD.TBL
|
||||
JSR GNC.UC NEXT CHARACTER OF COMMAND
|
||||
BCS .7 ...END OF LINE
|
||||
JSR CHECK.LETTER
|
||||
BCC .6 ...NOT A LETTER
|
||||
LDA CMD.TBL,X NEXT CHAR OF COMMAND NAME
|
||||
BEQ PASS.CMD.TO.PRODOS ...END OF TABLE
|
||||
EOR CURRENT.CHAR
|
||||
BEQ .2 ...CORRECT CHARACTER
|
||||
ASL SHIFT OUT END.OF.NAME FLAG
|
||||
BNE .5 ...REALLY DIFFERENT
|
||||
*---GO TO PROCESS COMMAND--------
|
||||
.3 LDA CMD.TBL+2,X
|
||||
PHA
|
||||
LDA CMD.TBL+1,X
|
||||
PHA
|
||||
LDX #0
|
||||
RTS
|
||||
*---SCAN TO NEXT TABLE ENTRY-----
|
||||
.5 INX
|
||||
LDA CMD.TBL-1,X
|
||||
BPL .5
|
||||
INX SKIP OVER ADDRESS
|
||||
BNE .1 ...ALWAYS
|
||||
*---ALL LETTERS MATCH-------------
|
||||
.6 DEY BACK OFF <EOL>
|
||||
STY CHAR.PNTR
|
||||
.7 CPY #3 AT LEAST THREE LETTERS?
|
||||
BCC PASS.CMD.TO.PRODOS ...NO, SPELLED WRONG
|
||||
.9 LDA CMD.TBL,X
|
||||
BMI .3 ...AT END OF COMMAND NAME
|
||||
INX
|
||||
BNE .9 ...ALWAYS
|
||||
*---NOT FOUND IN TABLE------------
|
||||
PASS.CMD.TO.PRODOS
|
||||
.DO 0 NO LONGER NECESSARY, BECAUSE 00=8D IN SCI
|
||||
LDX #-1 APPEND A <RETURN> FOR PRODOS
|
||||
.1 INX
|
||||
LDA WBUF,X LOOK FOR TERMINATING 00
|
||||
BNE .1 ...NOT YET
|
||||
LDA #$8D
|
||||
STA WBUF,X
|
||||
.FIN EFFECTIVE 10-23-86
|
||||
JSR SCI.COMMAND GIVE ProDOS A SHOT AT IT
|
||||
BCC .2 ProDOS liked it!
|
||||
JMP PRODOS.ERROR ...not acceptable, explain why
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
* COMMAND STRINGS
|
||||
*--------------------------------
|
||||
.MA CTBL
|
||||
.AT /]1/
|
||||
.DA ]1-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
CMD.TBL
|
||||
>CTBL ASM
|
||||
>CTBL AUTO
|
||||
>CTBL COPY
|
||||
>CTBL DATE
|
||||
>CTBL DELETE
|
||||
>CTBL EDIT
|
||||
>CTBL FAST
|
||||
>CTBL FIND
|
||||
>CTBL FP
|
||||
>CTBL HELP
|
||||
>CTBL HIDE
|
||||
>CTBL HIMEM
|
||||
>CTBL INCREMENT
|
||||
>CTBL LIST
|
||||
>CTBL LOMEM
|
||||
>CTBL MANUAL
|
||||
>CTBL MEMORY
|
||||
>CTBL MERGE
|
||||
>CTBL MGO
|
||||
>CTBL MNTR
|
||||
>CTBL NEW
|
||||
>CTBL PRT
|
||||
>CTBL RENUMBER
|
||||
>CTBL REPLACE
|
||||
>CTBL RESTORE
|
||||
>CTBL RST
|
||||
>CTBL SLOW
|
||||
>CTBL SYMBOLS
|
||||
>CTBL TEXT
|
||||
>CTBL TIME
|
||||
>CTBL USR
|
||||
>CTBL VAL
|
||||
>CTBL VERSION
|
||||
.HS 00 END OF TABLE
|
||||
*--------------------------------
|
||||
SCT.1 INY
|
||||
INY
|
||||
INY
|
||||
SEARCH.CHAR.TABLES
|
||||
LDA CHAR.TABLES,Y
|
||||
BEQ .1 ...NOT IN TABLE
|
||||
CMP CURRENT.CHAR
|
||||
BNE SCT.1
|
||||
.1 LDA CHAR.TABLES+2,Y
|
||||
PHA
|
||||
LDA CHAR.TABLES+1,Y
|
||||
PHA
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.scmd
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
495
SCMASM.30/SCMASM.S.SYMT.txt
Normal file
495
SCMASM.30/SCMASM.S.SYMT.txt
Normal file
@ -0,0 +1,495 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* INITIALIZE SYMBOL TABLE
|
||||
* 1. SET EOT TO BOT
|
||||
* 2. CLEAR HASH POINTER TABLE
|
||||
*--------------------------------
|
||||
STINIT LDA LO.MEM START OF SYMBOL TABLE
|
||||
STA EOT
|
||||
LDA LO.MEM+1
|
||||
STA EOT+1
|
||||
STA MACLBL+1 PRIVATE LABELS GO DOWN FROM THERE
|
||||
LDX #56 # BYTES IN HASH POINTER TABLE
|
||||
LDA #0
|
||||
STA MACLBL
|
||||
STA CURRENT.MAJOR.LABEL+1
|
||||
.1 STA HSHTBL-1,X
|
||||
DEX
|
||||
BNE .1
|
||||
.DO AUXMEM
|
||||
LDA RDRAM
|
||||
LDA RDRAM
|
||||
LDX #AUX.IMAGE.LEN-1
|
||||
.2 LDA AUX.IMAGE,X
|
||||
STA AUX.CODE,X
|
||||
DEX
|
||||
BPL .2
|
||||
BACK.TO.ROM
|
||||
PHA
|
||||
LDA RDROM
|
||||
PLA
|
||||
.FIN
|
||||
RTS RETURN WITH X=0
|
||||
*--------------------------------
|
||||
.DO AUXMEM
|
||||
LDA.STPNTR
|
||||
BIT RDRAM
|
||||
JSR LDA.STPNTR.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
ADC.STPNTR
|
||||
BIT RDRAM
|
||||
JSR ADC.STPNTR.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
SBC.STPNTR
|
||||
BIT RDRAM
|
||||
JSR SBC.STPNTR.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
LDA.PNTR
|
||||
BIT RDRAM
|
||||
JSR LDA.PNTR.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
LDA.TPTR
|
||||
BIT RDRAM
|
||||
JSR LDA.TPTR.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
LDA.SRCP
|
||||
BIT RDRAM
|
||||
JSR LDA.SRCP.AUX
|
||||
JMP BACK.TO.ROM
|
||||
*
|
||||
STA.PNTR
|
||||
STA WRAUX
|
||||
STA (PNTR),Y
|
||||
STA WRMAIN
|
||||
RTS
|
||||
STA.STPNTR
|
||||
STA WRAUX
|
||||
STA (STPNTR),Y
|
||||
STA WRMAIN
|
||||
RTS
|
||||
*--------------------------------
|
||||
AUX.IMAGE
|
||||
LDA.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
LDA (STPNTR),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
ADC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
ADC (STPNTR),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
SBC.STPNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
SBC (STPNTR),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
LDA.PNTR.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
LDA (PNTR),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
LDA.TPTR.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
LDA (TPTR),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
LDA.SRCP.AUX .EQ *-AUX.IMAGE+AUX.CODE
|
||||
STA RDAUX
|
||||
LDA (SRCP),Y
|
||||
STA RDMAIN
|
||||
RTS
|
||||
AUX.IMAGE.LEN .EQ *-AUX.IMAGE
|
||||
.FIN
|
||||
*--------------------------------
|
||||
* A table of 28 pointers begins at $130, called HSHTBL.
|
||||
* Each pointer points to the beginning of a chain of
|
||||
* symbol entries. The entries on a chain are kept
|
||||
* in alphabetical order. If a chain is empty, the
|
||||
* pointer = $0000.
|
||||
*
|
||||
* HSHTBL+$00: Chain for target file entries
|
||||
* HSHTBL+$02: Chain for labels starting with "A"
|
||||
* HSHTBL+$04: Chain for labels starting with "B"
|
||||
* - - -
|
||||
* HSHTBL+$34: Chain for labels starting with "Z"
|
||||
* HSHTBL+$36: Chain for Macro Names and Skeletons
|
||||
*
|
||||
* Format of Target File Entry:
|
||||
* 0,1 -- Forward chain pointer (0=end of chain)
|
||||
* 2,3 -- Length of target file in bytes
|
||||
* 4 -- Length of code name = $02
|
||||
* 5,6 -- Target file code name:
|
||||
* 5: "@" = $40
|
||||
* 6: $40 + target file number ($00-$1F)
|
||||
*
|
||||
* Format of Label Entry:
|
||||
* 0,1 -- Forward chain pointer (0=end of chain)
|
||||
* 2-5 -- Value of label
|
||||
* 6 -- Flags and length of label name:
|
||||
* Bits 5-0: length of label name ($01-$20)
|
||||
* Bit 6: =1 if forward reference
|
||||
* Bit 7: =1 if has local labels
|
||||
* 7 -- First character of label name, and flag.
|
||||
* Bit 7 = 1 if label is .SEt label.
|
||||
* thru 6+n -- The rest of the label name, with bit 7 = 0
|
||||
*
|
||||
* If the label has local labels, they follow.
|
||||
* Each local label occupies two bytes:
|
||||
* 1 -- Label number (0-99) +128
|
||||
* 2 -- Label value (distance from value of
|
||||
* named label)
|
||||
* The local label list is terminated with a $00
|
||||
* in the label number position.
|
||||
*
|
||||
* Format of Macro Definition Entry:
|
||||
* 0,1 -- Chain to next macro name
|
||||
* 2,3 -- $0000
|
||||
* 4 -- Length of macro name
|
||||
* 5 -- "[" + $5B
|
||||
* 6-n -- Rest of Macro name
|
||||
* etc.-- The packed skeleton lines, each
|
||||
* terminated by $00. A final $00
|
||||
* terminates the skeleton.
|
||||
*
|
||||
* Private Labels are kept in a separate table.
|
||||
* Each label takes 7 bytes. Bytes 0-3 are the
|
||||
* value, byte 4 is the colon number + $80,
|
||||
* and bytes 5 and 6 are the macro call number.
|
||||
* The Private Label table grows downward from
|
||||
* MACLBL toward $0800.
|
||||
*
|
||||
*--------------------------------
|
||||
* PACK SYMBOL FROM INPUT LINE
|
||||
* UP TO 32 CHARACTERS PACKED AT SYMBOL+7
|
||||
* AND FOLLOWING.
|
||||
* # CHARS STORED IN SYMBOL+6
|
||||
* RETURN CARRY CLEAR IF NO SYMBOL
|
||||
* RETURN CARRY SET IF GOOD SYMBOL
|
||||
*--------------------------------
|
||||
PACK LDX #0 POINT AT 1ST CHAR IN NAME
|
||||
CMP #CHR.PERIOD LOCAL SYMBOL?
|
||||
BEQ .1 YES
|
||||
CMP #': COLON MEANS MACRO PRIVATE LABEL
|
||||
BNE .3 NO, NORMAL SYMBOL
|
||||
.1 STA SYMBOL+7 SAVE PERIOD OR COLON
|
||||
JSR GNC.UC GET NEXT CHAR
|
||||
JSR CHECK.DIGIT
|
||||
BCC .4 NO, BAD SYMBOL
|
||||
JSR DECN CONVERT TO BINARY
|
||||
LDX #0 IN CASE BAD SYMBOL...
|
||||
LDA DGTCNT VALUE MUST BE < 100
|
||||
CMP #3 SO MUST BE 1 OR 2 DIGITS
|
||||
BCS .4 ...TOO MANY DIGITS, BAD SYMBOL
|
||||
LDA SYM.VALUE
|
||||
ORA #$80 BE SURE NOT 00
|
||||
STA SYMBOL+8 SAVE VALUE
|
||||
LDA CALL.NUM JUST IN CASE IT'S A
|
||||
STA SYMBOL+9 MACRO PRIVATE LABEL
|
||||
LDA CALL.NUM+1
|
||||
STA SYMBOL+10
|
||||
INX SIGNAL GOOD SYMBOL
|
||||
BNE .4 ...ALWAYS
|
||||
*--------------------------------
|
||||
.3 JSR PACK.NAME
|
||||
.4 JSR BACKUP.CHAR.PNTR
|
||||
STX SYMBOL+6 SAVE LENGTH
|
||||
CPX #1 CARRY SET IF AT LEAST ONE CHAR
|
||||
LDX #0 CLEAR X AGAIN
|
||||
RTS
|
||||
*--------------------------------
|
||||
* PACK A NAME INTO SYMBOL
|
||||
*--------------------------------
|
||||
PACK.NAME
|
||||
JSR CHECK.LETTER
|
||||
BCC .4 NOT A LETTER
|
||||
.1 CPX #32 SEE IF ALREADY 32 CHARACTERS
|
||||
BEQ .2 YES, IGNORE
|
||||
STA SYMBOL+7,X PUT CHAR IN ENTRY
|
||||
INX POINT AT NEXT SLOT
|
||||
.2 JSR GNC.UC GET NEXT CHAR FROM LINE
|
||||
JSR CHECK.DOT.DIGIT.OR.LETTER
|
||||
BCS .1 VALID CHAR
|
||||
.4 RTS END OF NAME
|
||||
*--------------------------------
|
||||
* SEARCH SYMBOL TABLE
|
||||
* # OF CHARS STORED AT SYMBOL+6
|
||||
* SYMBOL ITSELF AT SYMBOL+7 AND FOLLOWING
|
||||
* JSR STSRCH
|
||||
* IF FOUND: CARRY CLEAR
|
||||
* (STPNTR)=ADDRESS OF ENTRY
|
||||
* IF NOT FOUND: CARRY SET
|
||||
* (STPNTR)=ADDRESS OF
|
||||
* POINTER CELL WHICH
|
||||
* SHOULD POINT AT ENTRY
|
||||
*--------------------------------
|
||||
STSRCH SEC CONVERT FIRST CHARACTER
|
||||
LDA SYMBOL+7 OF SYMBOL TO HASH TABLE INDEX
|
||||
CMP #CHR.PERIOD SEE IF LOCAL SYMBOL
|
||||
BEQ .8 YES
|
||||
CMP #': COLON, THEN PRIVATE LABEL
|
||||
BNE .12 NO, NORMAL LABEL
|
||||
JMP SEARCH.PRIVATE.LABELS
|
||||
.12 SBC #$40 AT-SIGN
|
||||
ASL DOUBLE INDEX, CLEAR CARRY
|
||||
ADC #HSHTBL
|
||||
STA STPNTR
|
||||
LDA /HSHTBL
|
||||
ADC #0
|
||||
STA STPNTR+1
|
||||
.1 LDY #0
|
||||
>SYM LDA,STPNTR GET POINTER FROM ENTRY
|
||||
STA TPTR
|
||||
INY
|
||||
>SYM LDA,STPNTR
|
||||
BEQ .4 END OF CHAIN, NOT IN TABLE
|
||||
STA TPTR+1
|
||||
LDX SYMBOL+6 # CHARS IN SYMBOL
|
||||
LDY #6 POINT AT LENGTH
|
||||
>SYM LDA,TPTR USE MINIMUM LENGTH
|
||||
AND #$3F ISOLATE LENGTH
|
||||
CMP SYMBOL,Y
|
||||
INY
|
||||
BCS .2
|
||||
TAX
|
||||
.2 >SYM LDA,TPTR COMPARE BYTES FROM BOTH
|
||||
AND #$7F ALLOW FLAG BITS IN SYMBOL
|
||||
CMP SYMBOL,Y
|
||||
BCC .3 NOT THIS ONE, BUT KEEP LOOKING
|
||||
BNE .4 NOT IN THIS CHAIN
|
||||
DEX
|
||||
BEQ .5 THE NAME IS THE SAME OR A SUBSET
|
||||
INY NEXT BYTE PAIR
|
||||
BNE .2 ...ALWAYS
|
||||
.3 JSR .7 UPDATE POINTER, CLEAR CARRY
|
||||
BCC .1 ...ALWAYS
|
||||
.4 SEC DID NOT FIND
|
||||
LDX #0 RESTORE X=0
|
||||
RTS
|
||||
.5 LDY #6 TEST LENGTHS
|
||||
>SYM LDA,TPTR
|
||||
AND #$3F ISOLATE LENGTH
|
||||
CMP SYMBOL+6 # CHARS IN SYMBOL IN TABLE
|
||||
BEQ .6 SAME EXACTLY
|
||||
BCS .4 NEW SYMBOL IS SHORTER
|
||||
BCC .3 NEW SYMBOL IS LONGER
|
||||
.6 LDY #2 POINT AT VALUE
|
||||
.65 >SYM LDA,TPTR SET UP VALUE FOR EXPR SCAN
|
||||
STA SYM.VALUE-2,Y
|
||||
INY
|
||||
CPY #6
|
||||
BCC .65
|
||||
.7 LDA TPTR
|
||||
STA STPNTR
|
||||
LDA TPTR+1
|
||||
STA STPNTR+1
|
||||
CLC SIGNAL DID FIND IT
|
||||
RTS
|
||||
*--------------------------------
|
||||
.8 LDA CURRENT.MAJOR.LABEL
|
||||
STA STPNTR
|
||||
LDA CURRENT.MAJOR.LABEL+1
|
||||
BEQ .11
|
||||
STA STPNTR+1
|
||||
CLC
|
||||
LDY #6 POINT AT LENGTH
|
||||
>SYM LDA,STPNTR GET LENGTH OF MAJOR SYMBOL
|
||||
BPL .4 NO LOCAL SYMBOLS YET
|
||||
AND #$3F MASK TO REAL LENGTH
|
||||
ADC #7 POINT AT LOCALS
|
||||
TAY
|
||||
.9 >SYM LDA,STPNTR
|
||||
BEQ .4 END OF LOCALS, NOT FOUND
|
||||
CMP SYMBOL+8 COMPARE TO NAME OF LOCAL
|
||||
BEQ .10 FOUND IT!
|
||||
INY SKIP TO NEXT LOCAL
|
||||
INY
|
||||
BNE .9 ...ALWAYS
|
||||
.10 INY POINT AT VALUE OFFSET
|
||||
>SYM LDA,STPNTR
|
||||
CLC
|
||||
LDY #2 POINT AT MAJOR VALUE
|
||||
>SYM ADC,STPNTR
|
||||
STA SYM.VALUE
|
||||
INY
|
||||
>SYM LDA,STPNTR
|
||||
ADC #0
|
||||
STA SYM.VALUE+1
|
||||
INY
|
||||
>SYM LDA,STPNTR
|
||||
ADC #0
|
||||
STA SYM.VALUE+2
|
||||
INY
|
||||
>SYM LDA,STPNTR
|
||||
ADC #0
|
||||
STA SYM.VALUE+3
|
||||
CLC
|
||||
RTS
|
||||
.11 LDY #QER9 NO NORMAL LABEL YET
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
* SEARCH PRIVATE LABEL TABLE
|
||||
*--------------------------------
|
||||
SEARCH.PRIVATE.LABELS
|
||||
LDA MACLBL
|
||||
STA STPNTR
|
||||
LDA MACLBL+1
|
||||
.1 STA STPNTR+1
|
||||
CMP LO.MEM+1 END OF TABLE YET?
|
||||
BCS .3 ...YES, NO MORE LABELS
|
||||
LDY #6
|
||||
>SYM LDA,STPNTR
|
||||
AND #$3F ISOLATE FROM FLAG BITS
|
||||
CMP SYMBOL+10
|
||||
BNE .2 NO
|
||||
DEY
|
||||
>SYM LDA,STPNTR
|
||||
CMP SYMBOL+9
|
||||
BNE .2 NO
|
||||
DEY
|
||||
>SYM LDA,STPNTR
|
||||
CMP SYMBOL+8
|
||||
BEQ .4 YES, FOUND IT!
|
||||
.2 CLC BUMP PNTR TO NEXT LABEL
|
||||
LDA STPNTR
|
||||
ADC #7
|
||||
STA STPNTR
|
||||
LDA STPNTR+1
|
||||
ADC #0
|
||||
BNE .1 ...ALWAYS
|
||||
*--------------------------------
|
||||
.3 SEC SIGNAL NOT FOUND
|
||||
RTS
|
||||
*--------------------------------
|
||||
.4 DEY
|
||||
.5 >SYM LDA,STPNTR
|
||||
STA SYM.VALUE,Y
|
||||
DEY
|
||||
BPL .5
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* ADD SYMBOL TO TABLE
|
||||
*--------------------------------
|
||||
STADD LDA SYMBOL+7 SEE IF LOCAL SYMBOL
|
||||
CMP #CHR.PERIOD
|
||||
BEQ .5 YES
|
||||
CMP #': COLON, PRIVATE LABEL
|
||||
BNE .11 NO, NORMAL LABEL
|
||||
JMP ADD.PRIVATE.LABEL
|
||||
.11 LDY #1 POINT AT POINTER
|
||||
.1 >SYM LDA,STPNTR GET CURRENT POINTER
|
||||
STA SYMBOL,Y
|
||||
LDA EOT,Y
|
||||
>SYM STA,STPNTR
|
||||
STA PNTR,Y
|
||||
STA CURRENT.MAJOR.LABEL,Y
|
||||
LDA ORGN,Y VALUE
|
||||
STA SYMBOL+2,Y
|
||||
LDA ORGN+2,Y
|
||||
STA SYMBOL+4,Y
|
||||
DEY
|
||||
BPL .1
|
||||
CLC COMPUTE ENTRY SIZE
|
||||
LDA SYMBOL+6 FROM SYMBOL SIZE
|
||||
ADC #7
|
||||
.2 PHA SAVE SIZE
|
||||
LDY EOT+1
|
||||
CLC
|
||||
ADC EOT SEE IF ROOM FOR NEW ENTRY
|
||||
BCC .10
|
||||
INY
|
||||
.DO AUXMEM
|
||||
.10 CPY /$C000
|
||||
BCS .4 MEM FULL ERR
|
||||
STA EOT
|
||||
.ELSE
|
||||
.10 CMP MACSTK
|
||||
TAX SAVE LOW BYTE
|
||||
TYA GET HIGH BYTE
|
||||
SBC MACSTK+1
|
||||
BCS .4 MEM FULL ERR
|
||||
STX EOT
|
||||
.FIN
|
||||
STY EOT+1
|
||||
PLA GET SIZE
|
||||
TAY
|
||||
DEY CORRECT FOR INDEXING
|
||||
.3 LDA SYMBOL,Y
|
||||
>SYM STA,PNTR
|
||||
DEY
|
||||
BPL .3
|
||||
RTS
|
||||
.4 JMP MFER MEM FULL ERR
|
||||
*--------------------------------
|
||||
.5 LDY #6 LENGTH BYTE
|
||||
>SYM LDA,STPNTR
|
||||
BMI .6 ALREADY HAVE SOME LOCAL LABELS
|
||||
ORA #$80 SET LOCAL FLAG
|
||||
>SYM STA,STPNTR
|
||||
BNE .8 ...ALWAYS
|
||||
.6 LDA EOT BACK UP EOT
|
||||
BNE .7 OVER 00 TERMINATOR
|
||||
DEC EOT+1 OF LOCALS
|
||||
.7 DEC EOT
|
||||
.8 LDA SYMBOL+8 NAME OF LOCAL
|
||||
STA SYMBOL SET UP TO ADD TO SYMBOL TABLE
|
||||
SEC
|
||||
LDY #1
|
||||
JSR CALC.OFFSET.BYTE
|
||||
JSR CALC.OFFSET.BYTE
|
||||
BNE .9 ERROR > 255
|
||||
JSR CALC.OFFSET.BYTE
|
||||
BNE .9 ERROR > 255
|
||||
JSR CALC.OFFSET.BYTE
|
||||
BNE .9 ERROR > 255
|
||||
LDA EOT
|
||||
STA PNTR
|
||||
LDA EOT+1
|
||||
STA PNTR+1
|
||||
LDA #3 SIZE IS 3 BYTES
|
||||
BNE .2 ...ALWAYS
|
||||
.9 JMP GT255ERR VALUE > 255
|
||||
*--------------------------------
|
||||
CALC.OFFSET.BYTE
|
||||
INY
|
||||
LDA ORGN-2,Y
|
||||
>SYM SBC,STPNTR
|
||||
STA SYMBOL-1,Y
|
||||
RTS
|
||||
*--------------------------------
|
||||
* ADD A PRIVATE LABEL
|
||||
*--------------------------------
|
||||
ADD.PRIVATE.LABEL
|
||||
SEC
|
||||
LDA MACLBL
|
||||
SBC #7
|
||||
STA MACLBL
|
||||
STA STPNTR
|
||||
LDA MACLBL+1
|
||||
SBC #0
|
||||
STA MACLBL+1
|
||||
STA STPNTR+1
|
||||
CMP #8 BELOW $0800?
|
||||
BCC .3 YES, NO MORE ROOM
|
||||
LDY #6 POINT AT LAST BYTE
|
||||
.1 LDA SYMBOL+4,Y
|
||||
CPY #4
|
||||
BCS .2
|
||||
LDA ORGN,Y
|
||||
.2 >SYM STA,STPNTR
|
||||
DEY
|
||||
BPL .1
|
||||
RTS
|
||||
.3 JMP MFER
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.symt
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
291
SCMASM.30/SCMASM.S.TSRCH.txt
Normal file
291
SCMASM.30/SCMASM.S.TSRCH.txt
Normal file
@ -0,0 +1,291 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* SEARCH TEXT BUFFER FOR LINE
|
||||
*
|
||||
* LINE NUMBER TO BE FOUND IS AT 0,X AND 1,X
|
||||
*
|
||||
* IF FOUND, RETURN CARRY SET
|
||||
* (LINE.START) = ADDRESS OF LINE
|
||||
* (LINE.END ) = ADDRESS OF NEXT LINE
|
||||
*
|
||||
* IF NOT FOUND, RETURN CARRY CLEAR
|
||||
* (LINE.START) = ADDRESS OF NEXT LINE
|
||||
* (LINE.END ) = ADDRESS OF NEXT LINE
|
||||
*
|
||||
*--------------------------------
|
||||
SERTXT LDA PP START AT BEGINNING OF TEXT BUFFER
|
||||
STA LINE.END
|
||||
LDA PP+1
|
||||
STA LINE.END+1
|
||||
SERNXT LDA LINE.END+1 CONTINUE SEARCH WITH NEXT LINE
|
||||
STA LINE.START+1
|
||||
LDA LINE.END
|
||||
STA LINE.START
|
||||
CMP HI.MEM
|
||||
LDA LINE.START+1 SEE IF AT END YET
|
||||
SBC HI.MEM+1
|
||||
BCS .3 YES, DID NOT FIND
|
||||
LDY #0 POINT AT LINE LENGTH
|
||||
LDA (LINE.START),Y GET LINE LENGTH
|
||||
ADC LINE.END POINT TO NEXT LINE
|
||||
STA LINE.END
|
||||
BCC .1
|
||||
INC LINE.END+1
|
||||
.1 INY POINT AT LINE NUMBER
|
||||
LDA (LINE.START),Y COMPARE TO DESRIRED LINE NUMBER
|
||||
CMP 0,X
|
||||
INY
|
||||
LDA (LINE.START),Y
|
||||
SBC 1,X
|
||||
BCC SERNXT NOT THERE YET
|
||||
BNE .2 PASSED IT UP
|
||||
DEY CHECK LOW BYTE AGAIN
|
||||
LDA (LINE.START),Y
|
||||
CMP 0,X
|
||||
BEQ .4 FOUND IT!
|
||||
.2 LDA LINE.START PASSED IT UP
|
||||
STA LINE.END MAKE BOTH POINT AT SAME LINE
|
||||
LDA LINE.START+1
|
||||
STA LINE.END+1
|
||||
.3 CLC RETURN CARRY CLEAR
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* DELETE LINES
|
||||
*--------------------------------
|
||||
DELETE
|
||||
JSR GNNB GET NEXT NON-BLANK CHAR
|
||||
CMP #'/'
|
||||
BEQ .1 ...PATHNAME
|
||||
|
||||
JSR CHECK.LETTER
|
||||
BCC .2 ...NOT LETTER, PROBABLY LINES
|
||||
|
||||
.1 JMP PASS.CMD.TO.PRODOS
|
||||
|
||||
.2 JSR BACKUP.CHAR.PNTR
|
||||
JSR PARSE.LINE.RANGE
|
||||
BCS SYNX.3 ...NO NUMBERS, SYNTAX ERROR
|
||||
|
||||
DELETE.LINES
|
||||
LDX #-1
|
||||
SEC
|
||||
.2 LDA SRCP+1,X SEE IF RANGE EMPTY OR CROSSED
|
||||
STA LINE.START+1,X
|
||||
LDA ENDP+1,X
|
||||
STA A4L+1,X
|
||||
SBC LINE.START+1,X
|
||||
STA MOVE.DISTANCE+1,X
|
||||
INX
|
||||
BEQ .2
|
||||
TAX TEST HI-BYTE OF MOVE.DISTANCE
|
||||
BPL MOVE.TEXT.UP ...POSITIVE, RANGE GOOD
|
||||
SYNX.3 JMP SYNX
|
||||
*--------------------------------
|
||||
* MOVE TEXT FROM <PP> THRU <LINE.START>
|
||||
* UP <MOVE.DISTANCE> BYTES TO <A4L,A4H>
|
||||
*--------------------------------
|
||||
MOVE.TEXT.UP
|
||||
JSR COMPUTE.BLOCK.SIZE
|
||||
CLC
|
||||
LDA PP
|
||||
ADC MOVE.DISTANCE
|
||||
STA PP
|
||||
LDA PP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA PP+1
|
||||
LDY #0
|
||||
BEQ .3 ...ALWAYS
|
||||
*---MOVE A WHOLE BLOCK-----------
|
||||
.1 LDA (LINE.START),Y MOVE BYTES 255 THRU 1 IN BLOCK
|
||||
STA (A4L),Y
|
||||
.2 DEY
|
||||
BNE .1
|
||||
LDA (LINE.START),Y MOVE LOWEST BYTE IN BLOCK
|
||||
STA (A4L),Y
|
||||
.3 DEC LINE.START+1 PRIOR BLOCK
|
||||
DEC A4H
|
||||
DEX ANY MORE BLOCKS?
|
||||
BNE .2 YES
|
||||
*---MOVE SHORT BLOCK IF ANY------
|
||||
LDX BLKSIZ PARTIAL BLOCK SIZE
|
||||
BEQ .5 NONE LEFT
|
||||
.4 DEY
|
||||
LDA (LINE.START),Y
|
||||
STA (A4L),Y
|
||||
DEX
|
||||
BNE .4
|
||||
.5 RTS
|
||||
*--------------------------------
|
||||
* COPY L1,L2,L3
|
||||
* L1 = FIRST LINE OF RANGE TO COPY
|
||||
* L2 = LAST LINE OF RANGE TO COPY
|
||||
* L3 = LINE NUMBER BEFORE WHICH TO INSERT
|
||||
* THE COPIED LINES
|
||||
*--------------------------------
|
||||
ERR1 JMP SYNX
|
||||
ERR2 .EQ ERR1
|
||||
ERR3 JMP MFER
|
||||
ERR4 .EQ ERR1
|
||||
*--------------------------------
|
||||
COPY
|
||||
JSR PARSE.LINE.RANGE
|
||||
JSR GNNB look for a comma
|
||||
CMP #','
|
||||
BNE ERR1 ...no comma
|
||||
SEC SAVE POINTER AND COMPUTE LENGTH
|
||||
LDA SRCP REALLY -(LENGTH)
|
||||
SBC ENDP
|
||||
STA MOVE.DISTANCE
|
||||
LDA SRCP+1
|
||||
SBC ENDP+1
|
||||
STA MOVE.DISTANCE+1
|
||||
BPL ERR2 RANGE BACKWARD OR EMPTY
|
||||
*--------------------------------
|
||||
CLC
|
||||
LDA PP COMPUTE NEW PP POINTER
|
||||
ADC MOVE.DISTANCE
|
||||
STA A4L
|
||||
LDA PP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA A4H
|
||||
*--------------------------------
|
||||
LDA A4L SEE IF ROOM FOR THIS
|
||||
CMP LO.MEM
|
||||
LDA A4L+1
|
||||
SBC LO.MEM+1
|
||||
BCC ERR3 MEM FULL ERR
|
||||
*---Get Target Line Number-------
|
||||
JSR GNNB pick up first digit of target line number
|
||||
JSR SCAN.LINE.NUMBER (or it might be ".")
|
||||
BCS ERR1 ...not a line number of "."
|
||||
LDA 0,X copy line number to A0L,H
|
||||
STA A0L
|
||||
LDA 1,X
|
||||
STA A0H
|
||||
*---Verify valid target line-----
|
||||
LDA SRCP BE SURE NOT INSIDE SOURCE BLOCK
|
||||
CMP LINE.START
|
||||
LDA SRCP+1
|
||||
SBC LINE.START+1
|
||||
BCS .1 BELOW SOURCE BLOCK
|
||||
LDA LINE.START
|
||||
CMP ENDP
|
||||
LDA LINE.START+1
|
||||
SBC ENDP+1
|
||||
BCC ERR4 INSIDE SOURCE BLOCK
|
||||
*--------------------------------
|
||||
* TARGET IS ABOVE SOURCE BLOCK, SO WE HAVE TO
|
||||
* ADJUST SOURCE BLOCK POINTERS.
|
||||
*--------------------------------
|
||||
CLC
|
||||
LDA SRCP
|
||||
ADC MOVE.DISTANCE
|
||||
STA SRCP
|
||||
LDA SRCP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA SRCP+1
|
||||
CLC
|
||||
LDA ENDP
|
||||
ADC MOVE.DISTANCE
|
||||
STA ENDP
|
||||
LDA ENDP+1
|
||||
ADC MOVE.DISTANCE+1
|
||||
STA ENDP+1
|
||||
*--------------------------------
|
||||
.1 JSR MOVE.TEXT.DOWN MAKE THE HOLE
|
||||
*--------------------------------
|
||||
LDA SRCP SAVE SRCP AT A1
|
||||
STA A1L (POINTS TO BLOCK TO BE COPIED)
|
||||
LDA SRCP+1
|
||||
STA A1H
|
||||
.2 CLC ADD (Y) TO A4
|
||||
TYA
|
||||
ADC A4L POINTS TO BEGINNING OF NEXT
|
||||
STA A4L LINE IN HOLE
|
||||
BCC .3
|
||||
INC A4H
|
||||
.3 LDY #0
|
||||
LDA (A1L),Y COPY LINE LENGTH
|
||||
STA (A4L),Y
|
||||
INY INSERT LINE #
|
||||
LDA A0L OF TARGET LINE
|
||||
STA (A4L),Y
|
||||
INY INSERT LINE #
|
||||
LDA A0H OF TARGET LINE
|
||||
STA (A4L),Y
|
||||
.4 INY COPY REST OF LINE
|
||||
LDA (A1L),Y
|
||||
STA (A4L),Y
|
||||
BNE .4 UNTIL <EOL> TOKEN
|
||||
INY
|
||||
CLC
|
||||
TYA
|
||||
ADC A1L POINT TO NEXT SOURCE LINE
|
||||
STA A1L
|
||||
BCC .5
|
||||
INC A1H
|
||||
.5 CMP ENDP
|
||||
LDA A1H
|
||||
SBC ENDP+1
|
||||
BCC .2
|
||||
LDY #QDELOR
|
||||
JSR YES.OR.NO
|
||||
BNE .6
|
||||
JSR DELETE.LINES
|
||||
.6 RTS
|
||||
*--------------------------------
|
||||
* MOVE TEXT FROM <PP> THRU <LINE.START>
|
||||
* DOWN -<MOVE.DISTANCE> BYTES TO <A4L,A4H>
|
||||
*--------------------------------
|
||||
MOVE.TEXT.DOWN
|
||||
JSR COMPUTE.BLOCK.SIZE
|
||||
LDA PP
|
||||
STA A2L
|
||||
LDA PP+1
|
||||
STA A2H
|
||||
LDA A4L
|
||||
STA PP
|
||||
LDA A4H
|
||||
STA PP+1
|
||||
LDY #0
|
||||
BEQ .2 ...ALWAYS
|
||||
.1 LDA (A2L),Y YES, MOVE 256 BYTES
|
||||
STA (A4L),Y
|
||||
INY
|
||||
BNE .1
|
||||
INC A2H POINT AT NEXT BLOCK
|
||||
INC A4H
|
||||
.2 DEX ANY WHOLE BLOCKS LEFT?
|
||||
BNE .1 YES
|
||||
*---MOVE PARTIAL BLOCK-----------
|
||||
LDX BLKSIZ SIZE OF PARTIAL BLOCK
|
||||
BEQ .4 EMPTY
|
||||
.3 LDA (A2L),Y
|
||||
STA (A4L),Y
|
||||
INY
|
||||
DEX
|
||||
BNE .3
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* COMPUTE SIZE OF TEXT BLOCK
|
||||
* FROM <PP> TO <LINE.START>
|
||||
*
|
||||
* RETURN # WHOLE BLOCKS OF 256 BYTES +1 IN X
|
||||
* RETURN # BYTES IN PARTIAL BLOCK IN <BLKSIZ>
|
||||
*--------------------------------
|
||||
COMPUTE.BLOCK.SIZE
|
||||
SEC COMPUTE # OF BYTES TO BE MOVED
|
||||
LDA LINE.START CURRENT TOP POINTER
|
||||
SBC PP CURRENT BOTTOM POINTER
|
||||
STA BLKSIZ SAVE PARTIAL PAGE AMOUNT
|
||||
LDA LINE.START+1
|
||||
SBC PP+1
|
||||
TAX # OF WHOLE PAGES IN X
|
||||
INX
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.tsrch
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
96
SCMASM.30/SCMASM.S.VECT.txt
Normal file
96
SCMASM.30/SCMASM.S.VECT.txt
Normal file
@ -0,0 +1,96 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.MA VEC
|
||||
BIT RDROM
|
||||
JSR ]1
|
||||
BIT RDRAM
|
||||
RTS
|
||||
.EM
|
||||
*--------------------------------
|
||||
JMP SEARCH.COMPRESSED.TABLE
|
||||
JMP GNC
|
||||
JMP GNC.UC
|
||||
JMP GNNB
|
||||
>VEC EXPR
|
||||
>VEC EXP1
|
||||
JMP ASM.ERROR
|
||||
>VEC EMIT
|
||||
*--------------------------------
|
||||
ERBA LDY #QER5
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
.DUMMY
|
||||
.OR $D400
|
||||
D4.ASM.INIT .BS 3
|
||||
D4.ASM.LINE .BS 3
|
||||
D4.EMIT.VALUE .BS 3
|
||||
D4.DIR.OP .BS 3
|
||||
D4.VERSION
|
||||
.ED
|
||||
*--------------------------------
|
||||
ASM.INIT LDA RDRAM
|
||||
JSR D4.ASM.INIT
|
||||
LDA RDROM
|
||||
RTS
|
||||
*--------------------------------
|
||||
ASM.PARTICULAR LDA RDRAM
|
||||
JSR D4.ASM.LINE
|
||||
LDA RDROM
|
||||
RTS
|
||||
*--------------------------------
|
||||
EMIT.VALUE LDA RDRAM
|
||||
JSR D4.EMIT.VALUE
|
||||
LDA RDROM
|
||||
RTS
|
||||
*--------------------------------
|
||||
PSOP LDA RDRAM
|
||||
JSR D4.DIR.OP
|
||||
LDA RDROM
|
||||
RTS
|
||||
*--------------------------------
|
||||
EXP.OVER.256
|
||||
LDA EXP.VALUE+1
|
||||
STA EXP.VALUE
|
||||
LDA EXP.VALUE+2
|
||||
STA EXP.VALUE+1
|
||||
LDA EXP.VALUE+3
|
||||
STA EXP.VALUE+2
|
||||
LDA #0
|
||||
STA EXP.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
ASM.ERROR
|
||||
BIT RDROM
|
||||
TAX USE ERROR # FOR INDEX
|
||||
LDY ASM.ERROR.TABLE,X
|
||||
JMP SOFT.ERROR
|
||||
*--------------------------------
|
||||
ASM.ERROR.TABLE
|
||||
.DA #QER2 "BAD OPCODE"
|
||||
.DA #QER5 "BAD ADDRESS"
|
||||
.DA #QER3 "RANGE"
|
||||
.DA #QER6 "UNDEF LABEL"
|
||||
*--------------------------------
|
||||
VERSION
|
||||
LDY #QSC
|
||||
JSR QT.OUT
|
||||
LDY #2
|
||||
.1 LDA Q.VERSION,Y
|
||||
JSR MY.COUT
|
||||
DEY
|
||||
BPL .1
|
||||
LDA #$8D
|
||||
.2 JSR MY.COUT
|
||||
INY
|
||||
LDA RDRAM
|
||||
LDX D4.VERSION,Y
|
||||
LDA RDROM
|
||||
TXA
|
||||
BNE .2
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.vect
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
85
SCMASM.30/SCMASM.S.XTDIR.txt
Normal file
85
SCMASM.30/SCMASM.S.XTDIR.txt
Normal file
@ -0,0 +1,85 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DO 1
|
||||
*--------------------------------
|
||||
DIR. .SE 0
|
||||
.MA DIR
|
||||
.DO "]1"=DIR.=0
|
||||
.DA #"]1"-$C0
|
||||
DIR. .SE "]1"
|
||||
.FIN
|
||||
.DA #"]2"-$40,]3-1 .]1]2
|
||||
.EM
|
||||
*--------------------------------
|
||||
OPTBL.DIR
|
||||
>DIR A,C,DIR.AC ASCII STRING COMPRESSED
|
||||
>DIR A,S,PSAS ASCII STRING
|
||||
>DIR A,T,PSAT ASCII STRING WITH LAST BYTE
|
||||
>DIR A,Z,PSAZ ASCII STRING WITH ZERO END
|
||||
>DIR B,S,PSBS BLOCK STORAGE
|
||||
>DIR D,A,PSDA DATA
|
||||
>DIR D,O,PSDO DO
|
||||
>DIR D,U,D.DUMMY DUMMY
|
||||
>DIR E,D,D.END.DUMMY
|
||||
>DIR E,L,PSEL ELSE
|
||||
>DIR E,N,PSEN END OF SOURCE
|
||||
>DIR E,P,D.END.PHASE
|
||||
>DIR E,Q,PSEQ EQUATE
|
||||
>DIR F,I,PSFI FIN
|
||||
>DIR H,S,PSHS HEX STRING
|
||||
>DIR I,N,PSIN INCLUDE
|
||||
>DIR L,I,PSLI LIST ON,/ OFF
|
||||
>DIR M,A,PSMA MACRO
|
||||
>DIR O,P,PSOP OPCODE TABLE SELECT
|
||||
>DIR O,R,PSOR ORIGIN
|
||||
>DIR P,G,PSPG PAGE EJECT
|
||||
>DIR P,H,D.PHASE PHASE
|
||||
>DIR T,A,PSTA TARGET ADDRESS
|
||||
>DIR T,F,PSTF TARGET FILE
|
||||
>DIR T,I,PSTI TITLE
|
||||
>DIR U,S,PSUSER USER DIRECTIVE
|
||||
.HS 41 <<<TERMINATOR>>>
|
||||
*--------------------------------
|
||||
.ELSE
|
||||
*--------------------------------
|
||||
* DIRECTIVE TABLE
|
||||
*--------------------------------
|
||||
.MA DIR
|
||||
.AS /]1/
|
||||
.DA ]2-1
|
||||
.EM
|
||||
*---------------------------------
|
||||
OPTBL.DIR
|
||||
.HS 0402 ITEM SIZE, KEY SIZE
|
||||
>DIR AS,PSAS ASCII STRING
|
||||
>DIR AT,PSAT ASCII STRING WITH LAST BYTE
|
||||
>DIR BS,PSBS BLOCK STORAGE
|
||||
>DIR DA,PSDA DATA
|
||||
>DIR DO,PSDO DO
|
||||
>DIR DU,D.DUMMY DUMMY
|
||||
>DIR ED,D.END.DUMMY
|
||||
>DIR EL,PSEL ELSE
|
||||
>DIR EN,PSEN END OF SOURCE
|
||||
>DIR EP,D.END.PHASE
|
||||
>DIR EQ,PSEQ EQUATE
|
||||
>DIR FI,PSFI FIN
|
||||
>DIR HS,PSHS HEX STRING
|
||||
>DIR IN,PSIN INCLUDE
|
||||
>DIR LI,PSLI LIST ON,/ OFF
|
||||
>DIR MA,PSMA MACRO
|
||||
>DIR OP,PSOP OPCODE TABLE SELECT
|
||||
>DIR OR,PSOR ORIGIN
|
||||
>DIR PG,PSPG PAGE EJECT
|
||||
>DIR PH,D.PHASE PHASE
|
||||
>DIR TA,PSTA TARGET ADDRESS
|
||||
>DIR TF,PSTF TARGET FILE
|
||||
>DIR TI,PSTI TITLE
|
||||
>DIR US,PSUSER USER DIRECTIVE
|
||||
.HS 00 MARK END OF TABLE
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s.xtdir
|
||||
LOAD usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
83
SCMASM.30/SCMASM.S.txt
Normal file
83
SCMASM.30/SCMASM.S.txt
Normal file
@ -0,0 +1,83 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OR $2000
|
||||
.TF SCMASM.30,TSYS
|
||||
*--------------------------------------
|
||||
VERSION.HI .EQ 3 VERSION 3.0
|
||||
VERSION.LO .EQ 0
|
||||
*--------------------------------
|
||||
AUXMEM .EQ 1 ...USE AUXMEM FOR SYMBOL TABLE
|
||||
ROCKWELL .EQ 1 0 = LEAVE OUT ROCKWELL OPTION
|
||||
SWEET.16 .EQ 1 0 = LEAVE OUT SWEET-16 OPTION
|
||||
*--------------------------------
|
||||
.INB usr/src/scmasm.30/scmasm.s.ldr
|
||||
.BS $2200-*
|
||||
*--------------------------------
|
||||
.PH $8000
|
||||
.INB usr/src/scmasm.30/scmasm.s.data
|
||||
.INB usr/src/scmasm.30/scmasm.s.param
|
||||
.INB usr/src/scmasm.30/scmasm.s.edit
|
||||
.INB usr/src/scmasm.30/scmasm.s.mcmds
|
||||
.INB usr/src/scmasm.30/scmasm.s.scmd
|
||||
.INB usr/src/scmasm.30/scmasm.s.tsrch
|
||||
.INB usr/src/scmasm.30/scmasm.s.fndrep
|
||||
.INB usr/src/scmasm.30/scmasm.s.rline
|
||||
.INB usr/src/scmasm.30/scmasm.s.elines
|
||||
.INB usr/src/scmasm.30/scmasm.s.output
|
||||
.INB usr/src/scmasm.30/scmasm.s.disk
|
||||
.INB usr/src/scmasm.30/scmasm.s.pline
|
||||
.INB usr/src/scmasm.30/scmasm.s.asmgen
|
||||
.INB usr/src/scmasm.30/scmasm.s.asmnl
|
||||
.INB usr/src/scmasm.30/scmasm.s.exp
|
||||
.INB usr/src/scmasm.30/scmasm.s.symt
|
||||
.INB usr/src/scmasm.30/scmasm.s.psym
|
||||
.INB usr/src/scmasm.30/scmasm.s.macro
|
||||
.INB usr/src/scmasm.30/scmasm.s.dir1
|
||||
.INB usr/src/scmasm.30/scmasm.s.dir2
|
||||
.INB usr/src/scmasm.30/scmasm.s.acdir
|
||||
.INB usr/src/scmasm.30/scmasm.s.newq
|
||||
.INB usr/src/scmasm.30/scmasm.s.xtdir
|
||||
.BS $A700-*
|
||||
.INB usr/src/scmasm.30/scmasm.s.vect
|
||||
.BS $A800-*
|
||||
.INB usr/src/scmasm.30/scmasm.s.iostd
|
||||
.BS $A900-*
|
||||
.EP
|
||||
*--------------------------------------
|
||||
.PH $AA00
|
||||
.INB usr/src/scmasm.30/sci.s.eq
|
||||
.INB usr/src/scmasm.30/sci.s.cpar
|
||||
.INB usr/src/scmasm.30/sci.s.cat
|
||||
.INB usr/src/scmasm.30/sci.s.exec
|
||||
.INB usr/src/scmasm.30/sci.s.online
|
||||
.INB usr/src/scmasm.30/sci.s.prin
|
||||
.INB usr/src/scmasm.30/sci.s.errors
|
||||
.INB usr/src/scmasm.30/sci.s.loadsave
|
||||
.INB usr/src/scmasm.30/sci.s.openclose
|
||||
.INB usr/src/scmasm.30/sci.s.rwpa
|
||||
.INB usr/src/scmasm.30/sci.s.tables
|
||||
.BS $BD00-*
|
||||
.INB usr/src/scmasm.30/sci.s.vars
|
||||
.BS $BE00-*
|
||||
.INB usr/src/scmasm.30/sci.s.gp
|
||||
.BS $BF00-*
|
||||
.EP
|
||||
*--------------------------------------
|
||||
.INB usr/src/scmasm.30/io.s.iie
|
||||
.BS $6100-*
|
||||
.INB usr/src/scmasm.30/io.s.stb80
|
||||
.BS $6200-*
|
||||
.INB usr/src/scmasm.30/io.s.videx
|
||||
.BS $6400-*
|
||||
.INB usr/src/scmasm.30/io.s.ultra
|
||||
.BS $6600-*
|
||||
*--------------------------------------
|
||||
.PH $D400
|
||||
.INB usr/src/scmasm.30/asm65816.s
|
||||
.BS $E000-*
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.30/scmasm.s
|
||||
ASM
|
991
SCMASM.31/ASM65816.S..txt
Normal file
991
SCMASM.31/ASM65816.S..txt
Normal file
@ -0,0 +1,991 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR $A700
|
||||
ASM65816.SEARCH.TABLE .BS 3
|
||||
ASM65816.GNC .BS 3
|
||||
ASM65816.GNC.UC .BS 3
|
||||
ASM65816.GNNB .BS 3
|
||||
ASM65816.EXPR .BS 10
|
||||
ASM65816.EXP1 .BS 10
|
||||
ASM65816.ASM.ERROR .BS 3
|
||||
ASM65816.EMIT .BS 10
|
||||
*--------------------------------
|
||||
.OR $F0 F0-FF is ASM private ZeroPage
|
||||
LEVEL.MASK .BS 1
|
||||
OPBASE .BS 1
|
||||
MODE.BYTE .BS 1
|
||||
FORCE.ADDR.SIZE .BS 1
|
||||
.ED
|
||||
*--------------------------------
|
||||
ERR.BAD.OPCODE .EQ 0
|
||||
ERR.BAD.ADDRESS .EQ 1
|
||||
ERR.RANGE .EQ 2
|
||||
ERR.UNDEFINED .EQ 3
|
||||
*--------------------------------
|
||||
JMP ASM65816.ASM.INIT
|
||||
JMP ASM65816.ASM.LINE
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
JMP DIR.OP
|
||||
*--------------------------------
|
||||
.AS -/FOR THE 6502, 65C02, 65R02, 65816/
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
ASM65816.ASM.INIT
|
||||
LDA #0 MASK FOR 6502
|
||||
STA LEVEL.MASK
|
||||
LDA #15 MARGIN FOR 6502
|
||||
STA EMIT.MARGIN
|
||||
RTS
|
||||
*--------------------------------
|
||||
ASM65816.ASM.LINE
|
||||
LDA SEARCH.KEY 1ST LETTER
|
||||
CMP #'A'
|
||||
BCC .5 ...NOT A LETTER, SO BADOP
|
||||
CMP #'Z'+1
|
||||
BCS .5 ...NOT A LETTER, SO BADOP
|
||||
AND #$1F MAKE 01...1A
|
||||
TAX
|
||||
LDA FIRST.LETTER.TABLE-1,X
|
||||
BNE .8 ...UNUSED LETTER
|
||||
.5 JMP BADOPERR
|
||||
*---BUILD OPTBL.PNTR INTO TABLE--------
|
||||
.8 ADC #OPCODE.TABLE CARRY CLEAR ALREADY
|
||||
STA OPTBL.PNTR
|
||||
LDY /OPCODE.TABLE
|
||||
BCC .1
|
||||
INY
|
||||
.1 CPX #'R'-$40 WHICH HALF OF TABLE?
|
||||
BCC .2 ...FIRST HALF
|
||||
INY ...SECOND HALF
|
||||
.2 CLC INITIAL SEARCH
|
||||
.3 JSR ASM65816.SEARCH.TABLE
|
||||
BCC .5 ...NOT FOUND
|
||||
*---FOUND IT!--------------------
|
||||
LDA (OPTBL.PNTR),Y
|
||||
STA OPBASE
|
||||
INY
|
||||
LDA (OPTBL.PNTR),Y
|
||||
AND #$E1 ISOLATE LEVEL BITS
|
||||
BEQ .7 ...PLAIN 6502 LEVEL
|
||||
AND LEVEL.MASK
|
||||
BNE .7 ...ALLOWS 'STP' FOR BOTH 65816 & SWEET-16
|
||||
SEC CONTINUE SEARCH
|
||||
BCS .3 ...ALWAYS
|
||||
*---BRANCH TO PROCESS OPCODE-----
|
||||
.7 LDA (OPTBL.PNTR),Y
|
||||
AND #$1E
|
||||
TAY
|
||||
LDA OP.MODE+1,Y
|
||||
PHA
|
||||
LDA OP.MODE,Y
|
||||
PHA
|
||||
RTS
|
||||
*--------------------------------
|
||||
.MA MODE
|
||||
O..]1 .EQ *-OP.MODE
|
||||
.DA OP.]1-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
OP.MODE
|
||||
>MODE SNGL 0 -- SINGLE BYTE OPCODES
|
||||
>MODE COPS 2 -- LDA GROUP
|
||||
>MODE SHIFTS 4 -- ASL GROUP
|
||||
>MODE REL16 6 -- BRL & PER
|
||||
>MODE REL8 8 -- RELATIVE BRANCHES
|
||||
>MODE BITS A -- BIT GROUP
|
||||
>MODE MOVES C -- MVP & MVN
|
||||
>MODE JUMPS E -- JUMP GROUP
|
||||
>MODE ROCKB 10 -- ROCKWELL BIT OPS
|
||||
>MODE ROCKC 12 -- ROCKWELL BIT OPS
|
||||
>MODE XN 14 -- SWEET 16 REGISTER OPS
|
||||
>MODE POP 16 -- SWEET 16 POP & POPD
|
||||
>MODE SET 18 -- SWEET 16 SET
|
||||
>MODE CRS 1A -- COP, REP, SEP
|
||||
*--------------------------------
|
||||
OP.SNGL
|
||||
EMIT.OPBASE
|
||||
LDA OPBASE
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
OP.CRS JSR ASM65816.GNNB
|
||||
CMP #'#'
|
||||
BNE ERBA.E2
|
||||
JSR ASM65816.EXP1
|
||||
JMP EMIT.OP.AND.EXP.BYTE
|
||||
ERBA.E2
|
||||
JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
OP.COPS
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
LDA MODE.BYTE ALL INDIRECT MODES <<<12-16-85>>>
|
||||
AND #$04 REQUIRE ZP VALUE <<<12-16-85>>>
|
||||
BEQ .1 ...NOT INDIRECT <<<12-16-85>>>
|
||||
CPY #14
|
||||
BCC .4 ...MODES 0...13
|
||||
DEC ADDR.LENGTH SHORTEN >(ZP) AND >(ZP),Y
|
||||
.4 JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE ERBA.E2 ...MUST BE DIRECT VALUE
|
||||
.1 LDA ADDR.MODE.BITS.CLASS.1,Y
|
||||
BPL .2 VALID MODE
|
||||
INC ADDR.LENGTH ...DIRECT,Y NOT VALID
|
||||
LDA ADDR.MODE.BITS.CLASS.1+1,Y
|
||||
.2 EOR OPBASE
|
||||
CMP #$89 STA IMMED?
|
||||
BEQ ERBA.E2 ...YES, NO SUCH ANIMAL
|
||||
* FALL INTO EMIT.OP.AND.VALUE ***
|
||||
*--------------------------------
|
||||
EMIT.OP.AND.VALUE
|
||||
JSR ASM65816.EMIT
|
||||
ASM65816.EMIT.VALUE
|
||||
JSR EMIT.EXP.BYTE
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+1
|
||||
JSR ASM65816.EMIT
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+2
|
||||
JSR ASM65816.EMIT
|
||||
DEC ADDR.LENGTH
|
||||
BEQ .2
|
||||
LDA EXP.VALUE+3
|
||||
JSR ASM65816.EMIT
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
OP.BITS
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
CPY #7 ONLY MODES 0...6 LEGAL
|
||||
BCS .2 ...NOT VALID MODE
|
||||
LDX OPBASE
|
||||
BNE .0 ...NOT BIT OPCODE
|
||||
LDA LEVEL.MASK
|
||||
AND #$20
|
||||
BNE .0 ...AT LEAST 65C02
|
||||
LDA #$60 ONLY ZP AND ABS LEGAL
|
||||
BNE .7 ...ALWAYS
|
||||
.0 LDA CLASS.5.LEGAL.MODES,X
|
||||
.7 AND CLASS.5.MODE.MASKS,Y
|
||||
BNE .4 ...LEGAL
|
||||
LDA PASS
|
||||
BEQ .1 ...IN PASS 1
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .2 ...TOO BIG FOR ZP
|
||||
.1 DEY CHANGE ABS TO ZP MODE
|
||||
BMI .2 ...WASN'T ABS
|
||||
TYA
|
||||
LSR
|
||||
BCC .2 ...WASN'T ABS
|
||||
LDA CLASS.5.LEGAL.MODES,X
|
||||
AND CLASS.5.MODE.MASKS,Y
|
||||
BNE .3 ...LEGAL AFTERALL
|
||||
.2 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE
|
||||
.3 DEC ADDR.LENGTH
|
||||
*---FORM OPCODE------------------
|
||||
.4 LDA ADDR.MODE.BITS.CLASS.5,Y
|
||||
EOR CLASS.5.OPS,X
|
||||
LDY #$89
|
||||
CMP #$20
|
||||
BEQ .5
|
||||
LDY #$9C
|
||||
CMP #$6C
|
||||
BEQ .5
|
||||
LDY #$9E
|
||||
CMP #$7C
|
||||
BNE .6
|
||||
.5 TYA
|
||||
.6 JMP EMIT.OP.AND.VALUE
|
||||
*--------------------------------
|
||||
OP.SHIFTS
|
||||
JSR ASM65816.GNC CHECK FOR ACCUMULATOR MODE
|
||||
BNE .2 NOT ACCUM MODE
|
||||
JSR ASM65816.GNC
|
||||
BNE .2 NOT ACCUM MODE
|
||||
*---ACCUMULATOR MODE-------------
|
||||
LDA OPBASE
|
||||
EOR #$08 MAKE ACCUM MODE OPCODE
|
||||
BPL .1 NOT INC OR DEC
|
||||
PHA
|
||||
LDA LEVEL.MASK
|
||||
AND #$20 ONLY IN 65C02 AND ABOVE
|
||||
BEQ .5
|
||||
PLA
|
||||
EOR #$F0 CHANGE EA-->1A, CA-->3A
|
||||
.1 JMP ASM65816.EMIT
|
||||
*---MODES WITH OPERAND FIELD-----
|
||||
.2 DEC CHAR.PNTR
|
||||
JSR GENERAL.OPERAND
|
||||
JSR SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
CPY #5 ONLY MODES 1...4 LEGAL
|
||||
BCS .5
|
||||
TYA
|
||||
BEQ .5 ...NO IMMEDIATE MODE ALLOWED
|
||||
LDA ADDR.MODE.BITS.CLASS.1,Y
|
||||
EOR OPBASE
|
||||
JMP EMIT.OP.AND.VALUE
|
||||
.5 JMP ERBA.EMIT.TWO INVALID ADDRESS MODE
|
||||
*--------------------------------
|
||||
OP.REL8
|
||||
.DO SWEET.16
|
||||
LDA OPBASE CHECK FOR 'BNM1' SWEET-16 OP
|
||||
CMP #$09
|
||||
BNE .1 ...NOT 'BNM1'
|
||||
JSR ASM65816.GNC CHECK FOR '1'
|
||||
CMP #'1'
|
||||
BNE BADOPERR ...NO, SO BAD OP
|
||||
.FIN
|
||||
.1 JSR ASM65816.EXPR
|
||||
LDA OPBASE
|
||||
OP.REL8.A
|
||||
JSR ASM65816.EMIT EMIT OPCODE
|
||||
LDA EXP.UNDEF
|
||||
BMI GOEMIT ...UNDEFINED
|
||||
LDY EXP.VALUE+1
|
||||
CLC COMPUTE RELATIVE OFFSET
|
||||
LDA EXP.VALUE
|
||||
SBC ORGN
|
||||
STA EXP.VALUE
|
||||
BPL .2
|
||||
INY
|
||||
.2 TYA
|
||||
SBC ORGN+1
|
||||
BNE ERR.RANGE.EMIT.ONE
|
||||
EMIT.EXP.BYTE
|
||||
LDA EXP.VALUE
|
||||
GOEMIT JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
BADOPERR
|
||||
LDA #ERR.BAD.OPCODE
|
||||
JMP ASM65816.ASM.ERROR
|
||||
*--------------------------------
|
||||
* BRL & PER, 16-bit relative
|
||||
*--------------------------------
|
||||
OP.REL16
|
||||
JSR ASM65816.EXPR Get value of expression
|
||||
JSR EMIT.OPBASE Emit the opcode, bumping origin once
|
||||
LDA EXP.UNDEF If undefined, say so
|
||||
BMI .3 (If we didn't, might be RANGE ERR)
|
||||
CLC ADD 2 MORE TO ORIGIN
|
||||
LDY ORGN+2
|
||||
LDA ORGN
|
||||
ADC #2
|
||||
STA EXP.VALUE+3 (TEMP)
|
||||
LDA ORGN+1
|
||||
ADC #0
|
||||
BCC .2
|
||||
INY BANK BYTE
|
||||
.2 CPY EXP.VALUE+2 IN SAME BANK AS TARGET?
|
||||
BNE ERR.RANGE.EMIT.TWO ...NO, ERR RANGE
|
||||
STA EXP.VALUE+2 YES, SAVE IN ANOTHER TEMP
|
||||
LDA EXP.VALUE TARGET-ORGN+3
|
||||
SBC EXP.VALUE+3
|
||||
STA EXP.VALUE
|
||||
LDA EXP.VALUE+1
|
||||
SBC EXP.VALUE+2
|
||||
STA EXP.VALUE+1
|
||||
.3 LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
*--------------------------------
|
||||
ERR.RANGE.EMIT.TWO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ERR.RANGE.EMIT.ONE
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ASM65816.RAER
|
||||
LDA #ERR.RANGE
|
||||
JMP ASM65816.ASM.ERROR
|
||||
*--------------------------------
|
||||
OP.MOVES
|
||||
JSR EMIT.OPBASE
|
||||
JSR ASM65816.EXPR GET SOURCE BANK
|
||||
LDA EXP.VALUE+2
|
||||
PHA
|
||||
JSR ASM65816.GNC
|
||||
CMP #',' MUST HAVE COMMA HERE
|
||||
BNE .1 ...ILLEGAL
|
||||
JSR ASM65816.EXP1 GET DESTINATION BANK
|
||||
LDA EXP.VALUE+2
|
||||
JSR ASM65816.EMIT
|
||||
PLA
|
||||
JMP ASM65816.EMIT
|
||||
.1 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
OP.JUMPS
|
||||
JSR GENERAL.OPERAND
|
||||
LDA LEGAL.JUMP.MODES,Y
|
||||
BMI .4 ...ILLEGAL
|
||||
ORA OPBASE
|
||||
TAY
|
||||
LDA LEVEL.MASK
|
||||
BMI .1 65816, ALLOW ALL MODES
|
||||
CPY #5 DISALLOW JML, JSL, AND PEA
|
||||
BCS .4 ...ONE OF THOSE
|
||||
CPY #1 DISALLOW JMP LONG
|
||||
BEQ .4
|
||||
AND #$20 SEE IF 65C02
|
||||
BNE .1 ...YES
|
||||
CPY #3 ...NO, DISALLOW JMP (ABS,X)
|
||||
BEQ .4 ...THAT'S WHAT IT IS...
|
||||
.1 LDA JUMP.OPCODES,Y
|
||||
BEQ .4 ...ILLEGAL
|
||||
LDY #2 ASSUME TWO BYTE ADDRESS
|
||||
CMP #$5C CHECK FOR "JMP LONG"
|
||||
BEQ .2 ...YES, 3 BYTES OF ADDRESS
|
||||
CMP #$22 CHECK FOR "JSL"
|
||||
BNE .3 ...NO, ONLY 2 BYTES OF ADDRESS
|
||||
.2 INY 3 BYTE ADDRESS
|
||||
.3 STY ADDR.LENGTH
|
||||
JMP EMIT.OP.AND.VALUE
|
||||
.4 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
ASM65816.TEST.EXP.VALUE.ZP
|
||||
LDA EXP.VALUE+1
|
||||
ORA EXP.VALUE+2
|
||||
ORA EXP.VALUE+3
|
||||
RTS
|
||||
*--------------------------------
|
||||
LONG.INDIRECT
|
||||
JSR ASM65816.EXP1
|
||||
JSR ASM65816.GNC
|
||||
CMP #']'
|
||||
BNE ERBA.EMIT.TWO
|
||||
JSR ASM65816.GNC
|
||||
BEQ .1 ...[EXP]
|
||||
CMP #','
|
||||
BNE ERBA.EMIT.TWO
|
||||
JSR ASM65816.GNC.UC
|
||||
CMP #'Y'
|
||||
BNE ERBA.EMIT.TWO
|
||||
LDA #$47 ...[EXP],Y
|
||||
.HS 2C
|
||||
.1 LDA #$44 ...[EXP],Y
|
||||
STA MODE.BYTE
|
||||
LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP CHECK.IF.SUFFIX.LEGAL
|
||||
*--------------------------------
|
||||
IMMEDIATE
|
||||
JSR ASM65816.GNC.UC
|
||||
CMP DLIM 16-BIT IMMEDIATE?
|
||||
BNE .1 ...NO, BACKUP
|
||||
LDA LEVEL.MASK 16-BIT IMMEDIATE OKAY?
|
||||
BPL ERBA.EMIT.TWO ...NOT AT 65816 LEVEL
|
||||
INC ADDR.LENGTH ...YES, INCREASE LENGTH
|
||||
BNE .2 ...ALWAYS
|
||||
.1 DEC CHAR.PNTR
|
||||
.2 JSR ASM65816.EXP1
|
||||
JSR ASM65816.GNC
|
||||
BNE ERBA.EMIT.TWO ILLEGAL
|
||||
LDA DLIM
|
||||
CMP #'/' #=23, /=2F, ^=5E
|
||||
BCC .4 ...#
|
||||
BEQ .3 .../
|
||||
JSR ASM65816.EXP.OVER.256 ...^
|
||||
.3 JSR ASM65816.EXP.OVER.256
|
||||
.4 LDY #0 SIGNAL IMMEDIATE MODE
|
||||
STY MODE.BYTE COPS NEEDS THIS <<<12-16-85>>>
|
||||
RTS
|
||||
*--------------------------------
|
||||
ERBA.EMIT.THREE
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ERBA.EMIT.TWO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
JSR ASM65816.EMIT.ZERO
|
||||
ASM65816.ERBA
|
||||
LDA #ERR.BAD.ADDRESS
|
||||
JMP ASM65816.ASM.ERROR
|
||||
ASM65816.EMIT.ZERO LDA #0
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
* RETURN:
|
||||
* # BYTES IN ADDRESS IN ADDR.LENGTH
|
||||
* (Y) = INDEX TO ADDR.MODE.BITS
|
||||
*--------------------------------
|
||||
GENERAL.OPERAND
|
||||
JSR ASM65816.GNNB GET NEXT NON-BLANK
|
||||
BCS ERBA.EMIT.TWO ...NO OPERAND
|
||||
*---PARSE PREFIX-----------------
|
||||
LDY #1
|
||||
STY ADDR.LENGTH
|
||||
STA DLIM
|
||||
CMP #'('
|
||||
BEQ .3 ...indirect, must be ZP
|
||||
CMP #'['
|
||||
BEQ LONG.INDIRECT
|
||||
CMP #'#'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'/'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'^'
|
||||
BEQ IMMEDIATE
|
||||
CMP #'<'
|
||||
BEQ .3 MAKE FORCE SIZE = 1
|
||||
DEY Y=0
|
||||
CMP #'>'
|
||||
BNE .2 ...SIZE NOT FORCED
|
||||
JSR ASM65816.GNC
|
||||
LDY #3 Y=3
|
||||
CMP DLIM IS IT ">>"?
|
||||
BEQ .3 ...YES
|
||||
DEY Y=2
|
||||
STA DLIM CHANGE DLIM TO NEW VALUE
|
||||
CMP #'(' IS IT (?
|
||||
BEQ .3 ...YES, >(
|
||||
.2 DEC CHAR.PNTR ...NO, SO BACKUP
|
||||
.3 STY FORCE.ADDR.SIZE
|
||||
*---PARSE THE EXPRESSION---------
|
||||
JSR ASM65816.EXP1
|
||||
*---FIGURE # OF BYTES------------
|
||||
LDX FORCE.ADDR.SIZE
|
||||
BNE .6 ...FORCED WITH <, >, OR >>
|
||||
LDX #2 ASSUME 2-BYTE ADDRESS
|
||||
LDA EXP.UNDEF
|
||||
BMI .6
|
||||
LDA PASS IGNORE FWD REF FLAG IN PASS 1
|
||||
BEQ .4 ...PASS 1
|
||||
LDA EXP.FWDREF ...PASS 2, DEFINED
|
||||
BNE .4 ...BUT NOT FWD REF
|
||||
LDA EXP.VALUE+3 ...FWD REF MUST BE ONLY
|
||||
ORA EXP.VALUE+2 16 BITS
|
||||
BEQ .6 ...IT FITS!
|
||||
BNE ERBA.1 ...ALWAYS, ERBA
|
||||
.4 LDA EXP.VALUE+3 DO NOT ALLOW 32-BITS
|
||||
BNE ERBA.1 ...BAD ADDR
|
||||
LDA EXP.VALUE+2
|
||||
BNE .5 ...3-BYTE ADDRESS
|
||||
DEX X=1
|
||||
LDA EXP.VALUE+1
|
||||
BEQ .6 ...ZP
|
||||
.5 INX
|
||||
.6 STX ADDR.LENGTH
|
||||
*---PARSE SUFFIX-----------------
|
||||
DEX MAKE 0, 1, OR 2
|
||||
STX MODE.BYTE
|
||||
LDX #6
|
||||
.7 JSR ASM65816.GNC.UC
|
||||
.8 CMP MODE.CHARS,X
|
||||
BEQ .9
|
||||
CLC
|
||||
ROL MODE.BYTE
|
||||
DEX
|
||||
BPL .8
|
||||
BMI ERBA.1
|
||||
.9 CMP #' ' BLANK?
|
||||
BEQ CHECK.IF.SUFFIX.LEGAL ...YES, END OF OPERAND
|
||||
CMP #')' RIGHT PAREN?
|
||||
BNE .10 ...NO
|
||||
LDA DLIM WAS THERE A LEFT PAREN?
|
||||
CMP #'('
|
||||
BNE ERBA.1 ...NO
|
||||
.10 SEC
|
||||
ROL MODE.BYTE
|
||||
DEX
|
||||
BPL .7
|
||||
ERBA.1 JMP ERBA.EMIT.TWO ILLEGAL
|
||||
*--------------------------------
|
||||
CHECK.IF.SUFFIX.LEGAL
|
||||
LDY #0 SEARCH FORWARD FOR VARIOUS REASONS
|
||||
LDA MODE.BYTE
|
||||
.13 INY
|
||||
CPY #MODE.TABLE.SIZE+1
|
||||
BCS ERBA.1 ...END OF TABLE
|
||||
CMP MODE.TABLE-1,Y
|
||||
BNE .13 ...KEEP LOOKING
|
||||
RTS
|
||||
*--------------------------------
|
||||
SEE.IF.MODE.LEGAL.AT.LEVEL
|
||||
LDA LEVEL.MASK
|
||||
BMI .15 ...65816 LEVEL, ALL LEGAL
|
||||
CPY #9
|
||||
BCC .15 ...6502 MODES
|
||||
BEQ .14 ...65C02 MODE
|
||||
CPY #16
|
||||
BNE ERBA.1
|
||||
.14 AND #$20 AT C02 LEVEL?
|
||||
BEQ ERBA.1 ...NO
|
||||
.15 RTS
|
||||
*--------------------------------
|
||||
ASM65816.EXP.OVER.256
|
||||
LDA EXP.VALUE+1
|
||||
STA EXP.VALUE
|
||||
LDA EXP.VALUE+2
|
||||
STA EXP.VALUE+1
|
||||
LDA EXP.VALUE+3
|
||||
STA EXP.VALUE+2
|
||||
LDA #0
|
||||
STA EXP.VALUE+3
|
||||
RTS
|
||||
.DO ROCKWELL
|
||||
*--------------------------------
|
||||
* ROCKWELL 65C02 EXCLUSIVES
|
||||
*
|
||||
* RMB bit#,zp
|
||||
* SMB bit#,zp
|
||||
* BBR bit#,zp,reladdr
|
||||
* BBS bit#,zp,reladdr
|
||||
*--------------------------------
|
||||
OP.ROCKB
|
||||
JSR OP.ROCKWELL
|
||||
JSR ASM65816.GNC REQUIRE A COMMA
|
||||
CMP #','
|
||||
BNE .1 ...NO COMMA
|
||||
LDA EXP.VALUE
|
||||
PHA SAVE ZP VALUE
|
||||
JSR ASM65816.EXP1 GET BRANCH EXPRESSION
|
||||
JSR EMIT.OPBASE <<<12-16-85>>>
|
||||
PLA
|
||||
JMP OP.REL8.A
|
||||
.1 JMP ERBA.EMIT.THREE
|
||||
*--------------------------------
|
||||
OP.ROCKC
|
||||
JSR OP.ROCKWELL
|
||||
.FIN
|
||||
EMIT.OP.AND.EXP.BYTE
|
||||
JSR EMIT.OPBASE <<<12-16-85>>>
|
||||
JMP EMIT.EXP.BYTE <<<12-16-85>>>
|
||||
*--------------------------------
|
||||
.DO ROCKWELL
|
||||
OP.ROCKWELL
|
||||
JSR ASM65816.EXPR GET BIT #
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .1 ...MUST BE SMALL NUMBER!
|
||||
LDA EXP.VALUE
|
||||
CMP #8 MUST BE 0...7
|
||||
BCS .1 ...TOO LARGE
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ORA OPBASE MERGE INTO OPCODE
|
||||
STA OPBASE
|
||||
JSR ASM65816.GNC NEED A COMMA NOW
|
||||
CMP #','
|
||||
BNE .1
|
||||
JSR ASM65816.EXP1 GET ZP VALUE
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE .1 MUST BE ZERO PAGE
|
||||
RTS
|
||||
.1 JMP ERBA.EMIT.TWO
|
||||
*--------------------------------
|
||||
.ELSE
|
||||
OP.ROCKB
|
||||
OP.ROCKC
|
||||
JMP BADOPERR
|
||||
.FIN
|
||||
|
||||
.DO SWEET.16
|
||||
*--------------------------------
|
||||
* SWEET-16 OPCODES
|
||||
*--------------------------------
|
||||
OP.POP
|
||||
JSR ASM65816.GNC.UC SEE WHICH: POP OR POPD
|
||||
BEQ OP.XN ...POP
|
||||
CMP #'D'
|
||||
BEQ .1
|
||||
JMP BADOPERR
|
||||
.1 LDA #$A2 ...POP
|
||||
STA OPBASE
|
||||
*--------------------------------
|
||||
OP.XN
|
||||
JSR ASM65816.GNNB
|
||||
BCS SWEET.ERBA
|
||||
CMP #'@'
|
||||
BNE .1 ...NOT '@N'
|
||||
LDA OPBASE ...'@N', SEE IF LEGAL
|
||||
AND #2
|
||||
BEQ SWEET.ERBA ...NOT LEGAL WITH THIS OP
|
||||
LDA OPBASE ...LEGAL, ADD $20
|
||||
ADC #$1F .CS., SO 1F IS 20
|
||||
BNE .2 ...ALWAYS
|
||||
.1 DEC CHAR.PNTR Backup character pointer
|
||||
LDA OPBASE
|
||||
LSR
|
||||
BCC SWEET.ERBA 'N' NOT LEGAL FOR THIS OP
|
||||
LDA OPBASE
|
||||
.2 AND #$F0 CLEAR AWAY LEGALITY FLAGS
|
||||
STA OPBASE
|
||||
JSR ASM65816.EXP1 GET REGISTER NUMBER
|
||||
JSR ASM65816.TEST.EXP.VALUE.ZP
|
||||
BNE SWEET.RAER
|
||||
LDA EXP.VALUE
|
||||
CMP #$10
|
||||
BCS SWEET.RAER
|
||||
ORA OPBASE
|
||||
JMP ASM65816.EMIT
|
||||
*--------------------------------
|
||||
SWEET.ERBA JMP ASM65816.ERBA
|
||||
SWEET.RAER JMP ASM65816.RAER
|
||||
*--------------------------------
|
||||
OP.SET
|
||||
JSR OP.XN
|
||||
JSR ASM65816.GNC
|
||||
CMP #','
|
||||
BNE SWEET.ERBA
|
||||
JSR ASM65816.EXP1
|
||||
LDA #2
|
||||
STA ADDR.LENGTH
|
||||
JMP ASM65816.EMIT.VALUE
|
||||
*--------------------------------
|
||||
.ELSE
|
||||
OP.POP
|
||||
OP.XN
|
||||
OP.SET
|
||||
JMP BADOPERR
|
||||
.FIN
|
||||
*--------------------------------
|
||||
LEGAL.JUMP.MODES
|
||||
.HS FF.00.00.FF.FF.FF
|
||||
.HS FF.FF.03.02.FF.FF
|
||||
.HS 01.FF.02.FF.03
|
||||
*--------------------------------
|
||||
JUMP.OPCODES
|
||||
.HS 4C.5C.6C.7C JMP
|
||||
.HS 20.22.00.FC JSR
|
||||
.HS 00.00.DC.00 JML
|
||||
.HS 22.22.00.00 JSL
|
||||
.HS F4.00.00.00 PEA
|
||||
*--------------------------------
|
||||
MODE.CHARS
|
||||
.AS / Y,)SX,/
|
||||
*--------------------------------
|
||||
MODE.TABLE
|
||||
.HS 00 1 -- DIRECT
|
||||
.HS 40 2 -- ABSOLUTE
|
||||
.HS 30 3 -- DIRECT,X
|
||||
.HS 70 4 -- ABSOLUTE,X
|
||||
.HS 21 5 -- DIRECT,Y
|
||||
.HS 61 6 -- ABSOLUTE,Y
|
||||
.HS 07 7 -- (DIRECT),Y
|
||||
.HS 34 8 -- (DIRECT,X)
|
||||
*---IN 65C02, 802, 816-----------
|
||||
.HS 04 9 -- (DIRECT)
|
||||
*---IN 65802, 816----------------
|
||||
.HS 28 A -- ...,S
|
||||
.HS 2F B -- (...,S),Y
|
||||
*---ONLY IN 65816----------------
|
||||
.HS 80 C -- LONG
|
||||
.HS B0 D -- LONG,X
|
||||
.HS 44 E -- >(DIRECT)
|
||||
.HS 47 F -- >(DIRECT),Y
|
||||
*---SPECIAL FOR JMP,JSR (A,X)----
|
||||
.HS 74 10 -- (ABSOLUTE,X)
|
||||
MODE.TABLE.SIZE .EQ *-MODE.TABLE
|
||||
*--------------------------------
|
||||
ADDR.MODE.BITS.CLASS.1
|
||||
.HS 08 0 -- IMMEDIATE
|
||||
.HS 04 1 -- DIRECT
|
||||
.HS 0C 2 -- ABSOLUTE
|
||||
.HS 14 3 -- DIRECT,X
|
||||
.HS 1C 4 -- ABSOLUTE,X
|
||||
.HS FF 5 -- DIRECT,Y <<<NOT LEGAL>>>
|
||||
.HS 18 6 -- ABSOLUTE,Y
|
||||
.HS 10 7 -- (DIRECT),Y
|
||||
.HS 00 8 -- (DIRECT,X)
|
||||
*---IN 65C02, 802, 816-----------
|
||||
.HS 13 9 -- (DIRECT)
|
||||
*---IN 65802, 816----------------
|
||||
.HS 02 A -- ...,S
|
||||
.HS 12 B -- (...,S),Y
|
||||
*---ONLY IN 65816----------------
|
||||
.HS 0E C -- LONG
|
||||
.HS 1E D -- LONG,X
|
||||
.HS 06 E -- >(DIRECT)
|
||||
.HS 16 F -- >(DIRECT),Y
|
||||
*--------------------------------
|
||||
ADDR.MODE.BITS.CLASS.5
|
||||
.HS 00 0 -- IMMEDIATE
|
||||
.HS 04 1 -- DIRECT
|
||||
.HS 0C 2 -- ABSOLUTE
|
||||
.HS 14 3 -- DIRECT,X
|
||||
.HS 1C 4 -- ABSOLUTE,X
|
||||
.HS 14 5 -- DIRECT,Y
|
||||
.HS 1C 6 -- ABSOLUTE,Y
|
||||
*--------------------------------
|
||||
CLASS.5.MODE.MASKS
|
||||
.HS 80.40.20.10.08.04.02
|
||||
*--------------------------------
|
||||
FIRST.LETTER.TABLE
|
||||
.DA #LTR.A-OPCODE.TABLE
|
||||
.DA #LTR.B-OPCODE.TABLE
|
||||
.DA #LTR.C-OPCODE.TABLE
|
||||
.DA #LTR.D-OPCODE.TABLE
|
||||
.DA #LTR.E-OPCODE.TABLE
|
||||
.DA #LTR.F-OPCODE.TABLE
|
||||
.DA #LTR.G-OPCODE.TABLE
|
||||
.DA #LTR.H-OPCODE.TABLE
|
||||
.DA #LTR.I-OPCODE.TABLE
|
||||
.DA #LTR.J-OPCODE.TABLE
|
||||
.DA #LTR.K-OPCODE.TABLE
|
||||
.DA #LTR.L-OPCODE.TABLE
|
||||
.DA #LTR.M-OPCODE.TABLE
|
||||
.DA #LTR.N-OPCODE.TABLE
|
||||
.DA #LTR.O-OPCODE.TABLE
|
||||
.DA #LTR.P-OPCODE.TABLE
|
||||
.DA #LTR.Q-OPCODE.TABLE
|
||||
.DA #LTR.R-OPCODE.TABLE
|
||||
.DA #LTR.S-OPCODE.TABLE
|
||||
.DA #LTR.T-OPCODE.TABLE
|
||||
.DA #LTR.U-OPCODE.TABLE
|
||||
.DA #LTR.V-OPCODE.TABLE
|
||||
.DA #LTR.W-OPCODE.TABLE
|
||||
.DA #LTR.X-OPCODE.TABLE
|
||||
.DA #LTR.Y-OPCODE.TABLE
|
||||
.DA #LTR.Z-OPCODE.TABLE
|
||||
*--------------------------------
|
||||
* TWO KINDS OF ENTRIES, DISTINGUISHED BY FIRST BIT:
|
||||
* 8-BIT ENTRIES: FIRST BIT = 0
|
||||
* 24-BIT ENTRIES: FIRST BIT = 1
|
||||
*
|
||||
* FIRST ENTRY AT EACH LETTER IS AN 8-BIT ENTRY.
|
||||
* EACH 8-BIT ENTRY IS FOLLOWED BY ONE OR MORE
|
||||
* 24-BIT ENTRIES.
|
||||
* THE SUB-LIST OF 24-BIT ENTRIES IS TERMINATED
|
||||
* BY THE NEXT 8-BIT ENTRY.
|
||||
* THE LIST OF 8-BIT ENTRIES IS TERMINATED BY
|
||||
* AN 8-BIT ENTRY WITH BIT 6 = 1.
|
||||
*
|
||||
* THE VALUE OF BITS 5-0 IN AN 8-BIT ENTRY
|
||||
* IS THE DIMINISHED ASCII CODE FOR THE
|
||||
* SECOND LETTER OF AN OPCODE.
|
||||
* THE VALUE OF BITS 5-0 OF A 24-BIT ENTRY
|
||||
* IS THE DIMINISHED ASCII CODE FOR THE
|
||||
* THIRD LETTER OF AN OPCODE.
|
||||
* A...Z = $81...9A
|
||||
* BLANK = $E0
|
||||
* '1' = $F1
|
||||
* THE VALUE OF THE SECOND BYTE OF A 24-BIT
|
||||
* ENTRY IS AN OPCODE BASE.
|
||||
* THE THIRD BYTE OF A 24-BIT ENTRY HAS TWO PARTS:
|
||||
* BITS 4-1 ARE AN INDEX TO THE OP.MODE
|
||||
* JUMP TABLE IN ASM.65816
|
||||
* BITS 7-5 AND 0 ARE LEVEL MASK BITS.
|
||||
* 000XXXX0 = 6502 OPCODE
|
||||
* 000XXXX1 = SWEET-16
|
||||
* 001XXXX0 = 65C02
|
||||
* 010XXXX0 = ROCKWELL SPECIALS
|
||||
* 100XXXX0 = 65816
|
||||
*
|
||||
* LEVEL.MASK = $00 FOR 6502
|
||||
* = $20 FOR 65C02
|
||||
* = $60 FOR ROCKWELL C02
|
||||
* = $A0 FOR 65816
|
||||
*--------------------------------
|
||||
OP..1 .SE 0
|
||||
OP..2 .SE 0
|
||||
.MA OP
|
||||
.DO "]1"=OP..1=0
|
||||
LTR.]1 .DA #"]2"-$80 bits 76 = 01
|
||||
OP..1 .SE "]1"
|
||||
OP..2 .SE "]2"
|
||||
.ELSE
|
||||
.DO "]2"=OP..2=0
|
||||
.DA #"]2"-$C0 bits 76 = 00
|
||||
OP..2 .SE "]2"
|
||||
.FIN
|
||||
.FIN
|
||||
.DA #"]3"^$40,#$]4,#O..]5!O..]6 bits 76 = 10 or 11
|
||||
.EM
|
||||
*--------------------------------
|
||||
O..65816 .EQ $80
|
||||
O..65R02 .EQ $40
|
||||
O..65C02 .EQ $20
|
||||
O..SWEET .EQ $01
|
||||
O.. .EQ $00
|
||||
*--------------------------------
|
||||
OPCODE.TABLE
|
||||
LTR.F
|
||||
LTR.G
|
||||
LTR.H
|
||||
LTR.K
|
||||
LTR.Q
|
||||
LTR.U
|
||||
LTR.V
|
||||
LTR.Y
|
||||
LTR.Z .HS 00
|
||||
*--------------------------------
|
||||
>OP A,D,C,61,COPS
|
||||
>OP A,D,D,A1,XN,SWEET
|
||||
>OP A,N,D,21,COPS
|
||||
>OP A,S,L,02,SHIFTS
|
||||
>OP B,C,C,90,REL8
|
||||
>OP B,C,S,B0,REL8
|
||||
>OP B,C," ",03,REL8,SWEET
|
||||
>OP B,E,Q,F0,REL8
|
||||
>OP B,G,E,B0,REL8
|
||||
>OP B,I,T,00,BITS
|
||||
>OP B,L,T,90,REL8
|
||||
>OP B,M,I,30,REL8
|
||||
>OP B,M," ",05,REL8,SWEET
|
||||
>OP B,M,1,08,REL8,SWEET
|
||||
>OP B,N,E,D0,REL8
|
||||
>OP B,N,C,02,REL8,SWEET
|
||||
>OP B,N,M,09,REL8,SWEET (BNM1)
|
||||
>OP B,N,Z,07,REL8,SWEET
|
||||
>OP B,P,L,10,REL8
|
||||
>OP B,P," ",04,REL8,SWEET
|
||||
>OP B,R,A,80,REL8,65C02
|
||||
>OP B,R,K,00,SNGL
|
||||
>OP B,R,L,82,REL16,65816
|
||||
>OP B,R," ",01,REL8,SWEET
|
||||
>OP B,V,C,50,REL8
|
||||
>OP B,V,S,70,REL8
|
||||
>OP B,B,R,0F,ROCKB,65R02
|
||||
>OP B,B,S,8F,ROCKB,65R02
|
||||
>OP B,K," ",0A,SNGL,SWEET
|
||||
>OP B,S," ",0C,REL8,SWEET
|
||||
>OP B,Z," ",06,REL8,SWEET
|
||||
>OP C,L,C,18,SNGL
|
||||
>OP C,L,D,D8,SNGL
|
||||
>OP C,L,I,58,SNGL
|
||||
>OP C,L,V,B8,SNGL
|
||||
>OP C,M,P,C1,COPS
|
||||
>OP C,O,P,02,CRS,65816
|
||||
>OP C,P,X,04,BITS
|
||||
>OP C,P,Y,03,BITS
|
||||
>OP C,P,R,D1,XN,SWEET
|
||||
>OP D,E,C,C2,SHIFTS
|
||||
>OP D,E,X,CA,SNGL
|
||||
>OP D,E,Y,88,SNGL
|
||||
>OP D,C,R,F1,XN,SWEET
|
||||
>OP E,O,R,41,COPS
|
||||
>OP I,N,C,E2,SHIFTS
|
||||
>OP I,N,X,E8,SNGL
|
||||
>OP I,N,Y,C8,SNGL
|
||||
>OP I,N,R,E1,XN,SWEET
|
||||
>OP J,M,L,08,JUMPS,65816
|
||||
>OP J,M,P,00,JUMPS
|
||||
>OP J,S,L,0C,JUMPS,65816
|
||||
>OP J,S,R,04,JUMPS
|
||||
>OP L,D,A,A1,COPS
|
||||
>OP L,D,X,02,BITS
|
||||
>OP L,D,Y,01,BITS
|
||||
>OP L,D," ",23,XN,SWEET
|
||||
>OP L,D,D,42,XN,SWEET
|
||||
>OP L,S,R,42,SHIFTS
|
||||
>OP M,V,N,54,MOVES,65816
|
||||
>OP M,V,P,44,MOVES,65816
|
||||
>OP N,O,P,EA,SNGL
|
||||
>OP O,R,A,01,COPS
|
||||
>OP P,E,A,10,JUMPS,65816
|
||||
>OP P,E,I,0A,BITS,65816
|
||||
>OP P,E,R,62,REL16,65816
|
||||
>OP P,H,A,48,SNGL
|
||||
>OP P,H,B,8B,SNGL,65816
|
||||
>OP P,H,D,0B,SNGL,65816
|
||||
>OP P,H,K,4B,SNGL,65816
|
||||
>OP P,H,P,08,SNGL
|
||||
>OP P,H,X,DA,SNGL,65C02
|
||||
>OP P,H,Y,5A,SNGL,65C02
|
||||
>OP P,L,A,68,SNGL
|
||||
>OP P,L,B,AB,SNGL,65816
|
||||
>OP P,L,D,2B,SNGL,65816
|
||||
>OP P,L,P,28,SNGL
|
||||
>OP P,L,X,FA,SNGL,65C02
|
||||
>OP P,L,Y,7A,SNGL,65C02
|
||||
>OP P,O,P,62,POP,SWEET (POP,POPD)
|
||||
>OP R,E,P,C2,CRS,65816
|
||||
>OP R,O,L,22,SHIFTS
|
||||
>OP R,O,R,62,SHIFTS
|
||||
>OP R,T,I,40,SNGL
|
||||
>OP R,T,L,6B,SNGL,65816
|
||||
>OP R,T,S,60,SNGL
|
||||
>OP R,T,N,00,SNGL,SWEET
|
||||
>OP R,M,B,07,ROCKC,65R02
|
||||
>OP R,S," ",0B,SNGL,SWEET
|
||||
>OP S,B,C,E1,COPS
|
||||
>OP S,E,C,38,SNGL
|
||||
>OP S,E,D,F8,SNGL
|
||||
>OP S,E,I,78,SNGL
|
||||
>OP S,E,P,E2,CRS,65816
|
||||
>OP S,E,T,11,SET,SWEET
|
||||
>OP S,T,A,81,COPS
|
||||
>OP S,T,P,DB,SNGL,65816
|
||||
>OP S,T,P,72,XN,SWEET
|
||||
>OP S,T,X,06,BITS
|
||||
>OP S,T,Y,05,BITS
|
||||
>OP S,T,Z,07,BITS,65C02
|
||||
>OP S,T," ",33,XN,SWEET
|
||||
>OP S,T,D,52,XN,SWEET
|
||||
>OP S,U,B,B1,XN,SWEET
|
||||
>OP S,M,B,87,ROCKC,65R02
|
||||
>OP T,A,X,AA,SNGL
|
||||
>OP T,A,Y,A8,SNGL
|
||||
>OP T,C,D,5B,SNGL,65816
|
||||
>OP T,C,S,1B,SNGL,65816
|
||||
>OP T,D,C,7B,SNGL,65816
|
||||
>OP T,R,B,09,BITS,65C02
|
||||
>OP T,S,B,08,BITS,65C02
|
||||
>OP T,S,C,3B,SNGL,65816
|
||||
>OP T,S,X,BA,SNGL
|
||||
>OP T,X,A,8A,SNGL
|
||||
>OP T,X,S,9A,SNGL
|
||||
>OP T,X,Y,9B,SNGL,65816
|
||||
>OP T,Y,A,98,SNGL
|
||||
>OP T,Y,X,BB,SNGL,65816
|
||||
>OP W,A,I,CB,SNGL,65816
|
||||
>OP W,D,M,42,SNGL,65816
|
||||
>OP X,B,A,EB,SNGL,65816
|
||||
>OP X,C,E,FB,SNGL,65816
|
||||
.HS 40 <<<TERMINATOR>>>
|
||||
*--------------------------------
|
||||
CLASS.5.OPS
|
||||
* BIT LDY LDX CPY CPX STY STX STZ
|
||||
.HS 20..A0..A2..C0..E0..80..82..60
|
||||
*
|
||||
* TSB TRB PEI
|
||||
.HS 00..10..D0
|
||||
*
|
||||
CLASS.5.LEGAL.MODES
|
||||
.HS F8..F8..E6..E0..E0..70..64..78
|
||||
.HS 60..60..40
|
||||
*
|
||||
* 80 -- IMMEDIATE
|
||||
* 40 -- DIRECT
|
||||
* 20 -- ABSOLUTE
|
||||
* 10 -- DIRECT,X
|
||||
* 08 -- ABSOLUTE,X
|
||||
* 04 -- DIRECT,Y
|
||||
* 02 -- ABSOLUTE,Y
|
||||
* 01 -- <<<NOT USED>>>
|
||||
*--------------------------------
|
||||
* OPCODE TABLE SELECTION
|
||||
* .OP 6502/65C02/R65C02/65816/SWEET16,...
|
||||
*--------------------------------
|
||||
DIR.OP LDA #0
|
||||
STA LEVEL.MASK
|
||||
LDA #15
|
||||
STA EMIT.MARGIN
|
||||
.1 JSR ASM65816.GNC.UC GET NEXT CHARACTER
|
||||
BCS .5 END
|
||||
LDY #-2
|
||||
.2 INY
|
||||
INY
|
||||
LDA PSOP.TABLE,Y
|
||||
BEQ .1 ...END OF TABLE, TRY NEXT CHARACTER
|
||||
CMP CURRENT.CHAR
|
||||
BNE .2 ...NOT THIS ONE
|
||||
.3 LDA PSOP.TABLE+1,Y
|
||||
STA LEVEL.MASK
|
||||
BPL .5
|
||||
LDA #18
|
||||
STA EMIT.MARGIN
|
||||
.5 RTS RETURN TO ASSEMBLER
|
||||
*--------------------------------
|
||||
PSOP.TABLE
|
||||
.DA #'8',#$A0 65816 = $A0
|
||||
.DA #'C',#$20 65C02 = $20
|
||||
.DO ROCKWELL
|
||||
.DA #'R',#$60 ROCKWELL= $60
|
||||
.FIN
|
||||
.DO SWEET.16
|
||||
.DA #'S',#$01 SWEET-16= $01
|
||||
.FIN
|
||||
.DA #0
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/asm65816.s
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
137
SCMASM.31/IO.S.IIE..txt
Normal file
137
SCMASM.31/IO.S.IIE..txt
Normal file
@ -0,0 +1,137 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP IIE.INIT
|
||||
JMP IIE.WARM
|
||||
JMP IIE.RDKEY
|
||||
JMP S.GET.HORIZ.POSN
|
||||
JMP MON.HOME
|
||||
JMP MON.CLREOL
|
||||
JMP MON.CLREOP
|
||||
JMP MON.UP
|
||||
JMP MON.LF
|
||||
JMP IIE.LEFT
|
||||
JMP IIE.RIGHT
|
||||
JMP IIE.COUT
|
||||
JMP IIE.PICK.SCREEN
|
||||
JMP IIE.HTABX
|
||||
JMP IIE.HTAB
|
||||
JMP IIE.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
IIE.INIT
|
||||
LDA $BF98
|
||||
AND #2
|
||||
BEQ IO.HOME
|
||||
LDA #$99 CTRL-Y
|
||||
JMP $C300
|
||||
*--------------------------------
|
||||
IIE.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR IIE.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.HTAB
|
||||
BIT $C01F
|
||||
BPL .1
|
||||
STA $57B
|
||||
RTS
|
||||
.1 STA CH
|
||||
RTS
|
||||
*--------------------------------
|
||||
S.GET.HORIZ.POSN
|
||||
LDA $57B
|
||||
BIT $C01F
|
||||
BMI .1
|
||||
LDA CH
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
IIE.WARM
|
||||
CLD
|
||||
LDX CV SAVE CV
|
||||
JSR MON.INIT
|
||||
TXA GET CV, FALL INTO VTAB
|
||||
IIE.VTAB
|
||||
STA CV
|
||||
JMP MON.VTAB
|
||||
*--------------------------------
|
||||
IIE.RDKEY
|
||||
LDA #40
|
||||
BIT $C01F
|
||||
BPL .1
|
||||
ASL
|
||||
.1 STA SCREEN.WIDTH
|
||||
JSR MON.RDKEY
|
||||
CMP #$FF
|
||||
BNE .2
|
||||
LDA #$88
|
||||
.2 ASL $C061 SET CARRY IF "OPEN APPLE" PRESSED
|
||||
ORA #$80
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.COUT
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .2 ...NORMAL
|
||||
BIT $C01F ...INVERSE; 40- OR 80-COLUMNS?
|
||||
BPL .2 ...40-COLUMN
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR MON.COUT
|
||||
PLA
|
||||
CMP #$20 CONTROL CHAR?
|
||||
BCS .1 ...NO
|
||||
ORA #$40 MAKE PRINTABLE CHARACTER
|
||||
.1 ORA #$80
|
||||
JSR MON.COUT
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.2 JMP MON.COUT
|
||||
*--------------------------------
|
||||
IIE.PICK.SCREEN
|
||||
BIT $C01F
|
||||
BMI .1
|
||||
LDA (BASL),Y
|
||||
RTS
|
||||
.1 TYA
|
||||
LSR
|
||||
TAY
|
||||
PHP
|
||||
SEI
|
||||
LDA $C055
|
||||
BCC .2
|
||||
LDA $C054
|
||||
.2 LDA (BASL),Y
|
||||
BIT $C054
|
||||
PLP
|
||||
PHA SAVE CHAR FROM SCREEN
|
||||
TYA RESTORE Y-REG
|
||||
ROL
|
||||
TAY
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
IIE.RIGHT
|
||||
BIT $C01F IN 80-COLUMN MODE?
|
||||
BMI .1 ...YES
|
||||
JMP MON.ADVANC
|
||||
.1 LDA #$9C FORWARD SPACE
|
||||
.HS 2C SKIP TWO BYTES
|
||||
*--------------------------------
|
||||
IIE.LEFT
|
||||
LDA #$88 BACKSPACE
|
||||
JMP MON.COUT
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/io.s.iie
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
270
SCMASM.31/IO.S.IIE.ULTRA.txt
Normal file
270
SCMASM.31/IO.S.IIE.ULTRA.txt
Normal file
@ -0,0 +1,270 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
* VIDEX ULTRATERM DRIVER -- ASSUME SLOT 3
|
||||
ULTRA.SLOT .EQ 3
|
||||
SKMOD .EQ 1 SHIFT KEY MOD (=0 FOR //E VERSION)
|
||||
*--------------------------------
|
||||
* TO MAKE THE EDIT COMMAND USE MORE THAN 24 LINES,
|
||||
* CHANGE $17 TO $1F OR $2F AT $803A
|
||||
*--------------------------------
|
||||
ULTRA.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
ULTRA.CARD .EQ ULTRA.SLOT*256+$C000
|
||||
ULTRA.COUT1 .EQ ULTRA.SLOT*256+$C007
|
||||
*--------------------------------
|
||||
ULTRA.REG .EQ ULTRA.SLOT*16+$C080
|
||||
ULTRA.DATA .EQ ULTRA.SLOT*16+$C081
|
||||
*--------------------------------
|
||||
ULTRA.HORIZ .EQ $0578+ULTRA.SLOT
|
||||
ULTRA.START .EQ $06F8+ULTRA.SLOT TOP-OF-SCREEN ADDRESS / 16
|
||||
ULTRA.CHPG .EQ $0678
|
||||
ULTRA.TEMPX .EQ $0778
|
||||
ULTRA.TEMPY .EQ $07F8
|
||||
ULTRA.FLAGS .EQ $07F8+ULTRA.SLOT
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP ULTRA.INIT
|
||||
JMP ULTRA.WARM
|
||||
JMP ULTRA.READ.KEY.WITH.CASE
|
||||
JMP ULTRA.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP ULTRA.PICK.SCREEN
|
||||
JMP ULTRA.HTABX
|
||||
JMP ULTRA.HTAB
|
||||
JMP ULTRA.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
LDA ULTRA.FLAGS
|
||||
EOR #$40
|
||||
STA ULTRA.FLAGS
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
ULTRA.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR ULTRA.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.GET.HORIZ.POSN
|
||||
LDA ULTRA.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.VTAB
|
||||
STA CV
|
||||
LDA ULTRA.HORIZ
|
||||
ULTRA.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR ULTRA.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
JSR .1
|
||||
LDA CV
|
||||
|
||||
.1 CLC ADD $A0 OFFSET
|
||||
ADC #$A0
|
||||
JMP ULTRA.COUT1
|
||||
*--------------------------------
|
||||
ULTRA.INIT
|
||||
LDA #80
|
||||
STA ULTRA.SCREEN.WIDTH
|
||||
LDA #$8C CLEAR SCREEN AND START VIDEX-80
|
||||
STA $C00B SWITCH OFF //E C3 ROM
|
||||
STA $C006 SWITCH OFF //E C100-C7FF ROM
|
||||
JSR ULTRA.CARD
|
||||
ULTRA.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA ULTRA.VECTORS,X
|
||||
STA $36,X
|
||||
STA ULTRA.SLOT*2+$BE10,X
|
||||
LDA ULTRA.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA ULTRA.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.VECTORS
|
||||
.DA ULTRA.COUT
|
||||
.DA ULTRA.RDKEY
|
||||
*--------------------------------
|
||||
ULTRA.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP ULTRA.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
ULTRA.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC COMMAND
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
ULTRA.RDKEY
|
||||
CLD
|
||||
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
|
||||
STA ULTRA.REG
|
||||
LDA #$67
|
||||
STA ULTRA.DATA
|
||||
LDA #$0B
|
||||
STA ULTRA.REG
|
||||
LDA #$08
|
||||
STA ULTRA.DATA
|
||||
.1 LDA $C000
|
||||
BPL .1
|
||||
STA $C010
|
||||
PHA
|
||||
LDA #$06 HIDE THE CURSOR
|
||||
STA ULTRA.DATA
|
||||
PLA
|
||||
CMP #$8D
|
||||
BNE .2
|
||||
JSR IO.CLREOL
|
||||
LDA #$8D
|
||||
.DO SKMOD
|
||||
.2 PHA CHECK SHIFT LOCK FLAG
|
||||
LDA ULTRA.FLAGS
|
||||
ASL
|
||||
ASL
|
||||
PLA
|
||||
BCC .5 ...SHIFT LOCK IS ON
|
||||
CMP #$C0
|
||||
BCC .5 NOT IN ALPHA RANGE
|
||||
BEQ .3 ...@ IS CAPITAL P
|
||||
ORA #$20 ADJUST TO LOWER CASE
|
||||
BIT $C063 TEST SHIFT KEY (PB3)
|
||||
BMI .5 ...NOT PRESSED, LOWER CASE
|
||||
CMP #$FB
|
||||
BCC .4 ...NORMAL A-Z
|
||||
.3 EOR #$10 CHANGE @ to P, [\]^_ to KLMNO
|
||||
.4 AND #$DF UPPER CASE
|
||||
.5 RTS
|
||||
.ELSE
|
||||
.2 RTS
|
||||
.FIN
|
||||
*--------------------------------
|
||||
ULTRA.COUT
|
||||
CLD
|
||||
PHA
|
||||
STA MON.INVFLG BIT 7 CONTROLS INV/NORM
|
||||
CMP #$20 CATCH INV CTRL CHARS
|
||||
BCS .1 ...NOT ONE
|
||||
ORA #$40 MAKE CTRL VISIBLE
|
||||
.1 JSR ULTRA.COUT1
|
||||
LDA #$FF
|
||||
STA MON.INVFLG
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
W16TBL .DA #80/16
|
||||
.DA #96/16
|
||||
.DA #160/16
|
||||
.DA #80/16
|
||||
.DA #80/16
|
||||
.DA #80/16
|
||||
.DA #160/16
|
||||
.DA #128/16
|
||||
*--------------------------------
|
||||
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
|
||||
*--------------------------------
|
||||
ULTRA.PICK.SCREEN
|
||||
STY ULTRA.TEMPY
|
||||
STX ULTRA.TEMPX
|
||||
BIT $CFFF
|
||||
BIT ULTRA.CARD TURN ON SCREEN
|
||||
*--------------------------------
|
||||
LDA ULTRA.FLAGS GET MODE (0...7)
|
||||
AND #$07
|
||||
TAY Y = MODE INDEX (0...7)
|
||||
*--------------------------------
|
||||
LDA ULTRA.TEMPY HORIZ. POSN
|
||||
CPY #$06 132 COL MODE?
|
||||
BNE .1 ...NOT 132 COLUMNS
|
||||
ADC #14 ADJUST FOR 132 COLUMN MODE
|
||||
.1 STA ULTRA.CHPG
|
||||
*--------------------------------
|
||||
LDX W16TBL,Y GET WIDTH/16
|
||||
LDA ULTRA.START CV*(WIDTH/16) + START
|
||||
.2 CLC INCLUDE 'CLC' IN LOOP ON PURPOSE
|
||||
ADC CV TO FORCE WRAP-AROUND
|
||||
DEX
|
||||
BNE .2
|
||||
*--------------------------------
|
||||
PHA
|
||||
LSR *16
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAX SAVE PAGE VALUE IN X-REG
|
||||
PLA
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
*--------------------------------
|
||||
CLC + CH (or CH+15 if 132 columns)
|
||||
ADC ULTRA.CHPG
|
||||
STA ULTRA.CHPG
|
||||
BCC .3
|
||||
INX ADD CARRY TO PAGE VALUE
|
||||
*--------------------------------
|
||||
.3 TXA GET PAGE VALUE
|
||||
AND #$0F
|
||||
ORA MODETBL,Y
|
||||
STA ULTRA.REG+2
|
||||
*--------------------------------
|
||||
ASL
|
||||
AND #$0C
|
||||
TAY
|
||||
LDA ULTRA.REG,Y
|
||||
TXA GET PAGE VALUE AGAIN
|
||||
LSR SET CARRY IF IN 2ND PAGE
|
||||
*--------------------------------
|
||||
LDY ULTRA.CHPG
|
||||
LDA $CC00,Y
|
||||
BCC .4
|
||||
LDA $CD00,Y
|
||||
.4 ORA #$80 MAKE HIGH ASCII
|
||||
LDY ULTRA.TEMPY RESTORE REGS
|
||||
LDX ULTRA.TEMPX
|
||||
RTS ALL DONE
|
||||
*--------------------------------
|
||||
MODETBL .HS 40 80X24 (VIDEOTERM EMULATION)
|
||||
.HS 50 96X24
|
||||
.HS 70 160X24
|
||||
.HS 50 80X24 INTERLACE
|
||||
.HS 50 80X32 INTERLACE
|
||||
.HS 50 80X48 INTERLACE
|
||||
.HS 70 132X24 INTERLACE
|
||||
.HS 70 128X32 INTERLACE
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/io.s.ultra
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
219
SCMASM.31/IO.S.IIE.VIDEX.txt
Normal file
219
SCMASM.31/IO.S.IIE.VIDEX.txt
Normal file
@ -0,0 +1,219 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
VIDEX.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
VIDEX.SLOT .EQ 3 ASSUME SLOT 3
|
||||
*--------------------------------
|
||||
VIDEX.CARD .EQ VIDEX.SLOT*256+$C000
|
||||
VIDEX.COUT1 .EQ VIDEX.SLOT*256+$C007
|
||||
VIDEX.REG .EQ VIDEX.SLOT*16+$C080
|
||||
VIDEX.DATA .EQ VIDEX.SLOT*16+$C081
|
||||
*--------------------------------
|
||||
VIDEX.BASEL .EQ $0478+VIDEX.SLOT
|
||||
VIDEX.BASEH .EQ $04F8+VIDEX.SLOT
|
||||
VIDEX.HORIZ .EQ $0578+VIDEX.SLOT
|
||||
VIDEX.CHAR .EQ $0678+VIDEX.SLOT
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP VIDEX.INIT
|
||||
JMP VIDEX.WARM
|
||||
JMP VIDEX.READ.KEY.WITH.CASE
|
||||
JMP VIDEX.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP VIDEX.PICK.SCREEN
|
||||
JMP VIDEX.HTABX
|
||||
JMP VIDEX.HTAB
|
||||
JMP VIDEX.VTAB
|
||||
*---Case Toggle MUST go here-----
|
||||
LDA CASEFLG
|
||||
EOR #$80
|
||||
STA CASEFLG
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
VIDEX.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR VIDEX.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.GET.HORIZ.POSN
|
||||
LDA VIDEX.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.VTAB
|
||||
STA CV
|
||||
LDA VIDEX.HORIZ
|
||||
VIDEX.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR VIDEX.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
CLC
|
||||
ADC #$A0
|
||||
JSR VIDEX.COUT1
|
||||
LDA CV
|
||||
ORA #$A0
|
||||
JMP VIDEX.COUT1
|
||||
*--------------------------------
|
||||
VIDEX.INIT
|
||||
LDA #80
|
||||
STA VIDEX.SCREEN.WIDTH
|
||||
STA CASEFLG CLEAR CASEFLG (BIT7=0)
|
||||
LDA #$8C CLEAR SCREEN AND START VIDEX-80
|
||||
JSR VIDEX.CARD
|
||||
VIDEX.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA VIDEX.VECTORS,X
|
||||
STA $36,X
|
||||
STA VIDEX.SLOT*2+$BE10,X
|
||||
LDA VIDEX.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA VIDEX.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.VECTORS
|
||||
.DA VIDEX.COUT
|
||||
.DA VIDEX.RDKEY
|
||||
*--------------------------------
|
||||
VIDEX.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP VIDEX.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
VIDEX.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC COMMAND
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.RDKEY
|
||||
CLD
|
||||
LDA #$0A SELECT BLINKING DOUBLE UNDERLINE CURSOR
|
||||
STA VIDEX.REG
|
||||
LDA #$67
|
||||
STA VIDEX.DATA
|
||||
LDA #$0B
|
||||
STA VIDEX.REG
|
||||
LDA #$08
|
||||
STA VIDEX.DATA
|
||||
.1 LDA $C000
|
||||
BPL .1
|
||||
STA $C010
|
||||
PHA
|
||||
LDA #$0A HIDE THE CURSOR
|
||||
STA VIDEX.REG
|
||||
LDA #$09
|
||||
STA VIDEX.DATA
|
||||
PLA
|
||||
CMP #$8D
|
||||
BNE .2
|
||||
JSR IO.CLREOL
|
||||
LDA #$8D
|
||||
.2 BIT CASEFLG TEST CASE CONVERSION FLAG
|
||||
BPL .6 DO NOT CONVERT
|
||||
CMP #$B0
|
||||
BCC .6 DO NOT CONVERT
|
||||
BIT $C063 TEST PADDLE BUTTON
|
||||
BMI .5 NO SHIFTKEY PRESSED
|
||||
CMP #$B0
|
||||
BEQ .4
|
||||
CMP #$C0
|
||||
BNE .3
|
||||
LDA #$D0
|
||||
.3 CMP #$DB
|
||||
BCC .6
|
||||
AND #$CF
|
||||
BNE .6
|
||||
.4 LDA #$DD
|
||||
.5 ORA #$20
|
||||
.6 AND #$7F
|
||||
STA VIDEX.CHAR
|
||||
ORA #$80
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
VIDEX.COUT
|
||||
CLD
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .1 ...NORMAL
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR VIDEX.COUT1
|
||||
PLA
|
||||
ORA #$80 MAKE PRINTABLE CHARACTER
|
||||
CMP #$A0
|
||||
BCS .2
|
||||
ORA #$40
|
||||
.2 JSR VIDEX.COUT1
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.1 JMP VIDEX.COUT1
|
||||
*--------------------------------
|
||||
* GET CHARACTER OFF CURRENT SCREEN LINE, COLUMN (Y)
|
||||
*--------------------------------
|
||||
VIDEX.PICK.SCREEN
|
||||
STX SAVEX
|
||||
BIT $CFFF TURN ON $C800 VIDEO SPACE
|
||||
BIT VIDEX.CARD
|
||||
*---CALCULATE POSITION-----------
|
||||
CLC
|
||||
TYA COLUMN 0-79
|
||||
ADC VIDEX.BASEL
|
||||
PHA
|
||||
LDA #0
|
||||
ADC VIDEX.BASEH
|
||||
PHA
|
||||
ASL
|
||||
AND #$0C USE BIT 0 AND 1 FOR PAGING
|
||||
TAX
|
||||
LDA VIDEX.REG,X
|
||||
PLA
|
||||
LSR ODD/EVEN PAGE
|
||||
PLA
|
||||
TAX
|
||||
*---GET CHAR FROM WINDOW---------
|
||||
LDA $CC00,X
|
||||
BCC .1
|
||||
LDA $CD00,X
|
||||
.1 ORA #$80
|
||||
STA VIDEX.CHAR
|
||||
LDX SAVEX
|
||||
RTS
|
||||
*--------------------------------
|
||||
SAVEX .BS 1
|
||||
CASEFLG .BS 1
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/io.s.videx
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
166
SCMASM.31/IO.S.STB80.txt
Normal file
166
SCMASM.31/IO.S.STB80.txt
Normal file
@ -0,0 +1,166 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.PH $A800
|
||||
*--------------------------------
|
||||
STB.SCREEN.WIDTH .EQ $A5
|
||||
*--------------------------------
|
||||
STB.SLOT .EQ 3
|
||||
*--------------------------------
|
||||
STB.HORIZ .EQ $05F8+STB.SLOT
|
||||
STB.ESCBYT .EQ $06F8+STB.SLOT
|
||||
STB.FLAGS .EQ $0778+STB.SLOT
|
||||
*--------------------------------
|
||||
STB.ENTRY .EQ STB.SLOT*256+$C000
|
||||
STB.RDKEY1 .EQ STB.SLOT*256+$C005
|
||||
STB.COUT1 .EQ STB.SLOT*256+$C019
|
||||
STB.SCREEN .EQ STB.SLOT*256+$C031
|
||||
*--------------------------------
|
||||
* I/O VECTORS -- 3 BYTES EACH
|
||||
*--------------------------------
|
||||
JMP STB.INIT
|
||||
JMP STB.WARM
|
||||
JMP STB.READ.KEY.WITH.CASE
|
||||
JMP STB.GET.HORIZ.POSN
|
||||
LDA #$8C ^L--HOME
|
||||
.HS 2C
|
||||
LDA #$9D ^]--CLREOL
|
||||
.HS 2C
|
||||
LDA #$8B ^K--CLREOP
|
||||
.HS 2C
|
||||
LDA #$9F ^_--UP
|
||||
.HS 2C
|
||||
LDA #$8A ^J--DOWN
|
||||
.HS 2C
|
||||
LDA #$88 ^H--LEFT
|
||||
.HS 2C
|
||||
LDA #$9C ^\--RIGHT
|
||||
NOP
|
||||
JMP MON.COUT
|
||||
JMP STB.PICK.SCREEN
|
||||
JMP STB.HTABX
|
||||
JMP STB.HTAB
|
||||
JMP STB.VTAB
|
||||
*---Case Change MUST go here-----
|
||||
LDA STB.FLAGS
|
||||
EOR #$40
|
||||
STA STB.FLAGS
|
||||
RTS
|
||||
*--------------------------------
|
||||
* VARIABLE LENGTH ROUTINES
|
||||
*--------------------------------
|
||||
STB.HTABX
|
||||
PHA
|
||||
TXA
|
||||
JSR STB.HTAB
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.GET.HORIZ.POSN
|
||||
LDA STB.HORIZ
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.VTAB
|
||||
STA CV
|
||||
LDA STB.HORIZ
|
||||
STB.HTAB
|
||||
PHA SAVE HORIZ POSN
|
||||
LDA #$9E
|
||||
JSR STB.COUT1
|
||||
PLA GET HORIZ POSN
|
||||
JSR .1
|
||||
LDA CV
|
||||
|
||||
.1 CLC
|
||||
ADC #$A0
|
||||
JMP STB.COUT1
|
||||
*--------------------------------
|
||||
STB.INIT
|
||||
LDA #80
|
||||
STA STB.SCREEN.WIDTH
|
||||
LDA #$8C CLEAR SCREEN AND START STB-80
|
||||
JSR STB.ENTRY
|
||||
LDA #0
|
||||
STA STB.ESCBYT DISABLE ^A AND ESC-MODE
|
||||
LDA #2 DISABLE "HOME" SENSING
|
||||
STA STB.FLAGS
|
||||
STB.INSTALL.VECTORS
|
||||
LDX #1
|
||||
.1 LDA STB.VECTORS,X
|
||||
STA $36,X
|
||||
STA STB.SLOT*2+$BE10,X
|
||||
LDA STB.VECTORS+2,X
|
||||
BIT F.EXEC
|
||||
BMI .2
|
||||
STA $38,X
|
||||
.2 STA STB.SLOT*2+$BE20,X
|
||||
DEX
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.VECTORS .DA STB.COUT
|
||||
.DA STB.RDKEY
|
||||
*--------------------------------
|
||||
STB.WARM
|
||||
CLD
|
||||
LDX CV
|
||||
JSR MON.INIT
|
||||
STX CV
|
||||
JMP STB.INSTALL.VECTORS
|
||||
*--------------------------------
|
||||
* READ KEY WITH CASE CONTROL
|
||||
*--------------------------------
|
||||
STB.READ.KEY.WITH.CASE
|
||||
JSR MON.RDKEY
|
||||
ORA #$80 REQUIRED FOR EXEC FILES
|
||||
CLC SIGNAL NO OPEN APPLE
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.RDKEY
|
||||
CLD
|
||||
LDA #$0A
|
||||
STA STB.SLOT*16+$C080
|
||||
LDA #$07 SOLID DBL LINE CURSOR
|
||||
STA STB.SLOT*16+$C081
|
||||
JSR STB.RDKEY1
|
||||
ORA #$80 Make sure it looks right
|
||||
PHA
|
||||
LDA #$0A
|
||||
STA STB.SLOT*16+$C080
|
||||
LDA #$20 CURSOR OFF
|
||||
STA STB.SLOT*16+$C081
|
||||
PLA
|
||||
RTS
|
||||
*--------------------------------
|
||||
STB.COUT
|
||||
CLD
|
||||
CMP #$80 NORMAL OR INVERSE?
|
||||
BCS .1 ...NORMAL
|
||||
PHA ...80-COLUMN
|
||||
LDA #$8F SELECT INVERSE DISPLAY
|
||||
JSR STB.COUT1
|
||||
PLA
|
||||
ORA #$80 MAKE PRINTABLE CHARACTER
|
||||
CMP #$A0
|
||||
BCS .2
|
||||
ORA #$40
|
||||
.2 JSR STB.COUT1
|
||||
LDA #$8E SELECT NORMAL DISPLAY
|
||||
.1 JMP STB.COUT1
|
||||
*--------------------------------
|
||||
STB.PICK.SCREEN
|
||||
STX $481
|
||||
TYA
|
||||
STA $482
|
||||
JSR STB.HTAB
|
||||
JSR STB.SCREEN
|
||||
LDY $482
|
||||
LDX $481
|
||||
RTS
|
||||
*--------------------------------------
|
||||
.EP
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/io.s.stb80
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
491
SCMASM.31/SCI.S.CAT.txt
Normal file
491
SCMASM.31/SCI.S.CAT.txt
Normal file
@ -0,0 +1,491 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* CATALOG COMMAND
|
||||
*--------------------------------
|
||||
CAT
|
||||
LDA #39
|
||||
.HS 2C SKIP OVER TWO BYTES
|
||||
CATALOG
|
||||
LDA #79
|
||||
STA CAT.WIDTH
|
||||
LDA #0 CLEAR ACCUMULATED BLOCKS COUNTER
|
||||
STA BLOCKS
|
||||
STA BLOCKS+1
|
||||
LDA FBITS TEST FOR TYPE AND PATHNAME
|
||||
AND #$05
|
||||
LSR PATHNAME BIT INTO CARRY
|
||||
BNE .1 ...TYPE STATED
|
||||
STA VAL.T SET T=0, LIST ALL TYPES
|
||||
.1 BCS .2 ...PATH GIVEN
|
||||
JSR GET.FILE.INFO NONE STATED, GET PREFIX
|
||||
BCS .8 ...ERROR
|
||||
*---GET DIRECTORY----------------
|
||||
.2 JSR OPEN.READ.DIR.HEADER
|
||||
BCS .8 ...ERROR
|
||||
LDY #0 Print directory pathname
|
||||
.15 LDA PATHNAME.ONE.BUFFER+1,Y
|
||||
ORA #$80
|
||||
JSR COUT
|
||||
INY
|
||||
CPY PATHNAME.ONE.BUFFER
|
||||
BCC .15
|
||||
JSR CROUT
|
||||
*---PRINT TITLES-----------------
|
||||
LDA #Q.DIRHDR
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
JSR PRINT.CATALOG.LINE
|
||||
*---IF NO MORE FILES, FINISHED---
|
||||
.3 LDA FILE.COUNT ANY FILES LEFT?
|
||||
ORA FILE.COUNT+1
|
||||
BEQ .7 ...NO, FINISHED
|
||||
*---NEXT FILE DESCRIPTION--------
|
||||
JSR READ.NEXT.ENTRY
|
||||
BCS .8 ...ERROR
|
||||
LDA VAL.T CHECK IF WE LIKE THIS TYPE
|
||||
BEQ .4 ...WE LIKE THEM ALL
|
||||
CMP DIRBUF+16 FILE TYPE
|
||||
BNE .5 ...NO, SKIP OVER IT
|
||||
.4 JSR FORMAT.CAT.ENTRY
|
||||
JSR PRINT.CATALOG.LINE PRINT IT
|
||||
*---CHECK FOR PAUSE/ABORT--------
|
||||
.5 JSR CHECK.KEY SEE IF KEYPRESS
|
||||
BMI .3 ...NO, CONTINUE CATALOG
|
||||
BEQ .7 ...<CR> or <ESC>, abort
|
||||
*---<CR> or <ESC>, so abort------
|
||||
.6 JSR CHECK.KEY
|
||||
BMI .6 WAIT FOR KEY
|
||||
BNE .3 ...NOT CR OR ESC, CONTINUE
|
||||
*---<CR> or <ESC>, abort---------
|
||||
.7 LDX CAT.INDEX
|
||||
LDA FILE.REFNUMS,X
|
||||
JSR CLOSE.ONE.FILE
|
||||
BCS .8 ...ERROR
|
||||
JMP FREE.BLOCKS FORMAT BLOCKS FREE ETC.
|
||||
.8 RTS
|
||||
*--------------------------------
|
||||
CHECK.KEY
|
||||
LDA $C000 SEE IF KEYSTROKE
|
||||
BPL .1 ...NO
|
||||
STA $C010 ...YES, CLEAR STROBE
|
||||
.1 EOR #$8D SET .EQ. IF <RET>
|
||||
BEQ .2 ...YES
|
||||
EOR #$8D^$9B OR IF <ESC>
|
||||
.2 RTS .MI. IF NO KEY
|
||||
*--------------------------------
|
||||
* FORMAT BLOCKS FREE/INUSE
|
||||
*--------------------------------
|
||||
FREE.BLOCKS
|
||||
JSR ZERO.ACCUM
|
||||
JSR BLANK.WBUF
|
||||
LDA #Q.BLOCKS.ABOVE
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
LDA BLOCKS
|
||||
LDX BLOCKS+1
|
||||
LDY #24
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
JSR PRINT.MESSAGE
|
||||
*--------------------------------
|
||||
LDA #PATHNAME.ONE.BUFFER+1 set up ONLINE call
|
||||
STA MISC.PARMS+2 to read volume name
|
||||
LDA /PATHNAME.ONE.BUFFER+1
|
||||
STA MISC.PARMS+3
|
||||
LDA UNIT
|
||||
STA MISC.PARMS+1
|
||||
JSR MLI.C5 ONLINE
|
||||
BCS .1 ...ERROR
|
||||
*---Setup GET FILE INFO call-----
|
||||
LDA PATHNAME.ONE.BUFFER+1
|
||||
AND #$0F
|
||||
TAX
|
||||
INX
|
||||
STX PATHNAME.ONE.BUFFER
|
||||
LDA #"/"
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
JSR GET.FILE.INFO
|
||||
BCS .1 ...ERROR
|
||||
*---Format the bottom line-------
|
||||
JSR BLANK.WBUF
|
||||
LDA #Q.BLOCKS
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
*---Total Blocks in Volume-------
|
||||
LDA GET.SET.PARMS+5
|
||||
LDX GET.SET.PARMS+6
|
||||
LDY #51
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---Blocks Used in Volume--------
|
||||
LDA GET.SET.PARMS+8
|
||||
LDX GET.SET.PARMS+9
|
||||
LDY #24
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---Blocks Free in Volume--------
|
||||
LDA GET.SET.PARMS+5
|
||||
SEC
|
||||
SBC GET.SET.PARMS+8
|
||||
PHA
|
||||
LDA GET.SET.PARMS+6
|
||||
SBC GET.SET.PARMS+9
|
||||
TAX
|
||||
PLA
|
||||
LDY #37
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
JSR PRINT.CATALOG.LINE
|
||||
CLC
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* OPEN/READ DIRECTORY HEADER
|
||||
*--------------------------------
|
||||
OPEN.READ.DIR.HEADER
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
STX CAT.INDEX
|
||||
LDX #$0F IS STORAGE TYPE = VOL DIR?
|
||||
CPX GET.SET.PARMS+7
|
||||
BNE .1 ...NO
|
||||
STX GET.SET.PARMS+4 ...YES, MAKE TYPE = DIR
|
||||
.1 LDA #$01 FILE MUST BE READABLE
|
||||
JSR OPEN.DIRECTORY
|
||||
BCS .3 ...ERROR
|
||||
|
||||
LDX CAT.INDEX
|
||||
STA FILE.REFNUMS,X
|
||||
LDA #DIRBUF
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /DIRBUF
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #$2B
|
||||
STA READ.WRITE.PARMS+4
|
||||
STA MISC.PARMS+2
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ
|
||||
BCS .3
|
||||
LDX #3
|
||||
.2 LDA DIRBUF+35,X ENTRY LENGTH, ENTRIES/BLOCK,
|
||||
STA ENTRY.LENGTH,X and FILE COUNT
|
||||
DEX
|
||||
BPL .2
|
||||
LDA #1
|
||||
STA ENTRY.COUNTER
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
* READ NEXT DIRECTORY ENTRY
|
||||
*--------------------------------
|
||||
READ.NEXT.ENTRY
|
||||
.1 LDY ENTRY.COUNTER
|
||||
CPY ENTRIES.PER.BLOCK
|
||||
BCC .2
|
||||
*---Skip ahead remainder bytes---
|
||||
LDA #4
|
||||
SBC MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+4
|
||||
JSR MLI.CA
|
||||
BCS .4 ...ERROR
|
||||
LDY #0
|
||||
LDA #4
|
||||
STA MISC.PARMS+2
|
||||
*---Read a file description------
|
||||
.2 INY NEXT ENTRY
|
||||
STY ENTRY.COUNTER
|
||||
LDA ENTRY.LENGTH
|
||||
STA READ.WRITE.PARMS+4
|
||||
ADC MISC.PARMS+2
|
||||
STA MISC.PARMS+2
|
||||
JSR MLI.CA READ
|
||||
BCS .4 ...ERROR
|
||||
*---Check if deleted file--------
|
||||
LDA DIRBUF
|
||||
AND #$F0
|
||||
BEQ .1 ...deleted
|
||||
*---Count the file---------------
|
||||
LDA FILE.COUNT
|
||||
BNE .3
|
||||
DEC FILE.COUNT+1
|
||||
.3 DEC FILE.COUNT
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
* FORMAT CATALOG ENTRY LINE
|
||||
*--------------------------------
|
||||
.DO LOWERCASE=1
|
||||
FORMAT.CAT.BITS .HS 8040201008040201
|
||||
.FIN
|
||||
FORMAT.CAT.ENTRY
|
||||
JSR BLANK.WBUF
|
||||
|
||||
.DO LOWERCASE=1
|
||||
lda DIRBUF+$1D
|
||||
bpl .18
|
||||
|
||||
lda DIRBUF
|
||||
and #$0f
|
||||
tay
|
||||
|
||||
.10 cpy #8
|
||||
bcs .13
|
||||
|
||||
lda DIRBUF+$1D
|
||||
and FORMAT.CAT.BITS,y
|
||||
beq .15
|
||||
|
||||
bne .14
|
||||
|
||||
.13 lda DIRBUF+$1C
|
||||
and FORMAT.CAT.BITS-8,y
|
||||
beq .15
|
||||
|
||||
.14 lda DIRBUF,y
|
||||
eor #$20
|
||||
sta DIRBUF,y
|
||||
|
||||
.15 dey
|
||||
bne .10
|
||||
|
||||
.18 .FIN
|
||||
|
||||
LDA DIRBUF LENGTH OF FILENAME
|
||||
AND #$0F
|
||||
TAY
|
||||
.1 LDA DIRBUF,Y
|
||||
ORA #$80
|
||||
STA WBUF+7,Y
|
||||
DEY
|
||||
BNE .1
|
||||
STY ACCUM+2
|
||||
*---GET FILE TYPE----------------
|
||||
LDA DIRBUF+16 FILE TYPE
|
||||
LDX #LAST.FILE.TYPE
|
||||
LDY #3 POINT INTO WBUF
|
||||
.2 CMP FILE.TYPES,X
|
||||
BEQ .3 ...MATCH!
|
||||
DEX
|
||||
DEX
|
||||
DEX
|
||||
DEX
|
||||
BPL .2
|
||||
JSR CONVERT.TO.HEX
|
||||
JMP .6
|
||||
.3 DEX
|
||||
LDA FILE.TYPES,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
BNE .3
|
||||
*---SKIP IF 40-COLUMN------------
|
||||
BIT CAT.WIDTH
|
||||
BVC .7
|
||||
*---Display AuxType--------------
|
||||
LDY #"R" Use "R=" if type TXT
|
||||
LDA DIRBUF+16 FILE TYPE
|
||||
CMP #$04
|
||||
BEQ .5 ...it is TXT
|
||||
CMP #$06 Use "A=" if type BIN
|
||||
BNE .6 ...not BIN, just show $xxxx
|
||||
LDY #"A" ...BIN
|
||||
.5 STY WBUF+73
|
||||
LDA #"="
|
||||
STA WBUF+74
|
||||
.6 LDY #78
|
||||
LDA DIRBUF+31 AUXTYPE
|
||||
JSR CONVERT.TO.HEX
|
||||
LDA DIRBUF+32 "
|
||||
JSR CONVERT.TO.HEX
|
||||
*---Show file length-------------
|
||||
LDA DIRBUF+23 EOF MARK MSB
|
||||
STA ACCUM+2
|
||||
LDA DIRBUF+21 EOF MARK
|
||||
LDX DIRBUF+22 " "
|
||||
LDY #70
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
*---CREATION DATE/TIME-----------
|
||||
LDX #$18 OFFSET IN DIRBUF
|
||||
LDY #61 OFFSET IN WBUF
|
||||
JSR FORMAT.DATE.AND.TIME
|
||||
*---Blocks in the file-----------
|
||||
.7 LDY #27
|
||||
LDA DIRBUF+19 BLOCKS IN USE
|
||||
LDX DIRBUF+20 "
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
CLC
|
||||
LDA BLOCKS
|
||||
ADC DIRBUF+19
|
||||
STA BLOCKS
|
||||
LDA BLOCKS+1
|
||||
ADC DIRBUF+20
|
||||
STA BLOCKS+1
|
||||
*---Access code------------------
|
||||
LDA DIRBUF+30 ACCESS
|
||||
AND #$C2
|
||||
CMP #$C2
|
||||
BEQ .8
|
||||
LDA #"*" LOCKED
|
||||
STA WBUF+1
|
||||
*---Modified Date/Time-----------
|
||||
.8 LDX #$21 OFFSET IN DIRBUF
|
||||
LDY #44 OFFSET IN WBUF
|
||||
*--------------------------------
|
||||
* FORMAT DATE & TIME
|
||||
* --MSB--- --LSB---
|
||||
* YYYYYYYM MMMDDDDD
|
||||
*--------------------------------
|
||||
FORMAT.DATE.AND.TIME
|
||||
LDA DIRBUF,X MMMDDDDD
|
||||
AND #$1F 000DDDDD
|
||||
BEQ .1 ...DAY=0, NO DATE
|
||||
STA DAY
|
||||
LDA DIRBUF+1,X YYYYYYYM
|
||||
LSR 0YYYYYYY
|
||||
STA YEAR
|
||||
CMP #100
|
||||
BCS .1 ...YEAR>99, NO DATE
|
||||
LDA DIRBUF+1,X YYYYYYYM
|
||||
LSR M INTO CARRY
|
||||
LDA DIRBUF,X MMMDDDDD
|
||||
ROL MMDDDDDM M
|
||||
ROL MDDDDDMM M
|
||||
ROL DDDDDMMM M
|
||||
ROL DDDDMMMM
|
||||
AND #$0F 0000MMMM
|
||||
BEQ .1 ...MONTH=0, NO DATE
|
||||
CMP #13
|
||||
BCC .3 ...MONTH=1...12, GOOD
|
||||
*---Format <NO DATE>-------------
|
||||
.1 TYA
|
||||
SEC
|
||||
SBC #6 BACK UP OVER TIME SLOT
|
||||
TAY
|
||||
LDX #8
|
||||
.2 LDA NO.DATE.MSG,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
DEX
|
||||
BPL .2
|
||||
RTS
|
||||
*---Format date, time------------
|
||||
.3 STA MONTH
|
||||
LDA DIRBUF+3,X HOURS
|
||||
PHA
|
||||
LDA DIRBUF+2,X MINUTES
|
||||
LDX #0 HIGH BYTE
|
||||
CMP #60 IF > 59, USE 0
|
||||
BCC .4 0...59
|
||||
TXA
|
||||
.4 JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDA #":" SEPARATE WITH ":"
|
||||
STA WBUF+2,Y
|
||||
PLA HOURS
|
||||
LDX #0 HIGH BYTE
|
||||
CMP #24 IF > 24, USE 0
|
||||
BCC .5 0...23
|
||||
TXA
|
||||
.5 JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDA YEAR
|
||||
JSR CONVERT.DECIMAL.TWO.DIGITS
|
||||
LDX MONTH
|
||||
LDA MONTH.NAMES-1+24,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA MONTH.NAMES-1+12,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA MONTH.NAMES-1,X
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA #"-"
|
||||
STA WBUF+5,Y
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA DAY
|
||||
LDX #0 HIGH BYTE
|
||||
* JMP CONVERT.TO.DECIMAL
|
||||
*--------------------------------
|
||||
* CONVERT TO DECIMAL
|
||||
*--------------------------------
|
||||
CONVERT.TO.DECIMAL
|
||||
STX ACCUM+1
|
||||
STA ACCUM
|
||||
.1 JSR DIVIDE.ACCUM.BY.TEN
|
||||
ORA #$B0
|
||||
JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA ACCUM
|
||||
ORA ACCUM+1
|
||||
ORA ACCUM+2
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONVERT 2 DIGIT NUMBER
|
||||
*--------------------------------
|
||||
CONVERT.DECIMAL.TWO.DIGITS
|
||||
CLC
|
||||
ADC #100 FORCE TWO DIGITS TO PRINT
|
||||
JSR CONVERT.TO.DECIMAL
|
||||
LDA #" " COVER UP THE "1"
|
||||
INY
|
||||
*--------------------------------
|
||||
STUFF.WBUF.AND.BACKUP
|
||||
STA WBUF+1,Y
|
||||
DEY
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CONVERT TO HEX
|
||||
*--------------------------------
|
||||
CONVERT.TO.HEX
|
||||
PHA
|
||||
AND #$0F
|
||||
JSR .1
|
||||
PLA
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
.1 ORA #$B0
|
||||
CMP #$BA
|
||||
BCC .2
|
||||
ADC #6
|
||||
.2 JSR STUFF.WBUF.AND.BACKUP
|
||||
LDA #"$"
|
||||
STA WBUF+1,Y
|
||||
RTS
|
||||
*--------------------------------
|
||||
* DIVIDE ACCUM BY TEN
|
||||
*--------------------------------
|
||||
* DIVIDE 24-BIT VALUE IN ACCUM BY TEN
|
||||
* RETURN REMAINDER IN A-REG
|
||||
*--------------------------------
|
||||
DIVIDE.ACCUM.BY.TEN
|
||||
LDX #24 24 BITS IN DIVIDEND
|
||||
LDA #0 START WITH REM=0
|
||||
.1 JSR SHIFT.ACCUM.LEFT
|
||||
ROL
|
||||
CMP #10
|
||||
BCC .2 ...STILL < 10
|
||||
SBC #10
|
||||
INC ACCUM QUOTIENT BIT
|
||||
.2 DEX NEXT BIT
|
||||
BNE .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
BLANK.WBUF
|
||||
LDA #" "
|
||||
LDY #79
|
||||
.1 JSR STUFF.WBUF.AND.BACKUP
|
||||
BPL .1
|
||||
RTS
|
||||
*--------------------------------
|
||||
NOW JSR GP.MLI
|
||||
.DA #$82,0000
|
||||
JSR BLANK.WBUF
|
||||
LDX #4
|
||||
.1 LDA GP.DATE-1,X
|
||||
STA DIRBUF-1,X
|
||||
DEX
|
||||
BNE .1
|
||||
LDY #15
|
||||
JSR FORMAT.DATE.AND.TIME
|
||||
LDA #20
|
||||
STA CAT.WIDTH
|
||||
*** JMP PRINT.CATALOG.LINE
|
||||
*--------------------------------
|
||||
PRINT.CATALOG.LINE
|
||||
LDX CAT.WIDTH
|
||||
LDA #$8D
|
||||
STA WBUF+1,X
|
||||
JSR PRINT.MESSAGE
|
||||
CLC because a SEC would indicate ERROR
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.cat
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
569
SCMASM.31/SCI.S.CPAR.txt
Normal file
569
SCMASM.31/SCI.S.CPAR.txt
Normal file
@ -0,0 +1,569 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
.DA COMMAND.TABLE needed for HELP command
|
||||
*--------------------------------
|
||||
* PARSE COMMAND LINE
|
||||
*--------------------------------
|
||||
PARSE.COMMAND
|
||||
JSR SCAN.COMMAND.TABLE
|
||||
BCS SYNERR2 ...SYNTAX ERROR
|
||||
LDA #0
|
||||
STA FBITS
|
||||
STA FBITS+1
|
||||
STA PATHNAME.TWO.BUFFER
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
LDA D.SLOT
|
||||
STA VAL.S
|
||||
LDA D.DRIV
|
||||
STA VAL.D
|
||||
*---Handle special cases---------
|
||||
BIT PBITS Check for PR# or IN#
|
||||
BVS PARSE.INPR PR# & IN# commands
|
||||
BPL .1 ...not CAT(ALOG) or PREFIX
|
||||
JSR MLI.C7 ...CAT, CATALOG, or PREFIX
|
||||
*---TEST CHAR AFTER COMMAND------
|
||||
.1 JSR GET.NEXT.NONBLANK
|
||||
BNE .2 ...not comma or <CR>
|
||||
BCC .5 ...<CR> already
|
||||
JMP GET.ANOTHER.PARM
|
||||
*---Get a pathname---------------
|
||||
.2 CMP #'/' MUST START WITH "/" OR LETTER
|
||||
BEQ .3
|
||||
CMP #'A'
|
||||
BCC SYNERR2 ...SYNTAX ERROR
|
||||
.3 DEX RE-SCAN THE FIRST CHAR OF PATH
|
||||
LDY #0
|
||||
.4 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
STA PATHNAME.ONE.BUFFER+1,Y
|
||||
JSR STORE.PATH.TWO.AND.TEST
|
||||
BCC .4
|
||||
DEY
|
||||
STY PATHNAME.ONE.BUFFER
|
||||
STY PATHNAME.TWO.BUFFER
|
||||
LDA #$01 TELL THE WORLD ABOUT IT
|
||||
STA FBITS
|
||||
*--------------------------------
|
||||
DEX RE-SCAN CHAR AFTER PATHNAME
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE SYNERR2 ...NOT COMMA OR <CR>
|
||||
BCS MORE.PARMS ...COMMA
|
||||
.5 JMP NO.MORE.PARMS ...<CR>
|
||||
SYNERR2
|
||||
JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
* PR# or IN# commands
|
||||
*--------------------------------
|
||||
PARSE.INPR
|
||||
JSR GET.NEXT.NONBLANK CHAR AFTER COMMAND
|
||||
BEQ SYNERR2 ...comma or <CR>
|
||||
DEX ...IN CASE IT IS "Axxx"
|
||||
CMP #'A'
|
||||
BEQ GET.ANOTHER.PARM ...HANDLE PR#Axxx or IN#Axxx
|
||||
INX RESTORE X
|
||||
JSR ZERO.ACCUM
|
||||
STY PARM.LENM1 Y=0, 1 BYTE PARM
|
||||
LDY #VAL.LB-VAL.A PARM OFFSET FROM VAL.A
|
||||
STY PARM.OFFSET
|
||||
LDY #$40
|
||||
STY FBITS
|
||||
JSR CONVERT.DECIMAL.NUMBER
|
||||
BCS RTS4
|
||||
LDA VAL.LB
|
||||
CMP #$08
|
||||
BCC TEST.IF.MORE.PARMS
|
||||
SCI.ERR.RANGE
|
||||
LDA #$02
|
||||
SEC
|
||||
RTS4 RTS
|
||||
*--------------------------------
|
||||
MORE.PARMS
|
||||
LDA PBITS
|
||||
LSR TEST BIT 0
|
||||
BCC SYNERR2 ...NO PATHNAME EXPECTED
|
||||
LSR TEST BIT 1
|
||||
BCC GET.ANOTHER.PARM ...NO PATH-TWO EXPECTED
|
||||
*---Get second pathname----------
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR2 ...COMMA OR <CR>
|
||||
DEX RE-SCAN FIRST CHAR OF PATHNAME
|
||||
LDY #0
|
||||
.1 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
JSR STORE.PATH.TWO.AND.TEST
|
||||
BCC .1
|
||||
DEY
|
||||
STY PATHNAME.TWO.BUFFER
|
||||
LDA #$03 WE GOT TWO PATHNAMES, SO
|
||||
STA FBITS MARK THE BITS
|
||||
DEX RE-SCAN TERM. CHAR
|
||||
*--------------------------------
|
||||
TEST.IF.MORE.PARMS
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE SYNERR2
|
||||
BCC NO.MORE.PARMS
|
||||
GET.ANOTHER.PARM
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR2 ...NULL PARAMETER
|
||||
JSR PARSE.PARAMETER
|
||||
BCC TEST.IF.MORE.PARMS
|
||||
RTS ...error return
|
||||
*--------------------------------
|
||||
NO.MORE.PARMS
|
||||
LDA VAL.S CHECK RANGE OF S AND D
|
||||
BEQ SCI.ERR.RANGE
|
||||
CMP #$08
|
||||
BCS SCI.ERR.RANGE
|
||||
LDA VAL.D
|
||||
BEQ SCI.ERR.RANGE
|
||||
CMP #$03
|
||||
BCS SCI.ERR.RANGE
|
||||
*---CHECK IF DEFERRED COMMAND----
|
||||
LDA PBITS (only OPEN and WRITE are deferred)
|
||||
AND #$21
|
||||
LSR
|
||||
BEQ .1 ...NOT DEFERRED
|
||||
LDA STATE ...ARE WE IN DIRECT MODE?
|
||||
BEQ .6 ...YES, DEFERRED IS ILLEGAL
|
||||
*---CHECK PATHNAME---------------
|
||||
.1 BCC .5 ...NO PATH PERMITTED
|
||||
LDA PBITS+1
|
||||
AND #$04 S OR D OK?
|
||||
BEQ .5 ...NO
|
||||
LDA FBITS
|
||||
LSR HAVE WE A PATHNAME?
|
||||
BCS .2 ...YES
|
||||
LDA PBITS ...NO, IS PATH NEEDED
|
||||
AND #$90
|
||||
BEQ ERR.SYNTAX ...YES
|
||||
BPL .5
|
||||
*---NEED PREFIX OR S,D-----------
|
||||
.2 LDA PATHNAME.ONE.BUFFER+1
|
||||
EOR #'/' SLASH
|
||||
BEQ .3 ...EXPLICIT PREFIX
|
||||
LDA PREFIX.FLAG MLI's flag
|
||||
BEQ .4 ...NO PREFIX IS SET
|
||||
.3 LDA FBITS+1 DID WE GET S,D?
|
||||
AND #$04
|
||||
BEQ .5 ...NO
|
||||
BCS .4 ...YES, AND THERE IS A PATHNAME
|
||||
LDA #0 ...YES, BUT NO PATHNAME
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
LDA #$01 SIGNAL WE GOT PATHNAME AFTER ALL
|
||||
ORA FBITS
|
||||
STA FBITS
|
||||
.4 JSR INSERT.VOLUME.NAME
|
||||
BCS .7
|
||||
*---BRANCH TO COMMAND------------
|
||||
.5 CLC SIGNAL NO ERROR
|
||||
LDA COMMAND.NUMBER
|
||||
BEQ EXTERNAL ...USER'S COMMAND
|
||||
EOR #CN.PREFIX
|
||||
BEQ INTERNAL ...PREFIX COMMAND
|
||||
LDA PBITS+1 ARE S/D VALID?
|
||||
AND #$04
|
||||
BEQ INTERNAL ...NO
|
||||
LDA FBITS ANY PATHNAME SPECIFIED?
|
||||
LSR
|
||||
BCC INTERNAL ...NO
|
||||
JSR GET.FILE.INFO ...YES
|
||||
BCC INTERNAL ...NO ERROR
|
||||
ORA #0 ...ERROR, WAS IT "FILE NOT FOUND"?
|
||||
BPL .7 ...NO, REAL ERROR
|
||||
LDA PBITS OKAY TO CREATE PATHNAME?
|
||||
AND #$08
|
||||
BNE INTERNAL ...YES
|
||||
LDA #$06 "PATH NOT FOUND"
|
||||
.HS 2C
|
||||
.6 LDA #$0F "NOT DIRECT COMMAND"
|
||||
SEC
|
||||
.7 RTS
|
||||
*--------------------------------
|
||||
INTERNAL JMP (COMMAND.ADDR)
|
||||
EXTERNAL JMP (EXTERNAL.COMMAND.HANDLER)
|
||||
*--------------------------------
|
||||
ERR.SYNTAX
|
||||
LDA #$10 SYNTAX ERROR
|
||||
ERRR SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* INSERT PREFIX BEFORE PATHNAME
|
||||
*--------------------------------
|
||||
INSERT.VOLUME.NAME
|
||||
LDA VAL.S BUILD UNIT # FROM SLOT,DRIVE
|
||||
TAY SAVE VAL.S
|
||||
LSR 0000.00SS S
|
||||
ROR S000.000S S
|
||||
ROR SS00.0000 S
|
||||
ROR SSS0.0000 0
|
||||
LDX VAL.D
|
||||
CPX #2 .CS. if 2, .CC. if 1
|
||||
ROR DSSS.0000
|
||||
STA MISC.PARMS+1
|
||||
LDA #WBUF+1
|
||||
STA MISC.PARMS+2
|
||||
LDA /WBUF+1
|
||||
STA MISC.PARMS+3
|
||||
JSR MLI.C5 ONLINE -- READ VOLUME NAME
|
||||
BCS .4 NO SUCH SLOT AND DRIVE
|
||||
STX D.DRIV UPDATE DEFAULT S AND D
|
||||
STY D.SLOT
|
||||
*--------------------------------
|
||||
LDA PATHNAME.ONE.BUFFER+1
|
||||
EOR #'/' ALREADY HAVE VOLUME NAME?
|
||||
BEQ .4 ...YES, DON'T NEED ANOTHER
|
||||
*---ISOLATE VOLNAME LENGTH-------
|
||||
LDA WBUF+1 DSSSLLLL
|
||||
AND #$0F 0000LLLL
|
||||
STA WBUF+1
|
||||
*---MOVE PATHNAMES OVER L+2------
|
||||
LDY #62
|
||||
TYA
|
||||
SEC
|
||||
SBC WBUF+1
|
||||
TAX
|
||||
.1 LDA PATHNAME.ONE.BUFFER,X
|
||||
STA PATHNAME.ONE.BUFFER+2,Y
|
||||
LDA PATHNAME.TWO.BUFFER,X
|
||||
STA PATHNAME.TWO.BUFFER+2,Y
|
||||
DEY
|
||||
DEX
|
||||
BNE .1
|
||||
*---INSERT VOLUME SLASHES--------
|
||||
LDA #'/'
|
||||
STA PATHNAME.ONE.BUFFER+2,Y
|
||||
STA PATHNAME.ONE.BUFFER+1
|
||||
STA PATHNAME.TWO.BUFFER+2,Y
|
||||
STA PATHNAME.TWO.BUFFER+1
|
||||
*---COPY VOLUME NAME-------------
|
||||
.2 LDA WBUF+1,Y
|
||||
STA PATHNAME.ONE.BUFFER+1,Y
|
||||
STA PATHNAME.TWO.BUFFER+1,Y
|
||||
DEY
|
||||
BNE .2
|
||||
*---UPDATE PATH LENGTHS----------
|
||||
CLC
|
||||
LDA WBUF+1
|
||||
ADC #2 INCLUDE SLASHES
|
||||
TAY
|
||||
ADC PATHNAME.ONE.BUFFER
|
||||
CMP #64
|
||||
.3 BCS ERR.SYNTAX
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
TYA
|
||||
ADC PATHNAME.TWO.BUFFER
|
||||
STA PATHNAME.TWO.BUFFER
|
||||
CMP #64
|
||||
BCS .3 ...BRIDGE TO SYNTAX ERROR
|
||||
*--------------------------------
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
SCAN.COMMAND.TABLE
|
||||
LDY #0 PNTR INTO COMMAND TABLE
|
||||
STY COMMAND.NUMBER
|
||||
DEY
|
||||
*---COMPARE COMMAND NAME---------
|
||||
.1 INC COMMAND.NUMBER
|
||||
LDX #0 PNTR INTO WBUF
|
||||
.2 INY next byte in command table
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ .4 ...end of WBUF contents
|
||||
EOR COMMAND.TABLE,Y
|
||||
BEQ .2 ...same so far
|
||||
ASL Might be last char
|
||||
BNE .4 ...No, try next command
|
||||
*---We found the command---------
|
||||
LDA COMMAND.TABLE+1,Y
|
||||
STA COMMAND.ADDR
|
||||
LDA COMMAND.TABLE+2,Y
|
||||
STA COMMAND.ADDR+1
|
||||
LDA COMMAND.TABLE+3,Y
|
||||
STA PBITS
|
||||
LDA COMMAND.TABLE+4,Y
|
||||
STA PBITS+1
|
||||
CLC
|
||||
RTS
|
||||
*---SKIP TO NEXT COMMAND---------
|
||||
.3 INY
|
||||
.4 LDA COMMAND.TABLE,Y
|
||||
BPL .3 ...NOT LAST CHAR YET
|
||||
INY SKIP OVER ADDRESS
|
||||
INY
|
||||
INY SKIP OVER PBITS
|
||||
INY
|
||||
LDA COMMAND.TABLE+1,Y
|
||||
BNE .1 ...more commands in table
|
||||
*---TRY EXTERNAL COMMAND---------
|
||||
LDA #$FF
|
||||
STA COMMAND.NUMBER
|
||||
SEC
|
||||
JMP SCI.USER.CMD
|
||||
*--------------------------------
|
||||
SYNERR1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
PARSE.PARAMETER
|
||||
JSR ZERO.ACCUM
|
||||
LDY #NO.PARM.NAMES-1
|
||||
.1 CMP PARM.NAMES,Y
|
||||
BEQ FOUND.PARM
|
||||
DEY
|
||||
BPL .1
|
||||
CMP #'T'
|
||||
BNE SYNERR1 ...SYNTAX ERROR
|
||||
*---PARSE T PARAMETER------------
|
||||
LDA #$04
|
||||
AND PBITS
|
||||
BEQ ERR.BADPARM
|
||||
ORA FBITS
|
||||
STA FBITS
|
||||
LDA #0 SINGLE BLYTE
|
||||
STA PARM.LENM1
|
||||
LDA #VAL.T-VAL.A PARM OFFSET FROM VAL.A
|
||||
STA PARM.OFFSET
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ SYNERR1
|
||||
CMP #'$'
|
||||
BEQ CONVERT.HEX.NUMBER
|
||||
CMP #'A'
|
||||
BCC CONVERT.DECIMAL.NUMBER
|
||||
JMP CONVERT.FILE.TYPE
|
||||
*--------------------------------
|
||||
ERR.BADPARM
|
||||
SEC "INVALID PARAMETER"
|
||||
LDA #$0B
|
||||
RTS
|
||||
*--------------------------------
|
||||
FOUND.PARM
|
||||
LDA PARM.MASKS,Y
|
||||
BEQ .2
|
||||
AND PBITS+1
|
||||
BEQ ERR.BADPARM
|
||||
CMP #$04 IS IT S OR D
|
||||
BNE .1 ...NO
|
||||
AND FBITS+1 ...YES, DID WE ALREADY HAVE S OR D
|
||||
BNE .2 ...YES
|
||||
LDA #1 ...NO, SET D=1
|
||||
STA VAL.D
|
||||
LDA #$04
|
||||
.1 ORA FBITS+1
|
||||
STA FBITS+1
|
||||
.2 LDA PARM.VARIABLES,Y
|
||||
AND #$03
|
||||
STA PARM.LENM1
|
||||
LDA PARM.VARIABLES,Y
|
||||
LSR
|
||||
LSR
|
||||
STA PARM.OFFSET
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
CMP #'$'
|
||||
BEQ CONVERT.HEX.NUMBER
|
||||
*--------------------------------
|
||||
CONVERT.DECIMAL.NUMBER
|
||||
STX COMMAND.LINE.LENGTH
|
||||
JSR ACCUMULATE.DECIMAL.DIGIT
|
||||
BCC .1
|
||||
BMI GO.ERR.RANGE.1
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
.1 LDX COMMAND.LINE.LENGTH
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE CONVERT.DECIMAL.NUMBER
|
||||
BEQ CHECK.PARAMETER.RANGE
|
||||
*--------------------------------
|
||||
CONVERT.HEX.NUMBER
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
.1 STX COMMAND.LINE.LENGTH
|
||||
JSR ACCUMULATE.HEX.DIGIT
|
||||
BCC .2
|
||||
BMI GO.ERR.RANGE.1
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
.2 LDX COMMAND.LINE.LENGTH
|
||||
JSR GET.NEXT.NONBLANK
|
||||
BNE .1
|
||||
*--------------------------------
|
||||
CHECK.PARAMETER.RANGE
|
||||
LDX #$02
|
||||
.1 CPX PARM.LENM1
|
||||
BEQ .2
|
||||
LDA ACCUM,X
|
||||
BNE GO.ERR.RANGE.1
|
||||
DEX
|
||||
BNE .1
|
||||
.2 LDY PARM.OFFSET
|
||||
.3 LDA ACCUM,X
|
||||
STA VAL.A,Y
|
||||
DEY
|
||||
DEX
|
||||
BPL .3
|
||||
LDX COMMAND.LINE.LENGTH
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
GO.ERR.SYNTAX.1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
GO.ERR.RANGE.1 JMP SCI.ERR.RANGE
|
||||
*--------------------------------
|
||||
CONVERT.FILE.TYPE
|
||||
STA ACCUM+2 1ST LETTER
|
||||
LDY #2 GET 2ND AND 3RD
|
||||
.1 JSR GET.NEXT.NONBLANK
|
||||
BEQ GO.ERR.SYNTAX.1
|
||||
STA ACCUM-1,Y STORE THEM BACKWARDS
|
||||
DEY
|
||||
BNE .1 ...UNTIL Y=0
|
||||
STX COMMAND.LINE.LENGTH SAVE X-REG
|
||||
.2 LDX #2 COMPARE NEXT ENTRY
|
||||
.3 LDA ACCUM,X
|
||||
EOR FILE.TYPES,Y
|
||||
INY
|
||||
ASL IGNORE BIT 7
|
||||
BNE .4 ...NOT THE SAME
|
||||
DEX NEXT CHAR
|
||||
BPL .3
|
||||
LDA FILE.TYPES,Y
|
||||
STA VAL.T
|
||||
LDX COMMAND.LINE.LENGTH RESTORE X-REG
|
||||
CLC
|
||||
RTS
|
||||
.4 INY
|
||||
DEX
|
||||
BPL .4
|
||||
CPY #LAST.FILE.TYPE
|
||||
BCC .2
|
||||
BCS GO.ERR.SYNTAX.1
|
||||
*--------------------------------
|
||||
* GET NEXT NON-BLANK CHAR FROM WBUF
|
||||
* CHAR Z C
|
||||
* <CR> YES CLR
|
||||
* COMMA YES SET
|
||||
* OTHER NO ?
|
||||
*--------------------------------
|
||||
GET.NEXT.NONBLANK
|
||||
.1 JSR GET.NEXT.CHAR.FROM.WBUF
|
||||
CMP #' '
|
||||
BEQ .1 IGNORE BLANKS
|
||||
CMP #','
|
||||
BEQ .2 .CS. and .EQ.
|
||||
CMP #$0D .EQ. if <CR>
|
||||
CLC .CC.
|
||||
.2 RTS
|
||||
*--------------------------------
|
||||
GET.NEXT.CHAR.FROM.WBUF
|
||||
LDA WBUF,X
|
||||
BNE .1 MAKE 00==8D
|
||||
|
||||
LDA #$0D
|
||||
|
||||
.1 AND #$7F
|
||||
|
||||
.DO LOWERCASE=1
|
||||
.ELSE
|
||||
CMP #$60 CONVERT LOWER CASE TO UPPER
|
||||
BCC .2
|
||||
|
||||
AND #$5F
|
||||
.2 .FIN
|
||||
INX
|
||||
RTS
|
||||
*--------------------------------
|
||||
ACCUMULATE.DECIMAL.DIGIT
|
||||
CMP #$30
|
||||
BCC .1
|
||||
CMP #$3A
|
||||
BCC .2
|
||||
.1 SEC
|
||||
ORA #0
|
||||
RTS
|
||||
*--------------------------------
|
||||
.2 AND #$0F
|
||||
PHA
|
||||
LDA ACCUM+2
|
||||
CMP #$1A
|
||||
BCS .5
|
||||
LDX #$02
|
||||
.3 LDA ACCUM,X
|
||||
PHA
|
||||
DEX
|
||||
BPL .3
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
LDX #0
|
||||
CLC
|
||||
.4 PLA
|
||||
ADC ACCUM,X
|
||||
STA ACCUM,X
|
||||
INX
|
||||
TXA
|
||||
EOR #$03
|
||||
BNE .4
|
||||
JSR SHIFT.ACCUM.LEFT
|
||||
.5 PLA
|
||||
BCS TOOBIG
|
||||
ADC ACCUM
|
||||
STA ACCUM
|
||||
BCC RTS1
|
||||
CLC
|
||||
INC ACCUM+1
|
||||
BNE RTS1
|
||||
INC ACCUM+2
|
||||
BNE RTS1
|
||||
TOOBIG LDA #$FF
|
||||
SEC
|
||||
RTS1 RTS
|
||||
*--------------------------------
|
||||
ACCUMULATE.HEX.DIGIT
|
||||
CMP #'0'
|
||||
BCC .1
|
||||
CMP #'9'+1
|
||||
BCC .3
|
||||
CMP #'A'
|
||||
BCC .1
|
||||
CMP #'F'+1
|
||||
BCC .2
|
||||
.1 SEC
|
||||
ORA #0
|
||||
RTS
|
||||
.2 SBC #$06
|
||||
.3 AND #$0F
|
||||
LDX #$03
|
||||
.4 JSR SHIFT.ACCUM.LEFT
|
||||
BCS TOOBIG
|
||||
DEX
|
||||
BPL .4
|
||||
ORA ACCUM
|
||||
STA ACCUM
|
||||
RTS
|
||||
*--------------------------------
|
||||
SHIFT.ACCUM.LEFT
|
||||
ASL ACCUM
|
||||
ROL ACCUM+1
|
||||
ROL ACCUM+2
|
||||
RTS
|
||||
*--------------------------------
|
||||
ZERO.ACCUM
|
||||
LDY #0
|
||||
STY ACCUM
|
||||
STY ACCUM+1
|
||||
STY ACCUM+2
|
||||
RTS
|
||||
*--------------------------------
|
||||
* RETURN .CC. IF NOT END OF PATHNAME YET
|
||||
* ELSE .CS.
|
||||
*--------------------------------
|
||||
STORE.PATH.TWO.AND.TEST
|
||||
STA PATHNAME.TWO.BUFFER+1,Y
|
||||
INY
|
||||
CMP #','
|
||||
BEQ .1
|
||||
CMP #' '
|
||||
BEQ .1
|
||||
CMP #$0D
|
||||
BEQ .1
|
||||
CPY #65
|
||||
.1 RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.cpar
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
47
SCMASM.31/SCI.S.EQ.txt
Normal file
47
SCMASM.31/SCI.S.EQ.txt
Normal file
@ -0,0 +1,47 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
*BASL .EQ $28
|
||||
CSWL .EQ $36
|
||||
CSWH .EQ $37
|
||||
KSWL .EQ $38
|
||||
KSWH .EQ $39
|
||||
DRIVER.PTR .EQ $3A,3B
|
||||
RETRY.COUNT .EQ $3C
|
||||
*--------------------------------
|
||||
SC.INFLAG .EQ $51 $Cx if .INBx
|
||||
SC.LOMEM .EQ $52,53 START OF SYMBOLS
|
||||
SC.EOT .EQ $54,55 END OF SYMBOL TABLE
|
||||
SC.PP .EQ $56,57 START OF SOURCE PROGRAM
|
||||
SC.HIMEM .EQ $58,59 END OF SOURCE PROGRAM
|
||||
*PASS .EQ $63 PASS ($FF if command, 0 or 1 if assembling)
|
||||
*--------------------------------
|
||||
*WBUF .EQ $0200
|
||||
DIRBUF .EQ $0259
|
||||
PATHNAME.TWO.BUFFER .EQ $0280
|
||||
*--------------------------------
|
||||
GP.MLI .EQ $BF00
|
||||
UNIT .EQ $BF30
|
||||
BITMAP .EQ $BF58
|
||||
GP.DATE .EQ $BF90 ... 93
|
||||
LEVEL .EQ $BF94
|
||||
PREFIX.FLAG .EQ $BF9A
|
||||
*--------------------------------
|
||||
KEYBOARD .EQ $C000
|
||||
STROBE .EQ $C010
|
||||
IO.OFF .EQ $CFFF
|
||||
*--------------------------------
|
||||
BELL .EQ $FBE2
|
||||
ABORT.EXIT .EQ $FD10
|
||||
PRBYTE .EQ $FDDA
|
||||
CROUT .EQ $FD8E
|
||||
COUT .EQ $FDED
|
||||
*MON.SETVID .EQ $FE93
|
||||
*--------------------------------
|
||||
SC.HARD .EQ $8000
|
||||
SC.SOFT .EQ $8003
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.eq
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
107
SCMASM.31/SCI.S.ERRORS.txt
Normal file
107
SCMASM.31/SCI.S.ERRORS.txt
Normal file
@ -0,0 +1,107 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* Error Handler
|
||||
*--------------------------------
|
||||
ERROR.HANDLER
|
||||
AND #$1F TRIM TO SIZE
|
||||
STA ERROR.CODE
|
||||
LDA #$0F LEVEL
|
||||
STA LEVEL
|
||||
JSR UNHOOK.WRITE ...IF WRITING
|
||||
LDA #0
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
JSR MLI.CC CLOSE ALL FILES
|
||||
BCS .1
|
||||
LDA #0
|
||||
STA LEVEL
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
JSR MLI.CD FLUSH
|
||||
.1 LDA ERROR.CODE
|
||||
JSR PRINT.ERROR
|
||||
JSR CLOSE.EXEC.FILE
|
||||
JSR CROUT
|
||||
JMP SC.SOFT
|
||||
*--------------------------------
|
||||
ERR.FILE.BUSY
|
||||
LDA #$14
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
ERROR.PRINTER
|
||||
JSR FIND.AND.PUT.MSG.IN.WBUF
|
||||
JSR BELL
|
||||
*---PRINT MESSAGE FROM WBUF------
|
||||
PRINT.CR.MESSAGE
|
||||
JSR CROUT
|
||||
PRINT.MESSAGE
|
||||
LDX #0
|
||||
.1 LDA WBUF+1,X
|
||||
JSR COUT
|
||||
INX
|
||||
CMP #$8D END OF MESSAGE?
|
||||
BNE .1 ...NO
|
||||
RTS ...YES
|
||||
*--------------------------------
|
||||
FIND.AND.PUT.MSG.IN.WBUF
|
||||
LDX #0
|
||||
CLC
|
||||
*---SEARCH FOR MESSAGE #---------
|
||||
STA WBUF
|
||||
TAY
|
||||
BEQ .5 ...FIRST MESSAGE
|
||||
.2 JSR SCI.GET.NEXT.NYBBLE
|
||||
BNE .4
|
||||
.3 JSR SCI.GET.NEXT.NYBBLE
|
||||
BEQ .3
|
||||
BNE .2
|
||||
.4 EOR #$0F
|
||||
BNE .2
|
||||
DEC WBUF
|
||||
BNE .2
|
||||
*---Put message in WBUF----------
|
||||
.5 LDY #0
|
||||
STY WBUF+80 SQUEEZED BLANK COUNT
|
||||
.6 STY WBUF STORAGE INDEX
|
||||
LDA WBUF+80 BLANK COUNT
|
||||
BNE .8 ...ANOTHER BLANK
|
||||
.7 JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.FIRST.TABLE,Y
|
||||
BNE .9 ...FREQUENT CHAR
|
||||
JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.SECOND.TABLE,Y
|
||||
BNE .9 ...TWO NYBBLE CHAR
|
||||
JSR SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.THIRD.TABLE,Y
|
||||
BMI .9 ...REAL CHAR
|
||||
STA WBUF+80 ...BLANK COUNT
|
||||
.8 LDA #" "
|
||||
DEC WBUF+80
|
||||
BEQ .7 ...NO MORE BLANKS
|
||||
.9 LDY WBUF STORAGE INDEX
|
||||
STA WBUF+1,Y
|
||||
INY NEXT COLUMN
|
||||
EOR #$8D END OF MESSAGE?
|
||||
BNE .6 ...NO
|
||||
RTS ...YES
|
||||
*--------------------------------
|
||||
SCI.GET.NEXT.NYBBLE
|
||||
LDA SCI.MESSAGES,X
|
||||
BCS .1 2ND NYBBLE
|
||||
LSR 1ST NYBBLE
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
TAY
|
||||
SEC
|
||||
RTS
|
||||
.1 INX
|
||||
AND #$0F
|
||||
TAY
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.errors
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
125
SCMASM.31/SCI.S.EXEC.txt
Normal file
125
SCMASM.31/SCI.S.EXEC.txt
Normal file
@ -0,0 +1,125 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
EXEC.ERR.FILE.BUSY JMP ERR.FILE.BUSY
|
||||
EXEC.ERR.MISMATCH JMP TYPERR
|
||||
*--------------------------------
|
||||
EXEC
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCS .1 ...NOT CURRENTLY OPEN
|
||||
*---File is in use---------------
|
||||
BIT EXEC.FILE.CLOSING.FLAG
|
||||
BPL EXEC.ERR.FILE.BUSY
|
||||
*---Restarting same EXEC file----
|
||||
STA MISC.PARMS+1 REFNUM
|
||||
LDA #0 "REWIND" THE FILE
|
||||
STA MISC.PARMS+2
|
||||
STA MISC.PARMS+3
|
||||
STA MISC.PARMS+4
|
||||
JSR MLI.CE SET MARK
|
||||
BCS CLOSE.EXEC.SAVING.ERROR
|
||||
BCC .2 ...ALWAYS, RESTART
|
||||
*--------------------------------
|
||||
.1 JSR CLOSE.EXEC.FILE STOP ANY EXEC IN PROGRESS
|
||||
BCS .3 ...ERROR
|
||||
*---Check file type--------------
|
||||
LDA GET.SET.PARMS+4 FILE TYPE MUST BE TXT
|
||||
CMP #$04 TXT FILETYPE CODE
|
||||
BNE EXEC.ERR.MISMATCH
|
||||
*---Open the file----------------
|
||||
LDA #0
|
||||
STA LEVEL LEVEL
|
||||
STA MISC.PARMS+2 BUFFER ADDRESS
|
||||
LDA EXEC.BUFFER.BASE
|
||||
STA MISC.PARMS+3 BUFFER ADDRESS HI
|
||||
STA OPEN.PARMS+4 "
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .3 ...ERROR
|
||||
LDA OPEN.PARMS+5 REFNUM OF FILE
|
||||
STA EXEC.REFNUM
|
||||
*---Fill other param blocks------
|
||||
.2 LDX GET.SET.PARMS+5 RECORD LENGTH
|
||||
STX VAL.L
|
||||
LDX GET.SET.PARMS+6
|
||||
STX VAL.L+1
|
||||
LDX #2 POINT AT EXEC FILE NAME
|
||||
JSR SAVE.FILENAME.IN.TABLE
|
||||
*---Switch EXEC on now-----------
|
||||
LDA #$FF MARK EXEC ACTIVE
|
||||
STA F.EXEC
|
||||
LDA KSWL
|
||||
STA VDOSIO+2
|
||||
LDA KSWH
|
||||
STA VDOSIO+3
|
||||
LDA #READ.EXEC.FILE
|
||||
STA KSWL
|
||||
LDA /READ.EXEC.FILE
|
||||
STA KSWH
|
||||
CLC
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
CLOSE.EXEC.SAVING.ERROR
|
||||
PHA SAVE ERROR CODE
|
||||
JSR CLOSE.EXEC.FILE CLOSE THE FILE
|
||||
PLA GET ERROR CODE
|
||||
SEC SIGNAL ERROR
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CLOSE EXEC FILE
|
||||
*--------------------------------
|
||||
CLOSE.EXEC.FILE
|
||||
CLC
|
||||
LDA F.EXEC
|
||||
BPL .1 ...NO EXEC IN PROGRESS
|
||||
LDA VDOSIO+2 RESTORE INPUT HOOK
|
||||
STA KSWL
|
||||
LDA VDOSIO+3
|
||||
STA KSWH
|
||||
LDA #$FF
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
LDX #2
|
||||
LDA EXEC.REFNUM
|
||||
JSR CLOSE.ONE.FILE CLOSE THE FILE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* "EXEC" INPUT HOOK
|
||||
*--------------------------------
|
||||
READ.EXEC.FILE
|
||||
STA (BASL),Y STOP BLINKING ON SCREEN
|
||||
JSR SAVE.REGS SAVE A,X,Y
|
||||
*---Check for CTRL-C Abort-------
|
||||
LDA KEYBOARD
|
||||
CMP #$83 CONTROL-C?
|
||||
BNE .2 ...NO
|
||||
JSR CLOSE.EXEC.FILE ...YES
|
||||
STA STROBE
|
||||
*---End of Data------------------
|
||||
.1 JSR RESTORE.REGS
|
||||
JMP ABORT.EXIT
|
||||
*---Set up EXEC char input-------
|
||||
.2 LDA EXEC.REFNUM REFNUM
|
||||
STA READ.WRITE.PARMS+1
|
||||
LDA #EXEC.INPUT.CHAR
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /EXEC.INPUT.CHAR
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #1 READ JUST ONE BYTE
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ
|
||||
BCS .3 ...ERROR OR END OF DATA
|
||||
JSR RESTORE.REGS
|
||||
LDA EXEC.INPUT.CHAR
|
||||
ORA #$80
|
||||
RTS
|
||||
*--------------------------------
|
||||
.3 JSR CLOSE.EXEC.SAVING.ERROR CLOSE EXEC FILE
|
||||
CMP #$05 END OF DATA?
|
||||
BEQ .1 ...YES
|
||||
JMP ERROR.HANDLER
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.exec
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
174
SCMASM.31/SCI.S.GP.txt
Normal file
174
SCMASM.31/SCI.S.GP.txt
Normal file
@ -0,0 +1,174 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
JMP WARM.DOS
|
||||
JMP PARSE.COMMAND
|
||||
SCI.USER.CMD JMP GP.RTS USER COMMAND PARSER
|
||||
JMP ERROR.HANDLER
|
||||
PRINT.ERROR JMP ERROR.PRINTER
|
||||
ERROR.CODE .HS 00
|
||||
*--------------------------------
|
||||
OUTVEC .DA $FDF0,$C100,$C200,$C300,$C400,$C500,$C600,$C700
|
||||
INVEC .DA $FD1B,$C100,$C200,$C300,$C400,$C500,$C600,$C700
|
||||
*--------------------------------
|
||||
VECOUT .HS F0FD
|
||||
VECIN .HS 1BFD
|
||||
*--------------------------------
|
||||
VDOSIO .DA 0,0 SAVE HARDWARE VECTOR DURING EXEC, WRITE
|
||||
.DA 0,0 VSYSIO
|
||||
*--------------------------------
|
||||
D.SLOT .HS 06
|
||||
D.DRIV .HS 01
|
||||
*--------------------------------
|
||||
PREGA .BS 1
|
||||
PREGX .BS 1
|
||||
PREGY .BS 1
|
||||
*--------------------------------
|
||||
F.TRACE .BS 1 +=TRACE OFF, -=TRACE ON
|
||||
STATE .BS 1 0=IMMD, >0=DEFERRED
|
||||
F.EXEC .BS 1
|
||||
F.READ .BS 1
|
||||
F.WRITE .BS 1
|
||||
F.PREFIX .BS 1
|
||||
DIR.FILE.READ.FLAG .BS 1
|
||||
*--------------------------------
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
STRINGS.SPACE.COUNT .BS 1
|
||||
BUFFERED.WRITE.COUNT .BS 1
|
||||
COMMAND.LINE.LENGTH .BS 1
|
||||
PREVIOUS.CHAR .BS 1
|
||||
OPEN.FILE.COUNT .BS 1
|
||||
EXEC.FILE.CLOSING.FLAG .BS 1
|
||||
CATALOG.LINE.STATE .BS 1
|
||||
*--------------------------------
|
||||
EXTERNAL.COMMAND.HANDLER .BS 2
|
||||
COMMAND.NAME.LENGTH .BS 1
|
||||
COMMAND.NUMBER .BS 1
|
||||
*--------------------------------
|
||||
PBITS .HS 0000
|
||||
FBITS .HS 0000
|
||||
VAL.A .HS 0000
|
||||
VAL.B .HS 000000
|
||||
VAL.E .HS 0000
|
||||
VAL.L .HS 0000
|
||||
VAL.S .HS 00
|
||||
VAL.D .HS 00
|
||||
VAL.F .HS 0000
|
||||
VAL.R .HS 0000
|
||||
VAL.V .HS 00
|
||||
VAL.AT .HS 0000
|
||||
VAL.T .HS 00
|
||||
VAL.LB .HS 00 PR# OR IN# VALUE
|
||||
*--------------------------------
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.DA PATHNAME.TWO.BUFFER
|
||||
*--------------------------------
|
||||
MLI.CALLER
|
||||
STA .2
|
||||
STX GP.SAVEX
|
||||
CMP #$CF
|
||||
BCC .1
|
||||
LDA #$CE
|
||||
.1 TAX
|
||||
LDA MLI.PARM.PNTRS-$C0,X
|
||||
STA .3
|
||||
JSR GP.MLI
|
||||
.2 .HS 00
|
||||
.3 .DA *
|
||||
BCC .6
|
||||
LDX #0
|
||||
.4 CMP MLI.ERROR.CODES,X
|
||||
BEQ .5
|
||||
INX
|
||||
CPX #19
|
||||
BCC .4
|
||||
.5 LDA BI.ERROR.CODES,X
|
||||
*** SEC (CARRY ALREADY SET)
|
||||
.6 LDX #*-*
|
||||
GP.SAVEX .EQ *-1
|
||||
ORA #0
|
||||
GP.RTS RTS
|
||||
*--------------------------------
|
||||
.HS 00 <<<SPARE>>>
|
||||
*---CREATE PARMS-----------------
|
||||
CREATE.PARMS
|
||||
.HS 07
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS C3.00.0000.00.0000.0000
|
||||
*---GET & SET PREFIX, DESTROY----
|
||||
PREFIX.PARMS
|
||||
.HS 01
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
*---RENAME-----------------------
|
||||
RENAME.PARMS
|
||||
.HS 02
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.DA PATHNAME.TWO.BUFFER
|
||||
*---GET & SET FILE INFO----------
|
||||
GET.SET.PARMS
|
||||
.HS 0A
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS 00.00.0000
|
||||
.HS 00.0000.0000.0000.0000.0000
|
||||
*---MISC-------------------------
|
||||
MISC.PARMS
|
||||
.HS 02.00.0000
|
||||
.HS 00
|
||||
*---OPEN PARMS-------------------
|
||||
OPEN.PARMS
|
||||
.HS 03
|
||||
.DA PATHNAME.ONE.BUFFER
|
||||
.HS 0000.00
|
||||
*---SET NEWLINE PARMS------------
|
||||
NEWLINE.PARMS
|
||||
.HS 03.00.7F.0D
|
||||
*---READ & WRITE PARMS-----------
|
||||
READ.WRITE.PARMS
|
||||
.HS 04.00.0000.0000.0000
|
||||
*---CLOSE & FLUSH PARMS----------
|
||||
CLOSE.FLUSH.PARMS
|
||||
.HS 01.00
|
||||
*--------------------------------
|
||||
* ADDRESSES OF MLI PARM LISTS FOR EACH CALL $C0-$D3
|
||||
* actual address is $BExx
|
||||
*--------------------------------
|
||||
MLI.PARM.PNTRS
|
||||
.DA #CREATE.PARMS $C0--CREATE
|
||||
.DA #PREFIX.PARMS $C1--DESTROY
|
||||
.DA #RENAME.PARMS $C2--RENAME
|
||||
.DA #GET.SET.PARMS $C3--SFI
|
||||
.DA #GET.SET.PARMS $C4--GFI
|
||||
.DA #MISC.PARMS $C5--ONLINE
|
||||
.DA #PREFIX.PARMS $C6--SPFX
|
||||
.DA #PREFIX.PARMS $C7--GPFX
|
||||
.DA #OPEN.PARMS $C8--OPEN
|
||||
.DA #NEWLINE.PARMS $C9--NEWLINE
|
||||
.DA #READ.WRITE.PARMS $CA--READ
|
||||
.DA #READ.WRITE.PARMS $CB--WRITE
|
||||
.DA #CLOSE.FLUSH.PARMS $CC--CLOSE
|
||||
.DA #CLOSE.FLUSH.PARMS $CD--FLUSH
|
||||
.DA #MISC.PARMS $CE--SMARK
|
||||
* .DA #MISC.PARMS $CF--GMARK
|
||||
* .DA #MISC.PARMS $D0--SEOF
|
||||
* .DA #MISC.PARMS $D1--GEOF
|
||||
* .DA #MISC.PARMS $D2--SBUF
|
||||
* .DA #MISC.PARMS $D3--GBUF
|
||||
*--------------------------------
|
||||
.AS -/++++/
|
||||
*--------------------------------
|
||||
BUFFER.BASES .HS 78.7C LOWER/UPPER BUFFERS
|
||||
EXEC.BUFFER.BASE .HS 74
|
||||
*--------------------------------
|
||||
RTS WAS GET BUFFER
|
||||
NOP
|
||||
NOP
|
||||
RTS WAS RETURN BUFFER
|
||||
NOP
|
||||
NOP
|
||||
.HS 74 HIMEM PAGE
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.gp
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
381
SCMASM.31/SCI.S.LOADSAVE.txt
Normal file
381
SCMASM.31/SCI.S.LOADSAVE.txt
Normal file
@ -0,0 +1,381 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
DASH
|
||||
LDA GET.SET.PARMS+4 GET FILE TYPE
|
||||
CMP #$06 BINARY?
|
||||
BEQ .3 ...YES, BRUN
|
||||
CMP #$04 TEXT?
|
||||
BNE .1 ...NO, TRY SYS
|
||||
JMP EXEC ...YES, EXEC
|
||||
*--------------------------------
|
||||
.1 CMP #$FF SYS FILE?
|
||||
BEQ .2 ...YES, BRUN IT
|
||||
LDA #$0D "FILE TYPE MISMATCH"
|
||||
SEC
|
||||
RTS
|
||||
*---RUN SYS FILE-----------------
|
||||
.2 JSR CLOSE.ALL.FILES
|
||||
JSR CLOSE.EXEC.FILE
|
||||
LDA #0
|
||||
STA VAL.A
|
||||
LDX #6 RELEASE $8000-$B7FF
|
||||
.4 STA BITMAP+16,X
|
||||
DEX
|
||||
BPL .4
|
||||
LDA #$01 RELEASE $B800-$BEFF
|
||||
STA BITMAP+23 B800.BFFF
|
||||
LDA /$2000 A$2000
|
||||
STA VAL.A+1
|
||||
LDA #$FF T=SYS
|
||||
STA VAL.T
|
||||
LDA #$80 SIGNAL FOUND T,A, AND PATHNAME
|
||||
STA FBITS+1
|
||||
LDA #$05
|
||||
STA FBITS
|
||||
.3 JMP BRUN
|
||||
*--------------------------------
|
||||
WARM.DOS
|
||||
JSR CLOSE.ALL.FILES
|
||||
JSR CROUT
|
||||
JMP SC.SOFT
|
||||
*--------------------------------
|
||||
* LOAD A SOURCE PROGRAM
|
||||
*--------------------------------
|
||||
LOAD
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
BCS .5
|
||||
LDA #$01 READ
|
||||
LDX #$FA FILE TYPE
|
||||
JSR OPEN.A.FILE
|
||||
BCS .5 ...ERROR
|
||||
*---GET LENGTH OF FILE-----------
|
||||
LDA SC.INFLAG
|
||||
ASL
|
||||
BPL .1 ...NOT .INBx
|
||||
AND #$7F
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+2
|
||||
BEQ .2 ...ALWAYS
|
||||
.1 JSR MLI.D1 GET LENGTH OF FILE
|
||||
BCS .5 ...ERROR
|
||||
*---FIGURE LOAD ADDRESS----------
|
||||
.2 SEC
|
||||
LDA SC.HIMEM
|
||||
SBC MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+2
|
||||
STA VAL.A
|
||||
TAX
|
||||
LDA SC.HIMEM+1
|
||||
SBC MISC.PARMS+3
|
||||
STA READ.WRITE.PARMS+3
|
||||
STA VAL.A+1
|
||||
TAY
|
||||
*---CHECK FOR ROOM IN RAM--------
|
||||
BMI .6 ADDRESS>$7FFF MEANS NO ROOM
|
||||
TXA
|
||||
CMP SC.LOMEM
|
||||
TYA
|
||||
SBC SC.LOMEM+1
|
||||
BCC .6 ...BELOW LOMEM
|
||||
*---READ FILE--------------------
|
||||
LDA MISC.PARMS+2
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA MISC.PARMS+3
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CA READ THE FILE
|
||||
BCS .5
|
||||
*---CLOSE UNLESS .INBx-----------
|
||||
BIT SC.INFLAG
|
||||
BVS .4 ...IT IS .INBx
|
||||
.3 JSR MLI.CC CLOSE THE FILE
|
||||
BCS .5
|
||||
*--------------------------------
|
||||
.4 LDX VAL.A+1
|
||||
LDY VAL.A
|
||||
STX SC.PP+1
|
||||
STY SC.PP
|
||||
.5 RTS
|
||||
.6 LDA #$0E "PROGRAM TOO LARGE"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SAVE SOURCE PROGRAM ON DISK
|
||||
*--------------------------------
|
||||
SAVE
|
||||
BCC .1 ...FILE ALREADY HERE
|
||||
LDA #$FA FILE TYPE "INT"
|
||||
STA VAL.T
|
||||
STA GET.SET.PARMS+4
|
||||
LDA #$C3
|
||||
STA GET.SET.PARMS+3
|
||||
LDA SC.PP START OF PROGRAM
|
||||
STA CREATE.PARMS+5
|
||||
STA GET.SET.PARMS+5
|
||||
LDA SC.PP+1
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+6
|
||||
JSR MAKE.A.FILE CREATE A NEW FILE
|
||||
BCS .2 ...ERROR
|
||||
.1 JSR ALLOCATE.UPPER.BUFFER
|
||||
BCS .2
|
||||
LDA #$02
|
||||
LDX #$FA
|
||||
JSR OPEN.A.FILE
|
||||
BCS .2 ...ERROR
|
||||
*---GET LENGTH-------------------
|
||||
SEC GET LENGTH
|
||||
LDA SC.HIMEM
|
||||
SBC SC.PP
|
||||
TAX
|
||||
STA MISC.PARMS+2
|
||||
LDA SC.HIMEM+1
|
||||
SBC SC.PP+1
|
||||
TAY
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+4
|
||||
*---WRITE THE FILE---------------
|
||||
LDA SC.PP
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA SC.PP+1
|
||||
STA READ.WRITE.PARMS+3
|
||||
STX READ.WRITE.PARMS+4
|
||||
STY READ.WRITE.PARMS+5
|
||||
JSR MLI.CB WRITE DATA ON FILE
|
||||
BCS .2 ...ERROR
|
||||
JSR MLI.D0 SET EOF (TRUNCATE OLD LONGER FILE)
|
||||
BCS .2 ...ERROR
|
||||
JSR MLI.CC CLOSE THE FILE
|
||||
BCS .2 ...ERROR
|
||||
*---UPDATE FILE INFO-------------
|
||||
LDA SC.PP+1
|
||||
LDX SC.PP
|
||||
CMP GET.SET.PARMS+6
|
||||
BNE .3
|
||||
CPX GET.SET.PARMS+5
|
||||
CLC
|
||||
BNE .3
|
||||
.2 RTS
|
||||
.3 STX GET.SET.PARMS+5
|
||||
STA GET.SET.PARMS+6
|
||||
LDA #0
|
||||
STA GET.SET.PARMS+10
|
||||
STA GET.SET.PARMS+11
|
||||
STA GET.SET.PARMS+12
|
||||
STA GET.SET.PARMS+13
|
||||
JMP SET.FILE.INFO
|
||||
*--------------------------------
|
||||
CREATE
|
||||
LDX #0
|
||||
LDY #0 AuxType = 0000 unless specified
|
||||
LDA FBITS+1
|
||||
BPL .1 ...no A-value specified
|
||||
LDX VAL.A use A-value for AuxType
|
||||
LDY VAL.A+1
|
||||
.1 STX CREATE.PARMS+5
|
||||
STY CREATE.PARMS+6
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BNE MAKE.A.FILE
|
||||
LDA #$0F
|
||||
STA VAL.T
|
||||
|
||||
MAKE.A.FILE
|
||||
LDA VAL.T
|
||||
STA CREATE.PARMS+4
|
||||
LDX #$C3
|
||||
LDY #$01 SEEDLING
|
||||
CMP #$0F
|
||||
BNE .1
|
||||
LDY #$0D DIRECTORY
|
||||
.1 STX CREATE.PARMS+3
|
||||
STY CREATE.PARMS+7
|
||||
JMP MLI.C0 CREATE
|
||||
*--------------------------------
|
||||
RENAME LDA FBITS
|
||||
AND #$02 PATH 2?
|
||||
BEQ .1 ...NO, ERROR
|
||||
JMP MLI.C2 RENAME
|
||||
.1 JMP ERR.SYNTAX
|
||||
*--------------------------------
|
||||
LOCK JSR GET.FILE.INFO
|
||||
BCS RTS3
|
||||
LDA GET.SET.PARMS+3
|
||||
AND #$3C
|
||||
ORA #$01
|
||||
BNE LKUNLK ...ALWAYS
|
||||
UNLOCK JSR GET.FILE.INFO
|
||||
BCS RTS3
|
||||
LDA #$C3
|
||||
ORA GET.SET.PARMS+3
|
||||
LKUNLK STA GET.SET.PARMS+3
|
||||
JMP SET.FILE.INFO
|
||||
*--------------------------------
|
||||
PREFIX
|
||||
LDX #0
|
||||
LDA FBITS+1
|
||||
AND #$04
|
||||
BNE .1 ...SPECIFIED S/D
|
||||
LDA FBITS SEE IF SPECIFIED PATHNAME
|
||||
LSR
|
||||
BCC .3 ...NO, SO PRINT CURRENT PREFIX
|
||||
.1 JMP MLI.C6 SET PREFIX
|
||||
*---PRINT CURRENT PREFIX---------
|
||||
.2 LDA PATHNAME.ONE.BUFFER+1,X
|
||||
ORA #$80
|
||||
JSR COUT
|
||||
INX
|
||||
.3 CPX PATHNAME.ONE.BUFFER
|
||||
BCC .2
|
||||
JSR CROUT
|
||||
CLC
|
||||
RTS3 RTS
|
||||
*--------------------------------
|
||||
NOPREFIX
|
||||
LDA #0
|
||||
STA PATHNAME.ONE.BUFFER
|
||||
JMP MLI.C6 SET PREFIX
|
||||
*--------------------------------
|
||||
BSAVE
|
||||
BCC .2 ...EXISTING FILE
|
||||
LDA FBITS+1
|
||||
AND #$B0 A-EL
|
||||
CMP #$90 Require A and either E or L
|
||||
BCC .3 ...Neither E nor L
|
||||
LDA VAL.A
|
||||
STA CREATE.PARMS+5
|
||||
STA GET.SET.PARMS+5
|
||||
LDA VAL.A+1
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+6
|
||||
*---T=BIN unless specified-------
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BNE .1 ...TYPE SPECIFIED
|
||||
LDA #$06 ...NO TYPE, ASSUME BINARY
|
||||
STA VAL.T
|
||||
.1 LDA VAL.T
|
||||
STA GET.SET.PARMS+4
|
||||
*--------------------------------
|
||||
JSR MAKE.A.FILE
|
||||
BCS .4
|
||||
JSR GET.FILE.INFO
|
||||
BCS .4
|
||||
.2 LDA #$02
|
||||
BNE B.COMMON ...ALWAYS
|
||||
|
||||
.3 LDA #$06 "PATH NOT FOUND"
|
||||
SEC
|
||||
.4 RTS
|
||||
*--------------------------------
|
||||
BRUN
|
||||
JSR BLOAD
|
||||
BCS .1
|
||||
JSR .2
|
||||
CLC
|
||||
.1 RTS
|
||||
.2 JMP (READ.WRITE.PARMS+2)
|
||||
*--------------------------------
|
||||
BLOAD
|
||||
LDA #$01
|
||||
B.COMMON
|
||||
PHA
|
||||
JSR ALLOCATE.UPPER.BUFFER
|
||||
PLA
|
||||
BCS .3
|
||||
LDX #$06
|
||||
JSR OPEN.A.FILE
|
||||
BCS .3
|
||||
LDX VAL.A
|
||||
LDY VAL.A+1
|
||||
LDA FBITS+1
|
||||
BMI .1 ...ADDRESS SPECIFIED
|
||||
LDX GET.SET.PARMS+5
|
||||
LDY GET.SET.PARMS+6
|
||||
LDA FBITS DON'T ALLOW DEFAULT ADDRESS
|
||||
AND #$04 ON NON-BINARY FILES
|
||||
BEQ .0 ...T not specified, so it is BIN
|
||||
LDA VAL.T T specified, better be BIN or SYS
|
||||
CMP #$06 is it BIN?
|
||||
BEQ .0 ...yes, use AuxType value
|
||||
CMP #$FF is it SYS?
|
||||
BNE .4 ...no, error
|
||||
LDX #$2000 ...type SYS, assume A$2000
|
||||
LDY /$2000
|
||||
.0 LDA FBITS+1
|
||||
.1 STX READ.WRITE.PARMS+2
|
||||
STY READ.WRITE.PARMS+3
|
||||
LDX VAL.L
|
||||
LDY VAL.L+1
|
||||
AND #$30
|
||||
BEQ .5
|
||||
EOR #$30
|
||||
BEQ .4
|
||||
AND #$10
|
||||
BEQ .7
|
||||
LDA VAL.E
|
||||
SEC
|
||||
SBC VAL.A
|
||||
TAX
|
||||
LDA VAL.E+1
|
||||
SBC VAL.A+1
|
||||
TAY
|
||||
INX
|
||||
BNE .2
|
||||
INY
|
||||
.2 BCS .7
|
||||
LDA #$02 "RANGE ERROR"
|
||||
SEC
|
||||
.3 RTS
|
||||
*--------------------------------
|
||||
.4 LDA #$0B "INVALID PARAMETER"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
.5 JSR MLI.D1 GET EOF
|
||||
BCS .6
|
||||
LDX MISC.PARMS+2
|
||||
LDY MISC.PARMS+3
|
||||
LDA MISC.PARMS+4
|
||||
BEQ .7
|
||||
LDA #$0E "PROGRAM TOO LARGE"
|
||||
.6 SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
.7 STX READ.WRITE.PARMS+4
|
||||
STY READ.WRITE.PARMS+5
|
||||
LDA FBITS+1
|
||||
AND #$40
|
||||
BEQ .10
|
||||
LDX #$02
|
||||
.8 LDA VAL.B,X
|
||||
STA MISC.PARMS+2,X
|
||||
DEX
|
||||
BPL .8
|
||||
.9 JSR MLI.CE SET MARK
|
||||
LDX COMMAND.NUMBER
|
||||
BCC .10
|
||||
CMP #$02
|
||||
BNE .6
|
||||
CPX #CN.BSAVE
|
||||
BNE .6
|
||||
JSR MLI.D0 SET EOF
|
||||
BCC .9
|
||||
RTS
|
||||
*--------------------------------
|
||||
.10 LDX COMMAND.NUMBER
|
||||
CPX #CN.BSAVE
|
||||
BNE .12 ...NOT BSAVE
|
||||
JSR MLI.CB ...BSAVE
|
||||
BCS .13 ...ERROR
|
||||
.11 JMP MLI.CC
|
||||
.12 JSR MLI.CA READ
|
||||
BCC .11 ...GOOD, CLOSE
|
||||
.13 RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.loadsave
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
75
SCMASM.31/SCI.S.ONLINE.txt
Normal file
75
SCMASM.31/SCI.S.ONLINE.txt
Normal file
@ -0,0 +1,75 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
ONLINE LDA BUFFER.BASES
|
||||
STA MISC.PARMS+3
|
||||
LDA #0
|
||||
STA MISC.PARMS+2
|
||||
STA MISC.PARMS+1
|
||||
JSR MLI.C5 (Might clobber DRIVER.PTR)
|
||||
*---Now display the list---------
|
||||
LDA BUFFER.BASES
|
||||
STA DRIVER.PTR+1
|
||||
LDA #0
|
||||
STA DRIVER.PTR
|
||||
.1 PHA
|
||||
TAY
|
||||
LDA (DRIVER.PTR),Y
|
||||
BEQ .5 ...END OF LIST
|
||||
PHA
|
||||
LDA #"S"
|
||||
JSR COUT
|
||||
PLA
|
||||
PHA
|
||||
LSR ISOLATE SLOT NUMBER
|
||||
LSR
|
||||
LSR
|
||||
LSR
|
||||
AND #7
|
||||
ORA #"0"
|
||||
JSR COUT PRINT SLOT NUMBER
|
||||
LDA #","
|
||||
JSR COUT
|
||||
LDA #"D"
|
||||
JSR COUT
|
||||
PLA
|
||||
PHA
|
||||
ASL SET CARRY IF DRIVE 2
|
||||
LDA #"1" ASSUME DRIVE 1
|
||||
ADC #0 CHANGE TO 2 IF TRUE
|
||||
JSR COUT
|
||||
LDA #" " PRINT SPACE
|
||||
JSR COUT
|
||||
PLA get dsssllll again
|
||||
AND #$0F isolate length
|
||||
BEQ .3 no name, show error code
|
||||
TAX
|
||||
LDA #"/"
|
||||
.2 JSR COUT
|
||||
INY PRINT THE VOLUME OR FILE NAME
|
||||
LDA (DRIVER.PTR),Y
|
||||
ORA #$80
|
||||
DEX
|
||||
BPL .2
|
||||
LDA #"/"
|
||||
BNE .4 ...ALWAYS
|
||||
.3 LDA #"("
|
||||
JSR COUT
|
||||
INY
|
||||
LDA (DRIVER.PTR),Y GET ERROR CODE
|
||||
JSR PRBYTE
|
||||
LDA #")"
|
||||
.4 JSR COUT
|
||||
JSR CROUT
|
||||
*--------------------------------
|
||||
.5 CLC POINT TO NEXT VOLUME NAME
|
||||
PLA
|
||||
ADC #16
|
||||
BCC .1 STILL IN SAME PAGE
|
||||
CLC NO ERROR!
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.online
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
321
SCMASM.31/SCI.S.OPENCLOSE.txt
Normal file
321
SCMASM.31/SCI.S.OPENCLOSE.txt
Normal file
@ -0,0 +1,321 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* FOLLOWING USE "BIT" TO SKIP OVER TWO BYTES,
|
||||
* SO CANNOT HAVE THE SECOND OF THE TWO =$CX.
|
||||
*--------------------------------
|
||||
MLI.C0 LDA #$00 CREATE
|
||||
.HS 2C
|
||||
MLI.C1 LDA #$01 DESTROY
|
||||
.HS 2C
|
||||
MLI.C2 LDA #$02 RENAME
|
||||
.HS 2C
|
||||
MLI.C3 LDA #$03 SET FILE INFO
|
||||
.HS 2C
|
||||
MLI.C4 LDA #$04 GET FILE INFO
|
||||
.HS 2C
|
||||
MLI.C5 LDA #$05 ONLINE
|
||||
.HS 2C
|
||||
MLI.C6 LDA #$06 SET PREFIX
|
||||
.HS 2C
|
||||
MLI.C7 LDA #$07 GET PREFIX
|
||||
.HS 2C
|
||||
MLI.C8 LDA #$08 OPEN
|
||||
.HS 2C
|
||||
MLI.C9 LDA #$09 NEWLINE
|
||||
.HS 2C
|
||||
MLI.CA LDA #$0A READ
|
||||
.HS 2C
|
||||
MLI.CB LDA #$0B WRITE
|
||||
.HS 2C
|
||||
MLI.CC LDA #$0C CLOSE
|
||||
.HS 2C
|
||||
MLI.CD LDA #$0D FLUSH
|
||||
.HS 2C
|
||||
MLI.CE LDA #$0E SET MARK
|
||||
.HS 2C
|
||||
MLI.CF LDA #$0F GET MARK
|
||||
.HS 2C
|
||||
MLI.D0 LDA #$D0 SET EOF
|
||||
.HS 2C
|
||||
MLI.D1 LDA #$D1 GET EOF
|
||||
ORA #$C0 MAKE INTO MLI CALL CODE
|
||||
JMP MLI.CALLER
|
||||
*--------------------------------
|
||||
GET.FILE.INFO
|
||||
LDA #10
|
||||
STA GET.SET.PARMS
|
||||
BNE MLI.C4 GET FILE INFO
|
||||
*--------------------------------
|
||||
SET.FILE.INFO
|
||||
LDA #7
|
||||
STA GET.SET.PARMS
|
||||
BNE MLI.C3 SET FILE INFO
|
||||
*--------------------------------
|
||||
BYE
|
||||
JSR CLOSE.ALL.FILES
|
||||
JSR CLOSE.EXEC.FILE
|
||||
JSR GP.MLI
|
||||
.DA #$65,READ.WRITE.PARMS
|
||||
*--------------------------------
|
||||
OPEN.A.FILE
|
||||
PHA
|
||||
LDA FBITS
|
||||
AND #$04
|
||||
BEQ .1
|
||||
LDX VAL.T
|
||||
.1 PLA
|
||||
|
||||
OPEN.DIRECTORY
|
||||
CPX GET.SET.PARMS+4
|
||||
BNE TYPERR
|
||||
AND GET.SET.PARMS+3
|
||||
BEQ .3
|
||||
LDA ALLOCATED.BUFFER.PAGE
|
||||
STA OPEN.PARMS+4
|
||||
LDA #$0F
|
||||
STA LEVEL
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .1
|
||||
LDA OPEN.PARMS+5
|
||||
STA READ.WRITE.PARMS+1
|
||||
STA CLOSE.FLUSH.PARMS+1
|
||||
STA MISC.PARMS+1
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
.3 LDA #$0A "FILE LOCKED"
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
VERIFY
|
||||
LDA #$06 "PATH NOT FOUND"
|
||||
RTS ALREADY .CS. IF ERROR
|
||||
*--------------------------------
|
||||
TYPERR LDA #$0D
|
||||
SEC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* OPEN -- ONLY USED BY SCASM FOR OPENING
|
||||
* .TF AND "TEXT" FILES
|
||||
* THE FILES MAY BE TXT OR BIN FILE TYPE
|
||||
*--------------------------------
|
||||
OPEN
|
||||
PHP
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCC .9 ...ALREADY OPEN, ERROR
|
||||
PLP ...GET SAVED STATUS
|
||||
BCC .3 ...FILE ALREADY EXISTS
|
||||
*---MAKE A NEW FILE--------------
|
||||
LDA FBITS WAS T SPECIFIED?
|
||||
AND #$04
|
||||
BEQ .1 ...NO
|
||||
LDA VAL.T WHAT WAS SPEC?
|
||||
BCS .2 ...always, use spec'd type
|
||||
.1 LDA #$06 ...new file, type not spec'd, T=BIN
|
||||
BIT PASS $FF if command level, 0 or 1 if assembling
|
||||
BPL .4 ...assembling, make BIN file
|
||||
LDA #$04 ...command, make TXT file
|
||||
.4 STA VAL.T
|
||||
.2 STA GET.SET.PARMS+4
|
||||
LDA #$C3 FULL ACCESS PRIVILEGES
|
||||
STA GET.SET.PARMS+3
|
||||
LDA #0 RECORD LENGTH = 0000
|
||||
STA CREATE.PARMS+5
|
||||
STA CREATE.PARMS+6
|
||||
STA GET.SET.PARMS+5
|
||||
STA GET.SET.PARMS+6
|
||||
JSR MAKE.A.FILE CREATE THE FILE
|
||||
BCS .8 ...ERROR
|
||||
*---NOW THE FILE EXISTS----------
|
||||
*---OPEN THE FILE----------------
|
||||
.3 JSR ALLOCATE.LOWER.BUFFER
|
||||
STA OPEN.PARMS+4 STARTING PAGE OF BUFFER
|
||||
LDA #$07 LEVEL #
|
||||
STA LEVEL
|
||||
JSR MLI.C8 OPEN
|
||||
BCS .8 ...ERROR
|
||||
*---SAVE NAME, ETC OF OPEN FILE--
|
||||
LDA OPEN.PARMS+4 MARK THE BUFFER IN USE
|
||||
STA FILE.BUFFER.PNTRS,X
|
||||
LDA OPEN.PARMS+5 REFNUM
|
||||
STA FILE.REFNUMS,X
|
||||
JSR SAVE.FILENAME.IN.TABLE
|
||||
CLC
|
||||
.8 RTS
|
||||
*--------------------------------
|
||||
.9 PLP
|
||||
JMP ERR.FILE.BUSY
|
||||
*--------------------------------
|
||||
SAVE.FILENAME.IN.TABLE
|
||||
TXA
|
||||
ASL INDEX TIMES 32
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
TAX
|
||||
*---FORM NAME LENGTH BYTE--------
|
||||
LDA PATHNAME.TWO.BUFFER
|
||||
STA OPEN.FILE.NAME.BUFFERS,X
|
||||
TAY SAVE ACTUAL LENGTH
|
||||
CMP #30 ONLY ROOM FOR 29 CHARS
|
||||
BCC .1 ...'TWILL FIT
|
||||
LDA #29 USE LAST 29 CHARS
|
||||
.1 STA FNLEN
|
||||
LDA VAL.L
|
||||
STA OPEN.FILE.NAME.BUFFERS+1,X
|
||||
LDA VAL.L+1
|
||||
STA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
.2 INX
|
||||
LDA PATHNAME.TWO.BUFFER,Y
|
||||
STA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
DEY
|
||||
DEC FNLEN
|
||||
BNE .2
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
* SEARCH OPEN FILE NAME TABLE
|
||||
* RETURN .CS., A=ERRCOD IF NO PATHNAME
|
||||
* OR IF NOT IN TABLE
|
||||
* RETURN .CC., A=REFNUM IF FOUND IN TABLE
|
||||
*--------------------------------
|
||||
GET.REFNUM.OF.OPEN.FILE
|
||||
LDA FBITS WAS PATHNAME GIVEN?
|
||||
LSR
|
||||
BCS .1 ...YES
|
||||
JMP ERR.SYNTAX ...NO, "SYNTAX ERROR"
|
||||
*---CHECK AMONG NON-EXEC FILES---
|
||||
.1 LDX #1 MAX # OF FILES IS 2
|
||||
STX EXEC.FILE.CLOSING.FLAG
|
||||
.2 LDA FILE.BUFFER.PNTRS,X SEE IF IN USE
|
||||
BEQ .3 NO
|
||||
JSR COMPARE.TO.FILE.NAME.BUFFER
|
||||
BCC .5 ...FOUND IT
|
||||
.3 DEX
|
||||
BPL .2
|
||||
*---CHECK EXEC FILE--------------
|
||||
BIT F.EXEC IS EXEC ON?
|
||||
BPL .4 ...NO, FILE NOT OPEN
|
||||
LDX #2 ...YES
|
||||
JSR COMPARE.TO.FILE.NAME.BUFFER
|
||||
BCS .4 ...NOT THIS ONE EITHER
|
||||
LDA #$FF
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
LDA EXEC.REFNUM
|
||||
RTS RETURN .CC.
|
||||
.4 LDA #$12 "FILE NOT OPEN"
|
||||
SEC
|
||||
RTS RETURN .CS.
|
||||
.5 LDA FILE.REFNUMS,X
|
||||
RTS RETURN .CC.
|
||||
*--------------------------------
|
||||
* COMPARE NAMES
|
||||
* RETURN .CC. IF SAME, ELSE .CS.
|
||||
*--------------------------------
|
||||
COMPARE.TO.FILE.NAME.BUFFER
|
||||
TXA
|
||||
PHA SAVE X-REGISTER
|
||||
ASL INDEX TIMES 32
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
ASL
|
||||
TAX
|
||||
LDA OPEN.FILE.NAME.BUFFERS,X
|
||||
CMP PATHNAME.TWO.BUFFER
|
||||
BNE .3 ...DIFFERENT LENGTHS
|
||||
TAY POINT TO END OF PATHNAME
|
||||
CMP #30 CHOP AT 29
|
||||
BCC .1
|
||||
LDA #29
|
||||
.1 STA FNLEN
|
||||
LDA OPEN.FILE.NAME.BUFFERS+1,X
|
||||
STA RECORD.LENGTH
|
||||
LDA OPEN.FILE.NAME.BUFFERS+2,X
|
||||
STA RECORD.LENGTH+1
|
||||
.2 INX
|
||||
LDA PATHNAME.TWO.BUFFER,Y
|
||||
CMP OPEN.FILE.NAME.BUFFERS+2,X
|
||||
BNE .3 NOT THE SAME NAME
|
||||
DEY
|
||||
DEC FNLEN
|
||||
BNE .2 MORE TO THE NAME
|
||||
CLC SIGNAL SAME NAMES
|
||||
.HS B0 "BCS" OPCODE, SKIPS OVER "SEC"
|
||||
.3 SEC SIGNAL DIFFERENT NAMES
|
||||
PLA RESTORE X-REG
|
||||
TAX
|
||||
RTS
|
||||
*--------------------------------
|
||||
CLOSE
|
||||
LDA FBITS
|
||||
LSR ANY PATHNAME GIVEN?
|
||||
BCC CLOSE.ALL.FILES ...NO
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCC CLOSE.ONE.FILE ...OPEN, SO CLOSE IT
|
||||
CLC ...NOT OPEN, SO FINISHED
|
||||
RTS
|
||||
*--------------------------------
|
||||
* CLOSE A FILE ... REFNUM IN A-REG
|
||||
* INDEX IN X-REG
|
||||
*--------------------------------
|
||||
CLOSE.ONE.FILE
|
||||
STA CLOSE.FLUSH.PARMS+1 REFNUM
|
||||
LDA #0
|
||||
STA LEVEL LEVEL 0
|
||||
JSR MLI.CC CLOSE
|
||||
BCS RTS2 ...ERROR
|
||||
LDA #0
|
||||
BIT EXEC.FILE.CLOSING.FLAG
|
||||
BPL .1
|
||||
STA F.EXEC
|
||||
STA EXEC.FILE.CLOSING.FLAG
|
||||
RTS
|
||||
.1 STA FILE.BUFFER.PNTRS,X
|
||||
LDA CLOSE.FLUSH.PARMS+1
|
||||
EOR WRITE.REFNUM TEST .EQ., LEAVE CARRY CLEAR
|
||||
BNE RTS2 ...NOT SAME AS "WRITE" FILE
|
||||
*--------------------------------
|
||||
UNHOOK.WRITE
|
||||
BIT F.WRITE
|
||||
BPL RTS2
|
||||
LDA VDOSIO
|
||||
STA CSWL
|
||||
LDA VDOSIO+1
|
||||
STA CSWH
|
||||
LDA #0
|
||||
STA F.WRITE
|
||||
RTS2 RTS
|
||||
*--------------------------------
|
||||
CLOSE.ALL.FILES
|
||||
LDX #1 MAX FILES IS 2
|
||||
.1 LDA FILE.BUFFER.PNTRS,X
|
||||
BEQ .2 NOT IN USE
|
||||
LDA FILE.REFNUMS,X
|
||||
JSR CLOSE.ONE.FILE
|
||||
BCS RTS2
|
||||
.2 DEX
|
||||
BPL .1
|
||||
INX X=0
|
||||
STX CLOSE.FLUSH.PARMS+1
|
||||
LDA #$07
|
||||
STA LEVEL
|
||||
JMP MLI.CC CLOSE
|
||||
*--------------------------------
|
||||
* ALLOCATE UPPER/LOWER BUFFER
|
||||
*--------------------------------
|
||||
ALLOCATE.UPPER.BUFFER
|
||||
LDX #1
|
||||
.HS 2C
|
||||
ALLOCATE.LOWER.BUFFER
|
||||
LDX #0
|
||||
.2 LDA BUFFER.BASES,X
|
||||
STA ALLOCATED.BUFFER.PAGE
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.openclose
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
87
SCMASM.31/SCI.S.PRIN.txt
Normal file
87
SCMASM.31/SCI.S.PRIN.txt
Normal file
@ -0,0 +1,87 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
* PR#slot copy address from OUTVEC,slot to CSW
|
||||
* PR#Aaddr copy Aaddress into CSW
|
||||
* PR#slot,Aaddr copy Aaddress into OUTVEC,slot
|
||||
*
|
||||
* IN#slot copy address from INVEC,slot to KSW
|
||||
* IN#Aaddr copy Aaddress into KSW
|
||||
* IN#slot,Aaddr copy Aaddress into INVEC,slot
|
||||
*--------------------------------
|
||||
PR LDA #0
|
||||
.HS 2C SKIP NEXT LINE
|
||||
IN LDA #2
|
||||
PHA SAVE 0 OR 2
|
||||
ASL
|
||||
ASL 00 OR 08
|
||||
ORA VAL.LB +SLOT
|
||||
ASL *2
|
||||
TAX
|
||||
BIT FBITS WAS SLOT PARAMETER GIVEN?
|
||||
BVC .1 ...NO
|
||||
LDA FBITS+1 ...YES, WAS A$ PARM ALSO?
|
||||
BMI .2 ...YES, SO UPDATE TABLE
|
||||
TXA Check for "PR#0"
|
||||
BEQ .4 ...yes, so call MON.SETVID directly
|
||||
LDA OUTVEC,X ...NO, ONLY SLOT
|
||||
STA VAL.A SO GET VALUE FROM TABLE
|
||||
LDA OUTVEC+1,X
|
||||
STA VAL.A+1
|
||||
.1 JSR CHECK.IO.DRIVER
|
||||
BCS .3 ...NOT VALID DRIVER
|
||||
PLA POP SAVED 0 OR 2
|
||||
TAX
|
||||
LDA VAL.A INSTALL HOOK FOR DRIVER
|
||||
STA CSWL,X
|
||||
LDA VAL.A+1
|
||||
STA CSWH,X
|
||||
RTS
|
||||
*---ENTER NEW VALUE IN TABLE-----
|
||||
.2 JSR CHECK.IO.DRIVER
|
||||
BCS .3 ...ERROR
|
||||
PLA POP OFF SAVED 0 OR 2
|
||||
LDA VAL.A+1 UPDATE TABLE
|
||||
STA OUTVEC+1,X
|
||||
LDA VAL.A
|
||||
STA OUTVEC,X
|
||||
RTS
|
||||
.3 PLA POP OFF SAVED 0 OR 2
|
||||
LDA #$03 "NO DEVICE CONNECTED"
|
||||
RTS
|
||||
*--------------------------------
|
||||
.4 PLA POP OFF SAVED 0 OR 2
|
||||
JSR MON.SETVID
|
||||
CLC
|
||||
RTS
|
||||
*--------------------------------
|
||||
CHECK.IO.DRIVER
|
||||
LDA VAL.A GET DRIVER ADDRESS INTO PNTR
|
||||
STA DRIVER.PTR
|
||||
LDA VAL.A+1
|
||||
STA DRIVER.PTR+1
|
||||
LDY #0
|
||||
CMP #$C0 IS IT IN ROM AREA?
|
||||
BCC .3 ...NO
|
||||
LDA IO.OFF ...YES, TURN OFF $C800 SPACE
|
||||
STY RETRY.COUNT
|
||||
LDA (DRIVER.PTR),Y CHECK FOR ROM PRESENT
|
||||
CMP #$FF
|
||||
BEQ .4 ...NOT VALID ROM VALUE
|
||||
.1 CMP (DRIVER.PTR),Y BETTER NOT CHANGE...
|
||||
BNE .4 ...WOOPS, NOT ROM
|
||||
DEC RETRY.COUNT TRY IT 256 TIMES
|
||||
BNE .1 ...AGAIN
|
||||
.2 CLC ...REALLY A DRIVER
|
||||
RTS
|
||||
*---VERIFY RAM-BASED DRIVER------
|
||||
.3 LDA (DRIVER.PTR),Y GET FIRST BYTE
|
||||
CMP #$D8 "CLD" OPCODE?
|
||||
BEQ .2 ...YES, VALID DRIVER
|
||||
.4 SEC
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.prin
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
65
SCMASM.31/SCI.S.RWPA.txt
Normal file
65
SCMASM.31/SCI.S.RWPA.txt
Normal file
@ -0,0 +1,65 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
WRITE
|
||||
JSR GET.REFNUM.OF.OPEN.FILE
|
||||
BCS .1 ...NOT OPEN
|
||||
STA WRITE.REFNUM
|
||||
LDA CSWL
|
||||
STA VDOSIO
|
||||
LDA CSWH
|
||||
STA VDOSIO+1
|
||||
LDA #WRITE.TEXT.FILE
|
||||
STA CSWL
|
||||
LDA /WRITE.TEXT.FILE
|
||||
STA CSWH
|
||||
LDA #$FF
|
||||
STA F.WRITE
|
||||
.1 RTS
|
||||
*--------------------------------
|
||||
* OUTPUT HOOK DURING A WRITE OPERATION
|
||||
*--------------------------------
|
||||
WRITE.TEXT.FILE
|
||||
AND #$7F PRODOS STANDARD IS BIT7=0
|
||||
STA WRITE.OUTPUT.CHAR
|
||||
JSR SAVE.REGS
|
||||
LDX WRITE.REFNUM
|
||||
STX READ.WRITE.PARMS+1
|
||||
ASL IGNORE BIT 7
|
||||
BEQ .2 END OF FILE
|
||||
LDA #WRITE.OUTPUT.CHAR
|
||||
STA READ.WRITE.PARMS+2
|
||||
LDA /WRITE.OUTPUT.CHAR
|
||||
STA READ.WRITE.PARMS+3
|
||||
LDA #1
|
||||
STA READ.WRITE.PARMS+4
|
||||
LDA #0
|
||||
STA READ.WRITE.PARMS+5
|
||||
JSR MLI.CB WRITE
|
||||
BCC RESTORE.REGS
|
||||
*--------------------------------
|
||||
.1 JMP ERROR.HANDLER
|
||||
*--------------------------------
|
||||
.2 STX MISC.PARMS+1
|
||||
JSR MLI.CF READ MARK
|
||||
BCS .1
|
||||
JSR MLI.D0 SET EOF
|
||||
BCS .1 ...ERROR
|
||||
*---fall into RESTORE.REGS-------
|
||||
*--------------------------------
|
||||
RESTORE.REGS
|
||||
LDY PREGY
|
||||
LDX PREGX
|
||||
LDA PREGA
|
||||
RTS
|
||||
*--------------------------------
|
||||
SAVE.REGS
|
||||
STA PREGA
|
||||
STX PREGX
|
||||
STY PREGY
|
||||
RTS
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.rwpa
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
180
SCMASM.31/SCI.S.TABLES.txt
Normal file
180
SCMASM.31/SCI.S.TABLES.txt
Normal file
@ -0,0 +1,180 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
CN. .SE 1
|
||||
.MA CMD
|
||||
CN. .SE CN.+1
|
||||
CN.]2 .EQ CN.
|
||||
.AT /]2]3/
|
||||
.DA ]2
|
||||
.HS ]1
|
||||
.EM
|
||||
*--------------------------------
|
||||
COMMAND.TABLE
|
||||
.AT /-/
|
||||
.DA DASH
|
||||
.HS 0104
|
||||
>CMD 05F4,BLOAD
|
||||
>CMD 01F4,BRUN
|
||||
>CMD 0DF4,BSAVE
|
||||
>CMD 0000,BYE
|
||||
>CMD 9504,CATALOG
|
||||
>CMD 9504,CAT
|
||||
>CMD 0100,CLOSE
|
||||
>CMD 0D84,CREATE
|
||||
|
||||
* >CMD 0104,DELETE
|
||||
|
||||
CN. .SE CN.+1
|
||||
CN.DELETE .EQ CN.
|
||||
.AT /DELETE/
|
||||
.DA MLI.C1
|
||||
.HS 0104
|
||||
|
||||
>CMD 0107,EXEC
|
||||
>CMD 4080,IN,#
|
||||
>CMD 0504,LOAD
|
||||
>CMD 0104,LOCK
|
||||
>CMD 0000,NOPREFIX
|
||||
>CMD 0000,NOW
|
||||
>CMD 0000,ONLINE
|
||||
>CMD 2D14,OPEN
|
||||
>CMD 4080,PR,#
|
||||
>CMD 9104,PREFIX
|
||||
>CMD 0304,RENAME
|
||||
>CMD 0D04,SAVE
|
||||
>CMD 0104,UNLOCK
|
||||
>CMD 1104,VERIFY
|
||||
>CMD 2147,WRITE
|
||||
.HS 00
|
||||
*--------------------------------
|
||||
* PARAMETER NAME TABLE
|
||||
*--------------------------------
|
||||
PARM.NAMES
|
||||
.AS /ABELSDFRV/
|
||||
NO.PARM.NAMES .EQ *-PARM.NAMES
|
||||
*--------------------------------
|
||||
* BIT MASK FOR PARAMETERS IN PERMISSION BITS
|
||||
*--------------------------------
|
||||
* A B E L S D F R V @
|
||||
PARM.MASKS
|
||||
.HS 80.40.20.10.04.04.02.01.00
|
||||
*--------------------------------
|
||||
* XXXXXXYY where yy+1= # of bytes
|
||||
* xxxxxx= offset from VAL.A
|
||||
* of last byte
|
||||
*--------------------------------
|
||||
.MA PAR
|
||||
.DA #VAL.]1-VAL.A+]2-1*4+]2-1
|
||||
.EM
|
||||
*--------------------------------
|
||||
PARM.VARIABLES
|
||||
>PAR A,2
|
||||
>PAR B,3
|
||||
>PAR E,2
|
||||
>PAR L,2
|
||||
>PAR S,1
|
||||
>PAR D,1
|
||||
>PAR F,2
|
||||
>PAR R,2
|
||||
>PAR V,1
|
||||
*--------------------------------
|
||||
* FILE TYPE CODES
|
||||
*--------------------------------
|
||||
.MA FT
|
||||
.AS -/]1/
|
||||
.HS ]2
|
||||
.EM
|
||||
*--------------------------------
|
||||
FILE.TYPES
|
||||
>FT TXT,04
|
||||
>FT BIN,06
|
||||
>FT DIR,0F
|
||||
>FT ADB,19
|
||||
>FT AWP,1A
|
||||
>FT ASP,1B
|
||||
>FT PAS,EF
|
||||
>FT CMD,F0
|
||||
>FT S-C,FA (NORMALLY "INT")
|
||||
>FT IVR,FB
|
||||
>FT BAS,FC
|
||||
>FT VAR,FD
|
||||
>FT REL,FE
|
||||
>FT SYS,FF
|
||||
LAST.FILE.TYPE .EQ *-FILE.TYPES-1
|
||||
*--------------------------------
|
||||
* NAMES OF THE MONTHS
|
||||
*--------------------------------
|
||||
MONTH.NAMES
|
||||
.AS -/JFMAMJJASOND/
|
||||
.AS -/AEAPAUUUECOE/
|
||||
.AS -/NBRRYNLGPTVC/
|
||||
*--------------------------------
|
||||
NO.DATE.MSG
|
||||
.AS -/<NO DATE>/
|
||||
*--------------------------------
|
||||
* MLI ERROR CODES
|
||||
*--------------------------------
|
||||
MLI.ERROR.CODES
|
||||
.HS 282B4041424344454647
|
||||
.HS 48494B4C4D4E505356
|
||||
*--------------------------------
|
||||
* EQUIVALENT BI ERROR CODES
|
||||
*--------------------------------
|
||||
BI.ERROR.CODES
|
||||
.HS 0304100C0C1206068613 (86 IS A TRICK)
|
||||
.HS 09110D05020A140B0C08
|
||||
*--------------------------------
|
||||
SCI.MESSAGES
|
||||
.AC 0 INIT NYBBLE.FLAG
|
||||
.AC 1"ACDEFILNOPRST %"
|
||||
.AC 2"BGHKMUVWXY/():."
|
||||
.AC 3"QZ-4567890123@&"
|
||||
Q.BLOCKS.ABOVE .EQ 0
|
||||
.AC / BLOCKS SHOWN ABOVE:6%/
|
||||
*--------------------------------
|
||||
Q.DIRHDR .EQ 1
|
||||
.AC /TYPE NAME2BLOCKS MODIFIED9CREATED9ENDFILE AUXTYPE%/
|
||||
*--------------------------------
|
||||
.AC /RANGE ERROR%/
|
||||
.AC /NO DEVICE CONNECTED%/
|
||||
.AC /WRITE PROTECTED%/
|
||||
.AC /END OF DATA%/
|
||||
.AC /PATH NOT FOUND%/
|
||||
*--------------------------------
|
||||
Q.BLOCKS .EQ 7
|
||||
.AC / VOLUME BLOCKS USED:8FREE:8TOTAL:5%/
|
||||
*--------------------------------
|
||||
.AC "I/O ERROR%"
|
||||
.AC /DISK FULL%/
|
||||
.AC /FILE LOCKED%/
|
||||
.AC /INVALID PARAMETER%/
|
||||
.AC /NO BUFFERS AVAILABLE%/
|
||||
.AC /FILE TYPE MISMATCH%/
|
||||
.AC /PROGRAM TOO LARGE%/
|
||||
.AC /NOT DIRECT COMMAND%/
|
||||
.AC /SYNTAX ERROR%/
|
||||
.AC /DIRECTORY FULL%/
|
||||
.AC /FILE NOT OPEN%/
|
||||
.AC /DUPLICATE FILE NAME%/
|
||||
.AC /FILE BUSY%/
|
||||
.AC /FILE(S) STILL OPEN%/
|
||||
*--------------------------------
|
||||
.AC "%"
|
||||
*ZZ.MESSAGES .EQ *-MESSAGES
|
||||
*--------------------------------
|
||||
SCI.FIRST.TABLE .EQ *
|
||||
.HS 00
|
||||
.AS -"ACDEFILNOPRST "
|
||||
.HS 8D
|
||||
SCI.SECOND.TABLE .EQ *
|
||||
.HS 00
|
||||
.AS -"BGHKMUVWXY/():."
|
||||
SCI.THIRD.TABLE .EQ *
|
||||
.AS -"JQZ-"
|
||||
.HS 05.06.07.08.09.0A.0B.0C.0D.0E.0F.10 (BLANK COUNTS+1)
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/scmasm.31/sci.s.tables
|
||||
LOAD usr/src/scmasm.31/scmasm.s
|
||||
ASM
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user