sunfrancis12
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    :::warning 必考題為107和111考古皆有出現 ::: ## Marco 電腦科學裡的巨集是一種抽象(Abstraction),它根據一系列預定義的規則替換一定的文字模式。直譯器或編譯器在遇到巨集時會自動進行這一模式替換。 絕大多數情況下,「巨集」這個詞的使用暗示著將小命令或動作轉化為一系列指令(空間換取時間)。 > 引用自:https://zh.wikipedia.org/zh-tw/%E5%B7%A8%E9%9B%86 A macro represents a commonly used group of statements in the source programming language. The macro processor **replaces each macro instruction with the corresponding group of source language statements**. This is called expanding the macros. ### 考古題 **107** ![image](https://hackmd.io/_uploads/S1phiKqPa.png) ## Marco processer ERROR Handling The macro processors that we have discussed so far might be called **preprocessors.** They process macro **definitions and expand macro invocations**, producing an expanded version of the source program. This expanded program is then used as input to an assembler or compiler. the **macro processor performs no analysis** of the text it handles. The meaning of these statements, and their translation into machine language, are of no concern whatsoever during macro expansion ### 考古題 **111** ![image](https://hackmd.io/_uploads/B1uY3tcPp.png) <h2 style="color:orange">Marco, Function比較[必考]</h2> **Marco** * 將巨集指令複製到程式中,節省PC移動位址的時間,但也較費空間 **Function** * Function呼叫時會跳到指定的位址,節省程式碼的空間,但也較費時 ### 考古題 **107** ![image](https://hackmd.io/_uploads/Sy872FqwT.png) **111** ![image](https://hackmd.io/_uploads/ByNr3F9vT.png) <h2 style="color:orange">Marco label[必考]</h2> 在重複貼上Marco定義時,**會有重複Lablel出現**,會造成程式不知道要移動到哪個位址 However, the use of statements like **"JLT \*-14"** is generally considered to be a poor programming practice. 透過指定PC位移量的方式,會造成**程式不易維護** technique for generating unique labels within a macro expansion: The **character $ will be replaced by $XX**, where XX is a two-character alphanumeric counter of the number of macro instructions expanded, AA, AB, AC, etc. ```alt= 25 RDBUFF MACRO &INDEV,&BUFADR,&RECLTH 30 CLEAR X CLEAR LOOP COUNTER 35 CLEAR A 40 CLEAR S 45 +LDT #4096 SET MAXIMUM RECORD LENGTH 50 $LOOP TD =X'&INDEV' TEST INPUT DEVICE 55 JEQ $LOOP LOOP UNTIL READY 60 RD =X'&INDEV' READ CHARACTER INTO REG A 65 COMPR A,S TEST FOR END OF RECORD 70 JEQ $EXIT EXIT LOOP IF EOR 75 STCH &BUFADR,X STORE CHARACTER IN BUFFER 80 TIXR T LOOP UNLESS MAXIMUM LENGTH 85 JLT $LOOP HAS BEEN REACHED 90 $EXIT STX &RECLTH SAVE RECORD LENGTH 95 MEND (a) RDBUFF Fl,BUFFER,LENGTH 30 CLEAR X CLEAR LOOP COUNTER 35 CLEAR A 40 CLEAR S 45 +LDT #4096 SET MAXIMUM RECORD LENGTH 50 $AALOOP TD =X'Fl' TEST INPUT DEVICE 55 JEQ $AALOOP LOOP UNTIL READY 60 RD =X'Fl' READ CHARACTER INTO REG A 65 COMPR A,S TEST FOR END OF RECORD 70 JEQ $AAEXIT EXIT LOOP IF EOR 75 STCH BUFFER,X STORE CHARACTER IN BUFFER 80 TIXR T LOOP UNLESS MAXIMUM LENGTH 85 JLT $AALOOP HAS BEEN REACHED 90 $AAEXIT STX LENGTH SAVE REJORD LENGTH (b) ``` ### 考古題 **111, 107** ![image](https://hackmd.io/_uploads/ryc8pt5vT.png) <h2 style="color:orange">Marco Data structure[必考]</h2> **one-pass macro processor** that can alternate between macro definition and macro expansion 下層Macro可以定義不同的版本,取決於第一層Marco definition ```alt= 1 MACROS MACRO {Defines SIC standard version macros} 2 RDBUFF MACRO &INDEV,&BUFADR,&RECLTH . . {SIC standard version} . 3 MEND {End of RDBUFF} 4 WRBUFF MACRO &OUTDEV,&BUFADR,&RECLTH . . {SIC standard version} . 5 MEND {End of WRBUFF} . . . 6 MEND {End of MACROS} (a) 1 MACROX MACRO {Defines SIC/XE macros} 2 RDBUFF MACRO &INDEV,&BUFADR,&RECLTH . . {SIC/XE version} . 3 MEND {End of RDBUFF} 4 WRBUFF MACRO &OUTDEV,&BUFADR,&RECLTH . . {SIC/XE version} . 5 MEND {End of WRBUFF} . . . 6 MEND {End of MACROX} (b) ``` **There are three main data structures.** * Definition table (DEFTAB) - References to the macro instruction parameters are converted to a positional notation for efficiency in substituting arguments. * Name table (NAMTAB) - serving as an **index** to DEFTAB. - 目錄 * Argument table (ARGTAB) - 紀錄參數 ### 考古題1 **111,107** ![image](https://hackmd.io/_uploads/SJk7l5cPp.png) ### 考古題2 **107** ![image](https://hackmd.io/_uploads/S1NZ1qqD6.png) ## Recursive Macro Expansion **PROCESSLINE and EXPAND** would probably not be procedures at all. Instead, the same logic would be incorporated into a looping structure, with data values being **saved on a stack**. ### 考古題 **111** ![image](https://hackmd.io/_uploads/S1t6OWivp.png) <h2 style="color:orange">Keyword Macro Parameters[必考]</h2> ### 考古題 **111,107** ![image](https://hackmd.io/_uploads/HJBOGcqPa.png) <h2 style="color:orange">Marco程式[必考]</h2> ```alt= 1 SUM MACRO &ID 2 LDA X&ID-->1 3 ADD X&ID-->2 4 ADD X&ID-->3 5 STA X&ID-->S 6 MEND (a) SUM A | | \|/ LDA XAl ADD XA2 ADD XA3 STA XAS (b) ``` **111,107** ![image](https://hackmd.io/_uploads/ryz6g99v6.png) ### 考古題2 Boolean expression in IF statements occurs at the time macros are expanded, not during program execution. ```alt= 25 RDBUFF MACRO &INDEV, &BUFADR , &RECLTH ,&EOR ,&MAXLTH 26 IF (&EOR NE ") 27 &EORCK SET 1 28 ENDIF 30 CLEAR X CLEAR LOOP COUNTER 35 CLEAR A 38 IF (&EORCK EQ 1 ) 40 LDCH =X'&EOR' SET EOR CHARACTER 42 RMO A,S 43 ENDIF 44 IF (&MAXLTH EQ '') 45 +LDT #4096 SET MAX LENGTH = 4096 46 ELSE 47 +LDT #&MAXLTH SET MAXIMUM RECORD LENGTH 48 ENDIF 50 $LOOP TD =X'&INDEV' TEST INPUT DEVICE 55 JEQ $LOOP LOOP UNTIL READY 60 RD =X'&INDEV' READ CHARACTER INTO REG A 63 IF (&EORCK EQ 1 ) 65 COMPR A,S TEST FOR END OF RECORD 70 JEQ $EXIT EXIT LOOP IF EOR 73 ENDIF 75 STCH &BUFADR ,X STORE CHARACTER IN BUFFER 80 TIXR T LOOP UNLESS MAXIMUM LENGTH 85 JLT $LOOP HAS BEEN REACHED 90 $EXIT STX &RECLTH SAVE RECORD LENGTH 95 MEND (a) RDBUFF F3,BUF,RECL,04,2048 30 CLEAR X CLEAR LOOP COUNTER 35 CLEAR A 40 LOCH =X'04' SET EOR CHARACTER 42 RMO A,S 47 +LDT #2048 SET MAXIMUM RECORD LENGTH 50 $AALOOP TD =X'F3' TEST INPUT DEVICE 55 JEQ $AALOOP LOOP UNTIL READY 60 RD =X'F3' READ CHARACTER INTO REG A 65 COMPR A,S TEST FOR END OF RECORD 70 JEQ $AAEXIT EXIT LOOP IF EOR 75 STCH BUF,X STORE CHARACTER IN BUFFER 80 TIXR T LOOP UNLESS MAXIMUM LENGTH 85 JLT $AALOOP HAS BEEN REACHED 90 $AAEXIT STX RECL SAVE RECORD LENGTH ``` **111,107** ![image](https://hackmd.io/_uploads/ryFZM9qwa.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully