News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

dissasssembly of AMSDOS.COM from 6128 CPM discs

Started by arnoldemu, 13:06, 09 October 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

arnoldemu

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

Yes I kind of gathered it was going to do something like that - |BASIC cause I did a quick disassembly of it and noticed BASI at the end!

What's interesting though is that CP/M EOF marker. Is that really important?? Cause I noticed that when I'm compiling COM files with MAXAM it's not sticking the 1A byte at the end of the file. Perhaps that's causing CP/M to overload if I'm running COM files numerous times and it's not registering that EOF marker? I'll have a look later and see if that improves the performance.
* 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

arnoldemu

Quote from: CP/M User on 23:26, 09 October 10
Yes I kind of gathered it was going to do something like that - |BASIC cause I did a quick disassembly of it and noticed BASI at the end!

What's interesting though is that CP/M EOF marker. Is that really important?? Cause I noticed that when I'm compiling COM files with MAXAM it's not sticking the 1A byte at the end of the file. Perhaps that's causing CP/M to overload if I'm running COM files numerous times and it's not registering that EOF marker? I'll have a look later and see if that improves the performance.
I've no idea about the marker. Sometimes it's there and sometimes not.

Now fwreset.com from side 4 of the cpc6128 system discs:

http://www.cpctech.org.uk/docs/fwreset_com_cpc6128.asm

A cpm2.2 only file this time. I think it's used by logo.

Yes I am working my way through dissassembly cpc specific com files, and I do plan eventually if I feel like it, to compare the com files against the versions on the 464 and 644 cpm discs.

Sometimes I get bored and think, I wonder what that does so I disassemble it and comment it ;)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

#3
Sorry I made my comments about the EOF marker in the Sprite Blues. (I put an EOF marker on the end of my assembly program in question and zero out the rest). I thought the EOF marker might of had something to do with how CP/M exits the program and close the file? The rule I pointed out in CP/M is because everything is handled in Records 1 Rec = 128 bytes, files are saved as such which consequently may save unwanted code after it.

Spoiler: ShowHide
Anyway I didn't want to want divert from what this thread is about, I found after applying the EOF marker and Zero byting out the other rubbish past my compiled file, the program was running without a hitch, until I was doing some serious stuff with CP/M - DIR several times, and then trying to execute the test file I posted in Sprite Blues. Maybe something in CP/M 2.2 is overloading which is causing my program to crash? Only it's less frequent and it takes more doing to expose the crash.


But back ontopic, it appears that FWRESET.COM is being used to reset everything so Dr Logo can work without any worries.
* 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

arnoldemu

Quote from: CP/M User on 07:50, 13 October 10

But back ontopic, it appears that FWRESET.COM is being used to reset everything so Dr Logo can work without any worries.
Yes indeed it is. i forgot to write this in the dissassembly.

Your comments about the eof are fine, because really I don't know if it's needed or not.

And now I am starting to dissassemble and document more of the cpc's cp/m stuff.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

redbox

Quote from: arnoldemu on 21:13, 12 October 10
Sometimes I get bored

If you're ever bored, you could try getting this working with this using either this or even this  :)

I can't do it and it's driving me nuts.  >:(

(You are a C++ programmer, aren't you? Sure I read it somewhere)

AMSDOS

#6
Well it's good to see some interest in CP/M!  :)

The EOF tag according to a fellow CP/M User is only really essential in Text Files. Unfortunately it appears to be another "What does "CP/M" stand for anyway debate!  >:(

C, C, yes C can drive some people nuts. People who want something English like which is better than BASIC use Pascal, people who want something which is almost as good as Assembly use C and people who want Assembly use Assembly - it's always been the way!  ;D The alternative to C is Forth! Someone correct me if I'm wrong here, but some Forths require Kernals to run the programs, but I think I heard there was some Compilable Forths out there as well. Need to check out what development is happening out there with this language. My feeling though is if a Jupiter Ace can run some interesting games using it's in-built Forth Language, then it seems like an interesting language to check-out, it can also incorporate M/C or Assembly into it's coding.
* 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

arnoldemu

Quote from: redbox on 12:45, 13 October 10
If you're ever bored, you could try getting this working with this using either this or even this  :)

I can't do it and it's driving me nuts.  >:(

(You are a C++ programmer, aren't you? Sure I read it somewhere)
Yes I am a C++ programmer.
I personally use Code:Blocks.
I might have a go but I can't say when I would be able to look at it.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu


CP/M + boot sector:

http://www.cpctech.org.uk/docs/cpmplus_boot.asm

Loads an EMS file from disc and executes it. Disc must be standard SYSTEM/VENDOR format.
The system tracks don't appear to be used. It reads the directory and searches through it itself.
So the directory must be standard too.

CP/M 2.2 boot sector:

http://www.cpctech.org.uk/docs/cpm22_boot.asm

Loads 1 sector (track 0, sector &42, side 0) (which contains some configuration info), then calls BIOS WBOOT (which is in AMSDOS rom).

I believe (but not yet checked), that this loads furthur sectors into RAM from the system tracks.

I'll continue to document the stuff as I look at it.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

TFM

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

AMSDOS

My limited knowledge of Assembly isn't going to explain what this program is totally doing, though it's unusual and like FWRESET.COM this program - DRLKEYS.COM is also used for DR Logo 2 - it's the first file executed in the DR Logo SUBmit file (FWRESET.COM is used on exit from DR LOGO 2). When I run it - it resets to the colours as the machine is powered up in BASIC and changes the Screen Mode to 1. This is interesting cause the Disassembly shows nothing about Reseting the colours nor changing the Screen Mode. Where this routine Exists has got me stumped as well. So there's perhaps a good chance I haven't interpreted this program properly!  :(

.0100
LD C,&0C
CALL &0005
LD A,L
CP 22
JP Z,0118
LD DE,0179
LD C,&09
CALL &0005
LD C,00
CALL &0005
.0118
CALL &BE9B
DEFW &BBFF ;; SCR INITIALISE
CALL &BE9B
DEFW &BB00 ;; KM INITIALISE
CALL &BE9B
DEFW &BB4E ;; TXT INITIALISE
CALL &BE9B
DEFW &BBBA ;; GRA INITIALISE
LD HL,0158
.012F
LD A,(HL)
CP &FF
RET Z
INC HL
LD B,(HL)
PUSH HL
PUSH AF
CALL &BE9B
DEFW &BB27 ;; KM SET TRANSLATE - A=KEY NUMBER, B=NEW TOKEN OR CHARACTER
POP AF
POP HL
INC HL
LD B,(HL)
PUSH HL
PUSH AF
CALL &BE9B
DEFW &BB2D ;; KM SET SHIFT - A=KEY NUMBER, B=NEW TOKEN OR CHARACTER
POP AF
POP HL
INC HL
LD B,(HL)
PUSH HL
PUSH AF
CALL &BE9B
DEFW &BB33 ;; KM SET CONTROL - A=KEY NUMBER, B=NEW TOKEN OR CHARACTER
POP AF
POP HL
INC HL
JP 012F
.0158
LD BC,&0606
DEC B
EX AF,AF'
LD (BC),A
LD (BC),A
LD BC,&0410
INC B
INC B
LD B,D
RLCA
RLCA
RLCA
LD C,A
EX AF,AF'
EX AF,AF'
EX AF,AF'
ADD HL,BC
INC BC
INC BC
INC BC
DEFB 0
DJNZ 0183 ; Exit Point?
DEC D
LD (BC),A
LD C,&0E
LD D,&FF
.0179
DEFB 45,52,52,5F,52,3A,20,52
DEFB 65,71,75,69,72,65,73,20
DEFB 43,50,2F,4D,20,32,2E,32
DEFB 0A,0D,24 ; "ERROR: Requires CP/M 2.2  $"
* 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

arnoldemu

Dissassembly of AMSDOS.COM from CPC664 system discs, here you will find it is  different to the CPC6128 version and also it appears to almost be useless. It might aswell be one byte long with rst 0 in it ;)

http://www.cpctech.org.uk/docs/amsdos_com_cpc664.asm

Dissassembly of DUMP.ASM (already present on CPC664 discs). This is the original Digital Research code it seems.
http://www.cpctech.org.uk/docs/dump_com_cpc664.asm

The following are in progress:

SET24X80 utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
http://www.cpctech.org.uk/docs/set24x80_com_cpc6128.asm

PALETTE utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
  http://www.cpctech.org.uk/docs/palette_com_cpc6128.asm
 
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

Quote from: CP/M User on 02:38, 16 October 10
My limited knowledge of Assembly isn't going to explain what this program is totally doing, though it's unusual and like FWRESET.COM this program - DRLKEYS.COM is also used for DR Logo 2 - it's the first file executed in the DR Logo SUBmit file (FWRESET.COM is used on exit from DR LOGO 2). When I run it - it resets to the colours as the machine is powered up in BASIC and changes the Screen Mode to 1. This is interesting cause the Disassembly shows nothing about Reseting the colours nor changing the Screen Mode. Where this routine Exists has got me stumped as well. So there's perhaps a good chance I haven't interpreted this program properly!  :(
Thanks for the dissassembly, it's not one I've got around to yet.

Btw, SCR RESET and similar from the firmware do the work.
Their description in soft968 or the firmware guide describe that they reset colours and mode to the same as you see when you turn on the computer.

The keyboard expansion bits are the ones that define strings etc to display when you press one of the f keys for example.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

Quote from: TFM/FS on 22:00, 15 October 10
About CP/M 2.2, this can help you:

http://www.cpm.z80.de/download/cpm2-asm.zip
Excellent. Yes this is loaded by WBOOT after the configuration sector has been loaded.
This is the final piece of the cpm 2.2 booting jigsaw.

I'll compare this against the cpc's version, maybe Amstrad patched it, or maybe they didn't.

So for cpm essentially the boot sequence is:

1. |CPM
1. AMSDOS initialises some CPM jumptables
2. AMSDOS loads track 0, sector &41 into ram at &100 and executes it.
3. CPM2.2 boot sector then loads configuration sector which initialise some disc parameters and keyboard expansion tokens. Then does a WBOOT.
4. Furthur sectors are loaded (which contain this code).
5. CPM 2.2 starts.

I do not plan to dissassemble ALL the com files that come with the CPC system discs. Only those which were made specifically for the CPC itself (palette.com, set24x80.com, filecopy etc).
As you say the others are already there archived.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

arnoldemu wrote:

Dissassembly of AMSDOS.COM from CPC664 system discs, here you will find it is  different to the CPC6128 version and also it appears to almost be useless. It might aswell be one byte long with rst 0 in it ;)

http://www.cpctech.org.uk/docs/amsdos_com_cpc664.asm

That's hilarious!  :laugh:  I cannot help but feel it was done deliberately for amusement!  ;D

Dissassembly of DUMP.ASM (already present on CPC664 discs). This is the original Digital Research code it seems.
http://www.cpctech.org.uk/docs/dump_com_cpc664.asm

Yep - totally generic DR code.

The following are in progress:

SET24X80 utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
http://www.cpctech.org.uk/docs/set24x80_com_cpc6128.asm

PALETTE utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
 
http://www.cpctech.org.uk/docs/palette_com_cpc6128.asm

Oh okay, so there's no site for them yet? All I'm getting is a 404 error.
* 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

arnoldemu

Quote from: CP/M User on 00:42, 18 October 10
arnoldemu wrote:

Dissassembly of AMSDOS.COM from CPC664 system discs, here you will find it is  different to the CPC6128 version and also it appears to almost be useless. It might aswell be one byte long with rst 0 in it ;)

http://www.cpctech.org.uk/docs/amsdos_com_cpc664.asm

That's hilarious!  :laugh:  I cannot help but feel it was done deliberately for amusement!  ;D
indeed.

Quote from: CP/M User link=topic=1414.msg14610#msg14610   date=1287358952

Dissassembly of DUMP.ASM (already present on CPC664 discs). This is the original Digital Research code it seems.
http://www.cpctech.org.uk/docs/dump_com_cpc664.asm

Yep - totally generic DR code.
I included it only because it was on the cpc cpm discs.

Quote from: CP/M User link=topic=1414.msg14610#msg14610   date=1287358952
The following are in progress:

SET24X80 utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
http://www.cpctech.org.uk/docs/set24x80_com_cpc6128.asm

PALETTE utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
 
http://www.cpctech.org.uk/docs/palette_com_cpc6128.asm

Oh okay, so there's no site for them yet? All I'm getting is a 404 error.
I must have failed to upload. I'll do that tonight or tomorrow.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

redbox

Quote from: arnoldemu on 21:17, 15 October 10
Yes I am a C++ programmer.
I personally use Code:Blocks.

Thanks for the pointer, will take a look at the IDE.

AMSDOS

arnoldemu wrote:

I included it only because it was on the cpc cpm discs.

Sorry, I got the impression you were doing the CPC related CP/M Stuff! But DUMP.ASM is fine!  ;D

I must have failed to upload. I'll do that tonight or tomorrow.

I thought perhaps it was under a different name, easy enough mistake done.

I found a complete HTMLised version of the CP/M v2.2 Manual on the Internet, totally generic though there is one little section up the back which talks about the Inital page memory from 0 to &FF. Kind of explains a few things about CP/M 2.2, nothing there that would help me.

I presume you know a little bit about the memory from &BE80 to &BEBE which includes the Enter Firmware routine @ &BE9B. No idea what the other Jumps in there are about, though my feeling is their CPC related somehow. I'm confused what it all means though since the jumps point to what appears to be Screen addresses, I'm guessing it's like that due to the ROM State?
* 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

arnoldemu

Quote from: CP/M User on 10:12, 18 October 10
arnoldemu wrote:

I included it only because it was on the cpc cpm discs.

Sorry, I got the impression you were doing the CPC related CP/M Stuff! But DUMP.ASM is fine!  ;D
I am, but this source was on the disc as well as the .com file. I am not sure they wanted to include it

Quote from: CP/M User link=topic=1414.msg14643#msg14643   date=1287393149
I must have failed to upload. I'll do that tonight or tomorrow.

I thought perhaps it was under a different name, easy enough mistake done.

I found a complete HTMLised version of the CP/M v2.2 Manual on the Internet, totally generic though there is one little section up the back which talks about the Inital page memory from 0 to &FF. Kind of explains a few things about CP/M 2.2, nothing there that would help me.

I presume you know a little bit about the memory from &BE80 to &BEBE which includes the Enter Firmware routine @ &BE9B. No idea what the other Jumps in there are about, though my feeling is their CPC related somehow. I'm confused what it all means though since the jumps point to what appears to be Screen addresses, I'm guessing it's like that due to the ROM State?
BIOS_SET_MESSAGE         equ &BE80
BIOS_SETUP_DISC         equ &be83
BIOS_SELECT_FORMAT         equ &be86
BIOS_READ_SECTOR         equ &be89
BIOS_WRITE_SECTOR         equ &be8c
BIOS_FORMAT_TRACK         equ &be8f
BIOS_MOVE_TRACK         equ &be92
BIOS_GET_DRIVE_STATUS     equ &be95
BIOS_SET_RETRY_COUNT     equ &be98
ENTER_FIRMWARE             equ &be9b
SET_REG_SAVE             equ &be9e
SET_SIO                 equ &bea1
SET_CMND_BUFFER         equ &bea4
D0_IN_STATUS             equ &bea7
D0_IN                     equ &beaa
D0_OUT_STATUS            equ &bead
D0_OUT                    equ &beb0
D1_IN_STATUS             equ &beb3
D1_IN                     equ &beb6
D1_OUT_STATUS            equ &beb9
D1_OUT                    equ &bebc

They are all the AMSDOS BIOS functions which are documented in soft 968 (section AMSDOS BIOS).
Well these are not in the screen yet.

But if you see any jumps that go into the screen, they are likely to be calling into the AMSDOS ROM itself ;)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

Interesting, almost sums it up, unfortunately I couldn't find all those D0..D1, SET...., etc procedures/functions in the 968 book. It's got the BIOS covered and that's is. Not that it may help me, one gets curious when poking around with Memory!  ;)  SET_REG_SAVE sounds interesting.  :)
* 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

arnoldemu

Quote from: CP/M User on 12:09, 18 October 10
Interesting, almost sums it up, unfortunately I couldn't find all those D0..D1, SET...., etc procedures/functions in the 968 book. It's got the BIOS covered and that's is. Not that it may help me, one gets curious when poking around with Memory!  ;)  SET_REG_SAVE sounds interesting.  :)
well the AMSDOS rom has got code in it to access the serial interface. And that is what those functions are for.

set reg save is associated with enter firmware and tells it whether to store/restore registers or not when calling firmware.
The set reg save and enter firmware is documented in soft158a (ddi-1 firmware specification). The others may be there too. Can't remember.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

arnoldemu wrote:

well the AMSDOS rom has got code in it to access the serial interface. And that is what those functions are for.

set reg save is associated with enter firmware and tells it whether to store/restore registers or not when calling firmware.
The set reg save and enter firmware is documented in soft158a (ddi-1 firmware specification). The others may be there too. Can't remember.


Thanks for that, I'll have a look at that when I've got some time to download it!  :)
* 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

arnoldemu

both palette.com and set24xcom dissassemblies should now be accessible.

I have also uploaded the dissassembly for drlkeys.com.

http://www.cpctech.org.uk/docs/drlkeys_com_cpc6128.asm

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

arnoldemu wrote:

The following are in progress:

SET24X80 utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
http://www.cpctech.org.uk/docs/set24x80_com_cpc6128.asm

PALETTE utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
 
http://www.cpctech.org.uk/docs/palette_com_cpc6128.asm

Finally got around to checking these programs out. They are well & truly beyond my compehension, but then CP/M Plus is on a whole other level to CP/M 2.2!  ;)
* 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

arnoldemu

Quote from: CP/M User on 01:48, 29 October 10
arnoldemu wrote:

The following are in progress:

SET24X80 utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
http://www.cpctech.org.uk/docs/set24x80_com_cpc6128.asm

PALETTE utility (CPM+), this version specific to Amstrad CPC (not same as PCW version I think):
 
http://www.cpctech.org.uk/docs/palette_com_cpc6128.asm

Finally got around to checking these programs out. They are well & truly beyond my compehension, but then CP/M Plus is on a whole other level to CP/M 2.2!  ;)
I don't understand them all! They do some kind of parameter parsing and checking before doing some simple stuff.
So at the moment I haven't finished commenting them.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Powered by SMFPacks Menu Editor Mod