Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Certified SuperHero sammyboy's Avatar
    Join Date
    Apr 2004
    Location
    England
    Posts
    184

    Simple Visual Basic Programming Question

    I have tried numeros times to create an emulator (chip-8, gameboy) on Visual Basic but a few problems always hit me.


    When emulating - where on earth do I start.

    Loading - How do I implement out the loading opcodes

    Loading - What else do I need to do when programming the loading part

    Testing - How do I test to make sure the loading workd even though I havn't started the running game part.

    Running - I dont have a clue about this.



    The best way someone could help me is to give me a tutorial but not one that is boring with loads of long words but one that has funny bits and jokes kind of like they are talking to someone and not a computer. Otherwise I loose interest in the tutorial and walk away from it none the wiser.
    "About as innocent as a nun doing pushups in a cucumber field"


    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    Master of the Emulation Flame MasterPhW's Avatar
    Join Date
    May 2004
    Location
    come-to-hell
    Posts
    1,978
    Quote Originally Posted by sammyboy
    I have tried numeros times to create an emulator (chip-8, gameboy) on Visual Basic but a few problems always hit me.


    When emulating - where on earth do I start.

    Loading - How do I implement out the loading opcodes

    Loading - What else do I need to do when programming the loading part

    Testing - How do I test to make sure the loading workd even though I havn't started the running game part.

    Running - I dont have a clue about this.

    The best way someone could help me is to give me a tutorial but not one that is boring with loads of long words but one that has funny bits and jokes kind of like they are talking to someone and not a computer. Otherwise I loose interest in the tutorial and walk away from it none the wiser.
    Don't think there's a tut like these out there, but if there's one, I would like to see a link to it or something like this... if nobody has a link than probably is google ypur friend, but I don't think you will find a funny one.
    The Future of Emulation: Emulate a High End Computer on a Low End System
    Main: Intel Core i7 (Lynnfiled) 860 (@3.802Ghz) | 8 GB DDR3-1333 | ATI XFX HD 5750 PCI-E | ATI High Definition Audio Device | 256 GB SSD + 3 TB Internal SATA2 + 4 TB external | Windows 7 Professional X64 SP1 MSDNAA
    Netbook: Asus EeePC 1015PEM | Intel Atom Dual Core N550 (1,5GHz) | 2GB DDR3-1066 | Intel GMA 3150 | 250GB HDD | Win 7 Starter
    Old One: AMD Athlon 64 X2 4200+ (2x2.5Ghz; S939) | MSI KbT Neo2-F V2.0 | 2x1GB Corsair Value VS1GBKIT400 | Radeon HD 3850 512 MB/AGP8x | Creative SB Audigy LS | 2TB (4x500GB SATA2 HDDs Raid0) | Windows 7 Business X64 SP1 MSDNAA



  3. #3
    Crap Cracker glVertex3f's Avatar
    Join Date
    Jun 2004
    Location
    Under the Sea
    Posts
    164
    You need to make sure you know the basics of the language.

    The process of emulation is like so.

    1.) Load a rom into a "buffer" so you can access it
    2.) You can make a variable called "opcode" or what ever and assign it with the current location in the buffer.
    3.) Do this in a loop so after you have assigned the opcode you can see what the opcode's value is and do the associatd action.

    quick example

    Lets say the contents of a "rom" is like so

    12 45 DA 54 36 24 65 57

    Now you load that in to a buffer so you can have constant access to it.

    So you would now assign the opcode variable to 12.. check docs to see what the 12 instruction is and "do" it. then increse your location... now opcode is 45, etc..

    This is a rough idea on how it works, but you should get the idea
    Last edited by glVertex3f; August 10th, 2004 at 19:13.

  4. #4
    PCSX2 Coder refraction's Avatar
    Join Date
    Apr 2004
    Location
    Sheffield, UK
    Posts
    459
    also you will find that many of the opcodes are shown as hex format, if im not mistaken VB doesnt actually support hex, so you will need to convert all the values into decimal

  5. #5
    Crap Cracker glVertex3f's Avatar
    Join Date
    Jun 2004
    Location
    Under the Sea
    Posts
    164
    I dont think VB has bit operators either does it?

  6. #6
    Moderator aprentice's Avatar
    Join Date
    Nov 2001
    Posts
    1,390
    Quote Originally Posted by glVertex3f
    I dont think VB has bit operators either does it?
    you could use math operations to make up for that

  7. #7
    Crap Cracker glVertex3f's Avatar
    Join Date
    Jun 2004
    Location
    Under the Sea
    Posts
    164
    I myself had actually thought about trying to make a Chip8 emu in a few different languages just for the heck of it, but I couldnt find a decen (free) IDE for any knid of BASIC language

  8. #8
    PCSX2 Coder refraction's Avatar
    Join Date
    Apr 2004
    Location
    Sheffield, UK
    Posts
    459
    Quote Originally Posted by aprentice
    you could use math operations to make up for that

    yeh single bit shifts can be done by either dividing or multiplying a value

    if i recall

    << 1 = *2
    >>1 = /2

  9. #9
    EmuTalk Member BGNG's Avatar
    Join Date
    Jun 2004
    Posts
    198
    Hex can also be done in VB with "&H" before the number, such as &HFF. Be warned that certain numbers will be considered negative. If it becomes a problem, then just use decimal math. No biggie.

    A good place to start emulating is the ROM binary specification. All parts of a ROM mean something, and all ROMs of the same type are arranged the same way. Knowing the specification will let you tear apart its header and initialize anything it needs to use.

    The boot instructions of any program simply set parts of memory. This will be emulated in an almost-identical manner to the rest of the ROM. Probably the simplest way to see if the loading completed successfully is to step through every boot instruction yourself, then compare it to the state of the memory in your emulator.

    As was mentioned earlier, load the entire ROM into memory. Don't keep reading from hard disk. Visual Basic allows things like this to do that:
    Code:
    Dim Buffer() As Byte
    Open "C:\File.rom" For Binary Access Read As #1
    ReDim Buffer(0 To LoF(1) - 1) As Byte
    Get #1, 1, Buffer()
    Close #1
    Also, a handy thing to do is set aside exactly the number of bytes for "memory memory" as the emulated machine has total. So if you're emulating a 64K machine, set aside 64K bytes of memory in a RAM() array or something to that effect.

    Basically, an emulator just boots and runs. Running, as was also mentioned before, simply jumps around in the Buffer reading instructions and manipulating memory. Some instructions will be for normal memory, some for audio, and some for video. Look up documentation of your opcodes to find out what does what.

  10. #10
    Certified SuperHero sammyboy's Avatar
    Join Date
    Apr 2004
    Location
    England
    Posts
    184
    Look hang on lets get this striaght, first of all how would I set up a buffer.
    "About as innocent as a nun doing pushups in a cucumber field"

Page 1 of 3 123 LastLast

Similar Threads

  1. Simple Programming Question
    By sammyboy in forum Programming
    Replies: 5
    Last Post: June 1st, 2004, 12:53
  2. Visual Basic .exe's Question..
    By Jaz in forum Programming
    Replies: 14
    Last Post: December 10th, 2003, 21:48
  3. Best way to switch from Visual Basic to C++?
    By NeTo in forum Programming
    Replies: 16
    Last Post: October 20th, 2003, 18:41
  4. can someone Visual Basic programming!
    By Ultra-X in forum Programming
    Replies: 11
    Last Post: December 18th, 2002, 11:25
  5. Any tips for Visual Basic
    By tbag in forum Programming
    Replies: 34
    Last Post: November 8th, 2002, 06:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •