1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-05 03:37:43 +00:00

Peter Ferrie optimizations

This commit is contained in:
David Schmenk 2018-01-20 13:30:31 -08:00
parent eb852c8a73
commit ad3a0c6a46
10 changed files with 520 additions and 566 deletions

View File

@ -50,461 +50,470 @@ end
// Plot pixel
//
export asm dgrPlot(buff, x, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+2,X
STA SRCL
LDA ESTKH+2,X
STA SRCH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+1,X ; X COORD
LSR ESTKL,X
LDX GCLR ; COLOR
PHP
SEI
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+2,X
STA SRCL
LDA ESTKH+2,X
STA SRCH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+1,X ; X COORD
LSR ESTKL,X
LDX GCLR ; COLOR
PHP
SEI
end
asm _dgrPlotPix
JSR $3000
PLP
LDX ESP
INX
INX
INX
RTS
JSR $3000 ; _dgrSetPix
PLP
LDX ESP
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrHLin(buff, x1, x2, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+2,X ; X1 COORD
LSR ESTKL,X
PHP
- PLP
PHP
SEI
LDX GCLR ; COLOR
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA ESTKL+1,X ; X2 COORD
STA TMPH
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDY ESTKL+2,X ; X1 COORD
PHP
SEI
- LDA ESTKL,X
LSR
TYA
LDX GCLR ; COLOR
end
asm _dgrHLinPix
JSR $3000
LDX ESP
INC ESTKL+2,X ; X1 COORD
LDA ESTKL+2,X
CMP ESTKL+1,X ; X2 COORD
BCC -
BEQ -
PLP
INX
INX
INX
INX
RTS
JSR $3000 ; _dgrSetPix
LDX ESP
INC ESTKL+2,X ; X1 COORD
LDY ESTKL+2,X
CPY TMPH ; X2 COORD
BCC -
BEQ -
PLP
INX
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrVLin(buff, x, y1, y2)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+3,X
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA ESTKL+1,X ; Y1 COORD
- AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+1,X
LSR
LDA ESTKL+2,X ; X COORD
LDX GCLR ; COLOR
PHP
SEI
STX ESP
LDA ESTKL+3,X
STA SRCL
LDA ESTKH+3,X
STA SRCH
LDA ESTKL+1,X ; Y1 COORD
PHP
SEI
- AND #$FE
TAY
LDA (SRC),Y
STA GBASL
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+1,X
LSR
LDA ESTKL+2,X ; X COORD
LDX GCLR ; COLOR
end
asm _dgrVLinPix
JSR $3000
PLP
LDX ESP
INC ESTKL+1,X ; Y1 COORD
LDA ESTKL+1,X
CMP ESTKL,X ; Y2 COORD
BCC -
BEQ -
INX
INX
INX
INX
RTS
JSR $3000 ; _dgrSetPix
LDX ESP
INC ESTKL+1,X ; Y1 COORD
LDA ESTKL+1,X
CMP ESTKL,X ; Y2 COORD
BCC -
BEQ -
PLP
INX
INX
INX
INX
RTS
end
//
// Draw sprite
//
export asm dgrBLT(buff, x, y, width, height, src)#0
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+5,X
STA DSTL
LDA ESTKH+5,X
STA DSTH
LDA ESTKL+4,X ; X1 COORD
CMP #80
BPL ++++
CLC
ADC ESTKL+2,X
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+3,X ; Y1 COORD
CMP #48
BPL ++++
STA ESTKH+3,X ; Y COORD
CLC
ADC ESTKL+1,X
BMI ++++
STA ESTKH+1,X ; Y2 COORD
STX ESP
LDA ESTKH+3,X
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
CLC
ADC ESTKL+2,X ; WIDTH
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+4,X ; X1 COORD
STA ESTKH+4,X ; X COORD
PHP
SEI
-- CMP #80
BCS ++
STA TMP
LDA ESTKH+3,X ; Y COORD
LSR
LDY #$00
LDA (SRC),Y
BMI ++
TAX
LDA TMP
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+5,X
STA DSTL
LDA ESTKH+5,X
STA DSTH
LDA ESTKL+4,X ; X1 COORD
CMP #80
BPL ++++
CLC
ADC ESTKL+2,X
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+3,X ; Y1 COORD
CMP #48
BPL ++++
STA ESTKH+3,X ; Y COORD
CLC
ADC ESTKL+1,X
BMI ++++
STA ESTKH+1,X ; Y2 COORD
STX ESP
LDA ESTKH+3,X
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
CLC
ADC ESTKL+2,X ; WIDTH
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+4,X ; X1 COORD
STA ESTKH+4,X ; X COORD
PHP
SEI
-- CMP #80
BCS ++
STA TMP
LDA ESTKH+3,X ; Y COORD
LSR
LDY #$00
LDA (SRC),Y
BMI ++
TAX
LDA TMP
end
asm _dgrBLTPix
JSR $4000
LDX ESP
++ INC SRCL
BNE +
INC SRCH
+ INC ESTKH+4,X ; X COORD
LDA ESTKH+4,X
BMI --
CMP ESTKH+2,X ; X2 COORD
BCC --
PLP
+++ INC ESTKH+3,X ; Y COORD
LDA ESTKH+3,X
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
INX
INX
RTS
JSR $4000 ; _dgrSetPix
LDX ESP
++ INC SRCL
BNE +
INC SRCH
+ INC ESTKH+4,X ; X COORD
LDA ESTKH+4,X
BMI --
CMP ESTKH+2,X ; X2 COORD
BCC --
PLP
+++ INC ESTKH+3,X ; Y COORD
LDA ESTKH+3,X
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
INX
INX
RTS
end
//
// Internal set pixel routine
// - It expects the carry to be set for even or odd scanlines. Bad.
// - ACCUM has horizontal coordinate
// - X_REG has color
// - GBASE points to scanline
//
asm _dgrSetPix
BCS ++
; EVEN ROW
LSR
TAY
BCS +
BCS ++
; EVEN ROW
LSR
TAY
BCS +
end
asm _dgrSetEvnEvn
; EVEN PIXEL
LDA $2000,X
AND #$0F
STA TMP
JSR $0100 ; LDA AUX (DST),Y
AND #$F0
ORA TMP
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
RTS
; EVEN PIXEL
LDA $2000,X
AND #$0F
STA TMP
JSR $0100 ; LDA AUX (DST),Y
AND #$F0
ORA TMP
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
RTS
end
asm _dgrSetEvnOdd
; ODD PIXEL
+ LDA $1000,X
AND #$0F
STA TMP
LDA (GBASE),Y
AND #$F0
ORA TMP
STA (GBASE),Y
RTS
; ODD ROW
++ LSR
TAY
BCS +++
; ODD PIXEL
+ LDA $1000,X
AND #$0F
STA TMP
LDA (GBASE),Y
AND #$F0
ORA TMP
STA (GBASE),Y
RTS
; ODD ROW
++ LSR
TAY
BCS +++
end
asm _dgrSetOddEvn
; EVEN PIXEL
LDA $2000,X
AND #$F0
STA TMP
JSR $0100 ; LDA AUX (DST),Y
AND #$0F
ORA TMP
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
RTS
; EVEN PIXEL
LDA $2000,X
AND #$F0
STA TMP
JSR $0100 ; LDA AUX (DST),Y
AND #$0F
ORA TMP
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
RTS
end
asm _dgrSetOddOdd
; ODD PIXEL
+++ LDA $1000,X
AND #$F0
STA TMP
LDA (GBASE),Y
AND #$0F
ORA TMP
STA (GBASE),Y
RTS
; ODD PIXEL
+++ LDA $1000,X
AND #$F0
STA TMP
LDA (GBASE),Y
AND #$0F
ORA TMP
STA (GBASE),Y
RTS
end
//
// This gets copied to $0100!!!
//
asm auxRead
STA $C003 ; READ AUX MEM
LDA (GBASE),Y
STA $C002 ; READ MAIN MEM
RTS
STA $C003 ; READ AUX MEM
LDA (GBASE),Y
STA $C002 ; READ MAIN MEM
RTS
end
//
// Draw 8x8 tile (forced to 2x2 block address)
//
export asm dgrTile(buff, x, y, src)#0
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+3,X
STA DSTL
LDA ESTKH+3,X
STA DSTH
LDA ESTKL+2,X ; X1 COORD
CMP #80
BPL ++++
CLC
ADC #$08
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+1,X ; Y1 COORD
CMP #48
BPL ++++
STA TMPL ; Y COORD
CLC
ADC #$08
BMI ++++
STA ESTKH+1,X ; Y2 COORD
LDA TMPL ; Y COORD
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
ADC #$07 ; CARRY = 1
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+2,X ; X1 COORD
STA TMPH ; X COORD
PHP
SEI
-- LSR
TAY
CMP #40
LDX #$00
LDA (SRC,X)
INC SRCL
BNE +
INC SRCH
+ BCS +
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
+ LDA (SRC,X)
INC SRCL
BNE +
INC SRCH
+ BCS ++
STA (GBASE),Y
++ INC TMPH ; X COORD
INC TMPH ; X COORD
LDX ESP
LDA TMPH
BMI --
CMP ESTKH+2,X ; X2 COORD
BCC --
PLP
+++ INC TMPL ; Y COORD
INC TMPL ; Y COORD
LDA TMPL
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
RTS
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+3,X
STA DSTL
LDA ESTKH+3,X
STA DSTH
LDA ESTKL+2,X ; X1 COORD
CMP #80
BPL ++++
CLC
ADC #$08
BMI ++++
STA ESTKH+2,X ; X2 COORD
LDA ESTKL+1,X ; Y1 COORD
CMP #48
BPL ++++
STA TMPL ; Y COORD
CLC
ADC #$08
BMI ++++
STA ESTKH+1,X ; Y2 COORD
LDA TMPL ; Y COORD
- CMP #48
BCC +
LDA SRCL ; SKIP TO NEXT ROW
ADC #$07 ; CARRY = 1
STA SRCL
LDA SRCH
ADC #$00
STA SRCH
BNE +++
+ AND #$FE
TAY
LDA (DST),Y
STA GBASL
INY
LDA (DST),Y
STA GBASH
LDA ESTKL+2,X ; X1 COORD
STA TMPH ; X COORD
PHP
SEI
-- LSR
TAY
CMP #40
LDX #$00
LDA (SRC,X)
INC SRCL
BNE +
INC SRCH
+ BCS +
STA $C005 ; WRITE AUX MEM
STA (GBASE),Y
STA $C004 ; WRITE MAIN MEM
+ LDA (SRC,X)
INC SRCL
BNE +
INC SRCH
+ BCS ++
STA (GBASE),Y
++ INC TMPH ; X COORD
INC TMPH ; X COORD
LDX ESP
LDA TMPH
BMI --
CMP ESTKH+2,X ; X2 COORD
BCC --
PLP
+++ INC TMPL ; Y COORD
INC TMPL ; Y COORD
LDA TMPL
BMI -
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
RTS
end
//
// Draw a string of tiles
//
export asm dgrTileStr(buff, x, y, tilestr, strlen, tilebuff)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+9,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+9,X
STA ESTKH+3,X
LDA ESTKL+8,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+7,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
STA ESTKH,X
- DEX
DEX
DEX
DEX
LDA ESTKL+9,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+9,X
STA ESTKH+3,X
LDA ESTKL+8,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+7,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
STA ESTKH,X
end
asm _dgrTileTile
JSR $5000
LDA ESTKL+4,X ; UPDATE X COORD
CLC
ADC #$08
CMP #80 ; OFF RIGHT SIDE
BPL +
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ TXA
CLC
ADC #6
TAX
RTS
JSR $5000
LDA ESTKL+4,X ; UPDATE X COORD
CLC
ADC #$08
CMP #80 ; OFF RIGHT SIDE
BPL +
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ TXA
CLC
ADC #6
TAX
RTS
end
//
// Draw a string of tiles
// Fill a buffer with tiles
//
export asm dgrFill(buff, x, y, tile)#0
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
LDA ESTKL+1,X
AND #$0F
STA ESTKL+1,X
LDA #$00
SEC
SBC ESTKL+2,X ; ORIGINAL X
STA ESTKL+2,X
STA ESTKH+2,X
LDA #$00
SEC
SBC ESTKL+1,X
STA ESTKL+1,X
- DEX
DEX
DEX
DEX
LDA ESTKL+7,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+7,X
STA ESTKH+3,X
LDA ESTKL+6,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+5,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
STA ESTKH,X
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
LDA ESTKL+1,X
AND #$0F
STA ESTKL+1,X
LDA #$00
SEC
SBC ESTKL+2,X ; ORIGINAL X
STA ESTKL+2,X
STA ESTKH+2,X
LDA #$00
SEC
SBC ESTKL+1,X
STA ESTKL+1,X
- DEX
DEX
DEX
DEX
LDA ESTKL+7,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+7,X
STA ESTKH+3,X
LDA ESTKL+6,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+5,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
STA ESTKH,X
end
asm _dgrFillTile
JSR $5000
LDA ESTKL+2,X ; UPDATE X COORD
CLC
ADC #$08
STA ESTKL+2,X
CMP #80 ; OFF RIGHT SIDE?
BMI -
LDA ESTKH+2,X ; RESTORE X COORD
STA ESTKL+2,X
LDA ESTKL+1,X ; UPDATE Y COORD
CLC
ADC #$08
STA ESTKL+1,X
CMP #48 ; OFF BOTTOM?
BMI -
INX
INX
INX
INX
RTS
JSR $5000
LDA ESTKL+2,X ; UPDATE X COORD
CLC
ADC #$08
STA ESTKL+2,X
CMP #80 ; OFF RIGHT SIDE?
BMI -
LDA ESTKH+2,X ; RESTORE X COORD
STA ESTKL+2,X
LDA ESTKL+1,X ; UPDATE Y COORD
CLC
ADC #$08
STA ESTKL+1,X
CMP #48 ; OFF BOTTOM?
BMI -
INX
INX
INX
INX
RTS
end
//
// Wait for VLB
// Wait for VLB - Doens't work on //c
//
asm vlbWait#0
- LDA $C019
BMI -
- LDA $C019
BPL -
RTS
- LDA $C019
BMI -
- LDA $C019
BPL -
RTS
end
//
// Set double lores graphics, return draw buffer
@ -645,7 +654,7 @@ end
// Make sure we are a 128K //e or //c
//
if MACHID & $F0 <> $B0
puts("\n128K REQUIRED FOR DOUBLE LO-RES.")
puts("\n128K required for double-lores.\n")
^$C010
while ^$C000 < 128; loop
return -1

View File

@ -565,13 +565,14 @@ asm auxmove(dst, src, len)#0
CLC
BEQ +
SEC
+ LDA ESTKH,X
ADC #$00
STA $02FF
+ LDA #$00
TAY
ADC ESTKH,X
INX
INX
INX
STX ESP
TAX
PHP
SEI
STA $C009 ; SELECT ALTZP
@ -585,7 +586,6 @@ asm auxmove(dst, src, len)#0
STA $3C
LDA $02FD
STA $3D
LDY #$00
- LDA ($3C),Y
STA ($42),Y
INY
@ -594,7 +594,7 @@ asm auxmove(dst, src, len)#0
INC $43
+ DEC $02FE
BNE -
DEC $02FF
DEX
BNE -
STA $C008 ; SELECT MAINZP
PLP
@ -728,7 +728,7 @@ def loadcode(codefile)
byte ref
word pcode, seglen
byte filepath[64]
//puts(codefile); puts(":\n")
pcode = 0
ref = fileio:open(strcat(strcpy(@filepath, cmdsys:syspath), codefile))

View File

@ -17,15 +17,15 @@ export asm tone2(pitch1, pitch2, duration)#0
INY
+ STA DSTL
STY DSTH
LDY ESTKL+1,X
LDY ESTKL+1,X
STY TMPL
LDA ESTKL+2,X
TAX
CMP TMPL
BNE +
LDX #$00
+ STX TMPH
TAX
LDA #$00
CPX TMPL
BNE +
TAX
+ STX TMPH
PHP
SEI
- CLC

View File

@ -149,8 +149,7 @@ asm call(addr,areg,xreg,yreg,sstatus)#1
STA CALL6502+2
LDA ESTKL,X
PHA
LDA ESTKL+1,X
TAY
LDY ESTKL+1,X
LDA ESTKL+3,X
PHA
LDA ESTKL+2,X

View File

@ -161,8 +161,7 @@ REGVALS = SRC
STA TMPH
LDA ESTKL,X
PHA
LDA ESTKL+1,X
TAY
LDY ESTKL+1,X
LDA ESTKL+3,X
PHA
LDA ESTKL+2,X

View File

@ -1,49 +1,48 @@
INTERP = $03D0
LCRDEN = $C080
LCWTEN = $C081
ROMEN = $C082
LCRWEN = $C083
LCBNK2 = $00
LCBNK1 = $08
!SOURCE "vmsrc/plvmzp.inc"
INTERP = $03D0
LCRDEN = $C080
LCWTEN = $C081
ROMEN = $C082
LCRWEN = $C083
LCBNK2 = $00
LCBNK1 = $08
!SOURCE "vmsrc/plvmzp.inc"
;*
;* MOVE CMD DOWN TO $1000-$2000
;*
LDA #<_CMDBEGIN
STA SRCL
LDA #>_CMDBEGIN
STA SRCH
LDY #$00
STY DSTL
LDA #$10
STA DSTH
- LDA (SRC),Y
STA (DST),Y
INY
BNE -
INC SRCH
INC DSTH
LDA DSTH
CMP #$20 ; STOP WHEN DST=$2000 REACHED
BNE -
LDA #<_CMDEND
STA SRCL
LDA #>_CMDEND
STA SRCH
LDA #<_CMDBEGIN
STA SRCL
LDA #>_CMDBEGIN
STA SRCH
LDY #$00
STY DSTL
LDX #$10
STX DSTH
- LDA (SRC),Y
STA (DST),Y
INY
BNE -
INC SRCH
INC DSTH
DEX ; STOP WHEN DST=$2000 REACHED
BNE -
LDA #<_CMDEND
STA SRCL
LDA #>_CMDEND
STA SRCH
;
; INIT VM ENVIRONMENT STACK POINTERS
;
STY PPL
STY IFPL ; INIT FRAME POINTER
LDA #$BF
STA PPH
STA IFPH
LDX #$FE ; INIT STACK POINTER (YES, $FE. SEE GETS)
TXS
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
JMP $1000
_CMDBEGIN = *
!PSEUDOPC $1000 {
!SOURCE "vmsrc/cmd.a"
_CMDEND = *
}
STY PPL
STY IFPL ; INIT FRAME POINTER
LDA #$BF
STA PPH
STA IFPH
LDX #$FE ; INIT STACK POINTER (YES, $FE. SEE GETS)
TXS
LDX #ESTKSZ/2 ; INIT EVAL STACK INDEX
JMP $1000
_CMDBEGIN = *
!PSEUDOPC $1000 {
!SOURCE "vmsrc/cmd.a"
_CMDEND = *
}

View File

@ -88,7 +88,7 @@ MULLP LSR TMPH ; MULTPLRH
ADC ESTKH+1,X ; PRODH
+ ASL ESTKL,X ; MULTPLNDL
ROL ESTKH,X ; MULTPLNDH
DEY
DEY
BNE MULLP
STA ESTKH+1,X ; PRODH
LDY IPY
@ -167,13 +167,7 @@ DIVMOD JSR _DIV
;*
;* NEGATE TOS
;*
NEG LDA #$00
SEC
SBC ESTKL,X
STA ESTKL,X
LDA #$00
SBC ESTKH,X
STA ESTKH,X
NEG JSR _NEG
JMP NEXTOP
;*
;* INTERNAL DIVIDE ALGORITHM
@ -191,7 +185,7 @@ _DIV STY IPY
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
LDA ESTKH,X
LDA ESTKH,X
AND #$80
STA DVSIGN
BPL +
@ -309,10 +303,12 @@ SHL STY IPY
SBC #$08
SHL1 TAY
BEQ SHL3
SHL2 ASL ESTKL+1,X
LDA ESTKL+1,X
SHL2 ASL
ROL ESTKH+1,X
DEY
BNE SHL2
STA ESTKL+1,X
SHL3 LDY IPY
JMP DROP
;*
@ -802,24 +798,22 @@ BRFLS INX
ORA ESTKL-1,X
BNE NOBRNCH
BRNCH TYA ; FLATTEN IP
CLC
SEC
ADC IPL
STA TMPL
LDA #$00
TAY
ADC IPH
STA TMPH ; ADD BRANCH OFFSET
INY
LDA (IP),Y
CLC
LDA (TMP),Y
;CLC ; BETTER NOT CARRY OUT OF IP+Y
ADC TMPL
STA TMPL
STA IPL
INY
LDA (IP),Y
LDA (TMP),Y
ADC TMPH
STA IPH
LDA TMPL
STA IPL
LDY #$01
DEY
JMP FETCHOP
BREQ INX
LDA ESTKL-1,X
@ -860,6 +854,23 @@ IBRNCH LDA IPL
STA IPH
JMP DROP
;*
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
!IF SELFMODIFY {
STA CALLADR+1
} ELSE {
STA TMPL
}
LDA ESTKH,X
!IF SELFMODIFY {
STA CALLADR+2
} ELSE {
STA TMPH
}
INX
BNE _CALL
;*
;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE)
;*
CALL INY ;+INC_IP
@ -876,7 +887,7 @@ CALL INY ;+INC_IP
} ELSE {
STA TMPH
}
TYA
_CALL TYA
CLC
ADC IPL
PHA
@ -895,40 +906,6 @@ CALLADR JSR $FFFF
LDY #$01
JMP FETCHOP
;*
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
!IF SELFMODIFY {
STA ICALADR+1
} ELSE {
STA TMPL
}
LDA ESTKH,X
!IF SELFMODIFY {
STA ICALADR+2
} ELSE {
STA TMPH
}
INX
TYA
CLC
ADC IPL
PHA
LDA IPH
ADC #$00
PHA
!IF SELFMODIFY {
ICALADR JSR $FFFF
} ELSE {
JSR JMPTMP
}
PLA
STA IPH
PLA
STA IPL
LDY #$01
JMP FETCHOP
;*
;* JUMP INDIRECT TRHOUGH TMP
;*
JMPTMP JMP (TMP)

View File

@ -660,10 +660,12 @@ SHL STY IPY
SBC #$08
SHL1 TAY
BEQ SHL3
SHL2 ASL ESTKL+1,X
LDA ESTKL+1,X
SHL2 ASL
ROL ESTKH+1,X
DEY
BNE SHL2
STA ESTKL+1,X
SHL3 LDY IPY
JMP DROP
;*

View File

@ -131,7 +131,7 @@ INTERP PLA
PLA
ADC #$00
STA IPH
LDA IFPH
PHA ; SAVE ON STACK FOR LEAVE/RET
LDA IFPL
@ -161,7 +161,7 @@ XINTERP PLA
LDA (TMP),Y
STA IPL
DEY
LDA IFPH
PHA ; SAVE ON STACK FOR LEAVE/RET
LDA IFPL
@ -273,13 +273,7 @@ MULLP LSR TMPH ; MULTPLRH
;*
;* NEGATE TOS
;*
NEG LDA #$00
SEC
SBC ESTKL,X
STA ESTKL,X
LDA #$00
SBC ESTKH,X
STA ESTKH,X
NEG JSR _NEG
JMP NEXTOP
;*
;* DIV TOS-1 BY TOS
@ -432,13 +426,13 @@ SHL STY IPY
SBC #$08
SHL1 TAY
BEQ SHL3
SHL2 ASL ESTKL+1,X
LDA ESTKL+1,X
SHL2 ASL
ROL ESTKH+1,X
DEY
BNE SHL2
STA ESTKL+1,X
SHL3 LDY IPY
; INX
; JMP NEXTOP
JMP DROP
;*
;* SHIFT TOS-1 RIGHT BY TOS
@ -466,8 +460,6 @@ SHR3 CMP #$80
BNE SHR3
STA ESTKH+1,X
SHR4 LDY IPY
; INX
; JMP NEXTOP
JMP DROP
;*
;* LOGICAL NOT
@ -988,24 +980,22 @@ BRFLS INX
ORA ESTKL-1,X
BNE NOBRNCH
BRNCH TYA ; FLATTEN IP
CLC
SEC
ADC IPL
STA TMPL
LDA #$00
TAY
ADC IPH
STA TMPH ; ADD BRANCH OFFSET
INY
LDA (IP),Y
CLC
LDA (TMP),Y
;CLC ; BETTER NOT CARRY OUT OF IP+Y
ADC TMPL
STA TMPL
STA IPL
INY
LDA (IP),Y
LDA (TMP),Y
ADC TMPH
STA IPH
LDA TMPL
STA IPL
LDY #$01
DEY
JMP FETCHOP
BREQ INX
LDA ESTKL-1,X
@ -1044,19 +1034,26 @@ IBRNCH LDA IPL
LDA IPH
ADC ESTKH,X
STA IPH
; INX
; JMP NEXTOP
JMP DROP
;*
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
STA CALLADR+1
LDA ESTKH,X
STA CALLADR+2
INX
BNE _CALL
;*
;* CALL INTO ABSOLUTE ADDRESS (NATIVE CODE)
;*
CALL INY ;+INC_IP
CALL INY ;+INC_IP
LDA (IP),Y
STA CALLADR+1
INY ;+INC_IP
INY ;+INC_IP
LDA (IP),Y
STA CALLADR+2
TYA
_CALL TYA
CLC
ADC IPL
PHA
@ -1075,32 +1072,6 @@ CALLADR JSR $FFFF
LDY #$01
JMP FETCHOP
;*
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
;*
ICAL LDA ESTKL,X
STA ICALADR+1
LDA ESTKH,X
STA ICALADR+2
INX
TYA
CLC
ADC IPL
PHA
LDA IPH
ADC #$00
PHA
LDA IPX
PHA
ICALADR JSR $FFFF
PLA
STA IPX
PLA
STA IPH
PLA
STA IPL
LDY #$01
JMP FETCHOP
;*
;* ENTER FUNCTION WITH FRAME SIZE AND PARAM COUNT
;*
ENTER LDA IFPH
@ -1109,7 +1080,6 @@ ENTER LDA IFPH
PHA
INY
LDA (IP),Y
PHA ; SAVE ON STACK FOR LEAVE
EOR #$FF
SEC
ADC PPL

View File

@ -153,8 +153,7 @@ REGVALS = SRC
LDA ESTKL,X
PHA
INX
LDA ESTKL,X
TAY
LDY ESTKL,X
INX
LDA ESTKL+1,X
PHA