ifndef ??version ?debug macro endm publicdll macro name public name endm $comm macro name,dist,size,count comm dist name:BYTE:count*size endm else $comm macro name,dist,size,count comm dist name[size]:BYTE:count endm endif ?debug S "atom9.c" ?debug C E9D101AE1C0761746F6D392E63 ?debug C E900104D161B433A5C424F524C414E44435C494E434C5544455C73+ ?debug C 7464696F2E68 ?debug C E900104D1618433A5C424F524C414E44435C494E434C5544455C69+ ?debug C 6F2E68 ?debug C E900104D161B433A5C424F524C414E44435C494E434C5544455C63+ ?debug C 747970652E68 ?debug C E900104D161C433A5C424F524C414E44435C494E434C5544455C73+ ?debug C 7472696E672E68 ?debug C E900104D161B433A5C424F524C414E44435C494E434C5544455C63+ ?debug C 6F6E696F2E68 ?debug C E900104D161A433A5C424F524C414E44435C494E434C5544455C62+ ?debug C 696F732E68 ?debug C E900104D1619433A5C424F524C414E44435C494E434C5544455C64+ ?debug C 6F732E68 ?debug C E900104D161B433A5C424F524C414E44435C494E434C5544455C61+ ?debug C 6C6C6F632E68 ?debug C E900104D161C433A5C424F524C414E44435C494E434C5544455C73+ ?debug C 74646C69622E68 ?debug C E900104D1619433A5C424F524C414E44435C494E434C5544455C64+ ?debug C 69722E68 ?debug C E93873AC1C0870726F746F392E68 ?debug C E94C7CAC1C0A5236354330325F392E68 ?debug C E963099C1C076B623875732E68 _TEXT segment byte public 'CODE' _TEXT ends DGROUP group _DATA,_BSS assume cs:_TEXT,ds:DGROUP _DATA segment word public 'DATA' d@ label byte d@w label word _DATA ends _BSS segment word public 'BSS' b@ label byte b@w label word _BSS ends _DATA segment word public 'DATA' _def_kbrd label byte db 75 db 69 db 89 db 66 db 79 db 65 db 82 db 68 db 0 _ak label word db 255 db 255 db 0 db 255 db 255 db 1 db 223 db 0 db 0 db 223 db 0 db 1 db 253 db 2 db 0 db 253 db 2 db 1 db 253 db 1 db 0 db 247 db 7 db 0 db 253 db 0 db 0 db 253 db 0 db 1 db 251 db 9 db 0 db 251 db 9 db 1 db 251 db 8 db 0 db 251 db 8 db 1 db 251 db 7 db 0 db 254 db 5 db 0 db 251 db 6 db 0 db 251 db 7 db 1 db 251 db 5 db 0 db 251 db 3 db 1 db 251 db 4 db 0 db 251 db 5 db 1 db 253 db 3 db 0 db 251 db 4 db 1 db 251 db 0 db 0 db 251 db 0 db 0 db 251 db 0 db 1 db 251 db 2 db 1 db 253 db 4 db 0 db 253 db 4 db 0 db 253 db 5 db 0 db 253 db 5 db 0 db 239 db 0 db 0 db 239 db 0 db 1 db 223 db 4 db 0 db 223 db 4 db 1 db 247 db 2 db 0 db 247 db 2 db 1 db 223 db 9 db 0 db 223 db 9 db 1 db 223 db 7 db 0 db 223 db 7 db 1 db 223 db 2 db 0 db 223 db 2 db 1 db 223 db 6 db 0 db 223 db 6 db 1 db 239 db 8 db 0 db 239 db 8 db 1 db 239 db 2 db 0 db 239 db 2 db 1 db 239 db 1 db 0 db 239 db 1 db 1 db 254 db 8 db 0 db 254 db 8 db 1 db 254 db 6 db 0 db 254 db 6 db 1 db 253 db 6 db 0 db 253 db 6 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 247 db 6 db 0 db 247 db 6 db 1 db 223 db 8 db 0 db 223 db 8 db 1 db 247 db 3 db 0 db 247 db 3 db 1 db 247 db 1 db 0 db 247 db 1 db 1 db 247 db 0 db 0 db 247 db 0 db 1 db 239 db 9 db 0 db 239 db 9 db 1 db 239 db 7 db 0 db 239 db 7 db 1 db 239 db 6 db 0 db 239 db 6 db 1 db 239 db 5 db 0 db 239 db 5 db 1 db 251 db 2 db 0 db 251 db 3 db 0 db 251 db 6 db 1 db 253 db 1 db 1 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 7 db 0 db 254 db 7 db 1 db 223 db 1 db 0 db 223 db 1 db 1 db 223 db 3 db 0 db 223 db 3 db 1 db 247 db 4 db 0 db 247 db 4 db 1 db 223 db 5 db 0 db 223 db 5 db 1 db 247 db 5 db 0 db 247 db 5 db 1 db 239 db 3 db 0 db 239 db 3 db 1 db 239 db 4 db 0 db 239 db 4 db 1 db 251 db 1 db 0 db 251 db 1 db 1 db 247 db 9 db 0 db 247 db 9 db 1 db 247 db 8 db 0 db 247 db 8 db 1 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 9 db 0 db 254 db 9 db 1 db 254 db 4 db 0 db 254 db 4 db 1 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 2 db 0 db 254 db 2 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 3 db 1 db 254 db 3 db 1 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 3 db 0 db 254 db 3 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 254 db 2 db 1 db 254 db 2 db 1 db 255 db 255 db 0 db 255 db 255 db 0 db 253 db 5 db 0 db 253 db 5 db 0 db 253 db 4 db 0 db 253 db 4 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 db 255 db 255 db 0 ?debug C E9CC60741B09677261666978322E68 _Step label word db 0 db 0 _Debug label word db 0 db 0 _DebugSet label word db 0 db 0 _First label word db 1 db 0 _Stop label word db 0 db 0 _Continue label word db 0 db 0 _BreakDetect label word db 0 db 0 _Db_txt label byte db 40 dup (0) _Pause label word db 0 db 0 _xhalt label word db 255 db 255 _kbsz label byte db 32 _kbp1 label byte db 0 _kbp2 label byte db 0 _dflag label word db 0 db 0 _pflag label word db 0 db 0 _RunMode label word db 0 db 0 _pn label byte db 64 dup (0) _VideoMode label word db 0 db 0 _CrtOutput label word db 0 db 0 _AltBoot label word db 63 db 255 _FKey label word db 0 db 0 _fd label dword db 0 db 0 db 0 db 0 _fd0 label dword db 0 db 0 db 0 db 0 _fd1 label dword db 0 db 0 db 0 db 0 _nmi_set label word db 0 db 0 _nmi_cnt label word db 20 db 0 _cb label word db 0 db 0 _Shift label word db 0 db 0 _SFlag label word db 0 db 0 _Control label word db 255 db 0 _kb label dword db 23 db 4 db 0 db 0 _crt_row label dword db 80 db 0 db 64 db 0 _crt_col label dword db 81 db 0 db 64 db 0 _crta32 label word db 82 db 254 _DATA ends _BSS segment word public 'BSS' db 2 dup (?) _BSS ends _TEXT segment byte public 'CODE' ; ; void interrupt kbint() ; assume cs:_TEXT _kbint proc far push ax push bx push cx push dx push es push ds push si push di push bp mov bp,DGROUP mov ds,bp mov bp,sp dec sp dec sp ; ; { ; static int c; ; ; c = inportb(0x60); ; mov dx,96 in al,dx mov ah,0 mov word ptr DGROUP:b@w+0,ax ; ; ck = inportb(0x61); ; mov dx,97 in al,dx mov ah,0 mov word ptr DGROUP:_ck,ax ; ; outportb(0x61, ck | 0x80); ; mov al,byte ptr DGROUP:_ck or al,128 mov dx,97 out dx,al ; ; outportb(0x61, ck); ; mov dx,97 mov al,byte ptr DGROUP:_ck out dx,al ; ; ; switch(c) ; mov ax,word ptr DGROUP:b@w+0 mov word ptr [bp-2],ax mov cx,13 mov bx,offset @1@C2118 @1@98: mov ax,word ptr cs:[bx] cmp ax,word ptr [bp-2] je short @1@170 inc bx inc bx loop short @1@98 jmp @1@506 @1@170: jmp word ptr cs:[bx+26] @1@194: ; ; { ; case 0x4B : /* Arrow Left */ ; kb->kf02 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],2 ; ; cb = c; ; mov ax,word ptr DGROUP:b@w+0 mov word ptr DGROUP:_cb,ax ; ; break; ; jmp @1@698 @1@218: ; ; case 0xCB : ; kb->kf02 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],253 ; ; cb = 0; ; mov word ptr DGROUP:_cb,0 ; ; break; ; jmp @1@698 @1@242: ; ; case 0x50 : /* Arrow Down */ ; kb->kf02 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],2 ; ; cb = c; ; mov ax,word ptr DGROUP:b@w+0 mov word ptr DGROUP:_cb,ax ; ; break; ; jmp @1@698 @1@266: ; ; case 0xD0 : ; kb->kf02 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],253 ; ; cb = 0; ; mov word ptr DGROUP:_cb,0 ; ; break; ; jmp @1@698 @1@290: ; ; case 0x2A : /* Shift Left */ ; kb->kf02 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],2 ; ; SFlag = 1; ; mov word ptr DGROUP:_SFlag,1 ; ; break; ; jmp @1@698 @1@314: ; ; case 0xAA : ; kb->kf02 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],253 ; ; SFlag = 0; ; mov word ptr DGROUP:_SFlag,0 ; ; break; ; jmp @1@698 @1@338: ; ; case 0x36 : /* Shift Right */ ; kb->kf01 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],1 ; ; SFlag = 1; ; mov word ptr DGROUP:_SFlag,1 ; ; break; ; jmp @1@698 @1@362: ; ; case 0xB6 : ; kb->kf01 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],254 ; ; SFlag = 0; ; mov word ptr DGROUP:_SFlag,0 ; ; break; ; jmp @1@698 @1@386: ; ; case 0x38 : /* Alt */ ; kb->kf04 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],8 ; ; MWB00T( 0xB002, MRead( 0xB002 ) & 0xBF ); ; mov ax,45058 push ax call near ptr _MRead pop cx and ax,191 push ax mov ax,45058 push ax call near ptr _MWB00T pop cx pop cx ; ; break; ; jmp @1@698 @1@410: ; ; case 0xB8 : ; kb->kf04 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],247 ; ; MWB00T( 0xB002, MRead( 0xB002 ) | 0x40 ); ; mov ax,45058 push ax call near ptr _MRead pop cx or ax,64 push ax mov ax,45058 push ax call near ptr _MWB00T pop cx pop cx ; ; break; ; jmp short @1@698 @1@434: ; ; ; // case 0x3A : /* Caps Lock */ ; // kb->kf15 = 1; ; // break; ; // case 0xBA : ; // kb->kf07 = !kb->kf07; ; // kb->kf15 = 0; ; // break; ; // case 0x45 : /* Num Lock */ ; // kb->kf14 = 1; ; // break; ; // case 0xC5 : ; // kb->kf06 = !kb->kf06; ; // kb->kf14 = 0; ; // break; ; ; case 0x1D : /* Control */ ; kb->kf03 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],4 ; ; kb->kf09 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx+1],1 ; ; Control = 0xBF; ; mov word ptr DGROUP:_Control,191 ; ; break; ; jmp short @1@698 @1@458: ; ; case 0x9D : ; kb->kf03 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],251 ; ; kb->kf09 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],254 ; ; Control = 0xFF; ; mov word ptr DGROUP:_Control,255 ; ; break; ; jmp short @1@698 @1@482: ; ; case 0xE0 : /* Enhanced Kb Code */ ; break; ; jmp short @1@698 @1@506: ; ; default: ; if (c < 0x80) ; cmp word ptr DGROUP:b@w+0,128 jge short @1@650 ; ; { ; if (c > 0x3A && c < 0x45) /* F1 = 0x3B ... F10 = 0x44 */ ; cmp word ptr DGROUP:b@w+0,58 jle short @1@602 cmp word ptr DGROUP:b@w+0,69 jge short @1@602 ; ; FKey = TRUE; ; mov word ptr DGROUP:_FKey,1 jmp short @1@626 @1@602: ; ; else ; FKey = FALSE; ; mov word ptr DGROUP:_FKey,0 @1@626: ; ; cb = c; ; mov ax,word ptr DGROUP:b@w+0 mov word ptr DGROUP:_cb,ax ; ; } ; jmp short @1@674 @1@650: ; ; else ; cb = 0x00; ; mov word ptr DGROUP:_cb,0 @1@674: ; ; break; ; jmp short @1@698 @1@698: ; ; } ; ; outportb(0x20, 0x20); ; mov dx,32 mov al,32 out dx,al ; ; } ; mov sp,bp pop bp pop di pop si pop ds pop es pop dx pop cx pop bx pop ax iret _kbint endp @1@C2118 label word db 29 db 0 db 42 db 0 db 54 db 0 db 56 db 0 db 75 db 0 db 80 db 0 db 157 db 0 db 170 db 0 db 182 db 0 db 184 db 0 db 203 db 0 db 208 db 0 db 224 db 0 dw @1@434 dw @1@290 dw @1@338 dw @1@386 dw @1@194 dw @1@242 dw @1@458 dw @1@314 dw @1@362 dw @1@410 dw @1@218 dw @1@266 dw @1@482 ; ; void main( int argc, char **argv ) ; assume cs:_TEXT _main proc near push bp mov bp,sp sub sp,70 push si push di ; ; { ; char fn[64]; ; int c, ini = 0, r; ; xor di,di ; ; char b; ; unsigned la = 0x2900; /* Default Load Address */ ; mov word ptr [bp-6],10496 ; ; ; clrscr(); ; call near ptr _clrscr ; ; fprintf(stderr, "\ ; ; ; ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n\ ; º ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ º\n\ ; º ³ Acorn Atom Emulator version 0.9 á ³ º\n\ ; º ³ with R65C02 Processor ³ º\n\ ; º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ º\n\ ; ÌÍÍÍÍÍÍ» ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÉÍÍÍÍÍ͹\n\ ; ºACORN º ³ (c) Dick Bronsdijk ³ ºACORN º\n\ ; ºATOM º ³ Graphics (c) R. Leurs ³ ºATOM º\n\ ; º> º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ º> º\n\ ; ÈÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍͼ\n\ ; \n"); ; push ds mov ax,offset DGROUP:s@ push ax push ds mov ax,offset DGROUP:__streams+40 push ax call near ptr _fprintf add sp,8 ; ; ; sleep(1); ; mov ax,1 push ax call near ptr _sleep pop cx ; ; window( 1, 1, 80, 25); ; mov ax,25 push ax mov ax,80 push ax mov ax,1 push ax mov ax,1 push ax call near ptr _window add sp,8 ; ; gotoxy(1, 11); ; mov ax,11 push ax mov ax,1 push ax call near ptr _gotoxy pop cx pop cx ; ; ; MWrite( 0xFFFC, 0x00 ); /* Default ProgramCounter value at Start */ ; xor ax,ax push ax mov ax,65532 push ax call near ptr _MWrite pop cx pop cx ; ; MWrite( 0xFFFD, 0x00 ); ; xor ax,ax push ax mov ax,65533 push ax call near ptr _MWrite pop cx pop cx ; ; ; MWrite( 0xBFFF, 0x07 ); /* Select rom 7 */ ; mov ax,7 push ax mov ax,49151 push ax call near ptr _MWrite pop cx pop cx ; ; ; fn[0] = '\0'; ; mov byte ptr [bp-70],0 ; ; for (c = 1; c < argc; c++) ; mov si,1 jmp @2@602 @2@50: ; ; { ; if (argv[c][0] == '-' || argv[c][0] == '/') ; mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax les bx,dword ptr es:[bx] cmp byte ptr es:[bx],45 je short @2@98 mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax les bx,dword ptr es:[bx] cmp byte ptr es:[bx],47 je @@0 jmp @2@338 @@0: @2@98: ; ; switch(tolower(argv[c][1])) ; mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax les bx,dword ptr es:[bx] mov al,byte ptr es:[bx+1] cbw push ax call near ptr _tolower pop cx sub ax,98 mov bx,ax cmp bx,16 jbe @@1 jmp @2@314 @@1: shl bx,1 jmp word ptr cs:@2@C4050[bx] @2@170: ; ; { ; case 'b' : ; sscanf(&(argv[c][2]), "%x", &la); /* Load Address */ ; push ss lea ax,word ptr [bp-6] push ax push ds mov ax,offset DGROUP:s@+646 push ax mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax mov ax,word ptr es:[bx] inc ax inc ax push word ptr es:[bx+2] push ax call near ptr _sscanf add sp,12 ; ; b = 'b'; ; mov byte ptr [bp-3],98 ; ; break; ; jmp @2@314 @2@194: ; ; case 'r' : ; sscanf(&(argv[c][2]), "%x", &r); /* Rom Number */ ; push ss lea ax,word ptr [bp-2] push ax push ds mov ax,offset DGROUP:s@+649 push ax mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax mov ax,word ptr es:[bx] inc ax inc ax push word ptr es:[bx+2] push ax call near ptr _sscanf add sp,12 ; ; MWrite( 0xBFFF, r ); ; push word ptr [bp-2] mov ax,49151 push ax call near ptr _MWrite pop cx pop cx ; ; cprintf ("Eprom selected : %d\r\n", r); ; push word ptr [bp-2] push ds mov ax,offset DGROUP:s@+652 push ax call near ptr _cprintf add sp,6 ; ; b = 'r'; ; mov byte ptr [bp-3],114 ; ; break; ; jmp short @2@314 @2@218: ; ; case 'i' : ; b = 'i'; ; mov byte ptr [bp-3],105 ; ; break; ; jmp short @2@314 @2@242: ; ; case 'd' : ; dflag = 1; ; mov word ptr DGROUP:_dflag,1 ; ; break; ; jmp short @2@314 @2@266: ; ; case 'm' : ; RunMode = 1; ; mov word ptr DGROUP:_RunMode,1 ; ; break; ; jmp short @2@314 @2@290: ; ; case 'p' : ; pflag = 1; ; mov word ptr DGROUP:_pflag,1 ; ; *pn = '\0'; ; mov byte ptr DGROUP:_pn,0 ; ; sscanf(&(argv[c][2]), "%s", &pn); /* Printer Output */ ; push ds mov ax,offset DGROUP:_pn push ax push ds mov ax,offset DGROUP:s@+674 push ax mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax mov ax,word ptr es:[bx] inc ax inc ax push word ptr es:[bx+2] push ax call near ptr _sscanf add sp,12 ; ; break; ; jmp short @2@314 @2@314: ; ; } ; jmp @2@578 @2@338: ; ; else ; { ; strcpy(fn, argv[c]); ; mov ax,si shl ax,1 shl ax,1 les bx,dword ptr [bp+6] add bx,ax push word ptr es:[bx+2] push word ptr es:[bx] push ss lea ax,word ptr [bp-70] push ax call near ptr _strcpy add sp,8 ; ; if (access(fn, 0) == 0) ; xor ax,ax push ax push ss lea ax,word ptr [bp-70] push ax call near ptr _access add sp,6 or ax,ax jne short @2@482 ; ; { ; if (b == 'b') ; cmp byte ptr [bp-3],98 jne short @2@410 ; ; LoadProg( fn, la ); ; push word ptr [bp-6] push ss lea ax,word ptr [bp-70] push ax call near ptr _LoadProg add sp,6 jmp short @2@458 @2@410: ; ; else if (b == 'i') ; cmp byte ptr [bp-3],105 jne short @2@458 ; ; HexRead( fn ); ; push ss lea ax,word ptr [bp-70] push ax call near ptr _HexRead pop cx pop cx @2@458: ; ; } ; jmp short @2@554 @2@482: ; ; else ; if (!ProcessIni( fn )) ; push ss lea ax,word ptr [bp-70] push ax call near ptr _ProcessIni pop cx pop cx or ax,ax jne short @2@530 ; ; cprintf("File/Label '%s' not found\r\n", fn); ; push ss lea ax,word ptr [bp-70] push ax push ds mov ax,offset DGROUP:s@+677 push ax call near ptr _cprintf add sp,8 jmp short @2@554 @2@530: ; ; else ; ini++; ; inc di @2@554: ; ; fn[0] = '\0'; ; mov byte ptr [bp-70],0 @2@578: inc si @2@602: cmp si,word ptr [bp+4] jge @@2 jmp @2@50 @@2: ; ; } ; } ; ; if (!ini) ; or di,di jne short @2@698 ; ; if (!ProcessIni( "ATOM9" )) ; push ds mov ax,offset DGROUP:s@+705 push ax call near ptr _ProcessIni pop cx pop cx or ax,ax jne short @2@698 ; ; cprintf("Label '%s' not found\r\n", fn); ; push ss lea ax,word ptr [bp-70] push ax push ds mov ax,offset DGROUP:s@+711 push ax call near ptr _cprintf add sp,8 @2@698: ; ; ; if (dflag) ; cmp word ptr DGROUP:_dflag,0 je short @2@770 ; ; if ((f_out = fopen( "xray.xxx", "w")) == NULL) ; push ds mov ax,offset DGROUP:s@+743 push ax push ds mov ax,offset DGROUP:s@+734 push ax call near ptr _fopen add sp,8 mov word ptr DGROUP:_f_out+2,dx mov word ptr DGROUP:_f_out,ax or ax,dx jne short @2@770 ; ; { ; fprintf(stderr, "Debug file can't open\n"); ; push ds mov ax,offset DGROUP:s@+745 push ax push ds mov ax,offset DGROUP:__streams+40 push ax call near ptr _fprintf add sp,8 ; ; exit(1); ; mov ax,1 push ax call near ptr _exit pop cx @2@770: ; ; } ; ; if (pflag) ; cmp word ptr DGROUP:_pflag,0 jne @@3 jmp @2@962 @@3: ; ; if (strlen(pn) > 0) ; push ds mov ax,offset DGROUP:_pn push ax call near ptr _strlen pop cx pop cx or ax,ax jbe short @2@938 ; ; { ; if ((printer = fopen( pn, "w")) == NULL) ; push ds mov ax,offset DGROUP:s@+768 push ax push ds mov ax,offset DGROUP:_pn push ax call near ptr _fopen add sp,8 mov word ptr DGROUP:_printer+2,dx mov word ptr DGROUP:_printer,ax or ax,dx jne short @2@866 ; ; { ; fprintf(stderr, "Print file can't open\n"); ; push ds mov ax,offset DGROUP:s@+770 push ax push ds mov ax,offset DGROUP:__streams+40 push ax call near ptr _fprintf add sp,8 ; ; exit(1); ; mov ax,1 push ax call near ptr _exit pop cx ; ; } ; jmp short @2@914 @2@866: ; ; else ; if (RunMode) ; cmp word ptr DGROUP:_RunMode,0 je short @2@914 ; ; cprintf("Printer = %s\r\n", pn); ; push ds mov ax,offset DGROUP:_pn push ax push ds mov ax,offset DGROUP:s@+793 push ax call near ptr _cprintf add sp,8 @2@914: ; ; } ; jmp short @2@962 @2@938: ; ; else ; { ; printer = stdprn; ; mov word ptr DGROUP:_printer+2,ds mov word ptr DGROUP:_printer,offset DGROUP:__streams+80 ; ; cprintf("Printer = %s\r\n", stdprn); ; push ds mov ax,offset DGROUP:__streams+80 push ax push ds mov ax,offset DGROUP:s@+808 push ax call near ptr _cprintf add sp,8 @2@962: ; ; } ; ; if (RunMode) ; cmp word ptr DGROUP:_RunMode,0 je short @2@1010 ; ; { ; cprintf("\r\n\nPress any key to continue"); ; push ds mov ax,offset DGROUP:s@+823 push ax call near ptr _cprintf pop cx pop cx ; ; bioskey(0); ; xor ax,ax push ax call near ptr _bioskey pop cx @2@1010: ; ; } ; ; crta80 = (MRead( 0x0209 ) << 8 ) + MRead( 0x0208 ); ; mov ax,521 push ax call near ptr _MRead pop cx mov cl,8 shl ax,cl push ax mov ax,520 push ax call near ptr _MRead pop cx pop dx add dx,ax mov word ptr DGROUP:_crta80,dx ; ; ; fast6502(); ; call near ptr _fast6502 ; ; ; if (pflag) ; cmp word ptr DGROUP:_pflag,0 je short @2@1058 ; ; fclose(printer); ; push word ptr DGROUP:_printer+2 push word ptr DGROUP:_printer call near ptr _fclose pop cx pop cx @2@1058: ; ; if (dflag) ; cmp word ptr DGROUP:_dflag,0 je short @2@1106 ; ; fclose(f_out); ; push word ptr DGROUP:_f_out+2 push word ptr DGROUP:_f_out call near ptr _fclose pop cx pop cx @2@1106: ; ; if (fd != NULL) ; mov ax,word ptr DGROUP:_fd or ax,word ptr DGROUP:_fd+2 je short @2@1154 ; ; fclose(fd); ; push word ptr DGROUP:_fd+2 push word ptr DGROUP:_fd call near ptr _fclose pop cx pop cx @2@1154: ; ; ; gotoxy(1, 24); ; mov ax,24 push ax mov ax,1 push ax call near ptr _gotoxy pop cx pop cx ; ; } ; pop di pop si mov sp,bp pop bp ret _main endp @2@C4050 label word dw @2@170 dw @2@314 dw @2@242 dw @2@314 dw @2@314 dw @2@314 dw @2@314 dw @2@218 dw @2@314 dw @2@314 dw @2@314 dw @2@266 dw @2@314 dw @2@314 dw @2@290 dw @2@314 dw @2@194 ; ; void fast6502( void ) ; assume cs:_TEXT _fast6502 proc near push bp mov bp,sp ; ; { ; clrscr(); ; call near ptr _clrscr ; ; gettext(1, 1, 80, 25, crt80); ; push ds mov ax,offset DGROUP:_crt80 push ax mov ax,25 push ax mov ax,80 push ax mov ax,1 push ax mov ax,1 push ax call near ptr _gettext add sp,12 ; ; crt_col8 = 1; ; mov byte ptr DGROUP:_crt_col8,1 ; ; crt_row8 = 1; ; mov byte ptr DGROUP:_crt_row8,1 ; ; CrtOutput = TRUE; ; mov word ptr DGROUP:_CrtOutput,1 ; ; MWrite( 0xBFFE, 1 ); ; mov ax,1 push ax mov ax,49150 push ax call near ptr _MWrite pop cx pop cx ; ; ; Init_6502(); ; call near ptr _Init_6502 ; ; ; Stop = 0; ; mov word ptr DGROUP:_Stop,0 ; ; ; kb->kf01 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],254 ; ; kb->kf02 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],253 ; ; kb->kf03 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],251 ; ; kb->kf07 = 1; ; les bx,dword ptr DGROUP:_kb or byte ptr es:[bx],64 ; ; kb->kf09 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],254 ; ; kb->kf14 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],223 ; ; kb->kf15 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],191 ; ; ; org = getvect(0x09); ; mov ax,9 push ax call near ptr _getvect pop cx mov word ptr DGROUP:_org+2,dx mov word ptr DGROUP:_org,ax ; ; setvect(0x09, kbint); ; push cs mov ax,offset _kbint push ax mov ax,9 push ax call near ptr _setvect add sp,6 ; ; cb = 0x00; ; mov word ptr DGROUP:_cb,0 ; ; ; ProcessOpcode(); ; call near ptr _ProcessOpcode ; ; ; setvect(0x09, org); ; push word ptr DGROUP:_org+2 push word ptr DGROUP:_org mov ax,9 push ax call near ptr _setvect add sp,6 ; ; ; kb->kf01 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],254 ; ; kb->kf02 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],253 ; ; kb->kf03 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],251 ; ; kb->kf07 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx],191 ; ; kb->kf09 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],254 ; ; kb->kf14 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],223 ; ; kb->kf15 = 0; ; les bx,dword ptr DGROUP:_kb and byte ptr es:[bx+1],191 ; ; SwitchCrt( TRUE ); ; mov ax,1 push ax call near ptr _SwitchCrt pop cx ; ; } ; pop bp ret _fast6502 endp ; ; void SwitchCrt( int Mode ) ; assume cs:_TEXT _SwitchCrt proc near push bp mov bp,sp push si push di mov di,word ptr [bp+4] ; ; { ; unsigned i; ; ; if (Mode == FALSE) /* Set mode to 0 : Atom Crt */ ; or di,di jne short @4@218 ; ; { ; if (CrtOutput) ; cmp word ptr DGROUP:_CrtOutput,0 je short @4@98 ; ; { ; gettext(1, 1, 80, 25, crt80); ; push ds mov ax,offset DGROUP:_crt80 push ax mov ax,25 push ax mov ax,80 push ax mov ax,1 push ax mov ax,1 push ax call near ptr _gettext add sp,12 ; ; crt_col8 = wherex(); ; call near ptr _wherex mov byte ptr DGROUP:_crt_col8,al ; ; crt_row8 = wherey(); ; call near ptr _wherey mov byte ptr DGROUP:_crt_row8,al @4@98: ; ; } ; grafix(); ; call near ptr _grafix ; ; /* ; regs.x.ax = 0x0004; ; int86(0x10, ®s, ®s); ; crta80 = (MRead( 0x0209 ) << 8 ) + MRead( 0x0208 ); ; MWrite( 0x0208, crta32 & 0xFF ); ; MWrite( 0x0209, crta32 >> 8 ); ; MWrite( 0xFF9E, crta32 & 0xFF ); ; MWrite( 0xFF9F, crta32 >> 8 ); ; */ ; CrtOutput = FALSE; ; mov word ptr DGROUP:_CrtOutput,0 ; ; for (i = 0x8000; i < 0x9800; i++) ; mov si,32768 jmp short @4@170 @4@122: ; ; MWrite( i, MRead( i )); ; push si call near ptr _MRead pop cx push ax push si call near ptr _MWrite pop cx pop cx inc si @4@170: cmp si,38912 jb short @4@122 ; ; } ; jmp short @4@266 @4@218: ; ; else if (Mode == TRUE) /* Set mode to 1 : 80 Coloms */ ; cmp di,1 jne short @4@266 ; ; { ; /* ; regs.x.ax = 0x0003; ; int86(0x10, ®s, ®s); ; */ ; text8(); ; call near ptr _text8 ; ; puttext(1, 1, 80, 25, crt80); ; push ds mov ax,offset DGROUP:_crt80 push ax mov ax,25 push ax mov ax,80 push ax mov ax,1 push ax mov ax,1 push ax call near ptr _puttext add sp,12 ; ; gotoxy( crt_col8, crt_row8); ; mov al,byte ptr DGROUP:_crt_row8 mov ah,0 push ax mov al,byte ptr DGROUP:_crt_col8 mov ah,0 push ax call near ptr _gotoxy pop cx pop cx ; ; /* ; crta32 = (MRead( 0x0209 ) << 8 ) + MRead( 0x0208 ); ; MWrite( 0x0208, crta80 & 0xFF ); ; MWrite( 0x0209, crta80 >> 8 ); ; MWrite( 0xFF9E, crta80 & 0xFF ); ; MWrite( 0xFF9F, crta80 >> 8 ); ; */ ; CrtOutput = TRUE; ; mov word ptr DGROUP:_CrtOutput,1 @4@266: ; ; } ; } ; pop di pop si pop bp ret _SwitchCrt endp ; ; void Init_6502( void ) ; assume cs:_TEXT _Init_6502 proc near push bp mov bp,sp ; ; { ; if (kb->kf03) /* Control Key */ ; les bx,dword ptr DGROUP:_kb mov al,byte ptr es:[bx] shr ax,1 shr ax,1 and ax,1 or ax,ax je short @5@74 ; ; PC = MRead( 0xFFFC) + (MRead( 0xFFFD ) << 8); ; mov ax,65532 push ax call near ptr _MRead pop cx push ax mov ax,65533 push ax call near ptr _MRead pop cx mov cl,8 shl ax,cl pop dx add dx,ax mov word ptr DGROUP:_PC,dx jmp short @5@98 @5@74: ; ; else ; PC = AltBoot; ; mov ax,word ptr DGROUP:_AltBoot mov word ptr DGROUP:_PC,ax @5@98: ; ; SP = 0xFF; ; mov byte ptr DGROUP:_SP,255 ; ; P.P= 0x0000; ; mov word ptr DGROUP:_P,0 ; ; P.F.I = 1; ; or byte ptr DGROUP:_P,4 ; ; X = 0x00; ; mov byte ptr DGROUP:_X,0 ; ; Y = 0x00; ; mov byte ptr DGROUP:_Y,0 ; ; A = 0x00; ; mov byte ptr DGROUP:_A,0 ; ; ; /* Atom specific Functions */ ; MWrite( 0xB000, 0x00 ); /* Set KB Scan counter */ ; xor ax,ax push ax mov ax,45056 push ax call near ptr _MWrite pop cx pop cx ; ; MWB00T( 0xB001, 0xFF ); /* No key pressed */ ; mov ax,255 push ax mov ax,45057 push ax call near ptr _MWB00T pop cx pop cx ; ; MWB00T( 0xB002, 0xFF ); /* No Repeat key */ ; mov ax,255 push ax mov ax,45058 push ax call near ptr _MWB00T pop cx pop cx ; ; MWrite( 0xB80C, 0x00 ); /* Zet printer uit */ ; xor ax,ax push ax mov ax,47116 push ax call near ptr _MWrite pop cx pop cx ; ; MWrite( 0xBFFF, 0x07 ); /* Set RomSwitch to 7 */ ; mov ax,7 push ax mov ax,49151 push ax call near ptr _MWrite pop cx pop cx ; ;