No ROM replacement needed for this... but it's not a lot faster.
It uses the same patch to the CHRGET function on the direct page used in the the latest ROM.
The patch will be embedded in the REM in line 0 after the first run.
Then delete lines 9998-10000 and move the EXEC to line 1 in place of the GOSUB and save it.
It will already be embedded in the REM and there's no need to read/poke the data again.
The patch is actually resident in RAM on the direct page until you turn off the machine or it crashes.
BASIC code:
0 REM012345678901234567890123456789012345
1 GOSUB 10000
9998 DATA 60,54,55,206,67,101,236,1,221,246,236,3,221,248,236,5,221,250,236,7,221,252
9999 DATA 51,50,56,57,240,129,58,37,1,57,126,225,204
10000 FORI=0TO34:READ A:POKE 17227+I,A:NEXT:EXEC17227:RETURN
And the assembly for the TASM cross assembler:
; Simple speed up for MC-10 Microcolor BASIC
; (C)2018 James Diffendaffer
; May be freely redistributed
.MSFIRST ; Most Significant byte first
#define EQU .EQU
#define ORG .ORG
#define RMB .BLOCK
#define FCB .BYTE
#define FCC .TEXT
#define FDB .WORD
#define END .END
#define FCS .TEXT
#define equ .EQU
#define org .ORG
#define rmb .BLOCK
#define fcb .BYTE
#define fcc .TEXT
#define fdb .WORD
#define end .END
#define fcs .TEXT
org $434B
pshx
psha
pshb
ldx #PATCH
ldd 1,X
std $F6
ldd 3,x
std $F8
ldd 5,x
std $FA
ldd 7,x
std $FC
pulb
pula
pulx
rts
PATCH
FCB $F0
org $00F6
cmpa #':' ; set Z flag if statement separator
bcs AA ; perform more tests if not
rts ; return if >= ':'
AA jmp $E1CC ; jump to the parser back end
end
It uses the same patch to the CHRGET function on the direct page used in the the latest ROM.
The patch will be embedded in the REM in line 0 after the first run.
Then delete lines 9998-10000 and move the EXEC to line 1 in place of the GOSUB and save it.
It will already be embedded in the REM and there's no need to read/poke the data again.
The patch is actually resident in RAM on the direct page until you turn off the machine or it crashes.
BASIC code:
0 REM012345678901234567890123456789012345
1 GOSUB 10000
9998 DATA 60,54,55,206,67,101,236,1,221,246,236,3,221,248,236,5,221,250,236,7,221,252
9999 DATA 51,50,56,57,240,129,58,37,1,57,126,225,204
10000 FORI=0TO34:READ A:POKE 17227+I,A:NEXT:EXEC17227:RETURN
And the assembly for the TASM cross assembler:
; Simple speed up for MC-10 Microcolor BASIC
; (C)2018 James Diffendaffer
; May be freely redistributed
.MSFIRST ; Most Significant byte first
#define EQU .EQU
#define ORG .ORG
#define RMB .BLOCK
#define FCB .BYTE
#define FCC .TEXT
#define FDB .WORD
#define END .END
#define FCS .TEXT
#define equ .EQU
#define org .ORG
#define rmb .BLOCK
#define fcb .BYTE
#define fcc .TEXT
#define fdb .WORD
#define end .END
#define fcs .TEXT
org $434B
pshx
psha
pshb
ldx #PATCH
ldd 1,X
std $F6
ldd 3,x
std $F8
ldd 5,x
std $FA
ldd 7,x
std $FC
pulb
pula
pulx
rts
PATCH
FCB $F0
org $00F6
cmpa #':' ; set Z flag if statement separator
bcs AA ; perform more tests if not
rts ; return if >= ':'
AA jmp $E1CC ; jump to the parser back end
end
The FCB $F0 is padding so the embedded assembly won't have any zeros in it. LDD ,X is the same as LDD 0,X, which will have a zero.
ReplyDeleteThe reason this is important, is BASIC uses 0 as a line terminator.
If you don't take this step, when you try to list the program after running it the first time, BASIC will crash.
Please be aware that we discovered you need an extra character in the string on the REM line (1 more than the code requires) to get it to properly CLOAD after saving it with the machine code. I'm guessing this is a bug in the parser, but the fix is easy so I'm not messing with it.
ReplyDeleteThanks to Jim Gerrie for testing this!