mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-12-13 13:40:56 +00:00
400 lines
5 KiB
Text
400 lines
5 KiB
Text
.globl main
|
|
.text
|
|
.text
|
|
.ent main
|
|
main:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-96($sp)
|
|
.mask 0x4000000,-96
|
|
.frame $sp,96,$26,48
|
|
stq $26,0($sp)
|
|
.prologue 1
|
|
stq $31,-88+96($sp)
|
|
stl $31,next
|
|
br L.3
|
|
L.2:
|
|
lda $16,-76+96($sp)
|
|
lda $17,-88+96($sp)
|
|
jsr $26,lookup
|
|
ldgp $gp,0($26)
|
|
ldl $25,($0)
|
|
lda $25,1($25)
|
|
stl $25,($0)
|
|
L.3:
|
|
lda $16,-76+96($sp)
|
|
jsr $26,getword
|
|
ldgp $gp,0($26)
|
|
cmpeq $0,$31,$23
|
|
beq $23,L.2
|
|
ldq $16,-88+96($sp)
|
|
jsr $26,tprint
|
|
ldgp $gp,0($26)
|
|
mov $31,$0
|
|
L.1:
|
|
ldq $26,0($sp)
|
|
lda $sp,96($sp)
|
|
ret
|
|
.end main
|
|
.globl err
|
|
.text
|
|
.ent err
|
|
err:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-64($sp)
|
|
.mask 0x4000000,-64
|
|
.frame $sp,64,$26,48
|
|
stq $26,0($sp)
|
|
stq $16,16($sp)
|
|
.prologue 1
|
|
lda $16,L.6
|
|
ldq $17,-48+64($sp)
|
|
jsr $26,printf
|
|
ldgp $gp,0($26)
|
|
lda $16,1
|
|
jsr $26,exit
|
|
ldgp $gp,0($26)
|
|
mov $31,$0
|
|
L.5:
|
|
ldq $26,0($sp)
|
|
lda $sp,64($sp)
|
|
ret
|
|
.end err
|
|
.globl getword
|
|
.text
|
|
.ent getword
|
|
getword:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-96($sp)
|
|
.mask 0x5006000,-72
|
|
.frame $sp,96,$26,48
|
|
stq $13,0($sp)
|
|
stq $14,8($sp)
|
|
stq $24,16($sp)
|
|
stq $26,24($sp)
|
|
stq $16,48($sp)
|
|
.prologue 1
|
|
L.8:
|
|
L.9:
|
|
jsr $26,getchar
|
|
ldgp $gp,0($26)
|
|
mov $0,$27
|
|
mov $27,$14
|
|
lda $25,-1
|
|
cmpeq $27,$25,$23
|
|
bne $23,L.11
|
|
mov $14,$16
|
|
jsr $26,isletter
|
|
ldgp $gp,0($26)
|
|
cmpeq $0,$31,$23
|
|
bne $23,L.8
|
|
L.11:
|
|
ldq $13,-48+96($sp)
|
|
br L.15
|
|
L.12:
|
|
mov $13,$27
|
|
lda $13,1($27)
|
|
mov $14,$25
|
|
stb $25,($27)
|
|
L.13:
|
|
jsr $26,getchar
|
|
ldgp $gp,0($26)
|
|
mov $0,$14
|
|
L.15:
|
|
mov $14,$16
|
|
jsr $26,isletter
|
|
ldgp $gp,0($26)
|
|
mov $0,$14
|
|
cmpeq $0,$31,$23
|
|
beq $23,L.12
|
|
stb $31,($13)
|
|
mov $13,$27
|
|
ldq $25,-48+96($sp)
|
|
cmpule $27,$25,$23
|
|
bne $23,L.16
|
|
lda $0,1
|
|
br L.7
|
|
L.16:
|
|
mov $31,$0
|
|
L.7:
|
|
ldq $13,0($sp)
|
|
ldq $14,8($sp)
|
|
ldq $24,16($sp)
|
|
ldq $26,24($sp)
|
|
lda $sp,96($sp)
|
|
ret
|
|
.end getword
|
|
.globl isletter
|
|
.text
|
|
.ent isletter
|
|
isletter:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-64($sp)
|
|
.frame $sp,64,$26,48
|
|
.prologue 1
|
|
lda $27,65
|
|
cmplt $16,$27,$23
|
|
bne $23,L.19
|
|
lda $27,90
|
|
cmple $16,$27,$23
|
|
beq $23,L.19
|
|
lda $16,32($16)
|
|
L.19:
|
|
lda $27,97
|
|
cmplt $16,$27,$23
|
|
bne $23,L.21
|
|
lda $27,122
|
|
cmple $16,$27,$23
|
|
beq $23,L.21
|
|
mov $16,$0
|
|
br L.18
|
|
L.21:
|
|
mov $31,$0
|
|
L.18:
|
|
lda $sp,64($sp)
|
|
ret
|
|
.end isletter
|
|
.globl lookup
|
|
.text
|
|
.ent lookup
|
|
lookup:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-80($sp)
|
|
.mask 0x4004000,-72
|
|
.frame $sp,80,$26,48
|
|
stq $14,0($sp)
|
|
stq $26,8($sp)
|
|
stq $16,32($sp)
|
|
mov $17,$14
|
|
.prologue 1
|
|
ldq $27,($14)
|
|
cmpeq $27,$31,$23
|
|
bne $23,L.24
|
|
ldq $16,-48+80($sp)
|
|
ldq $27,($14)
|
|
ldq $17,24($27)
|
|
jsr $26,strcmp
|
|
ldgp $gp,0($26)
|
|
stl $0,-60+80($sp)
|
|
ldl $27,-60+80($sp)
|
|
cmplt $27,$31,$23
|
|
beq $23,L.26
|
|
ldq $16,-48+80($sp)
|
|
ldq $27,($14)
|
|
lda $17,8($27)
|
|
jsr $26,lookup
|
|
ldgp $gp,0($26)
|
|
mov $0,$27
|
|
br L.23
|
|
L.26:
|
|
ldl $27,-60+80($sp)
|
|
cmple $27,$31,$23
|
|
bne $23,L.28
|
|
ldq $16,-48+80($sp)
|
|
ldq $27,($14)
|
|
lda $17,16($27)
|
|
jsr $26,lookup
|
|
ldgp $gp,0($26)
|
|
mov $0,$27
|
|
br L.23
|
|
L.28:
|
|
ldq $0,($14)
|
|
br L.23
|
|
L.24:
|
|
ldl $27,next
|
|
lda $25,2000
|
|
cmplt $27,$25,$23
|
|
bne $23,L.30
|
|
lda $16,L.32
|
|
jsr $26,err
|
|
ldgp $gp,0($26)
|
|
L.30:
|
|
ldl $27,next
|
|
sll $27,5,$27
|
|
stl $31,words($27)
|
|
ldl $27,next
|
|
sll $27,5,$27
|
|
stq $31,words+16($27)
|
|
stq $31,words+8($27)
|
|
ldq $16,-48+80($sp)
|
|
jsr $26,strlen
|
|
ldgp $gp,0($26)
|
|
mov $0,$27
|
|
lda $16,1($27)
|
|
jsr $26,malloc
|
|
ldgp $gp,0($26)
|
|
ldl $25,next
|
|
sll $25,5,$25
|
|
stq $0,words+24($25)
|
|
ldl $27,next
|
|
sll $27,5,$27
|
|
ldq $27,words+24($27)
|
|
cmpeq $27,$31,$23
|
|
beq $23,L.36
|
|
lda $16,L.39
|
|
jsr $26,err
|
|
ldgp $gp,0($26)
|
|
L.36:
|
|
ldl $27,next
|
|
sll $27,5,$27
|
|
ldq $16,words+24($27)
|
|
ldq $17,-48+80($sp)
|
|
jsr $26,strcpy
|
|
ldgp $gp,0($26)
|
|
ldl $27,next
|
|
lda $25,1($27)
|
|
stl $25,next
|
|
sll $27,8*(8-4),$27
|
|
sra $27,8*(8-4),$27
|
|
sll $27,5,$27
|
|
lda $27,words($27)
|
|
stq $27,($14)
|
|
mov $27,$0
|
|
L.23:
|
|
ldq $14,0($sp)
|
|
ldq $26,8($sp)
|
|
lda $sp,80($sp)
|
|
ret
|
|
.end lookup
|
|
.globl tprint
|
|
.text
|
|
.ent tprint
|
|
tprint:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-80($sp)
|
|
.mask 0x4004000,-72
|
|
.frame $sp,80,$26,48
|
|
stq $14,0($sp)
|
|
stq $26,8($sp)
|
|
mov $16,$14
|
|
.prologue 1
|
|
mov $14,$27
|
|
cmpeq $27,$31,$23
|
|
bne $23,L.42
|
|
ldq $16,8($14)
|
|
jsr $26,tprint
|
|
ldgp $gp,0($26)
|
|
lda $16,L.44
|
|
ldl $17,($14)
|
|
ldq $18,24($14)
|
|
jsr $26,printf
|
|
ldgp $gp,0($26)
|
|
ldq $16,16($14)
|
|
jsr $26,tprint
|
|
ldgp $gp,0($26)
|
|
L.42:
|
|
mov $31,$0
|
|
L.41:
|
|
ldq $14,0($sp)
|
|
ldq $26,8($sp)
|
|
lda $sp,80($sp)
|
|
ret
|
|
.end tprint
|
|
.globl strcmp
|
|
.text
|
|
.ent strcmp
|
|
strcmp:
|
|
ldgp $gp,0($27)
|
|
lda $sp,-64($sp)
|
|
.frame $sp,64,$26,48
|
|
.prologue 1
|
|
br L.47
|
|
L.46:
|
|
mov $16,$27
|
|
lda $16,1($27)
|
|
ldb $27,($27)
|
|
cmpeq $27,$31,$23
|
|
beq $23,L.49
|
|
mov $31,$0
|
|
br L.45
|
|
L.49:
|
|
lda $17,1($17)
|
|
L.47:
|
|
ldb $27,($16)
|
|
ldb $25,($17)
|
|
cmpeq $27,$25,$23
|
|
bne $23,L.46
|
|
ldb $27,($16)
|
|
cmpeq $27,$31,$23
|
|
beq $23,L.51
|
|
lda $0,-1
|
|
br L.45
|
|
L.51:
|
|
ldb $27,($17)
|
|
cmpeq $27,$31,$23
|
|
beq $23,L.53
|
|
lda $0,1
|
|
br L.45
|
|
L.53:
|
|
ldb $27,($16)
|
|
ldb $25,($17)
|
|
subl $27,$25,$0
|
|
L.45:
|
|
lda $sp,64($sp)
|
|
ret
|
|
.end strcmp
|
|
.globl next
|
|
.comm next,4
|
|
.globl words
|
|
.comm words,64000
|
|
.rdata
|
|
.align 0
|
|
L.44:
|
|
.byte 37
|
|
.byte 100
|
|
.byte 9
|
|
.byte 37
|
|
.byte 115
|
|
.byte 10
|
|
.byte 0
|
|
.align 0
|
|
L.39:
|
|
.byte 111
|
|
.byte 117
|
|
.byte 116
|
|
.byte 32
|
|
.byte 111
|
|
.byte 102
|
|
.byte 32
|
|
.byte 119
|
|
.byte 111
|
|
.byte 114
|
|
.byte 100
|
|
.byte 32
|
|
.byte 115
|
|
.byte 116
|
|
.byte 111
|
|
.byte 114
|
|
.byte 97
|
|
.byte 103
|
|
.byte 101
|
|
.byte 0
|
|
.align 0
|
|
L.32:
|
|
.byte 111
|
|
.byte 117
|
|
.byte 116
|
|
.byte 32
|
|
.byte 111
|
|
.byte 102
|
|
.byte 32
|
|
.byte 110
|
|
.byte 111
|
|
.byte 100
|
|
.byte 101
|
|
.byte 32
|
|
.byte 115
|
|
.byte 116
|
|
.byte 111
|
|
.byte 114
|
|
.byte 97
|
|
.byte 103
|
|
.byte 101
|
|
.byte 0
|
|
.align 0
|
|
L.6:
|
|
.byte 63
|
|
.byte 32
|
|
.byte 37
|
|
.byte 115
|
|
.byte 10
|
|
.byte 0
|