Getting started with MSX coding (assembler)

Página 4/4
1 | 2 | 3 |

Por PingPong

Prophet (4088)

imagem de PingPong

30-09-2008, 09:04

No, i tested on the unfamous Sony HB-10P with the vdp clone. (write of 6144 bytes continuosly) This model is knew to be the slowest in VRAM Access.. With 26T-States there is no corruption even with ALL SPRITES ON (the worst case)
(i have 32 sprites of 16x16 pixels on screen arranged on a 4x8 matrix)
So the effective time is about 7.2 us

Mmm. I'm not sure that disabling/enabling the sprites would make a difference in VRAM access speed when considering MSX1 machines. Has anyone tested this? I know that it is true for V99x8 enabled computers, but I doubt that it would make a difference in a TMS99xx or compatible VDP.

I also never know about speed with or without sprites enabled. Simply i have tested in the worst case.....

Por Gregory

Master (199)

imagem de Gregory

03-04-2022, 13:07

hbarcellos wrote:

1) Download PASMO to assemble on a PC
2) Download Notepad++ to create files
3) Use this "template"

--- CUT HERE ---
INITTXT EQU #006c
INIT32 EQU #006f
INITGRP EQU #0072
INIMLT EQU #0075

CHPUT EQU #00A2

org #4000
db "AB"
dw start
db 00,00,00,00,00,00

start:

call INITTXT
LD HL,texto
loop:
LD A,(HL)
call CHPUT
inc HL
ld a,0
cp (HL)
JR NZ, loop
fim:
jp fim

texto:
DB 'Hello World of MSX! Im SDW and I just got my NMS 8245 ',00

END

--- CUT HERE ---

RAM is *probably* after $c000
Save that as mycode.asm
Go to DOS and use
pasmo mycode.asm myfirst.rom

use the .ROM on BlueMSX or OpenMSX...

That's it. Direct and easy!

Doesn't want to work for me.
If I insert the .rom file, blueMSX keeps jumping to basic.
This is the hex-dump of my rom-file. Does it look alright?

41 42 10 40 00 00 00 00 00 00 00 00 00 00 00 00 CD 6C 00 21 23 40 7E CD A2 00 23 3E 00 BE 20 F6 C3 20 40 48 65 6C 6C 6F 20 57 6F 72 6C 64 20 6F 66 20 4D 53 58 21 20 49 6D 20 53 44 57 20 61 6E 64 20 49 20 6A 75 73 74 20 67 6F 74 20 6D 79 20 4E 4D 53 20 38 32 34 35 20 00

Screenshot

Por Gregory

Master (199)

imagem de Gregory

03-04-2022, 18:05

Oh, the rom isn't 8kb... Wink

Por Manuel

Ascended (19229)

imagem de Manuel

03-04-2022, 22:23

$ openmsx test.rom
warning: (uncompressed) ROM image filesize was not a multiple of 8kB (which is required for mapper type Mirrored), so we padded it to be correct. But if the ROM you are running was just dumped, the dump is probably not complete/correct!

By the way, that was a pretty heavy necropost Tongue

Por Gregory

Master (199)

imagem de Gregory

04-04-2022, 02:45

Manuel wrote:
$ openmsx test.rom
warning: (uncompressed) ROM image filesize was not a multiple of 8kB (which is required for mapper type Mirrored), so we padded it to be correct. But if the ROM you are running was just dumped, the dump is probably not complete/correct!

By the way, that was a pretty heavy necropost Tongue

How can I pad the rom myself to be a multiple of 8kb.
I thought you could do it with another 'org' statement at the end of the source code, but I didn't get it to work (used org '&c000'.

Por thegeps

Paragon (1156)

imagem de thegeps

04-04-2022, 12:10

ds -$ & 3fffh

Por Gregory

Master (199)

imagem de Gregory

04-04-2022, 19:42

thegeps wrote:

ds -$ & 3fffh

Where in the code need I put this instruction?

Por Grauw

Ascended (10685)

imagem de Grauw

04-04-2022, 20:08

Gregory wrote:
thegeps wrote:
ds -$ & 3fffh

Where in the code need I put this instruction?

Where you need the padding, in this case, at the very end.

It inserts the padding needed until the next multiple of 4000H. In other words, it aligns to 4000H.

It works by taking the 2’s complement address of the current location (negating), and then ANDing it with a power of 2 minus 1. It needs to be a power of 2 so that you get a binary number of all zeroes followed by all ones. This masks out all the bits and this is what calculates the alignment to a specific multiple.

For example, say we’re at address 42H, its 2’s complement is 0xFFFFFFBE. We want to align to 4000H (2^14), minus 1 is 3FFFH, or in binary 0011111111111111B. The result in this example is 3FBEH, which is the number of bytes you need to add to 42H to reach address 4000H.

The result is the same for e.g. 4042H, -4042H is 0xFFFFBFBE, AND 3FFFH is 3FBEH, and adding 3FBEH to 42H is 8000H. This is where you can see why the AND is needed.

If you want to just pad to a specific size, let’s say 128K, you can more simply write:

ds 20000H - $

If your code becomes greater than 128K, this particular calculation will give a negative number and cause an error, saying that you can’t DS a negative amount (define negative space). You will need to increase the padding.

Por Gregory

Master (199)

imagem de Gregory

04-04-2022, 20:16

Grauw wrote:
Gregory wrote:
thegeps wrote:
ds -$ & 3fffh

Where in the code need I put this instruction?

Where you need the padding, in this case, at the very end.

It inserts the padding needed until the next multiple of 4000H. In other words, it aligns to 4000H.

It works by taking the 2’s complement address of the current location (negating), and then ANDing it with a power of 2 minus 1. It needs to be a power of 2 so that you get a binary number of all zeroes followed by all ones. This masks out all the bits and this is what calculates the alignment to a specific multiple.

For example, say we’re at address 42H, its 2’s complement is 0xFFFFFFBE. We want to align to 4000H (2^14), minus 1 is 3FFFH, or in binary 0011111111111111B. The result in this example is 3FBEH, which is the number of bytes you need to add to 42H to reach address 4000H.

The result is the same for e.g. 4042H, -4042H is 0xFFFFBFBE, AND 3FFFH is 3FBEH, and adding 3FBEH to 42H is 8000H. This is where you can see why the AND is needed.

If you want to just pad to a specific size, let’s say 128K, you can more simply write:

ds 20000H - $

If your code becomes greater than 128K, this particular calculation will give a negative number and cause an error, saying that you can’t DS a negative amount (define negative space). You will need to increase the padding.

Thanks for the in depth explanation, got it working (on blueMSX). With pasmo it was 'ds -$ & #3fff'.
Big smile

Página 4/4
1 | 2 | 3 |