Hello everyone.
Here is a program in C language which allows you to generate a DISC.BIN file. It is based on that of mochilote from cpcmania.
This works very well with SDCC versions 3.3.0 and 3.4.0. On the other hand, with the latest versions 4.x.x it does not work.
Here is the C code:
// Disc.c
#include <stdio.h>
#include <string.h>
////////////////////////////////////////////////////////////////////////
//SetupDOS - Prepare DOS for file load
////////////////////////////////////////////////////////////////////////
void SetupDOS()
{
//Based on http://cpctech.cpc-live.com/source/loader.html
__asm
ld l, 2 (ix) ;stack return address
ld h, 3 (ix) ;stack return address
ld (_stack+1), hl
;;------------------------------------------------------------------------
;; store the drive number the loader was run from
ld hl,(#0xbe7d)
ld a,(hl)
ld (_drive+1),a
;;------------------------------------------------------------------------
ld c,#0xff ;; disable all roms
ld hl, #_start222 ;; execution address for program
call #0xbd16 ;;mc_start_program ;; start it
_start222:: nop
call #0xbccb ;;kl_rom_walk ;; enable all roms
;;------------------------------------------------------------------------
;; when AMSDOS is enabled, the drive reverts back to drive 0!
;; This will restore the drive number to the drive the loader was run from
_drive: ld a, #0x00
ld hl,(#0xbe7d)
ld (hl),a
_stack: ld hl, #0x0000
push hl //one for sdcc ix pop
push hl //two for return address
__endasm;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//Load filename to address
////////////////////////////////////////////////////////////////////////
unsigned char nFileNameLen = 0;
void LoadFile(char *sFileName, char *pLoadAddress)
{
nFileNameLen = strlen(sFileName);
__asm
;; B = length of the filename in characters
ld hl, #_nFileNameLen;
ld b, (hl)
;; HL = address of the start of the filename
LD L, 4 (IX) ;sFileName
LD H, 5 (IX) ;sFileName
;; DE = address of a 2k buffer
;; in disc mode: this buffer is not used when CAS IN DIRECT
;; firmware function is used, so it is safe to put it anywhere
;; you want.
ld de, #0x0
;; firmware function to open a file for reading
call #0xbc77 ;;cas_in_open
;; firmware function to load the entire file
;; this will work with files that have a AMSDOS header (ASCII
;; files do not have a header)
;; HL = load address
LD L, 6 (IX) ;pLoadAddress
LD H, 7 (IX) ;pLoadAddress
;; read file
call #0xbc83 ;;cas_in_direct
;; firmware function to close a file opened for reading
call #0xbc7a ;;cas_in_close
__endasm;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//SetColor
////////////////////////////////////////////////////////////////////////
void SetColor(unsigned char nColorIndex, unsigned char nPaletteIndex)
{
__asm
ld a, 4 (ix)
ld b, 5 (ix)
ld c, b
call #0xBC32 ;SCR SET INK
__endasm;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//SetPalette
////////////////////////////////////////////////////////////////////////
void SetPalette(const unsigned char *pPalette, unsigned char nNumColors)
{
unsigned char nColor = 0;
for(nColor = 0; nColor < nNumColors; nColor++)
SetColor(nColor, pPalette[nColor]);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//SetBorder
////////////////////////////////////////////////////////////////////////
void SetBorder(unsigned char nBorder)
{
__asm
ld b, 4 (ix)
ld c, 4 (ix)
call #0xBC38 ;SCR_SET_BORDER
__endasm;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//SetMode
////////////////////////////////////////////////////////////////////////
void SetMode(unsigned char nMode)
{
__asm
ld a, 4 (ix)
call #0xBC0E ;SCR_SET_MODE
__endasm;
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
//Call for screen uncompress routine
////////////////////////////////////////////////////////////////////////
void Call1(void)
{
__asm
call #0x1000
__endasm;
}
////////////////////////////////////////////////////////////////////////
//Call for game uncompress and jump routine
////////////////////////////////////////////////////////////////////////
void Call2(void)
{
__asm
call #0x9d32
__endasm;
}
////////////////////////////////////////////////////////////////////////
//main
////////////////////////////////////////////////////////////////////////
main()
{
unsigned char BlackPalette[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned char ScreenPalette[] = { 13,1,2,11,9,18,22,6,3,16,6,12,24,25,26,0};
SetupDOS();
SetMode(0);
SetBorder(0);
SetPalette((char *)BlackPalette, 16);
LoadFile("SCREEN.BIN", (char *)0x1000);
SetPalette((char *)ScreenPalette, 16);
Call1();
LoadFile("GAME.BIN", (char *)0x6300);
Call2();
while(1);
//return 0;
}
////////////////////////////////////////////////////////////////////////
Here is the asm code generated by version 3.4.0 and which works:
sdcc -mz80 --opt-code-size --code-loc 0x078 --data-loc 0 --fno-omit-frame-pointer --no-std-crt0 crt0_cpc.rel putchar_cpc.rel disc.c
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.4.0 #8981 (Apr 5 2014) (MINGW64)
; This file was generated Sat Feb 10 18:08:24 2024
;--------------------------------------------------------
.module disc
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _main
.globl _Call2
.globl _Call1
.globl _SetMode
.globl _SetBorder
.globl _SetPalette
.globl _SetColor
.globl _LoadFile
.globl _SetupDOS
.globl _strlen
.globl _nFileNameLen
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
_nFileNameLen::
.ds 1
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;disc.c:12: void SetupDOS()
; ---------------------------------
; Function SetupDOS
; ---------------------------------
_SetupDOS_start::
_SetupDOS:
push ix
ld ix,#0
add ix,sp
;disc.c:45: __endasm;
ld l, 2 (ix) ;stack return address
ld h, 3 (ix) ;stack return address
ld (_stack+1), hl
;;------------------------------------------------------------------------
;; store the drive number the loader was run from
ld hl,(#0xbe7d)
ld a,(hl)
ld (_drive+1),a
;;------------------------------------------------------------------------
ld c,#0xff ;; disable all roms
ld hl, #_start222 ;; execution address for program
call #0xbd16 ;;mc_start_program ;; start it
_start222::
nop
call #0xbccb ;;kl_rom_walk ;; enable all roms
;;------------------------------------------------------------------------
;; when AMSDOS is enabled, the drive reverts back to drive 0!
;; This will restore the drive number to the drive the loader was run from
_drive:
ld a, #0x00
ld hl,(#0xbe7d)
ld (hl),a
_stack:
ld hl, #0x0000
push hl
push hl
pop ix
ret
_SetupDOS_end::
;disc.c:54: void LoadFile(char *sFileName, char *pLoadAddress)
; ---------------------------------
; Function LoadFile
; ---------------------------------
_LoadFile_start::
_LoadFile:
push ix
ld ix,#0
add ix,sp
;disc.c:56: nFileNameLen = strlen(sFileName);
ld l,4 (ix)
ld h,5 (ix)
push hl
call _strlen
pop af
ld iy,#_nFileNameLen
ld 0 (iy),l
;disc.c:88: __endasm;
;; B = length of the filename in characters
ld hl, #_nFileNameLen;
ld b, (hl)
;; HL = address of the start of the filename
LD L, 4 (IX) ;sFileName
LD H, 5 (IX) ;sFileName
;; DE = address of a 2k buffer
;; in disc mode: this buffer is not used when CAS IN DIRECT
;; firmware function is used, so it is safe to put it anywhere
;; you want.
ld de, #0x0
;; firmware function to open a file for reading
call #0xbc77 ;;cas_in_open
;; firmware function to load the entire file
;; this will work with files that have a AMSDOS header (ASCII
;; files do not have a header)
;; HL = load address
LD L, 6 (IX) ;pLoadAddress
LD H, 7 (IX) ;pLoadAddress
;; read file
call #0xbc83 ;;cas_in_direct
;; firmware function to close a file opened for reading
call #0xbc7a ;;cas_in_close
pop ix
ret
_LoadFile_end::
;disc.c:95: void SetColor(unsigned char nColorIndex, unsigned char nPaletteIndex)
; ---------------------------------
; Function SetColor
; ---------------------------------
_SetColor_start::
_SetColor:
push ix
ld ix,#0
add ix,sp
;disc.c:102: __endasm;
ld a, 4 (ix)
ld b, 5 (ix)
ld c, b
call #0xBC32 ;SCR SET INK
pop ix
ret
_SetColor_end::
;disc.c:110: void SetPalette(const unsigned char *pPalette, unsigned char nNumColors)
; ---------------------------------
; Function SetPalette
; ---------------------------------
_SetPalette_start::
_SetPalette:
push ix
ld ix,#0
add ix,sp
;disc.c:114: for(nColor = 0; nColor < nNumColors; nColor++)
ld d,#0x00
00103$:
ld a,d
sub a, 6 (ix)
jr NC,00105$
;disc.c:115: SetColor(nColor, pPalette[nColor]);
ld a,4 (ix)
add a, d
ld l,a
ld a,5 (ix)
adc a, #0x00
ld h,a
ld h,(hl)
push de
push hl
inc sp
push de
inc sp
call _SetColor
pop af
pop de
;disc.c:114: for(nColor = 0; nColor < nNumColors; nColor++)
inc d
jr 00103$
00105$:
pop ix
ret
_SetPalette_end::
;disc.c:122: void SetBorder(unsigned char nBorder)
; ---------------------------------
; Function SetBorder
; ---------------------------------
_SetBorder_start::
_SetBorder:
push ix
ld ix,#0
add ix,sp
;disc.c:128: __endasm;
ld b, 4 (ix)
ld c, 4 (ix)
call #0xBC38 ;SCR_SET_BORDER
pop ix
ret
_SetBorder_end::
;disc.c:136: void SetMode(unsigned char nMode)
; ---------------------------------
; Function SetMode
; ---------------------------------
_SetMode_start::
_SetMode:
push ix
ld ix,#0
add ix,sp
;disc.c:141: __endasm;
ld a, 4 (ix)
call #0xBC0E ;SCR_SET_MODE
pop ix
ret
_SetMode_end::
;disc.c:148: void Call1(void)
; ---------------------------------
; Function Call1
; ---------------------------------
_Call1_start::
_Call1:
push ix
ld ix,#0
add ix,sp
;disc.c:152: __endasm;
call #0x1000
pop ix
ret
_Call1_end::
;disc.c:158: void Call2(void)
; ---------------------------------
; Function Call2
; ---------------------------------
_Call2_start::
_Call2:
push ix
ld ix,#0
add ix,sp
;disc.c:162: __endasm;
call #0x9d32
pop ix
ret
_Call2_end::
;disc.c:168: main()
; ---------------------------------
; Function main
; ---------------------------------
_main_start::
_main:
push ix
ld hl,#-32
add hl,sp
ld sp,hl
;disc.c:170: unsigned char BlackPalette[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
ld hl,#0x0000
add hl,sp
ld c,l
ld b,h
xor a, a
ld (bc),a
ld l, c
ld h, b
inc hl
ld (hl),#0x00
ld l, c
ld h, b
inc hl
inc hl
ld (hl),#0x00
ld l, c
ld h, b
inc hl
inc hl
inc hl
ld (hl),#0x00
ld hl,#0x0004
add hl,bc
ld (hl),#0x00
ld hl,#0x0005
add hl,bc
ld (hl),#0x00
ld hl,#0x0006
add hl,bc
ld (hl),#0x00
ld hl,#0x0007
add hl,bc
ld (hl),#0x00
ld hl,#0x0008
add hl,bc
ld (hl),#0x00
ld hl,#0x0009
add hl,bc
ld (hl),#0x00
ld hl,#0x000A
add hl,bc
ld (hl),#0x00
ld hl,#0x000B
add hl,bc
ld (hl),#0x00
ld hl,#0x000C
add hl,bc
ld (hl),#0x00
ld hl,#0x000D
add hl,bc
ld (hl),#0x00
ld hl,#0x000E
add hl,bc
ld (hl),#0x00
ld hl,#0x000F
add hl,bc
ld (hl),#0x00
;disc.c:171: unsigned char ScreenPalette[] = { 13,1,2,11,9,18,22,6,3,16,6,12,24,25,26,0};
ld hl,#0x0010
add hl,sp
ex de,hl
ld a,#0x0D
ld (de),a
ld l, e
ld h, d
inc hl
ld (hl),#0x01
ld l, e
ld h, d
inc hl
inc hl
ld (hl),#0x02
ld l, e
ld h, d
inc hl
inc hl
inc hl
ld (hl),#0x0B
ld hl,#0x0004
add hl,de
ld (hl),#0x09
ld hl,#0x0005
add hl,de
ld (hl),#0x12
ld hl,#0x0006
add hl,de
ld (hl),#0x16
ld hl,#0x0007
add hl,de
ld (hl),#0x06
ld hl,#0x0008
add hl,de
ld (hl),#0x03
ld hl,#0x0009
add hl,de
ld (hl),#0x10
ld hl,#0x000A
add hl,de
ld (hl),#0x06
ld hl,#0x000B
add hl,de
ld (hl),#0x0C
ld hl,#0x000C
add hl,de
ld (hl),#0x18
ld hl,#0x000D
add hl,de
ld (hl),#0x19
ld hl,#0x000E
add hl,de
ld (hl),#0x1A
ld hl,#0x000F
add hl,de
ld (hl),#0x00
;disc.c:173: SetupDOS();
push bc
push de
call _SetupDOS
xor a, a
push af
inc sp
call _SetMode
inc sp
xor a, a
push af
inc sp
call _SetBorder
inc sp
pop de
pop bc
;disc.c:177: SetPalette((char *)BlackPalette, 16);
push de
ld a,#0x10
push af
inc sp
push bc
call _SetPalette
pop af
inc sp
pop de
;disc.c:179: LoadFile("SCREEN.BIN", (char *)0x1000);
ld hl,#___str_0
push de
ld bc,#0x1000
push bc
push hl
call _LoadFile
pop af
pop af
pop de
;disc.c:180: SetPalette((char *)ScreenPalette, 16);
ld a,#0x10
push af
inc sp
push de
call _SetPalette
pop af
inc sp
;disc.c:181: Call1();
call _Call1
;disc.c:183: LoadFile("GAME.BIN", (char *)0x6300);
ld hl,#___str_1
ld bc,#0x6300
push bc
push hl
call _LoadFile
pop af
pop af
;disc.c:184: Call2();
call _Call2
;disc.c:186: while(1);
00102$:
jr 00102$
_main_end::
___str_0:
.ascii "SCREEN.BIN"
.db 0x00
___str_1:
.ascii "GAME.BIN"
.db 0x00
.area _CODE
.area _INITIALIZER
__xinit__nFileNameLen:
.db #0x00 ; 0
.area _CABS (ABS)
Here is now the code generated by the latest version 4.4.0 for example and which does not work:
;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14620 (MINGW32)
;--------------------------------------------------------
.module disc
.optsdcc -mz80
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _main
.globl _Call2
.globl _Call1
.globl _SetMode
.globl _SetBorder
.globl _SetPalette
.globl _SetColor
.globl _LoadFile
.globl _SetupDOS
.globl _strlen
.globl _nFileNameLen
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area _INITIALIZED
_nFileNameLen::
.ds 1
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area _DABS (ABS)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _HOME
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _CODE
;disc.c:12: void SetupDOS()
; ---------------------------------
; Function SetupDOS
; ---------------------------------
_SetupDOS::
call ___sdcc_enter_ix
;disc.c:45: __endasm;
ld l, 2 (ix) ;stack return address
ld h, 3 (ix) ;stack return address
ld (_stack+1), hl
;;------------------------------------------------------------------------
;; store the drive number the loader was run from
ld hl,(#0xbe7d)
ld a,(hl)
ld (_drive+1),a
;;------------------------------------------------------------------------
ld c,#0xff ;; disable all roms
ld hl, #_start222 ;; execution address for program
call #0xbd16 ;;mc_start_program ;; start it
_start222::
nop
call #0xbccb ;;kl_rom_walk ;; enable all roms
;;------------------------------------------------------------------------
;; when AMSDOS is enabled, the drive reverts back to drive 0!
;; This will restore the drive number to the drive the loader was run from
_drive:
ld a, #0x00
ld hl,(#0xbe7d)
ld (hl),a
_stack:
ld hl, #0x0000
push hl
push hl
;disc.c:46: }
pop ix
ret
;disc.c:54: void LoadFile(char *sFileName, char *pLoadAddress)
; ---------------------------------
; Function LoadFile
; ---------------------------------
_LoadFile::
push ix
ld ix,#0
add ix,sp
;disc.c:56: nFileNameLen = strlen(sFileName);
call _strlen
ld iy, #_nFileNameLen
ld 0 (iy), e
;disc.c:88: __endasm;
;; B = length of the filename in characters
ld hl, #_nFileNameLen;
ld b, (hl)
;; HL = address of the start of the filename
LD L, 4 (IX) ;sFileName
LD H, 5 (IX) ;sFileName
;; DE = address of a 2k buffer
;; in disc mode: this buffer is not used when CAS IN DIRECT
;; firmware function is used, so it is safe to put it anywhere
;; you want.
ld de, #0x0
;; firmware function to open a file for reading
call #0xbc77 ;;cas_in_open
;; firmware function to load the entire file
;; this will work with files that have a AMSDOS header (ASCII
;; files do not have a header)
;; HL = load address
LD L, 6 (IX) ;pLoadAddress
LD H, 7 (IX) ;pLoadAddress
;; read file
call #0xbc83 ;;cas_in_direct
;; firmware function to close a file opened for reading
call #0xbc7a ;;cas_in_close
;disc.c:89: }
pop ix
ret
;disc.c:95: void SetColor(unsigned char nColorIndex, unsigned char nPaletteIndex)
; ---------------------------------
; Function SetColor
; ---------------------------------
_SetColor::
push ix
ld ix,#0
add ix,sp
;disc.c:102: __endasm;
ld a, 4 (ix)
ld b, 5 (ix)
ld c, b
call #0xBC32 ;SCR SET INK
;disc.c:103: }
pop ix
ret
;disc.c:110: void SetPalette(const unsigned char *pPalette, unsigned char nNumColors)
; ---------------------------------
; Function SetPalette
; ---------------------------------
_SetPalette::
push ix
ld ix,#0
add ix,sp
ex de, hl
;disc.c:114: for(nColor = 0; nColor < nNumColors; nColor++)
ld c, #0x00
00103$:
ld a, c
sub a, 4 (ix)
jr NC, 00105$
;disc.c:115: SetColor(nColor, pPalette[nColor]);
ld l, c
; spillPairReg hl
; spillPairReg hl
ld h, #0x00
; spillPairReg hl
; spillPairReg hl
add hl, de
ld l, (hl)
; spillPairReg hl
push bc
push de
ld a, c
call _SetColor
pop de
pop bc
;disc.c:114: for(nColor = 0; nColor < nNumColors; nColor++)
inc c
jr 00103$
00105$:
;disc.c:116: }
pop ix
pop hl
inc sp
jp (hl)
;disc.c:122: void SetBorder(unsigned char nBorder)
; ---------------------------------
; Function SetBorder
; ---------------------------------
_SetBorder::
call ___sdcc_enter_ix
;disc.c:128: __endasm;
ld b, 4 (ix)
ld c, 4 (ix)
call #0xBC38 ;SCR_SET_BORDER
;disc.c:129: }
pop ix
ret
;disc.c:136: void SetMode(unsigned char nMode)
; ---------------------------------
; Function SetMode
; ---------------------------------
_SetMode::
call ___sdcc_enter_ix
;disc.c:141: __endasm;
ld a, 4 (ix)
call #0xBC0E ;SCR_SET_MODE
;disc.c:142: }
pop ix
ret
;disc.c:148: void Call1(void)
; ---------------------------------
; Function Call1
; ---------------------------------
_Call1::
call ___sdcc_enter_ix
;disc.c:152: __endasm;
call #0x1000
;disc.c:153: }
pop ix
ret
;disc.c:158: void Call2(void)
; ---------------------------------
; Function Call2
; ---------------------------------
_Call2::
call ___sdcc_enter_ix
;disc.c:162: __endasm;
call #0x9d32
;disc.c:163: }
pop ix
ret
;disc.c:168: main()
; ---------------------------------
; Function main
; ---------------------------------
_main::
call ___sdcc_enter_ix
ld hl, #-32
add hl, sp
ld sp, hl
;disc.c:170: unsigned char BlackPalette[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
ld -32 (ix), #0x00
ld -31 (ix), #0x00
ld -30 (ix), #0x00
ld -29 (ix), #0x00
ld -28 (ix), #0x00
ld -27 (ix), #0x00
ld -26 (ix), #0x00
ld -25 (ix), #0x00
ld -24 (ix), #0x00
ld -23 (ix), #0x00
ld -22 (ix), #0x00
ld -21 (ix), #0x00
ld -20 (ix), #0x00
ld -19 (ix), #0x00
ld -18 (ix), #0x00
ld -17 (ix), #0x00
;disc.c:171: unsigned char ScreenPalette[] = { 13,1,2,11,9,18,22,6,3,16,6,12,24,25,26,0};
ld -16 (ix), #0x0d
ld -15 (ix), #0x01
ld -14 (ix), #0x02
ld -13 (ix), #0x0b
ld -12 (ix), #0x09
ld -11 (ix), #0x12
ld -10 (ix), #0x16
ld -9 (ix), #0x06
ld -8 (ix), #0x03
ld -7 (ix), #0x10
ld -6 (ix), #0x06
ld -5 (ix), #0x0c
ld -4 (ix), #0x18
ld -3 (ix), #0x19
ld -2 (ix), #0x1a
ld -1 (ix), #0x00
;disc.c:173: SetupDOS();
call _SetupDOS
;disc.c:175: SetMode(0);
xor a, a
call _SetMode
;disc.c:176: SetBorder(0);
xor a, a
call _SetBorder
;disc.c:177: SetPalette((char *)BlackPalette, 16);
ld a, #0x10
push af
inc sp
ld hl, #1
add hl, sp
call _SetPalette
;disc.c:179: LoadFile("SCREEN.BIN", (char *)0x1000);
ld de, #0x1000
ld hl, #___str_0
call _LoadFile
;disc.c:180: SetPalette((char *)ScreenPalette, 16);
ld a, #0x10
push af
inc sp
ld hl, #17
add hl, sp
call _SetPalette
;disc.c:181: Call1();
call _Call1
;disc.c:183: LoadFile("GAME.BIN", (char *)0x6300);
ld de, #0x6300
ld hl, #___str_1
call _LoadFile
;disc.c:184: Call2();
call _Call2
;disc.c:186: while(1);
00102$:
;disc.c:189: }
jr 00102$
___str_0:
.ascii "SCREEN.BIN"
.db 0x00
___str_1:
.ascii "GAME.BIN"
.db 0x00
.area _CODE
.area _INITIALIZER
__xinit__nFileNameLen:
.db #0x00 ; 0
.area _CABS (ABS)
It seems that it is missing some code and it is the same problem with previous versions until 3.6.0.
Do you have any idea how to adapt the C code to make this working again ?
Another request. I'm trying to make this loader more universal but my knowledge in C language is poor. How to make CALL and JP universal functions ?
Examples (not working):
void Call(unsigned char nCallAdr)
{
__asm
call nCallAdr
__endasm;
}
void Jump(unsigned char nJumpAdr)
{
__asm
jp nJumpAdr
__endasm;
}
main()
{
...
LoadFile("SCREEN.BIN", (char *)adr1);
SetPalette((char *)ScreenPalette, 16);
Call(0x1000);
LoadFile("GAME.BIN", (char *)adr2);
Call(0x6300) or Jump(0x6300) depending of the need...
...
}
Thank you in advance for your help and I think it will be useful to others :)