Restructure ROM

Include WOZMON
This commit is contained in:
Kilian committed 2026-09-27 19:34:27 +02:00
1 parent a5e30a7b28
commit 385de7a111
83 files changed
+180 -2754

No files matched your search

-81
View File
@@ -1,81 +0,0 @@
# Microsoft BASIC for 6502
This is a single integrated assembly source tree that can generate nine different versions of Microsoft BASIC for 6502.
By running ./make.sh, this will generate all versions and compare them to the original files byte by byte. The CC65 compiler suite is need to build this project.
These are the first ten (known) versions of Microsoft BASIC for 6502:
| Name | Release | MS Version | ROM | 9digit | INPUTBUFFER | extensions | .define |
| ------------------- |:--------:| ------------ |:----:|:------:|:------------:|:-----------:| ---------- |
| Commodore BASIC 1 | 1977 | | Y | Y | ZP | CBM | |
| OSI BASIC | 1977 | 1.0 REV 3.2 | Y | N | ZP | - | CONFIG_10A |
| AppleSoft I | 1977 | 1.1 | N | Y | $0200 | Apple | CONFIG_11 |
| KIM BASIC | 1977 | 1.1 | N | Y | ZP | - | CONFIG_11A |
| AppleSoft II | 1978 | | Y | Y | $0200 | Apple | CONFIG_2 |
| AIM-65 BASIC | 1978 | 1.1? | Y | N | ZP | AIM | CONFIG_2A |
| SYM-1 BASIC | 1978 | 1.1? | Y | N | ZP | SYM | CONFIG_2A |
| Commodore BASIC 2 | 1979 | | Y | Y | $0200 | CBM | CONFIG_2A |
| KBD BASIC | 1982 | | Y | N | $0700 | KBD | CONFIG_2B |
| MicroTAN | 1980 | | Y | Y | ZP | - | CONFIG_2C |
(Note that this assembly source cannot (yet) build AppleSoft II.)
This lists the versions in the order in which they were forked from the Microsoft source base. Commodore BASIC 1, as used on the original PET is the oldest known version of Microsoft BASIC for 6502. It contains some additions to Microsoft's version, like Commodore-style file I/O.
The CONFIG_n defines specify what Microsoft-version the OEM version is based on. If CONFIG_2B is defined, for example, CONFIG_2A, CONFIG_2, CONFIG_11A, CONFIG_11 and CONFIG_10A will be defined as well, and all bugfixes up to version 2B will be enabled.
Additionally these releases are built for computer originally not having "original" Microsoft BASIC
| Name | Release | .define |
| ------------------- |:--------:| ---------- |
| W65C816SXB | 2014 | CONFIG_2C |
The following symbols can be defined in addition:
| Configuration Symbol | Description
| --------------------------------- | --------------------------------------------------------------------------------
| CONFIG_CBM1_PATCHES | jump out into CBM1's binary patches instead of doing the right thing inline
| CONFIG_CBM_ALL | add all Commodore-specific additions except file I/O
| CONFIG_DATAFLG | ?
| CONFIG_EASTER_EGG | include the CBM2 "WAIT 6502" easter egg
| CONFIG_FILE | support Commodore PRINT#, INPUT#, GET#, CMD
| CONFIG_IO_MSB | all I/O has bit #7 set
| CONFIG_MONCOUT_DESTROYS_Y | Y needs to be preserved when calling MONCOUT
| CONFIG_NO_CR | terminal doesn't need explicit CRs on line ends
| CONFIG_NO_LINE_EDITING | disable support for Microsoft-style "@", "_", BEL etc.
| CONFIG_NO_POKE | don't support PEEK, POKE and WAIT
| CONFIG_NO_READ_Y_IS_ZERO_HACK | don't do a very volatile trick that saves one byte
| CONFIG_NULL | support for the NULL statement
| CONFIG_PEEK_SAVE_LINNUM | preserve LINNUM on a PEEK
| CONFIG_PRINTNULLS | whether PRINTNULLS does anything
| CONFIG_PRINT_CR | print CR when line end reached
| CONFIG_RAM | optimizations for RAM version of BASIC, only use on 1.x
| CONFIG_ROR_WORKAROUND | use workaround for buggy 6502s from 1975/1976; not safe for CONFIG_SMALL!
| CONFIG_SAFE_NAMENOTFOUND | check both bytes of the caller's address in NAMENOTFOUND
| CONFIG_SCRTCH_ORDER | where in the init code to call SCRTCH
| CONFIG_SMALL | use 6 digit FP instead of 9 digit, use 2 character error messages, don't have GET
| CONFIG_SMALL_ERROR | use 2 character error messages
Changing symbol definitions can alter an existing base configuration, but it not guaranteed to assemble
or work correctly.
## More Information
More information on the differences of the respective versions can be found on this blog entry: [Create your own Version of Microsoft BASIC for 6502](http://www.pagetable.com/?p=46).
Also, Ben Eater has an published excellent video demonstrating how to port BASIC to a new system: [Running MSBASIC on my breadboard 6502 computer
](https://www.youtube.com/watch?v=XlbPnihCM0E)
## License
2-clause BSD
## Credits
* Main work by Michael Steil <mist64@mac.com>.
* AIM-65 and SYM-1 by Martin Hoffmann-Vetter
* Function names and all uppercase comments taken from Bob Sander-Cederlof's excellent [AppleSoft II disassembly](http://www.txbobsc.com/scsc/scdocumentor/).
* [Applesoft lite](http://cowgod.org/replica1/applesoft/) by Tom Greene helped a lot, too.
* Thanks to Joe Zbicak for help with Intellision Keyboard BASIC
* This work is dedicated to the memory of my dear hacking pal Michael "acidity" Kollmann.
-10
View File
@@ -1,10 +0,0 @@
* convert messy init code into completely different
files without ifdefs (not much in common!)
* move all machine specific code into separate files
* rename all labels that point to RTS to RTSn
* add AppleSoft comments
* look for all " $", i.e. (zeropage) constants, replace them
with symbols
* convert platform ifdefs in generic files into feature ifdefs or macros
* reconstruct pre-CBM1, i.e. CBM1 without the patches
* add some comments to every file
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $B000, size = $2000, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-5
View File
@@ -1,5 +0,0 @@
.segment "EXTRA"
LCFFA:
jsr CHRGOT
jmp LB89D
-18
View File
@@ -1,18 +0,0 @@
.segment "CODE"
ISCNTC:
lda DRA2
pha
lda #$7f
sta DRA2
pha
pla
lda DRB2
rol a
pla
sta DRA2
bcs RET2
jsr GETKEY
lda #$03
cmp #$03
;!!! runs into "STOP"
-51
View File
@@ -1,51 +0,0 @@
.segment "CODE"
SAVE:
pha
jsr WHEREO
jsr OUTSP
lda #$ff
jmp LB4BF
MONRDKEY:
lda INFLG
jsr COUT5
bne LOAD2
jmp INALL
LOAD2:
jmp CUREAD
MONCOUT:
pha
lda OUTFLG
jsr COUT5
bne COUT3
pla
jmp OUTALL
COUT3:
pla
cmp #LF
beq COUT6
cmp #CR
beq COUT4
jmp OUTPUT
COUT4:
jsr CRCK
lda #CR
rts
COUT5:
cmp #$54
beq COUT6
cmp #$55
beq COUT6
cmp #$4C
COUT6:
rts
MONRDKEY2:
jsr ROONEK
tya
beq COUT5
jmp GETKY
-128
View File
@@ -1,128 +0,0 @@
.segment "EXTRA"
.byte 0,0,0
L2900:
jsr LFD6A
stx $33
ldx #$00
L2907:
lda $0200,x
and #$7F
cmp #$0D
bne L2912
lda #$00
L2912:
sta $0200,x
inx
bne L2907
ldx $33
rts
PLT:
jmp L29F0
L291E:
cmp #$47
bne L2925
jmp L29E0
L2925:
cmp #$43
bne L292B
beq L2988
L292B:
cmp #$50
beq L2930
inx
L2930:
stx $33
L2932:
jsr FRMEVL
jsr ROUND_FAC
jsr AYINT
lda FAC+4
ldx $33
sta $0300,x
dec $33
bmi L294Dx
lda #$2C
jsr SYNCHR
bpl L2932
L294Dx:
tay
pla
cmp #$43
bne L2957
tya
jmp LF864
L2957:
cmp #$50
bne L2962
tya
ldy $0301
jmp LF800
L2962:
pha
lda $0301
sta $2C
sta $2D
pla
cmp #$48
bne L2978
lda $0300
ldy $0302
jmp LF819
L2978:
cmp #$56
beq L297F
jmp SYNERR
L297F:
ldy $0300
lda $0302
jmp LF828
L2988:
dex
beq L2930
INLINX:
jsr OUTQUES
jsr OUTSP
ldx #$80
jmp INLIN1
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0
USR_FUNC:
jsr L29DA
lda FAC+3
sta FAC+5
jmp (FAC+4)
L29DA:
jmp (GOAYINT)
brk
brk
brk
L29E0:
pla
jmp LFB40
.byte 0,0,0,0,0,0,0,0,0,0,0,0
L29F0:
pha
ldx #$01
inc $B9
bne L29F9
inc $BA
L29F9:
jmp L291E
.byte $00,$00,$00,$00,$41,$53,$21,$D2
.byte $02,$FA,$00
lda $12
beq L2A0E
jmp (GOGIVEAYF)
L2A0E:
jsr LF689
.byte $15,$BC,$08,$10,$52,$45,$75,$10
.byte $CD,$00,$55,$15,$9E,$08,$10,$4C
.byte $45,$75,$10,$D4,$00,$55,$15,$0E
.byte $08,$10,$89,$10,$75,$15,$1C,$08
.byte $10,$1F,$10,$75,$00
jmp (GOGIVEAYF)
; ----------------------------------------------------------------------------
.byte 0,0,0,0,0,0
-10
View File
@@ -1,10 +0,0 @@
.segment "CODE"
ISCNTC:
lda $C000
cmp #$83
beq L0ECC
rts
L0ECC:
jsr RDKEY
cmp #$03
;!!! runs into "STOP"
-39
View File
@@ -1,39 +0,0 @@
.segment "CODE"
SAVE:
jsr L0F42
jsr LFECD
jsr L0F51
jmp LFECD
LOAD:
jsr L0F42
jsr LFEFD
jsr L0F51
jsr LFEFD
lda #<QT_LOADED
ldy #>QT_LOADED
jsr STROUT
jmp FIX_LINKS
QT_LOADED:
.byte 0 ; XXX PATCHED
.byte "OADED"
.byte 0
L0F42:
lda #$6C
ldy #$00
sta $3C
sty $3D
lda #$6E
sta $3E
sty $3F
rts
L0F51:
lda $6A
ldy $6B
sta $3C
sty $3D
lda $6C
ldy $6D
sta $3E
sty $3F
rts
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $0800, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-51
View File
@@ -1,51 +0,0 @@
.segment "INIT"
PATCH1:
clc
jmp CONTROL_C_TYPED
PATCH2:
bit FAC+4
bpl LE1AA
cmp #$54
bne LE1AA
jmp LCE3B
LE1AA:
rts
PATCH3:
bit FAC+4
bmi LE1B2
jmp LCE90
LE1B2:
cmp #$54
beq LE1B9
jmp LCE82
LE1B9:
jmp LCE69
PATCH4:
sta CHARAC
inx
jmp LE1D9
PATCH5:
bpl LE1C9
lda Z8C
ldy Z8C+1
rts
LE1C9:
ldy #$FF
rts
PATCH6:
bne LE1D8
LE1CE:
inc POSX
bne LE1D8
lda $E2
sta POSX
bne LE1CE
LE1D8:
rts
LE1D9:
stx TXTPTR
pla
pla
tya
jmp L2B1C
-1
View File
@@ -1 +0,0 @@
; nothing - ISCNTC is a KERNAL function
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-59
View File
@@ -1,59 +0,0 @@
; configuration
CONFIG_2A := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 1
CONFIG_PEEK_SAVE_LINNUM := 1
CONFIG_SMALL_ERROR := 1
; zero page
ZP_START1 = $00
ZP_START2 = $10
ZP_START3 = $06
ZP_START4 = $5E
;extra ZP variables
USR := $03
TXPSV := LASTOP
NULL := IQERR
; inputbuffer
INPUTBUFFER := $0016
;extra stack
STACK2 := $0200
; constants
STACK_TOP := $FD
SPACE_FOR_GOSUB := $44
NULL_MAX := $F2
CRLF_1 := CR
CRLF_2 := LF
WIDTH := 20
WIDTH2 := 10
; memory layout
RAMSTART2 := $0211
; monitor functions
PRIFLG := $A411
INFLG := $A412
OUTFLG := $A413
DRA2 := $A480
DRB2 := $A482
DU13 := $E520
PSLS := $E7DC
LOAD := $E848
WHEREO := $E871
OUTPUT := $E97A
INALL := $E993
OUTALL := $E9BC
CRCK := $EA24
GETKEY := $EC40
GETKY := $EC43
ROONEK := $ECEF
CUREAD := $FE83
-49
View File
@@ -1,49 +0,0 @@
; configuration
CONFIG_11 := 1
APPLE_BAD_BYTE := 1
CONFIG_IO_MSB := 1 ; all I/O has bit #7 set
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 3
BYTES_PER_ELEMENT := 6 ; XXX override
; zero page
ZP_START1 = $00
ZP_START2 = $4F
ZP_START3 = $0D
ZP_START4 = $55
;extra ZP variables
USR := $000A
; inputbuffer
INPUTBUFFER := $0200
; constants
STACK_TOP := $F8
SPACE_FOR_GOSUB := $36
CRLF_1 := CR
CRLF_2 := $80
WIDTH := 40
WIDTH2 := 14
; memory layout
RAMSTART2 := $2A00
; monitor functions
MONRDKEY := $FD0C
MONCOUT := $FDED
LF689 := $F689
LF800 := $F800
LF819 := $F819
LF828 := $F828
LF864 := $F864
TEX := $FB2F
LFB40 := $FB40
LFD0C := $FD0C
LFD6A := $FD6A
LFECD := $FECD
LFEFD := $FEFD
-54
View File
@@ -1,54 +0,0 @@
; configuration
; oldest known version, no CONFIG_n
CONFIG_CBM_ALL := 1
CONFIG_CBM1_PATCHES := 1 ; ** don't turn off! **
CONFIG_DATAFLG := 1
CONFIG_FILE := 1; support PRINT#, INPUT#, GET#, CMD
CONFIG_NO_CR := 1; terminal doesn't need explicit CRs on line ends
CONFIG_NO_LINE_EDITING := 1; support for "@", "_", BEL etc.
CONFIG_PRINTNULLS := 1; whether PRINTNULLS does anything
CONFIG_SCRTCH_ORDER := 2
; zero page
ZP_START1 = $00
ZP_START2 = $04
ZP_START3 = $5A
ZP_START4 = $65
; extra ZP variables
CURDVC := $0003
TISTR := $0200
Z96 := $020C
USR := GORESTART
; constants
SPACE_FOR_GOSUB := $36
STACK_TOP := $FC
NULL_MAX := $0A
MAX_EXPON := 12 ; XXX override
RAMSTART2 := $0400
; magic memory locations
ENTROPY = $9044
; monitor functions
OPEN := $FFC0
CLOSE := $FFC3
CHKIN := $FFC6
CHKOUT := $FFC9
CLRCH := $FFCC
CHRIN := $FFCF
CHROUT := $FFD2
LOAD := $FFD5
SAVE := $FFD8
VERIFY := $FFDB
SYS := $FFDE
ISCNTC := $FFE1
GETIN := $FFE4
CLALL := $FFE7
LE7F3 := $E7F3; for CBM1
MONCOUT := CHROUT
MONRDKEY := GETIN
-60
View File
@@ -1,60 +0,0 @@
; configuration
CONFIG_2A := 1
CONFIG_CBM_ALL := 1
CONFIG_DATAFLG := 1
CONFIG_EASTER_EGG := 1
CONFIG_FILE := 1; support PRINT#, INPUT#, GET#, CMD
CONFIG_NO_CR := 1; terminal doesn't need explicit CRs on line ends
CONFIG_NO_LINE_EDITING := 1; support for "@", "_", BEL etc.
CONFIG_NO_READ_Y_IS_ZERO_HACK := 1
CONFIG_PEEK_SAVE_LINNUM := 1
CONFIG_SCRTCH_ORDER := 2
; zero page
ZP_START1 = $00
ZP_START2 = $0D
ZP_START3 = $03
ZP_START4 = $13
; extra/override ZP variables
CURDVC := $000E
TISTR := $008D
Z96 := $0096
POSX := $00C6
TXPSV := LASTOP
USR := GORESTART ; XXX
; inputbuffer
INPUTBUFFER := $0200
; constants
SPACE_FOR_GOSUB := $3E
STACK_TOP := $FA
WIDTH := 40
WIDTH2 := 30
RAMSTART2 := $0400
; magic memory locations
ENTROPY = $E844
; monitor functions
OPEN := $FFC0
CLOSE := $FFC3
CHKIN := $FFC6
CHKOUT := $FFC9
CLRCH := $FFCC
CHRIN := $FFCF
CHROUT := $FFD2
LOAD := $FFD5
SAVE := $FFD8
VERIFY := $FFDB
SYS := $FFDE
ISCNTC := $FFE1
GETIN := $FFE4
CLALL := $FFE7
LE7F3 := $E7F3; for CBM1
MONCOUT := CHROUT
MONRDKEY := GETIN
-52
View File
@@ -1,52 +0,0 @@
; configuration
CONFIG_2B := 1
CONFIG_NO_POKE := 1
CONFIG_NO_READ_Y_IS_ZERO_HACK := 1
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 3
CONFIG_SMALL := 1
; zero page
ZP_START1 = $00
ZP_START2 = $0F
ZP_START3 = $06
ZP_START4 = $15
; extra/override ZP variables
TXPSV := $0049
JMPADRS := $0093
LOWTRX := $0094 ; $AB also EXPSGN?
Z96 := $0096
Z17 := $06FC
Z18 := $06FD
; inputbuffer
INPUTBUFFER := $0700
; constants
STACK_TOP := $FE
SPACE_FOR_GOSUB := $49
CRLF_1 := LF
CRLF_2 := CR
; magic memory locations
L06FE := $06FE
L6874 := $6874
; memory layout
RAMSTART2 := $0300
CONST_MEMSIZ := $3FFF
; monitor functions
MONCOUT := $FDFA
LC000 := $C000
LC009 := $C009
LDE24 := $DE24
PRIMM := $DE42
LDE48 := $DE48
LDE53 := $DE53
LDE7F := $DE7F
LDE8C := $DE8C
-32
View File
@@ -1,32 +0,0 @@
; configuration
CONFIG_11A := 1
CONFIG_MONCOUT_DESTROYS_Y := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_RAM := 1
CONFIG_ROR_WORKAROUND := 1
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 2
; zero page
ZP_START1 = $00
ZP_START2 = $15
ZP_START3 = $0A
ZP_START4 = $63
; constants
STACK_TOP := $FC
SPACE_FOR_GOSUB := $36
NULL_MAX := $F2 ; probably different in original version; the image I have seems to be modified; see PDF
WIDTH := 72
WIDTH2 := 56
; magic memory locations
L1800 := $1800
L1873 := $1873
; monitor functions
MONRDKEY := $1E5A
MONCOUT := $1EA0
-47
View File
@@ -1,47 +0,0 @@
; configuration
CONFIG_2C := 1
CONFIG_NULL := 1
CONFIG_MONCOUT_DESTROYS_Y := 1
CONFIG_PEEK_SAVE_LINNUM := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_ROR_WORKAROUND := 1
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 1
; zero page
ZP_START1 = $17
ZP_START2 = $2F
ZP_START3 = $24
ZP_START4 = $85
;extra ZP variables
USR := $0021
TXPSV := $00BA
; constants
STACK_TOP := $FE
SPACE_FOR_GOSUB := $3E
NULL_MAX := $F0
WIDTH := 80
WIDTH2 := 56
; memory layout
RAMSTART2 := $0400
; monitor functions
MONRDKEY := $E210
MONRDKEY2 := $E213
MONCOUT := $E216
LF000 := $F000
LF003 := $F003
LF006 := $F006
LF009 := $F009
LF00C := $F00C
LF00F := $F00F
LF018 := $F018
LF01B := $F01B
LF01E := $F01E
LF021 := $F021
LFDFA := $FDFA
LFE73 := $FE73
LFE75 := $FE75
-37
View File
@@ -1,37 +0,0 @@
; configuration
CONFIG_10A := 1
CONFIG_DATAFLG := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SCRTCH_ORDER := 3
CONFIG_SMALL := 1
; zero page
ZP_START1 = $00
ZP_START2 = $0D
ZP_START3 = $5B
ZP_START4 = $65
;extra ZP variables
USR := $000A
; constants
STACK_TOP := $FC
SPACE_FOR_GOSUB := $33
NULL_MAX := $0A
WIDTH := 72
WIDTH2 := 56
; memory layout
RAMSTART2 := $0300
; magic memory locations
L0200 := $0200
; monitor functions
MONRDKEY := $FFEB
MONCOUT := $FFEE
MONISCNTC := $FFF1
LOAD := $FFF4
SAVE := $FFF7
-57
View File
@@ -1,57 +0,0 @@
; configuration
CONFIG_2A := 1
CONFIG_NULL := 1
CONFIG_PRINT_CR := 1 ; print CR when line end reached
CONFIG_SAFE_NAMENOTFOUND := 1
CONFIG_SCRTCH_ORDER := 1
CONFIG_PEEK_SAVE_LINNUM := 1
CONFIG_SMALL_ERROR := 1
; zero page
ZP_START1 = $00
ZP_START2 = $18
ZP_START3 = $0d
ZP_START4 = $66
;extra ZP variables
USR := $0A
TXPSV := LASTOP
ZD3 := $D3
ZD4 := $D4
GET := IQERR
COS := USR1
SIN := USR1
TAN := USR1
ATN := USR1
; inputbuffer
INPUTBUFFER := $001E
; constants
STACK_TOP := $FE
SPACE_FOR_GOSUB := $3E
NULL_MAX := $F0
CRLF_1 := CR
CRLF_2 := LF
WIDTH := 72
WIDTH2 := 56
; memory layout
RAMSTART2 := $0200
; monitor functions
ASCNIB := $8275
INSTAT := $8386
MONRDKEY := $8A1B
MONCOUT := $8A47
ACCESS := $8B86
L8C78 := $8C78
DUMPT := $8E87
P3L := $A64A
P3H := P3L+1
P2L := $A64C
P2H := P2L+1
P1L := $A64E
-26
View File
@@ -1,26 +0,0 @@
; configuration
CONFIG_2C := 1
CONFIG_NO_CR := 1
CONFIG_SCRTCH_ORDER := 2
; zero page
ZP_START1 := $00
ZP_START2 := $0D
ZP_START3 := $5B
ZP_START4 := $65
;extra ZP variables
USR := $000A
; constants
STACK_TOP := $FC
SPACE_FOR_GOSUB := $33
WIDTH := 72
WIDTH2 := 56
; memory layout
RAMSTART2 := $5000
SAVE:
LOAD:
rts
-32
View File
@@ -1,32 +0,0 @@
.segment "CODE"
; ----------------------------------------------------------------------------
; SEE IF CONTROL-C TYPED
; ----------------------------------------------------------------------------
.ifndef CONFIG_CBM_ALL
.include "cbm_iscntc.s"
.endif
.ifdef KBD
.include "kbd_iscntc.s"
.endif
.ifdef OSI
.include "osi_iscntc.s"
.endif
.ifdef APPLE
.include "apple_iscntc.s"
.endif
.ifdef KIM
.include "kim_iscntc.s"
.endif
.ifdef MICROTAN
.include "microtan_iscntc.s"
.endif
.ifdef AIM65
.include "aim65_iscntc.s"
.endif
.ifdef SYM1
.include "sym1_iscntc.s"
.endif
.ifdef W65C816SXB
.include "w65c816sxb_iscntc.s"
.endif
;!!! runs into "STOP"
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $2000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-335
View File
@@ -1,335 +0,0 @@
.segment "EXTRA"
stx SHIFTSIGNEXT
stx $0800
inx
stx Z17
stx Z18
stx TXTTAB
lda #$08
sta TXTTAB+1
jsr SCRTCH
sta STACK+255
LFD81:
jsr PRIMM
.byte $1B,$06,$01,$0C
.byte "INTELLIVISION BASIC"
.byte $0D,$0A,$0A
.byte "Copyright Microsoft, Mattel 1980"
.byte $0D,$0A,$00
sta $0435
sta $8F
ldy #$0F
lda #$FF
sta ($04),y
jsr LDE8C
.byte $0C ; NOP $xxxx
jmp RESTART
OUTQUESSP:
jsr OUTQUES
jmp OUTSP
INLIN:
ldy #$FF
LFDDC:
iny
LFDDD:
jsr GETLN
cmp #$03 ; CTRL+C
beq LFDF7
cmp #$20
bcs LFDEC ; no control char
sbc #$09
bne LFDDD
LFDEC:
sta INPUTBUFFER,y
tax
bne LFDDC
jsr CRDO2
ldy #$06
LFDF7:
tax
clc
rts
LFDFA:
bit $8F
bmi LFE01
jsr LDE48
LFE01:
bit $8F
bvc LFE10
jmp LDE53
LFE08:
jsr LFDFA
LFE0B:
jsr LDE24
bne LFE08
LFE10:
rts
VSAV:
jsr GARBAG
lda FRETOP
sta $00
lda FRETOP+1
.byte $85
LFE1B:
ora ($A5,x)
.byte $2F
sta $02
lda STREND+1
sta $03
ldy #$00
LFE26:
lda ($00),y
sta ($02),y
inc $02
bne LFE30
inc $03
LFE30:
inc $00
bne LFE26
inc $01
bit $01
bvc LFE26
ldx VARTAB
ldy VARTAB+1
lda #$01
bne LFE50
PSAV:
lda VARTAB
sta $02
lda VARTAB+1
sta $03
ldx #$01
ldy #$08
lda #$02
LFE50:
sta $0513
stx $0503
stx $00
sty $0504
sty $01
ldy #$0D
lda #$00
LFE61:
sta $0504,y
dey
bne LFE61
sty $0500
lda #$40
sta $0505
lda $02
sec
sbc $00
sta $00
lda $03
sbc $01
sta $01
lsr a
lsr a
lsr a
sta $03
jsr LE870
sta $02
jsr CHRGOT
beq LFEA6
cmp #$2C
beq L40FA
jmp SYNERR
L40FA:
jsr CHRGET
jsr LE870
sec
sbc $02
cmp $03
bpl LFEBF
lda #$27
sta JMPADRS
jmp LFFBD
LFEA6:
lda $02
clc
adc $03
jsr LE874
pha
jsr LFE0B
jsr L6874
.byte $72
adc $00,x
pla
tax
lda #$00
jsr LINPRT
LFEBF:
ldx #$07
LBF83:
dex
lda VARTAB,x
sec
sbc TXTTAB,x
sta $051B,x
lda VARTAB+1,x
sbc TXTTAB+1,x
sta $051C,x
dex
bpl LBF83
txa
sbc FRETOP
sta $0521
lda #>CONST_MEMSIZ
sbc FRETOP+1
sta $0522
lda FRETOP
sta $0523
lda FRETOP+1
sta $0524
ldx $02
jsr LFFDD
jsr LFFD1
lda $01
ldx #$05
LFEF7:
stx $0511
ldy #$E4
sec
sbc #$08
sta $01
bpl LFF15
adc #$08
asl $00
rol a
asl $00
rol a
asl $00
rol a
adc #$01
sta $0505
ldy #$00
LFF15:
sty $0512
jsr LE4C0
ldx #$00
lda $01
bpl LFEF7
LFF21:
rts
VLOD:
jsr LFFD1
stx JMPADRS
lda VARTAB
ldy VARTAB+1
ldx #$01
jsr LFF64
ldx #$00
ldy #$02
LFF34:
jsr LE39A
iny
iny
inx
inx
cpx #$05
bmi LFF34
lda STREND
sta LOWTR
lda STREND+1
sta LOWTR+1
lda FRETOP
sta HIGHTR
lda FRETOP+1
sta HIGHTR+1
lda #<CONST_MEMSIZ
sta HIGHDS
lda #>CONST_MEMSIZ
sta HIGHDS+1
lda $0523
sta FRETOP
lda $0524
sta FRETOP+1
jmp BLTU2
LFF64:
sta $9A
sty $9B
stx $00
jsr LE870
jsr LFFDD
lda JMPADRS
beq LFF7F
lda #$01
sta $9A
lda #$08
sta $9B
jsr STXTPT
LFF7F:
lda $9A
sta $0503
lda $9B
sta $0504
lda #$ED
sta $0512
lda #$05
sta $01
LFF92:
ldx $0512
beq LFF21
ldy #$04
jsr LE4C4
lda $01
cmp $0511
bne LFFB2
lda #$00
sta $01
lda $00
cmp $0513
beq LFF92
lda #$18
bne LFFB8
LFFB2:
lda #$27
bne LFFB8
LFFB6:
lda #$3C
LFFB8:
sta JMPADRS
jsr CLEARC
LFFBD:
jsr VARTAB_MINUS_2_TO_AY
sta $9A
sty $9B
lda #$00
tay
sta ($9A),y
iny
sta ($9A),y
ldx JMPADRS
jmp ERROR
LFFD1:
ldx #$00
LFFD3:
lda #$02
.byte $2C
LFFD6:
lda #$03
jsr LDE8C
asl FACSIGN
LFFDD:
jsr CHRGOT
beq LFFE5
jmp SYNERR
LFFE5:
lda #$0D
ldy #$00
jsr LDE8C
.byte $06
LFFED:
lda $034C
bmi LFFED
ldy #$01
lda ($04),y
bne LFFB6
rts
.byte $FF
; NMI
.addr LC000
; RESET
.addr LC000
; IRQ
.addr LC009
-10
View File
@@ -1,10 +0,0 @@
.segment "CODE"
ISCNTC:
jsr LE8F3
bcc RET1
LE633:
jsr LDE7F
beq STOP
cmp #$03
bne LE633
;!!! runs into "STOP"
-37
View File
@@ -1,37 +0,0 @@
.segment "CODE"
SLOD:
ldx #$01
.byte $2C
PLOD:
ldx #$00
ldy CURLIN+1
iny
sty JMPADRS
jsr LFFD3
jsr VARTAB_MINUS_2_TO_AY
ldx #$02
jsr LFF64
ldx #$6F
ldy #$00
jsr LE39A
jsr LE33D
jmp CLEARC
.byte $FF,$FF,$FF
; ----------------------------------------------------------------------------
VER:
lda #$13
ldx FAC
beq LE397
lda $DFF9
LE397:
jmp FLOAT
LE39A:
lda VARTAB,x
clc
adc $051B,y
sta VARTAB,y
lda VARTAB+1,x
adc $051C,y
sta VARTAB+1,y
; !!! next instruction is an RTS!
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $E000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-5
View File
@@ -1,5 +0,0 @@
.segment "EXTRA"
RAMSTART2:
.byte $08,$29,$25,$20,$60,$2A,$E5,$E4
.byte $20,$66,$24,$65,$AC,$04,$A4
-10
View File
@@ -1,10 +0,0 @@
.segment "CODE"
ISCNTC:
lda #$01
bit $1740
bmi RET2
ldx #$08
lda #$03
clc
cmp #$03
;!!! runs into "STOP"
-62
View File
@@ -1,62 +0,0 @@
.segment "CODE"
SAVE:
tsx
stx INPUTFLG
lda #$37
sta $F2
lda #$FE
sta $17F9
lda TXTTAB
ldy TXTTAB+1
sta $17F5
sty $17F6
lda VARTAB
ldy VARTAB+1
sta $17F7
sty $17F8
jmp L1800
ldx INPUTFLG
txs
lda #<QT_SAVED
ldy #>QT_SAVED
jmp STROUT
QT_LOADED:
.byte "LOADED"
.byte $00
QT_SAVED:
.byte "SAVED"
.byte $0D,$0A,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00
LOAD:
lda TXTTAB
ldy TXTTAB+1
sta $17F5
sty $17F6
lda #$FF
sta $17F9
lda #<L27A6
ldy #>L27A6
sta GORESTART+1
sty GORESTART+2
jmp L1873
L27A6:
ldx #$FF
txs
lda #<RESTART
ldy #>RESTART
sta GORESTART+1
sty GORESTART+2
lda #<QT_LOADED
ldy #>QT_LOADED
jsr STROUT
ldx $17ED
ldy $17EE
txa
bne L27C2
nop
L27C2:
nop
stx VARTAB
sty VARTAB+1
jmp FIX_LINKS
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-923
View File
@@ -1,923 +0,0 @@
.byte 0,0,0,0,0,0,0,0,0
LE210:
jmp LE34A
LE213:
jmp LE34A
LE216:
jmp LE33C
LE219:
jmp LE252
LE21C:
jmp LE6AD
LE21F:
jmp LE6B9
LE222:
pla
tay
sta $5E
pla
sta $5F
pha
tya
pha
ldy #$03
LE22E:
lda ($5E),y
beq LE238
jsr LFE75
iny
bne LE22E
LE238:
jsr LFDFA
lda $01
cmp #$03
beq LE24C
cmp #$0D
beq LE24B
jsr LFE75
jmp LE238
LE24B:
rts
LE24C:
pla
pla
pla
jmp LE2D6
LE252:
tya
pha
jsr LE222
bcs LE260
.byte "FAST?"
.byte $0D,$00
LE260:
ldy #$00
sty $50
sty $31
lda $03E0
cmp #$59
beq LE26F
inc $50
LE26F:
pla
pha
beq LE28C
jsr LE222
bcs LE280
ora $5845
.byte "AM?"
.byte $0D,$00
LE280:
lda $03E0
cmp #$59
beq LE28C
pla
clc
adc #$01
pha
LE28C:
jsr LE222
bcs LE29D
ora $4946
.byte "LENAME?"
.byte $0D,$00
LE29D:
ldy #$FF
jsr LF006
bcs LE28C
cmp #$FF
bne LE28C
lda #$00
lda #$42
jsr LF003
jsr LF000
pla
bne LE2C3
ldy #$20
jsr LF009
jsr LF00C
jsr LF01E
jmp LE2D6
LE2C3:
pha
jsr LF01B
pla
clc
sbc #$00
jsr LF021
lda $1E
sta $9C
lda $1F
sta $9D
LE2D6:
jsr LFE73
cli
lda #$00
sta $BFCB
sta $BFC2
ldx #$00
LE2E4:
pla
sta $13,x
inx
cpx #$4D
bne LE2E4
rts
lda #$0F
sta $0C
lda #$00
sta $BFC2
sta $15
sta $16
jmp COLD_START
LE2FD:
pha
txa
pha
lda #$02
sta $14
lda #$00
LE306:
dex
bmi LE312
clc
adc #$20
bcc LE306
inc $14
bne LE306
LE312:
sta $13
pla
tax
pla
rts
LE318:
jsr LE2FD
sta ($13),y
rts
LE31E:
pha
txa
pha
ldx #$00
LE323:
lda $0220,x
sta $0200,x
inx
cpx #$A0
bne LE323
lda #$20
ldx #$1F
LE332:
sta $0280,x
dex
bpl LE332
pla
tax
LE33A:
pla
rts
LE33C:
pha
lda $16
beq LE346
bpl LE33A
jmp LE714
LE346:
pla
jmp LC7A5
LE34A:
lda $16
beq LE357
bmi LE353
jmp LE778
LE353:
lda #$00
sta $16
LE357:
lda $15
beq LE35E
jmp LE660
LE35E:
jsr LC764
cmp #$05
beq LE366
rts
LE366:
stx $0E
lda #$00
sta $33
sta $34
ldx #$FF
LE370:
inx
cpx $0E
beq LE3C8
lda $34
cmp #$19
bcs LE3A7
pha
lda $33
asl a
rol $34
asl a
rol $34
adc $33
sta $33
pla
adc $34
sta $34
asl $33
rol $34
lda $35,x
sec
sbc #$30
bmi LE3A7
cmp #$3A
bcs LE3A7
clc
adc $33
sta $33
bcc LE370
inc $34
bne LE370
LE3A7:
ldx #$00
LE3A9:
lda LE3B4,x
beq LE3C3
jsr LFE75
inx
bne LE3A9
LE3B4:
ora $4F4E
.byte " SUCH LINE"
.byte $0D,$00
LE3C3:
ldx #$00
lda #$0D
rts
LE3C8:
ldx #$09
LE3CA:
lda #$04
sta $45,x
dex
lda #$01
sta $45,x
dex
bpl LE3CA
sta $CE
lda #$04
sta $CF
stx $7D
stx $7B
LE3E0:
ldy #$03
lda ($CE),y
pha
dey
lda ($CE),y
pha
dey
lda ($CE),y
tax
dey
lda ($CE),y
sta $CE
stx $CF
sta $4F
stx $50
pla
tax
pla
cmp $34
bne LE403
cpx $33
beq LE419
LE403:
stx $7A
sta $7B
ldx #$00
LE409:
lda $47,x
sta $45,x
inx
cpx #$0A
bne LE409
iny
lda ($CE),y
beq LE3A7
bne LE3E0
LE419:
iny
lda ($CE),y
beq LE428
iny
lda ($CE),y
sta $7C
iny
lda ($CE),y
sta $7D
LE428:
ldx #$03
LE42A:
lda $7A,x
pha
dex
bpl LE42A
lda #$20
ldx #$0F
LE434:
ldy #$1F
LE436:
jsr LE318
dey
bpl LE436
dex
bpl LE434
ldx #$05
LE441:
ldy #$1F
lda #$2D
LE445:
jsr LE318
dey
bpl LE445
cpx #$09
beq LE453
ldx #$09
bne LE441
LE453:
lda $45
sta $CE
lda $46
sta $CF
LE45B:
txa
pha
lda #$00
sta $07
ldy #$02
lda ($CE),y
tax
iny
lda ($CE),y
cmp $34
beq LE473
bcc LE479
LE46F:
dec $07
bmi LE47B
LE473:
cpx $33
beq LE47B
bcs LE46F
LE479:
inc $07
LE47B:
sty $08
stx $D2
sta $D1
ldx #$90
sec
jsr FLOAT2
jsr FOUT
ldx #$00
LE48C:
lda $0100,x
beq LE496
sta $35,x
inx
bne LE48C
LE496:
lda #$20
LE498:
ldy $08
and #$7F
LE49C:
sta $35,x
beq LE4D0
inx
cpx #$4F
bcc LE4A9
lda #$00
beq LE49C
LE4A9:
iny
lda ($CE),y
bpl LE49C
sec
sbc #$7F
stx $09
tax
sty $08
ldy #$FF
LE4B8:
dex
beq LE4C3
LE4BB:
iny
lda TOKEN_NAME_TABLE,y
bpl LE4BB
bmi LE4B8
LE4C3:
ldx $09
LE4C5:
iny
lda TOKEN_NAME_TABLE,y
bmi LE498
sta $35,x
inx
bne LE4C5
LE4D0:
ldx #$00
stx $08
pla
tax
ldy #$00
lda $07
bne LE4E0
ldx #$06
bne LE4EE
LE4E0:
bpl LE4E9
LE4E2:
inx
cpx #$0E
beq LE529
bne LE4EE
LE4E9:
jsr LE31E
ldx #$04
LE4EE:
stx $09
LE4F0:
ldx $08
lda $35,x
beq LE50D
inx
stx $08
ldx $09
jsr LE318
iny
cpy #$20
bne LE4F0
ldy #$00
lda $07
beq LE4E2
bpl LE4E9
bmi LE4E2
LE50D:
ldy #$00
lda ($CE),y
pha
iny
lda ($CE),y
sta $CF
pla
sta $CE
lda ($CE),y
beq LE529
ldx $09
lda $07
bne LE526
ldx #$09
LE526:
jmp LE45B
LE529:
ldx #$00
LE52B:
lda $02C1,x
cmp #$20
beq LE53A
sta $03E1,x
inx
stx $0E
bne LE52B
LE53A:
ldx #$00
LE53C:
pla
sta $7A,x
inx
cpx #$04
bne LE53C
ldx #$06
ldy #$00
sty $01
LE54A:
jsr LE2FD
lda ($13),y
sta $82
lda #$FF
sta ($13),y
LE555:
lda #$40
sta $80
sta $81
LE55B:
lda $01
bne LE574
dec $80
bne LE55B
dec $81
bne LE55B
lda ($13),y
pha
lda $82
sta ($13),y
pla
sta $82
jmp LE555
LE574:
lda $82
bmi LE57A
sta ($13),y
LE57A:
lda $01
cmp #$18
bne LE584
dey
bpl LE584
iny
LE584:
cmp #$06
bne LE58D
cpy #$1F
beq LE58D
iny
LE58D:
cmp #$02
bne LE596
cpx #$06
beq LE596
dex
LE596:
cmp #$04
bne LE59F
cpx #$08
beq LE59F
inx
LE59F:
cmp #$7F
bne LE5B6
cpy #$00
bne LE5AB
cpx #$06
beq LE5B6
LE5AB:
dey
bpl LE5BA
ldy #$1F
dex
jsr LE2FD
bne LE5BA
LE5B6:
cmp #$05
bne LE5D5
LE5BA:
pha
tya
pha
LE5BD:
tya
clc
adc $13
cmp #$1F
beq LE5CE
iny
lda ($13),y
dey
sta ($13),y
iny
bne LE5BD
LE5CE:
lda #$20
sta ($13),y
pla
tay
pla
LE5D5:
cmp #$1B
beq LE641
cmp #$0D
beq LE657
cmp #$0A
beq LE631
cmp #$03
beq LE645
cmp #$0B
beq LE627
cmp #$09
beq LE63D
cmp #$20
bcc LE620
cmp #$7E
bcs LE620
pha
tya
pha
lda ($13),y
LE5FA:
sta $80
tya
clc
adc $13
cmp #$1F
beq LE60F
iny
lda ($13),y
pha
lda $80
sta ($13),y
pla
bne LE5FA
LE60F:
pla
tay
pla
sta ($13),y
cpy #$1F
bne LE61F
cpx #$08
beq LE620
inx
ldy #$FF
LE61F:
iny
LE620:
lda #$00
sta $01
jmp LE54A
LE627:
ldx #$5F
lda #$20
LE62B:
sta $02C0,x
dex
bpl LE62B
LE631:
ldx #$02
LE633:
lda $7A,x
sta $13
inx
lda $7A,x
jmp LE659
LE63D:
ldx #$00
stx $0E
LE641:
ldx #$00
beq LE633
LE645:
jsr LFE73
ldx #$00
lda #$00
sta $16
LE64E:
sta $15
ldy #$00
sty $03
lda #$0D
rts
LE657:
lda #$FF
LE659:
sta $14
lda #$01
pha
bne LE685
LE660:
cmp #$03
beq LE69E
cmp #$02
beq LE681
ldx $03C0
cpx #$20
bne LE645
ldx #$FF
LE671:
inx
cpx $0E
bne LE67A
lda #$02
bne LE64E
LE67A:
lda $03E1,x
sta $35,x
bne LE671
LE681:
tax
inx
txa
pha
LE685:
ldx #$4F
LE687:
lda $02C0,x
sta $35,x
dex
bpl LE687
ldx #$4F
LE691:
lda $02BF,x
cmp #$20
bne LE69B
dex
bne LE691
LE69B:
pla
bne LE64E
LE69E:
ldx $14
cpx #$FF
beq LE645
stx $34
lda $13
sta $33
jmp LE3C8
LE6AD:
pha
lda #$05
sta $0E
pla
jsr LINGET
jmp LC57E
LE6B9:
lda $0E
bmi LE6D1
dec $0E
bne LE6D1
jsr LFDFA
lda #$82
sta $0E
lda $01
cmp #$0A
beq LE6D1
sec
rol $0E
LE6D1:
jsr ISCNTC
jmp LC5A9
LE6D7:
ldx #$FF
LE6D9:
jsr LE6E2
dey
bne LE6D9
dex
bne LE6D9
LE6E2:
rts
LE6E3:
lda #$0C
LE6E5:
ldx #$FF
tay
lda $01
cmp #$03
beq LE6E2
tya
LE6EF:
pha
lda $BFC0
LE6F3:
lda $BFCD
and #$08
beq LE6F3
lda $BFC9
pha
lda #$FF
sta $BFC9
pla
cmp #$FC
pla
bcc LE6E5
dex
bne LE6EF
dey
bne LE6EF
rts
LE710:
lda #$06
bne LE6E5
LE714:
stx $13
sty $14
lda $16
cmp #$FD
beq LE749
lda #$00
sta $BFCB
lda #$20
sta $BFC0
lda #$40
sta $BFC2
jsr LE6D7
jsr LF000
lda $16
cmp #$FF
bne LE740
ldy #$20
jsr LF009
dec $16
LE740:
ldy #$10
ldx #$FF
jsr LF009
dec $16
LE749:
pla
sei
pha
cmp #$0A
beq LE771
ldx $0E
stx $50
jsr LF00F
cli
lda $01
cmp #$03
beq LE771
pla
pha
cmp #$0D
bne LE771
lda #$00
sta $16
sta $BFCB
jsr LE6D7
sta $BFC2
LE771:
ldx $13
ldy $14
cli
pla
rts
LE778:
lda #$40
sta $BFC0
jsr LF000
cli
lda $16
cmp #$01
bne LE78A
jsr LE6E3
LE78A:
jsr LE710
lda $01
cmp #$03
beq LE7CE
LE793:
lda $50
pha
lda $51
pha
lda $0E
sta $50
sei
jsr LF018
cli
tay
pla
sta $51
pla
sta $50
bcs LE7BD
lda #$00
sta $16
ldx #$06
LE7B1:
lda LE7DC,x ; "PARITY"
jsr LFE75
dex
bpl LE7B1
inx
beq LE7CE
LE7BD:
lda $01
cmp #$03
beq LE7CE
cpy #$0D
beq LE7CE
sty $35,x
inx
cpx #$4F
bne LE793
LE7CE:
lda #$00
sta $BFCB
sta $BFC2
sta $16
cli
lda #$0D
rts
LE7DC:
.byte "YTIRAP"
.byte $0D,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF
-12
View File
@@ -1,12 +0,0 @@
.segment "CODE"
ISCNTC:
lda $01
cmp #$03
beq LC6EF
lda #$01
rts
LC6EF:
nop
nop
cmp #$03
;!!! runs into "STOP"
-75
View File
@@ -1,75 +0,0 @@
.segment "CODE"
SAVE:
ldy #$00
beq LC74D
LC74B:
ldy #$01
LC74D:
ldx #$4C
LC74F:
lda $13,x
pha
dex
bpl LC74F
ldx #$03
LC757:
lda TXTTAB,x
sta GOSTROUT+2,x
dex
bpl LC757
jmp LE219
nop
nop
nop
LC764:
tya
pha
ldy $03
lda #$FF
sta ($0A),y
pla
tay
jsr LFDFA
lda $01
jsr LC7A5
rts
.byte "DED"
.byte $0D,$0A
.byte "OK"
.byte $0D,$0A,$00
.byte "SAVED"
.byte $0D,$0A,$00
LOAD:
jsr LC74B
ldx #$FF
tsx
lda #$4F
jsr LFE75
lda #$4B
jsr LFE75
jsr LFE73
lda VARTAB
tax
ldy VARTAB+1
jmp FIX_LINKS
nop
LC7A5:
pha
cmp #$0A
beq LC7AD
jsr LFE75
LC7AD:
tya
pha
ldy $03
lda #$20
sta ($0A),y
pla
tay
pla
rts
inc $8A17
stx VARTAB
sty VARTAB+1
jmp FIX_LINKS
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $A000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-12
View File
@@ -1,12 +0,0 @@
.segment "CODE"
ISCNTC:
jmp MONISCNTC
nop
nop
nop
nop
lsr a
bcc RET2
jsr GETLN
cmp #$03
;!!! *used*to* run into "STOP"
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $2000, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-8
View File
@@ -1,8 +0,0 @@
.segment "CODE"
ISCNTC:
jsr INSTAT
bcc RET1
lda #$03
cmp #$03
;!!! runs into "STOP"
-70
View File
@@ -1,70 +0,0 @@
.segment "CODE"
SAVE:
beq L2739
sta P1L
jsr CHRGET
bne NULL-1
lda TXTTAB
ldy TXTTAB+1
sta P2L
sty P2H
lda VARTAB
ldy VARTAB+1
sta P3L
sty P3H
ldy #$80
jsr USR2
bcs LC6DD
lda #<SAVED
ldy #>SAVED
jmp STROUT
LOADED:
.byte "LOADED",CR,LF
.byte "OK",CR,LF,0
SAVED:
.byte "SAVED",CR,LF,0
LOAD:
beq L2739
sta $A64E
jsr CHRGET
bne L2738
ldy #$80
jsr USR3
bcs LC6EF
lda #<LOADED
ldy #>LOADED
jsr STROUT
ldx P3L
ldy P3H
txa
stx VARTAB
sty VARTAB+1
jmp FIX_LINKS
LC6DD:
lda #<BAD_SAVE
ldy #>BAD_SAVE
jmp STROUT
BAD_SAVE:
htasc "BAD SAVE"
.byte CR,LF,0
LC6EF:
lda #<BAD_LOAD
ldy #>BAD_LOAD
jsr STROUT
jsr SCRTCH
jmp RESTART
BAD_LOAD:
htasc "BAD LOAD"
.byte CR,LF,0
-19
View File
@@ -1,19 +0,0 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $1000, size = $3F00, fill = no, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = BASROM, type = ro;
VECTORS: load = BASROM, type = ro;
KEYWORDS: load = BASROM, type = ro;
ERROR: load = BASROM, type = ro;
CODE: load = BASROM, type = ro;
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
DUMMY: load = DUMMY; # don't include
}
-92
View File
@@ -1,92 +0,0 @@
.segment "EXTRA"
.export MONRDKEY_NB, MONRDKEY, MONCOUT, INITUSBSERIAL
VIA_USB_REG_DDRB := $7FE2
VIA_USB_REG_DDRA := $7FE3
VIA_USB_REG_PORTB := $7FE0
VIA_USB_REG_PORTA := $7FE1
VIA_USB_NRD := %00001000 ; make RD# high to not output data from FTDI
VIA_USB_WR := %00000100 ; make WR high to output data from FTDI
VIA_USB_nRXF := %00000010
VIA_USB_DDRB_INIT := (VIA_USB_NRD+VIA_USB_WR)
; INIT: Set up outputs and block reading characters from FTDI
INITUSBSERIAL:
lda #(VIA_USB_NRD+VIA_USB_WR) ; Make these outputs
sta VIA_USB_REG_DDRB ; to DDRB
lda #VIA_USB_NRD ; Block RD, no WR
sta VIA_USB_REG_PORTB ; to REGB
rts
MONRDKEY_NB:
READCHAR:
lda VIA_USB_REG_PORTB
and #VIA_USB_nRXF
bne READCHAR_NOTHINGTOREAD ; Z=0 -> had no result
; Reset DDRA as input
lda #$00 ; 0x00
sta VIA_USB_REG_DDRA ; to Directory Data (all in)
lda #0 ; DO RD, no WR
sta VIA_USB_REG_PORTB ; to REGB
lda VIA_USB_REG_PORTA
; Save on stack temporrily
pha
lda #VIA_USB_NRD ; Block RD, no WR
sta VIA_USB_REG_PORTB ; to REGB
; Get character back
pla
sec
rts
READCHAR_NOTHINGTOREAD:
clc
rts
MONRDKEY:
php
@MONRDKEYREREAD:
jsr MONRDKEY_NB
bcc @MONRDKEYREREAD
; Enable to echo back
; jsr SENDCHAR
plp
rts
MONCOUT:
; TXE SHOULD be read before sending, but since the USB connection is
; running full speed this buffer has not been seen filling up.
; Save A for when returning
pha
; Output character
sta VIA_USB_REG_PORTA ; to data
lda #VIA_USB_NRD ; Block RD, no WR
sta VIA_USB_REG_PORTB ; to REGB
lda #$FF
sta VIA_USB_REG_DDRA ; (all out)
; Pulse WR
lda #(VIA_USB_NRD+VIA_USB_WR) ; Block RD, DO WR
sta VIA_USB_REG_PORTB ; to REGB
lda #VIA_USB_NRD ; Block RD, no WR
sta VIA_USB_REG_PORTB ; to REGB
; Reset DDRA as input
lda #$00
sta VIA_USB_REG_DDRA ; to Directory Data (all in)
; Restore Accumulator
pla
rts
-10
View File
@@ -1,10 +0,0 @@
.segment "CODE"
ISCNTC:
jsr MONRDKEY_NB
bcc @NOTHING
cmp #$03
beq @STOPIT
@NOTHING:
rts
@STOPIT:
;!!! runs into "STOP"
+1
View File
@@ -0,0 +1 @@
tmp/
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1
View File
@@ -34,4 +34,5 @@
.ifdef KILIAN
.include "kilian_extra.s"
.include "wozmon.s"
.endif
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1
View File
@@ -0,0 +1 @@
;!!! runs into "STOP"
+4 -2
View File
@@ -1,7 +1,8 @@
MEMORY {
ZP: start = $0000, size = $0100, type = rw;
BASROM: start = $C000, size = $3FFA, fill = yes, file = %O;
RESETVEC: start = $FFFA, size = 6, fill = yes, file = %O;
BASROM: start = $C000, size = $3F00, fill = yes, file = %O;
WOZMON: start = $FDAA, size = $FA, fill = yes, file = %O;
RESETVEC: start = $FFFA, size = $6, fill = yes, file = %O;
DUMMY: start = $0000, size = $00FF, file = "";
}
@@ -15,6 +16,7 @@ SEGMENTS {
CHRGET: load = BASROM, type = ro;
INIT: load = BASROM, type = ro;
EXTRA: load = BASROM, type = ro;
WOZMON: load = WOZMON, type = ro;
RESETVEC: load = RESETVEC, type = ro;
DUMMY: load = DUMMY; # don't include
@@ -29,5 +29,5 @@ MONCOUT:
.segment "RESETVEC"
.word $0000 ; NMI vector
.word COLD_START ; RESET vector
.word RESET ; RESET vector
.word $0000 ; IRQ vector
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+171
View File
@@ -0,0 +1,171 @@
.segment "WOZMON"
XAML = $24 ; Last "opened" location Low
XAMH = $25 ; Last "opened" location High
STL = $26 ; Store address Low
STH = $27 ; Store address High
L = $28 ; Hex value parsing Low
H = $29 ; Hex value parsing High
YSAV = $2A ; Used to see if hex value is given
MODE = $2B ; $00=XAM, $7F=STOR, $AE=BLOCK XAM
IN = $0200 ; Input buffer
RESET:
LDA #$1B ; Begin with escape.
NOTCR:
CMP #$08 ; Backspace key?
BEQ BACKSPACE ; Yes.
CMP #$1B ; ESC?
BEQ ESCAPE ; Yes.
INY ; Advance text index.
BPL NEXTCHAR ; Auto ESC if line longer than 127.
ESCAPE:
LDA #$5C ; "\".
JSR ECHO ; Output it.
GETLINE:
LDA #$0D ; Send CR
JSR ECHO
LDY #$01 ; Initialize text index.
BACKSPACE: DEY ; Back up text index.
BMI GETLINE ; Beyond start of line, reinitialize.
NEXTCHAR:
LDA $BC01 ; Check status.
BMI NEXTCHAR ; Loop until ready.
STA IN,Y ; Add to text buffer.
JSR ECHO ; Display character.
CMP #$0D ; CR?
BNE NOTCR ; No.
LDY #$FF ; Reset text index.
LDA #$00 ; For XAM mode.
TAX ; X=0.
SETBLOCK:
ASL
SETSTOR:
ASL ; Leaves $7B if setting STOR mode.
STA MODE ; $00 = XAM, $74 = STOR, $B8 = BLOK XAM.
BLSKIP:
INY ; Advance text index.
NEXTITEM:
LDA IN,Y ; Get character.
CMP #$0D ; CR?
BEQ GETLINE ; Yes, done this line.
CMP #$2E ; "."?
BCC BLSKIP ; Skip delimiter.
BEQ SETBLOCK ; Set BLOCK XAM mode.
CMP #$3A ; ":"?
BEQ SETSTOR ; Yes, set STOR mode.
CMP #$52 ; "R"?
BEQ RUNWOZ ; Yes, run user program.
STX L ; $00 -> L.
STX H ; and H.
STY YSAV ; Save Y for comparison
NEXTHEX:
LDA IN,Y ; Get character for hex test.
EOR #$30 ; Map digits to $0-9.
CMP #$0A ; Digit?
BCC DIG ; Yes.
ADC #$88 ; Map letter "A"-"F" to $FA-FF.
CMP #$FA ; Hex letter?
BCC NOTHEX ; No, character not hex.
DIG:
ASL
ASL ; Hex digit to MSD of A.
ASL
ASL
LDX #$04 ; Shift count.
HEXSHIFT:
ASL ; Hex digit left, MSB to carry.
ROL L ; Rotate into LSD.
ROL H ; Rotate into MSD's.
DEX ; Done 4 shifts?
BNE HEXSHIFT ; No, loop.
INY ; Advance text index.
BNE NEXTHEX ; Always taken. Check next character for hex.
NOTHEX:
CPY YSAV ; Check if L, H empty (no hex digits).
BEQ ESCAPE ; Yes, generate ESC sequence.
BIT MODE ; Test MODE byte.
BVC NOTSTOR ; B6=0 is STOR, 1 is XAM and BLOCK XAM.
LDA L ; LSD's of hex data.
STA (STL,X) ; Store current 'store index'.
INC STL ; Increment store index.
BNE NEXTITEM ; Get next item (no carry).
INC STH ; Add carry to 'store index' high order.
TONEXTITEM: JMP NEXTITEM ; Get next command item.
RUNWOZ:
JMP (XAML) ; Run at current XAM index.
NOTSTOR:
BMI XAMNEXT ; B7 = 0 for XAM, 1 for BLOCK XAM.
LDX #$02 ; Byte count.
SETADR: LDA L-1,X ; Copy hex data to
STA STL-1,X ; 'store index'.
STA XAML-1,X ; And to 'XAM index'.
DEX ; Next of 2 bytes.
BNE SETADR ; Loop unless X = 0.
NXTPRNT:
BNE PRDATA ; NE means no address to print.
LDA #$0D ; CR.
JSR ECHO ; Output it.
LDA XAMH ; 'Examine index' high-order byte.
JSR PRBYTE ; Output it in hex format.
LDA XAML ; Low-order 'examine index' byte.
JSR PRBYTE ; Output it in hex format.
LDA #$3A ; ":".
JSR ECHO ; Output it.
PRDATA:
LDA #$20 ; Blank.
JSR ECHO ; Output it.
LDA (XAML,X) ; Get data byte at 'examine index'.
JSR PRBYTE ; Output it in hex format.
XAMNEXT: STX MODE ; 0 -> MODE (XAM mode).
LDA XAML
CMP L ; Compare 'examine index' to hex data.
LDA XAMH
SBC H
BCS TONEXTITEM ; Not less, so no more data to output.
INC XAML
BNE MOD8CHK ; Increment 'examine index'.
INC XAMH
MOD8CHK:
LDA XAML ; Check low-order 'examine index' byte
AND #$07 ; For MOD 8 = 0
BPL NXTPRNT ; Always taken.
PRBYTE:
PHA ; Save A for LSD.
LSR
LSR
LSR ; MSD to LSD position.
LSR
JSR PRHEX ; Output hex digit.
PLA ; Restore A.
PRHEX:
AND #$0F ; Mask LSD for hex print.
ORA #$30 ; Add "0".
CMP #$3A ; Digit?
BCC ECHO ; Yes, output it.
ADC #$06 ; Add offset for letter.
ECHO:
STA $BC00 ; Output character.
RTS ; Return.
File renamed without changes.
+1 -1
View File
@@ -7,7 +7,7 @@
uint8_t rom[ROM_SIZE] = {0};
void initRom(uint8_t *rom) {
FILE *fp = fopen("msbasic/tmp/kilian.bin", "rb");
FILE *fp = fopen("rom/tmp/kilian.bin", "rb");
if (!fp) {
perror("fopen");