News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Assembling to ROM in Winape

Started by Trebmint, 20:17, 24 September 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Trebmint

Assembling using the built in assember in Winape is it possible to assemble to a ROM page.


Having not coded either ROM or using Winape, having only written to RAM im a bit confused as to how to do it.


The project I have to Plus+++ a existing game. Its working nicely too with lots of new colours etc and upgraded graphics. Developing wise Ive used the built Winape assembler directly to a block of 2k spare ram in the main 64k. Ive been saving the whole thing as a Snapshot as I dont have a full dissambly to recompile etc


So is it possible to direct assemble to cartridge ROM?????? Please


Else I'd have to release as a snapshot file and thats no fun.... I want a .CRT


Rob

Bryce

The Cartridge ROMs are like a standard expansion ROM (see several guides as discussed in another current thread). The only difference is that they are not limited to 16K, they can be up to 512K and appear as ROM Number 128 onwards.

Bryce.

Trebmint

So how do I direct compile to a ROM using Winape assembler? What are the compiler directives

TFM

I'm not acquainted to this assembler. But I would do the following.

- Assemble part in 16 KB blocks (target address would usually be &C000-&FFFF)

- Save these single 16 KB blocks

- Use a HEX Editor to make a big file out of all these 16 KB Blocks

- Use the program BIN2CPR [nb]or similar name[/nb] to generate a CPR


I dunno if there is a more easy way. But you can ask Devilmarkus to implement this new desired feature in his JavaCPC  ;)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

arnoldemu

TFM's way is one way, it's a bit of a pain with larger files.

16K sections, join together with copy /b, then use bin2cpr to generate the cpr file.

The alternative, is to use a "Cart File system". I've implemented something you are welcome to use.

A tool on the pc joins multiple files together, and inserts a "directory" of sorts at the start of the cart.
To load each part you use the function in rom page 0. My approach is similar to No$cash utility but without basic, firmware and amsdos.

If you're interested PM me and I'll send you the latest version to use with some instructions.

I plan to take this approach first.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

TFM

Quote from: arnoldemu on 08:52, 25 September 13
A tool on the pc joins multiple files together,


I made such a tool for the CPC side. For my Cartridge developments I use only the CPC, a PC is not needed. And it's quick process, in case all the assembly (and debugging) was done before.

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Executioner

Hi Rob,

You can use the write direct command to write directly to a selected ROM address. Not sure if it works for ROMS 128..255 though...

From the WinAPE help file:

write direct    Write direct allows direct output to emulator memory. The full syntax is:
write direct [lower_rom[,upper_rom[,ram_bank]]].
Set lower_rom to -1 to disable or 0 to enable the lower_rom, upper_rom to -1 to disable, or an upper ROM number and ram_bank to an expansion bank number #C0 to #FF.


Cheers,
Richard



AMSDOS

Trying to make a small ROM in Winape using the Write Direct which I think is correct, though when I do a reset, it gets as far as printing my Palette Installed Message before going into this ongoing Reset Loop. Suspect it's code I've obtained from the AA53 Feature Article, but I'm not completely sure  :'(




org &c000


write direct -1,1,#C0


defb 1
defb 1,1,1


defw nametable


jp initialize


jp prog1


ret


.nametable
defb "PA"
defb "L"+#80
defb 0


.initialize
push hl
push de
ld hl,message
call print


ld de,100
sbc hl,de

pop de
pop hl
scf
ret


.message
defb "Pallette Installed",0


.print ld a,(hl)
cp 0
ret z
call #bb5a
inc hl
jr print


.prog1 ld a,0
ld bc,1111
call &bc32
ld a,1
ld bc,2626
call &bc32
ld bc,1111
call &bc38
ret
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

IanS

You don't have a name defined for your "prog1" command in .nametable.

You are also trying to reserve some memory "sbc hl,de", but you then restore hl from the stack. So you won't be reserving aby memory.

I don't think either of those things should cause a reset loop, but you should probably fix them.

roudoudou

Quote from: AMSDOS on 09:04, 28 December 17
Trying to make a small ROM in Winape using the Write Direct which I think is correct, though when I do a reset, it gets as far as printing my Palette Installed Message before going into this ongoing Reset Loop. Suspect it's code I've obtained from the AA53 Feature Article, but I'm not completely sure  :'(




   org &c000


   write direct -1,1,#C0


   defb 1
   defb 1,1,1


   defw nametable


   jp initialize


   jp prog1


   ret


.nametable
   defb "PA"
   defb "L"+#80
   defb 0


.initialize
   push hl
   push de
   ld hl,message
   call print


   ld de,100
   sbc hl,de
   
   pop de
   pop hl
   scf
   ret


.message
   defb "Pallette Installed",0


.print   ld a,(hl)
   cp 0
   ret z
   call #bb5a
   inc hl
   jr print


.prog1   ld a,0
   ld bc,1111
   call &bc32
   ld a,1
   ld bc,2626
   call &bc32
   ld bc,1111
   call &bc38
   ret



- Use only "write direct 1" to write the rom 1 or "write direct -1,1"
- You must know winape cant write to rom 1 if there is not already a rom 1, dont ask me why...



My pronouns are RASM and ACE

AMSDOS


Quote from: IanS on 13:07, 28 December 17You don't have a name defined for your "prog1" command in .nametable.You are also trying to reserve some memory "sbc hl,de", but you then restore hl from the stack. So you won't be reserving aby memory.I don't think either of those things should cause a reset loop, but you should probably fix them.



Ok, I've added a Name to go with the Initialize routine.


The program published in AA53 looks a little bit dodgy, in their case their PUSHing HL & DE, Printing the Text (which is incorrect as they don't have a print routine, I added one earlier), and then reserving some memory before POPping HL/DE from the Stack. I've since moved that after the POP has occurred from the Stack.

Quote from: roudoudou on 13:41, 28 December 17

- Use only "write direct 1" to write the rom 1 or "write direct -1,1"
- You must know winape cant write to rom 1 if there is not already a rom 1, dont ask me why...




Write Direct 1 is an out of range error, so I'm using write direct -1,1, this is what I've currently got:




org #C000


write direct -1,1


defb 1
defb 1,1,1


defw nametable


jp initialize


jp prog1


ret


.nametable
defb "SETUP PALETT"
defb "E"+#80
defb "PA"
defb "L"+#80
defb 0


.initialize
push hl
push de


ld hl,message
call print


pop de
pop hl


ld de,100
sbc hl,de

scf
ret


.message
defb "Palette Installed",0


.print ld a,(hl)
cp 0
ret z
call #bb5a
inc hl
jr print




.prog1 ld a,0
ld bc,#0b0b
call #bc32
ld a,1
ld bc,#1a1a
call #bc32
ld bc,#0b0b
call #bc38
ret



Sadly I've never written a ROM before and after I've made the changes, the problem is still occurring. When I pause to go into the Winape Debugger Select Any, Goto ROM 1 & select &C0, it looks like my code is going somewhere where it's overwriting something else, I don't know why as Winape is telling me that area is supposed to be Empty.


I'm also confused as to how I'm supposed to write out a ROM file, I use the Debugger to save a file with the Extension .ROM, though that doesn't look correct. Help!  :'(
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

roudoudou



do you have a rom file selected in the upper slot 1 ?


in 6128 default configuration, upper 1 is empty. Create a 16384 zeroed file and load it in the slot 1. So you will be able to write in the upper 1
My pronouns are RASM and ACE

SOS

Quote from: AMSDOS on 23:39, 28 December 17





org #C000


write direct -1,1


defb 1
defb 1,1,1


defw nametable


jp initialize


jp prog1


ret


.nametable
defb "SETUP PALETT"
defb "E"+#80
defb "PA"
defb "L"+#80
defb 0


.initialize
push hl
push de


ld hl,message
call print


pop de
pop hl


ld de,100
sbc hl,de

scf
ret


.message
defb "Palette Installed",0


.print ld a,(hl)
cp 0
ret z
call #bb5a
inc hl
jr print




.prog1 ld a,0
ld bc,#0b0b
call #bc32
ld a,1
ld bc,#1a1a
call #bc32
ld bc,#0b0b
call #bc38
ret


Sadly I've never written a ROM before and after I've made the changes, the problem is still occurring. When I pause to go into the Winape Debugger Select Any, Goto ROM 1 & select &C0,

it looks like my code is going somewhere where it's overwriting something else, I don't know why as Winape is telling me that area is supposed to be Empty.

I'm getting this, with an empty Slot 1 (no file):  (btw. why do you select &c0?)

[attach=2]

Quote from: AMSDOS on 23:39, 28 December 17
I'm also confused as to how I'm supposed to write out a ROM file, I use the Debugger to save a file with the Extension .ROM, though that doesn't look correct. Help!  :'( [/font]

Try:
write direct -1,7

; AMSDOS 6128
org #whatever
ld a,(007)
cp "JAMES"
ret z

close
save "AMSDOSP.ROM",#c000,#3fff,0


IanS

Quote from: AMSDOS on 23:39, 28 December 17I've since moved that after the POP has occurred from the Stack.
So you are now putting the wrong value in DE. It would exit being set to 100.

You needs something like this:
.initialize
    push de
    push hl

    ld hl,message
    call print

    pop hl

    ld de,100
    sbc hl,de

    pop de
   
    scf
    ret

AMSDOS

#14

Well I've done what @roudoudou has suggested and created a zero out ROM file. I've put that into Upper 1 slot and compiled my Winape assembly file, initially I had "write direct -1,1", though that still wasn't working, so I changed to "write direct -1,1,#c0" and the program compiles to where it needs to go. I saved that in the Winape Debugger as a 16384 byte ROM file, which now seems to be working.



   org #C000


   write direct -1,1,#c0


   defb 1
   defb 1,1,1


   defw nametable


   jp initialize


   jp prog1


   ret


.nametable
   defb "Setup Palett"
   defb "e"+#80
   defb "PA"
   defb "L"+#80
   defb 0


.initialize
   push hl
   push de


   ld hl,message
   call print


   pop de
   pop hl


   ld de,100
   sbc hl,de
   
   scf
   ret


.message
   defb "Palette Installed",0


.print   ld a,(hl)
   cp 0
   ret z
   call #bb5a
   inc hl
   jr print




.prog1   ld a,0
   ld bc,#0b0b
   call #bc32
   ld a,1
   ld bc,#1a1a
   call #bc32
   ld bc,#0b0b
   call #bc38
   ret



Guess if I don't rectify the 100 in DE issue, the stack will fill out and crash the system.


EDIT: Attached correct ROM so DE won't have 100 in it.


@SOS - I select &C0 because I'm using an Upper ROM where the program resides at &C000 and when I say write direct -1,1,#C0 the program compiles to &C000 in Upper ROM slot 1.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

fgbrain

Not sure if this is the right thread...


I want to try building a cpr cartridge from Winape assembler.


Is there any special command for this??
What is the execution address of a cartridge? I suspect &0000 at rom 0????





_____

6128 (UK keyboard, Crtc type 0/2), 6128+ (UK keyboard), 3.5" and 5.25" drives, Reset switch and Digiblaster (selfmade), Inicron Romram box, Bryce Megaflash, SVideo & PS/2 mouse, , Magnum Lightgun, X-MEM, X4 Board, C4CPC, Multiface2 X4, RTC X4 and Gotek USB Floppy emulator.

roudoudou

#16
Quote from: fgbrain on 19:10, 13 May 18
Not sure if this is the right thread...


I want to try building a cpr cartridge from Winape assembler.


Is there any special command for this??
What is the execution address of a cartridge? I suspect &0000 at rom 0? ???
Winape does not assemble in cartridge, as far as i know BUT it can assemble to ROM

Plus the memory configuration is not dependant of global configuration (WTF?)

I suggest you to build a real CPR with any tool and run CPR
A CPC+ run at #0000 interrupt disabled and IM 1 as default with ROM 0 connected lower AND upper in #C000note: The upper ROM is ROM 1 if there is more than 1 ROM in your CPR. Else ROM 0
My pronouns are RASM and ACE

evenmore

Just in case anyone is reading this and wants to assemble their own ROM through WinAPE, I have fixed a few bugs in the above Palette ROM code.

I added a linefeed and carriage return after the ROM name so it appears correctly on boot above the BASIC 1.1 line.

I changed the JP (Jump) commands to CALL commands so that they return correctly.

I added PUSH and POP commands before and after the palette modification commands so that the ROM will return to the BASIC prompt correctly. Before it would just hang.

; WRITE TO ROM
; MAKE 16k ZERO'D FILE EMPTY.ROM
;   IN LINUX
;   dd if=/dev/zero of=Empty.ROM count=1 bs=16384

; SELECT EMPTY.ROM FILE IN WINAPE MEMORY SETTINGS, UPPER 1
; ASSEMBLE WITH WINAPE
; write direct -1,1,#c0 COMPILES TO ROM FILE INSTEAD OF MEMORY

   org #C000

   write direct -1,1,#c0

   defb 1
   defb 1,1,1

   defw nametable
   call initialize
   call prog1

   ret

.nametable
   defb "Setup Palett"
   defb "e"+#80
   defb "PA"
   defb "L"+#80
   defb 0

.initialize
   push hl
   push de

   ld hl,message
   call print

   pop de
   pop hl
  
   scf
   ret

.message
   defb " Palette Installed",10,13,0

.print  
   ld a,(hl)
   cp 0
   ret z
   call #bb5a
   inc hl
   jr print

.prog1  
   push hl
   push de

   ld a,0
   ld bc,#0b0b
   call #bc32
   ld a,1
   ld bc,#1a1a
   call #bc32
   ld bc,#0b0b
   call #bc38

   pop de
   pop hl
  
   ret

Powered by SMFPacks Menu Editor Mod