Pep8 intro #1 - machine language

00:08:50
https://www.youtube.com/watch?v=QjkTcpApFHI

Résumé

TLDRTutorial iki njlentrehake carane nggunakake simulator PEP8 kanggo mbiwiti kode mesin lan kode Assembly. Wiwit saka nemokake program ing komputer nganti mbukak kode lan njelasake fungsi saka macem-macem fitur ing program iki, tutorial iki menehi pandhuan langkah-langkah. Tutorial iki uga kalebu carane nggunakake panel panel telu kanggo ndeleng kode sumber, arsitektur registrasi, lan dhumpa memori. Mode debugging digunakake kanggo nglikasake proses fetch-decode-execute kode, lan ana pandhuan babagan carane nyimpen lan mbukak program sing wis digarap. Tutorial iki nduweni informasi rinci kanggo pamula lan bisa ngirit wektu lan usaha kanggo ngerti cara kerja simulator iki.

A retenir

  • 💻 Gunakake simulator PEP8 kanggo latihan kode mesin lan assembly.
  • 🗂️ Bukak folder PEP8 13 win kanggo miwiti simulator.
  • 🖱️ Pilih tampilan panel telung ing setelan simulator.
  • 🧹 Gunakake 'clear memory' kanggo ngresiki memori sadurunge mbukak program anyar.
  • ⌨️ Ketikka kode mesin ing jendhela kode obyek.
  • 🔍 Gunakake mode debugging kanggo langkah-langkah liwat kode.
  • 🟦 Program counter nunjuk instruksi sabanjuré kanggo dieksekusi.
  • 🔢 Instruksi dieksekusi minangka bagian saka siklus fetch-decode-execute.
  • 💾 Simpen kode obyek kanggo diteruske utawa diunggah.
  • 📤 Gabungake input langsung ing tab 'batch IO'.

Chronologie

  • 00:00:00 - 00:08:50

    Pambuka ngenani panggunaan simulator PEP8 kanggo mbukak kode mesin lan kode rakitan. Wiwit kanthi mipir program saka folder pep8_13_win ing desktop, mbukak file pep8.exe, lan pindah menyang tampilan panel telu. Iki kalebu wilayah kode sumber, kode obyek, daftar rakitan, lan wilayah arsitektur sing nuduhake registri lan memori. Simulasine padha karo siklus 'fetch-decode-execute', nggoleki instruksi saka memori, ngurai, lan nglakokake. Program kasebut nuduhake carane nglebokake kode mesin kanthi nggambarake data instruksi lan ngasilake karakter sing kalebu nilai ASCII tartamtu. Proses debugging kalebu langkah demi langkah kanggo mriksa eksekusi instruksi. Akhire, cara nyimpen lan mbukak kode obyek menyang/dari file uga diterangke.

Carte mentale

Mind Map

Questions fréquemment posées

  • Carane nemokake lan mbukak simulator PEP8?

    Sampeyan kudu manggonke folder PEP8 13 win ing desktop, banjur pilih pep a.exe kanggo mbukak.

  • Apa fungsi saka tombol 'clear memory'?

    Fungsi iki kanggo ngresiki memori, kanggo ensure ora ana sisa saka mbukak sadurungé.

  • Carane ngetik lan mbangun kode obyek?

    Ketikka kode mesin ing jendhela kode obyek, banjur pilih 'build' lan 'load' kanggo mbukak kode menyang memori.

  • Apa tujuan saka mode debugging ing simulator PEP8?

    Mode debugging menehi kesempatan kanggo langkah-langkah kanthi pelan liwat proses fetch-decode-execute supaya bisa ngidentifikasi kesalahan.

  • Apa gunane simbol 'ZZ' ing kode obyek?

    ZZ digunakake mung minangka tandha pungkasan kode obyek kanggo simulator iki.

  • Kepiye cara nyimpen program sing digarap ing PEP8?

    Pilih 'file', banjur 'save object' lan simpen ing lokasi sing dikarepake ing komputer.

  • Apa isi panel tengah nalika simulasi mlaku?

    Ing panel tengah, nilai-nilai saka akumulator, counter program, lan regeskde instruksi dikempakkan lan ditampilake.

  • Apa manfaat tombol 'single step' ing mode debugging?

    Tombol 'single step' ngidini pangguna kanggo nindakake instruksi siji-siji lan nganalisa kepiye sistem nglakokno instruksi.

  • Carane nggarap input ing simulator PEP8?

    Gunakake tab 'batch IO' kanggo ngetik input kanthi langsung tanpa tandha koma.

Voir plus de résumés vidéo

Accédez instantanément à des résumés vidéo gratuits sur YouTube grâce à l'IA !
Sous-titres
en
Défilement automatique:
  • 00:00:01
    hi so what I'd like to do today is give
  • 00:00:03
    you an introduction to the pep8
  • 00:00:05
    simulator that we're going to use for
  • 00:00:06
    running machine language code as well as
  • 00:00:08
    Assembly Language code so the first
  • 00:00:10
    thing we have to do is find the program
  • 00:00:12
    in theory if you follow the directions
  • 00:00:14
    in the uh handout that I gave you it's
  • 00:00:16
    hopefully in a folder on your desktop
  • 00:00:18
    called pep8 13 win so I'm going to go
  • 00:00:22
    into that
  • 00:00:23
    folder and you're going to select the
  • 00:00:25
    pep a.exe
  • 00:00:28
    icon right it's going to ask you to run
  • 00:00:30
    it you're going to run it so when it
  • 00:00:33
    first opens up it's going to be in this
  • 00:00:34
    basically two panel views source code
  • 00:00:37
    and then the architecture here showing
  • 00:00:38
    the registers and you want to be in a
  • 00:00:40
    three panel view so go up here in the
  • 00:00:41
    middle and left click on this three
  • 00:00:43
    panel View and so now you have a source
  • 00:00:45
    code object code assembly listing region
  • 00:00:48
    you have an architecture region showing
  • 00:00:50
    the different registers the accumulator
  • 00:00:51
    the program counter instruction register
  • 00:00:54
    composed of the instruction specifier
  • 00:00:56
    and operand specifier and then your
  • 00:00:58
    memory dump over here on the right
  • 00:01:00
    and just as a note in the future um
  • 00:01:03
    whenever a program calls for input uh
  • 00:01:05
    make sure you have the batch IO tab
  • 00:01:07
    clicked so that's in the Forefront and
  • 00:01:09
    you'll just enter your values
  • 00:01:11
    here you know 40 for whatever values the
  • 00:01:14
    program is looking for okay you don't
  • 00:01:16
    put any commas or anything like that so
  • 00:01:17
    that's the batch iio area all right well
  • 00:01:21
    the first thing you always want to get
  • 00:01:22
    in the habit of doing is going up under
  • 00:01:23
    system left clicking on system and left
  • 00:01:26
    clicking on clear memory and what that
  • 00:01:28
    does is it clears out your memory memory
  • 00:01:30
    remember that all the programs are run
  • 00:01:31
    from memory and so the instructions are
  • 00:01:33
    fetched from memory and then executed so
  • 00:01:36
    by clearing out memory you're making
  • 00:01:38
    sure that you don't have anything
  • 00:01:39
    residual from previous runs and so it
  • 00:01:42
    just kind of a nice
  • 00:01:44
    restart so the first thing that I'm
  • 00:01:46
    going to do is I'm going to I've cleared
  • 00:01:49
    memory system clear memory so now I'm
  • 00:01:52
    going to go down here in the object code
  • 00:01:54
    window and I'm going to type in the
  • 00:01:57
    object code the machine language program
  • 00:01:59
    from the box on page 163 of your book
  • 00:02:02
    and so I'm going to type that in and
  • 00:02:04
    then um so it starts out 5 0 0 and I'm
  • 00:02:08
    going to continue to type that in and so
  • 00:02:10
    I'll be right back after I type it
  • 00:02:13
    in okay now you can see that I've typed
  • 00:02:15
    in the program from that box on page 163
  • 00:02:18
    excuse me and notice that I put a zz at
  • 00:02:20
    the
  • 00:02:21
    end that ZZ doesn't have anything to do
  • 00:02:23
    with the ma machine language itself
  • 00:02:26
    that's simply two symbols that are used
  • 00:02:28
    by this simulator to know where the end
  • 00:02:31
    of the object code is and so it's just
  • 00:02:34
    for use by this particular simulator so
  • 00:02:36
    now I'm going to go up under build left
  • 00:02:38
    click on build and I like to run these
  • 00:02:40
    in debugging mode so I'm going to go to
  • 00:02:43
    load first I'm going to left click on
  • 00:02:45
    load and that's going to load this
  • 00:02:47
    object code into memory and now notice
  • 00:02:50
    if we read across and from
  • 00:02:53
    zero to 7 to 8 using these addresses
  • 00:02:57
    this address is the address in tax of
  • 00:03:00
    the first bite in the row you'll notice
  • 00:03:03
    that our program that's here has simply
  • 00:03:06
    been copied into memory here and it
  • 00:03:09
    wraps around through there all right so
  • 00:03:11
    everything here is directly from here
  • 00:03:15
    and so we've copied our object code into
  • 00:03:17
    memory so now what we want to do is do
  • 00:03:20
    the fetch execute cycle that we learned
  • 00:03:22
    about as far as how a computer actually
  • 00:03:24
    works and so that's all it's going to
  • 00:03:25
    happen now is that the program the
  • 00:03:27
    simulator is going to do the fetch
  • 00:03:29
    decode execute cycle so now as I
  • 00:03:32
    mentioned before I like to run these in
  • 00:03:33
    debugging mode so I'm going to go build
  • 00:03:35
    start debugging object since this is
  • 00:03:38
    object code machine code and you'll
  • 00:03:40
    notice now what's happened is the
  • 00:03:42
    central region here is populated with
  • 00:03:43
    some values and we have a a button here
  • 00:03:46
    single step that we can start to
  • 00:03:49
    click notice that the program counter
  • 00:03:51
    here has hex value of 0o decimal value
  • 00:03:55
    of zero and it's pointing at the first
  • 00:03:57
    three bytes in memory so the those three
  • 00:04:00
    bytes are in blue and they represent the
  • 00:04:04
    instruction that will next be fetched
  • 00:04:06
    and executed so the program counter is
  • 00:04:08
    pointing at the next instruction excuse
  • 00:04:11
    me to be fetched and
  • 00:04:13
    executed so I'm going to click on single
  • 00:04:15
    step and so that first instruction has
  • 00:04:18
    been fetched and is now sitting in the
  • 00:04:21
    instruction specifier and the operand
  • 00:04:23
    specifier you'll notice that over here
  • 00:04:26
    the operand the instruction specifi is
  • 00:04:28
    the first bite so 5 0 notice that when
  • 00:04:30
    we look at the instruction specifier
  • 00:04:32
    here it's showing it in binary but
  • 00:04:34
    you'll notice that 0 1 01 0000 is simply
  • 00:04:38
    5 and hex what's nice about this
  • 00:04:41
    simulator is that on to the right of
  • 00:04:43
    this on the to the right of the
  • 00:04:44
    instruction specifier it's showing the
  • 00:04:46
    Assembly Language version of that
  • 00:04:49
    instruction specifier so character
  • 00:04:51
    output Caro comma I means to Output the
  • 00:04:55
    asky character associated with the value
  • 00:04:58
    that's in the operand specifier this is
  • 00:05:00
    immediate mode I so the asky character
  • 00:05:04
    associated with hex value 48 if we look
  • 00:05:06
    down here in the output panel is H right
  • 00:05:09
    so all this did was fetch that first
  • 00:05:11
    instruction decode it execute it so the
  • 00:05:15
    execution was the character output a an
  • 00:05:18
    asky character to the user using
  • 00:05:20
    immediate
  • 00:05:21
    mode so the hex value the aski value
  • 00:05:24
    associated with the hex value of 48 is H
  • 00:05:27
    all right notice now that the program
  • 00:05:28
    counter is pointing at location 3 X3
  • 00:05:31
    decimal 3 and you'll notice there that
  • 00:05:33
    the next three byes are in blue so
  • 00:05:36
    that's the next instruction that's going
  • 00:05:37
    to be fetched and executed so we single
  • 00:05:40
    step and you'll notice that now the
  • 00:05:42
    program counter is incremented to
  • 00:05:44
    six pointing at the next instruction to
  • 00:05:47
    be fetched and executed the instruction
  • 00:05:49
    that we just fetched is sitting now in
  • 00:05:51
    the instruction specifier the operand
  • 00:05:53
    specifier you'll notice that this
  • 00:05:55
    operand specifier 65 agrees exactly to
  • 00:05:58
    the Opera specifier here here of
  • 00:06:00
    0065
  • 00:06:02
    0065 and again we have our cheat which
  • 00:06:04
    is showing us that this is character
  • 00:06:05
    output immediate mode immediate
  • 00:06:07
    addressing and so now it's putting out
  • 00:06:10
    the asky character associated with hex
  • 00:06:12
    value of 65 which is an e and we can
  • 00:06:15
    continue to step through this program h
  • 00:06:19
    h h o and so notice now that each time
  • 00:06:24
    the program counter incremented by
  • 00:06:26
    three and now it's pointing at location
  • 00:06:31
    um what's that 15 f f f okay F and so
  • 00:06:36
    now it's one more step on this single
  • 00:06:38
    step and it pulls in that 0 instruction
  • 00:06:43
    which we know to be stop and notice it
  • 00:06:45
    went from 15 to 16 and why is that
  • 00:06:48
    because it fetched a one bite
  • 00:06:50
    instruction stop instructions are one
  • 00:06:52
    bytes one by instruction they're unary
  • 00:06:54
    they have no operand specifier
  • 00:06:57
    associated with them and just pointing
  • 00:06:58
    out how the program counters incremented
  • 00:07:01
    right so the program outputed the word
  • 00:07:03
    hello and so uh and it's finished it's
  • 00:07:06
    stopped you'll notice that we no longer
  • 00:07:07
    have the single step button here that we
  • 00:07:09
    can click on and so um that's showing
  • 00:07:12
    how a machine language program is
  • 00:07:15
    entered into the simulator
  • 00:07:18
    loaded and then executed using debugging
  • 00:07:21
    mode and I would just uh stress that
  • 00:07:23
    it's probably the easiest way to do this
  • 00:07:24
    it avoids some of the particular quirks
  • 00:07:26
    that this particular program has now
  • 00:07:29
    once once you've actually gotten a
  • 00:07:30
    program to work or you're in the process
  • 00:07:32
    of trying to work on one you're probably
  • 00:07:34
    going to want to save it so that you can
  • 00:07:36
    load it later and a way to do that is
  • 00:07:38
    just go up under
  • 00:07:40
    file go save in this case object we want
  • 00:07:43
    to save the object because this is
  • 00:07:46
    object code all right and then find the
  • 00:07:50
    file that you want to save it to I'm
  • 00:07:51
    going just go to the
  • 00:07:53
    desktop and I'm going to save it on the
  • 00:07:55
    desktop and you could save it into a
  • 00:07:57
    particular folder if you want I'm just
  • 00:07:59
    going to call this
  • 00:08:03
    test test. PPO leave the extension alone
  • 00:08:08
    click save and so now I have saved this
  • 00:08:12
    object code right here into a file that
  • 00:08:14
    I can now submit as part of my
  • 00:08:16
    assignment to Sakai or I can reload it
  • 00:08:19
    later on by going up under
  • 00:08:21
    file
  • 00:08:24
    open go to my
  • 00:08:25
    [Music]
  • 00:08:28
    desktop find the file down here
  • 00:08:30
    somewhere hopefully there it is left
  • 00:08:32
    click on that left click on
  • 00:08:34
    open and it reloads it all right so
  • 00:08:38
    that's giving you an example of how to
  • 00:08:41
    enter object code into the program
  • 00:08:42
    machine language load it and execute it
  • 00:08:46
    and then save it
Tags
  • PEP8 simulator
  • machine language
  • assembly language
  • debugging
  • code execution
  • memory management
  • programming
  • computer architecture
  • instruction cycle
  • object code