Loading file to VRAM in ASM

صفحة 4/4
1 | 2 | 3 |

بواسطة aoineko

Paladin (874)

صورة aoineko

23-04-2011, 00:38

I think DiskROM initialization failed, but I'm not sure how to interpret the result :

	; Check if disk found
	ld		a, (HPHYD) ;// a=F7
	cp		#0xC9
	jr		z, return
	; comprueba version de DOS y guarda
	ld		c, DOSVER ;// c=6F
	call		BDOS
	ld		a, b ;// a=0, b=0
	inc		a ;// a=1

بواسطة flyguille

Prophet (3031)

صورة flyguille

23-04-2011, 01:01

F7 = rst $30

so there is something hooked.... done!

بواسطة aoineko

Paladin (874)

صورة aoineko

26-04-2011, 22:59

I successfully opened a file using DOS function 44h (Create file handle).
I got Error=0, Handle=0.
But when I try read the file (DOS function 48h) I got the following result:

Input:
    C = 48H (_READ) 
    B = 0 (File handle)
    DE = C0BEh (Buffer address)
    HL = 100h (Number of bytes to read  )
Output:
    A = 0 (Error)
    HL = 100h (Number of bytes actually read)

According to returned values, all is right but the problem is nothing is copied at the C0BEh address.
Any idea?

بواسطة aoineko

Paladin (874)

صورة aoineko

28-04-2011, 01:23

The MSX Technical handbook - Part III say:

System calls can also be used from DISK-BASIC by using
the entry address of F37DH. For this case, store the machine codes in the
area allocated by the CLEAR statement and call its start address using the
USR function.

Someone can explain this section?
What are the CLEAR statement and the USR function?

بواسطة flyguille

Prophet (3031)

صورة flyguille

28-04-2011, 03:07

the CLEAR statement in the BASIC, define not only the space reserved in bytes for BASIC variables

also has a second parameter, that defines the higher address that the BASIC interpreter can use.

so, if you define

clear 200, &HBFFF

basic interpreter can to use from &H8000 up to &HBFFF

that way it frees for other purposes the addresses &HC000 and UP!. Purposes like, you placing your assempler code.

so that phrase, is saying, if you want to call that function, you must place some assembler code where the CLEAR sentences allows it, and then to call it.

صفحة 4/4
1 | 2 | 3 |