Lab 1: Основы ассемблера #1

Open
ElectronixTM wants to merge 13 commits from labs/01 into main
3 changed files with 179 additions and 0 deletions
Showing only changes of commit 4c423c7acc - Show all commits

View File

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

View File

@ -1,3 +1,4 @@
#include "substitutions.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

View 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