One of the things I'll try to do in my blog posts is explain the code changes as well as update overall status..
The initial version of the ROM assembles and boots, but it crashes when you enter a live of code.
There are some differences from the original ROM, probably due to the disassembly having some minor errors and I threw in a few optimizations. So I'll have to remove optimizations and get it working first. I actually tried this before writing the project page so I'm not really trying to skip a step. This is where the initial milestone came from.
I am using TASM to assemble the code and syntax changes were required,so that could also be a problem. None of the commands in the token table were terminated properly. The interpreter expects the last character of the strings to be logically ORed with $80 (%1000000). That lets the code test for a negative number instead of having to use an additional byte to terminate each string. It works quite well since $80 is above the ASCII characters we have to use.
Here are the Easter eggs and programmer's name in the ROM. This is from the disassembly located in the files area of the MC-10 Yahoo group.: Most of the space savings we'll use to add ELSE comes from removing these..
Easter egg #1. If you pass an invalid color to CLS, it clears the screen to green and prints MICROSOFT. My change clears the screen turn green. The code to be changed starts at $FBB8
4998 FB92 ;***Here is the new version. Notice it just jumps to a different address and uses existing code.
4999 FB92 ;*** CLS [color]
5000 FB92 ;***
5001 FB92 27 13 CLS beq LFBD4 ; branch if no parameter provided
5002 FB94 BD EE F1 jsr LEF0D ; Evaulate unsigned 8 bit integer expression into ACCB
5003 FB97 C1 08 cmpb #8 ; if color number > 8 then..
5004 FB99 ; bhi LFBE5 ; ..go clear with default color and print 'MICROSOFT'
5005 FB99 22 0C bhi LFBD4 ; ..go clear with default color
5006 FB9B 5D tstb ; check for color code if 0
5007 FB9C 27 06 beq LFBD1 ; branch if CLS 0
5008 FB9E 5A decb ; convert the color number..
5009 FB9F 86 10 ldaa #16 ; ..to a SemiGraphics 4 VDG code..
5010 FBA1 3D mul ; ..using the formula:
5011 FBA2 CA 0F orab #$0F ; .. (colorNum - 1) * 16 | $0F
5012 FBA4 CA 80 LFBD1 orab #$80 ; ..and set the graphics bit (bit 7)
5013 FBA6 8C fcb SKP2 ; skip next instruction
5014 FBA7 C6 60 LFBD4 ldab #$60 ; default color blank character
5015 FBA9 CE 40 00 ldx #VIDRAM ; point X to start of video RAM
5016 FBAC FF 42 80 LFBD9 stx CRSPTR ; set new cursor location
5017 FBAF E7 00 LFBDC stab ,X ; clear screen location with color code
5018 FBB1 08 inx ; bump pointer
5019 FBB2 8C 42 00 cpx #VIDRAM+$200 ; end of video RAM?
5020 FBB5 26 F8 bne LFBDC ; loop if more to do
5021 FBB7 39 rts ; return
5022 FBB8
5023 FBB8 ;* Clear screen using default color and then print 'MICROSOFT'
5024 FBB8 ;LFBE5 bsr LFBD4 ; clear screen
5025 FBB8 ; ldx #MS_STR-1 ; point X to 'MICROSOFT' string (-1)
5026 FBB8 ; jmp STROUT ; output string
5027 FBB8
This saves 9 bytes.
;***
;*** CLS [color]
;***
CLS beq LFBD4 ; branch if no parameter provided
jsr LEF0D ; Evaulate unsigned 8 bit integer expression into ACCB
cmpb #8 ; if color number > 8 then..
; bhi LFBE5 ; ..go clear with default color and print 'MICROSOFT'
bhi LFBD4 ; ..go clear with default color
tstb ; check for color code if 0
beq LFBD1 ; branch if CLS 0
decb ; convert the color number..
ldaa #16 ; ..to a SemiGraphics 4 VDG code..
mul ; ..using the formula:
orab #$0F ; .. (colorNum - 1) * 16 | $0F
LFBD1 orab #$80 ; ..and set the graphics bit (bit 7)
fcb SKP2 ; skip next instruction
LFBD4 ldab #$60 ; default color blank character
ldx #VIDRAM ; point X to start of video RAM
LFBD9 stx CRSPTR ; set new cursor location
LFBDC stab ,X ; clear screen location with color code
inx ; bump pointer
cpx #VIDRAM+$200 ; end of video RAM?
bne LFBDC ; loop if more to do
rts ; return
Easter egg #2. This is actually a remnent from the 6502 code. Microsoft hid their name at the end of a math table in a manner that people would just think it's part of the table.
Removing this saves 10 bytes.
4227 F701 ;* The text 'MICROSOFT!' obfuscated and reversed. Some versionsAnd here we have the programmer's name in reverse.
4228 F701 ;* of Microsoft Basic include a routine to print this message to the
4229 F701 ;* console, but MicroColor Basic does not.
4230 F701 ; fcb $80+'!'
4231 F701 ; fcb $00+'T'
4232 F701 ; fcb $00+'F'
4233 F701 ; fcb $40+'O'
4234 F701 ; fcb $1F&'S'
4235 F701 ; fcb $40+'O'
4236 F701 ; fcb $00+'R'
4237 F701 ; fcb $00+'C'
4238 F701 ; fcb $40+'I'
4239 F701 ; fcb $80+'M'
4240 F701
Removing this saves 8 bytes.
We are half way to our goal.
5655 FF97
5656 FF97 ;* Mark Chamberlin co-wrote the 6800 version of Microsoft Basic.
5657 FF97 ;* Perhaps he also worked on the MC-10 version?
5658 FF97 ; fcc 'nilrebmahC' ; 'Chamberlin' spelled backwards
5659 FF97
Sorry if the quoted test isn't properly formatted.
I can spend time making the blog look pretty or spend time on the code.
No comments:
Post a Comment