- Top Stats

Top Posters Top Topic Starters Top Topics
AMSDOS 1288
arnoldemu 1128
TFM 1124
ervin 745
ronaldo 403
AMSDOS 55
arnoldemu 51
ervin 42
EgoTrip 35
Arnaud 33
FutureOS corner - 70641 Views TFM/FS 07:12, 01 October 10
Example Z80 as... - 65991 Views arnoldemu 10:59, 04 April 10
#CPCtelera 1.4... - 32961 Views ronaldo 13:59, 11 May 15
BASIC programm... - 30854 Views arnoldemu 16:23, 22 May 09
CHAMP Assemble... - 24956 Views Bruce Abbo... 12:59, 16 January 14


Author Topic: Example Z80 assembly programs (was:ASM source code)  (Read 65992 times)

0 Members and 1 Guest are viewing this topic.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.586
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 851
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #150 on: 00:23, 25 March 18 »
Hi @Urusergi

Unfortunately I'm unable to remember what that BASIC program was, had a feeling it might of been a program which had BASIC code as well as a binary file, but I don't know that for sure. Back in 2015 I was typing in a few large programs from various magazines like Your Computer. I checked out programs which I might have considered for it, but they weren't 12kb. The only thing I could think of which came close is the early AMSOFT game Quack-A-Jack, which has a 12kb binary file & 14kb BASIC file.

It maybe better though to use one of my BASIC programs, rather than invite trouble. At the moment I've been working on this program, and made some progress with it yesterday after adding enemy tank (with the help I had from an AA Type-in), I also improved the shooting sequence, so the tanks can move after shots have been fired. I probably might just add some colourful sprites to the program before handing it to you if you wanted to test that.
* Using some of the hardly used Amstrad compilers :D
* I use Firmware in my Assembly code :P
* Have interpreted some BASIC 1.1 programs for BASIC 1.0. :)

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #151 on: 01:41, 25 March 18 »
4) I though this method could be used to load a BASIC program using Headerless loader and then execute this using this method, but only really makes sense to apply it for a larger program. Any thoughts
Do you know "2cdt" x86 program?. I think that is what you need. You can create 2 unique blocks whatever the size of the basic game. The first block can be as small as 1 byte, and the second with the rest of bytes (and you can adjust the speed too). Obviously the biggest problem is when you get a "read error b" and you have to start charging again from the beginning  :doh:

I probably might just add some colourful sprites to the program before handing it to you if you wanted to test that.
Ok, pass it to me when you finish ;)

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.586
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 851
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #152 on: 13:12, 25 March 18 »
Do you know "2cdt" x86 program?. I think that is what you need. You can create 2 unique blocks whatever the size of the basic game. The first block can be as small as 1 byte, and the second with the rest of bytes (and you can adjust the speed too). Obviously the biggest problem is when you get a "read error b" and you have to start charging again from the beginning  :doh: 


It's not a problem producing a Headerless file with 2cdt, but I thought the problem is loading a headerless file over another BASIC program which is trying to load it, hence write Assembly program to load file from another location, then use Assembly routine to run the BASIC program.


Quote
Ok, pass it to me when you finish ;)


Are you sure? Winking emoji usually means do the opposite.
* Using some of the hardly used Amstrad compilers :D
* I use Firmware in my Assembly code :P
* Have interpreted some BASIC 1.1 programs for BASIC 1.0. :)

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #153 on: 18:39, 25 March 18 »
It's not a problem producing a Headerless file with 2cdt, but I thought the problem is loading a headerless file over another BASIC program which is trying to load it, hence write Assembly program to load file from another location, then use Assembly routine to run the BASIC program.
No, I mean create 2 turbo blocks with header that are still firmware compatible. It's almost as fast as a headerless file and can be executed with run ""

Are you sure? Winking emoji usually means do the opposite.
??? At least in my country I think it means that I am willing to help or I agree to help you. Let's see if other Spaniards corroborate me or I'm wrong.
In this forum I've always helped in everything I could, maybe that's the reason I 've more likes than posts.
« Last Edit: 18:56, 25 March 18 by Urusergi »

Offline adolfo.pa

  • Supporter
  • CPC664
  • *
  • Posts: 76
  • Country: es
    • index.php?action=treasury
  • Liked: 54
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #154 on: 22:21, 25 March 18 »
??? At least in my country I think it means that I am willing to help or I agree to help you. Let's see if other Spaniards corroborate me or I'm wrong.

Sorry @Urusergi , I think you're wrong about the emoji  :) Northern spaniard here, and I've always used it as a "just joking" indicator.

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #155 on: 23:19, 25 March 18 »
Sorry @Urusergi , I think you're wrong about the emoji  :) Northern spaniard here, and I've always used it as a "just joking" indicator.

Then I'm going to have to erase a few thousand of smiles that I put in ~15 years that I've been writing in forums and, interestingly, nobody told me anything about my mistake (in fact, they always reacted positively).

For example, someone sends me this message recently:
"Is it possible to have a version without the crosshair fix, we will have the option of on or off then.  ;) "

What should I understand? Is it a joke? and he doesn't really want me to do that version?

Offline adolfo.pa

  • Supporter
  • CPC664
  • *
  • Posts: 76
  • Country: es
    • index.php?action=treasury
  • Liked: 54
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #156 on: 00:24, 26 March 18 »
Then I'm going to have to erase a few thousand of smiles that I put in ~15 years that I've been writing in forums and, interestingly, nobody told me anything about my mistake (in fact, they always reacted positively).

For example, someone sends me this message recently:
"Is it possible to have a version without the crosshair fix, we will have the option of on or off then.  ;) "

What should I understand? Is it a joke? and he doesn't really want me to do that version?

It is definitely a friendly emoji, so it is natural for people to react to it in a positive way. Also, most of the time the meaning will be obvious given the context; in your response it is pretty clear you used it with the meaning of a regular smiley (friendlyness).

I use it to make sure people know I'm joking. For example, the other day I posted this as a response to Duke:
Quote
Please stop making so many cool stuff! You make the rest of us look like lazy couch potatos (which we aren't, of course  ;) )

If you remove the wink smiley the meaning changes quite a lot  :)

Not exactly an authoritative source of information, but here is the entry in the Emojipedia.

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #157 on: 01:03, 26 March 18 »
@adolfo.pa I think you're not understanding the approach.

AMSDOS thinks I'm not going to help him with the problem if I tell him in this way:
"Ok, pass it to me when you finish  ;) "

Recently someone (foreign) asked me for help in this way:
"Is it possible to have a version without the crosshair fix, we will have the option of on or off then.  ;) "

Of course I made that version he asked me and I didn't think he was kidding

That's why I think that depending on the country we may understand the emoticons in different ways.

What do you think in this case?

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #158 on: 01:24, 26 March 18 »
@AMSDOS as you haven't finished your game yet, I've created two examples with a spanish game (Star Sordium):

- Original is 10 Blocks at 2000 baud and loads in 2 minutes and 11 seconds.

- 2 Blocks at 2000 baud loads in 1 minute and 23 seconds.

- 2 Blocks at 2500 baud loads in 1 minute and 6 seconds.


look at the attachments (here I used to put a wink emoticon, but better not)

Offline adolfo.pa

  • Supporter
  • CPC664
  • *
  • Posts: 76
  • Country: es
    • index.php?action=treasury
  • Liked: 54
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #159 on: 01:33, 26 March 18 »
What do you think in this case?

Well, I think you're giving too much importance to this  ;)

I don't think there's any country specific thing going on here, and AFAIK, the meaning of the winky smiley is the same on all western/european countries. In my job I chat regularly with people from western europe, USA, and Brazil, and all of them seem to use it in that sense. Proof of that is that I haven't been fired yet :D

Cheers!

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #160 on: 01:47, 26 March 18 »
Well, I think you're giving too much importance to this  ;)
I don't give importance, it's just curiosity but I see that you don't want to answer (Lo entiendo  ;) )

Let's leave it that way....

Offline adolfo.pa

  • Supporter
  • CPC664
  • *
  • Posts: 76
  • Country: es
    • index.php?action=treasury
  • Liked: 54
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #161 on: 01:55, 26 March 18 »
I don't give importance, it's just curiosity but I see that you don't want to answer (Lo entiendo  ;) )

Now I'm confused, because I though I had answered you  ???

Anyway, this is waaay off-topic, so yep, let's forget about it.

Cheers!

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.586
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 851
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #162 on: 11:45, 26 March 18 »
No, I mean create 2 turbo blocks with header that are still firmware compatible. It's almost as fast as a headerless file and can be executed with run ""


I'm familiar with that approach as I used to do that with all my AMSOFT games with JL-Copy, but that's not taking my BASIC program and using and Assembly routine to execute that BASIC from Assembly. I think the size of my BASIC code and number of variables it uses throws me in the deep end when it comes to that routine, I think it just needs a short program with a couple of variables just to show it's function properly, but as it is I'm having trouble following it.


* Using some of the hardly used Amstrad compilers :D
* I use Firmware in my Assembly code :P
* Have interpreted some BASIC 1.1 programs for BASIC 1.0. :)

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #163 on: 17:22, 26 March 18 »
Ok, I see that you want to use exclusively the machine code routine for load, and then run the basic file.

Tonight I'll try with a little example.


Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.586
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 851
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #164 on: 11:01, 27 March 18 »
It doesn't have to load, but I would like to see it in an Assembler format with the BASIC embedded in as defb statements. I think something simple like this should be fine:

Code: [Select]
10 a%=1000
20 b%=256
30 PRINT a%+b%
40 PRINT"8)"
50 END


Thanks
* Using some of the hardly used Amstrad compilers :D
* I use Firmware in my Assembly code :P
* Have interpreted some BASIC 1.1 programs for BASIC 1.0. :)

Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #165 on: 18:24, 27 March 18 »
Sorry but I've already created a headerless file with my prime number generator in basic.

Machine code:

Code: [Select]
kl_rom_select equ &B90F

org &A000

ld hl,&0170  ; load basic start
ld de,&00E9 ; basic length
ld a,&16  ; sync file char
call &bca1

ld hl,(length)
ld c,0
call kl_rom_select
ld a,(&c002)
cp 0
jp z,cpc464
ld (&ae66),hl
ld (&ae68),hl
ld (&ae6a),hl
ld (&ae6c),hl
cp 1
jp z,cpc664
jp &ea78        ;; run BASIC CPC6128
.cpc664
jp &ea7d        ;; run BASIC CPC664
.cpc464
ld (&ae83),hl
ld (&ae85),hl
ld (&ae87),hl
ld (&ae89),hl
jp &e9bd        ;; run BASIC CPC464


length dw &025A ; Address of start of variables (&AE66-67 in cpc6128-664, &AE83-84 in cpc464)

If you don't understand something, don't hesitate to ask me, but I think it's pretty simple to follow.



Offline Urusergi

  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 241
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #166 on: 23:10, 27 March 18 »
@AMSDOS Here is your Basic example  8)

Code: [Select]
kl_rom_select equ &B90F

ORG &A000

LD HL,Data
LD DE,&0170  ; Basic start
LD BC,EndData-Data
LDIR

ld hl,(length)
ld c,0
call kl_rom_select
ld a,(&c002)
cp 0
jp z,cpc464
ld (&ae66),hl
ld (&ae68),hl
ld (&ae6a),hl
ld (&ae6c),hl
cp 1
jp z,cpc664
jp &ea78        ;; run BASIC CPC6128
.cpc664
jp &ea7d        ;; run BASIC CPC664
.cpc464
ld (&ae83),hl
ld (&ae85),hl
ld (&ae87),hl
ld (&ae89),hl
jp &e9bd        ;; run BASIC CPC464


;PRINT HEX$(PEEK(&AE67))
;PRINT HEX$(PEEK(&AE66))
length dw &01AC ; Address of start of variables (&AE66-67 in cpc6128-664, &AE83-84 in cpc464)

.Data
DB &0D,&00,&0A,&00,&02,&00,&00,&E1
DB &EF,&1A,&E8,&03,&00,&0D,&00,&14
DB &00,&02,&00,&00,&E2,&EF,&1A,&00
DB &01,&00,&10,&00,&1E,&00,&BF,&20
DB &02,&00,&00,&E1,&F4,&02,&00,&00
DB &E2,&00,&0A,&00,&28,&00,&BF,&22
DB &38,&29,&22,&00,&06,&00,&32,&00
DB &98,&00,&00,&00
.EndData

Offline ikonsgr

  • CPC6128
  • ****
  • Posts: 256
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 160
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #167 on: 11:39, 01 July 18 »
You might want to add this code to Source codes too.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.586
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 851
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #168 on: 10:38, 07 July 18 »
You might want to add this code to Source codes too.


I've added a page, please inspect it though. Registration to the CPCWiki is seperate from the forum, so feel free to register and amend where necessary.
* Using some of the hardly used Amstrad compilers :D
* I use Firmware in my Assembly code :P
* Have interpreted some BASIC 1.1 programs for BASIC 1.0. :)

Offline ikonsgr

  • CPC6128
  • ****
  • Posts: 256
  • Country: gr
    • ikonsgr 80's Home Micros WorkBench
  • Liked: 160
Re: Example Z80 assembly programs (was:ASM source code)
« Reply #169 on: 10:55, 07 July 18 »
Ok, thanks!