Saturday, October 29, 2022

Part 2j: History in the making

It wasn't long before I finally got to test out the command that MicroSoft's own Paul Allen typed into the ALTAIR 8800 when he flew to MITS to demonstrate their first version of BASIC. Although this was possibly done on the 4K version of BASIC, I think the historical recognition still applies here:

History in the making. A simple command to add 2+2 does a lot more than you think.

Keep in mind that this is floating point BASIC, so the '2's are converted to from human readable decimal to binary floating point format and then they are added, then the result is converted back from floating point and printed on the screen in human readable decimal format.

At this point I think I have achieved my initial goal to test out the feasibility of running 8K ALTAIR 680 BASIC on the ETA-3400X.

At this point I could have sat back and handed my work over to other more experienced programmers to finish the job. I probably only had about 20% of the entire 8K entered by this stage and thought I had to comment the entire disassembled source in order to get it to work. But I realised that nobody else would have the hardware besides me, unless they had an emulator or something, that they could rearrange the memory and I/O.

As one of the ET-3400 group.io members commented, I don't have to actually fully understand the code in order to port it. And now I think they were partly right, although I did have to understand some of what was going on in order to de-conflict zero-page memory usage.

The light at the end of the tunnel.

Anyway, after getting this far, the Adrenalin had kicked in and I could see the light at the end of the tunnel, even if that tunnel was rather long.

Pressing on, I managed to get a lot more commands entered and tested, adding comments in the relevant blocks of code as best as I could determine.

I did avoid command that involved keywords that were not listed in the pointer table. As I mentioned TO and STEP in a FOR/NEXT loop were two such keywords. I eventually found that hidden in the FOR command segment below:

;********************************************************************
; perform FOR:
0565 : 86 80 ldaa #$80
0567 : 97 5E staa X005E ;set FNX flag
0569 : BD 07 91 jsr LET ;get variable name
056C : BD 02 A7 jsr L02A7
056F : 31 ins
0570 : 31 ins
0571 : 26 04 bne L0577
0573 : BD 03 06 jsr L0306
0576 : 35 txs
0577 L0577:
0577 : C6 08 ldab #$08
0579 : BD 02 EA jsr L02EA
057C : BD 07 0B jsr L070B
057F : DF 71 stx X0071
0581 : D6 72 ldab X0072
0583 : 37 pshb
0584 : D6 71 ldab X0071
0586 : 37 pshb
0587 : D6 8B ldab X008B
0589 : 37 pshb
058A : D6 8A ldab X008A
058C : 37 pshb
058D : C6 9B ldab #$9B ;"TO" token
058F : BD 0B 3F jsr L0B3F
0592 : BD 0A 0D jsr L0A0D
0595 : BD 0A 0B jsr L0A0B
0598 : D6 B3 ldab X00B3
059A : CA 7F orab #$7F
059C : D4 B0 andb X00B0
059E : D7 B0 stab X00B0
05A0 : CE 05 A6 ldx #$05A6
05A3 : 7E 0A AB jmp L0AAB
;
05A6 : CE 12 B1 ldx #$12B1
05A9 : BD 14 38 jsr L1438
;--------------------------------------------
;05AC : BD 00 C7 jsr L00C7
;---------------patch------------------------ ;patch for relocated z-page subroutine
05AC : BD 00 D8 jsr L00D8
;--------------------------------------------
05AF : 81 A0 cmpa #$A0 ;is it STEP token ?
05B1 : 26 06 bne L05B9 ;no,
;--------------------------------------------

'TO' token (#$9B) hidden at $058E, and 'STEP' token (#$A0) hidden at $05B0.

I found these hidden tokens by entering a short FOR-TO-STEP command and placing a breakpoints at the start of the FOR command. Once it hit the breakpoint I stepped through the code until it hit address $058D, and wondering what that was for, then I realised it was one of my missing keyword tokens. Since I wasn't 100% sure of all of the token numbers for some commands at that stage, it also confirmed the token number for me.

Next I figure out MBF (what's MBF, I hear you ask)...

No comments:

Post a Comment

Part 2o: The future of the ETA-3400X

You can find all the work I've done on the ETA-3400X and 8K ALTAIR 680 BASIC, except for the ETA-3400X Gerber files, on the ET-3400 grou...