Imagen

FM77AV - learning how to program it (english thread)

malikto999
Mensajes: 162
Registrado: 09 Jun 2017 11:20

Re: FM77AV - learning how to program it (english thread)

Mensaje por malikto999 »

jimbobaby escribió: (i just need -MORE- VRAM -507 .. sub-cpu doesn't have it's own MMR or RAM mode, true? -no )
When the FM77AV was announced, a writer for Oh!FM magazine also wrote that it was disappointing that the sub monitor was not on RAM.
In the end, it was the FM77AV40EX that had the sub-monitors (type D and type E) placed on RAM, but it was too late.
Even though the sub-CPU was made to have full RAM, I don't think anyone used it.
Also, the 260,000 color mode (Type D) cannot use analog palettes, so the techniques like the 64 color dual screen mode cannot be used, so it was not as popular as the 4096 color mode.
Avatar de Usuario
jimbobaby
Mensajes: 539
Registrado: 13 Ago 2023 21:17

Re: FM77AV - learning how to program it (english thread)

Mensaje por jimbobaby »

malikto999 escribió: Even though the sub-CPU was made to have full RAM, I don't think anyone used it.
It's a shame, really. I have been banging my head thinking ways to use both cpu's at the same time, and.. -banghead .

In the end, as in the movie , "the only way to win is not to play" -rofl, so, no sub-cpu for now and only do things with main cpu+MMR -shock . Kinda FM77AV "lite"...

PS: By the way, there is a little easter egg on F-BASIC... "With the CAP key and Kana key turned on, press the CTRL key, both left and right SHIFT keys, GRAPH key, and T key at the same time". I don't know if it's known here ;)
-sp3zy PC 386 -coam1 -m3s3x
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

jimbobaby escribió:It's a shame, really. I have been banging my head thinking ways to use both cpu's at the same time, and.. -banghead .
In the end, as in the movie , "the only way to win is not to play" -rofl, so, no sub-cpu for now and only do things with main cpu+MMR -shock . Kinda FM77AV "lite"...
Hi, jimbobaby,
I cannot agree with that. It's just us not knowing enough about the inners of this machine, believe me!
The game I am applying 'reverse engineering' to, is going to be a source of tricks to deal with the FM77AV.
Just as an advance, the SUBsystem offers up to 29 functions to the main CPU, that means that the main program can be calling the subsystem to perform a lot of operations and still be working on its side, so both CPUs will be working at the same time allowing us to program kinda
two threads code. We will need to understand very in deep the code of that game ...
Right now I am still trying to detect all of the code blocks called along the game.
By now (and I have not yet finished) I have found 310 codeblocks and a lot of data blocks, that unfortunately are mixed with the code blocks
fooling the F9DASM when diassembling it. That means that a lot of parts require manual disassembling to find out the real code -banghead
Once things are more defined, I will upload the source file so that you can see the monster it is ...
The binary file is 40.960 bytes and once unassembled it creates an asm file with 24.535 code lines ... as I said, a real nightmare to work with -507
cheers!
pere
Avatar de Usuario
jimbobaby
Mensajes: 539
Registrado: 13 Ago 2023 21:17

Re: FM77AV - learning how to program it (english thread)

Mensaje por jimbobaby »

pser1 escribió: I cannot agree with that. It's just us not knowing enough about the inners of this machine, believe me!
The game I am applying 'reverse engineering' to, is going to be a source of tricks to deal with the FM77AV.
Just as an advance, the SUBsystem offers up to 29 functions to the main CPU, that means that the main program can be calling the subsystem to perform a lot of operations and still be working on its side, so both CPUs will be working at the same time allowing us to program kinda
two threads code. We will need to understand very in deep the code of that game ...
Hi Pere

Agree to disagree -507

Obviously there are a lot of things that we don't know (a lot), and we will try to learn them step by step with malikto999's help and trying things and learning from mistakes.

And i'm the first to like a challenge :), and this sure it is. I'm not worried about that and i will takle it again someday, but, for now, i'll stick with what i can handle (as this machine allows it), a more "classical" approach if you will: one cpu, banking ram in and out and attacking directly the hw -grin.

There are a lot of things i want to try. Getting ideas is somewhat easy, the problem is converting them into reality. We'll see -thumbup

PS: By the way, thank you for all your commitment and all the hard work you do, it's appreciated -drinks
-sp3zy PC 386 -coam1 -m3s3x
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

jimbobaby escribió:Hi Pere
Agree to disagree -507
Obviously there are a lot of things that we don't know (a lot), and we will try to learn them step by step with malikto999's help and trying things and learning from mistakes.
And i'm the first to like a challenge :), and this sure it is. I'm not worried about that and i will takle it again someday, but, for now, i'll stick with what i can handle (as this machine allows it), a more "classical" approach if you will: one cpu, banking ram in and out and attacking directly the hw -grin.
There are a lot of things i want to try. Getting ideas is somewhat easy, the problem is converting them into reality. We'll see -thumbup
I am sorry for malikto999 who is going to suffer us putting so many questions ;-)
Concerning the Subsystem, the game I am working on uses a lot of RAM from $C000 to $C93B, there is where the 29 functions are put.
PS: By the way, thank you for all your commitment and all the hard work you do, it's appreciated -drinks
Thx for your kind words.
I would like to work with this machine with the same easy I can work with CoCos and Dragon even with the SuperSprite-FM+ module that allows
almost the same possibilities as any MSX2 machine!
Fabrizio Caruso
Mensajes: 3
Registrado: 06 Ene 2019 12:57

Re: FM77AV - learning how to program it (english thread)

Mensaje por Fabrizio Caruso »

Hi everyone!

I am the author of Cross-Lib: https://github.com/Fabrizio-Caruso/CROSS-LIB
which is a universal WORA framework (retro-hardware abstraction layer and build-chain) that can produce binaries for about 200 different systems (consoles, computers, hand-helds, arcade boards, pocket calculators, hacked toy computers, etc.) from the *very same* C source.

I would like to supprot the FM-7 series but I need some help from the experts.
I currently support the following targets that use the Motorola 6809:
- CoCo 1/2
- CoCo 3
- Dragon 32/64
- Thomson Mo5/Mo6/Olivetti Prodest PC 128
- Thomson To7/To8/To9

The way Cross-Lib works is that it provides a library that does the abstraction so that more than a dozen different compilers can be used to compile the very same code and produce the very same game that auto-adapts to screen size/colors/sound of each system. Graphic assets (i.e., tiles) are also abstracted so that machine-specific assets (e.g., Assembly data file to be linked) are produced by some automatic scripts from an abstracted version of the assets.

For Motorola 6809 I use cmoc compiler (http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html).
Has anyone here used cmoc for the FM-7?

I have very little knowledge of the Motorola 6809 Assembly and I am not going to need a lot of, any way.
I think I may need Assembly snippets only to send commands to the secondary CPU to display tiles on the screen.

In order to start with I would need:
- basic instructions on how to create an image file (e.g., tape/disk/cartridge) that can be loaded into an emulator (which tools? which emulator? how?)
- basic instructions on whether I need to initialize the machine and how, how to disable interrupts if I don't need for rom routines
- at which address should the binary code start? $0000? Do I need to other settings (e.g., staack location)?
- how can I produce a visible effect to just verify my build-chain is working? (e.g., display something on the screen)

For Cross-Lib I only need:
- routine to initialize a bitmap mode (8 colors are enough, low resolution like 320x200 with at least 8 colors would be perfect)
- routine to display an 8x8 monochromatic tile at 8-bit boundaries (i.e., like a character with a user-defined shape)
- routine to poll the keyboard (with auto-repeat) and/or joystick
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

@Fabrizio Caruso,
I have found a very interesting page that might be of help for you ... and for me too, of course ;-)
https://www.chibiakumas.com/6809/fm7.php
cheers!
pere
Fabrizio Caruso
Mensajes: 3
Registrado: 06 Ene 2019 12:57

Re: FM77AV - learning how to program it (english thread)

Mensaje por Fabrizio Caruso »

@pser1 Thanks! I knew that site. I had already taken a quick look at it. I still have to read it carefully.
Right now I have a basic question:
- which emulator can I use ? which settings?
- how do I create a disk image ? Which tool?
- who has used cmoc for the FM-7 ?
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

Fabrizio Caruso escribió:Right now I have a basic question:
- which emulator can I use ? which settings?
- how do I create a disk image ? Which tool?
- who has used cmoc for the FM-7 ?
- Most of us are using "XM7" (version 3.5L52a R130423)
- When you have the binary created by the compiler, that should have the header (21 bytes) and a tail (5 bytes)
you could add it to a blank formatted virtual disk using "D77MAN" (a windows app created by malikto999)
- The CMOC question ... Maybe jimbobaby could tell us what C compiler he is using for testing examples
cheers!
Avatar de Usuario
jimbobaby
Mensajes: 539
Registrado: 13 Ago 2023 21:17

Re: FM77AV - learning how to program it (english thread)

Mensaje por jimbobaby »

pser1 escribió: - Most of us are using "XM7" (version 3.5L52a R130423)
You (and i) use that because it's the only translated version there is, and you know it -507 . I also sometimes use Mutsu (https://github.com/captainys/77AVEMU). But yes, the golden standard (and rightfully so) is the XM7. Have not tried MESS/MAME yet, but i haven't heard nothing good about...
pser1 escribió: - The CMOC question ... Maybe jimbobaby could tell us what C compiler he is using for testing examples
I have seen WinCMOC for CoCo & Dragons (no support for FM7, at least not out of the box). But i discovered malikto999's C Compiler, and never looked back -drinks , so i have still not tried WinCMOC.

But i don't know if it would be useful to you. It's a very good compiler (those are some of the hardest thing to program, so lots of respect), but it's a japanese compiler, with japanese documentation, probably ideal for programmers that want to step up from Basic to something better. But perhaps you will need low-level things that you will not find there, i'm afraid. And depending on your setup probably you will run into issues just to run it. It is what it is, if it works, good, else.... -grin

Don't get me wrong, i use it a lot for prototyping, and it's a godsend for me (as i know C, but not assembler for this CPU) -thanks , but i'm aware that i'm using it in ways not intended to, and i try to not bother him about it (well, i bother him about other things -grin -thumbup , but not about his compiler)

Anyway, don't rush. The FM7 family is "special" architecture-wise, and needs some TLC. Fortunately just with the information here, on this board, you have enough to get started -thumbup.
-sp3zy PC 386 -coam1 -m3s3x
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

Hello,
finally I have ended the first step of the reverse engineering that is been applied to the chosen game.
Now I have numbered every group of code lines like that BLKnnn, there are 461 blocks of code!
Those blocks that are just data or tables are named simply DATA without numbers.
I have traced manually the program numbering the Blocks as they are used. Unfortunately, there are a few that are never called,
despite some of them are related, I mean one is calling another or more than one of them.
For maybe someone would like to have a peek at the monster source file, I am attaching here the output created by the disassembler
F9DASM and the current version of the file I am working on. The Blocks that are never called are these
Z749C, Z7564, Z756C, Z7A17, Z8062, Z8B5C, Z8BB7, Z90B4, Z90C8, Z90F9, Z9107, Z9115, Z9123, Z913E, Z9159,
ZB0CD, ZB0DF, ZB0FA, ZB10C, ZB5D5, ZD2B1, ZD2B5, ZD2B9, ZD2BD, ZD2C1, ZD2C5, ZD311, ZD45A, ZD491, ZD49F
The only data Block that is never pointed to is M82A1
Any help trying to find out where these Blocks are called / pointed will be highly appreciate

Next step will be trying to understand what every function does, beginnig from $4000 on.
There are a lof of $FDxx used. By now, I don't know what most of them they are used for, so once I begin the tracing, I will be posting
messages with these addresses so that someone (malikto999) could tell us what are they intended for.

Current version has been greatly modified so that when compiling with ASM6809 it creates the same binary as the original game loads from disk.
cheers!
pere
3-Block03 Just Disassembled.zip
(196.72 KiB) Descargado 30 veces
Code03-v20.zip
(229.62 KiB) Descargado 21 veces
Avatar de Usuario
jimbobaby
Mensajes: 539
Registrado: 13 Ago 2023 21:17

Re: FM77AV - learning how to program it (english thread)

Mensaje por jimbobaby »

pser1 escribió: The only data Block that is never pointed to is M82A1
Any help trying to find out where these Blocks are called / pointed will be highly appreciate
Thank you Pere! that's awesome.
pser1 escribió: There are a lof of $FDxx used. By now, I don't know what most of them they are used for, so once I begin the tracing, I will be posting
messages with these addresses so that someone (malikto999) could tell us what are they intended for.
I have just glimpsed over. I assume that you want confirmation on the parts commented with "what are this / what does this". Some of the registers i "know", but have not used them in practice, so i don't have the details (or only have parts of them).

For example, i have used $D410 for drawing lines (code $80), but not for tilepaint ($code 86). Or $D430, bit 7 is for NMI, and a value of 7 into lower bits means activate OA bit ("fine grained" scroll, i have used that), and map "submonitor rom 2", whatever is this (i don't know what code contains).

I will try to read carefully the dissasembly (to learn, of course), and try to add comments/hints where appropiate if i can.

Good job! -thumbup
-sp3zy PC 386 -coam1 -m3s3x
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

Hi, jimbobaby
You have seen some comments on parts that I have not understood as I were working on the source code to identify the
diferent code blocks that form the game.
In fact most of the time the problem is the lack of knowledge about the hardware use through registers in the $FDxx range
I am tracing the game from the beginnig and I am writting on a document the points that need some explanation
Sooner or later I will upload that doc so that someone, most probably malikto999, will shine some light ...
cheers!
pere
malikto999
Mensajes: 162
Registrado: 09 Jun 2017 11:20

Re: FM77AV - learning how to program it (english thread)

Mensaje por malikto999 »

pser1 escribió:Hi, jimbobaby
You have seen some comments on parts that I have not understood as I were working on the source code to identify the
diferent code blocks that form the game.
In fact most of the time the problem is the lack of knowledge about the hardware use through registers in the $FDxx range
I am tracing the game from the beginnig and I am writting on a document the points that need some explanation
Sooner or later I will upload that doc so that someone, most probably malikto999, will shine some light ...
cheers!
pere
That's a great achievement!
I also searched for 'what' and took a quick look at the corresponding code.
At first glance, it looks like a process to clear the VRAM plane to 0, but it is interesting that it uses a logic operation circuit.
I don't know much about this feature either, but I'd like to join you in the analysis.
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

malikto999 escribió:That's a great achievement!
I also searched for 'what' and took a quick look at the corresponding code.
At first glance, it looks like a process to clear the VRAM plane to 0, but it is interesting that it uses a logic operation circuit.
I don't know much about this feature either, but I'd like to join you in the analysis.
Hi,
this part has a lot of question marks because there are many $D4xx addresses used that I am not sure what they would do ...
You are welcome to do any work/comment on the working source file.
Same applies to any other member that would like to join this monster task ;-)
I have some parts commented, I found a few code blocks that seem to be only 'delays'. In order to calculate exactly the timing, I will add
the CPU cycles to these blocks and then I will update the source file here hopefully today late evening.
I will post a message with a few questions that have arisen while adding comments to the code from $4000 on
cheers!
pere

Ps I have arrived to a subroutine (Z7DBC) that seems to load a number of sectors and is called from 17 points at least!
The way the parameters are passed is something I never had thought about -507
Avatar de Usuario
pser1
Mensajes: 4840
Registrado: 08 Dic 2012 18:34

Re: FM77AV - learning how to program it (english thread)

Mensaje por pser1 »

@malikto999
As I said in previous message, these are the 'things' that need some explanation, at least to me -banghead

1) What interrupts have a 'hook' at $FFFx ? $FFF6 and $FFF8 are being used in the game

2) What is this code useful for?

Código: Seleccionar todo

; -------------------------------------------------------------------
; BLK 51 - Interrupt Service Routine, set in BLK 01	ZZZZZ
; asociated to $FFF6/7 addresses
; -------------------------------------------------------------------
M776D   ANDCC   #$EF                   ; disable IRQ			
        PSHS    A                      ; save register value		
Z7771   LDA     SUBIF                  ; get SUB interface ($FD04)		
        BITA    #$02                   ; check bit 1 (BRK)		
        BEQ     Z7771                  ; if zero (enabled) loopback
Z7778   LDA     SUBIF                  ; get SUB interface ($FD04)		
        BITA    #$02                   ; check bit 1 (BRK)		
        BNE     Z7778                  ; if disabled, loopback		
Z777F   LDA     SUBIF                  ; get SUB interface ($FD04)		
        BITA    #$02                   ; check bit 1 (BRK)		
        BEQ     Z777F                  ; if zero (enabled) loopback
        PULS    A                      ; restore register		
        RTI                            ; return			
; -------------------------------------------------------------------

3) Addresses $FDEA and $FDEB, what are these ones (maybe YM2203)? Both are used in code for the Subsystem

4) $FD15 and $FD16 (maybe FM related)

5) $FD37 related to Multipage ...

6) $FD00 related to Key Clock, what does it return when read?

7) the area $FFE0-$FFE5 seems FDC values, but the game uses $FFE8 too as last drive used. Is that correct?

Any hint on those addresses would be highy appreciated!
cheers!
pere
Responder

Volver a “Fujitsu FM7”