--- np2/romimage/SASIBIOS.ASM 2004/01/31 20:05:23 1.3 +++ np2/romimage/SASIBIOS.ASM 2004/03/19 00:30:01 1.4 @@ -1,11 +1,11 @@ -CODE SEGMENT - ASSUME CS:CODE,DS:nothing,ES:nothing,SS:nothing - ORG 0000H + ORG 0 + USE16 + CPU 8086 -FIXCS equ 2eh +segment .sasi start=0x0000 -START: retf ; 00 + retf ; 00 nop nop retf ; 03 @@ -15,16 +15,16 @@ START: retf ; 00 nop nop db 055h, 0aah, 002h ; 09 - jmp short sasi_init1 ; 0c + jmp short init1 ; 0c nop - jmp short sasi_init2 ; 0f + jmp short init2 ; 0f nop retf ; 12 nop nop - jmp short sasi_boot ; 15 + jmp short boot ; 15 nop - jmp short sasi_bios ; 18 + jmp short bios ; 18 nop retf ; 1b nop @@ -48,32 +48,28 @@ START: retf ; 00 nop nop -sasi_init1: mov byte ptr [bx], 0d9h +init1: mov byte [bx], 0xd9 retf -sasi_init2: mov ax, cs - mov word ptr ds:[0044h], offset sasiint - mov ds:[0046h], ax - mov ds:[04b0h], ah - mov ds:[04b8h], ah - mov ax, 0300h - int 1bh +init2: mov ax, cs + mov word [0x0044], sasiint + mov [0x0046], ax + mov [0x04b0], ah + mov [0x04b8], ah + mov ax, 0x0300 + int 0x1b retf -sasi_bios: cld +bios: cld mov dx, cs mov ds, dx mov cx, 8 - mov si, offset sasibiosstr - mov dx, 07efh + mov si, sasibiosstr + mov dx, 0x07ef cli - if 1 -@@: lodsb +.loop: lodsb out dx, al - loop short @b - else - rep outsb - endif + loop .loop sti pop ax pop bx @@ -86,65 +82,63 @@ sasi_bios: cld pop ds iret -sasi_boot: cmp al, 0ah - je short sasi_boot2 - cmp al, 0bh - je short sasi_boot2 +boot: cmp al, 0x0a + je short .main + cmp al, 0x0b + je short .main retf -sasi_boot2: sub al, 9 - mov dl, 0ffh - test ds:[055dh], al ; sasi - je short boot_exit +.main: sub al, 9 + test [0x055d], al ; sasi + je short .exit dec al - mov ah, 06h - mov cx, 1fc0h + mov ah, 0x06 + mov cx, 0x1fc0 mov es, cx - mov bp, bx - mov cx, bx - mov dx, bx - mov bh, 4 - int 1bh - jc short boot_exit - or al, 80h - mov byte ptr ds:[0584h], al - db 9ah ; call far - dw 0 - dw 1fc0h -boot_exit: retf + xor bp, bp + mov bx, 0x0400 + xor cx, cx + xor dx, dx + int 0x1b + jc short .exit + or al, 0x80 + mov [0x0584], al + db 0x9a ; call far + dw 0x0000 + dw 0x1fc0 +.exit: retf ; MS-DOSがこの割り込みを使用する... sasiint: push ax - in al, 82h - and al, 0fdh - cmp al, 0adh - je short sasireadstat - and al, 0f9h - cmp al, 0a1h - jne short sasiinteoi -sasireadstat: push ds + in al, 0x82 + and al, 0xfd + cmp al, 0xad + je short .readstat + and al, 0xf9 + cmp al, 0xa1 + jne short .eoi +.readstat: push ds xor ax, ax mov ds, ax - or byte ptr ds:[055fh], 1 - mov al, 0c0h - out 82h, al + or byte [0x055f], 1 + mov al, 0xc0 + out 0x82, al pop ds -sasiinteoi: mov al, 20h - out 08h, al - mov al, 0bh - out 08h, al - in al, 08h +.eoi: mov al, 0x20 + out 0x08, al + mov al, 0x0b + out 0x08, al + in al, 0x08 test al, al - jne short sasiintexit - mov al, 20h - out 00h, al -sasiintexit: pop ax + jne short .exit + mov al, 0x20 + out 0x00, al +.exit: pop ax iret sasibiosstr db "sasibios" -CODE ENDS - END START + ends