JP Start NOP NOP NOP RET LD R0, (R1) LD (R0), R1 LD R0, R1 LD R0, 1 LD (R0 + 1), R1 ;LD (R0), (R1) LD D1, R0, 1 LD D1, R0, R1 JP Start NOP NOP NOP VAR DeviceConsole 1 VAR ConsoleReadChar 0 VAR ConsoleWriteChar 0 VAR DeviceKeyboard 2 VAR DeviceScreen 3 VAR ScreenGetWidth 0 VAR ScreenGetHeight 1 VAR ScreenSetAddr 0 VAR ScreenWrite 1 Start: LD R0, Hello LD R1, 12 CALL WriteStr ;LD R0, 64 ;LD R1, 8 ;OUT (R1), R0 ;LD R1, 0 ;LD R2, 10 ;OUT (R1), R0 ;Loop: ;INC R0 ;DEC R2 ;JNZ R2, Loop HALT WriteStr: ; R0 - string address ; R1 - string length PUSH R2 PUSH R3 PUSH R4 LD R3, ConsoleWriteChar WriteStrLoop: LD D1, R2, (R0) OUT D1, (R3), R2 INC R0 DEC R1 JNZ R1, WriteStrLoop POP R4 POP R3 POP R2 RET ClearScreen: PUSH R0 PUSH R1 PUSH R2 PUSH R3 LD R0, ScreenSetAddr LD R1, 0 OUT (R0), R1 LD R0, ScreenGetWidth IN R1, (R0) LD R0, ScreenGetHeight IN R2, (R0) MUL R2, R1 LD R0, ScreenWrite LD R1, 120 ClearScreenLoop: OUT (R0), R1 DEC R2 JNZ R2, ClearScreenLoop POP R3 POP R2 POP R1 POP R0 RET Hello: DB 'Hello friend' KeyInterrupt: ; Echo key PUSH R3 PUSH R2 PUSH R4 LD R3, ConsoleReadChar IN R2, (R3) LD R3, ConsoleWriteChar OUT (R3), R2 POP R4 POP R2 POP R3 RET Test: LD R0, (R1 + 1) LD (R1 + 12), R2