n2ram.asm
The engine's work area. Download · All the source
; ------------------------------------------------------------------ RAM; The net2-style evaluator's work area: 8 pages from WORK (a page; boundary), WORK2NEED bytes from WORK2 (anywhere uncontended), and the; parts from WORK3, WORK4 and WORK5 (below), which the includer sets. Boards are 64 bytes: a side's points 1 to 24 (0 to 23), bar (24); and checkers borne off (25), and at +32 the other side's from its own; side.NLA equ 8 ; candidates looked at, at most (n2choose.asm)NREPLY equ 1 ; the opponent's replies scored a rollBSIZE equ 26 ; a dense layer's block: tmplend - tmpl (n2net.asm; ; the builders check it)W equ WORK+$000 ; the move generator's board (at a page)ROOT equ WORK+$040 ; the position to play fromROOT2 equ WORK+$080 ; a candidate's position, the opponent on rollTOP2 equ WORK+$0c0 ; a list (below) of the opponent's replies (NREPLY)LOGZ equ WORK+$0d6 ; the 6 logits (16-bit)EVV equ WORK+$0e2 ; the outcomes' weights for the evaluationVW equ WORK+$0e8 ; the outcomes' weights (money; set per score)SPW equ WORK+$0ee ; the chances of the side last evaluated (stats), ; and eq0's and ply1's: of winning, and the extra ; points of gammons won and lost (3 x 2, 8192 for 1)SBEST equ WORK+$0f4 ; ply1: a roll's chances after the play taken (3 x 2)STEPS equ WORK+$100 ; per step of the play being generated: point, hit ; (at a page)GDIE equ WORK+$108 ; the die of each stepKEY equ WORK+$10c ; a play's hashNEWSTEPS equ WORK+$110 ; a play's steps: 4 points ($ff after the last), 4 diceWINSTEPS equ WORK+$118 ; a play kept by `hcount` / `hreply`REC equ WORK+$120 ; per step: its transformer rows (a count, then ; address and 1 to add or 0 to take away, 4 at most)VARS equ WORK+$160 ; single variables (below), to VARSENDPAIRS equ WORK+$1e0 ; the pair products (F/2 bytes)EVACC equ WORK+$200 ; the accumulators being evaluated (F 16-bit, in a ; page)ACC2 equ WORK+$280 ; ROOT's, from the opponent's side; then a ; candidate's, from the side on roll at ROOTSC99 equ EVACC ; the filter's best 99 scores (only before ACC2)HSTAMP equ WORK+$300 ; plays of a non-double generated: a stamp, then ; their hash's 4 bytes, a page eachWORKEND equ WORK+$800RESULT equ W ; the chosen play's positionRTAB equ WORK2 ; hash values: 51 of 4 bytesBLK equ RTAB+204 ; the dense layer's blocks: NB x BSIZE + 3blocks equ BLK ; (for the profile)WORK2NEED equ 204+NB*BSIZE+3WORK2END equ WORK2+WORK2NEED; and from WORK3, WORK4 and WORK5 (anywhere: little used, they may be in; contended memory), their sizes WORK3NEED to WORK5NEED:TOPC equ WORK3 ; lists: count, capacity, then 10 bytes each (NLA)P1LIST equ TOPC+40 ; ply1's plays (P1KEEP, n2cube.asm): decide's TOPC is ; idle then (the game's cube rule keeps 40 bytes below)WORK3NEED equ 2+10*NLAH1 equ WORK4 ; the heads' hidden outputs (L1, L2 bytes)H2 equ H1+N2_L1WORK4NEED equ N2_L1+N2_L2PART equ WORK5 ; a dense layer's partial sums (16-bit each)WORK5NEED equ 2*(N2_L1|N2_L2) ; (at least the larger layer's outputs); Variables: the move generator'sGROOT equ VARS+0 ; the board being generated from (2)GCOUNT equ VARS+2 ; plays generated (2)GSP equ VARS+4 ; the stack to leave the search with (2)LEAFFN equ VARS+6 ; the move generator's handler of a play (2)USERFN equ VARS+8 ; the caller's (2)GTARGET equ VARS+10GMAX equ VARS+11GEMIT equ VARS+12GDOUBLE equ VARS+13GMAXA equ VARS+14GENID equ VARS+15 ; the move generator's search numberDHI equ VARS+16 ; the dice, larger firstDLO equ VARS+17GKEYED equ VARS+18 ; plays hashedGPRUNE equ VARS+19 ; second-order plays repeating the first skipped; the filter and the steps' rowsFSUMC equ VARS+20 ; the filter's sums of W, the mover's view: contact (2)FSUMR equ VARS+22 ; race (2)FS0C equ VARS+24 ; and of the board gen starts from (2 + 2)FS0R equ VARS+26FHIT equ VARS+28FFROM equ VARS+29FDIE equ VARS+30RECP equ VARS+31 ; (2)GREC equ VARS+33 ; record the steps' transformer rows; the chooserWIN equ VARS+34 ; a play bearing off the last checker was seenTHRON equ VARS+37 ; only the filter's best 99 are scoredTHR equ VARS+38 ; the 99th best filter score (2)NEED equ VARS+40 ; plays of that score to takeEQN equ VARS+41 ; taken so farSCN equ VARS+42 ; SC99's countLSZ equ VARS+43 ; a list's entry sizeSPENT equ VARS+44 ; the decision's work by the cost model (4)ST equ VARS+48 ; SPENT before the lookahead (4)BL equ VARS+52 ; the budget's two sides (4 + 4)BR equ VARS+56PSUM equ ST ; ply1: its chances' sums over the rolls (3 x 3; in ; decide's ST, BL and BR)TOTAL equ VARS+60 ; a candidate's sum over the rolls (4)BEST equ VARS+64 ; (4)CJ equ VARS+68 ; the candidate looked atNCAND equ VARS+69 ; candidatesBESTI equ VARS+70RWORST equ VARS+71 ; the opponent's choice so far (2)RCNT equ VARS+73SCANB equ VARS+74 ; scan: the board's half (2)SCANR equ VARS+76 ; its viewSCANFN equ VARS+77 ; (2); the evaluationEVON equ VARS+81 ; the side on roll's half of a board (2)EVOTH equ VARS+83 ; the other side's (2)EHEAD equ VARS+85 ; the head's first layer (2)DX equ VARS+87 ; dense: inputs (2)DN equ VARS+89 ; their countDW equ VARS+90 ; the rows (2)DL equ VARS+92 ; outputsDY equ VARS+93 ; where they go (2)DT equ VARS+95 ; their shifts (2)DMODE equ VARS+97 ; 0 hidden (bytes), 1 logits (16-bit)DPASS equ VARS+98 ; passes so farDLASTF equ VARS+99 ; 0 on the last passDXP equ VARS+100 ; the inputs left: where (2)DBC equ VARS+102 ; how many, and their place (2)DCNT equ VARS+104 ; outputs leftDJP equ VARS+105 ; the block ending the pass (2)SPSAVE equ VARS+110 ; (2)NUM equ VARS+112 ; the equity's numerator (3)PJ equ VARS+115 ; pairs: the unitPU equ VARS+116DEN equ VARS+117 ; the equity's denominator (2)RES equ VARS+119 ; eq0's and ply1's equity (3)VARSEND equ VARS+122OPPOFF equ 32PA equ ROOT2 ; (encode.asm's `contact`, not used)PB equ ROOT2+OPPOFF