6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu May 09, 2024 12:18 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Sep 09, 2022 8:58 pm 
Offline

Joined: Thu May 13, 2021 5:15 pm
Posts: 7
I'm diving in, once again, to an old project: disassembling and documenting the "KVOS" I found in the ROMs of a KIM-1 I bought several years ago. More information: https://retroconnector.com/bdc-6500-computer-kim-1/

I've learned a great deal since I last left it, and now I've been able to decipher enough of the boot process to work out what I think is the routine for loading a program from tape (maybe paper tape?)

This code looks like it waits for a header like "XXXX"+efabcd

The initial loop waits for an ASCII "X" 0x58, then the first three characters after X are ignored.

the e f bytes are stored in $04, $05
a,b,c,d bytes are stored in $00, $01, $02, $03

Byte c ($02) is subtracted from 0, and stored back in $02
Byte d ($03) is subtracted from 0, and stored back in $03

It then loops with a series of bytes loaded from the 6522, stored at address set in $00,$01. Loops until cd bytes are read.
When it's done loading, jumps to address in $04,$05

In short: "load the program with entry point EF, starting at AB, length CD"


Code:
FC1A           cld                    ;  D8       
FC1B           sei                    ;  78       
FC1C           ldx     #$FF           ;  A2 FF     
FC1E           txs                    ;  9A       
FC1F           lda     #$00           ;  A9 00     
FC21           sta     6522-DDRA      ;  8D 83 15 
FC24           lda     6522-PCR       ;  AD 8C 15 
FC27           and     #$F0           ;  29 F0     
FC29           ora     $0E            ;  05 0E     
FC2B           sta     6522-PCR       ;  8D 8C 15 
FC2E   LFC2E:  jsr     WAITFORIO      ;  20 7F FC 
FC31           cmp     #$58           ;  C9 58     
FC33           bne     LFC2E          ;  D0 F9     
FC35           jsr     WAITFORIO      ;  20 7F FC 
FC38           jsr     WAITFORIO      ;  20 7F FC 
FC3B   LFC3B:  jsr     WAITFORIO      ;  20 7F FC 
FC3E           jsr     WAITFORIO      ;  20 7F FC 
FC41           sta     L0004          ;  85 04     
FC43           jsr     WAITFORIO      ;  20 7F FC 
FC46           sta     $05            ;  85 05     
FC48           jsr     WAITFORIO      ;  20 7F FC 
FC4B           sta     $00            ;  85 00     
FC4D           jsr     WAITFORIO      ;  20 7F FC 
FC50           sta     $01            ;  85 01     
FC52           jsr     WAITFORIO      ;  20 7F FC 
FC55           sta     $02            ;  85 02     
FC57           jsr     WAITFORIO      ;  20 7F FC 
FC5A           sta     $03            ;  85 03     
FC5C           ldx     #$00           ;  A2 00     
FC5E           txa                    ;  8A       
FC5F   LFC5F:  sec                    ;  38       
FC60           sbc     $02            ;  E5 02     
FC62           sta     $02            ;  85 02     
FC64           txa                    ;  8A       
FC65           sbc     $03            ;  E5 03     
FC67           sta     $03            ;  85 03     
FC69   LFC69:  jsr     WAITFORIO      ;  20 7F FC 
FC6C           sta     ($00,x)        ;  81 00     
FC6E           inc     $00            ;  E6 00     
FC70           bne     LFC74          ;  D0 02     
FC72           inc     $01            ;  E6 01     
FC74   LFC74:  inc     $02            ;  E6 02     
FC76           bne     LFC69          ;  D0 F1     
FC78           inc     $03            ;  E6 03     
FC7A           bne     LFC69          ;  D0 ED     
FC7C           jmp     (L0004)        ;  6C 04 00 

; ----------------------------------------------------------------------------
; LOOPS UNTIL INPUT ON 6522. INTERRUPT FLAG BIT 1 SET ON IO AT 6522 PORTA
WAITFORIO:

FC7F        lda     6522-IFR       ;  AD 8D 15 
FC82        and     #$02           ;  29 02     
FC84        beq     WAITFORIO      ;  F0 F9     
FC86        lda     6522-INPUTA    ;  AD 81 15 
FC89        pha                    ;  48       
FC8A        lda     6522-PCR       ;  AD 8C 15 
FC8D        and     #$F0           ;  29 F0     
FC8F        ora     #$0C           ;  09 0C     
FC91        sta     6522-PCR       ;  8D 8C 15 
FC94        ora     #$0E           ;  09 0E     
FC96        sta     6522-PCR       ;  8D 8C 15 
FC99        pla                    ;  68       
FC9A        rts                    ;  60       


Does this format sound familiar to anyone - 10-bytes of header starting with X, and finishing with three 2-byte words defining where and how much to load? Would programs have been stored on paper tape? Or sent via a serial terminal? Any pointers that might help illuminate the process would be greatly appreciated.


Top
 Profile  
Reply with quote  
PostPosted: Sat Sep 10, 2022 7:08 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
It's new to me, but interesting to see it. For example, what the intended role of the two ignored bytes might be - I'm going to guess a checksum. Also the fact that it's dealing with raw binary, not hex. And indeed, booting over a parallel port rather than a serial one...

8 hole paper tape does seem most likely, I think. And the sprocket holes act as a timing source, so it can (presumably) readily be hooked up as a data byte plus strobe.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: