How to programming EPROM for internal EPROM socket on C128 MB?

Started by MIRKOSOFT, August 20, 2010, 11:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

Hi!


I want to programming EPROM for empty socket on MB of C128.
First I want to prepare .BIN file and then flash it into EPROM (as I know its size is 32kB).


But:
- I don't know the structure of EPROM
- I don't know header which must to have EPROM
- I don't know how to start ML code in EPROM
. I don't know "boot" sequence of EPROM (holding CTRL key during startup/reset)


If you can, please help me.
The Qs are lot. But I'll do it first time.


Many thanks for every reply.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

pearsoe

I've never created a function ROM but there is information out there to be had.  Not sure what you mean by "I don't know the structure of an EPROM" but basically you are storing an ML program you have created on the EPROM.  Storing the ML program seems simple as it should be handled by your EPROM burning program of choice.  The Internal function ROM starts at $8000 so that would be your starting address in your program.

The header is described in 'Mapping the Commodore 128'.  Look at $E26B on page 518.  I would also recommend getting a HEX editor and loading up some of the BIN files that are available out there for the Internal function ROM.

Provided you are in the correct BANK configuration accessing code in the function ROM I believe is just like accessing code you have loaded into any other valid location.  Again the code in the function ROM starts at $8000.

The C-128 boot sequence automatically will detect if a valid function ROM is installed.  Again see $E26B and $F867.  According to these routines you could have an autobooting function ROM or not, though even if it is not autobooting the fact that there is a valid function ROM is recorded so I would imagine holding the CTRL key just forces a boot from the function ROM.

Hope this helps.
My rig: C-128 w/JD SCPU, uIEC/SD, CMD-HD (500 MB), CMD-HD ZIP drive, CMD RAMLink, 1750XL 2 MB REU, FD-2000, 1581, Turbo232

abraXxl

The internal function rom is mapped to bank 4, the external is mapped to bank 8, both at 8000-ffff.
There is an start sequence similar to the CBM80 sequence at c64.

These startup sequences have to placed at $48000, $4c000, $88000 an $8c000.
This code has the following layout:

0/1/2/3 - unused - (AFAIK)
4 -  00 - ROM entry point is not called -
     01 - entry point is called before the kernal initialized completly
     02-ff - entry point is called after kernal and basic is initialized, shortly before disk boot up
5/6 - vector function entry point
7/8/9 - "CBM"


The code the vector at $5/6 is executed in bank 4 or 8. Regard that at $d000 IO is located, and that in every bank at $ff00 to $ff04 the MMU-CR registers are placed.

At the end some example code I use to call C64 programs from the function rom.

; vim:ts=4:ft=asm:fdm=marker:fmr={,}

; c128 function start code {
; function rom start address
.byt $00, $80
*=$8000
func_rom_boot_code:

; C128 function rom stub
.byt $ea, $ea, $ea, $4c
.word func_rom_entry
.byt $02
; 00 - don't start
; 01 - start before kernal init
; 02 - start after kernal and basic init, shortly befor disk boot
.byt $43, $42, $4d
; }
; labels {
VIC = $d000
VIC_CLOCK = VIC + $30

C128_code_bank0_15 = $220

; changable entry point for own go64
C128_c64_entry_point_lo = C128_code_bank0_15 + go64_bank0_code_entry_len
C128_c64_entry_point_hi = C128_c64_entry_point_lo + 1

C128_MMU = $d500
C128_MMU_MCR = C128_MMU + 5
C128_MMU_CR = $ff00
; }

; code entry in bank 4/8
func_rom_entry:
; disable interrupts {
sei
; }

; go c64 {
jsr copy_go64_code
lda C128_c64_entry_point_lo
lda C128_c64_entry_point_hi
jmp C128_code_bank0_15
; }

; padding to 32k {
func_rom_boot_code_end:
#echo Free bytes function ROM
#print $ffff - func_rom_boot_code_end - 255
.dsb $ffff - func_rom_boot_code_end - 255, $ff
; }
above_mmu_codeblock: ;{
; 5 MMU registers are mirrored here
.byt "12345"

; go to fast/slow 1/2mhz {
slow:
lda #00
.byte $4c ; mask next opcode
fast:
lda #01
sta VIC_CLOCK
rts
;}

; enable IO {
enable_io:
lda C128_MMU_CR
and #%11111110
jmp disable_io_write
;}
; disable IO {
disable_io:
lda C128_MMU_CR
ora #%00000001
disable_io_write:
sta C128_MMU_CR
rts
;}

; copy go64 code to $C128_code_bank0 {
copy_go64_code:
;jsr enable_io
    ldy #go64_bank0_code_end-go64_bank0_code_start+1
go_64_cody_copy_loop:
lda go64_bank0_code_start-1,y
sta C128_code_bank0_15-1,y
dey
bne go_64_cody_copy_loop
rts
; }

; { bank0 ram code for go64
go64_bank0_code_start:
lda #0 ; bank 15
sta C128_MMU_CR
lda #$f7
sta C128_MMU_MCR
go64_bank0_code_entry_len = * - go64_bank0_code_start + 1 ; = #fce2
jmp $FCE2
go64_bank0_code_end:
; }

above_mmu_codeblock_end:

.dsb 251 - (above_mmu_codeblock_end - above_mmu_codeblock), $ff
#echo Free bytes in above MMU_BLOCK
#print  251 - (above_mmu_codeblock_end - above_mmu_codeblock)
; }
; ensure we have nmi and irq vectors pointing to meaningful routines for some incidents might happen {
; dummy IRQ and NMI routines
blank_irq_nmi:
irq_entry:
nmi_entry:
rti
; IRQ
.word blank_irq_nmi
; NMI
.word blank_irq_nmi
;}


Have a look at "Mapping the C128" page 519 and 597 for more info.
This is intentionally left blank.