marie programming
play

MARIE Programming 2 Schedule Today Review / discuss - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific MARIE Programming 2 Schedule Today Review /


  1. ì ¡ Computer ¡Systems ¡and ¡Networks ¡ ECPE ¡170 ¡– ¡Jeff ¡Shafer ¡– ¡University ¡of ¡the ¡Pacific ¡ MARIE ¡Programming ¡

  2. 2 ¡ Schedule ¡ ì Today ¡ ì Review ¡/ ¡discuss ¡MARIE ¡assembly ¡homework ¡ problems ¡ ì Opportunity ¡to ¡re-­‑submit ¡HW ¡#10 ¡un8l ¡midnight ¡ ì Office ¡hours ¡this ¡aKernoon: ¡1:30pm+ ¡ ì Friday ¡24 th ¡ ¡ ì Start ¡Chapter ¡5 ¡ ì Quiz ¡3! ¡ ì Topic: ¡Assembly ¡programming! ¡ ì I ¡will ¡give ¡you ¡Table ¡4.7 ¡from ¡the ¡book ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  3. 3 ¡ Recap ¡on ¡I/O ¡Instructions ¡ ì INPUT ì Where ¡is ¡the ¡value ¡from ¡the ¡keyboard ¡stored? ¡ ì The ¡accumulator! ¡ ì Output ì Where ¡does ¡the ¡value ¡on ¡the ¡display ¡come ¡from? ¡ ì The ¡accumulator! ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  4. 4 ¡ Homework ¡4.32 ¡ ì Write ¡a ¡MARIE ¡subrou8ne ¡to ¡subtract ¡two ¡ numbers ¡ ì What ¡do ¡we ¡need ¡in ¡our ¡program ¡to ¡handle ¡the ¡ mechanics ¡of ¡a ¡subrou8ne? ¡ ì Arguments ¡to ¡the ¡funcRon ¡(i.e. ¡input ¡data) ¡ ì Return ¡value ¡from ¡the ¡funcRon ¡ ì A ¡way ¡to ¡jump ¡to ¡the ¡funcRon ¡ ì A ¡way ¡to ¡return ¡from ¡the ¡funcRon ¡when ¡finished ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  5. 5 ¡ Homework ¡4.33 ¡ ì Write ¡a ¡MARIE ¡program ¡to ¡traverse ¡a ¡linked ¡list ¡ and ¡print ¡the ¡data ¡stored ¡in ¡each ¡node ¡ ì In ¡this ¡case, ¡the ¡data/desired ¡output ¡is ¡the ¡sequence ¡ 1 ¡2 ¡3 ¡4 ¡5 ¡ ì The ¡linked ¡list ¡is ¡scrambled ¡in ¡memory ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  6. 6 ¡ Homework ¡4.33 ¡ Addr, Hex ____ / Top of list pointer Node2, Hex 0032 / Node's data is the character "2." Hex ____ / Address of Node3. Node4, Hex 0034 / Character "4." Hex ____ Node1, Hex 0031 / Character "1" Hex ____ Node3, Hex 0033 / Character "3" Hex ____ Node5, Hex 0035 / Character "5" Hex 0000 / Indicates terminal node. Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  7. 7 ¡ ì ¡ Discuss ¡Quiz ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  8. 8 ¡ ì ¡ Clever ¡Tricks ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  9. 9 ¡ Clever ¡Tricks ¡– ¡Faking ¡LOADI ¡ ì MARIE ¡has ¡LOAD-­‑Indirect ¡(LOADI) ¡and ¡STORE-­‑ Indirect ¡(STOREI) ¡instrucRons ¡ ì But ¡clever ¡programmers ¡don’t ¡need ¡them! ¡ ì How ¡could ¡I ¡“emulate” ¡the ¡ LOADI X ¡instruc8on ¡ using ¡several ¡non-­‑indirect ¡MARIE ¡instruc8ons? ¡ CLEAR / Put 0 in AC ADDI X / Add indirect value from Mem[Mem[X]] Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  10. 10 ¡ Clever ¡Tricks ¡– ¡Faking ¡STOREI ¡ ì How ¡could ¡I ¡“emulate” ¡the ¡ STOREI X ¡instruc8on ¡ using ¡several ¡non-­‑indirect ¡MARIE ¡instruc8ons? ¡ This ¡is ¡harder! ¡ ì ì Idea: ¡Take ¡advantage ¡of ¡the ¡stored ¡program ¡concept ¡ InstrucRons ¡are ¡just ¡data ¡ ì ì We ¡need ¡a ¡sequence ¡of ¡instrucRons ¡that ¡construct ¡a ¡ STORE ¡instrucRon ¡with ¡the ¡desired ¡address ¡ ì This ¡would ¡be ¡a ¡good ¡applicaRon ¡of ¡a ¡subrouRne ¡ Pass ¡the ¡value ¡to ¡store ¡in ¡AC, ¡place ¡the ¡address ¡in ¡a ¡ ì parameter ¡variable ¡ Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

  11. 11 ¡ Clever ¡Tricks ¡– ¡Faking ¡STOREI ¡ ì Equivalent ¡code ¡to ¡ STOREI X : ¡ LOAD STROPCODE / Get opcode ADD X / Combine addr STORE STOREI / Save STOREI, HEX 0 / Data: build instruction / here, then execute it / Program continues here... ... ... STROPCODE, STORE 0 / Data: Just opcode / for store Computer ¡Systems ¡and ¡Networks ¡ Spring ¡2012 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend