This commit is contained in:
Michael Steil 2008-10-11 07:15:19 +00:00
parent a22d31d7db
commit 7d804ddd8f
3 changed files with 126 additions and 86 deletions

View File

@ -1,10 +1,11 @@
Z00 := $0000
L0001 := $0001
L0002 := $0002
GOWARM := $0000
GOWARM := $0003
GOSTROUT := $0003
GOGIVEAYF := $0008
USR := $000A
CHARAC := $000D
ENDCHR := $000E
EOLPNTR := $000F
@ -18,9 +19,9 @@ Z14 := $0017 ; Ctrl+O flag
Z15 := $0018
Z16 := $0050
Z17 := $0051
Z18 := $001B
Z18 := $0052
LINNUM := $0053
TXPSV := $001C
TXPSV := $0053
INPUTBUFFER := $0200
INPUTBUFFERX := $0200
TEMPPT := $0063-14
@ -85,8 +86,8 @@ RNDSEED := $00D8-14
L1800 := $1800
L1873 := $1873
MONRDKEY := $1E5A
MONCOUT := $1EA0
MONRDKEY := $FD0C
MONCOUT := $FDED
STACK_TOP := $F8
BYTES_PER_FRAME := $12
@ -94,9 +95,8 @@ SPACE_FOR_GOSUB := $36
TEMPST := $58
FOR_STACK1 := $0F
FOR_STACK2 := $09
NUM_TOKENS := $1D
NULL_MAX := $F2 ; probably different in original version; the image I have seems to be modified; see PDF
BYTES_PER_ELEMENT := 5
NUM_TOKENS := $1C
BYTES_PER_ELEMENT := 6 ; ??? should be 5 on Apple
BYTES_PER_VARIABLE := 7
BYTES_FP := 5
MANTISSA_BYTES := BYTES_FP-1
@ -123,38 +123,32 @@ TOKEN_LEFTSTR := $C1
RAMSTART3 := $AAAA
RAMSTART2 := $AAAA
USR := $AAAA
SAVE := $AAAA
LOAD := $AAAA
LFD0C := $AAAA
INLIN := $AAAA
CLEAR := $AAAA
L0BF3 := $AAAA
LFEFD := $AAAA
LFECD := $AAAA
LF689 := $F689
LF800 := $F800
LF819 := $F819
LF828 := $F828
LF864 := $F864
TEX := $FB2F
LFB40 := $FB40
LFD0C := $FD0C
LFD6A := $FD6A
LFECD := $FECD
LFEFD := $FEFD
L0D28 := $AAAA
L1528 := $AAAA
L000A := $000A
L123C := $AAAA
L2829 := $AAAA
QT_WRITTEN_BY := $AAAA
L2AAA := $AAAA
L2A52 := $AAAA
L2AA3 := $AAAA
L1008 := $AAAA
L2A6D := $AAAA
L2A68 := $AAAA
LF689 := $AAAA
L0008 := $AA
LFB40 := $AAAA
L0006 := $AA
LF828 := $AAAA
LF819 := $AAAA
LF800 := $AAAA
LF864 := $AAAA
L1F20 := $AAAA
L00A4 := $AA
L1751 := $AAAA
L2198 := $AAAA
L13D7 := $AAAA
LFD6A := $AAAA

10
macros.s Normal file
View File

@ -0,0 +1,10 @@
; ----------------------------------------------------------------------------
; Macros
; htasc - set the hi bit on the last byte of a string for termination
.macro htasc str
.repeat .strlen(str)-1,I
.byte .strat(str,I)
.endrep
.byte .strat(str,.strlen(str)-1) | $80
.endmacro

156
msbasic.s
View File

@ -40,14 +40,22 @@ TOKEN_ADDRESS_TABLE:
.word INPUT-1
.word DIM-1
.word READ-1
.ifdef APPLE
.word PLT-1
.else
.word LET-1
.endif
.word GOTO-1
.word RUN-1
.word IF-1
.word RESTORE-1
.word GOSUB-1
.word POP-1
.ifdef APPLE
.word TEX-1
.else
.word REM-1
.endif
.word STOP-1
.word ON-1
.ifndef CBM_KBD_APPLE
@ -589,7 +597,11 @@ LE28E:
.ifdef CBM
jsr STROUT
.else
jsr GOWARM
.ifdef APPLE
jsr GOSTROUT
.else
jsr GOWARM ; XXX
.endif
.endif
L2351:
jsr INLIN
@ -832,8 +844,9 @@ RET3:
rts
.else
.ifdef APPLE
INLIN:
ldx #$DD
L0C27:
INLIN1:
stx $33
jsr L2900
cpx #$EF
@ -1158,12 +1171,20 @@ STKINI:
pla
.ifdef CBM2_KBD
tay
.else
.ifdef APPLE
sta STACK+249
.else
sta STACK+253
.endif
.endif
pla
.ifndef CBM2_KBD
.ifdef APPLE
sta STACK+250
.else
sta STACK+254
.endif
.endif
ldx #STACK_TOP
txs
@ -1434,9 +1455,11 @@ NEWSTT2:
jsr EXECUTE_STATEMENT
jmp NEWSTT
EXECUTE_STATEMENT:
.ifndef CONFIG_11
.ifndef CONFIG_11_NOAPPLE
beq RET1
.ifndef APPLE
sec
.endif
.else
beq RET2
.endif
@ -1590,49 +1613,6 @@ L271C:
sty CURLIN+1
RET1:
rts
.ifdef APPLE
L0F14:
bne RET1
jmp L0D28
L0F19:
jsr L0F42
jsr LFECD
jsr L0F51
jmp LFECD
L0F25:
jsr L0F42
jsr LFEFD
jsr L0F51
jsr LFEFD
lda #$3B
ldy #$0F
jsr STROUT
jmp L0BF3
brk
.byte $4F
eor ($44,x)
eor $44
brk
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
.endif
.ifdef KBD
PRT:
jsr GETBYT
@ -1664,11 +1644,50 @@ NULL:
L2739:
jmp IQERR
.endif
.ifndef CONFIG_11
.ifndef CONFIG_11_NOAPPLE
CLEAR:
bne RET1
jmp CLEARC
.endif
.ifdef APPLE
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
.endif
.ifdef KIM
SAVE:
tsx
@ -2188,7 +2207,11 @@ LC9D8:
sta Z16
.endif
jsr OUTDO
.ifdef APPLE
lda #$80
.else
lda #$0A
.endif
jsr OUTDO
PRINTNULLS:
.ifdef CBM1
@ -2258,14 +2281,18 @@ L29F5:
.ifndef CONFIG_11_NOAPPLE
.ifdef APPLE
beq L1185
jmp L1528
jmp SYNERR
L1185:
.else
bne SYNERR4
.endif
pla
cmp #TOKEN_TAB
.ifdef APPLE
bne L2A09
.else
bne L2A0A
.endif
.else
.ifdef CBM2_KBD
bne SYNERR4
@ -2530,7 +2557,11 @@ L2A9E:
lda #$2C
sta INPUTBUFFER-1
LCAF8:
.ifdef APPLE
jsr INLINX
.else
jsr NXIN
.endif
.ifdef KBD
bmi L2ABE
NXIN:
@ -4624,7 +4655,7 @@ ASC:
ldy #$00
lda (INDEX),y
tay
.ifndef CONFIG_11
.ifndef CONFIG_11_NOAPPLE
jmp SNGFLT1
.else
jmp SNGFLT
@ -7002,17 +7033,23 @@ L4192:
sty L0002
jmp (L0001)
.endif
.ifdef APPLE
.byte $C3,$CF,$D0,$D9,$D2,$C9,$C7,$C8
.byte $D4,$A0,$B1,$B9,$B7,$B7,$A0,$C2
.byte $D9,$A0,$CD,$C9,$C3,$D2,$CF,$D3
.byte $CF,$C6,$D4,$A0,$C3,$CF,$0D,$00
.endif
.ifndef CBM_APPLE
QT_WANT:
.byte "WANT SIN-COS-TAN-ATN"
.byte $00
.endif
QT_WRITTEN_BY:
.ifndef CBM
.ifdef APPLE
; set the MSB of every byte of a string
.macro asc80 str
.repeat .strlen(str),I
.byte .strat(str,I)+$80
.endrep
.endmacro
asc80 "COPYRIGHT 1977 BY MICROSOFT CO"
.byte $0D,$00
.else
.byte $0D,$0A,$0C
.ifdef OSI_KBD
.byte "WRITTEN BY RICHARD W. WEILAND."
@ -7021,7 +7058,6 @@ QT_WRITTEN_BY:
.endif
.byte $0D,$0A,$00
.endif
.ifndef CBM
QT_MEMORY_SIZE:
.byte "MEMORY SIZE"
.byte $00
@ -7639,7 +7675,7 @@ L2912:
bne L2907
ldx $33
rts
L291B:
PLT:
.byte $4C
L291C:
beq L2947
@ -7697,7 +7733,7 @@ L2962:
L2978:
cmp #$56
beq L297F
jmp L1528
jmp SYNERR
L297F:
ldy $0300
lda $0302
@ -7705,11 +7741,11 @@ L297F:
L2988:
dex
beq L2930
L298B:
INLINX:
jsr OUTQUES
jsr OUTSP
ldx #$80
jmp L0C27
jmp INLIN
brk
brk
brk