First steps in ASM, but I (probably) need some guidance

Page 2/7
1 | | 3 | 4 | 5 | 6 | 7

Par norakomi

Paladin (963)

Portrait de norakomi

26-09-2005, 11:22


And to make it a bit faster, you could replace 'CALL CHPUT' with 'OUT (152),A'...

Cool !! i didnt know that
do you also know with what I can replace call $5f (set screenmode)????

Par Tanni

Hero (556)

Portrait de Tanni

26-09-2005, 11:33


And to make it a bit faster, you could replace 'CALL CHPUT' with 'OUT (152),A'...

Cool !! i didnt know that
do you also know with what I can replace call $5f (set screenmode)????

... unless you didn't read form the VDP before calling CHPUT. As far as I know, read and write operations change the VDP pointer to the next screen location accessed. So if you want to write to one address, but read from another, you must reset this pointer via a BIOS routine call to the correct location.

Par [D-Tail]

Ascended (8232)

Portrait de [D-Tail]

26-09-2005, 11:54

norakomi: The Yamaha V9938 application manual describes the VDP register settings for the G4 mode, but you wouldn't want to set them up yourself, manually. Screen mode changing isn't something that you do very often, so it's easier to just use the BIOS routine for that. Unless of course, you're in DOS or anything and don't want to select the BIOS in slot 0 Wink

Par norakomi

Paladin (963)

Portrait de norakomi

26-09-2005, 12:23

ORG $C000

CHGET: EQU $9F
CHPUT: EQU $A2

CALL CHGET
CALL BITS
RET

BITS:
LD E,A
CALL CHPUT
LD A,58
CALL CHPUT
LD A,32
CALL CHPUT

LD BC,8*256+48

BITS2:
XOR A
RL E
ADC A,C
OUT ($98),A
DJNZ BITSL
RET

Heey sjoerd, you said that call chput can be replaced by OUT ($98),A
I typed the above program in Wbass 2,
and at the end you see that I did replace call chput with
out ($98),a
But, funilly enough this doesnt work for the 1st 3 call chputs...
Why is that???

Par Tanni

Hero (556)

Portrait de Tanni

26-09-2005, 13:17

In the DJNZ statement, you jump to BITSL which is not declared!

Par norakomi

Paladin (963)

Portrait de norakomi

26-09-2005, 13:34


BITS2:
XOR A
RL E
ADC A,C
OUT ($98),A
DJNZ BITS2
RET
yes, I see that s a type mistake, it should be BITS2,
but still I cannot replace the call chput with out ($98),a in the beginning of the programm

Par Mirg

Expert (88)

Portrait de Mirg

26-09-2005, 13:45

My guess (but I could be way off) is that VDP somehow is set to read instead of write. There are three CALL CHPUTs before the BITS2 loop. I'm at work, so I can't test if it works, but maybe you can replace the latter two CALL CHPUTs with OUT ($98),As? So:

CALL CHPUT
..
OUT ($98),A
..
OUT ($98),A

I *think* CALL CHPUT (CALL $A2) sets the VDP to write, so this should work. I'm not too sure about it, though. My ASM knowledge is still really really wonky, heh. Tongue

Par Mirg

Expert (88)

Portrait de Mirg

26-09-2005, 13:53

Edwin: Thanks for clearing up the JP / JR difference! I take it the address used for JR is a two's complement, then?

Tanni: So simply assigning the labels VDP98, VDP99, VDP9A and VDP9B and loading them with the correct port addresses should do the trick if I then use OUT(VDP98) instead of OUT($98), right?

Par ARTRAG

Enlighted (6189)

Portrait de ARTRAG

26-09-2005, 14:37

@norakomi
The only thing to do to change screen mode is to set the vdp registers
that rule the screen mode to the appropriate values.
This is true also for the table for patterns and sprites, whose position can
change from one screen mode to another.

There is no problem in changing screen mode in this way if you
program in asm and you do not relay on the basic screen editor.

Never the less there are very nice tricks you can get also playing havoc
in the vdp while you are in basic
For example you can switch in scr4 letting the basic think that you are in screen 1.
In this way you gain 8 sprites per line and multicolor characters
while still being able to use LOCATE and PRINT commands.
You can also have the prompt and list your basic programs in this fake scr1.
Look at and enjoy the following code :

10 dim a(20)
20 screen 4,2
30 a(0) = vdp(0)
40 a(1) = vdp(1)
50 a(4) = vdp(4)
60 a(3) = vdp(3)
70 a(5) = vdp(5)
80 a(6) = vdp(6)
90 a(12) = vdp(12)
92 for n=0 to 31
94 put sprite n,(n*32,128),15,0
96 next
100 screen 1,2
110 vdp(0) = a(0)
120 vdp(1) = a(1)
130 vdp(4) = a(4)
140 vdp(3) = a(3)
150 vdp(5) = a(5)
160 vdp(6) = a(6)
170 vdp(12) = a(12)
180 for n=8192 to 8192+768*8-1
190 vpoke n,rnd(1)*2+2
200 next
210 for n=0 to 256*8-1
220 vpoke n+256*8,vpeek(n)
230 vpoke n+512*8,vpeek(n)
240 next
250 sprite$(0)=string$(32,255)
290 for n=0 to 7
300 put sprite n,(n*32,128),15,0
310 next

Par norakomi

Paladin (963)

Portrait de norakomi

26-09-2005, 16:12

haha,
thats cool

you've fooled the computer there !!!!

Page 2/7
1 | | 3 | 4 | 5 | 6 | 7