fs2port/src/ovl25.s

1740 lines
54 KiB
ArmAsm

;;; FS2.1 overlay: file section $25 (6K) -- edit mode / mode library ("SIMULATION CONTROL")
;;; Assembled with ca65 and compared byte for byte against the
;;; section extracted from the FS2.1 file (see Makefile validate).
.include "ovlPrelude.inc"
L1735 := $1735
L1EAD := $1EAD
L1EB0 := $1EB0
L1EB9 := $1EB9
L1EC4 := $1EC4
L1F89 := $1F89
L8740 := $8740
L8743 := $8743
L8746 := $8746
L8749 := $8749
L874C := $874C
L874F := $874F
L8764 := $8764
L8767 := $8767
L876A := $876A
L876D := $876D
L8779 := $8779
L877C := $877C
.byte $A1,$BC,$20,$55,$87,$00,$00,$00
.byte $4C,$4B,$B0,$4C,$4B,$B0,$20,$5B
.byte $87,$00,$00,$00,$20,$5E,$87,$00
.byte $00,$00,$20,$61,$87,$00,$00,$00
;;; Data: (lo,hi) pointer to each page's 24x40 text image, indexed by
;;; the page index $0920 (0 = SIMULATION CONTROL at $A804, 2 = ENVIRONMENTAL
;;; CONTROL at $ABC4). The images follow immediately.
PageTextPtrLo: .byte $04
PageTextPtrHi: .byte $A8,$C4,$AB,$20,$20,$53,$49,$4D
.byte $55,$4C,$41,$54,$49,$4F,$4E,$20
.byte $43,$4F,$4E,$54,$52,$4F,$4C,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$55
.byte $53,$45,$52,$20,$4D,$4F,$44,$45
.byte $20,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $4F,$55,$4E,$44,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$41
.byte $55,$54,$4F,$2D,$43,$4F,$4F,$52
.byte $44,$49,$4E,$41,$54,$49,$4F,$4E
.byte $20,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $4C,$45,$57,$20,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$52
.byte $45,$41,$4C,$49,$54,$59,$20,$4D
.byte $4F,$44,$45,$20,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$45
.byte $55,$52,$4F,$50,$45,$20,$31,$39
.byte $31,$37,$20,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$43
.byte $4F,$4D,$4D,$55,$4E,$49,$43,$41
.byte $54,$49,$4F,$4E,$20,$52,$41,$54
.byte $45,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$4F
.byte $56,$45,$52,$2D,$43,$4F,$4E,$54
.byte $52,$4F,$4C,$20,$4C,$49,$4D,$49
.byte $54,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$41,$49,$52
.byte $43,$52,$41,$46,$54,$20,$50,$4F
.byte $53,$49,$54,$49,$4F,$4E,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$4E
.byte $4F,$52,$54,$48,$20,$50,$4F,$53
.byte $49,$54,$49,$4F,$4E,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$45
.byte $41,$53,$54,$20,$50,$4F,$53,$49
.byte $54,$49,$4F,$4E,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$41
.byte $4C,$54,$49,$54,$55,$44,$45,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$50
.byte $49,$54,$43,$48,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$42
.byte $41,$4E,$4B,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$48
.byte $45,$41,$44,$49,$4E,$47,$20,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$41
.byte $49,$52,$53,$50,$45,$45,$44,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$54
.byte $48,$52,$4F,$54,$54,$4C,$45,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$52
.byte $55,$44,$44,$45,$52,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$41
.byte $49,$4C,$45,$52,$4F,$4E,$53,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$46
.byte $4C,$41,$50,$53,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$45
.byte $4C,$45,$56,$41,$54,$4F,$52,$53
.byte $20,$20,$2D,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$41,$32,$2D,$46,$53
.byte $32,$20,$20,$20,$46,$49,$58,$20
.byte $4D,$4F,$44,$45,$20,$20,$20,$20
.byte $20,$20,$20,$20,$48,$49,$54,$20
.byte $45,$53,$43,$20,$54,$4F,$20,$45
.byte $58,$49,$54,$20,$20,$45,$4E,$56
.byte $49,$52,$4F,$4E,$4D,$45,$4E,$54
.byte $41,$4C,$20,$43,$4F,$4E,$54,$52
.byte $4F,$4C,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$54
.byte $49,$4D,$45,$3A,$20,$48,$4F,$55
.byte $52,$53,$20,$20,$2D,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$4D,$49,$4E
.byte $55,$54,$45,$53,$20,$20,$2D,$20
.byte $2D,$20,$2D,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $45,$41,$53,$4F,$4E,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$43
.byte $4C,$4F,$55,$44,$20,$4C,$41,$59
.byte $45,$52,$20,$32,$20,$54,$4F,$50
.byte $53,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$43
.byte $4C,$4F,$55,$44,$20,$4C,$41,$59
.byte $45,$52,$20,$32,$20,$42,$4F,$54
.byte $54,$4F,$4D,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$43
.byte $4C,$4F,$55,$44,$20,$4C,$41,$59
.byte $45,$52,$20,$31,$20,$54,$4F,$50
.byte $53,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$43
.byte $4C,$4F,$55,$44,$20,$4C,$41,$59
.byte $45,$52,$20,$31,$20,$42,$4F,$54
.byte $54,$4F,$4D,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$57
.byte $49,$4E,$44,$20,$4C,$45,$56,$45
.byte $4C,$20,$33,$3A,$20,$4B,$4E,$4F
.byte $54,$53,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$44,$45,$47
.byte $52,$45,$45,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $48,$45,$41,$52,$20,$5A,$4F,$4E
.byte $45,$20,$41,$4C,$54,$49,$54,$55
.byte $44,$45,$20,$33,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$57
.byte $49,$4E,$44,$20,$4C,$45,$56,$45
.byte $4C,$20,$32,$3A,$20,$4B,$4E,$4F
.byte $54,$53,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$44,$45,$47
.byte $52,$45,$45,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $48,$45,$41,$52,$20,$5A,$4F,$4E
.byte $45,$20,$41,$4C,$54,$49,$54,$55
.byte $44,$45,$20,$32,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$57
.byte $49,$4E,$44,$20,$4C,$45,$56,$45
.byte $4C,$20,$31,$3A,$20,$4B,$4E,$4F
.byte $54,$53,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$44,$45,$47
.byte $52,$45,$45,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $48,$45,$41,$52,$20,$5A,$4F,$4E
.byte $45,$20,$41,$4C,$54,$49,$54,$55
.byte $44,$45,$20,$31,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$53
.byte $55,$52,$46,$41,$43,$45,$20,$57
.byte $49,$4E,$44,$3A,$20,$4B,$4E,$4F
.byte $54,$53,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$44,$45,$47
.byte $52,$45,$45,$53,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$52,$45,$4C
.byte $49,$41,$42,$49,$4C,$49,$54,$59
.byte $20,$46,$41,$43,$54,$4F,$52,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$4A,$4F,$59
.byte $53,$54,$49,$43,$4B,$20,$28,$30
.byte $20,$4F,$52,$20,$31,$29,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$41,$44,$46
.byte $20,$45,$4E,$41,$42,$4C,$45,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$20,$20,$20,$20,$20
.byte $20,$20,$20,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$5F,$5F,$5F,$5F,$5F
.byte $5F,$5F,$5F,$41,$32,$2D,$46,$53
.byte $32,$20,$20,$20,$46,$49,$58,$20
.byte $4D,$4F,$44,$45,$20,$20,$20,$20
.byte $20,$20,$20,$20,$48,$49,$54,$20
.byte $45,$53,$43,$20,$54,$4F,$20,$45
.byte $58,$49,$54
;;; Data: text-page address of column 26 of every screen row, as (lo,hi)
;;; pairs indexed by the row index $091F (= row * 2). Row 1 is $041A, and
;;; the "-->" marker sits at that address with the digits five columns on.
RowPtrTableLo: .byte $1A
RowPtrTableHi: .byte $04,$9A,$04,$1A,$05,$9A,$05,$1A
.byte $06,$9A,$06,$1A,$07,$9A,$07,$42
.byte $04,$C2,$04,$42,$05,$C2,$05,$42
.byte $06,$C2,$06,$42,$07,$C2,$07,$6A
.byte $04,$EA,$04,$6A,$05,$EA,$05,$6A
.byte $06,$EA,$06,$6A,$07,$EA,$07
;;; Data: 1, 10, 100, 1000, 10000, 100000 as 24-bit (lo, mid, hi) columns,
;;; used by ComputeValue/FormatValue to convert the six-digit buffer.
Pow10Lo: .byte $01,$0A,$64,$E8,$10,$A0
Pow10Mid: .byte $00,$00,$00,$03,$27,$86
Pow10Hi: .byte $00,$00,$00,$00,$00,$01
;;; Data: the two words ExitEditor stores into $62/$63 and $5A/$5B (the
;;; sub-unit parts of the aircraft position), both zero in this build.
ExitWordALo: .byte $00
ExitWordAHi: .byte $00
ExitWordBLo: .byte $00
ExitWordBHi: .byte $00
;;; Data: (lo,hi) pointer to each page's field list, indexed by the page
;;; index. A field entry is (width in bytes, row index, offset into the
;;; 65-byte mode record at $0935); a zero width ends the list. Page 0 maps
;;; USER MODE .. ELEVATORS onto $0976/$0935..$0952, page 1 maps the
;;; environmental fields onto $0954..$097B.
FieldListPtrLo: .byte $CE
FieldListPtrHi: .byte $AF,$0B,$B0,$01,$02,$41,$01,$04
.byte $00,$01,$06,$01,$01,$08,$02,$01
.byte $0A,$03,$01,$0C,$05,$01,$0E,$06
.byte $01,$10,$47,$02,$14,$07,$02,$16
.byte $09,$02,$18,$0B,$02,$1A,$0D,$02
.byte $1C,$0F,$02,$1E,$11,$02,$20,$13
.byte $02,$22,$15,$02,$24,$17,$02,$26
.byte $19,$02,$28,$1B,$02,$2A,$1D,$00
.byte $01,$02,$1F,$01,$04,$20,$01,$06
.byte $21,$02,$08,$22,$02,$0A,$24,$02
.byte $0C,$26,$02,$0E,$28,$02,$10,$30
.byte $02,$12,$32,$02,$14,$2E,$02,$16
.byte $34,$02,$18,$36,$02,$1A,$2C,$02
.byte $1C,$38,$02,$1E,$3A,$02,$20,$2A
.byte $02,$22,$3C,$02,$24,$3E,$01,$26
.byte $40,$01,$28,$45,$01,$2A,$46,$00
;;; ============================================================
;;; Edit mode ("SIMULATION CONTROL" / "ENVIRONMENTAL CONTROL").
;;; Entered through PatchSlot_PreMode, which this overlay's first page
;;; turns into `jmp EditOverlayEntry`. Runs in text mode on the $0400
;;; page (the game's $0400..$07FF bytes are parked in hires page 2 rows
;;; meanwhile), edits the 65-byte mode record at $0935..$0975, and on
;;; exit converts it back into the live aircraft state. ModeLibraryAction
;;; ($08A7) = 1 ('+') loads mode $0934, 2 ('S') saves it, 0 = interactive.
;;; Translated in port/src/ovlEdit.c.
EditOverlayEntry:
.refto EditOverlayEntry
jsr SaveTextPage
jsr PrepareRecord
lda $C051
lda $C054
jsr ShowFirstPage
jsr L1EC4
bit $1FBD
ldx $08A7
beq EditLoop
dex
bne EditAction_Save
jsr LoadRecord
jmp EditExit
EditAction_Save: jsr SaveToNextSlot
jmp EditExit
;;; Interactive loop. EditField reads one field; if digits were typed
;;; ApplyModeNumber re-parses the page (and stays on the USER MODE line of
;;; page 0). Escape leaves, '-' steps back one field, anything else steps
;;; forward.
EditLoop: jsr EditField
lda $0921
beq EditLoop_CheckExit
jsr ApplyModeNumber
lda $0920
bne EditLoop_CheckExit
lda $091F
cmp #$02
bne EditLoop_CheckExit
jmp EditLoop
EditLoop_CheckExit: lda $091A
beq EditLoop_Direction
;;; Leave the editor: restore hires page 1 from page 2 (SceneryCopyLoaded
;;; Section), bring $0400..$07FF back, then ExitEditor.
EditExit: bit $1FAC
jsr L8779
jsr RestoreTextPage
jmp ExitEditor
EditLoop_Direction: lda $091B
beq EditLoop_Next
lda #$00
sta $091B
jsr PrevField
jmp EditLoop
EditLoop_Next: jsr NextField
jmp EditLoop
;;; Move the marker down one field; past ELEVATORS/ADF ENABLE flip to the
;;; other page (the page index wraps 0 -> 2 -> 0).
NextField: jsr ClearMarker
lda $091F
clc
adc #$02
cmp #$2C
bne SelectRow
lda $0920
clc
adc #$02
cmp #$04
bne ShowPage
;;; Select page A (ShowFirstPage forces page 0): draw its text image, fill
;;; in every field from the record, and put the marker on row index 2.
ShowFirstPage: lda #$00
ShowPage: sta $0920
jsr DrawPage
jsr FillFields
lda #$02
;;; Make row index A the current field and write the "-->" marker
;;; ($AD $AD $BE) at its row pointer.
SelectRow: sta $091F
jsr SetRowPtr
ldy #$00
lda #$AD
sta ($3E),y
iny
sta ($3E),y
iny
lda #$BE
sta ($3E),y
rts
;;; Move the marker up one field; above the first field flip to the other
;;; page and land on its last field (row index $2A).
PrevField: jsr ClearMarker
lda $091F
sec
sbc #$02
cmp #$00
bne SelectRow
lda $0920
sec
sbc #$02
bpl PrevField_Store
lda #$02
PrevField_Store: sta $0920
jsr DrawPage
jsr FillFields
lda #$2A
jmp SelectRow
;;; Blank the three marker characters of the current row.
ClearMarker: jsr SetRowPtr
ldy #$00
lda #$A0
sta ($3E),y
iny
sta ($3E),y
iny
sta ($3E),y
rts
;;; $3E/$3F = RowPtrTable[$091F].
SetRowPtr: ldx $091F
lda RowPtrTableLo,x
sta $3E
lda RowPtrTableHi,x
sta $3F
rts
;;; Type a number into the current field. Keeps a six-digit buffer at
;;; $0924..$0929 (least significant first), the digit count in $0923 and
;;; the text column in $092A (5..10). Return / '-' / Escape compute the
;;; value into $091C..$091E and return ('-' sets $091B, Escape sets $091A);
;;; Backspace shifts the buffer down; '+' reloads the selected mode, 'S'
;;; saves into the next user slot; digits shift the buffer up and echo.
;;; The three `cmp #$53` branches after the 'S' test can never be taken
;;; (they compare the same key again), so the disk load/save code below
;;; is dead in this build.
EditField: lda #$00
sta $0921
jsr SetRowPtr
ldy #$05
sty $092A
lda #$00
sta $0923
sta $091A
ldx #$05
EditField_ClearDigits: lda #$30
sta $0924,x
dex
bpl EditField_ClearDigits
EditField_Key: jsr L8743
cmp #$0D
beq EditField_Done
cmp #$2D
bne EditField_TestEscape
sta $091B
beq EditField_Done
EditField_TestEscape: cmp #$1B
bne EditField_Backspace
inc $091A
EditField_Done: jsr ComputeValue
rts
EditField_Backspace: cmp #$08
bne EditField_TestPlus
lda $0923
beq EditField_Key
dec $0923
lda #$A0
dec $092A
ldy $092A
sta ($3E),y
ldx #$01
EditField_ShiftDown: lda $0924,x
sta $0923,x
inx
cpx #$06
bne EditField_ShiftDown
lda #$30
sta $0929
bne EditField_Key
EditField_TestPlus: cmp #$2B
bne EditField_TestSave
jsr LoadAndRefresh
jmp EditField
EditField_TestSave: cmp #$53
bne EditField_DeadLoad
jsr SaveToNextSlot
jmp EditField
EditField_DeadLoad: cmp #$53
bne EditField_DeadSave
bit $1FAC
jsr DeadSetLoaderPtr
jsr L1EAD
bcs EditField_DeadFail
lda $091F
sta $A9
jsr LoadRecord
jsr FillFields
lda $A9
sta $091F
jmp EditField_DeadDone
EditField_DeadFail: lda $1E01
jmp L1F89
EditField_DeadSave: cmp #$53
bne EditField_TestDigit
bit $1FAC
jsr L1EB9
bcs EditField_DeadFail
jsr DeadSetLoaderPtr
jsr L1EB0
bcs EditField_DeadFail
EditField_DeadDone: bit $1FBD
lda #$00
sta $1E0E
jmp EditField_Again
EditField_TestDigit: cmp #$30
bcs EditField_Digit
EditField_Again: jmp EditField_Key
EditField_Digit: cmp #$3A
bcs EditField_Again
ldy $092A
cpy #$0B
beq EditField_Again
inc $0921
sta $AF
lda $0923
bne EditField_ShiftUp
ldy #$0C
lda #$A0
EditField_ClearRow: sta ($3E),y
dey
cpy #$04
bne EditField_ClearRow
EditField_ShiftUp: ldx #$04
EditField_ShiftUpLoop: lda $0924,x
sta $0925,x
dex
bpl EditField_ShiftUpLoop
lda $AF
sta $0924
inc $0923
ldy $092A
ora #$80
sta ($3E),y
iny
sty $092A
jmp EditField_Again
;;; Dead: would point the loader at the user records ($0932) and sector
;;; $40 for the unreachable disk save/load paths above.
DeadSetLoaderPtr: lda $0932
ldx $0933
sta $1E03
stx $1E04
lda #$40
sta $1E01
rts
;;; $091C..$091E = sum over the digit buffer of digit * Pow10[index]
;;; (24-bit, repeated addition).
ComputeValue: ldx #$00
stx $091C
stx $091D
stx $091E
ComputeValue_Digit: lda $0924,x
and #$7F
sec
sbc #$30
tay
beq ComputeValue_Next
clc
ComputeValue_Add: lda Pow10Lo,x
adc $091C
sta $091C
lda Pow10Mid,x
adc $091D
sta $091D
lda Pow10Hi,x
adc $091E
sta $091E
dey
bne ComputeValue_Add
ComputeValue_Next: inx
cpx #$06
bne ComputeValue_Digit
rts
;;; Print $091C..$091E at columns 5.. of the current row: for each power
;;; of ten from 100000 down, subtract while the 24-bit result stays
;;; non-negative, and print the count. Leading zeros are suppressed
;;; ($0922 = a non-zero digit has been printed); the units digit always
;;; prints.
FormatValue: jsr SetRowPtr
lda #$00
sta $0922
lda #$05
sta $092A
ldy #$05
lda #$A0
FormatValue_Clear: sta ($3E),y
iny
cpy #$0B
bne FormatValue_Clear
ldx #$05
FormatValue_Digit: lda #$30
sta $092D
FormatValue_Subtract: lda $091C
sec
sbc Pow10Lo,x
sta $092E
lda $091D
sbc Pow10Mid,x
sta $092F
lda $091E
sbc Pow10Hi,x
bmi FormatValue_Test
sta $091E
lda $092F
sta $091D
lda $092E
sta $091C
inc $092D
bne FormatValue_Subtract
FormatValue_Test: lda $092D
cpx #$00
beq FormatValue_Print
cmp #$30
bne FormatValue_Print
lda $0922
beq FormatValue_Next
FormatValue_Print: inc $0922
ldy $092A
lda $092D
ora #$80
sta ($3E),y
inc $092A
FormatValue_Next: dex
bpl FormatValue_Digit
rts
;;; Copy a 24x40 text image at AX onto the text page ($0400 with the
;;; Apple II row interleave), setting bit 7 of every character.
DrawTextPage: sta $3C
stx $3D
lda #$00
ldx #$04
sta $3E
stx $3F
DrawTextPage_Row: ldy #$00
DrawTextPage_Char: lda ($3C),y
ora #$80
sta ($3E),y
iny
cpy #$28
bne DrawTextPage_Char
tya
clc
adc $3C
sta $3C
bcc DrawTextPage_NextRow
inc $3D
DrawTextPage_NextRow: lda $3E
clc
adc #$80
sta $3E
lda $3F
adc #$00
sta $3F
cmp #$08
bmi DrawTextPage_Row
lda $3E
sec
sbc #$D8
cmp #$78
bne DrawTextPage_Wrap
rts
DrawTextPage_Wrap: sta $3E
lda $3F
sbc #$03
sta $3F
bne DrawTextPage_Row
;;; After digits were typed: ParseFields, then act on the USER MODE
;;; number ($0976). Below 110 it selects a mode (must be < $0931, the mode
;;; count) and loads its record; 100+n stores the current record into user
;;; slot n; anything else is rejected and the old number is restored.
;;; Refills the page from the record either way.
ApplyModeNumber: lda $091F
sta $A9
jsr ParseFields
lda $0976
cmp #$D2
bcs ApplyModeNumber_Reject
cmp $0934
beq ApplyModeNumber_Reject
cmp #$6E
bcs ApplyModeNumber_Save
cmp $0931
bcs ApplyModeNumber_Reject
sta $0934
jsr LoadRecord
lda $0934
sta $0976
jmp ApplyModeNumber_Refresh
ApplyModeNumber_Save: sec
sbc #$64
cmp $0931
bcs ApplyModeNumber_Reject
sta $0934
sta $0976
jsr SaveRecord
ApplyModeNumber_Refresh: jsr FillFields
lda $A9
sta $091F
rts
ApplyModeNumber_Reject: lda $0934
sta $0976
jmp ApplyModeNumber_Refresh
;;; Walk the current page's field list and print every field from the
;;; mode record.
FillFields: ldx $0920
lda FieldListPtrLo,x
sta $A5
lda FieldListPtrHi,x
sta $A6
FillFields_Loop: ldy #$00
lda ($A5),y
sta $092E
bne FillFields_Field
rts
FillFields_Field: jsr FieldSetup
ldy #$00
sty $091C
sty $091D
sty $091E
FillFields_Copy: lda ($3E),y
sta $091C,y
iny
cpy $092E
bne FillFields_Copy
jsr FormatValue
jmp FillFields_Loop
;;; Build the editable record from the live aircraft state: altitude
;;; (($5F/$60 + ground elevation) * $D1EB, shifted, minus 9), heading less
;;; the two magnetic corrections, bank and pitch (each * $0168), airspeed
;;; (* $0200), throttle and flaps as they are, rudder/ailerons/elevators
;;; biased by $7FFF, then the wind layers and altitudes through WindConvert
;;; mode 0 and * $0348.
PrepareRecord: jsr L874C
clc
lda $5F
adc $0A36
sta $C2
lda $60
adc $0A37
sta $C3
lda #$EB
ldx #$D1
jsr L1735
asl a
rol $C8
rol $C9
asl a
rol $C8
rol $C9
lda $C8
sec
sbc #$09
sta $0940
lda $C9
sbc #$00
sta $0941
sec
lda $09E4
sbc $0848
sta $09E4
lda $09E5
sbc $0849
sta $09E5
sec
lda $09E4
sbc $0846
sta $09E4
lda $09E5
sbc $0847
sta $09E5
lda $09E4
ldx $09E5
sta $C2
stx $C3
lda #$68
ldx #$01
jsr L1735
stx $0946
lda $C9
sta $0947
lda $09AF
ldx $09B0
sta $C2
stx $C3
lda #$68
ldx #$01
jsr L1735
stx $0944
lda $C9
sta $0945
lda $09AD
ldx $09AE
sta $C2
stx $C3
lda #$68
ldx #$01
jsr L1735
stx $0942
lda $C9
sta $0943
lda $0A11
ldx $0A12
sta $C2
stx $C3
lda #$00
ldx #$02
jsr L1735
stx $0948
lda $C9
sta $0949
lda $0A6E
ldx $0A6F
sta $094A
stx $094B
lda $0A5E
ldx $0A5F
sta $0950
stx $0951
lda $0A64
clc
adc #$FF
sta $094C
lda $0A65
adc #$7F
sta $094D
lda $0A52
clc
adc #$FF
sta $094E
lda $0A53
adc #$7F
sta $094F
lda $0A5A
clc
adc #$FF
sta $0952
lda $0A5B
adc #$7F
sta $0953
ldy #$00
jsr WindConvert
lda $095F
ldx $0960
sta $C2
stx $C3
lda #$48
ldx #$03
jsr L1735
sta $095F
stx $0960
lda $0961
ldx $0962
sta $C2
stx $C3
lda #$48
ldx #$03
jsr L1735
sta $0961
stx $0962
lda $0963
ldx $0964
sta $C2
stx $C3
lda #$48
ldx #$03
jsr L1735
sta $0963
stx $0964
rts
;;; Park $0400..$07FF in the first 26 rows of hires page 2 (40 bytes per
;;; row, stored last column first) while the editor uses the text page.
SaveTextPage: lda #$00
sta $AF
sta $2D
lda #$04
sta $2E
SaveTextPage_Row: ldx $AF
inc $AF
lda $0F5A,x
sta $8E
lda $0E9A,x
and #$DF
ora #$40
sta $8F
ldy #$27
ldx #$00
SaveTextPage_Byte: lda ($2D,x)
sta ($8E),y
inc $2D
bne SaveTextPage_Next
inc $2E
lda $2E
cmp #$08
bne SaveTextPage_Next
rts
SaveTextPage_Next: dey
bpl SaveTextPage_Byte
bmi SaveTextPage_Row
;;; The inverse of SaveTextPage.
RestoreTextPage: lda #$00
sta $AF
sta $2D
lda #$04
sta $2E
RestoreTextPage_Row: ldx $AF
inc $AF
lda $0F5A,x
sta $8E
lda $0E9A,x
and #$DF
ora #$40
sta $8F
ldy #$27
ldx #$00
RestoreTextPage_Byte: lda ($8E),y
sta ($2D,x)
inc $2D
bne RestoreTextPage_Next
inc $2E
lda $2E
cmp #$08
bne RestoreTextPage_Next
rts
RestoreTextPage_Next: dey
bpl RestoreTextPage_Byte
bmi RestoreTextPage_Row
;;; Convert the record back into the live state. With EUROPE 1917 set,
;;; first load built-in mode 7 and copy the colour-patch words to the
;;; sky/ground overrides. Then: graphics mode, clock digits, position from
;;; NORTH/EAST ($40-biased high bytes), altitude via the $8746 entry,
;;; heading/bank/pitch (* $B60C), airspeed (* $7FFF), controls unbiased,
;;; throttle high byte clamped, magnetos re-applied on the ground in
;;; reality mode, wind layers back through WindConvert mode 1 (* $4E),
;;; WW1 counters cleared, ResetAircraftSystems, BaseTemp from the frame
;;; counter, the four wind layer words at $0856.., and every control
;;; indicator redrawn. Clears EditModeFlag and ModeLibraryAction.
ExitEditor: lda $093A
beq ExitEditor_Restore
lda #$07
sta $0976
sta $0934
jsr LoadRecord
lda $0802
ldx $0803
sta $0880
stx $0881
lda $0800
ldx $0801
sta $0882
stx $0883
ExitEditor_Restore: lda $C050
jsr L8740
lda $093C
sta $64
lda $093D
sec
sbc #$40
sta $65
lda $093E
sta $5C
lda $093F
sec
sbc #$40
sta $5D
lda ExitWordALo
ldx ExitWordAHi
sta $62
stx $63
lda ExitWordBLo
ldx ExitWordBHi
sta $5A
stx $5B
jsr L8746
lda $0946
ldx $0947
sta $C2
stx $C3
lda #$0C
ldx #$B6
jsr L1735
sta $09E4
stx $09E5
clc
lda $09E4
adc $0848
sta $09E4
lda $09E5
adc $0849
sta $09E5
clc
lda $09E4
adc $0846
sta $09E4
lda $09E5
adc $0847
sta $09E5
lda $0944
ldx $0945
sta $C2
stx $C3
lda #$0C
ldx #$B6
jsr L1735
sta $09AF
stx $09B0
lda $0942
ldx $0943
sta $C2
stx $C3
lda #$0C
ldx #$B6
jsr L1735
sta $09AD
stx $09AE
lda $0948
ldx $0949
sta $C2
stx $C3
lda #$FF
ldx #$7F
jsr L1735
sta $0A11
stx $0A12
lda $094A
ldx $094B
sta $0A6E
stx $0A6F
lda $0950
ldx $0951
sta $0A5E
stx $0A5F
lda $094C
sec
sbc #$FF
sta $0A64
lda $094D
sbc #$7F
sta $0A65
lda $094E
sec
sbc #$FF
sta $0A52
lda $094F
sbc #$7F
sta $0A53
lda $0952
sec
sbc #$FF
sta $0A5A
lda $0953
sbc #$7F
sta $0A5B
lda $0A6F
bpl ExitEditor_Magnetos
lda #$7F
sta $0A6F
ExitEditor_Magnetos: lda $0938
beq ExitEditor_Winds
lda $09E3
beq ExitEditor_Winds
lda $0A6F
bne ExitEditor_Winds
jsr L8749
ExitEditor_Winds: lda $095F
ldx $0960
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $095F
stx $0960
lda $0961
ldx $0962
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $0961
stx $0962
lda $0963
ldx $0964
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $0963
stx $0964
ldy #$01
jsr WindConvert
lda #$64
sta $0A54
lda #$35
sta $08D2
lda #$00
sta $0A72
sta $08C7
sta $0898
sta $08C3
sta $0A56
sta $08C0
sta $08C1
jsr L874F
lda $2B
and #$1F
sec
sbc #$10
sta $0930
lda #$14
sta $089E
lda $095D
ldx $095E
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $0856
stx $0857
lda $095B
ldx $095C
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $0858
stx $0859
lda $0959
ldx $095A
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $085A
stx $085B
lda $0957
ldx $0958
sta $C2
stx $C3
lda #$4E
ldx #$00
jsr L1735
sta $085C
stx $085D
jsr L8764
jsr L8767
jsr L876A
jsr L876D
lda #$00
sta $08A6
sta $08A7
lda $0A5F
jsr L877C
lda $0976
sta $0886
lda $2B
and #$1F
sec
sbc #$10
sta $0930
lda #$01
sta $08C2
sta $08B4
lda #$00
sta $08C8
rts
;;; 'S': a built-in mode saves into its slot + 10, a user mode saves in
;;; place (rejected at the mode count). Then LoadAndRefresh.
SaveToNextSlot: lda $0934
cmp #$0A
bcs SaveToNextSlot_User
adc #$0A
sta $0976
sta $0934
jmp SaveToNextSlot_Store
SaveToNextSlot_User: cmp $0931
bcs SaveToNextSlot_Exit
SaveToNextSlot_Store: jsr SaveRecord
jsr LoadAndRefresh
SaveToNextSlot_Exit: rts
;;; '+': load mode $0934 into the record and refill the fields, keeping
;;; the current row.
LoadAndRefresh: lda $091F
pha
jsr LoadRecord
jsr FillFields
pla
sta $091F
rts
;;; One field entry at ($A5): row index -> $091F, the row's digit text
;;; (column 5) -> $3C, the record field -> $3E, and advance $A5 by 3.
FieldSetup: ldy #$01
lda ($A5),y
sta $091F
tax
lda RowPtrTableLo,x
clc
adc #$05
sta $3C
lda #$00
adc RowPtrTableHi,x
sta $3D
iny
lda ($A5),y
clc
adc #$35
sta $3E
lda #$00
adc #$09
sta $3F
lda $A5
clc
adc #$03
sta $A5
bcc FieldSetup_Exit
inc $A6
FieldSetup_Exit: rts
;;; Draw the current page's text image.
DrawPage: ldx $0920
lda PageTextPtrLo,x
tay
lda PageTextPtrHi,x
tax
tya
jsr DrawTextPage
rts
;;; Walk the field list reading each field's digits back from the text
;;; page into the record (ComputeValue, `width` bytes stored).
ParseFields: ldx $0920
lda FieldListPtrLo,x
sta $A5
lda FieldListPtrHi,x
sta $A6
ParseFields_Loop: ldy #$00
lda ($A5),y
sta $092E
bne ParseFields_Field
rts
ParseFields_Field: jsr FieldSetup
ldx #$05
ParseFields_ClearDigits: lda #$30
sta $0924,x
dex
bpl ParseFields_ClearDigits
ldy #$00
ParseFields_Char: lda ($3C),y
cmp #$A0
beq ParseFields_Store
ldx #$04
ParseFields_ShiftUp: lda $0924,x
sta $0925,x
dex
bpl ParseFields_ShiftUp
lda ($3C),y
sta $0924
iny
bne ParseFields_Char
ParseFields_Store: jsr ComputeValue
ldy #$00
ParseFields_Copy: lda $091C,y
sta ($3E),y
iny
cpy $092E
bne ParseFields_Copy
jmp ParseFields_Loop
;;; Y = 0: live units -> record units, Y = 1: the reverse, for the four
;;; wind layers ($0965, $0969, $096D, $0971 via WindLayer) and the seven
;;; words at $085C (each * $0348, or * $4E0C taking the high word).
WindConvert: lda #$65
sta $A2
lda #$09
sta $A3
jsr WindLayer
lda #$69
sta $A2
lda #$09
sta $A3
jsr WindLayer
lda #$6D
sta $A2
lda #$09
sta $A3
jsr WindLayer
lda #$71
sta $A2
lda #$09
sta $A3
jsr WindLayer
lda #$07
sta $B8
lda #$5C
sta $A2
lda #$08
sta $A3
lda #$0C
sta $BA
lda #$4E
sta $BB
WindConvert_Word: cpy #$01
beq WindConvert_WordOut
sty $9E
ldy #$00
lda ($A2),y
sta $C2
iny
lda ($A2),y
sta $C3
lda #$48
ldx #$03
jsr L1735
ldy #$00
sta ($A2),y
iny
txa
sta ($A2),y
jmp WindConvert_NextWord
WindConvert_WordOut: sty $9E
lda $BA
ldx $BB
sta $C2
stx $C3
ldy #$01
lda ($A2),y
tax
dey
lda ($A2),y
jsr L1735
ldy #$00
lda $C8
sta ($A2),y
iny
lda $C9
sta ($A2),y
WindConvert_NextWord: ldy $9E
lda $A2
clc
adc #$02
sta $A2
lda $A3
adc #$00
sta $A3
lda $B8
sec
sbc #$01
sta $B8
bne WindConvert_Word
rts
;;; One (direction, speed) layer at ($A2). Mode 0: speed * $0168 stored
;;; in place, direction = dir.hi * 100 + dir.lo (+ carry). Mode 1: speed *
;;; $B60C, direction counted in steps of $9C with a $64 bias.
WindLayer: sty $9E
ldy #$00
lda ($A2),y
sta $BA
iny
lda ($A2),y
sta $BB
iny
lda ($A2),y
sta $B8
iny
lda ($A2),y
sta $B9
ldy $9E
beq WindLayer_In
jmp WindLayer_Out
WindLayer_In: lda #$68
sta $C2
lda #$01
sta $C3
lda $B8
ldx $B9
jsr L1735
ldy #$02
lda $C8
sta ($A2),y
iny
lda $C9
sta ($A2),y
lda #$64
sta $C2
lda #$00
sta $C3
lda #$00
ldx $BB
jsr L1735
clc
adc $BA
bcc WindLayer_InStore
inx
WindLayer_InStore: sta $BA
txa
ldx $BA
jmp WindLayer_Store
WindLayer_Out: lda #$0C
sta $C2
lda #$B6
sta $C3
lda $B8
ldx $B9
jsr L1735
ldy #$02
sta ($A2),y
iny
txa
sta ($A2),y
lda $BA
ldx $BB
ldy #$FF
WindLayer_DirLoop: iny
clc
adc #$9C
bcc WindLayer_DirNext
inx
WindLayer_DirNext: dex
bpl WindLayer_DirLoop
clc
adc #$64
tax
tya
WindLayer_Store: ldy #$01
sta ($A2),y
txa
dey
sta ($A2),y
ldy $9E
WindLayer_Exit: rts
;;; $0935.. -> mode slot $0934; built-in modes (< 10) are never
;;; overwritten. LoadRecord is the reverse; TransferRecord does the copy
;;; with $092D selecting the direction (1 = save). Built-in records are the
;;; ten 65-byte blocks at $BA17, user records live at ($0932).
SaveRecord: lda $0934
cmp #$0A
bcc WindLayer_Exit
lda #$01
bne TransferRecord
LoadRecord: lda #$00
TransferRecord: sta $092D
lda #$17
ldx #$BA
sta $3E
stx $3F
lda $0934
cmp #$0A
bcc TransferRecord_Index
sbc #$0A
ldx $0932
stx $3E
ldx $0933
stx $3F
TransferRecord_Index: tax
TransferRecord_Step: dex
bmi TransferRecord_Copy
lda $3E
clc
adc #$41
sta $3E
bcc TransferRecord_Step
inc $3F
bne TransferRecord_Step
TransferRecord_Copy: ldy #$40
TransferRecord_Byte: lda $092D
beq TransferRecord_Load
lda $0935,y
sta ($3E),y
jmp TransferRecord_Next
TransferRecord_Load: lda ($3E),y
sta $0935,y
TransferRecord_Next: dey
bpl TransferRecord_Byte
rts
.byte $00,$01,$00,$00,$00,$00,$80,$24
.byte $43,$1F,$41,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$FF
.byte $7F,$FF,$7F,$00,$00,$FF,$7F,$0C
.byte $00,$04,$00,$00,$00,$00,$00,$00
.byte $00,$00,$B8,$0B,$70,$17,$28,$23
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $64,$00,$00,$00,$01,$00,$00,$80
.byte $5F,$53,$B8,$19,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $FF,$7F,$FF,$7F,$00,$00,$FF,$7F
.byte $0F,$17,$02,$00,$00,$00,$00,$00
.byte $00,$00,$00,$60,$09,$D4,$1C,$E8
.byte $35,$2B,$00,$0E,$01,$19,$00,$22
.byte $01,$11,$00,$22,$01,$0A,$00,$36
.byte $01,$5F,$00,$01,$00,$00,$01,$00
.byte $80,$24,$43,$1F,$41,$00,$00,$00
.byte $00,$00,$00,$00,$00,$14,$00,$00
.byte $7D,$FF,$7F,$BC,$7F,$00,$00,$FF
.byte $97,$0A,$11,$03,$00,$00,$00,$00
.byte $00,$00,$00,$00,$B8,$0B,$70,$17
.byte $28,$23,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$64,$01,$01,$00,$00,$00
.byte $00,$80,$0E,$3C,$AD,$16,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$FF,$7F,$FF,$7F,$00,$00
.byte $FF,$7F,$15,$05,$03,$00,$00,$00
.byte $00,$00,$00,$00,$00,$B8,$0B,$70
.byte $17,$28,$23,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$64,$00,$01,$00,$00
.byte $00,$00,$80,$24,$43,$1F,$41,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$FF,$7F,$FF,$7F,$00
.byte $00,$FF,$7F,$16,$1F,$03,$00,$00
.byte $00,$00,$00,$00,$00,$00,$B8,$0B
.byte $70,$17,$28,$23,$1F,$00,$22,$01
.byte $12,$00,$5E,$01,$0C,$00,$54,$01
.byte $03,$00,$5E,$01,$64,$00,$01,$00
.byte $00,$00,$00,$40,$8A,$42,$49,$52
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$FF,$7F,$FF,$7F
.byte $00,$00,$FF,$7F,$0D,$00,$03,$00
.byte $00,$00,$00,$68,$10,$98,$0D,$98
.byte $0D,$68,$10,$28,$23,$21,$00,$2C
.byte $01,$19,$00,$1D,$01,$42,$01,$18
.byte $01,$04,$00,$0E,$01,$64,$00,$01
.byte $00,$00,$00,$00,$80,$EB,$45,$5D
.byte $55,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$FF,$7F,$FF
.byte $7F,$00,$00,$FF,$7F,$09,$2D,$03
.byte $5E,$24,$40,$1F,$64,$19,$B8,$0B
.byte $B0,$04,$91,$05,$B8,$0B,$08,$01
.byte $1D,$00,$82,$02,$19,$00,$86,$00
.byte $10,$00,$48,$01,$0A,$00,$64,$00
.byte $01,$00,$00,$00,$01,$FF,$FC,$43
.byte $0A,$1D,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$FF,$7F
.byte $FF,$7F,$00,$00,$FF,$7F,$0C,$23
.byte $03,$00,$00,$00,$00,$00,$00,$00
.byte $00,$B8,$0B,$70,$17,$28,$23,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$64
.byte $00,$01,$00,$00,$00,$00,$FF,$10
.byte $40,$51,$40,$00,$00,$00,$00,$00
.byte $00,$5A,$00,$00,$00,$00,$00,$FF
.byte $7F,$FF,$7F,$00,$00,$FF,$7F,$0E
.byte $17,$03,$00,$00,$00,$00,$00,$00
.byte $00,$00,$B8,$0B,$70,$17,$28,$23
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $64,$00,$01,$00,$00,$00,$00,$FF
.byte $10,$40,$51,$40,$00,$00,$00,$00
.byte $00,$00,$5A,$00,$00,$00,$00,$00
.byte $FF,$7F,$FF,$7F,$00,$00,$FF,$7F
.byte $0E,$23,$03,$00,$00,$00,$00,$88
.byte $13,$7E,$04,$B8,$0B,$70,$17,$28
.byte $23,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$64,$79,$8D,$C0,$BD,$8C,$C0
.byte $68,$09,$AA,$20,$D4,$BC,$A9,$DE
.byte $20,$D5,$BC,$A9,$AA,$20,$D5,$BC
.byte $A9,$EB,$20,$D5,$BC,$18,$BD,$8E
.byte $C0,$BD,$8C,$C0,$60,$48,$4A,$05
.byte $3E,$9D,$8D,$C0,$DD,$8C,$C0,$68
.byte $EA,$EA,$EA,$09,$AA,$EA,$EA,$48
.byte $68,$9D,$8D,$C0,$DD,$8C,$C0,$60
.byte $88,$A5,$E8,$91,$A0,$94,$88,$96
.byte $E8,$91,$A0,$94,$88,$96,$91,$91
.byte $C8,$94,$D0,$96,$91,$91,$C8,$94
.byte $D0,$96,$91,$A3,$C8,$A0,$A5,$85
.byte $A4,$84,$48,$85,$49,$A0,$02,$8C
.byte $F8,$06,$A0,$04,$8C,$F8,$04,$A0
.byte $01,$B1,$48,$AA,$A0,$0F,$D1,$48
.byte $F0,$1B,$8A,$48,$B1,$48,$AA,$68
.byte $48,$91,$48,$BD,$8E,$C0,$A0,$08
.byte $BD,$8C,$C0,$DD,$8C,$C0,$D0,$F6
.byte $88,$D0,$F8,$68,$AA,$BD,$8E,$C0
.byte $BD,$8C,$C0,$A0,$08,$BD,$8C,$C0
.byte $48,$68,$48,$68,$8E,$F8,$05,$DD
.byte $8C,$C0,$D0,$03,$88,$D0,$EE,$08
.byte $BD,$89,$C0,$A0,$06,$B1,$48,$99
.byte $36,$00,$C8,$C0,$0A,$D0,$F6,$A0
.byte $03,$B1,$3C,$85,$47,$A0,$02,$B1
.byte $48,$A0,$10,$D1,$48,$F0,$06,$91
.byte $48,$28,$A0,$00,$08,$6A,$90,$05
.byte $BD,$8A,$C0,$B0,$03,$BD,$8B,$C0
.byte $66,$35,$28,$08,$D0,$0B,$A0,$07
.byte $20,$00,$BA,$88,$D0,$FA,$AE,$F8
.byte $05,$A0,$04,$B1,$48,$20,$5A,$BE
.byte $28,$D0,$11,$A4,$47,$10,$0D,$A0
.byte $12,$88,$D0,$FD,$E6,$46,$D0,$F7
.byte $E6,$47,$D0,$F3,$A0,$0C,$B1,$48
.byte $F0,$5A,$C9,$04,$F0,$58,$6A,$08
.byte $B0,$03,$20,$00,$B8,$A0,$30,$8C
.byte $78,$05,$AE,$F8,$05,$20,$44,$B9
.byte $90,$24,$CE,$78,$05,$10,$F3,$AD
.byte $78,$04,$48,$A9,$60,$20,$95,$BE
.byte $CE,$F8,$06,$F0,$28,$A9,$04,$8D
.byte $F8,$04,$A9,$00,$20,$5A,$BE,$68
.byte $20,$5A,$BE,$4C,$BC,$BD,$A4,$2E
.byte $CC,$78,$04,$F0,$1C,$AD,$78,$04
.byte $48,$98,$20,$95,$BE,$68,$CE,$F8
.byte $04,$D0,$E5,$F0,$CA,$68,$A9,$40
.byte $28,$4C,$48,$BE,$F0,$39,$4C,$AF
.byte $BE,$A0,$03,$B1,$48,$48,$A5,$2F
.byte $A0,$0E,$91,$48,$68,$F0,$08,$C5
.byte $2F,$F0,$04,$A9,$20,$D0,$E1,$A0
.byte $05,$B1,$48,$A8,$B9,$B8,$BF,$C5
.byte $2D,$D0,$97,$28,$90,$1C,$20,$DC
.byte $B8,$08,$B0,$8E,$28,$A2,$00,$86
.byte $26,$20,$C2,$B8,$AE,$F8,$05,$18
.byte $24,$38,$A0,$0D,$91,$48,$BD,$88
.byte $C0,$60,$20,$2A,$B8,$90,$F0,$A9
.byte $10,$B0,$EE,$48,$A0,$01,$B1,$3C
.byte $6A,$68,$90,$08,$0A,$20,$6B,$BE
.byte $4E,$78,$04,$60,$85,$2A,$20,$8E
.byte $BE,$B9,$78,$04,$24,$35,$30,$03
.byte $B9,$F8,$04,$8D,$78,$04,$A5,$2A
.byte $24,$35,$30,$05,$99,$F8,$04,$10
.byte $03,$99,$78,$04,$4C,$A0,$B9,$8A
.byte $4A,$4A,$4A,$4A,$A8,$60,$48,$A0
.byte $02,$B1,$48,$6A,$66,$35,$20,$8E
.byte $BE,$68,$0A,$24,$35,$30,$05,$99
.byte $F8,$04,$10,$03,$99,$78,$04,$60
.byte $A0,$03,$B1,$48,$85,$41,$A9,$AA
.byte $85,$3E,$A0,$56,$A9,$00,$85,$44
.byte $99,$FF,$BB,$88,$D0,$FA,$99,$00
.byte $BB,$88,$D0,$FA,$A9,$50,$20,$95
.byte $BE,$A9,$28,$85,$45,$A5,$44,$20
.byte $5A,$BE,$20,$0D,$BF,$A9,$08,$B0
.byte $24,$A9,$30,$8D,$78,$05,$38,$CE
.byte $78,$05,$F0,$19,$20,$44,$B9,$B0
.byte $F5,$A5,$2D,$D0,$F1,$20,$DC,$B8
.byte $B0,$EC,$E6,$44,$A5,$44,$C9,$23
.byte $90,$D3,$18,$90,$05,$A0,$0D,$91
.byte $48,$38,$BD,$88,$C0,$60,$A9,$00
.byte $85,$3F,$A0,$80,$D0,$02,$A4,$45
.byte $20,$56,$BC,$B0,$6B,$20,$2A,$B8
.byte $B0,$66,$E6,$3F,$A5,$3F,$C9,$10
.byte $90,$EC,$A0,$0F,$84,$3F,$A9,$30
.byte $8D,$78,$05,$99,$A8,$BF,$88,$10
.byte $FA,$A4,$45,$20,$87,$BF,$20,$87
.byte $BF,$20,$87,$BF,$48,$68,$EA,$88
.byte $D0,$F1,$20,$44,$B9,$B0,$23,$A5
.byte $2D,$F0,$15,$A9,$10,$C5,$45,$A5
.byte $45,$E9,$01,$85,$45,$C9,$05,$B0
.byte $11,$38,$60,$20,$44,$B9,$B0,$05
.byte $20,$DC,$B8,$90,$1C,$CE,$78,$05
.byte $D0,$F1,$20,$44,$B9,$B0,$0B,$A5
.byte $2D,$C9,$0F,$D0,$05,$20,$DC,$B8
.byte $90,$8C,$CE,$78,$05,$D0,$EB,$38
.byte $60,$A4,$2D,$B9,$A8,$BF,$30,$DD
.byte $A9,$FF,$99,$A8,$BF,$C6,$3F,$10
.byte $CA,$A5,$44,$D0,$0A,$A5,$45,$C9
.byte $10,$90,$E5,$C6,$45,$C6,$45,$18
.byte $60,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte $FF,$00,$0D,$0B,$09,$07,$05,$03
.byte $01,$0E,$0C,$0A,$08,$06,$04,$02
.byte $0F,$20,$93,$FE,$AD,$81,$C0,$AD
.byte $81,$C0,$A9,$00,$8D,$00,$E0,$4C
.byte $44,$B7,$00,$00,$00,$8D,$63,$AA
.byte $8D