njvm/test/tests/bigMultiplication.asm
2024-01-27 21:18:34 +01:00

126 lines
1.0 KiB
NASM

//
// version
//
.vers 7
//
// execution framework
//
__start:
call _main
call _exit
__stop:
jmp __stop
//
// Integer readInteger()
//
_readInteger:
asf 0
rdint
popr
rsf
ret
//
// void writeInteger(Integer)
//
_writeInteger:
asf 0
pushl -3
wrint
rsf
ret
//
// Character readCharacter()
//
_readCharacter:
asf 0
rdchr
popr
rsf
ret
//
// void writeCharacter(Character)
//
_writeCharacter:
asf 0
pushl -3
wrchr
rsf
ret
//
// Integer char2int(Character)
//
_char2int:
asf 0
pushl -3
popr
rsf
ret
//
// Character int2char(Integer)
//
_int2char:
asf 0
pushl -3
popr
rsf
ret
//
// void exit()
//
_exit:
asf 0
halt
rsf
ret
//
// void writeString(String)
//
_writeString:
asf 1
pushc 0
popl 0
jmp _writeString_L2
_writeString_L1:
pushl -3
pushl 0
getfa
call _writeCharacter
drop 1
pushl 0
pushc 1
add
popl 0
_writeString_L2:
pushl 0
pushl -3
getsz
lt
brt _writeString_L1
rsf
ret
//
// void main()
//
_main:
asf 0
pushc 4421
pushc 5743
mul
pushc 7699
mul
call _writeInteger
drop 1
__0:
rsf
ret