feat: новые функции были подшиты к основному шаблону
This commit is contained in:
@ -2,6 +2,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "substitutions.h"
|
||||||
|
|
||||||
#define PortCan0 0x40
|
#define PortCan0 0x40
|
||||||
|
|
||||||
void beep(unsigned iTone, unsigned iDlit);
|
void beep(unsigned iTone, unsigned iDlit);
|
||||||
@ -27,15 +29,18 @@ int main(void) {
|
|||||||
printf("\n Читаем содержимое порта с адресом 40 с помощью функции Си \n");
|
printf("\n Читаем содержимое порта с адресом 40 с помощью функции Си \n");
|
||||||
printf("\n Для выхода из цикла - нажмите любую клавишу \n");
|
printf("\n Для выхода из цикла - нажмите любую клавишу \n");
|
||||||
|
|
||||||
while (bioskey(1) == 0) {
|
set_input_mode();
|
||||||
|
while (isKeyPressed() == 0) {
|
||||||
printf("\n Порт40 = %d", inp(PortCan0));
|
printf("\n Порт40 = %d", inp(PortCan0));
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
reset_input_mode();
|
||||||
|
|
||||||
system("pause");
|
system("pause");
|
||||||
printf("\n Читаем содержимое порта с адресом 40 ассемблером \n");
|
printf("\n Читаем содержимое порта с адресом 40 ассемблером \n");
|
||||||
|
|
||||||
while (bioskey(1) == 0) {
|
set_input_mode();
|
||||||
|
while (isKeyPressed() == 0) {
|
||||||
asm {
|
asm {
|
||||||
push ax
|
push ax
|
||||||
in al,0x40
|
in al,0x40
|
||||||
@ -45,19 +50,23 @@ int main(void) {
|
|||||||
delay(500);
|
delay(500);
|
||||||
printf("\n Порт40 = %d", Tmm);
|
printf("\n Порт40 = %d", Tmm);
|
||||||
}
|
}
|
||||||
|
reset_input_mode();
|
||||||
system("pause");
|
system("pause");
|
||||||
printf("\n Для продолжения - нажмите любую клавишу \n");
|
printf("\n Для продолжения - нажмите любую клавишу \n");
|
||||||
system("pause");
|
system("pause");
|
||||||
|
|
||||||
long *pTime = (long *)0x46C;
|
long *pTime = (long *)0x46C;
|
||||||
while (bioskey(1) == 0) {
|
set_input_mode();
|
||||||
|
while (isKeyPressed() == 0) {
|
||||||
printf("\n %ld", *pTime);
|
printf("\n %ld", *pTime);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
reset_input_mode();
|
||||||
system("pause");
|
system("pause");
|
||||||
|
|
||||||
int Time;
|
int Time;
|
||||||
while (bioskey(1) == 0) {
|
set_input_mode();
|
||||||
|
while (isKeyPressed() == 0) {
|
||||||
asm push ds
|
asm push ds
|
||||||
asm push si
|
asm push si
|
||||||
asm mov ax, 40h
|
asm mov ax, 40h
|
||||||
@ -71,6 +80,7 @@ int main(void) {
|
|||||||
printf("\n %d", Time);
|
printf("\n %d", Time);
|
||||||
delay(300);
|
delay(300);
|
||||||
}
|
}
|
||||||
|
reset_input_mode();
|
||||||
|
|
||||||
beep(400, 200);
|
beep(400, 200);
|
||||||
for (lCnt = 0; lCnt < 1000000; lCnt++) {
|
for (lCnt = 0; lCnt < 1000000; lCnt++) {
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#include "substitutions.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
9
01-asm-basics/substitutions.h
Normal file
9
01-asm-basics/substitutions.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef SUBSTITUTIONS_H
|
||||||
|
#define SUBSTITUTIONS_H
|
||||||
|
|
||||||
|
void reset_input_mode();
|
||||||
|
void set_input_mode();
|
||||||
|
void delay(unsigned int ms);
|
||||||
|
char isKeyPressed();
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user