16bit Poke in [whatever Language you prefer]! :)

Started by AMSDOS, 12:31, 28 July 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Probably the only one here who found this useful:

Procedure memw(address, data : integer);

The assembly looks like this:

poke16: LD DE,(data)
LD HL,(addr)

The BASIC interactive version could look like this (use a Memory Editor to Poke the bytes in):

LD E,(IX+00) --> DD,5E,00
LD D,(IX+01) --> DD,56,01
LD L,(IX+02) --> DD,6E,02
LD H,(IX+03) --> DD,66,03
LD (HL),E --> 73
INC HL --> 23
LD (HL),D --> 72
RET --> C9

I was using this a few years ago in Turbo Pascal & BASIC to poke 16bit values from an Array (in Turbo Pascal), and in BASIC using the memory to store a series of values (16bit in origin). The resulting program which was simply a Circle routine which originally came from the Amstrad CPC464 Manual. In BASIC the program was okay because of it's Lookup table to make everything display faster. In Turbo Pascal 3 the same program (in it's Pascal equivalent) was noticibly slower due to it been entirely calculated and nothing was going to change that unless it all the values were stored into an array. Remarkibly the resulting program was much faster.

In BASIC storing the result in memory and having a M/C routine in my BASIC program to take that information and drawing it would also prove to run faster than allowing BASIC to utilise it's lookup table. If I ever find that example again I'll send it in.

Unsure if a 16bit Poke proves to be faster than simply apply too BASIC pokes, perhaps because I'm taking a routine which takes straight to the machine.

* 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

Powered by SMFPacks Menu Editor Mod