Remove need to write enable LC, fix STDLIB module address

This commit is contained in:
David Schmenk 2014-06-20 09:29:15 -07:00
parent e98b96cf57
commit 72af9602db
2 changed files with 68 additions and 74 deletions

View File

@ -21,7 +21,7 @@ predef crout, cout, prstr, cin, rdstr
predef markheap, allocheap, allocalignheap, releaseheap, availheap
predef memset, memcpy
predef uword_isgt, uword_isge, uword_islt, uword_isle
predef loadmod, execmod, lookupmod
predef loadmod, execmod, lookupstrmod
;
; System variable.
;
@ -77,7 +77,7 @@ word = @uisltstr, @uword_islt
word = @uislestr, @uword_isle
word = @loadstr, @loadmod
word = @execstr, @execmod
word = @modadrstr, @lookupmod
word = @modadrstr, @lookupstrmod
word = @machidstr, MACHID
word = 0
word stdlibsym = @exports
@ -504,11 +504,11 @@ asm dcitos
STA SRCH
LDY #$00
- LDA (SRC),Y
CMP #$80
AND #$7F
CMP (SRC),Y
INY
STA (DST),Y
BCC -
BCS -
TYA
LDY #$00
STA (DST),Y
@ -602,12 +602,11 @@ asm modtosym
INX
LDY #$00
LDA #'#'+$80
STA (DST),Y
- LDA (SRC),Y
- STA (DST),Y
CMP #$80
LDA (SRC),Y
INY
STA (DST),Y
AND #$80
BMI -
BCS -
RTS
end
;
@ -645,8 +644,8 @@ asm lookuptbl
CMP (SRC),Y
BNE ++
INY
AND #$80
BMI -
CMP #$80
BCS -
LDA (DST),Y
PHA
INY
@ -662,16 +661,14 @@ asm lookuptbl
INC DSTL
BNE ++
INC DSTH
++ AND #$80
BMI --
++ CMP #$80
BCS --
LDA #$02
CLC
ADC DSTL
STA DSTL
TYA
ADC DSTH
STA DSTH
BNE -
BCC -
INC DSTH
BCS -
end
;
; ProDOS routines
@ -827,6 +824,11 @@ def lookupmod(mod)
byte dci[17]
return lookuptbl(modtosym(mod, @dci), symtbl)
end
def lookupstrmod(str)
byte mod[17]
stodci(str, @mod)
return lookupmod(@mod)
end
def addmod(mod, addr)
byte dci[17]
return addsym(modtosym(mod, @dci), addr)
@ -1246,7 +1248,7 @@ heap = *freemem
; Init symbol table.
;
stodci(@stdlibstr, heap)
addmod(heap, @systemflags)
addmod(heap, @version)
while *stdlibsym
stodci((stdlibsym):0, heap)
addsym(heap, (stdlibsym):2)

View File

@ -179,9 +179,7 @@ OPTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0E
;*
;* ENTER INTO BYTECODE INTERPRETER
;*
DINTERP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
PLA
DINTERP PLA
STA IPL
PLA
STA IPH
@ -189,9 +187,7 @@ DINTERP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
LDA #>OPTBL
STA OPPAGE
JMP FETCHOP
IINTRP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
PLA
IINTRP PLA
STA TMPL
PLA
STA TMPH
@ -205,9 +201,7 @@ IINTRP BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
LDA #>OPTBL
STA OPPAGE
JMP FETCHOP
IINTRPX BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
PLA
IINTRPX PLA
STA TMPL
PLA
STA TMPH
@ -316,10 +310,12 @@ DISABLE80 !BYTE 21, 13, '1', 26, 13
FAILMSG !BYTE 39
!TEXT "MISSING CMD. PRESS ANY KEY TO RESET..."
PAGE0 = *
;******************************
;* *
;* INTERP BYTECODE INNER LOOP *
;* *
;******************************
!PSEUDOPC $00EF {
;*
;* INTERP BYTECODE INNER LOOP
;*
INX ; DROP @ $EF
INY ; NEXTOP @ $F0
BEQ NEXTOPH
@ -330,10 +326,10 @@ NEXTOPH INC IPH
BNE FETCHOP
}
PAGE3 = *
!PSEUDOPC $03D0 {
;*
;* PAGE 3 VECTORS INTO INTERPRETER
;*
!PSEUDOPC $03D0 {
BIT LCRDEN+LCBNK2 ; $03D0 - DIRECT INTERP ENTRY
JMP DINTERP
BIT LCRDEN+LCBNK2 ; $03D6 - INDIRECT INTERP ENTRY
@ -401,13 +397,13 @@ IDXW LDA ESTKL,X
;* MUL TOS-1 BY TOS
;*
MUL STY IPY
LDY #$00
STY TMPL ; PRODL
STY TMPH ; PRODH
LDY #$10
MUL1 LSR ESTKH,X ; MULTPLRH
LDA #$00
STA TMPL ; PRODL
STA TMPH ; PRODH
MULLP LSR ESTKH,X ; MULTPLRH
ROR ESTKL,X ; MULTPLRL
BCC MUL2
BCC +
LDA ESTKL+1,X ; MULTPLNDL
CLC
ADC TMPL ; PRODL
@ -415,15 +411,15 @@ MUL1 LSR ESTKH,X ; MULTPLRH
LDA ESTKH+1,X ; MULTPLNDH
ADC TMPH ; PRODH
STA TMPH
MUL2 ASL ESTKL+1,X ; MULTPLNDL
+ ASL ESTKL+1,X ; MULTPLNDL
ROL ESTKH+1,X ; MULTPLNDH
DEY
BNE MUL1
BNE MULLP
INX
; LDA TMPH ; PRODH
STA ESTKH,X
LDA TMPL ; PRODL
STA ESTKL,X
LDA TMPH ; PRODH
STA ESTKH,X
LDY IPY
JMP NEXTOP
;*
@ -441,31 +437,31 @@ _DIV STY IPY
LDA ESTKH,X
AND #$80
STA DVSIGN
BPL _DIV1
BPL +
JSR _NEG
INC DVSIGN
_DIV1 LDA ESTKH+1,X
BPL _DIV2
+ LDA ESTKH+1,X
BPL +
INX
JSR _NEG
DEX
INC DVSIGN
BNE _DIV3
_DIV2 ORA ESTKL+1,X ; DVDNDL
BNE _DIV3
BNE _DIV1
+ ORA ESTKL+1,X ; DVDNDL
BNE _DIV1
STA TMPL
STA TMPH
RTS
_DIV3 LDY #$11 ; #BITS+1
_DIV1 LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
_DIV4 ASL ESTKL+1,X ; DVDNDL
- ASL ESTKL+1,X ; DVDNDL
ROL ESTKH+1,X ; DVDNDH
DEY
BCC _DIV4
BCC -
STY ESTKL-1,X
_DIV5 ROL TMPL ; REMNDRL
_DIVLP ROL TMPL ; REMNDRL
ROL TMPH ; REMNDRH
LDA TMPL ; REMNDRL
SEC
@ -473,13 +469,13 @@ _DIV5 ROL TMPL ; REMNDRL
TAY
LDA TMPH ; REMNDRH
SBC ESTKH,X ; DVSRH
BCC _DIV6
BCC +
STA TMPH ; REMNDRH
STY TMPL ; REMNDRL
_DIV6 ROL ESTKL+1,X ; DVDNDL
+ ROL ESTKL+1,X ; DVDNDL
ROL ESTKH+1,X ; DVDNDH
DEC ESTKL-1,X
BNE _DIV5
BNE _DIVLP
LDY IPY
RTS
;*
@ -1373,17 +1369,17 @@ IBRNCH LDA IPL
;*
CALL +INC_IP
LDA (IP),Y
STA CALLADR+1
STA TMPL
+INC_IP
LDA (IP),Y
STA CALLADR+2
STA TMPH
LDA IPH
PHA
LDA IPL
PHA
TYA
PHA
CALLADR JSR $FFFF
JSR JMPTMP
PLA
TAY
PLA
@ -1392,16 +1388,14 @@ CALLADR JSR $FFFF
STA IPH
LDA #>OPTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE
STA OPPAGE
BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
JMP NEXTOP
;
CALLX +INC_IP
LDA (IP),Y
STA CALXADR+1
STA TMPL
+INC_IP
LDA (IP),Y
STA CALXADR+2
STA TMPH
LDA IPH
PHA
LDA IPL
@ -1410,7 +1404,7 @@ CALLX +INC_IP
PHA
STA ALTRDOFF
CLI
CALXADR JSR $FFFF
JSR JMPTMP
SEI
STA ALTRDON
PLA
@ -1421,16 +1415,14 @@ CALXADR JSR $FFFF
STA IPH
LDA #>OPXTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE
STA OPPAGE
BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
JMP NEXTOP
;*
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
STA ICALADR+1
STA TMPL
LDA ESTKH,X
STA ICALADR+2
STA TMPH
INX
LDA IPH
PHA
@ -1438,7 +1430,7 @@ ICAL LDA ESTKL,X
PHA
TYA
PHA
ICALADR JSR $FFFF
JSR JMPTMP
PLA
TAY
PLA
@ -1447,14 +1439,12 @@ ICALADR JSR $FFFF
STA IPH
LDA #>OPTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE
STA OPPAGE
BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
JMP NEXTOP
;
ICALX LDA ESTKL,X
STA ICLXADR+1
STA TMPL
LDA ESTKH,X
STA ICLXADR+2
STA TMPH
INX
LDA IPH
PHA
@ -1464,7 +1454,7 @@ ICALX LDA ESTKL,X
PHA
STA ALTRDOFF
CLI
ICLXADR JSR $FFFF
JSR JMPTMP
SEI
STA ALTRDON
PLA
@ -1475,10 +1465,12 @@ ICLXADR JSR $FFFF
STA IPH
LDA #>OPXTBL ; MAKE SURE WE'RE INDEXING THE RIGHT TABLE
STA OPPAGE
BIT LCRWEN+LCBNK2 ; WRITE ENABLE LANGUAGE CARD
BIT LCRWEN+LCBNK2
JMP NEXTOP
;*
;* JUMP INDIRECT TRHOUGH TMP
;*
JMPTMP JMP (TMP)
;*
;* ENTER FUNCTION WITH FRAME SIZE AND PARAM COUNT
;*
ENTER +INC_IP