Annotation of nono/exp/pack1.has, revision 1.1

1.1     ! root        1: ; vi:set ts=8:
        !             2: 
        !             3: ; nono
        !             4: ; Copyright (C) 2025 Tetsuya Isaki
        !             5: ;
        !             6: ; Permission to use, copy, modify, and/or distribute this software for any
        !             7: ; purpose with or without fee is hereby granted.
        !             8: ;
        !             9: ; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            10: ; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            11: ; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            12: ; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            13: ; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            14: ; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            15: ; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            16: 
        !            17: ; PACK/UNPK のアクセスサイズを調べる。
        !            18: ; 68030 実機ではどちらもワードアクセスをしている。
        !            19: ;
        !            20: ; How to build and use:
        !            21: ; > has pack1.has
        !            22: ; > hlk pack1.o
        !            23: ; > pack1.x
        !            24: ; PACK SSW.size=2
        !            25: ; UNPK SSW.size=2
        !            26: 
        !            27:        .include        doscall.mac
        !            28:        .include        iocscall.mac
        !            29: 
        !            30:        .cpu    68030
        !            31:        .list
        !            32:        .text
        !            33:        .even
        !            34: start:
        !            35:        ; バスエラーハンドラを差し替える。
        !            36:        pea.l   buserr_handler
        !            37:        move.w  #2,-(sp)
        !            38:        DOS     _INTVCS
        !            39:        addq.l  #6,sp
        !            40:        move.l  d0,buserr_backup
        !            41: 
        !            42: test_pack:
        !            43:        ; PACK -(Ax),-(Ay),#imm は
        !            44:        ; -(Ax) から2バイト読んで -(Ay) に1バイト書き込む。
        !            45:        ; この読み込みのアクセスサイズを調べる。
        !            46:        pea.l   msg_pack(pc)
        !            47:        DOS     _PRINT
        !            48:        addq.l  #4,sp
        !            49: 
        !            50:        move.l  #$ed4002,d0
        !            51:        movea.l d0,a0
        !            52:        lea.l   buf+2(pc),a1
        !            53:        lea.l   @f,a2
        !            54:        pack    -(a0),-(a1),#0
        !            55: @@:
        !            56:        move.b  d0,msg_res0
        !            57:        pea     msg_res(pc)
        !            58:        DOS     _PRINT
        !            59:        addq.l  #4,sp
        !            60: 
        !            61: test_unpk:
        !            62:        ; UNPK -(Ax),-(Ay),#imm は
        !            63:        ; -(Ax) から1バイト読んで -(Ay) に2バイト書き込む。
        !            64:        ; この書き込みのアクセスサイズを調べる。
        !            65:        pea.l   msg_unpk(pc)
        !            66:        DOS     _PRINT
        !            67:        addq.l  #4,sp
        !            68: 
        !            69:        lea.l   buf+2(pc),a0
        !            70:        move.l  #$ed4002,d0
        !            71:        movea.l d0,a1
        !            72:        lea.l   @f,a2
        !            73:        unpk    -(a0),-(a1),#0
        !            74: @@:
        !            75:        move.b  d0,msg_res0
        !            76:        pea     msg_res(pc)
        !            77:        DOS     _PRINT
        !            78:        addq.l  #4,sp
        !            79: 
        !            80: done:
        !            81:        move.l  buserr_handler,-(sp)
        !            82:        move.w  #2,-(sp)
        !            83:        DOS     _INTVCS
        !            84: 
        !            85:        DOS     _EXIT
        !            86: 
        !            87: ; SSW のサイズフィールドから '1' or '2' を d0 に入れて a2 に帰る。
        !            88: buserr_handler:
        !            89:        move.w  $a(sp),d0
        !            90:        andi.w  #$0eff,d0       ; Clear Rerun flags
        !            91:        move.w  d0,$a(sp)
        !            92:        lsr.w   #4,d0
        !            93:        andi.w  #3,d0
        !            94:        addi.b  #'0',d0
        !            95:        move.l  a2,2(sp)
        !            96:        rte
        !            97: 
        !            98: msg_pack:
        !            99:        .dc.b   "PACK",0
        !           100: msg_unpk:
        !           101:        .dc.b   "UNPK",0
        !           102:        .data
        !           103:        .even
        !           104: buf:
        !           105:        .dc.b   2
        !           106: msg_res:
        !           107:        .dc.b   ": SSW.size="
        !           108: msg_res0:
        !           109:        .dc.b   "x",$d,$a,0
        !           110: 
        !           111:        .bss
        !           112:        .even
        !           113: buserr_backup:
        !           114:        .ds.l   1
        !           115:        .end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.