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 Z00 := $0000
L0001 := $0001 L0001 := $0001
L0002 := $0002 L0002 := $0002
GOWARM := $0000 GOWARM := $0003
GOSTROUT := $0003 GOSTROUT := $0003
GOGIVEAYF := $0008 GOGIVEAYF := $0008
USR := $000A
CHARAC := $000D CHARAC := $000D
ENDCHR := $000E ENDCHR := $000E
EOLPNTR := $000F EOLPNTR := $000F
@ -18,9 +19,9 @@ Z14 := $0017 ; Ctrl+O flag
Z15 := $0018 Z15 := $0018
Z16 := $0050 Z16 := $0050
Z17 := $0051 Z17 := $0051
Z18 := $001B Z18 := $0052
LINNUM := $0053 LINNUM := $0053
TXPSV := $001C TXPSV := $0053
INPUTBUFFER := $0200 INPUTBUFFER := $0200
INPUTBUFFERX := $0200 INPUTBUFFERX := $0200
TEMPPT := $0063-14 TEMPPT := $0063-14
@ -85,8 +86,8 @@ RNDSEED := $00D8-14
L1800 := $1800 L1800 := $1800
L1873 := $1873 L1873 := $1873
MONRDKEY := $1E5A MONRDKEY := $FD0C
MONCOUT := $1EA0 MONCOUT := $FDED
STACK_TOP := $F8 STACK_TOP := $F8
BYTES_PER_FRAME := $12 BYTES_PER_FRAME := $12
@ -94,9 +95,8 @@ SPACE_FOR_GOSUB := $36
TEMPST := $58 TEMPST := $58
FOR_STACK1 := $0F FOR_STACK1 := $0F
FOR_STACK2 := $09 FOR_STACK2 := $09
NUM_TOKENS := $1D NUM_TOKENS := $1C
NULL_MAX := $F2 ; probably different in original version; the image I have seems to be modified; see PDF BYTES_PER_ELEMENT := 6 ; ??? should be 5 on Apple
BYTES_PER_ELEMENT := 5
BYTES_PER_VARIABLE := 7 BYTES_PER_VARIABLE := 7
BYTES_FP := 5 BYTES_FP := 5
MANTISSA_BYTES := BYTES_FP-1 MANTISSA_BYTES := BYTES_FP-1
@ -123,38 +123,32 @@ TOKEN_LEFTSTR := $C1
RAMSTART3 := $AAAA RAMSTART3 := $AAAA
RAMSTART2 := $AAAA RAMSTART2 := $AAAA
USR := $AAAA LF689 := $F689
SAVE := $AAAA LF800 := $F800
LOAD := $AAAA LF819 := $F819
LFD0C := $AAAA LF828 := $F828
INLIN := $AAAA LF864 := $F864
CLEAR := $AAAA TEX := $FB2F
L0BF3 := $AAAA LFB40 := $FB40
LFEFD := $AAAA LFD0C := $FD0C
LFECD := $AAAA LFD6A := $FD6A
LFECD := $FECD
LFEFD := $FEFD
L0D28 := $AAAA L0D28 := $AAAA
L1528 := $AAAA
L000A := $000A L000A := $000A
L123C := $AAAA L123C := $AAAA
L2829 := $AAAA L2829 := $AAAA
QT_WRITTEN_BY := $AAAA
L2AAA := $AAAA L2AAA := $AAAA
L2A52 := $AAAA L2A52 := $AAAA
L2AA3 := $AAAA L2AA3 := $AAAA
L1008 := $AAAA L1008 := $AAAA
L2A6D := $AAAA L2A6D := $AAAA
L2A68 := $AAAA L2A68 := $AAAA
LF689 := $AAAA
L0008 := $AA L0008 := $AA
LFB40 := $AAAA
L0006 := $AA L0006 := $AA
LF828 := $AAAA
LF819 := $AAAA
LF800 := $AAAA
LF864 := $AAAA
L1F20 := $AAAA L1F20 := $AAAA
L00A4 := $AA L00A4 := $AA
L1751 := $AAAA L1751 := $AAAA
L2198 := $AAAA L2198 := $AAAA
L13D7 := $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 INPUT-1
.word DIM-1 .word DIM-1
.word READ-1 .word READ-1
.ifdef APPLE
.word PLT-1
.else
.word LET-1 .word LET-1
.endif
.word GOTO-1 .word GOTO-1
.word RUN-1 .word RUN-1
.word IF-1 .word IF-1
.word RESTORE-1 .word RESTORE-1
.word GOSUB-1 .word GOSUB-1
.word POP-1 .word POP-1
.ifdef APPLE
.word TEX-1
.else
.word REM-1 .word REM-1
.endif
.word STOP-1 .word STOP-1
.word ON-1 .word ON-1
.ifndef CBM_KBD_APPLE .ifndef CBM_KBD_APPLE
@ -589,7 +597,11 @@ LE28E:
.ifdef CBM .ifdef CBM
jsr STROUT jsr STROUT
.else .else
jsr GOWARM .ifdef APPLE
jsr GOSTROUT
.else
jsr GOWARM ; XXX
.endif
.endif .endif
L2351: L2351:
jsr INLIN jsr INLIN
@ -832,8 +844,9 @@ RET3:
rts rts
.else .else
.ifdef APPLE .ifdef APPLE
INLIN:
ldx #$DD ldx #$DD
L0C27: INLIN1:
stx $33 stx $33
jsr L2900 jsr L2900
cpx #$EF cpx #$EF
@ -1158,12 +1171,20 @@ STKINI:
pla pla
.ifdef CBM2_KBD .ifdef CBM2_KBD
tay tay
.else
.ifdef APPLE
sta STACK+249
.else .else
sta STACK+253 sta STACK+253
.endif
.endif .endif
pla pla
.ifndef CBM2_KBD .ifndef CBM2_KBD
.ifdef APPLE
sta STACK+250
.else
sta STACK+254 sta STACK+254
.endif
.endif .endif
ldx #STACK_TOP ldx #STACK_TOP
txs txs
@ -1434,9 +1455,11 @@ NEWSTT2:
jsr EXECUTE_STATEMENT jsr EXECUTE_STATEMENT
jmp NEWSTT jmp NEWSTT
EXECUTE_STATEMENT: EXECUTE_STATEMENT:
.ifndef CONFIG_11 .ifndef CONFIG_11_NOAPPLE
beq RET1 beq RET1
.ifndef APPLE
sec sec
.endif
.else .else
beq RET2 beq RET2
.endif .endif
@ -1590,49 +1613,6 @@ L271C:
sty CURLIN+1 sty CURLIN+1
RET1: RET1:
rts 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 .ifdef KBD
PRT: PRT:
jsr GETBYT jsr GETBYT
@ -1664,11 +1644,50 @@ NULL:
L2739: L2739:
jmp IQERR jmp IQERR
.endif .endif
.ifndef CONFIG_11 .ifndef CONFIG_11_NOAPPLE
CLEAR: CLEAR:
bne RET1 bne RET1
jmp CLEARC jmp CLEARC
.endif .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 .ifdef KIM
SAVE: SAVE:
tsx tsx
@ -2188,7 +2207,11 @@ LC9D8:
sta Z16 sta Z16
.endif .endif
jsr OUTDO jsr OUTDO
.ifdef APPLE
lda #$80
.else
lda #$0A lda #$0A
.endif
jsr OUTDO jsr OUTDO
PRINTNULLS: PRINTNULLS:
.ifdef CBM1 .ifdef CBM1
@ -2258,14 +2281,18 @@ L29F5:
.ifndef CONFIG_11_NOAPPLE .ifndef CONFIG_11_NOAPPLE
.ifdef APPLE .ifdef APPLE
beq L1185 beq L1185
jmp L1528 jmp SYNERR
L1185: L1185:
.else .else
bne SYNERR4 bne SYNERR4
.endif .endif
pla pla
cmp #TOKEN_TAB cmp #TOKEN_TAB
.ifdef APPLE
bne L2A09
.else
bne L2A0A bne L2A0A
.endif
.else .else
.ifdef CBM2_KBD .ifdef CBM2_KBD
bne SYNERR4 bne SYNERR4
@ -2530,7 +2557,11 @@ L2A9E:
lda #$2C lda #$2C
sta INPUTBUFFER-1 sta INPUTBUFFER-1
LCAF8: LCAF8:
.ifdef APPLE
jsr INLINX
.else
jsr NXIN jsr NXIN
.endif
.ifdef KBD .ifdef KBD
bmi L2ABE bmi L2ABE
NXIN: NXIN:
@ -4624,7 +4655,7 @@ ASC:
ldy #$00 ldy #$00
lda (INDEX),y lda (INDEX),y
tay tay
.ifndef CONFIG_11 .ifndef CONFIG_11_NOAPPLE
jmp SNGFLT1 jmp SNGFLT1
.else .else
jmp SNGFLT jmp SNGFLT
@ -7002,17 +7033,23 @@ L4192:
sty L0002 sty L0002
jmp (L0001) jmp (L0001)
.endif .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 .ifndef CBM_APPLE
QT_WANT: QT_WANT:
.byte "WANT SIN-COS-TAN-ATN" .byte "WANT SIN-COS-TAN-ATN"
.byte $00 .byte $00
.endif
QT_WRITTEN_BY: 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 .byte $0D,$0A,$0C
.ifdef OSI_KBD .ifdef OSI_KBD
.byte "WRITTEN BY RICHARD W. WEILAND." .byte "WRITTEN BY RICHARD W. WEILAND."
@ -7021,7 +7058,6 @@ QT_WRITTEN_BY:
.endif .endif
.byte $0D,$0A,$00 .byte $0D,$0A,$00
.endif .endif
.ifndef CBM
QT_MEMORY_SIZE: QT_MEMORY_SIZE:
.byte "MEMORY SIZE" .byte "MEMORY SIZE"
.byte $00 .byte $00
@ -7639,7 +7675,7 @@ L2912:
bne L2907 bne L2907
ldx $33 ldx $33
rts rts
L291B: PLT:
.byte $4C .byte $4C
L291C: L291C:
beq L2947 beq L2947
@ -7697,7 +7733,7 @@ L2962:
L2978: L2978:
cmp #$56 cmp #$56
beq L297F beq L297F
jmp L1528 jmp SYNERR
L297F: L297F:
ldy $0300 ldy $0300
lda $0302 lda $0302
@ -7705,11 +7741,11 @@ L297F:
L2988: L2988:
dex dex
beq L2930 beq L2930
L298B: INLINX:
jsr OUTQUES jsr OUTQUES
jsr OUTSP jsr OUTSP
ldx #$80 ldx #$80
jmp L0C27 jmp INLIN
brk brk
brk brk
brk brk