Vampier's quest for assembly [hopefully a n00b guide to assembly]

Pagina 2/21
1 | | 3 | 4 | 5 | 6 | 7

Van ARTRAG

Enlighted (6935)

afbeelding van ARTRAG

18-02-2010, 18:12

Sure!

try this on any msx2 (it works also on 90% of msx1)

go to screen 2 (or screen 4)

set Reg# 4 to 0x00 to use one pattern definition
set REG# 3 to 0x9F to use one color definition

this (untested) should work

10 color 15,1,4:screen 2: rem screen 4 is ok too
20 line (0,0)-(255,192),15
25 for i=0 to 100: next: color  ,,3
30 vdp(4)=0:vdp(3)=&h9f
40 goto 40

the line will repeat 3 times as the first bank becomes active 3 times

Now you can use the VRAM of the other 2 banks for anything you like and acton only the first bank to have animated tiles in the whole screen

Actually there is even more:
You can even have two banks: one for the top 2/3rds of the screen and one for the lowest 3rd

You can also duplicate shapes and not colors and vice versa etc etc

Van nikodr

Paladin (750)

afbeelding van nikodr

18-02-2010, 21:18

Can somebody post a tutorial for newbies like me how to use custom interupt handlers?
I dont want to jmp to 38 and do all this not needed bios stuff.I want to have my own stuff going on,and to use custom routines to open screens initialize vdp etc.
I guess it is not easy?
What about IM 2 ?I dont care about the 256 bytes lost for the table of addresses.I just want the maximum speed msx can give.
But few people use those.

In that example bios is still used i dont want bios at all.
Nitpick:

;color 15,1,1
LD HL,15+256*4
LD (&HF3E9),HL
XOR A
LD (&HF3EB),A
CALL &H62

Basically i can understand the principle of defining a new handler at fd9f and fd9a address,but there is always the hated jump to 38,lots of push and pops there happening with no reason,plus some routines to scan for uneeded devices i dont want.So some instructions how to kill the bios,and any stuff like disk rom access etc.I want the lowest level of access possible Smile

So a nice tutorial showing how to switch ram to 38 ?

Van ARTRAG

Enlighted (6935)

afbeelding van ARTRAG

18-02-2010, 22:05

Van MOA

Champion (293)

afbeelding van MOA

18-02-2010, 23:25

Can somebody post a tutorial for newbies like me how to use custom interupt handlers?
I dont want to jmp to 38 and do all this not needed bios stuff.I want to have my own stuff going on,and to use custom routines to open screens initialize vdp etc.
I guess it is not easy?
What about IM 2 ?I dont care about the 256 bytes lost for the table of addresses.I just want the maximum speed msx can give.
But few people use those.

In that example bios is still used i dont want bios at all.
Nitpick:

;color 15,1,1
LD HL,15+256*4
LD (&HF3E9),HL
XOR A
LD (&HF3EB),A
CALL &H62

Basically i can understand the principle of defining a new handler at fd9f and fd9a address,but there is always the hated jump to 38,lots of push and pops there happening with no reason,plus some routines to scan for uneeded devices i dont want.So some instructions how to kill the bios,and any stuff like disk rom access etc.I want the lowest level of access possible Smile

So a nice tutorial showing how to switch ram to 38 ?

For small programs I always used IM 2 and the I register. This way you can place the interrupt handler at 'any' desired location (LSB and MSB of address must be the same on MSX).

From the top of my head (it has been a while):

; --- the BLOAD,R header
header
   db #fe
   dw startup, bss_section, startup

; --- the code
  org #c000
startup:
  di
  ld A,vector_table >> 8
  ld I,A                     ; vector table MSB, LSB is on the bus (undefined on msx)
  ld HL,vector_table         ; fill vector table with ISR address. LSB and MSB must be the same
  ld DE,vector_table + 1
  ld BC,255
  ld (HL),isr >> 8
  ldir
  im 2
  ei
  jp main

  org #c0c0
isr:
  ; custom isr
  ret

main:
  ; etc.
  im 1
  ret

; --- the data
data_section:
  ; initialized data

bss_section:
   ; uninitialized data
vector_table:
  defs 256

Van norakomi

Paragon (1140)

afbeelding van norakomi

18-02-2010, 23:51

thanx ARTRAG
im definitely going to use that trick in the code i am working with atm.

Van Leo

Paragon (1236)

afbeelding van Leo

19-02-2010, 08:33

good luck for your training !
i learnt slowly by myself asm for Z80 , but it helped me a lot for any other cpu's asm like intel 386.
i have a Z80 emulator from ohnosoft that is very friendly use and has a basic interpreter, so it is like
this you type basic in one column and you get asm on the other . It will not help you for programming
msx hardware in asm but it helps in writing mathematical functions or algorithms .

I tend to use devpack from hisoft "gen80" and a few times microsoft one's m80/l80
or as80 as well on pc's.
Maybe if you want to write a game with asm inside ( for speed ) you may write most of it in more elaborated language ( turbo pascal / C) and include some speed critical function in asm.
you dont bother in mastering ALL the msx hardware , like for loading files into mem or keyboard
controls, screen inits , graphics inits ...

Big smile

Van ARTRAG

Enlighted (6935)

afbeelding van ARTRAG

19-02-2010, 23:28

Z80 emulator from ohnosoft ?
Where can i find it?

Van Huey

Prophet (2694)

afbeelding van Huey

21-02-2010, 21:51

here it is
http://karoshi.auic.es/index.php?topic=212.0

So erh, if I understand correctly I can:

- set my own ROM at page 0 (48kbROM setup) (using BIOS calls)
- and include in my ROM at 38h my own interrupt stuff?

        PUSH    HL      SAVE ALL THE REGISTERS USED
        PUSH    DE
        PUSH    BC
        PUSH    AF

        <my code I want to run on int>

        POP     AF      RESTORE THE REGISTERS
        POP     BC
        POP     DE
        POP     HL
        RET             EXIT BIOS CALL

Is that right? Or not? Or could I use the EXX command?

Van Huey

Prophet (2694)

afbeelding van Huey

21-02-2010, 22:26

^^
||

Of course I need to save more registers Wink

Van NYYRIKKI

Enlighted (6067)

afbeelding van NYYRIKKI

22-02-2010, 00:39

- set my own ROM at page 0 (48kbROM setup) (using BIOS calls)
ROM or RAM, but don't use BIOS calls. (BIOS calls are on page 0, so changeing page 0... not a good idea while you execute code there...)

Is that right? Or not? Or could I use the EXX command?
Of course I need to save more registers Wink

It depends... If you use only HL, BC, DE and AF in <my code I want to run on int> then this is fine... Even EX AF,AF' & EXX might do the trick for you, if you are absolutely sure that these shadow registers can be changed any time in you main code without it being crashed.

Interrupts are not magic. Interrut is simply RST #38 (=CALL #38) that can happen any time in your code inside EI / DI block... Same rules apply as with any subroutine, but you want to make sure that registers you are working with don't suddenly have values returned from interrupt handler call.

Pagina 2/21
1 | | 3 | 4 | 5 | 6 | 7