APU mmio area: hack-ready
git-svn-id: svn://kolibrios.org@3519 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a0f9d2e236
commit
bcdfe175d7
@ -62,10 +62,6 @@ cfgmanager:
|
||||
; mov [es:0x901C], al
|
||||
|
||||
|
||||
; VRR_M USE
|
||||
|
||||
; mov [es:0x9030], byte 2
|
||||
|
||||
; BOOT DEVICE
|
||||
|
||||
xor ax, ax
|
||||
|
@ -145,7 +145,7 @@ rs7xx_pcie_init:
|
||||
; (eax = phys. address of PCIe conf.space)
|
||||
;
|
||||
map_pcie_pages:
|
||||
or eax, (PG_NOCACHE + PG_SHARED + PG_LARGE + PG_UW) ; UW is unsafe, fix it!
|
||||
or eax, (PG_NOCACHE + PG_SHARED + PG_LARGE + PG_UW) ; UW is unsafe!
|
||||
mov ecx, PCIe_CONFIG_SPACE ; linear address
|
||||
mov ebx, ecx
|
||||
shr ebx, 20
|
||||
@ -163,13 +163,9 @@ map_pcie_pages:
|
||||
add eax, 0x400000 ; +4M phys.
|
||||
add ecx, 0x400000 ; +4M lin.
|
||||
cmp dl, byte[mmio_pcie_cfg_pdes-OS_BASE]
|
||||
jae .pcie_cfg_mapped
|
||||
jae pcie_cfg_mapped
|
||||
inc dl
|
||||
jmp .write_pde
|
||||
; mov eax, cr3
|
||||
; mov cr3, eax ; flush TLB
|
||||
.pcie_cfg_mapped:
|
||||
ret ; <<< OK >>>
|
||||
|
||||
; ---- stepping 10h CPUs and Fusion APUs: the configspace is stored in MSR_C001_0058 ----
|
||||
align 4
|
||||
@ -196,7 +192,25 @@ fusion_pcie_init:
|
||||
add edx, eax ; the upper configspace limit
|
||||
mov dword[mmio_pcie_cfg_lim-OS_BASE], edx
|
||||
|
||||
jmp map_pcie_pages
|
||||
pcie_cfg_mapped:
|
||||
|
||||
create_mmio_pte:
|
||||
|
||||
mov ecx, mmio_pte ; physical address
|
||||
or ecx, (PG_NOCACHE + PG_SHARED)
|
||||
mov ebx, FUSION_MMIO ; linear address
|
||||
shr ebx, 20
|
||||
add ebx, (sys_pgdir - OS_BASE) ; PgDir entry @
|
||||
mov dword[ebx], ecx ; Fusion MMIO tables
|
||||
|
||||
map_apic_mmio:
|
||||
mov ecx, 0x01B ; APIC BAR
|
||||
rdmsr
|
||||
and eax, 0xFFFFF000 ; physical address
|
||||
or eax, (PG_NOCACHE + PG_SHARED + PG_UW) ; UW is unsafe!
|
||||
mov dword[mmio_pte + 0], eax
|
||||
|
||||
ret ; <<< OK >>>
|
||||
|
||||
; ================================================================================
|
||||
|
||||
|
@ -206,6 +206,8 @@ PUTPIXEL equ (OS_BASE+0x0006820)
|
||||
GETPIXEL equ (OS_BASE+0x0006824)
|
||||
mouseunder equ (OS_BASE+0x0006900)
|
||||
|
||||
IDE_DMA equ 0x0007000
|
||||
|
||||
|
||||
|
||||
MOUSE_VISIBLE equ (OS_BASE+0x000F204)
|
||||
@ -266,19 +268,18 @@ MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
|
||||
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)
|
||||
DONT_SWITCH equ (OS_BASE+0x000FFFF)
|
||||
|
||||
TMP_STACK_TOP equ 0x006CC00
|
||||
FONT_II equ (OS_BASE+0x005DC00)
|
||||
FONT_I equ (OS_BASE+0x005E600)
|
||||
|
||||
FONT_II equ (OS_BASE+0x006DC00)
|
||||
FONT_I equ (OS_BASE+0x006E600)
|
||||
TMP_STACK_TOP equ 0x006C000
|
||||
|
||||
mmio_pte equ 0x006E000
|
||||
sys_pgdir equ (OS_BASE+0x006F000)
|
||||
|
||||
DRIVE_DATA equ (OS_BASE+0x0070000)
|
||||
|
||||
SLOT_BASE equ (OS_BASE+0x0080000)
|
||||
|
||||
;unused
|
||||
;TMP_BUFF equ (OS_BASE+0x0090000)
|
||||
|
||||
;VGABasePtr equ (OS_BASE+0x00A0000)
|
||||
|
||||
@ -286,25 +287,18 @@ RAMDISK equ (OS_BASE+0x0100000)
|
||||
RAMDISK_FAT equ (OS_BASE+0x0280000)
|
||||
|
||||
CLEAN_ZONE equ 0x280000
|
||||
IDE_DMA equ 0x284000
|
||||
|
||||
BgrAuxTable equ (OS_BASE+0x0298000)
|
||||
; unused?
|
||||
SB16Buffer equ (OS_BASE+0x02A0000)
|
||||
SB16_Status equ (OS_BASE+0x02B0000)
|
||||
|
||||
BUTTON_INFO equ (OS_BASE+0x02C0000)
|
||||
RESERVED_PORTS equ (OS_BASE+0x02D0000)
|
||||
IRQ_SAVE equ (OS_BASE+0x02E0000)
|
||||
;BOOT_VAR equ (OS_BASE+0x02F0000)
|
||||
|
||||
|
||||
stack_data_start equ (OS_BASE+0x0300000)
|
||||
eth_data_start equ (OS_BASE+0x0300000)
|
||||
stack_data equ (OS_BASE+0x0304000)
|
||||
stack_data_end equ (OS_BASE+0x031ffff)
|
||||
resendQ equ (OS_BASE+0x0320000)
|
||||
;VMODE_BASE equ (OS_BASE+0x0328000)
|
||||
BgrAuxTable equ (OS_BASE+0x0328000)
|
||||
skin_data equ (OS_BASE+0x0330000)
|
||||
draw_data equ (OS_BASE+0x0338000);
|
||||
|
||||
@ -327,6 +321,8 @@ HEAP_MIN_SIZE equ 0x02000000
|
||||
PCIe_CONFIG_SPACE equ 0xF0000000
|
||||
USER_DMA_BUFFER equ 0xFD000000 ; linear addr.
|
||||
USER_DMA_SIZE equ 0x00800000
|
||||
FUSION_MMIO equ 0xFD800000
|
||||
LAPIC_BAR equ 0xFD800000 ; ==
|
||||
|
||||
page_tabs equ 0xFDC00000
|
||||
app_page_tabs equ 0xFDC00000
|
||||
|
@ -20,7 +20,6 @@ irq0:
|
||||
mov es, ax
|
||||
inc [timer_ticks]
|
||||
mov eax, [timer_ticks]
|
||||
; call playNote ; <<<--- Speaker driver
|
||||
sub eax,[next_usage_update]
|
||||
cmp eax,100
|
||||
jb .nocounter
|
||||
|
@ -105,7 +105,7 @@ char2 db '/sys/FONTS/CHAR2.MT',0
|
||||
bootpath db '/KOLIBRI '
|
||||
bootpath2 db 0
|
||||
vmode db '/sys/drivers/VMODE.MDR',0
|
||||
vrr_m db 'VRR_M',0
|
||||
;vrr_m db 'VRR_M',0
|
||||
kernel_file db 'KERNEL MNT'
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision$
|
||||
|
||||
|
||||
;***************************************************
|
||||
; ïðåäâàðèòåëüíàÿ î÷èñòêà îáëàñòè òàáëèöû
|
||||
; ïîèñê è çàíåñåíèå â òàáëèöó ïðèâîäîâ FDD
|
||||
; àâòîð Mario79
|
||||
;***************************************************
|
||||
xor eax,eax
|
||||
mov edi,DRIVE_DATA
|
||||
mov ecx,16384
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov al,0x10
|
||||
out 0x70,al
|
||||
mov cx,0xff
|
||||
wait_cmos:
|
||||
dec cx
|
||||
test cx,cx
|
||||
jnz wait_cmos
|
||||
in al,0x71
|
||||
mov [DRIVE_DATA],al
|
@ -21,25 +21,13 @@ FindHDD:
|
||||
mov [ChannelNumber],1
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov ax,[Sector512+176]
|
||||
; mov [DRIVE_DATA+6],ax
|
||||
; mov ax,[Sector512+126]
|
||||
; mov [DRIVE_DATA+8],ax
|
||||
; mov ax,[Sector512+128]
|
||||
; mov [DRIVE_DATA+8],ax
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+7],al
|
||||
inc [ChannelNumber]
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+8],al
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_1
|
||||
; mov al,[Sector512+176]
|
||||
; mov [DRIVE_DATA+9],al
|
||||
|
||||
jmp EndFindHDD
|
||||
|
||||
@ -57,9 +45,9 @@ FindHDD_1:
|
||||
call DeviceReset
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
call ReadCD_ID
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
; call ReadCD_ID
|
||||
; cmp [DevErrorCode],0
|
||||
; jne FindHDD_2_2
|
||||
inc byte [DRIVE_DATA+1]
|
||||
inc byte [DRIVE_DATA+1]
|
||||
FindHDD_2_2:
|
||||
@ -111,8 +99,6 @@ ReadHDD_ID:
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitCompleet
|
||||
; Принять блок данных от контроллера
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;регистр данных
|
||||
mov CX,256 ;число считываемых слов
|
||||
@ -201,17 +187,10 @@ SendCommandToHDD:
|
||||
; Ожидать, пока диск не будет готов
|
||||
inc DX
|
||||
mov ecx,0xfff
|
||||
; mov eax,[timer_ticks]
|
||||
; mov [TickCounter_1],eax
|
||||
@@WaitHDReady:
|
||||
; Проверить время ожидани
|
||||
dec ecx
|
||||
; cmp ecx,0
|
||||
jz @@Err1
|
||||
; mov eax,[timer_ticks]
|
||||
; sub eax,[TickCounter_1]
|
||||
; cmp eax,300 ;îæèäàòü 300 òèêîâ
|
||||
; ja @@Err1 ;îøèáêà òàéì-àóòà
|
||||
; Прочитать регистр состояни
|
||||
in AL,DX
|
||||
; Проверить состояние сигнала BSY
|
||||
@ -270,6 +249,7 @@ SendCommandToHDD:
|
||||
; Завершение работы программы
|
||||
ret
|
||||
|
||||
if 0
|
||||
;*************************************************
|
||||
;* ЧТЕНИЕ ИДЕНТИФИКАТОРА УСТРОЙСТВА ATAPI *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
@ -299,7 +279,6 @@ ReadCD_ID:
|
||||
@@WaitCompleet_1:
|
||||
; Проверить врем
|
||||
dec ecx
|
||||
; cmp ecx,0
|
||||
jz @@Error1_1 ;ошибка тайм-аута
|
||||
; Проверить готовность
|
||||
in AL,DX
|
||||
@ -310,8 +289,6 @@ ReadCD_ID:
|
||||
test AL,08h ;состояние сигнала DRQ
|
||||
jz @@WaitCompleet_1
|
||||
; Принять блок данных от контроллера
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;порт 1x0h
|
||||
mov CX,256 ;число считываемых слов
|
||||
@ -326,6 +303,8 @@ ReadCD_ID:
|
||||
@@End_1:
|
||||
ret
|
||||
|
||||
end if
|
||||
|
||||
;*************************************************
|
||||
;* СБРОС УСТРОЙСТВА *
|
||||
;* Входные параметры передаются через глобальные *
|
||||
|
@ -8,7 +8,7 @@
|
||||
$Revision$
|
||||
|
||||
|
||||
include 'dev_fd.inc'
|
||||
;include 'dev_fd.inc'
|
||||
include 'dev_hdcd.inc'
|
||||
include 'getcache.inc'
|
||||
include 'sear_par.inc'
|
||||
|
@ -508,11 +508,11 @@ high_code:
|
||||
out 0xA1, al
|
||||
|
||||
; Enable interrupts in IDE controller
|
||||
mov al, 0
|
||||
mov dx, 0x3F6
|
||||
out dx, al
|
||||
mov dl, 0x76
|
||||
out dx, al
|
||||
; mov al, 0
|
||||
; mov dx, 0x3F6
|
||||
; out dx, al
|
||||
; mov dl, 0x76
|
||||
; out dx, al
|
||||
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
include 'detect/disks.inc'
|
||||
@ -721,7 +721,8 @@ include 'detect/disks.inc'
|
||||
|
||||
; LOAD FIRST APPLICATION
|
||||
cli
|
||||
|
||||
if 0
|
||||
<<<
|
||||
cmp byte [BOOT_VAR+0x9030],1
|
||||
jne no_load_vrr_m
|
||||
|
||||
@ -732,8 +733,8 @@ include 'detect/disks.inc'
|
||||
sub eax,2
|
||||
jz first_app_found
|
||||
|
||||
no_load_vrr_m:
|
||||
|
||||
no_load_vrr_m: <<<
|
||||
end if
|
||||
mov ebp, firstapp
|
||||
call fs_execute_from_sysdir
|
||||
|
||||
|
@ -70,14 +70,10 @@
|
||||
|
||||
; 6000 -> 68FF << free (2k5)
|
||||
|
||||
; 6900 -> 7EFF << saved picture under mouse pointer (1k5)
|
||||
; 6900 -> 6EFF << saved picture under mouse pointer (1k5)
|
||||
;
|
||||
; 7F00 -> 7FFF << SB16_Status (256) \\
|
||||
; 7000 -> EFFF HDD DMA AREA (32k)
|
||||
;
|
||||
; 8000 -> 87FF free (2k)
|
||||
; 0x80008000 -> 9FFF ramdisk fat (8k)
|
||||
|
||||
; A000 -> F9FF free (23k)
|
||||
|
||||
; FA00 byte no of keys in buffer
|
||||
; FA01 byte 'buffer'
|
||||
@ -151,11 +147,13 @@
|
||||
; -> 3B752 end_of_kernel
|
||||
; -> 3C000 not used (>200k)
|
||||
; 0x80050000 -> 090000 zero-filled zone after preinit_mem
|
||||
; 0x8006CC00 -> 6DBFF stack at boot time (4Kb)
|
||||
; 0x8006DC00 -> 5E5FF basic text font II
|
||||
; 0x8006E600 -> 5Efff basic text font I
|
||||
|
||||
; 0x8006C000 -> 6CFFF stack at boot time (4Kb)
|
||||
;
|
||||
; 0x8006DC00 -> 6E5FF basic text font II
|
||||
; 0x8006E600 -> 6Efff basic text font I
|
||||
; 0x8006F000 -> 6FFFF main page directory
|
||||
; 0x8006E000 -> 6EFFF MMIO PTE directory (4Kb)
|
||||
; 0x8006F000 -> 6FFFF main page directory (4Kb)
|
||||
|
||||
; 0x80070000 -> 7FFFF data of retrieved disks and partitions (Mario79)
|
||||
; 0x80080000 -> 8FFFF additional app info, in 256 byte steps - 256 entries
|
||||
@ -200,28 +198,16 @@
|
||||
; BC dword address of debug event memory
|
||||
; C0 5 dd thread debug registers: DR0,DR1,DR2,DR3,DR7
|
||||
;
|
||||
; 0x80090000 -> 9FFFF wav device buffer (64k) ; << SB16Buffer
|
||||
; 0x80090000 -> 9FFFF free (64k)
|
||||
; 0x800A0000 -> AFFFF screen access area << VGA legacy buffer
|
||||
; 0x800B0000 -> FFFFF bios rest in peace -area (320k), << purpose unknown
|
||||
|
||||
; 0x80100000 -> 283FFF diskette image (1m5)
|
||||
; 0x80280000 -> 9FFF ramdisk fat (8k)
|
||||
|
||||
; 0x80284000 -> HEAP_BASE zero-filled zone after preinit_mem
|
||||
; 0x80280000 -> HEAP_BASE zero-filled zone after preinit_mem
|
||||
;
|
||||
; 0x80284000 -> 28BFFF HDD DMA AREA (32k)
|
||||
; 0x8028C000 -> 297FFF free (48k)
|
||||
;
|
||||
; 0x80298000 -> 29ffff auxiliary table for background smoothing code (32k)
|
||||
;
|
||||
; 0x802A0000 -> 2Bffff free (128k)
|
||||
; 0x80328000 -> 32FFFF !vrr driver (32k)
|
||||
|
||||
|
||||
; 0x80338000 -> 338FFF draw data - 256 entries (4k)
|
||||
; 00 dword draw limit - x start
|
||||
; 04 dword draw limit - y start
|
||||
; 08 dword draw limit - x end
|
||||
; 0C dword draw limit - y end
|
||||
; 0x80339000 -> 3BFFF3 free (12k)
|
||||
; 0x80280000 -> 2Bffff free (262k)
|
||||
|
||||
; 0x802C0000 -> 2C3fff button info (8k)
|
||||
;
|
||||
@ -244,8 +230,20 @@
|
||||
; dword start port
|
||||
; dword end port
|
||||
; dword 0
|
||||
|
||||
; 0x802E0000 -> 2EFFFF irq data area (64k)
|
||||
; 0x802F0000 -> 327fff free (229k)
|
||||
|
||||
; 0x80328000 -> 29ffff auxiliary table for background smoothing code (32k)
|
||||
;
|
||||
; 0x80338000 -> 338FFF draw data - 256 entries (4k)
|
||||
; 00 dword draw limit - x start
|
||||
; 04 dword draw limit - y start
|
||||
; 08 dword draw limit - x end
|
||||
; 0C dword draw limit - y end
|
||||
; 0x80339000 -> 3BFFF3 free (12k)
|
||||
|
||||
;
|
||||
; 0x80370000 -> 37FFFF irq data area (64k)
|
||||
; 0x80380000 -> 38FFFF low memory save (64k)
|
||||
;
|
||||
; 0x80390000 -> 3AFFFF tcp memory (128k)
|
||||
@ -265,7 +263,10 @@
|
||||
; 0x80800000 ->827FFFFF kernel heap
|
||||
|
||||
; 0xF0000000 -> 0xF1FFFFFF PCI-express extended config space
|
||||
; 0xFD000000 -> 0xFD3FFFFF static system buffer 4Mb
|
||||
|
||||
; 0xFD000000 -> 0xFD7FFFFF static system buffer (8Mb reserved)
|
||||
; 0xFD800000 -> 0xFBFFFFFF CPU & Southbridge memory-mapped IO (4Mb reserved)
|
||||
; +0000..0FFF LAPIC BAR (4k)
|
||||
; 0xFDC00000 -> 0xFDFFFFFF page tables 4Mb
|
||||
; 0xFE000000 -> 0xFFFFFFFF LFB 32Mb
|
||||
; 0xFE000000 -> 0xFE7FFFFF application available LFB 8Mb
|
||||
|
@ -1,166 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; PLAYNOTE.INC version 1.1 22 November 2003 ;;
|
||||
;; ;;
|
||||
;; Player Notes for Speaker PC ;;
|
||||
;; subfunction #55 from function #55 Menuet OS ;;
|
||||
;; ;;
|
||||
;; Copyright 2003 VaStaNi ;;
|
||||
;; vastani@ukr.net ;;
|
||||
;; >>>- SIMPLY - QUICKLY - SHORTLY -<<< ;;
|
||||
;; ;;
|
||||
;; Note: playnote.txt ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision$
|
||||
|
||||
align 4
|
||||
sound_interface:
|
||||
|
||||
cmp eax,ebx ; this is subfunction #55 ?
|
||||
jne retFunc55 ; if no then return.
|
||||
|
||||
cmp byte [sound_flag],0
|
||||
jne retFunc55
|
||||
|
||||
movzx eax, byte [countDelayNote]
|
||||
or al, al ; player is busy ?
|
||||
jnz retFunc55 ; return counter delay Note
|
||||
|
||||
mov [memAdrNote],esi;edx
|
||||
call get_pid
|
||||
mov [pidProcessNote],eax
|
||||
xor eax, eax ; Ok! EAX = 0
|
||||
retFunc55:
|
||||
mov [esp+32], eax ; return value EAX for application
|
||||
ret
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
kontrOctave dw 0x4742, 0x4342, 0x3F7C, 0x3BEC, 0x388F, 0x3562
|
||||
dw 0x3264, 0x2F8F, 0x2CE4, 0x2A5F, 0x2802, 0x25BF
|
||||
memAdrNote dd 0
|
||||
pidProcessNote dd 0
|
||||
slotProcessNote dd 0
|
||||
count_timer_Note dd 1
|
||||
mem8253r42 dw 0
|
||||
countDelayNote db 0
|
||||
endg
|
||||
|
||||
playNote:
|
||||
; jmp NotPlayNotes
|
||||
mov esi, [memAdrNote]
|
||||
or esi, esi ; ESI = 0 ? - OFF Notes Play ?
|
||||
jz NotPlayNotes ; if ESI = 0 -> ignore play pocedure
|
||||
cmp eax, [count_timer_Note]
|
||||
jb NotPlayNotes
|
||||
push eax
|
||||
inc eax
|
||||
mov [count_timer_Note], eax
|
||||
mov al, [countDelayNote]
|
||||
dec al ; decrement counter Delay for Playing Note
|
||||
jz NewLoadNote@Delay
|
||||
cmp al, 0xFF ; this is first Note Play ?
|
||||
jne NextDelayNote
|
||||
;This is FIRST Note, save counter channel 2 chip 8253
|
||||
mov al, 0xB6 ; control byte to timer chip 8253
|
||||
out 0x43, al ; Send it to the control port chip 8253
|
||||
in al, 0x42 ; Read Lower byte counter channel 2 chip 8253
|
||||
mov ah, al ; AH = Lower byte counter channel 2
|
||||
in al, 0x42 ; Read Upper byte counter channel 2 chip 8253
|
||||
mov [mem8253r42], ax ; Save counter channel 2 timer chip 8253
|
||||
NewLoadNote@Delay:
|
||||
cld
|
||||
; lodsb ; load AL - counter Delay
|
||||
call ReadNoteByte
|
||||
or al, al ; THE END ?
|
||||
jz EndPlayNote
|
||||
cmp al, 0x81
|
||||
jnc NoteforOctave
|
||||
mov [countDelayNote], al
|
||||
; lodsw ; load AX - counter for Note!
|
||||
call ReadNoteByte
|
||||
mov ah,al
|
||||
call ReadNoteByte
|
||||
xchg al,ah
|
||||
jmp pokeNote
|
||||
|
||||
EndPlayNote: ; THE END Play Notes!
|
||||
in al, 0x61 ; Get contents of system port B chip 8255
|
||||
and al, 0xFC ; Turn OFF timer and speaker
|
||||
out 0x61, al ; Send out new values to port B chip 8255
|
||||
mov ax, [mem8253r42] ; memorize counter channel 2 timer chip 8253
|
||||
xchg al, ah ; reverse byte in word
|
||||
out 0x42, al ; restore Lower byte counter channel 2
|
||||
mov al, ah ; AL = Upper byte counter channel 2
|
||||
out 0x42, al ; restore Upper byte channel 2
|
||||
xor eax, eax ; EAX = 0
|
||||
mov [memAdrNote], eax ; clear header control Delay-Note string
|
||||
NextDelayNote:
|
||||
mov [countDelayNote], al ; save new counter delay Note
|
||||
pop eax
|
||||
NotPlayNotes:
|
||||
RET
|
||||
|
||||
NoteforOctave:
|
||||
sub al, 0x81 ; correction value for delay Note
|
||||
mov [countDelayNote], al ; save counter delay this new Note
|
||||
; lodsb ; load pack control code
|
||||
call ReadNoteByte
|
||||
cmp al, 0xFF ; this is PAUSE ?
|
||||
jne packCode ; no, this is PACK CODE
|
||||
in al, 0x61 ; Get contents of system port B chip 8255
|
||||
and al, 0xFC ; Turn OFF timer and speaker
|
||||
out 0x61, al ; Send out new values to port B chip 8255
|
||||
jmp saveESI
|
||||
|
||||
packCode:
|
||||
mov cl, al ; save code
|
||||
and al, 0xF ; clear upper bits
|
||||
dec al ; correction
|
||||
add al, al ; transform number to offset constant
|
||||
movsx eax, al ; EAX - offset
|
||||
add eax, dword kontrOctave ; EAX - address from constant
|
||||
mov ax, [eax] ; read constant
|
||||
shr cl, 4 ; transform for number Octave
|
||||
shr ax, cl ; calculate from Note this Octave!
|
||||
pokeNote:
|
||||
out 0x42, al ; Lower byte Out to channel 2 timer chip 8253
|
||||
mov al, ah
|
||||
out 0x42, al ; Upper byte Out to channel 2 timer chip 8253
|
||||
in al, 0x61 ; Get contents of system port B chip 8255
|
||||
or al, 3 ; Turn ON timer and speaker
|
||||
out 0x61, al ; Send out new values to port B chip 8255
|
||||
saveESI:
|
||||
; mov [memAdrNote], esi ; save new header control Delay-Note string
|
||||
pop eax
|
||||
RET
|
||||
ReadNoteByte:
|
||||
;result:
|
||||
; al - note
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
|
||||
mov eax,[pidProcessNote]
|
||||
call pid_to_slot
|
||||
test eax,eax
|
||||
jz .failed
|
||||
lea ecx,[esp+12]
|
||||
mov edx,1
|
||||
mov esi,[memAdrNote]
|
||||
inc [memAdrNote]
|
||||
|
||||
call read_process_memory
|
||||
.failed:
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop eax
|
||||
ret
|
||||
;------------------- END CODE -------------------
|
Loading…
Reference in New Issue
Block a user