
;;; gcc for m6809 : Apr  3 2025 06:14:16
;;; 4.6.4 (gcc6809lw pl9)
;;; ABI version 1
;;; -mint16
	.module	lib8.c

	.area	.text
_PutRawByte:
	pshs	y,u
	ldx	_cursor
	stb	,x+
	stx	_cursor
	bra	L2
L6:
	ldu	#15872
L3:
	leay	32,u
	ldd	,y
	std	,u++
	cmpu	#16288	;cmphi:
	bne	L3
L4:
	ldy	#8224
	sty	,u++
	cmpu	#16320	;cmphi:
	bne	L4
	leax	-32,x
L2:
	cmpx	#16319	;cmphi:
	bhi	L6
	stx	_cursor
	ldb	#-1
	stb	,x
	ldx	#0
L5:
	stx	16382
	leax	1,x
	cmpx	#256	;cmphi:
	bne	L5
	puls	y,u,pc
_PutChar:
	leas	-1,s
	bra	L22
L18:
	ldb	#95
L22:
	stb	,s
	ldb	#32
	stb	[_cursor]
	ldb	,s
	cmpb	#10	;cmpqi:
	bne	L21
	bra	L19
L14:
	jsr	_PutChar
L19:
	ldx	_cursor
	ldb	#32
	cmpx	#16318	;cmphi:
	bls	L14
	bra	L22
L21:
	ldb	,s
	cmpb	#31	;cmpqi:
	bls	L18
	cmpb	#95	;cmpqi:
	bhi	L16
	andb	#63
	stb	,s
	bra	L23
L16:
	ldb	,s
	bmi	L17
	addb	#-96
	bra	L23
L17:
	ldb	,s
L23:
	leas	1,s
	jmp	_PutRawByte
_PutStr:
	pshs	y,u
	leay	,x
	ldu	#30
	bra	L25
L27:
	jsr	_PutChar
	cmpu	#0	;cmphi:
	bne	L26
	ldb	#92
	puls	y,u
	jmp	_PutChar
L26:
	leau	-1,u
L25:
	ldb	,y+
	bne	L27
	puls	y,u,pc
_PutHex:
	pshs	u
	leas	-4,s
	leau	,x
	cmpx	#15	;cmphi:
	bls	L29
	tfr	x,d
	lsra
	rorb
	lsra
	rorb
	lsra
	rorb
	lsra
	rorb
	std	2,s
	tfr	d,x
	jsr	_PutHex
L29:
	tfr	u,d
	anda	#0
	andb	#15
	tfr	d,x
	ldb	_HexAlphabet,x
	leas	4,s
	puls	u
	jmp	_PutChar
_DivMod10:
	ldd	#0
	bra	L31
L32:
	leax	-10000,x
	addd	#1000
L31:
	cmpx	#9999	;cmphi:
	bhi	L32
	bra	L39
L34:
	leax	-1000,x
	addd	#100
L39:
	cmpx	#999	;cmphi:
	bhi	L34
	bra	L40
L36:
	leax	-100,x
	addd	#10
L40:
	cmpx	#99	;cmphi:
	bhi	L36
	bra	L41
L38:
	leax	-10,x
	addd	#1
L41:
	cmpx	#9	;cmphi:
	bhi	L38
	std	[2,s]
	tfr	x,d	;movlsbqihi: R:x -> R:b
	rts
_PutDec:
	pshs	y,u
	leas	-2,s
	leau	,s
	leay	,x
	cmpx	#9	;cmphi:
	bls	L43
	ldd	#0
	pshs	u	;addhi: R:d += R:u
	addd	,s++
	pshs	d
	jsr	_DivMod10
	ldx	,u
	jsr	_PutDec
	leas	2,s
L43:
	ldd	#0
	pshs	u	;addhi: R:d += R:u
	addd	,s++
	pshs	d
	leax	,y
	jsr	_DivMod10
	addb	#48
	jsr	_PutChar
	leas	4,s
	puls	y,u,pc
_loop:
	leas	-6,s
L66:
	ldb	_gReal
L45:
	cmpb	_gReal	;cmpqi:
	beq	L45
	ldb	_gKern+4
	ldx	#127
	tstb	;cmpqi:(ZERO)
	lbeq	L46
	ldx	#8
	ldb	#1
	stb	2,s
L53:
	ldb	2,s
	comb
	stb	-254
	ldb	-256
	comb
	andb	#127
	lbeq	L47
	stb	4,s
	ldb	#127
	stb	-254
	ldb	-256
	stb	3,s
	com	3,s
	ldb	3,s
	andb	#64
	stb	5,s
	clr	3,s
L49:
	ldb	2,s
	clra		;zero_extendqihi: R:b -> R:d
	std	,s
	anda	#0
	andb	#1
	cmpd	#0	;cmphi:
	bne	L48
	lsr	2,s
	inc	3,s
	ldb	3,s
	cmpb	#8	;cmpqi:
	bne	L49
	ldb	#-1
	stb	3,s
L48:
	clr	2,s
L51:
	ldb	4,s
	clra		;zero_extendqihi: R:b -> R:d
	std	,s
	anda	#0
	andb	#1
	cmpd	#0	;cmphi:
	bne	L50
	lsr	4,s
	inc	2,s
	ldb	2,s
	cmpb	#8	;cmpqi:
	bne	L51
	ldb	#-1
	stb	2,s
L50:
	ldb	2,s
	aslb
	aslb
	aslb
	addb	3,s
	stb	2,s
	ldb	5,s
	beq	L52
	ldb	#-128
	orb	2,s
	stb	2,s
L52:
	ldb	2,s
	clra		;zero_extendqihi: R:b -> R:d
	tfr	d,x
	bra	L46
L47:
	asl	2,s
	leax	-1,x
	cmpx	#0	;cmphi:
	lbne	L53
	ldx	#127
L46:
	tfr	x,d
	eora	_prev_code
	eorb	_prev_code+1
	anda	#0
	andb	#127
	cmpd	#0	;cmphi:
	lbeq	L66
	stx	_prev_code
	cmpx	#127	;cmphi:
	lbeq	L66
	tfr	x,d	;movlsbqihi: R:x -> R:b
	stb	2,s
	andb	#127
	stb	3,s
	ldx	#_CocoKeyMap
	ldb	2,s
	bpl	L56
	ldx	#_CocoKeyMapShifted
L56:
	ldb	3,s
	cmpb	#49	;cmpqi:
	bhi	L57
	clra		;zero_extendqihi: R:b -> R:d
	std	,s
	leax	d,x
	ldb	,x
	stb	2,s
	beq	L57
	jsr	_PutChar
	ldb	2,s
	jsr	_PutChar
L57:
	inc	16383
	leas	6,s
	rts
_Printf:
	pshs	y,u
	leas	-4,s
	leau	12,s
	ldy	10,s
	ldx	#31
	stx	2,s
	jmp	L68
L80:
	ldd	2,s
	addd	#-1
	std	2,s
	bne	L69
	ldb	#92
	jsr	_PutChar
	jmp	L67
L69:
	ldb	,s
	cmpb	#31	;cmpqi:
	bhi	L71
	ldb	#10
	bra	L81
L71:
	ldb	,s
	cmpb	#37	;cmpqi:
	beq	L73
L81:
	jsr	_PutChar
	sty	,s
	bra	L72
L73:
	leax	1,y
	stx	,s
	ldb	1,y
	cmpb	#115	;cmpqi:
	beq	L76
	bhi	L79
	cmpb	#100	;cmpqi:
	bne	L74
	bra	L77
L79:
	cmpb	#117	;cmpqi:
	beq	L77
	cmpb	#120	;cmpqi:
	bne	L74
	bra	L83
L77:
	leay	2,u
	ldx	,u
	jsr	_PutDec
	bra	L82
L83:
	leay	2,u
	ldx	,u
	jsr	_PutHex
	bra	L82
L76:
	leay	2,u
	ldx	,u
	jsr	_PutStr
L82:
	leau	,y
	bra	L72
L74:
	jsr	_PutChar
L72:
	ldx	,s
	leay	1,x
L68:
	ldb	,y
	stb	,s
	lbne	L80
L67:
	leas	4,s
	puls	y,u,pc
LC0:
	.ascii "Hello LIB8\n\0"

	.area	.text.startup

	.globl	_main
_main:
	pshs	u
;----- asm -----
;  5 "../nekot1/game_postlude.h" 1
	.globl __n1pre_entry
;--- end asm ---
	ldx	#__n1pre_entry
	stx	0
;----- asm -----
;  8 "../nekot1/game_postlude.h" 1
	.globl __n1pre_final
;--- end asm ---
	ldu	#__n1pre_final
	stu	0
;----- asm -----
;  11 "../nekot1/game_postlude.h" 1
	.globl __n1pre_final_startup
;--- end asm ---
	ldx	#__n1pre_final_startup
	stx	0
	clrb
	ldx	#15872
	jsr	_gTextScreen
	ldx	#15872
L85:
	ldu	#12079
	stu	,x++
	cmpx	#16384	;cmphi:
	bne	L85
	ldx	#16288
	stx	_cursor
	ldb	#-1
	stb	16288
	ldx	#LC0
	stx	,--s
	jsr	_Printf
	ldu	#__n1pre_final_startup
	stu	,--s
	ldx	#__n1pre_final
	stx	,--s
	ldx	#_loop
	jsr	_xAfterSetup
	leas	6,s
	ldx	#0
	puls	u,pc

	.area	.text
LC1:
	.ascii "** EXIT %d.  (HIT BREAK) \n\0"

	.globl	__exit
__exit:
	pshs	u
	leau	,x
	ldx	#LC1
	jsr	_PutStr
	bra	L88
L89:
	stu	16352
	leau	1,u
L88:
	ldb	_gKern+5
	bne	L89
L91:
	bra	L91

	.area	.bss
_cursor:	.blkb	2

	.area	.text.entry
__n1pre_entry:
	.byte	126
	.word	_main

	.area	.final
__n1pre_final:
	.word	-20754

	.area	.final.setup
__n1pre_final_startup:
	.word	-20753

	.area	.bss
_prev_code:	.blkb	2

	.area	.text
_CocoKeyMapShifted:
	.ascii "@ABCDEFGHIJKLMNOPQRSTUVWXYZ\0\0\010\0 \0!\042#$%&'()*+<=>?"
	.ascii "\n\0"
_CocoKeyMap:
	.ascii "@ABCDEFGHIJKLMNOPQRSTUVWXYZ\0\0\010\0 0123456789:;,-./"
	.ascii "\n\0"
_HexAlphabet:
	.ascii "0123456789ABCDEF\0"
  .area .absolute
  .globl  _gAlloc64
_gAlloc64            EQU  $0BDC
  .globl  _gConfig
_gConfig             EQU  $0607
  .globl  _gFatal
_gFatal              EQU  $0ABC
  .globl  _gFatalFIRQ
_gFatalFIRQ          EQU  $0B5F
  .globl  _gFatalNMI
_gFatalNMI           EQU  $0B75
  .globl  _gFatalSWI1
_gFatalSWI1          EQU  $0BB9
  .globl  _gFatalSWI2
_gFatalSWI2          EQU  $0BA3
  .globl  _gFatalSWI3
_gFatalSWI3          EQU  $0B8C
  .globl  _gFree64
_gFree64             EQU  $07AC
  .globl  _gIrqRestore
_gIrqRestore         EQU  $07A1
  .globl  _gIrqSaveAndDisable
_gIrqSaveAndDisable  EQU  $0794
  .globl  _gKern
_gKern               EQU  $0048
  .globl  _gModeScreen
_gModeScreen         EQU  $0A85
  .globl  _gNetworkLog
_gNetworkLog         EQU  $0DBD
  .globl  _gPMode1Screen
_gPMode1Screen       EQU  $0A6A
  .globl  _gReal
_gReal               EQU  $0022
  .globl  _gReceiveCast64
_gReceiveCast64      EQU  $084B
  .globl  _gScore
_gScore              EQU  $060B
  .globl  _gSendCast
_gSendCast           EQU  $0DF0
  .globl  _gTextScreen
_gTextScreen         EQU  $09A8
  .globl  _gWall
_gWall               EQU  $0026
  .globl  _memcpy
_memcpy              EQU  $08C1
  .globl  _memcpy_words
_memcpy_words        EQU  $0868
  .globl  _memset
_memset              EQU  $089B
  .globl  _memset_words
_memset_words        EQU  $0880
  .globl  _strlen
_strlen              EQU  $08E3
  .globl  _xAfterSetup
_xAfterSetup         EQU  $07CC
  .globl  _xSendControlPacket
_xSendControlPacket  EQU  $0DD6
