Download HTBLuVA Wien V
Transcript
HTBLuVA Wien V Abteilung: Ausbildungsschwerpunkt: Informatik Intelligente Systeme, Tools und Methodik str1: STRING "loooping" str2: STRING "done loooping" IO There are a number of commands which can be used to control hardware connected to the emulator. HIGH / LOW turn a pin on or off TOGGLE inv ert a output pin PIN read binary v alue from pin ADC read analogue value of the ADC-Pins (legacy commands: ADC0, ADC1, ADC2) Toggling LEDs main: TOGGLE 3 ; switch LED on output-pin 3 DELAY 30000 ; wait for ~450ms JMP main Reading pushbutton main: PIN 1 ; read value ; PIN will set the ; pin is on => z ; pin is off => z JNZ on JMP main from pushbutton zero -flag to 1 if the pins state is zero, so: = 0 => JNZ jumps = 1 => JZ jumps on: TOGGLE 3 JMP main ; toggle an LED each time a button is pressed Stack There is a 16-byte-stack which can be accessed by the fairly standard PUSH and POP-instructions. MOV b0, 0x20 MOV b1, 0x40 MOV b2, 0x60 ; w0 = 0x2040 ; w1 = 0x6000 ; initial sp = 0x50 ; b1 = 0x40 PUSH b1 ; Stack = 0x40 ; sp = 0x51 ; b0 = 0x20 PUSH b0 ; Stack = 0x40 0x20 ; sp = 0x52 Seite 139 von 197