writing to flashrom (2MB rom) and support for emulators

Pagina 3/8
1 | 2 | | 4 | 5 | 6 | 7 | 8

Van Daemos

Paragon (1713)

afbeelding van Daemos

02-05-2020, 15:00

As far as understood so far the code to write to the megaflashrom is proprietary stuff so nobody but the maker of the hardware knows how to write to the megaflashrom. Not even the person who wrote the opfxsd tool has insight into the flashing process at assembly level. Not ever going down that road ever again. Ill stick to SRAM.

@Manuel: Any chances that the default openmsx setting CBIOS2+ or any CBIOS machine can have SRAM support in the exact same fashion as it works in the turbo-R? Like that there is no hustle for emulator people to save their game data inside openmsx.

Van Manuel

Ascended (16851)

afbeelding van Manuel

02-05-2020, 21:12

Daemos: the flashing process is emulated, so you can simply see in openMSX what is going on. But OK, whatever you want Smile

About the SRAM: I'll have to check how it works.

Van Daemos

Paragon (1713)

afbeelding van Daemos

02-05-2020, 21:34

Quote:

Daemos: the flashing process is emulated, so you can simply see in openMSX what is going on. But OK, whatever you want

Omg didn't think about that. Openmsx is open source. I could figure this out indeed. Thanks for the advice and forgive my blindness.

Van Manuel

Ascended (16851)

afbeelding van Manuel

02-05-2020, 22:08

Anyways, I don't think you would want to use the MegaFlashROM, because it isn't meant for that purpose. As I said, if the user wants to play another game in it, the save data will be gone.

Van Manuel

Ascended (16851)

afbeelding van Manuel

02-05-2020, 22:13

@norakomi: as far as I can see, the cartridge you want to use has no way to make a part of the flashROM chip readonly and a part read/write (the flash chip has the possibilities, but the cartridge doesn't seem to support them, if I'm not mistaken). Can you check that please?
Or do you want to keep the whole flashROM flashable? (Then users could flash overwrite your cartridge with the right tools.)

Van Grauw

Ascended (9272)

afbeelding van Grauw

03-05-2020, 03:46

Manuel wrote:

Or do you want to keep the whole flashROM flashable? (Then users could flash overwrite your cartridge with the right tools.)

Nothing wrong with that IMO, in fact it seems a good feature. If you discover a bug, you can release a fix without requiring users to send back their cartridges.

Van norakomi

Paragon (1084)

afbeelding van norakomi

03-05-2020, 09:22

Quote:

@norakomi: as far as I can see, the cartridge you want to use has no way to make a part of the flashROM chip readonly and a part read/write (the flash chip has the possibilities, but the cartridge doesn't seem to support them, if I'm not mistaken). Can you check that please?

I asked. Waiting for the answer to that.

Quote:

the flashing process is emulated

Can you explain me how I can do this in openmsx ?
Thanks !

Van Manuel

Ascended (16851)

afbeelding van Manuel

03-05-2020, 11:35

Norakomi: exactly the same as on a real MSX, of course!

Van norakomi

Paragon (1084)

afbeelding van norakomi

03-05-2020, 12:09

no, it doesn't work like that.

On a real msx, I insert the rom into the msx, and then I can save to the flashrom.
But on the emulator it doesn't work.

It's the same issue I had back then with Manbow2.

For bluemsx, a special romtype was develloped/added (romtype: manbow2).
You then you had insert the manbow.rom into bluemsx, and choose romtype: manbow2.
Then the ability to save to flashrom was enabled.

In openmsx there was a similar option.
(carta manbow2.rom -romtype manbow2)

But now the story is slightly different, because the rom we use now is 2MB.

So trying the same thing doesn't work now.

Van Giangiacomo Zaffini 2

Master (224)

afbeelding van Giangiacomo Zaffini 2

03-05-2020, 12:34

This code work for 2MBytes MultiMapper ROM, I know it because I have one, but it is tailored just for ASC8 ASCII 8 KBytes pages. If needed I can arrange a KONAMI mapper version or ASC16 ASCII 16KBytes pages. It didn't started from scratch but I started from other code.


;*** FL8.COM v1.32z for MSX

;*** ROM Loader for FlashROM mapped ASCII 8K

; --------------------- begin | How compile assembly
; compile with pasmo
; user@machine:~$ ~/pasmo-0.5.4.beta2/pasmo --bin FL8.asm FL8.COM FL8.SYM
; --------------------- end | How compile assembly

DBGVAL	equ	0	; debug variable 0=FALSE, 1=TRUE

LF	equ	0ah
CR	equ	0dh

			; MSX-DOS

			; The file name specified as the first parameter of the command line is
			; stored in the default FCB area from 005CH address
FCB	equ	0005ch

BDOS	equ	00005h	; System call calling address

_CONOUT	equ	00002h	; MSX-DOS 2 function call CPM MSX1* 02h -  Console output
_DIRIN	equ	00007h	; MSX-DOS 2 function call     MSX1* 07h -  Direct console input
_STROUT	equ	00009h	; MSX-DOS 2 function call CPM MSX1* 09h -  String output
_FOPEN	equ	0000fh	; MSX-DOS 2 function call CPM MSX1  0Fh -  Open file (FCB)
_SETDTA	equ	0001ah	; MSX-DOS 2 function call CPM MSX1  1Ah -  Set disk transfer address
_RDBLK	equ	00027h	; MSX-DOS 2 function call     MSX1  27h -  Random block read (FCB)


			; ROM BIOS

			; CHKRAM (also called STARTUP, RESET or BOOT)

			; Address  : #0000
			; Function : Tests RAM and sets RAM slot for the system
			; Registers: All
			; Remark   : After this, a jump must be made to INIT, for further initialisation.

CHKRAM	equ	00000h	; MSX 1 BIOS entry CHKRAM

			; RDSLT

			; Address  : #000C
			; Function : Reads the value of an address in another slot
			; Input    : A  - ExxxSSPP
			;            |        || Primary  slotnumber  (00-11)
			;            |        - Secundary slotnumber (00-11)
			;            +----------- Expanded slot (0 = no, 1 = yes)
			;            HL - Address to read
			; Output   : A  - Contains the vaule of the read address
			; Registers: AF, C, DE
			; Remark   : This routine turns off the interupt, but won't turn it on again

			; WRSLT

			; Address  : #0014
			; Function : Writes a value to an address in another slot.
			; Input    : A  - Slot in which the value will be written
			;            see RDSLT for input
			;            HL - Address of value to write
			;            E  - value to write
			; Registers: AF, BC, D
			; Remark   : See RDSLT

WRSLT	equ	00014h	; MSX 1 BIOS entry WRSLT

			; CALSLT

			; Address  : #001C
			; Function : Executes inter-slot call.
			; Input    : IY - High byte with input for A in RDSLT
			;            IX - The address that will be called
			; Output   : depends on the result of the called program
			; Registers: depends on the result of the called program
			; Remark   : Variables can never be given in alternative registers
			;            of the Z-80 or IX and IY

CALSLT	equ	0001Ch	; MSX 1 BIOS entry CALSLT

			; ENASLT

			; Address  : #0024
			; Function : Switches indicated slot at indicated page on perpetual
			; Input    : A  - ExxxSSPP
			;            see RDSLT
			;            HL
			;            H - Bit 6 and 7 must contain the page number (00-11)
			; Registers: all

ENASLT	equ	00024h	; MSX 1 BIOS entry ENASLT

			; INIT32

			; Address  : #006F
			; Function : Switches to SCREEN 1 (text screen with 32*24 characters)
			; Input    : T32NAM, T32CGP, T32COL, T32ATR, T32PAT
			; Registers: All

INIT32	equ	0006Fh	; MSX 1 BIOS entry INIT32

			; CHGET

			; Address  : #009F
			; Function : One character input (waiting)
			; Output   : A  - ASCII-code of the input character
			; Registers: A

CHGET	equ	0009Fh	; MSX 1 BIOS entry CHGET

			; CHPUT

			; Address  : #00A2
			; Function : Displays one character
			; Input    : A  - ASCII-code of character to display

CHPUT	equ	000A2h	; MSX 1 BIOS entry CHPUT

			; RSLREG

			; Address  : #0138
			; Function : Reads the primary slot register
			; Output   : A  - for the value which was read
			;            33221100
			;            ||||||- Page 0 (#0000-#3FFF)
			;            ||||--- Page 1 (#4000-#7FFF)
			;            ||----- Page 2 (#8000-#BFFF)
			;            ------- Page 3 (#C000-#FFFF)
			; Registers: A

RSLREG	equ	00138h	; MSX 1 BIOS entry RSLREG

			; WSLREG

			; Address  : #013B
			; Function : Writes value to the primary slot register
			; Input    : A  - value value to (see RSLREG)

WSLREG	equ	00138h	; MSX 1 BIOS entry WSLREG

DMA	equ	00080h	; DMA area address default address

RAMAD0	equ	0F341h	; MSX-DOS (Disk-ROM) System Variables located in RAM : Slot address of RAM in page 0 (DOS)
RAMAD1	equ	0F342h	; MSX-DOS (Disk-ROM) System Variables located in RAM : Slot address of RAM in page 1 (DOS)
RAMAD2	equ	0F343h	; MSX-DOS (Disk-ROM) System Variables located in RAM : Slot address of RAM in page 2 (DOS/BASIC)
RAMAD3	equ	0F344h	; MSX-DOS (Disk-ROM) System Variables located in RAM : Slot address of RAM in page 3 (DOS/BASIC)

BUFTOP	equ	08000h

			; see MSX Datapack Volume 2 p.17
			; |  F |  0 |  0 |  0 | S1 | S0 | P1 | P0 | Expansion Slot
			; |sec.|    zeroed    |Secondary| Primary |
			; |slot|   reserved   |  slot   |  slot   |
			; |Flag|              |  (0-3)  |  (0-3)  |
			;
			; see <a href="https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC" title="https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC">https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC</a>
			;
EXPTBL	equ	0FCC1h	; EXPTBL - Expansion Slot 0..3 Table:                                4B/RW
EXSAD0	equ	0FCC1h	; EXSAD0 - Slot 0: 08xh = Expanded, 00xh = Not Expanded (Main Slot)  1B/RW
EXSAD1	equ	0FCC2h	; EXSAD1 - Slot 1: 08xh = Expanded, 00xh = Not Expanded              1B/RW
EXSAD2	equ	0FCC3h	; EXSAD2 - Slot 2: 08xh = Expanded, 00xh = Not Expanded              1B/RW
EXSAD3	equ	0FCC4h	; EXSAD3 - Slot 3: 08xh = Expanded, 00xh = Not Expanded              1B/RW

			; see MSX Datapack Volume 1 p.60
			; |b 07|b 06|b 05|b 04|b 03|b 02|b 01|b 00|
			; |p3 1|p3 0|p2 1|p2 0|p1 1|p1 0|p0 1|p0 1| I/O Port 0A8H (RW)
			; | page 3  | page 2  | page 1  | page 0  | Primary Slot selection
			; |C000-FFFF|8000-BFFF|4000-7FFF|0000-3FFF|
			; |pri. slot|pri. slot|pri. slot|pri. slot|
			; |   0-3   |   0-3   |   0-3   |   0-3   |
			; see MSX Datapack Volume 1 Figure 1.21 Primary Slot p.26

			; see MSX Datapack Volume 2 p.18
			; |b 07|b 06|b 05|b 04|b 03|b 02|b 01|b 00|
			; |p3 1|p3 0|p2 1|p2 0|p1 1|p1 0|p0 1|p0 1| Secondary Slot selection
			; | page 3  | page 2  | page 1  | page 0  |
			; |C000-FFFF|8000-BFFF|4000-7FFF|0000-3FFF|
			; |sec. slot|sec. slot|sec. slot|sec. slot|
			; |   0-3   |   0-3   |   0-3   |   0-3   |
			; see MSX Datapack Volume 1 Figure 1.22 Secondary Slot p.26
			;
SLTTBL	equ	0FCC5h	; SLTTBL - Mirror Of Slot 0..3 Secondary Slot Selection Registers:   4B/RW
SLMIR0	equ	0FCC5h	; SLMIR0 - Slot 0: Mirror Of Secondary Slot Selection Register       1B/RW
SLMIR1	equ	0FCC6h	; SLMIR1 - Slot 1: Mirror Of Secondary Slot Selection Register       1B/RW
SLMIR2	equ	0FCC7h	; SLMIR2 - Slot 2: Mirror Of Secondary Slot Selection Register       1B/RW
SLMIR3	equ	0FCC8h	; SLMIR3 - Slot 3: Mirror Of Secondary Slot Selection Register       1B

XBRSA	equ	0FAF8h	; SUBROM slot address (EXtended BIOS-ROM Slot Address)

			; see MSX Datapack Volume 2 p.653
			; FB21 DRVTBL Disk-ROM slot address                                  1B/RW
			;
			; see <a href="http://map.grauw.nl/resources/msxsystemvars.php" title="http://map.grauw.nl/resources/msxsystemvars.php">http://map.grauw.nl/resources/msxsystemvars.php</a>
			; #FB21 (size 1) Nr. of drives connected to disk interface 1
			; #FB22 (size 1) Slot address of disk interface 1
			; see <a href="https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC" title="https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC">https://github.com/PeterLemon/MSX/blob/master/LIB/MSX.INC</a>
			; DRVINF - Drive Info: DRVINF($FB21)
			; DRCNT1 - Number Of Drives Connected To Disk Interface 1 DRCNT1($FB21)
			; DRSAD1 - Slot Address Of Disk Interface 1 DRSAD1($FB22)
DRVINV	equ	0FB22h	; Installed Disk-ROM
DRSAD1	equ	0FB22h	; DRSAD1 - Slot Address Of Disk-ROM Interface 1                      1B/RW
DRSAD2	equ	0FB24h	; DRSAD2 - Slot Address Of Disk-ROM Interface 2                      1B/RW
DRSAD3	equ	0FB26h	; DRSAD3 - Slot Address Of Disk-ROM Interface 3                      1B/RW
DRSAD4	equ	0FB28h	; DRSAD4 - Slot Address Of Disk-ROM Interface 4                      1B/RW

			; see <a href="http://bifi.msxnet.org/msxnet/tech/megaroms.html#ascii8" title="http://bifi.msxnet.org/msxnet/tech/megaroms.html#ascii8">http://bifi.msxnet.org/msxnet/tech/megaroms.html#ascii8</a>
			;
			; memory banks:
			; Bank 1: 4000h - 5FFFh memory addresses range <- it lives in memory page 1
			; Bank 2: 6000h - 7FFFh memory addresses range <- it lives in memory page 1
			; Bank 3: 8000h - 9FFFh memory addresses range <- it lives in memory page 2
			; Bank 4: A000h - BFFFh memory addresses range <- it lives in memory page 2
			;
			; address to change banks:
B1CHDD	equ	06000h	; ASC8 ASCII 8k FlashROM Bank 1 change segment/page address
B2CHDD	equ	06800h	; ASC8 ASCII 8k FlashROM Bank 2 change segment/page address
B3CHDD	equ	07000h	; ASC8 ASCII 8k FlashROM Bank 3 change segment/page address
B4CHDD	equ	07800h	; ASC8 ASCII 8k FlashROM Bank 4 change segment/page address

			; from JEDEC STANDARD Standard Manufacturer's Identification Code
			; JEP106AX SEPTEMBER 2018
			;
			; Table 1 - Manufaturer's Identification Code
			; COMPANY                8 7 6 5 4 3 2 1 HEX
			;  1 AMD                 0 0 0 0 0 0 0 1 01
			;  4 Fujitsu             0 0 0 0 0 1 0 0 04
			;
			; The following numbers are all in bank (=sector of 256 byte lenght) two:
			; COMPANY                8 7 6 5 4 3 2 1 HEX
			; Continuation Code      0 1 1 1 1 1 1 1 7F
			; 28 Eon Silicon Devices 0 0 0 1 1 1 0 0 1C
Amd	equ	001h
Fujitsu	equ	004h
Contin	equ	07Fh
Eon_sd	equ	01Ch	; 28 Eon Silicon Devices 7F 1C, it is two byte manufacturer identification code

	org	0100h

START:
	jp	Main

MESVER
	db	CR,LF,"FL8 FlashROM Loader",CR,LF
	db	"version 1.32z",CR,LF
	db	"for ASC8 FlashROM",CR,LF
	db	"ASCII 8KBytes bank size",CR,LF
	db	"by GDX and G.Zaffini",CR,LF
	db	"based on",CR,LF
	db	"FLLOAD by K.Tsujikawa"
MESend
	db	CR,LF,CR,LF,"$"
HlpMes
	db	"Usage:",CR,LF
	db	" > FL8 romname.ROM /Sxx /R /A",CR,LF
	db	" > FL8 /Sxx /E or > FL8 /Sxx /I",CR,LF,CR,LF
	db	"   /Sxx (xxh=FxxxSSPPb address) indicates FlashROM slot",CR,LF
	db	"   /R is for running FlashROM after program w/System Reset",CR,LF
	db	"   /A is for skipping FlashROM erase",CR,LF
	db	"   /E is for only FlashROM erase",CR,LF
	db	"   /I is for only identify Flash",CR,LF
	db	" (^_^)/~",CR,LF,"$"

DosErr
	db	"File reading error!",CR,LF,"$"
FlshEra
	db	"FlashROM erasing...",CR,LF,"$"
FlshEok
	db	"OK",CR,LF,CR,LF,"$"
FlshErr
	db	"FlashROM writing error!",CR,LF,"$"
DonMes
	db	"Load complete. Thank you.",CR,LF,"$"
AM29F0xx
	db	"Am29F040B found in Slot!",CR,LF,"$"
NO_FLSH
	db	"FlashROM not found!",CR,LF,"$"
WarnMess
	db	"You have selected a slot that",CR,LF
	db	"contains a Disk-ROM!",CR,LF,"$"
ConfirmMess
	db	"Do you want to erase it? (Y/N)",CR,LF,"$"
CancelMess
	db	"Canceled.",CR,LF,"$"
ManIDmsg
	db	"ManufacturerID hex =","$"
DevIDmsg
	db	"DeviceID hex =","$"

; dbg block - begin
IF DBGVAL
DBG_MAN
	db	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DBG_DEV
	db	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DBGEXSAD0
	db	"EXSAD0 =","$"
DBGXBRSA
	db	"XBRSA =","$"
USEDSLOT
	db	"working slot S","$"
USLOT_DR
	db	" contains a Disk-ROM!",CR,LF,"$"
SpcSTRNG
	db	" ","$"
ENDIF
; dbg block - end

; function Main - application entry point

Main:
	ld	de,MESVER
	ld	c,_STROUT
	call	BDOS		; Print MESVER message (FL8 info)

; dbg block - begin
IF 0
	ld	de,DBGEXSAD0
	ld	c,_STROUT
	call	BDOS		; Print DBGEXSAD0 message
	ld	hl,EXSAD0
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print EXSAD0 hex and MESend message

	ld	de,DBGXBRSA
	ld	c,_STROUT
	call	BDOS		; Print DBGXBRSA message
	ld	hl,XBRSA
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print XBRSA hex and MESend message

	call	WSpaceBar
ENDIF
; dbg block - end

; dbg block - begin
IF 0
	ld	hl,DRSAD1
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print DRSAD1 hex and MESend message

	ld	hl,DRSAD2
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print DRSAD2 hex and MESend message

	ld	hl,DRSAD3
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print DRSAD3 hex and MESend message

	ld	hl,DRSAD4
	ld	c,(hl)
	call	OutHex8
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print DRSAD4 hex and MESend message

	call	WSpaceBar
ENDIF
; dbg block - end

	call	Parameters
	cp	255
	jp	z,TO_END	; Jump if Parameters failed

	call	ChkManID
	or	a
	call	nz,FOUND
	ld	a,(ParameterS)
	cp	053h		; 053h S LATIN CAPITAL LETTER S
	jr	z,NO_FND

	ld	b,3		; b=Primary Slot - NOTE actual tested primary slot # is b XOR 003h value

BCLM:
	ld	c,0		; c=Secondary Slot

BCLMI:
	push	bc		; [+]
	call	AutoSeek
	pop	bc		; [+]

	call	ChkManID
	or	a
	call	nz,FOUND

	inc	c
	ld	a,c
	cp	4
	jr	nz,BCLMI	; Jump if Secondary Slot < 4
	dec	b
	jp	p,BCLM		; Jump if Primary Slot < 0

NO_FND:
	ld	de,NO_FLSH	; Pointer to NO_FLSH message
	jp	NoReset		; manage NO_FLSH message and returns
				; ret is not here because NoReset does ret also for Main

FOUND:
	call	SeDevID
	ld	a,(ParameterI)
	cp	049h		; 049h I LATIN CAPITAL LETTER I
	call	nz,PreFCB
TO_END:
	ret

; *** end of function Main

; function ChkManID
; Check Manufacturer ID against fixed set of SUCCESSFUL case values and return FAIL or SUCCESS
; Input: none
; Output: accumulator register a: a==000h FAIL, a!=000h SUCCESS

ChkManID:
	ld	a,(MAN_ID)
	or	a
	jr	z,F_ChkMaID
	cp	Amd		; AMD Manufacturer Identification Code
	ret	z
	cp	Fujitsu		; Fujitsu Manufacturer Identification Code
	ret	z
	cp	Contin		; Continuation Code
	jr	nz,F_ChkMaID
	ld	a,(MAN_ID+1)	; looking in bank two
	cp	Eon_sd		; Eon Silicon Devices Manufacturer Identification Code
	ret	z

F_ChkMaID:
	xor	a
	ret

; *** end of function ChkManID

; function AutoSeek

AutoSeek:
	ld	a,b		; a <- b, a=Primary Slot, b=Primary Slot, c=Secondary Slot
	xor	3		; Reverse the bits to reverse the search order (0 to 3)

; dbg block - begin
; it displays current slot under test
IF 0
	push	af		; [(.)]
	push	bc		; [(..)]
	ld	de,USEDSLOT
	ld	c,_STROUT
	call	BDOS		; Print USEDSLOT message
	pop	hl		; [(..)]
	push	hl		; [(..)]
	call	DispHLhex
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print bc hex and MESend message
	pop	bc		; [(..)]
	pop	af		; [(.)]
ENDIF
; dbg block - end

	ld	hl,EXPTBL	; hl is address of EXPTBL an array of 4 positions of EXSAD0, EXSAD1, EXSAD2 and EXSAD3 addresses
	ld	d,0
	ld	e,a		; e <- a, e=Primary Slot, a=Primary Slot, b=Primary Slot, c=Secondary Slot
	add	hl,de		; hl is an entry on EXPTBL an array of 4 positions of EXSAD0, EXSAD1, EXSAD2 and EXSAD3 addresses
	bit	7,(hl)
	jr	z,primSlt	; Jump if slot is not expanded
	or	080h		; Set flag for secondary slot
	sla	c		; SLA r Shift register r left arithmetic.
	sla	c		; SLA r Shift register r left arithmetic.
	or	c		; Add secondary slot value, register [Acc] a format FxxxSSPP slot # as for MSX BIOS 1 entry RDSLT

primSlt:
	ld	(ERMSlt),a	; Assign variable for the successful case a accumulator register [Acc] a is a slot # as for MSX BIOS 1 entry RDSLT
	ld	b,a		; Keep actual slot value, register b format FxxxSSPP slot # as for MSX BIOS 1 entry RDSLT

	bit	7,a
	jr	nz,SecSlt	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSlt:
	ld	c,a		; e <- a, e=Primary Slot, a=Primary Slot, b=Primary Slot, c=Secondary Slot
	ld	a,(DRSAD1)	; A = Slot Address Of Disk-ROM Interface 1
	bit	7,a
	jr	nz,SecSlt1	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSlt1:
	cp	c

; dbg block - begin
IF DBGVAL
	call	z,UsdSlot
ENDIF
; dbg block - end

	cp	c
	ret	z		; Return if Disk-ROM Slot

	ld	a,(DRSAD2)	; A = Slot Address Of Disk-ROM Interface 2
	bit	7,a
	jr	nz,SecSlt2	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSlt2:
	cp	c

; dbg block - begin
IF DBGVAL
	call	z,UsdSlot
ENDIF
; dbg block - end

	cp	c
	ret	z		; Return if Disk-Rom Slot

	ld	a,(DRSAD3)	; A = Slot Address Of Disk-ROM Interface 3
	bit	7,a
	jr	nz,SecSlt3	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSlt3:
	cp	c

; dbg block - begin
IF DBGVAL
	call	z,UsdSlot
ENDIF
; dbg block - end

	cp	c
	ret	z		; Return if Disk-Rom Slot

	ld	a,(DRSAD4)	; A = Slot Address Of Disk-ROM Interface 4
	bit	7,a
	jr	nz,SecSlt4	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSlt4:
	cp	c

; dbg block - begin
IF DBGVAL
	call	z,UsdSlot
ENDIF
; dbg block - end

	cp	c
	ret	z		; Return if Disk-Rom Slot

	call	BnkLoop		; check if FlashROM is in /Sxx Slot
	ret

; *** end of function AutoSeek

; function BnkLoop - this function look into Bank 1 <- segment/page # 0 mapped into it and it looks for NOR Flash Manufacturer Identification and Device Identification values

BnkLoop:
	ld	a,(ERMSlt)	; Assign variable for the successful case a accumulator register [Acc] a is a slot # as for MSX BIOS 1 entry RDSLT
	ld	h,040h
	call	ENASLT		; Select actual slot at memory page 1 with Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
				; NOTE ENASLT uses all registers, no longer true that b=Primary Slot
	ei			; ENASLT does di

	ld	a,(SegmntPg)
	ld	(B1CHDD),a	; Bank 1 <- segment/page # a

; dbg block - begin
IF DBGVAL
	ld	bc,0800h
	ld	hl,4000h
dbgFlBnks: 
	push	bc		; [^bc]
	push	hl		; [^hl]
	call	MDu3BsSp
	pop	hl		; [^hl]
	inc	h
	push	hl		; [^hl]
	call	MDu3BsSp
	ld	de,MESend+2
	ld	c,_STROUT
	call	BDOS		; Print MESend starting with 2 byte offset
	pop	hl		; [^hl]
	inc	h
	pop	bc		; [^bc]
	djnz	dbgFlBnks	; DJNZ e instruction : decrement register b and jump e relative on no zero : b <- b + FFH and jp NZ, e

ENDIF
; dbg block - end

				; considered 15 Continuation Code 16 steps loop, setting bank size of 256 bytes for the case of Continuation Code
				; see probe_jedec_common function in jedec.c module of flashrom GitHub repository

				; FlashROM device Am29F040B has 8 uniform sectors of 64 Kbytes each, other flash devices have as many as 32 sectors
				; Sector A18 A17 A16 Address Range
				; SA0    0   0   0   00000h-0FFFFh
				; SA1    0   0   1   10000h-1FFFFh
				; SA2    0   1   0   20000h-2FFFFh
				; SA3    0   1   1   30000h-3FFFFh
				; SA4    1   0   0   40000h-4FFFFh
				; SA5    1   0   1   50000h-5FFFFh
				; SA6    1   1   0   60000h-6FFFFh
				; SA7    1   1   1   70000h-7FFFFh

				; /!\ ACHTUNG /!\ segment address (SA) updating logic missing /!\ ACHTUNG /!\
				; Sector Protection. (01h=protected, 00h=unprotected)

	di			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\
	ld	a,0f0h
	ld	(4000h),a	; The Reset command is required to return to reading array data when device is in the autoselect mode
	ld	a,0aah
	ld	(4555h),a	; unlock cycle #1
	ld	a,055h
	ld	(42aah),a	; unlock cycle #2
	ld	a,090h
	ld	(4555h),a	; Autoselect Mode ON command

; dbg block - begin
IF DBGVAL
	ld	ix,DBG_MAN
	ld	iy,DBG_DEV
	ld	a,(04000h)
	ld	(ix+000h),a
	ld	a,(04100h)
	ld	(ix+001h),a
	ld	a,(04200h)
	ld	(ix+002h),a
	ld	a,(04300h)
	ld	(ix+003h),a
	ld	a,(04400h)
	ld	(ix+004h),a
	ld	a,(04500h)
	ld	(ix+005h),a
	ld	a,(04600h)
	ld	(ix+006h),a
	ld	a,(04700h)
	ld	(ix+007h),a
	ld	a,(04800h)
	ld	(ix+008h),a
	ld	a,(04900h)
	ld	(ix+009h),a
	ld	a,(04A00h)
	ld	(ix+00Ah),a
	ld	a,(04B00h)
	ld	(ix+00Bh),a
	ld	a,(04C00h)
	ld	(ix+00Ch),a
	ld	a,(04D00h)
	ld	(ix+00Dh),a
	ld	a,(04E00h)
	ld	(ix+00Eh),a
	ld	a,(04F00h)
	ld	(ix+00Fh),a
	ld	a,(04001h)
	ld	(iy+000h),a
	ld	a,(04101h)
	ld	(iy+001h),a
	ld	a,(04201h)
	ld	(iy+002h),a
	ld	a,(04301h)
	ld	(iy+003h),a
	ld	a,(04401h)
	ld	(iy+004h),a
	ld	a,(04501h)
	ld	(iy+005h),a
	ld	a,(04601h)
	ld	(iy+006h),a
	ld	a,(04701h)
	ld	(iy+007h),a
	ld	a,(04801h)
	ld	(iy+008h),a
	ld	a,(04901h)
	ld	(iy+009h),a
	ld	a,(04A01h)
	ld	(iy+00Ah),a
	ld	a,(04B01h)
	ld	(iy+00Bh),a
	ld	a,(04C01h)
	ld	(iy+00Ch),a
	ld	a,(04D01h)
	ld	(iy+00Dh),a
	ld	a,(04E01h)
	ld	(iy+00Eh),a
	ld	a,(04F01h)
	ld	(iy+00Fh),a
	call	DBG_CONT
ENDIF
; dbg block - end

	ld	bc,MAN_ID	; bc <- MAN_ID Manufacturer Identification
	ld	de,DEV_ID	; de <- DEV_ID Manufacturer Identification
	ld	hl,4000h	; hl be Manufacturer ID address

RDID_RD:
	ld	a,(hl)		; (HL) = Manufacturer ID
	ld	(bc),a

	inc	l		; hl be Device ID address
	ld	a,(hl)		; (HL) = Device ID
	ld	(de),a

	inc	l
	ld	a,(hl)		; (HL) = sector protection value 01 protected 00 unprotected

	dec	l
	dec	l		; restore hl address aligned with bank - bank is part/page of Flash sector and it has nothing to do with ASC8 bank size

	ld	a,(bc)		; bc <- MAN_ID Manufacturer Identification last in character offset
	cp	Contin		; for the case of EON EN29F040A look at bank two, where bank = sector of 256 bytes, where bank one is the one of 1 AMD and 4 Fujitsu
	jr	nz,complIDs
	inc	h		; setting bank size of 256 bytes for the case of Continuation Code - bank is part/page of Flash sector and it has nothing to do with ASC8 bank size
	inc	c		; bc <- MAN_ID Manufacturer Identification
	inc	e		; de <- DEV_ID Device Identification

	ld	a,(bc)		; bc <- MAN_ID Manufacturer Identification next in character offset
	or	a
	jr	z,RDID_RD	; at most 16 Continuation Code loop, since DEV_ID follows MAN_ID, when pointer to MAN_ID points into a non zero byte it has reached DEV_ID

complIDs:
	ld	hl,4000h
	ld	(hl),0f0h	; The Reset command is required to return to reading array data when device is in the autoselect mode
	ei			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\

	ld	de,ManIDmsg
	ld	c,_STROUT
	call	BDOS		; Print ManIDmsg message

	ld	hl,MAN_ID
lpManId:
	ld	c,(hl)
	push	hl		; [.|]
	call	OutHex8
	pop	hl		; [.|]
	ld	a,(hl)
	inc	l
	cp	Contin		; for the case of EON EN29F040A look at bank two, where bank = sector of 256 bytes, where bank one is the one of 1 AMD and 4 Fujitsu
	jr	z,lpManId
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print MAN_ID hex and MESend message

	ld	de,DevIDmsg
	ld	c,_STROUT
	call	BDOS		; Print DevIDmsg message

	ld	hl,DEV_ID
lpDevId:
	ld	c,(hl)
	push	hl		; [..|]
	call	OutHex8
	pop	hl		; [..|]
	ld	a,(hl)
	inc	l
	cp	Contin		; for the case of EON EN29F040A look at bank two, where bank = sector of 256 bytes, where bank one is the one of 1 AMD and 4 Fujitsu
	jr	z,lpDevId
	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print DEV_ID hex and MESend message

;	ld	a,(SegmntPg)
;	xor	a
;	ld	(SegmntPg),a	; SegmntPg segment/page index cleared

	ret

; *** end of function BnkLoop

; function SeDevID
; it searches for matching Device ID and it prepares a string to be diplayed in stdout

SeDevID:
	ld	a,(DEV_ID)

	cp	0D5h		; Device ID (05Dh=Am29F080B)
	ex	AF,AF'
	ld	a,038h		; 038h '8'
	ld	(AM29F0xx+6),a
	ld	a,030h		; 030h '0'
	ld	(AM29F0xx+7),a
	ex	AF,AF'
	jr	z,ID_OK

	cp	0A4h		; Device ID (0A4h=Am29F040B)
	jr	z,ID_OK

	cp	077h		; Device ID (077h=Am29F004B (Top Boot Block))
	ex	AF,AF'
	ld	a,030h		; 030h '0'
	ld	(AM29F0xx+6),a
	ld	a,034h		; 034h '4'
	ld	(AM29F0xx+7),a
	ex	AF,AF'
	jr	z,ID_OK
	cp	07Bh		; Device ID (07Bh=Am29F004B (Bottom Boot Block))
	jr	z,ID_OK

	cp	0B0h		; Device ID (0B0h=Am29F002 (Top Boot Block))
	ex	AF,AF'
	ld	a,030h		; 030h '0'
	ld	(AM29F0xx+6),a
	ld	a,032h		; 032h '2'
	ld	(AM29F0xx+7),a
	ld	a,020h		; Space ASCII character
	ld	(AM29F0xx+8),a
	ex	AF,AF'
	jr	z,ID_OK
	cp	034h		; Device ID (034h=Am29F002 (Bottom Boot Block))
	jr	z,ID_OK

	cp	020h		; Device ID (020h=Am29F010)
	ex	AF,AF'
	ld	a,031h		; 031h '1'
	ld	(AM29F0xx+6),a
	ld	a,030h		; 030h '0'
	ld	(AM29F0xx+7),a
	ld	a,020h		; Space ASCII character
	ld	(AM29F0xx+8),a
	ex	AF,AF'
	jr	z,ID_OK

	cp	0ADh		; Device ID (0ADh=AM29F016D)
	ex	AF,AF'
	ld	a,031h		; 031h '1'
	ld	(AM29F0xx+6),a
	ld	a,036h		; 036h '6'
	ld	(AM29F0xx+7),a
	ld	a,044h		; D LATIN CAPITAL LETTER D
	ld	(AM29F0xx+8),a
	ex	AF,AF'
	jr	z,ID_OK

	cp	Contin		; Continuation Code
	jr	nz,SeDevIDr

	ld	a,(DEV_ID+1)	; looking in bank two
	cp	1Ch		; Device ID (7Fh 1Ch=EN29F040A)
	ex	AF,AF'		;
	ld	a,045h		; E LATIN CAPITAL LETTER E
	ld	(AM29F0xx+0),a
	ld	a,04Eh		; N LATIN CAPITAL LETTER N
	ld	(AM29F0xx+1),a
	ld	a,041h		; A LATIN CAPITAL LETTER A
	ld	(AM29F0xx+8),a
	ex	AF,AF'
	jr	z,ID_OK

ID_OK:
	ld	a,(RAMAD1)
	ld	h,40h
	call	ENASLT		; Select Main-RAM at memory page 1 cutting out Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	de,AM29F0xx	; Pointer to AM29F0xx message
	ld	c,_STROUT
	call	BDOS		; Print AM29F0xx message

	ld	a,(ERMSlt)	; FlashROM slot
	and	3
	add	a,30h
	ld	e,a
	ld	c,_CONOUT
	call	BDOS		; Print primary slot number

	ld	e,02Dh
	ld	c,_CONOUT
	call	BDOS		; Print "-" character

	ld	a,(ERMSlt)	; FlashROM slot
	and	0Ch
	srl	a
	srl	a
	add	a,30h
	ld	e,a
	ld	c,_CONOUT
	call	BDOS		; Print secondary slot number

	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print MESend

SeDevIDr:
	ret

; *** end of function SeDevID

; function Parameters
; In: none
; Out: A = 0 if Parameters succeed or 255 if Parameters failed

Parameters:
	ld	a,255		; a is initialized to 255 which is Parameters failed return value
	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	inc	b
	dec	b
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if no parameter and returns with ret

; Check parameter /R

	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	ld	c,052h		; 052h R LATIN CAPITAL LETTER R
	call	SeekParameter
	cp	255
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if syntax error and returns with ret
	ld	(ParameterR),a

; Check parameter /A

	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	ld	c,041h		; 041h A LATIN CAPITAL LETTER A
	call	SeekParameter
	cp	255
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if syntax error and returns with ret
	ld	(ParameterA),a

; Check parameter /I

	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	ld	c,049h		; 049h I LATIN CAPITAL LETTER I
	call	SeekParameter
	cp	255
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if syntax error and returns with ret
	ld	(ParameterI),a

; Check parameter /E

	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	ld	c,045h		; 045h E LATIN CAPITAL LETTER E
	call	SeekParameter
	cp	255
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if syntax error and returns with ret
	or	a
	ld	(FLerase),a

; Check parameter /S

	ld	hl,DMA		; hl is pointer in DMA area and it will be pushed in stack, ref. [%]
	ld	b,(hl)		; b is length of DMA area and it will be pushed in stack, ref. [&]
	ld	c,053h		; 053h S LATIN CAPITAL LETTER S
	call	SeekParameter
	cp	255
	ld	de,HlpMes	; Pointer to HlpMes message
	jp	z,NoReset	; Jump if syntax error and returns with ret
	ld	(ParameterS),a
	or	a
	jr	z,No_S
	call	GetNum		; Get the slot number from parameter
	ld	a,e
	ld	(ERMSlt),a	; FlashROM slot ; Acc = a = slot number from option S

; dbg block - begin
; it displays parameter /S arugument that is argument of BnkLoop called function
IF 0
	exx			; EXX (4 cycles) Exchange the contents of BC,DE,HL with BC',DE',HL'.
	ld	de,USEDSLOT
	ld	c,_STROUT
	call	BDOS		; Print USEDSLOT message

	ld	a,(ERMSlt)	; FlashROM slot ; Acc = a = slot number from option S

	ld	c,a		; C <- FlashROM slot ; Acc = a = slot number from option S
	call	OutHex8

	ld	de,MESend
	ld	c,_STROUT
	call	BDOS		; Print MESend message
	exx			; EXX (4 cycles) Exchange the contents of BC,DE,HL with BC',DE',HL'.
ENDIF
; dbg block - end

	call	BnkLoop		; check if FlashROM is in /Sxx Slot

No_S:
; not valid slot value passed as /Sxx parameter, valid range is slot 1, 2 or 3

	ret

; *** end of function Parameters

; function SeekParameter
; In: B = Length of parameters zone, C = Character, HL = Pointer address
; Out: A = 0 if Parameter not found or 255 if syntax error, DE = HlpMes if syntax error
; Modify AF, BC, HL

SeekParameter:
	inc	hl
	ld	a,(hl)
	cp	02Fh		; Seek '/' character
	jr	nz,ParamBCL
	inc	hl
	ld	a,(hl)
	cp	c		; Compare found character with the input character
	ret	z
	call	SyntaxCheck
	cp	255
	ret	z

ParamBCL:
	djnz	SeekParameter	; DJNZ e instruction : decrement register b and jump e relative on no zero : b <- b + FFH and jp NZ, e
	xor	a
	ret

; *** end of function SeekParameter

; function SyntaxCheck

SyntaxCheck:
	cp	053h		; S LATIN CAPITAL LETTER S
	jr	z,SyntaxOK
	cp	052h		; R LATIN CAPITAL LETTER R
	jr	z,SyntaxOK
	cp	041h		; A LATIN CAPITAL LETTER A
	jr	z,SyntaxOK
	cp	049h		; I LATIN CAPITAL LETTER I
	jr	z,SyntaxOK
	cp	045h		; E LATIN CAPITAL LETTER E
	jr	z,SyntaxOK
	ld	de,HlpMes
	ld	a,255		; Syntax error

SyntaxOK:
	ret

; *** end of function SyntaxCheck

; function PreFCB

PreFCB:
	ld	bc,24		; Prepare the FCB
	ld	de,FCB+13
	ld	hl,FCB+12
	ld	(hl),b
	ldir			; Initialize the second half with zero

	ld	c,_FOPEN
	ld	de,FCB
	call	BDOS		; Open file

	ld	hl,1
	ld	(FCB+14),hl	; Record size = 1 byte
	or	a
	ld	de,DosErr
	jp	nz,Done

	ld	c,_SETDTA
	ld	de,BUFTOP
	call	BDOS		; Set disk transfer address BUFTOP

	ld	a,(ERMSlt)	; A = Slot number from option S
	bit	7,a
	jr	nz,SecSltPa	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSltPa:
	ld	e,a
	ld	a,(DRSAD1)
	bit	7,a
	jr	nz,SecSltP1a	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSltP1a:
	cp	e
	call	z,Confirm	; Return if actual slot is same as Disk-ROM Interface 1 Slot

	ld	a,(DRSAD2)
	bit	7,a
	jr	nz,SecSltP2a	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSltP2a:
	cp	e
	call	z,Confirm	; Return if actual slot is same as Disk-ROM Interface 2 Slot

	ld	a,(DRSAD3)
	bit	7,a
	jr	nz,SecSltP3a	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSltP3a:
	cp	e
	call	z,Confirm	; Return if actual slot is same as Disk-ROM Interface 3 Slot

	ld	a,(DRSAD4)
	bit	7,a
	jr	nz,SecSltP4a	; Jump if Secondary Slot
	and	3		; Keep primary slot bits

SecSltP4a:
	cp	e
	call	z,Confirm	; Return if actual slot is same as Disk-ROM Interface 4 Slot

	ld	a,(OverWR)
	cp	059h		; Y LATIN CAPITAL LETTER Y
	jr	z,OverWrite
	ld	de,CancelMess
	jp	Done

Confirm:
	push	de		; [0]
	ld	de,WarnMess
	ld	c,_STROUT
	call	BDOS		; Print WarnMess message

	ld	de,ConfirmMess
	ld	c,_STROUT
	call	BDOS		; Print ConfirmMess message
	pop	de		; [0]

WaitKey:
	ld	ix,CHGET
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
	ei			; CALSLT does di
	and	0dfh
	cp	059h		; Y LATIN CAPITAL LETTER Y
	ld	(OverWR),a
	ret	z
	cp	04Eh		; N LATIN CAPITAL LETTER N
	ld	(OverWR),a
	ret	z
	jr	WaitKey

OverWrite:

	ld	de,FlshEra	; Pointer to message FLASH-ROM erase start
	ld	c,_STROUT
	call	BDOS		; Print FlshEra message

	ld	a,(ERMSlt)
	ld	h,40h
	call	ENASLT		; Select FlashROM at memory page 1 with Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	a,(ParameterA)
	cp	041h		; A LATIN CAPITAL LETTER A
	jr	z,NoErase	; Jump if option /A used

	di			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\
	ld	a,0aah
	ld	(4555h),a	; FlashROM...
	ld	a,055h
	ld	(42aah),a	;
	ld	a,080h
	ld	(4555h),a	; ... erase ...
	ld	a,0aah
	ld	(4555h),a	;
	ld	a,055h
	ld	(42aah),a	;
	ld	a,010h
	ld	(4555h),a	; ... command
	ei			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\

NoErase:
	di			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\
	ld	a,0ffh
	ld	de,4000h
	ei			; /!\ ACHTUNG /!\ arbitrarly disabled interrupts, there is no reason to doing so, in case of trouble, enable disable them again /!\ ACHTUNG /!\

	call	CHECK
	jp	c,Done		; Jump if Erase fail

	ei
	ld	de,FlshEok	; Pointer to Erase OK message
	ld	a,(FLerase)
	cp	045h		; E LATIN CAPITAL LETTER E
	jp	z,Done		; Jump if Erase option used

	ld	c,_STROUT
	call	BDOS		; Print FlshEok message

	ld	a,(RAMAD1)
	ld	h,40h
	call	ENASLT		; Select Main-RAM at memory page 1 cutting out Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENALST does di

_8kL01:
	ld	c,_RDBLK
	ld	de,FCB
	ld	hl,2000h	; Number of records to read
	call	BDOS		; Read a block from file

	push	hl		; [0]
	ld	hl,FCB+16
	xor	a
	or	(hl)
	inc	hl
	or	(hl)
	inc	hl
	or	(hl)
	inc	hl
	or	(hl)
	ld	(FileSize),a	; Get a simple value to test file size
	pop	hl		; [0]

	ld	a,h
	or	l
	ld	de,DonMes
	jp	nz,CONTloading	; Jump if record is readed

	ld	a,(SegmntPg)
	cp	1
	jr	z,MakeMirror
	cp	2
	jr	z,MakeMirror
	cp	3
	jp	z,FLashPage	; FLash Page 1 again to segment/page 3
	cp	4
	jr	z,TestSize
	jp	Done		; Jump if any record is readed

MakeMirror:
	ld	a,(FileSize)
	cp	20h
	jp	z,FLashPage	; Jump if 8KB rom

Make16KMirror:
	ld	a,(ERMSlt)
	ld	h,40h
	call	ENASLT		; Select FlashROM at memory page 1 with Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	a,(SegmntPg)
	ld	(B1CHDD),a	; Bank 1 <- segment/page # a

	ld	hl,4555h
	ld	de,42aah

	exx
	ld	bc,2000h	; Length
	ld	de,4000h	; Destination
	ld	hl,0A000h	; Source
	jp	Loop

TestSize:
	ld	a,(FileSize)
	cp	80h
	jr	z,Patch4P4	; Jump if 32KB rom
	cp	40h
	jr	z,Patch4P4	; Jump if 16KB rom
	jp	Done

Patch4P4:
	ld	hl,BUFTOP
	xor	a
	ld	(hl),a
	ld	de,BUFTOP+1
	ld	bc,50h
	ldir			; clean before insert the patch

	ld	hl,CopyINIpages
	ld	de,BUFTOP+10h
	ld	bc,023h
	ldir			; Add patch for 16/32K Rom into memory page 4

	ld	hl,(HeaderADRS)
	ex	de,hl
	ld	(hl),e
	inc	hl
	ld	(hl),d		; Put ROM start addresse

	ld	a,(ERMSlt)
	ld	h,40h
	call	ENASLT		; Select FlashROM at memory page 1 with Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	a,(SegmntPg)
	ld	(B1CHDD),a	; Bank 1 <- segment/page # a

	ld	hl,4555h
	ld	de,42aah

	exx
	ld	bc,36h		; Length
	ld	de,4000h	; Destination
	ld	hl,BUFTOP	; Source

	jp	Loop

CONTloading:
	ld	a,h
	cp	20h
	ld	de,DosErr
	jp	nz,Done		; Jump if readed records number is not 2000h

	ld	a,(SegmntPg)
	or	a
	jr	nz,SKIP_PatchRomHeader

	ld	a,(BUFTOP)
	cp	41h		; A LATIN CAPITAL LETTER A
	jr	nz,SKIP_PatchRomHeader
	ld	a,(BUFTOP+1)
	cp	42h		; B LATIN CAPITAL LETTER B
	jr	nz,SKIP_PatchRomHeader

	ld	a,(FileSize)
	cp	80h
	jr	z,PatchHead
	cp	40h
	jr	nz,SKIP_PatchRomHeader

	ld	hl,BUFTOP
	ld	de,0A000h
	ld	bc,2000h
	ldir			; backup of memory page 0 for 16KB Rom

PatchHead:
	ld	hl,(BUFTOP+2)
	ld	a,h
	and	40h
	jr	nz,KeepJP
	ld	a,0c9h
	ld	(HeaderJump),a

KeepJP:
	ld	(HeaderADRS),hl	; Address start to JP of INIpages

	ld	hl,BUFTOP+8h
	ld	(hl),0		; Remove pointer for Basic
	inc	hl
	ld	(hl),0		; Remove pointer for Basic

	ld	hl,400Bh
	ld	(BUFTOP+2),hl	; Address start = patch into Header
	ld	hl,NewHeader
	ld	de,BUFTOP+11
	ld	bc,05h
	ldir			; Patch 32KB Rom header

SKIP_PatchRomHeader:
FLashPage:
	ld	a,(ERMSlt)
	ld	h,40h
	call	ENASLT		; Select FlashROM at memory page 1 with Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	a,(SegmntPg)
	ld	(B1CHDD),a	; Bank 1 <- segment/page # a

	ld	hl,4555h
	ld	de,42aah

	exx
	ld	bc,2000h	; Length
	ld	de,4000h	; Destination
	ld	hl,BUFTOP	; Source

Loop:
	di
	exx
	ld	(hl),0aah
	ld	a,055h
	ld	(de),a
	ld	(hl),0a0h
 	exx
	ld	a,(hl)
	ld	(de),a		; Write a byte to FlashROM

	ex	AF,AF'
	ld	a,(SegmntPg)
	ld	(B1CHDD),a	; Bank 1 <- segment/page # a
	ex	AF,AF'

	call	CHECK		; Check this byte
	jp	c,Done

NEXT:
	inc	hl
	inc	de
	dec	bc
	ld	a,b
	or	c
	jr	nz,Loop

	ei
	ld	a,(RAMAD1)
	ld	h,40h
	call	ENASLT		; Select Main-RAM at page 1 cutting out Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di

	ld	a,(SegmntPg)
	inc	a
	ld	(SegmntPg),a	; Increments FlashROM ASC8 mapper segment/page index for pertinent Bank
	dec	a

	and	0fh
	cp	10
	jr	c,_8kR01
	add	a,7		; add a,'A'-'0'-10 = 65-48-10 = 7

_8kR01:
	add	a,030h		; add a,'0'
	ld	e,a
	ld	c,_CONOUT
	call	BDOS		; Print FlashROM ASC8 mapper segment/page index for pertinent Bank

	ld	a,(SegmntPg)
	and	0fh
	jp	nz,_8kL01
	ld	e,CR
	ld	c,_CONOUT
	call	BDOS		; Print CR character
	ld	e,LF
	ld	c,_CONOUT
	call	BDOS		; Print LF character
	jp	_8kL01

CHECK:
	push	bc		; [*]
	ld	c,a

CHK_L1:
	ld	a,(de)
	xor	c
	jp	p,CHK_R1	; Jump if readed bit 7 = written bit 7
	xor	c
	and	020h
	jr	z,CHK_L1	; Jump if readed bit 5 = 1
	ld	a,(de)
	xor	c
	jp	p,CHK_R1	; Jump if readed bit 7 = written bit 7
	ld	de,FlshErr
	scf

CHK_R1:
	pop	bc		; [*]
	ret

Done:
	ld	a,(ParameterR)
	cp	052h		; Seek 'R' character
	jr	z,ResetRoutine
	ld	de,FlshEok	; Pointer to FlshEok message
	jp	NoReset		; manage FlshEok message and returns

ResetRoutine:
	ld	a,(ERMSlt)	; FlashROM slot
	ld	hl,B1CHDD	; Bank 1 segment/page selection address for ASC8 mapper
	ld	e,0		; bank # 0 (first bank)
	call	WRSLT		; Writes a value to an address in another slot

	ld	a,(ERMSlt)	; FlashROM slot
	ld	hl,B2CHDD	; Bank 2 segment/page selection address for ASC8 mapper
	ld	e,0		; bank # 0 (first bank)
	call	WRSLT		; Writes a value to an address in another slot

	ld	a,(ERMSlt)	; FlashROM slot
	ld	hl,B3CHDD	; Bank 3 segment/page selection address for ASC8 mapper
	ld	e,0		; bank # 0 (first bank)
	call	WRSLT		; Writes a value to an address in another slot

	ld	a,(ERMSlt)	; FlashROM slot
	ld	hl,B4CHDD	; Bank 4 segment/page selection address for ASC8 mapper
	ld	e,0		; bank # 0 (first bank)
	call	WRSLT		; Writes a value to an address in another slot

	ld	hl,ResetMSX
	ld	de,0C000h
	ld	bc,0020h
	ldir 			; Copy ResetMSX Routine to 0C000h
	jp	0C000h		; jump to ResetMSX routine

ResetMSX:
	ld	a,(EXSAD0)	; A = Main-ROM slot
	ld	h,00h		; HL = address start of slot bank
	call	ENASLT		; Select Main-ROM at memory page 0
	ei			; ENALST does di
	ld	a,(EXSAD0)	; Main-ROM slot
	ld	h,40h		; HL = address start of slot bank
	call	ENASLT		; Select Main-ROM at memory page 1
	ei			; ENASLT does di
	call	INIT32		; MSX 1 BIOS entry INIT32
	jp	CHKRAM		; msx reset

NoReset:
	push	af		; [1]
	push	de		; [0]
	ld	a,(RAMAD1)
	ld	h,40h
	call	ENASLT		; Select Main-RAM at memory page 1 cutting out Bank 1: 4000h - 5FFFh and Bank 2: 6000h - 7FFFh of ASC8 FlashROM
	ei			; ENASLT does di
	ld	a,(RAMAD2)
	ld	h,80h
	call	ENASLT		; Select Main-RAM at memory page 2 cutting out Bank 3: 8000h - 9FFFh and Bank 4: A000h - BFFFh of ASC8 FlashROM
	ei			; ENASLT does di
	pop	de		; [0]

	ld	c,_STROUT
	call	BDOS		; Print final message

	pop	af		; [1]
	ret

; *** end of function - whichever function jumped to Done

GetNum:
	ld	de,0

GetL01:
	inc	hl
	ld	a,(hl)
	sub	030h		; sub '0'
	ret	c
	cp	10
	jr	c,GetR01
	and	0dfh
	sub	7		; sub 'A'-'0'-10
	ret	c
	cp	16
	ccf			; invert the carry flag
	ret	c
GetR01:
	sla	e		; the contents of e are shifted left one bit position. The contents of bit 7 are copied to the carry flag and a zero is put to bit 0.
	rl	d		; the contents of d are rotated left one bit position. The contents of bit 7 are copied to the carry flag and the previous contents of the carry flag is copied to bit 0.
	sla	e
	rl	d
	sla	e
	rl	d
	sla	e
	rl	d
	add	a,e
	ld	e,a
	jr	GetL01

; Patch for 16/32KB ROM Header & added page 4

NewHeader:
	ld	a,4
	ld	(B1CHDD),a	; Bank 1 <- segment/page # 4 (fifth segment/page)

CopyINIpages:
	push	hl		; [0]
	push	bc		; [1]
	ld	hl,04022h	; Start of INIpages routine in ROM
	ld	de,0C000h
	ld	bc,014H
	ldir
	pop	bc		; [1]
	pop	hl		; [0]
	jp	0C000h		; CopyINIpages length = 12h

INIpages:
	xor	a
	ld	(B1CHDD),a	; Bank 1 default segment/page # 0 (first segment/page)
	inc	a
	ld	(B2CHDD),a	; Bank 2 default segment/page # 1 (second segment/page)
	inc	a
	ld	(B3CHDD),a	; Bank 3 default segment/page # 2 (third segment/page)
	inc	a
	ld	(B4CHDD),a	; Bank 4 default segment/page # 3 (fourth segment/page)

HeaderJump:
	jp	4010h		; INIpages length = 13h


; Initialisation routine of memory pages for 32KB ROM (length = 11h)


; Initialisation routine of mrmory pages for 16KB ROM (length = 14h)

INIpages16:
	ld	a,1
	ld	(B2CHDD),a	; Bank 2 <- segment/page # 1 (second segment/page)
	ld	(B4CHDD),a	; Bank 4 <- segment/page # 1 (second segment/page)
	push	hl		; [0]
	ld	hl,(0C012h)
	ld	a,(hl)
	inc	hl
	or	(hl)
	pop	hl		; [0]
	ret	z

; Display functions

; function DispHLhex
; Display a 16-bit number in hex format
; Input: HL pair

DispHLhex:
	push	bc		; [0]
	ld	c,h
	call	OutHex8
	ld	c,l
	call	OutHex8
	pop	bc		; [0]
	ret

; function OutHex8
; Display a 8-bit number in hex format
; Input: C register 8-bit number

OutHex8:
	push	af		; [0]
	push	de		; [1]
	push	bc		; [2]
	ld	a,c
	rra
	rra
	rra
	rra
	call	Conv
	pop	bc		; [2] restore bc
	push	bc		; [2]
	ld	a,c
	call	Conv
	pop	bc		; [2] restore bc
	pop	de		; [1] restore de
	pop	af		; [0] restore af
	ret

; function Conv
; Display 4-bit number in hex format
; Input: A register 4-bit number

Conv:
	and	00Fh
	add	a,090h
	daa			; Decimal Adjust Accumulator
	adc	a,040h
	daa			; Decimal Adjust Accumulator
	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
	ret

; function WSpaceBar
; Wait for space bar

WSpaceBar:
	push	bc		; [0] register c will be used
	push	hl		; [1] register l will be used by _DIRIN function
	ld	b,a
	push	bc		; [2] register a will be used by _DIRIN function
WSpaceLoop:
	ld	c,_DIRIN	; MSX-DOS 2 function call     MSX1* 07h -  Direct console input
	call	BDOS		; Console input
	cp	020h		; 020h SPACE
	jr	nz,WSpaceLoop
	pop	bc		; [2] restore bc
	ld	a,b		; restore accumulator [Acc] a register
	pop	hl		; [1] restore hl
	pop	bc		; [0] restore bc
	ret

; function MDu8Bytes
; it dumps 8 Bytes hex memory starting HL
; Input: HL 16 bit register 16 bit address

MDu8Bytes:
	push	hl		; [0] function uses hl
	push	bc		; [1] function uses bc
	push	af		; [2] function uses a
	ld	b,008h
;	ld	a,07Ch		; 07Ch | VERTICAL LINE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	call	DispHLhex

;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
MDu1Byte:
	ld	a,07Ch		; 07Ch | VERTICAL LINE
	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	ld	c,(hl)
	call	OutHex8
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	inc	hl
	djnz	MDu1Byte	; DJNZ e instruction : decrement register b and jump e relative on no zero : b <- b + FFH and jp NZ, e

;	ld	a,07Ch		; 07Ch | VERTICAL LINE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	ld	a,CR
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
	ld	a,LF
	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
	pop	af		; [2] restore a
	pop	bc		; [1] restore  bc
	pop	hl		; [0] restore  hl
	ret


; function MDu3BsSp
; it dumps 3 Bytes and a space character hex memory starting HL
; Input: HL 16 bit register 16 bit address

MDu3BsSp:
	push	hl		; [0] function uses hl
	push	bc		; [1] function uses bc
	push	af		; [2] function uses a
	ld	b,003h
;	ld	a,07Ch		; 07Ch | VERTICAL LINE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	call	DispHLhex

;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
MDu1Bo3B:
	ld	a,07Ch		; 07Ch | VERTICAL LINE
	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	ld	c,(hl)
	call	OutHex8
;	ld	a,020h		; 020h   SPACE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	inc	hl
	djnz	MDu1Bo3B	; DJNZ e instruction : decrement register b and jump e relative on no zero : b <- b + FFH and jp NZ, e

;	ld	a,07Ch		; 07Ch | VERTICAL LINE
;	ld	ix,CHPUT	; NOTE - MSX 1 BIOS entry CHPUT call do no modify registers
;	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
;	call	CALSLT		; Execute the ROM MSX BIOS call
	ld	a,020h		; 020h   SPACE
	ld	iy,(EXSAD0-1)	; Main-ROM Slot number & Secondary slot flag. Slot 0: #80 = expanded, 0 = not expanded. Also main BIOS-ROM slot address
	call	CALSLT		; Execute the ROM MSX BIOS call
	pop	af		; [2] restore a
	pop	bc		; [1] restore  bc
	pop	hl		; [0] restore  hl
	ret

; dbg block - begin
IF DBGVAL
; function DBG_CONT
; it dumps 16 Bytes hex memory array DBG_MAN and DBG_DEV

DBG_CONT:
	push	hl		; [0]
	ld	hl,DBG_MAN
	call	MDu8Bytes
	ld	hl,DBG_MAN+8
	call	MDu8Bytes
	ld	hl,DBG_DEV
	call	MDu8Bytes
	ld	hl,DBG_DEV+8
	call	MDu8Bytes
	pop	hl		; [0]
	ret
ENDIF
; dbg block - end


; dbg block - begin
IF DBGVAL
; function UsdSlot
; it warns current slot under test being Disk-ROM slot 
; Input: A accumulator 8 bit register is slot FXXSSPP value

UsdSlot:
	push	hl		; [(__)]
	push	de		; [(_~)]
	push	bc		; [(~_)]
	push	af		; [(~~)]
	ld	de,USEDSLOT
	ld	c,_STROUT
	call	BDOS		; Print slot # hex and USEDSLOT message
	pop	af		; [(~~)]
	pop	bc		; [(~_)]
	push	bc		; [(~_)]
	push	af		; [(~~)]
	call	OutHex8
	ld	de,USLOT_DR
	ld	c,_STROUT
	call	z,BDOS		; Print slot # hex and USLOT_DR message
	pop	af		; [(~~)]
	pop	bc		; [(~_)]
	push	bc		; [(~_)]
	push	af		; [(~~)]
	cp	c
	call	z,WSpaceBar
	pop	af		; [(~~)]
	pop	bc		; [(~_)]
	pop	de		; [(_~)]
	pop	hl		; [(__)]
	ret
ENDIF
; dbg block - end

; work area

ERMSlt				; FlashROM Slot coordinates, either found in AutoSeek function or assigned with /S option by calling context
	db	0
SegmntPg			; FlashROM ASC8 mapper page index for pertinent Bank, used for Bank 1 for most of the time here
	db	0
FLerase
	db	0
MAN_ID
	db	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0		; Manufacturer's Identification Code
DEV_ID
	db	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0		; Am29F016D device identifier 0ADh, Am29040B device identifier 0A4h, EN29F040A device identifier 7Fh 1Ch
;SEC_PROT
;	db	0
FileSize
	db	0
HeaderADRS
	dw	0
ParameterR
	db	0
ParameterA
	db	0
ParameterI
	db	0
ParameterS
	db	0
OverWR
	db	059h		; Y LATIN CAPITAL LETTER Y

Pagina 3/8
1 | 2 | | 4 | 5 | 6 | 7 | 8