Annotation of hatari/src/faketos.s, revision 1.1

1.1     ! root        1: ; A very minimalistic TOS ROM replacement, used for testing without real TOS
        !             2: 
        !             3:        org     $e00000
        !             4: 
        !             5: TEST_PRG_BASEPAGE equ $1000
        !             6: 
        !             7: rom_header:
        !             8:        bra.s   start                   ; Branch to 0xe00030
        !             9:        dc.w    $0001                   ; TOS version
        !            10:        dc.l    start                   ; Reset PC value
        !            11:        dc.l    rom_header              ; Pointer to ROM header
        !            12:        dc.l    TEST_PRG_BASEPAGE       ; End of OS BSS
        !            13:        dc.l    start                   ; Reserved
        !            14:        dc.l    $0                      ; Unused (GEM's MUPB)
        !            15:        dc.l    $03032018               ; Fake date
        !            16:        dc.w    $0001                   ; PAL flag
        !            17:        dc.w    $4c63                   ; Fake DOS date
        !            18:        dc.l    $00000880               ; Fake pointer 1 (mem pool)
        !            19:        dc.l    $00000870               ; Fake pointer 2 (key shift)
        !            20:        dc.l    $00000800               ; Addr of basepage var
        !            21:        dc.l    $0                      ; Reserved
        !            22: start:
        !            23:        move    #$2700,sr
        !            24:        reset
        !            25:        move.b  #5,$ffff8001.w          ; Fake memory config
        !            26:        lea     $20000,sp               ; Set up SSP
        !            27:        lea     $fa0000,a0
        !            28:        cmp.l   #$abcdef42,(a0)         ; Cartridge enabled?
        !            29:        bne.s   no_sys_init
        !            30:        lea     unhandled_error(pc),a1
        !            31:        movea.w #8,a0                   ; Start with bus error handler
        !            32: set_exc_loop:
        !            33:        move.l  a1,(a0)+                ; Set all exception handlers
        !            34:        cmp.w   #$1c0,a0
        !            35:        ble.s   set_exc_loop
        !            36:        dc.w    $a                      ; Call SYSINIT_OPCODE to init trap #1
        !            37: 
        !            38: no_sys_init:
        !            39:        lea     rte_only(pc),a1
        !            40:        move.l  a1,$68                  ; Ignore HBLs
        !            41:        move.l  a1,$72                  ; Ignore VBLs
        !            42: 
        !            43:        moveq   #0,d0
        !            44:        movea.l d0,a0
        !            45:        movea.l d0,a1
        !            46:        move    #$0700,sr               ; Go to user mode
        !            47:        lea     $18000,sp               ; Set up USP
        !            48:        pea     TEST_PRG_BASEPAGE.w
        !            49:        pea     rom_header(pc)
        !            50:        jmp     TEST_PRG_BASEPAGE+$100.w
        !            51: 
        !            52: 
        !            53: unhandled_err_txt:
        !            54:        dc.b    "ERROR: Unhandled exception!",13,10,0
        !            55:        even
        !            56: 
        !            57: unhandled_error:
        !            58:        pea     unhandled_err_txt(pc)
        !            59:        move.w  #9,-(sp)
        !            60:        trap    #1              ; Cconws
        !            61:        addq.l  #6,sp
        !            62: 
        !            63:        move.w  #1,-(sp)
        !            64:        move.w  #76,-(sp)
        !            65:        trap    #1              ; Pterm
        !            66: 
        !            67: rte_only:
        !            68:        rte

unix.superglobalmegacorp.com

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